// initialization with biso
set eip, 0xfffffff0 // points to code to be executed by the processor.
// if (physic memory < 4G) hardware translate to BIOS memory block, jmp POST;
// POST(power on self test): memory check, system bus check, low-level initialization, select boot device
// int 0x19: the int 0x19 handler reads 512 bytes from the first sector of boot device into the memory at address 0x7c00
set cr0, 0 // control register cr0's PE bit, indicates whether the processor is run.ning in 32-bit protected mode or 16-bit real mode
// | pg | 000000000000000 | 00000000000 | et | ts | em | mp | pe | cr 0.
// current running in real mode, because backwards compatibility / bios running in real mode / service provided bios
// mbr program
// boot0 copy itself to address 0x600
// boot0.s complile as boot.img (master boot record)
// boot0 scan partition stable, let the user choose which partition to boot from.
mbr(master boot record) struct:
0 440 444 446 510 512
| code |flag|null| dpt info|flag|
| | |
(select disk flag) | (vaild flag)
|
(1 1 6 8 byte)
_______________________________
(descriptor table information)
1 |
f1|f2| chs format | lba format
|
2 | ... |
3 | ... |
4 |
_______________________________|
f1(file system type) f2(bootable flag)
chs(sylinder/head/sector): first and last coordinates (end with 0xaa55).
lba(logic block addr): partition stable start position and length
(end with 0xaa55)
.