[Solved]My IDT appears to get broken when I call 'sti'!
Posted: Wed Aug 20, 2014 6:51 am
Hello,
I am having a probem with getting interruts working that I just cant figure.
My kernel sets up the GDT and IDT correctly: If I run the code below with line 27 and 29 of kernel.c commented out, the kernel works fine with no tripple faut, then using 'info gdt' and 'info idt' in bochs I can see that the GDT and IDT are well formed and contain the exact data I expect.
However, if I uncomment either line 27(kernel.c) or line 29 (kernel.c). Which are 'asm("sti");' and test1()(a function call that calls into kernel.asm with the two lines 'int 1' and 'ret').
I immediately get a tripple fault.
the tripple fault goes like so:
(excerpt from bochs.log)
As far as I can read this error, this means:
1) I get a 'opcode invalid exception' (the 0x06 vector)
2) That vector fails meaning;
3) I get a 'general protection fault exception' (the 0x0d vector)
4) That vector fails meaning;
5) I get a 'double fault exception' (the 0x08 vector)
Now usually I would except that getting any form of 'gate descriptor is not valid sys seg' error simply means my IDT is broken, however as above, I have proved the IDT is 'fine'.
So after the tripple fault I use bochs to once again 'info gdt' and 'info idt' and both are complete garbage.
I have no idea how calling either of these two small segments of code can result in both my GDT and IDT getting stomped on.
The log of the crash can be found at 'moss/bochs.log'
Thanks in advanced for everyones time.
I am having a probem with getting interruts working that I just cant figure.
My kernel sets up the GDT and IDT correctly: If I run the code below with line 27 and 29 of kernel.c commented out, the kernel works fine with no tripple faut, then using 'info gdt' and 'info idt' in bochs I can see that the GDT and IDT are well formed and contain the exact data I expect.
However, if I uncomment either line 27(kernel.c) or line 29 (kernel.c). Which are 'asm("sti");' and test1()(a function call that calls into kernel.asm with the two lines 'int 1' and 'ret').
I immediately get a tripple fault.
the tripple fault goes like so:
(excerpt from bochs.log)
Code: Select all
00084585552e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x06)
00084585552e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00084585552e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
1) I get a 'opcode invalid exception' (the 0x06 vector)
2) That vector fails meaning;
3) I get a 'general protection fault exception' (the 0x0d vector)
4) That vector fails meaning;
5) I get a 'double fault exception' (the 0x08 vector)
Now usually I would except that getting any form of 'gate descriptor is not valid sys seg' error simply means my IDT is broken, however as above, I have proved the IDT is 'fine'.
So after the tripple fault I use bochs to once again 'info gdt' and 'info idt' and both are complete garbage.
I have no idea how calling either of these two small segments of code can result in both my GDT and IDT getting stomped on.
The log of the crash can be found at 'moss/bochs.log'
Thanks in advanced for everyones time.