I have some problems switching to protected mode.
This code is loaded at segment 0x1000 and starts execution at start
GDT:
.word 0, 0, 0, 0
.word 0xffff
.word 0x0000 /* boot segment 0x1000 */
.word 0x9a01
.word 0x0040
.word 0xffff
.word 0x0000
.word 0x9c01
.word 0x0040
GDTR:
.word 19, 0, 0
start:
.byte 0x66
mov $GDT, %eax
.byte 0x67 /* address prefix */
.byte 0x66 /* data prefix */
movl %eax, GDTR + 2
cli
.byte 0x67, 0x66
lgdt GDTR
mov %cr0, %eax
.byte 0x66
or $1, %eax
mov %eax, %cr0
.byte 0x66
ljmp $0x08, $prot
prot:
movw $0x10, %ax
mov %ax, %ds
mov %ax, %ss
mov %ax, %es
This (nicely ?) reboots my machine.
What is wrong. Thank you for your help.
Nicolas