Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
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
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
well
if you send the compilede data, i could take a greater look at it ..
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
gdt:
dq 0
desc 0x80000, (0x100000000-0x80000)/0x1000-1, DF_CODE or DF_DUALACTION or DF_USE32 or DF_PAGED
desc 0x80000, (0x100000000-0x80000)/0x1000-1, DF_DATA or DF_DUALACTION or DF_USE32 or DF_PAGED
The selector 8 is correct for data segment registers if the code segment (that it selects) is readable. Loading of data segment registers depends on CS.CPL, therefore to initialize cs firstly is more right.
If you have seen bad English in my words, tell me what's wrong, please.
...and CS.CPL is zero in real mode so it doesn't matter anyway
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]