>On 2002-01-15 22:01:09, crazysurfmonkey wrote:
>Ok for the pass three days i have tried to get this stupid bootsector to work but it causes a triple fault every single time I try to switch to protected mode! WHAT THE HELL IS WRONG WITH THIS CODE! here is my whole program written to be compiled in NASM:
>Can anybody help me!
PMODE is a pain!
Looks awfully familiar...
Usually, it's an IDT/GDT problem. I don't have the
intel specs on me, so I can't check that, but there
are a couple possibilities...
>
> ; Switch to pmode
> lidt[ds:idtReg]
> lgdt[ds:gdtReg]
The ds: is irrelavent. I never used it in my
code and it worked fine.
> mov eax, cr0
> or al, 1
> mov cr0, eax
add the following:
jmp stuff
nop
nop
nop
stuff:
I don't claim to understand why that's needed. I thought
your jump below was enough to clear the pre-fetch
queue, but I seem to recall needed this.
I'm a little rusty, I must admit... I wrote my
boot code years ago (which you seemed to have
adopted
> jmp ME_SEL:pmode ; far jump
you might need to code that in asm, in case
nasm is fudging that into a 16 bit jump...
db 0xea
dd pmode
dw ME_SEL
>gdtReg:
> dw GDT_END - GDT - 1
> dd 0x9000*16+0xFD00+GDT
+ 0xFD00? What's that all about?
>codeSel:
> dw 0xFFFF
> dw 0
> db 0
> db 0x9A
> db 0xC0
> db 0
Uhm... this is probably your problem right here, dude.
At the end of your code, you loop with a jump to
CODE_SEL:repeat. CODE_SEL is a descriptor for
a memory block starting at 0x0, and your code hasn't
been moved there... it's still at 0x90000!!!!
Jeff