BIOS and BOOTSECTCPU power-on to 16-bit real mode Hardware logic design for power-on Instantaneous force settings:Cs=0xf000,ip=0xfff0,cs:ip=0xffff0 and the entry address of the BIOS program is0xffff0Is the address of the first instruction that the CPU executes after the computer is power on the BIOS program in-Memory load interrupt vector table and interrupt service program call int 0x19 interrupt, the first sector of the floppy disk (0 side 0 Tracks 1 sectors) 512 bytes is bootsect.s loaded into the Ram 0X07C00 BOOTSECT.S copy itself to 0x90000~0x90200,ds:si-es:direp instructions Repeat 256 times, one copy 4 bytes is double word, after the end of the copy is skipped, the jump specified the segment and the offset (the intra-segment offset is actually unchanged) call int 0x13 Interrupt , the SETUP.S corresponding program loaded into the 0x90200, a total of four sectors 2K again through the int 0x13 interrupt, the system is loaded into the 0x10000 to check the root device and then jump to setup.s the first line of instructions visible, bootsect is mainly to carry out the loading work The first thing in the Setupsetup program is to use the BIOS Interrupt service program to load machine system data in the original bootsect location (overwrite), 0x90000~0x901fd, only 2 bytes off interrupt before Setup, Copy system from 0x10000 to 0x00000 set Global descriptor Descriptor (for future LDT and TSS) and interrupt descriptor, GDT--Gdtr,idt-IDTR,Note: Setup.s starting from 0x92000, the GDT is offset relative to 0x90000 to addOpen A20 for 32-bit addressingEstablish a protection mode interrupt mechanism, set the interrupt controller 8259A, retain the internal non-shielded interrupt 0x00~0x1f, remap the interrupt number, IRQ0 for 0x20 will control register CR0 the No. 0 bit PE 1, Turn on Protected mode (after which you want to jump to the address of the GDT from the 1-point of the GDT) to start execution, i.e. Head.s reference: "The art of Linux kernel design"
Bootsect and Setup