Page 1 of 1
Enable intterupts once in pmode
Posted: Wed Nov 15, 2006 4:21 am
by Lprogster
...
Thanks all,
Lprogster
Posted: Wed Nov 15, 2006 4:28 am
by AJ
Hi,
A few things that have caused this before in my OS:
* Have you definitely got a valid IDT?
* If in PMode is your GDT valid?
Is it possible (using Bochs or similar) to see what the register state is when the CPU triple-faults (ie, which exception number is actually causing the first exception?).
HTH
Posted: Wed Nov 15, 2006 4:38 am
by Lprogster
I am not using Bochs. Ill post the source code, would that help?
NOTE: This is probably poorly written/ unsafe!
Thanks,
Lprogster
Posted: Wed Nov 15, 2006 5:28 am
by AJ
I haven't had time to read this in detail, but does the CPU also reset if you change:
to
This will at least let you know if the area you are jumping to is causing the problem.
Sorry if I have missed something obvious but I am doing this in between other work! I am also fairly new to OS dev myself...
Adam
Posted: Wed Nov 15, 2006 5:49 am
by Lprogster
When that line is changed my OS still restarts but displays nothing on the screen first.
Thanks,
Lprogster
Re: Enable intterupts once in pmode
Posted: Wed Nov 15, 2006 6:28 am
by Brendan
Hi,
Lprogster wrote:How should I enable interrupts?
For protected mode, you must tell the CPU where to find a "32 bit compatible" IDT, then you need to either mask all IRQs or provide 32-bit protected mode IRQ handlers for anything that isn't masked.
You're doing none of this, so the first time an IRQ is received the CPU thinks there's a valid 32-bit protected mode IDT where the old (real mode only) IVT is at 0x00000000. In this case the CPU crashes trying to load the IDT entry for the IRQ (causing a double fault, then triple fault/CPU reset).
Cheers,
Brendan
Posted: Wed Nov 15, 2006 6:39 am
by Lprogster
How should I build an IDT?
Posted: Wed Nov 15, 2006 6:57 am
by AJ
For my first test kernel, I used:
http://www.osdever.net/bkerndev/index.php?the_id=90
which seems to take you through each stage step-by-step. Sorry I didn't mention the protected mode IDT - as I said, I'm fairly new to all this myself.
Adam[/url]
Posted: Wed Nov 15, 2006 9:23 am
by JAAman
get the intel manuals -- they will be a very big help, especially with the beginning where you are now
there is a link to the intel manuals in my signature, where you can download them, at the bottom of the page is a link to instructions on ordering hard-copies highly recommended, and completely free -- you need volume 3a most, but i recommend getting all 5 books
read very closely, volume 3, particularly chapters 2-5, and then you will probably want to reread them again before beginning to understand, but its very important -- the CPU is complicated, but important, and all your work is Dependant on that chip