Page 1 of 1
Looking for a BIOS manual
Posted: Tue Nov 01, 2016 8:46 pm
by osa1
Hi everyone,
I'm just getting started so sorry if the question doesn't make sense. I've been reading a little bit on bootloaders and I'm very confused. Different sources explain the BIOS bootloader story differently, and most of the resources are so old I'm not even sure if what they're describing is relevant anymore. I'm talking about tutorials and lecture notes (which usually use some kind of ancient CPU) that google lists in the first few pages.
I tried searching for "BIOS manual" and some similar words but Google just returns motherboard manufacturers' BIOS user manuals, rather than the BIOS bootloader specs etc.
What I'm looking for is an _up to date_ manual on BIOS bootloading, e.g. where does BIOS look for bootloaders, what are the initial registers, CPU modes etc. on entry to the bootloader etc. I'm not looking for how BIOS used to work on ancient systems with 64KB RAM etc. I'm looking for how BIOS on, say, my Thinkpad T440p with a x86_64 CPU, works.
Any help would be very appreciated.
Re: Looking for a BIOS manual
Posted: Tue Nov 01, 2016 9:25 pm
by crunch
Here's an article from the wiki that is relevant:
http://wiki.osdev.org/System_Initialization_(x86)
Re: Looking for a BIOS manual
Posted: Tue Nov 01, 2016 9:32 pm
by osa1
Thanks.. There are certainly some good resources (like Wikipedia), but I'm looking for some official specs. I'm surprised that it's this hard to find.
Re: Looking for a BIOS manual
Posted: Tue Nov 01, 2016 11:33 pm
by Brendan
Hi,
osa1 wrote:Thanks.. There are certainly some good resources (like Wikipedia), but I'm looking for some official specs. I'm surprised that it's this hard to find.
Sadly, there is no official "BIOS specification" that covers everything. Mostly IBM created the original one (as closed source) thinking that the PC would be dead soon anyway; then other companies reverse engineered IBM's BIOS to create clones; then (over time) various extensions got slapped on top.
However, for booting (and probably nothing else) you might get some useful information in a document called "BIOS Boot Specification". Please note that (despite its title) this document is not intended for OS developers (and doesn't document BIOS functions that an OS might use during boot); and is mostly intended for firmware developers and hardware manufacturers (e.g. so that "option ROMs" built into add-on cards that plug into ISA and PCI slots can be compatible with a computer's firmware).
Cheers,
Brendan
Re: Looking for a BIOS manual
Posted: Wed Nov 02, 2016 1:25 am
by Octocontrabass
osa1 wrote:What I'm looking for is an _up to date_ manual on BIOS bootloading,
As Brendan already mentioned, there isn't one and there never has been.
osa1 wrote:where does BIOS look for bootloaders,
For hard disks, floppy disks, and devices that can be emulated as one of the two (e.g. USB flash drives), it looks at the first sector of the disk. For CDs, it follows the
El Torito specification. Of course, older hardware will support fewer of these things, or have more bugs in the implementation.
osa1 wrote:what are the initial registers,
The only register with a defined initial value is DL, which is the disk number for INT 0x13. All other registers are undefined, even CS and IP.
osa1 wrote:CPU modes
Real mode.
osa1 wrote:I'm not looking for how BIOS used to work on ancient systems with 64KB RAM etc. I'm looking for how BIOS on, say, my Thinkpad T440p with a x86_64 CPU, works.
They work the same. That's why an IBM PC 5150 with 64kB of RAM and your Thinkpad T440p can both boot MS-DOS 6.22.
Re: Looking for a BIOS manual
Posted: Wed Nov 02, 2016 5:09 am
by Roman
You may be interested in Ralf Brown's interrupt list.
Re: Looking for a BIOS manual
Posted: Wed Nov 02, 2016 6:42 am
by osa1
Thanks all for all the answers.
So this is a bit sad for me because I'm a beginner and I don't want, at this point, to gather information from unofficial sources as I'll probably have enough problems at hand. I'm wondering if I should be using UEFI instead. The specs are online:
http://www.uefi.org/specifications. Any ideas?
Re: Looking for a BIOS manual
Posted: Wed Nov 02, 2016 8:00 am
by Octocontrabass
osa1 wrote:So this is a bit sad for me because I'm a beginner and I don't want, at this point, to gather information from unofficial sources as I'll probably have enough problems at hand.
A lot of the information you need does have official sources, it's just not officially gathered in one place. The basics are in IBM's PC manuals (the ones with complete BIOS source code). For modern hard disks, look to the BIOS EDD Services. For CDs and such, you want the El Torito Bootable CD Specification.
PCs are moving towards being exclusively UEFI, so it's a good idea to have a UEFI bootloader. Unfortunately, I haven't started writing one yet, so I can't tell you how it compares to writing a BIOS bootloader.
Re: Looking for a BIOS manual
Posted: Wed Nov 02, 2016 4:26 pm
by bzt
I've written a loader for BIOS, MultiBoot and UEFI, see my latest loader's source here:
https://github.com/bztsrc/osz/tree/master/loader
I'd say it's safe to skip BIOS entirely and focus only on UEFI. The EFI SDK is a real bloated mess, but you can use GNUEFI which is much much clearer and simpler to work with.
If you insist on non-EFI boot, you should consider MultiBoot imho.
bzt
Re: Looking for a BIOS manual
Posted: Wed Nov 02, 2016 5:00 pm
by Kazinsal
AMD is a *lot* better at documenting this kind of thing than Intel is when it comes to writing chipset initialization firmware. For AMD stuff, check out the BIOS and Kernel Developer Guides on the
AMD Developer Guides site. I think Intel has a much more brief overview of their equivalent available somewhere but I'm not sure where.