Looking for a BIOS manual

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
osa1
Posts: 3
Joined: Tue Nov 01, 2016 8:32 pm
Libera.chat IRC: osa1

Looking for a BIOS manual

Post 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.
User avatar
crunch
Member
Member
Posts: 81
Joined: Wed Aug 31, 2016 9:53 pm
Libera.chat IRC: crunch
Location: San Diego, CA

Re: Looking for a BIOS manual

Post by crunch »

Here's an article from the wiki that is relevant: http://wiki.osdev.org/System_Initialization_(x86)
osa1
Posts: 3
Joined: Tue Nov 01, 2016 8:32 pm
Libera.chat IRC: osa1

Re: Looking for a BIOS manual

Post 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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Looking for a BIOS manual

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Octocontrabass
Member
Member
Posts: 5587
Joined: Mon Mar 25, 2013 7:01 pm

Re: Looking for a BIOS manual

Post 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.
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: Looking for a BIOS manual

Post by Roman »

You may be interested in Ralf Brown's interrupt list.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
osa1
Posts: 3
Joined: Tue Nov 01, 2016 8:32 pm
Libera.chat IRC: osa1

Re: Looking for a BIOS manual

Post 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?
Octocontrabass
Member
Member
Posts: 5587
Joined: Mon Mar 25, 2013 7:01 pm

Re: Looking for a BIOS manual

Post 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.
osa1 wrote:I'm wondering if I should be using UEFI instead. The specs are online: http://www.uefi.org/specifications. Any ideas?
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.
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: Looking for a BIOS manual

Post by bzt »

osa1 wrote:I'm wondering if I should be using UEFI instead. The specs are online: http://www.uefi.org/specifications. Any ideas?
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
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Looking for a BIOS manual

Post 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.
Post Reply