Subject: Re: new kpi proposal, sysdisk(9)
To: None <,>
From: Travis H. <>
List: tech-kern
Date: 02/04/2007 22:05:26
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

A bit old conversation but I had to comment as I know x86
bootstrapping quite well.  I hope we're just talking x86 and platforms
that want to understand x86-formatted hard disks, because this stuff
is way too brain-damaged to merit copying.  There are no written
standards on how it must be, so the only "authority" here is how fdisk
and Redmond software did things (and even that has not stayed static).
There is no MUST, only MAY and MAY NOT. ;-)

For details on how MS-DOS and other legacy systems interpreted the MBR:

On Wed, Jan 03, 2007 at 09:06:18PM +0000, David Laight wrote:
> It appears to be like that at first, but in fact each of the 'extended
> partitions' is only allowed to have 2 entries - one data ptn and the next
> extended one.  The data ptn is defined relative to the current 'extended
> ptn' (ie has offset 63), whereas each extended ptn is defined relative to
> the outer extended ptn.

Suffice to say that the format itself can have a number of states
whose interpretation is not intuitively obvious.  For example, you can
mark any or all partition(s) active.  You can mark any or all
partitions as extended.  Partitions can overlap.  CHS and LBA
addresses may not be equivalent (and LBA is usually ignored).  There
have been hacks for supporting partitions whos CHS cylinder numbers
are over 10 bits (set CHS to max and use LBA).  The very notion of
cylindrical coordinates in modern drives with variable-density zones
and automatic bad sector remapping is absurd.

There are some BIOS issues, which perhaps are not so irrelevant.
Basically we need to convert values for INT 13h AH=3D02h calls.  Maybe
one day they'll ditch BIOS for something more sensible (Linux-BIOS
maybe?) but until then I suppose boot loaders have little choice.

Shooting for MS-DOG compatibility is aiming very low.  If we're trying
to decide how to interpret it, let's not leave so many states
resulting in undefined behavior.  Let's support every state with
defined behavior; if other systems can't handle it, they can hardly
fault NetBSD for being better (defined as: more liberal in
interpretation, documented, fully-defined, and self-consistent).

It seems to me the limitations such as "0-1 extended partitions and
0-1 data partitions per [extended] partition table" forcing it to be a
linked-list is due to laziness on the part of Redmond boot loader
writers or perhaps to space limitations, but not any intrinsic
limitation.  If there were more than 2 entries in the extended
partition tables, they'd actually have to think about how to traverse
a tree in a deterministic manner.  That smacks of effort, apparently.
The driving force behind innovation is sublimation.
-><- <URL:>
For a good time on my UBE blacklist, email

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.2.1 (OpenBSD)