GPF and int instruction

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
jtlb
Member
Member
Posts: 29
Joined: Sat May 12, 2007 8:24 am

GPF and int instruction

Post by jtlb »

hello, my kernel is running in ring0(or at least is suppose to!). When a thread returns i make it issue an int instruction and I get a GPF with error code 0x7fa. Is that normal?? what should i do then?

thank you for your help
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:

Post by Combuster »

You're probably loading a bad segment register somewhere. Your IDT may be borked...

Have you tried debugging the code? does Bochs tell you anything special?
"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 ]
jtlb
Member
Member
Posts: 29
Joined: Sat May 12, 2007 8:24 am

Post by jtlb »

tanks for your answer.
yes i tried to debug the code. I' m also sure the segment is good and the IDT segment has been setted up the same way as the isr interrupt vector. I think that if the problem were comming from here, i would get another exeption than a GPF. Actually, the GPF occures on the "int" instruction, not while loading the handler.

I finally choose to handle it in my GPF handler near the v86 handler.
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:

Post by Combuster »

jtlb wrote:Actually, the GPF occures on the "int" instruction, not while loading the handler.
If your GPF handler points to the INT instruction, then it is indeed that instruction that causes the GPF. Given that you are in protected mode, it will always look at the IDT and try to load the corresponding entry. If if finds something unusual there the result can very easily become that the GPF handler is called because it fails to enter the normal handler.
"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 ]
jtlb
Member
Member
Posts: 29
Joined: Sat May 12, 2007 8:24 am

Post by jtlb »

No, I first detect that the app was running in non v86 mode and i then "emulate" the int instruction by calling the "C" handler directly. Of course i add 2 to the ip pointer to make it execute the next instruction
Post Reply