Interrupts not working under real BIOS [SOLVED]

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.
Post Reply
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Interrupts not working under real BIOS [SOLVED]

Post by Chandra »

Hello Everyone,

I tried to implement IDT in my kernel (adapted from Bran's Kernel Development Tutorial/IDT).
I have setup the IDT and installed the keyboard and mouse handler. It was working well with both BOCHS and QEMU.
Then, I realized that I should test my kernel under real BIOS so I created floppy disk image for my OS and rebooted under my real BIOS. Then came the hiccup.
As soon as my kernel tries to setup the IDT my fault handler displays the message "General Protection Fault". I searched the forum and found that some other guys had similar problem with IDT but my problem was the "General Protection Fault".

So, if anybody knows what is causing the "General Protection Fault" when I setup the IDT, please help!
Last edited by Chandra on Wed Sep 29, 2010 8:43 pm, edited 1 time in total.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Interrupts not working under real BIOS

Post by Combuster »

Did you run the exact same floppy contents under bochs where you *can* debug? Did you zero out the memory where needed?

Statler: Did he make any attempt to narrow down the problem?
Waldorf: No, he attempted to narrow down his prose.
"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 ]
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Interrupts not working under real BIOS

Post by gerryg400 »

If you get a GPF you must look at the cs, eip and error code. The error code will tell you if a selector was involved. The cs:eip will tell you the faulting instruction. Should be easy to solve the problem from there.

By the way what do you mean by "real BIOS" ? Do you mean you tested on actual hardware ?
If a trainstation is where trains stop, what is a workstation ?
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Interrupts not working under real BIOS

Post by Chandra »

gerryg400 wrote: By the way what do you mean by "real BIOS" ? Do you mean you tested on actual hardware ?
Yes, I was trying to tell that I tested on actual hardware ( trying to use a typical term "real BIOS"...). And of course, several tests showed that the problem was actually with my bootloader GDT. As soon as I loaded the kernel, I setup another GDT and replaced my bootloader GDT which solved the problem. It's working fine now.

Thanks both of you.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Post Reply