Page 1 of 1
Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Fri Nov 23, 2012 7:22 pm
by nixeagle
There are
several posts around here that mention this specification. Sadly
Google is failing to find any references to it at all.
This supposedly covers information on what the BIOS is
supposed to initialize various registers to and I'm thinking it might have some other historical goodies.
Does it still exist? If so, how can I go about getting a copy?
P.S - Yes I'm well aware that BIOS implementations suck and that their authors generally take any specification as a "suggestion".
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Fri Nov 23, 2012 7:40 pm
by bluemoon
Since there are so many versions of BIOS, including buggy one, the general idea is the assume the minimum condition necessary to boot the OS (or boot manager).
This include:
1. The MBR, at least 512 bytes, is loaded from the booting media
2. The MBR is executed at linear address 00007C00 in real address mode, while CS:IP is not necessary to be exactly 0000:7C00 - use a far jump to fix that.
3. DL holds the drive ID of the boot media, which can be use for subsequent INT 0x13 functions
4. BIOS services are callable (ie. it won't crash by doing INT 0x13), but may return fail or "feature not supported"
5. The stack may be barely enough to handle IRQ, the MBR should setup its own stack asap with sane size.
6. It's preferably to disable interrupt until the OS setup proper handler.
The above 6 points is sufficient for most boot sequence, and the OS should assume nothing else and (re-)initialize all things it use.
nixeagle wrote:information on what the BIOS is supposed to initialize various registers
Basically, DL holds the boot media handle, all other registers are irrelevant.
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Fri Nov 23, 2012 7:52 pm
by nixeagle
Yea, thanks for the summary, short, brief and to the point. You almost ought to toss that up on the wiki as an overview on bootloader requirements. I'm not actually stuck writing a bootloader here. Mine has been done for years ;). What I'm curious about is what spec the BIOS writers are supposed to be meeting. I want to know this for two reasons; my own curiosity and to try and save some history.
Long story short, I already know all about the what, I want to know why and how we got here. I think obtaining a copy of this specification might allow me to answer some deeper questions I've had for a while.
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Fri Nov 23, 2012 8:16 pm
by bluemoon
A quick search get these:
http://en.wikipedia.org/wiki/BIOS#BIOS_ ... cification
The above links to
https://www.acpica.org/documentation/re ... uments.php
Which contain the related document:
BIOS Boot Specification (Version 1.01, 11 January 1996)
Interestingly, it recommend boot code for only two things:
D.1 USE DL FOR DRIVE NUMBER
D.2 INT 18H ON BOOT FAILURE
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Fri Nov 23, 2012 8:28 pm
by Brendan
Hi,
nixeagle wrote:There are
several posts around here that mention this specification. Sadly
Google is failing to find any references to it at all.
As far as I can tell this specification describes an interface between an MBR (which is not part of any BIOS) and a second stage boot loader (which is not part of any BIOS); and is not something that any BIOS has ever supported or will ever support.
I would assume that egos (and one or more other people) are writing an OS, and during the design of this OS they decided to do things properly and create specifications for (at least parts of) their OS; and then (once they had specification/s and working code) realised that other people might be able to use parts of it and provided
their MBR to anyone interested; but (as far as I can tell) never posted any of their specifications (or any other documentation) on this site.
Of course there are other OS development sites; and it's possible that their specification/s were made available on a different site. However, I'd assume that if it was posted in English somewhere then Google would've found it, and therefore I'd assume that if it was posted somewhere else it wasn't in English (for example, maybe it was posted on an Arabic forum and is actually called "مواصفات الثانوية محمل التمهيد").
nixeagle wrote:Does it still exist? If so, how can I go about getting a copy?
I'd ask egos for a copy of his specification (he is a regular here and you could just send him a PM).
Cheers,
Brendan
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Fri Nov 23, 2012 8:33 pm
by nixeagle
Nice Google-fu! Unfortunately I'm not sure that is what I'm looking for. That is the boot loader specification, I'm looking for a specification titled "Secondary Loader Boot Specification", revision 3. If you click the OSdev forum links I provided in the original post, you will see this specification quoted by name.
Also the posts mentioning this specification seem to infer more information about the BIOS/Bootloader interface than this spec seems to give. I might be wrong though...
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Fri Nov 23, 2012 8:40 pm
by nixeagle
Brendan wrote:
As far as I can tell this specification describes an interface between an MBR (which is not part of any BIOS) and a second stage boot loader (which is not part of any BIOS); and is not something that any BIOS has ever supported or will ever support.
I would assume that egos (and one or more other people) are writing an OS, and during the design of this OS they decided to do things properly and create specifications for (at least parts of) their OS; and then (once they had specification/s and working code) realised that other people might be able to use parts of it and provided
their MBR to anyone interested; but (as far as I can tell) never posted any of their specifications (or any other documentation) on this site.
That actually kinda makes sense. I hooked onto the last bit of that post and assumed the specification was something more general. It is rather uncommon for hobby operating systems to have specifications!
Assuming your guess is correct, I'll have to keep digging. Seems like so much of the pre-history is lost or extremely hard to get at. To be clear, I'm curious on some of the design decisions and rationale for same that were made way back when.
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Fri Nov 23, 2012 9:11 pm
by Brendan
Hi,
nixeagle wrote:Assuming your guess is correct, I'll have to keep digging. Seems like so much of the pre-history is lost or extremely hard to get at. To be clear, I'm curious on some of the design decisions and rationale for same that were made way back when.
I not too sure exactly what you're looking for; but I have a feeling it never existed. Things like technical references and specifications say how things are (or how things should be) and never really say why. You'd probably need to find one of maybe 10 people that worked on the firmware for the original
IBM PC, or perhaps articles from old magazines (this was a time before the internet existed). The only other way to figure out why various design decisions were made is to take an educated guess or rely on other people's (hopefully educated) guesses.
Cheers,
Brendan
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Sat Nov 24, 2012 2:09 am
by egos
Sorry, it's internal document of our company. I can give link to the web version, but the Spec. exists only in Russian.
nixeagle wrote:That is the boot loader specification, I'm looking for a specification titled "Secondary Loader Boot Specification", revision 3. If you click the OSdev forum links I provided in the original post, you will see this specification quoted by name.
I'm sorry again for my mispoint. Maybe will be more right: "Secondary Loader's Boot Specification".
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Sat Nov 24, 2012 8:34 am
by Owen
If you're looking for how a traditional MBR invokes a VBR... this is something that seems informally specified (read: DOS did it, therefore it stuck, with some evolution). Therefore, the places to look would appear to be people who implement compatible MBRs and VBRs.
Syslinux and
FreeDOS would appear to be good places to start.
Looking at Syslinux' MBR, it would appear that
- The [es:di] PNPBIOS vector should be preserved
- The BIOS drive number in dl should be the drive from which the boot sector was loaded (this may be different from the drive from which the MBR was booted in the case of e.g. a complex chainloader like GRUB/Syslinux)
- [ds:si] points to the MBR entry corresponding to the partition
Conventionally, the MBR relocates itself to 0x0600, so you should avoid touching the following 512 bytes until you have a copy of the data you need (suggest quickly copying ds:si to some memory you "own")
There is no standard for GPT systems (hell, there isn't a defined standard for any of this), but Syslinux has (I think) adopted the convention of putting 0x54504721 ("!GPT") in EAX to specify a GPT boot, simulating an MBR entry for the partition (where possible) at DS:SI, and then following this with a DWORD indicating the length of the GPT entry, followed by the GPT entry.
Likewise, MBR type codes are full (and many conflict, etc, etc). If you're creating a new MBR partition, I suggest taking advantage of the OS/2 "installable file system" partition format (which is also used by Windows for NTFS)
Re: Copy of "Secondary Loader Boot Specification Rev.3"
Posted: Sat Nov 24, 2012 9:21 am
by egos
Owen wrote:- The [es:di] PNPBIOS vector should be preserved
MBR boot loaders usually do not make this.
There is no standard for GPT systems (hell, there isn't a defined standard for any of this), but Syslinux has (I think) adopted the convention of putting 0x54504721 ("!GPT") in EAX to specify a GPT boot, simulating an MBR entry for the partition (where possible) at DS:SI, and then following this with a DWORD indicating the length of the GPT entry, followed by the GPT entry.
This interface was described in EDD draft. My MBR boot loaders pass in AX any value other than "!G" for this reason (usually 0xAA55, but I think about supporting Yoda's interface, so a "magic number" can be other than 0xAA55 in some future versions). I think this interface is not reliable, so perhaps I will expand it in my GPT boot loader.