Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

State of Registers After Bootup

Tags:

boot

bios

I'm working on a boot loader on an x86 machine.

When the BIOS copies the contents of the MBR to 0x7c00 and jumps to that address, is there a standard meaning to the contents of the registers? Do the registers have standard values?

I know that the segment registers are typically set to 0, but will sometimes be 0x7c0. What about the other hardware registers?

like image 807
Terry Avatar asked Aug 21 '08 15:08

Terry


3 Answers

This early execution environment is highly implementation defined, meaning the implementation of your particular BIOS. Never make any assumptions on the contents of registers. They might be initialized to 0, but they might contain a random value just as well.

from the OS dev Wiki, which is where I get information when I'm playing with my toy OS's

like image 186
sparkes Avatar answered Nov 09 '22 14:11

sparkes


Best option would be to assume nothing. If they have meaning, you will find that from the other side when you need the information they provide.

like image 1
BCS Avatar answered Nov 09 '22 15:11

BCS


Undefined, I believe? I think it depends on the mainboard and CPU, and should be treated as random for your own good.

like image 1
wvdschel Avatar answered Nov 09 '22 15:11

wvdschel