This time I'm trying to go into 32bit protected mode.
But it seems like the code below crashes in virtualbox.
Can anyone spot the problem?
Code to enter protected mode:
Code: Select all
cli
lgdt [GDT]
mov eax, cr0
or al, 1
mov cr0, eax
jmp 0x08:PMode ; Enter Protected Mode!
Code: Select all
gdt_data:
dd 0 ; null descriptor
dd 0
dw 0FFFFh ; limit low
dw 0 ; base low
db 0 ; base middle
db 10011010b ; access
db 11001111b ; granularity
db 0 ; base high
dw 0FFFFh ; limit low (Same as code)
dw 0 ; base low
db 0 ; base middle
db 10010010b ; access
db 11001111b ; granularity
db 0 ; base high
end_of_gdt:
GDT:
dw end_of_gdt - gdt_data - 1 ; limit (Size of GDT)
dd gdt_data ; base of GDT
Code: Select all
[bits 32]
PMode:
mov ax, 0x10
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
hlt
jmp $
VirtualBox - Guru Meditation
A critical error has occured while running the virtual machine and the machine execution has been stopped.
Btw I'm using nasm to assemble!