Error entering protected mode
Posted: Fri Oct 17, 2008 2:11 pm
Hi.
I've just modified my boot loader but now it doesn't enter protected mode. Debugging (with bochs), when the line "move cr0, eax" is executed, the next code that is executed is at address 0x0000
Maybe LGDT has an invalidad value? Does DS has to have a specified value? At the moment when I load GDT, DS = 0x8000
These are images of debug
Before loading GDT
After
This is the part of code for the gdt:
I've just modified my boot loader but now it doesn't enter protected mode. Debugging (with bochs), when the line "move cr0, eax" is executed, the next code that is executed is at address 0x0000
Maybe LGDT has an invalidad value? Does DS has to have a specified value? At the moment when I load GDT, DS = 0x8000
These are images of debug
Before loading GDT
After
This is the part of code for the gdt:
Code: Select all
cli ; Inhabilitar interrupciones
lgdt [gdt_desc] ; leer GDT
mov eax, cr0
or eax, 1
mov cr0, eax
jmp 0x08:limpiarRegistros
...
use32
...
gdt:
gdt_null:
dd 0
dd 0
gdt_code: ; segmento de codigo
dw 0x0FFFF
dw 0
db 0
db 10011010b
db 11001111b
db 0
gdt_data: ; segmento de datos
dw 0x0FFFF
dw 0
db 0
db 10010010b
db 11001111b
db 0
gdt_end: ; para calcular el tamano de la GDT
gdt_desc:
dw gdt_end - gdt - 1 ; limite
dd gdt ; direccion de la GDT