Re: Problem with protected mode jump
Posted: Mon Oct 13, 2008 2:40 pm
Well, it started to work. I think the main problem was with not loading the GDT correctly. Because of that the processor just received descriptors that were total gibberish. Here follows the new code:
As you can see there's still a lot of work to be done but now I can at least finally do the work. I'd like to thank everyone for their input. It certainly helped me a lot.
Code: Select all
LGDT [GDTDESC]
Code: Select all
[BITS 16]
main:
mov ax,0xB800
mov es,ax
mov byte[es:0],'b'
cli
xor ax,ax
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
sti
GDTDESC:
dw 0
dd 0
setGDT:
mov word[GDTDESC],0x2F
mov dword[GDTDESC + 2],0x00020096
lgdt [GDTDESC]
cli
mov eax,cr0
or eax,1
mov cr0,eax
jmp dword 0x08:0x000200FA
times 150 - ($ - $$) db 0
%include "d:\vinitech\mik\gdt006.asm"
times 250 - ($ - $$) db 0
[BITS 32]
enter_pmode:
mov eax, 0x10
mov ds,ax
.print_char:
mov byte[ds:0x000B8002],'a'
mov byte[ds:0x000B8003],0x7F
.hang:
jmp .hang
times 512 - ($ - $$) db 0