From: Phillip Susi <psusi@cfl.rr.com>
To: "linux-os (Dick Johnson)" <linux-os@analogic.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Seewer Philippe <philippe.seewer@bfh.ch>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: RFC: disk geometry via sysfs
Date: Thu, 16 Feb 2006 14:55:23 -0500 [thread overview]
Message-ID: <43F4D8AB.7020208@cfl.rr.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0602161316100.23547@chaos.analogic.com>
linux-os (Dick Johnson) wrote:
>
> You sure are interested in arguing. The translation cannot be wrong
> because the BIOS invented the translation which was created when
> the BIOS did a "read capacity." That translation is stored in the
> BIOS as a BPB, not on the disk, and it is accessed by any file-
> systems that use the 16-bit Int 0x13 interface. If the file-
> systems are not broken, they will NOT use the wrong translation
> because they will read the current interpretation by reading
> the BPB from the vector represented by int 0x64, or by executing
> Int 0x13, function code 8 (read drive parameters). These parameters
> are INVENTED upon startup as previously explained.
>
The BPB is stored in the MBR by fdisk. The MBR also contains CHS sector
addresses for the location of the partitions on the disk. fdisk
computes those addresses by translating the LBA into CHS using a
geometry. If the bios is using a different geometry then those CHS
addresses that the boot loader will request the bios to load will have a
completely different meaning, so the loader won't get the intended sector.
> As previously explained, the fake geometry is not geometry at
> all, but rather a translation key that was decided upon
> startup after the capacity was determined. Its sole purpose
> is to get a sector-offset through the limited register-set
> in the 0x13 interface.
>
Yes, I've been saying it is a translation key the whole time. The bios
uses it to figure out what sector you are referencing in int 13, and
fdisk uses it to figure out what CHS values correspond to a given LBA so
it can store them in the MBR. If they don't both use the same
translation key, they aren't both speaking the same language, and so the
boot loader will break.
> [FS offset]--->[encode KEY]--->[INT 0x13]--->[decode KEY]--->[drive offset]
> | |
> |-- anything that will fit ---|
>
> This encode/decode key should have never been let out of its cage.
> Unfortunately some DOS tools put it on the disks in a table
> called the BPB.
>
And fdisk must also perform the encode so the partition table can
correctly indicate where the partition begins. The boot loader passes
those values to the bios which decodes them. The encode and decode must
both be done using the same key.
> DOS creates two software interrupt vectors, int 0x25, and
> int 0x26, (absolute read and write), which perform this
> translation using the stuff in the BPB. This means that
> the caller (the file-system) doesn't have to worry about
> these things.
>
We aren't talking about dos's filesystem here, we're talking about the
windows ( or dos ) boot loader which directly uses int 13 and passes the
CHS values from the MBR. The meaning of those values is entirely
dependent on the geometry, so when fdisk writes those values to the MBR
it has to be using the same geometry that the bios will use to decode
it, otherwise when the sector address of the partition is encoded using
one geometry, and decoded using another, it will come out all wrong.
> Since the offsets are directly available when the BIOS is not
> used, this BPB is useless.
>
The boot loader is directly using the bios.
> Even when using dosemu, where a virtual 0x13 is available, the
> key used to access this resource is obtained by reading the
> capacity of the DOS file-system(s) and building a BPB for
> each (virtual) disk.
>
next prev parent reply other threads:[~2006-02-16 19:56 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-10 13:06 RFC: disk geometry via sysfs Seewer Philippe
2006-02-13 9:56 ` Bartlomiej Zolnierkiewicz
2006-02-15 7:57 ` Seewer Philippe
2006-02-13 16:32 ` Phillip Susi
2006-02-13 19:02 ` Seewer Philippe
2006-02-13 19:22 ` linux-os (Dick Johnson)
2006-02-13 19:36 ` Phillip Susi
2006-02-14 16:35 ` Seewer Philippe
2006-02-13 19:34 ` Phillip Susi
[not found] ` <43F206E7.70601@bfh.ch>
2006-02-14 18:19 ` Phillip Susi
2006-02-15 8:39 ` Seewer Philippe
2006-02-15 8:51 ` Bartlomiej Zolnierkiewicz
2006-02-15 9:01 ` Seewer Philippe
2006-02-15 14:06 ` Alan Cox
2006-02-15 14:11 ` Seewer Philippe
2006-02-15 15:15 ` Alan Cox
2006-02-15 15:29 ` Phillip Susi
2006-02-16 8:12 ` Seewer Philippe
2006-02-16 15:36 ` Phillip Susi
2006-02-16 15:41 ` Seewer Philippe
2006-02-16 16:15 ` Phillip Susi
2006-02-15 15:20 ` Phillip Susi
2006-02-15 16:06 ` Alan Cox
2006-02-15 16:20 ` Phillip Susi
2006-02-15 17:32 ` Alan Cox
2006-02-15 18:43 ` Phillip Susi
2006-02-15 19:23 ` linux-os (Dick Johnson)
2006-02-15 20:54 ` Phillip Susi
2006-02-15 21:41 ` linux-os (Dick Johnson)
2006-02-15 22:43 ` Phillip Susi
2006-02-16 12:33 ` linux-os (Dick Johnson)
2006-02-16 15:26 ` Phillip Susi
2006-02-16 16:15 ` Seewer Philippe
2006-02-16 17:01 ` Phillip Susi
2006-02-16 16:39 ` linux-os (Dick Johnson)
2006-02-16 17:09 ` Phillip Susi
2006-02-16 19:01 ` linux-os (Dick Johnson)
2006-02-16 19:55 ` Phillip Susi [this message]
2006-02-16 8:18 ` Seewer Philippe
2006-02-16 18:14 ` Matt Domsch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43F4D8AB.7020208@cfl.rr.com \
--to=psusi@cfl.rr.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bzolnier@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=philippe.seewer@bfh.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox