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
Strange double fault after "sti"
Re: Strange double fault after "sti"
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.
EDIT: I'm confused because the double fault isn't fired from a fixed location.
Last edited by torshie on Mon Aug 29, 2011 3:03 am, edited 1 time in total.
Re: Strange double fault after "sti"
I think it's in the error code? (Not sure)
- xenos
- Member
- Posts: 1121
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Strange double fault after "sti"
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"
got only one line from bochs log, not much help,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.
CPU 0: Interrupt 0x08 occured (error_code=0x0000)
- xenos
- Member
- Posts: 1121
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Strange double fault after "sti"
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"
And why exactly do you consider this of not much help?torshie wrote:got only one line from bochs log, not much help, :(
CPU 0: Interrupt 0x08 occured (error_code=0x0000)
JAL
- Combuster
- 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: Strange double fault after "sti"
Given the symptoms, I'm pretty sure the OP missed the FAQ