2 # Switch from protected mode to real mode and jump to setup.S
3 # image located at %cx:0.
5 # This module must be placed into physical memory at 0:7C00h.
6 # EFI has some real mode thunking code at 2000:0h.
8 # Processor and non-maskable interrupts should be disabled
9 # before control is passed to this module.
18 # Load identity mapped GDT & real mode IDT.
19 # Add 7C00h to the addresses since this is linked to start
20 # at 0h and it is being placed at 7C00h.
23 lgdt %cs:gdt_48 + 0x7C00
24 lidt %cs:idt_48 + 0x7C00
27 # Turn off PG bit in CR0 and set CR3 to zero.
31 andl $0x7FFFFFFF, %eax
39 # Now we add 7B00h because we need to force the segment
40 # address and selector to be the same.
44 .long pm_reload + 0x7B00
52 # Reload DS, ES, FS, GS & SS.
63 # Switch to real mode. Clear PE bit in CR0.
67 andl $0xFFFFFFFE, %eax
75 .word rm_reload + 0x7C00
89 # Start running setup.S
97 # GDT & IDT stuff for switching into real mode.
100 gdt: .word 0, 0, 0, 0 # unused (00h)
101 .word 0, 0, 0, 0 # dummy (08h)
102 .word 0xFFFF, 0x100 # code (10h)
104 .word 0xFFFF, 0x180 # data (18h)
107 gdt_48: .word 0x08 * 0x400
114 # Be careful not to exceed 1F0h or the the bootsect.S
115 # parameters will be lost!