Issue with the IDT
Posted: Fri Feb 19, 2010 8:15 pm
I'm reading JamesM's tutorial to get familiar with the concepts of a kernel, and I got to the end of chapter four and then tested interrupts. It does work, and my handler gets called and returns, but for some reason, I'm constantly getting int 0x0D. Now, I know you've had this question before, because I read the answers, as well as the Intel manual (vol. 3A chapter 6) and the relevant section in Ralph Brown's interrupt list, so I know what the problem is... roughly. From what I've read, I can gather that int 0xD means I've got a problem with my IDT or GDT. I only get this problem when I call an interupt (in the tutorial ints 0x3 and 0x4 are called, so I called them), so it's almost certainly not my GDT. I thought I'd mention all that to show I have done my homework, and I do try to solve my problems by myself
At first this was funny:
(that's printed again and again, until QEMU dies*)
but now it's just annoying, because I know it's probably some really small error somewhere in some obscure file. I haven't copied the tutorial code exactly (I don't know why, but I can't bare to do that; I always have to change something), but I haven't changed the relevant code very much... I've also checked mine against that in the tutorial, and I can't find what I've done wrong.
*QEMU produces this error:
In the ISR handler, all the segments get loaded to 10 except CS (which stays at 0008); but shouldn't they get changed back to whatever they were already? I don't know, but I don't think the stack segment and data segment should be in the same place, should they?
Could someone give me some advice as to what might be causing this? It's almost certainly the IDT causing the problem, but I can't figure out what that problem is. If I need to post any thing, e.g. code, etc. tell me.
Thank you
At first this was funny:
(that's printed again and again, until QEMU dies*)
but now it's just annoying, because I know it's probably some really small error somewhere in some obscure file. I haven't copied the tutorial code exactly (I don't know why, but I can't bare to do that; I always have to change something), but I haven't changed the relevant code very much... I've also checked mine against that in the tutorial, and I can't find what I've done wrong.
*QEMU produces this error:
Do you think it's to do withqemu: fatal: Trying to execute code outside RAM or ROM at 0x20636e75
EAX=00000000 EBX=6574726f ECX=00000000 EDX=636e7566
ESI=000a2164 EDI=31746e69 EBP=46203a35 ESP=ffffd581
EIP=20636e75 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
CS =0008 00000000 ffffffff 00cf9a00 DPL=0 CS32 [-R-]
SS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
DS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
FS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
GS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT= 00104024 00000027
IDT= 0010404c 000007ff
CR0=60000011 CR2=00000000 CR3=00000000 CR4=00000000
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
DR6=ffff0ff0 DR7=00000400
CCS=0000003c CCD=00000000 CCO=LOGICL
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
?ES =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
CS =0008 00000000 ffffffff 00cf9a00 DPL=0 CS32 [-R-]
SS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
DS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
FS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
GS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA]
In the ISR handler, all the segments get loaded to 10 except CS (which stays at 0008); but shouldn't they get changed back to whatever they were already? I don't know, but I don't think the stack segment and data segment should be in the same place, should they?
Could someone give me some advice as to what might be causing this? It's almost certainly the IDT causing the problem, but I can't figure out what that problem is. If I need to post any thing, e.g. code, etc. tell me.
Thank you