/* real.S - real mode code */ #define ASM 1 #include .code16 .data .globl gdtdesc, _gdtdesc gdtdesc: .word 0 .long gdt gdt: /* Allocate some bytes here, set them in protected mode code */ .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 .text .globl enter_protmode, _enter_protmode enter_protmode: _enter_protmode: movl $gdt, %eax lgdt (%eax) movl %cr0, %eax orl $(CR0_PE),%eax movl %eax,%cr0 xorw %ax,%ax movw %ax,%gs movw %ax,%fs movw %ax,%es movw $(SEG_KERN_DATA),%ax movw %ax,%ds movw $(SEG_KERN_CODE),%ax shlw $4,%ax addl $protmode_entry, %eax ljmpl *(%eax) .code32 .text .extern multiboot_entry protmode_entry: _protmode_entry: jmp multiboot_entry