Page 1 of 1

Strange double fault after "sti"

Posted: Mon Aug 29, 2011 1:45 am
by torshie
My kernel works in 64-bit mode, after loading the interrupt descriptor table, I set the interrupt flag with "sti". A few (the number varies) instructions after the "sti" instruction, the CPU would fire a double fault. If I simply "iretq" return from the double fault, everything works just fine. Tested on qemu, bochs and physical machine.
Anyone knows the possible cause of the double fault ?

Thanks
-torshie

Re: Strange double fault after "sti"

Posted: Mon Aug 29, 2011 2:56 am
by torshie
I know the cause of the double fault. But how can I find out the first interrupt the CPU trying to handle ?

EDIT: I'm confused because the double fault isn't fired from a fixed location.

Re: Strange double fault after "sti"

Posted: Mon Aug 29, 2011 3:01 am
by Nessphoro
I think it's in the error code? (Not sure)

Re: Strange double fault after "sti"

Posted: Mon Aug 29, 2011 3:02 am
by xenos
Since this happens right after enabling interrupts, it is very likely a hardware interrupt. It you run your code in Bochs, the log file should tell you what's going on.

Re: Strange double fault after "sti"

Posted: Mon Aug 29, 2011 3:35 am
by torshie
XenOS wrote:Since this happens right after enabling interrupts, it is very likely a hardware interrupt. It you run your code in Bochs, the log file should tell you what's going on.
got only one line from bochs log, not much help, :(

CPU 0: Interrupt 0x08 occured (error_code=0x0000)

Re: Strange double fault after "sti"

Posted: Mon Aug 29, 2011 5:25 am
by xenos
You could try to increase the CPU debug level. When Bochs is running, hit the "config" button, "log options for individual devices", "CPU0", "debug", "report". This should give you a lot more output.

Re: Strange double fault after "sti"

Posted: Mon Sep 05, 2011 9:30 am
by jal
torshie wrote:got only one line from bochs log, not much help, :(
CPU 0: Interrupt 0x08 occured (error_code=0x0000)
And why exactly do you consider this of not much help?


JAL

Re: Strange double fault after "sti"

Posted: Mon Sep 05, 2011 11:14 am
by Combuster
Given the symptoms, I'm pretty sure the OP missed the FAQ