I am fairly new to the level of programming required for osdev and was wondering if I am missing something stupid in the following problem:
I am following many different tutorials and am always getting stuck at one point: protected mode.
My code currently reads as follows (an extract):
Code: Select all
cli
mov al, 2 ; set bit 2 (enable a20)
out 0x92, al
call InstallGDT
jmp 0x1000 : Stage3
Stage3:
mov eax, cr0 ; set bit 0 in CR0-go to pmode
or eax, 1
mov cr0, eax
hlt
1) That jump statement. I am told by numerous sources that it should be jmp 0x08 for my GDT and ds. However implementing this results in a triple fault. (I am loaded at 0x10000)
2) The order of my commands. Should I be jumping before setting cr0 or after? Jumping after gave a fault. Also, when should I enable A20?
3) Am I actually in pmode by the hlt statement???
I understand if you get impatient with my questions which may have obvious solutions but I have trawled the web and consulted tutorials 'till I was blue in the face. Everything they suggested ran into triple faults when I ran it. This suggests another alternative. Is there anything I need to know about setting up bochs that may help?
Any help would be much appreciated.
Thanks.