I have some problems getting interrupts to work properly.
Whenever an interrupt fires (I am using the int instruction to test this), qemu simply crashes with this message:
Code: Select all
qemu-system-i386 -kernel kernel.bin
KVM internal error. Suberror: 1
emulation failure
EAX=00101001 EBX=00009500 ECX=000b8000 EDX=000b801e
ESI=00000000 EDI=00108000 EBP=001069f8 ESP=001069e0
EIP=00100094 EFL=00000202 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
CS =0008 00000000 ffffffff 00c09b00 DPL=0 CS32 [-RA]
SS =0010 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
DS =0010 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
FS =0010 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
GS =0010 00000000 ffffffff 00c09300 DPL=0 DS [-WA]
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT= 00106a08 00000017
IDT= 22000000 000007ff
CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
DR6=ffff0ff0 DR7=00000400
EFER=0000000000000000
Code=ff ff ff e8 c2 00 00 00 c7 04 24 00 10 10 00 e8 91 00 00 00 <cc> c7 04 24 11 10 10 00 e8 84 00 00 00 eb 01 90 c9 c3 66 90 55 89 e5 83 ec 14 8b 45 08 88
I am hosting my kernel on github, so you can easily check it out: https://github.com/Xandaros/Geranium-Du ... ree/faulty
loader.S is the initial file, kmain resides in kernel.c.
The other relevant files are idt.c to setup the IDT; interrupt.c, which contains the interrupt handler(s) and isr.S, which contains the initial assembly handlers, before they get passed to the C handler.
Any idea what could be causing this?
I have tried to use bochs, too, but that doesn't even work properly if I take out the interrupts and just HLTs right away... (with enabled interrupts it triple-faults)
I hope you can help me with this.
If you need more information, please tell me.
Edit: Oh yes... I am using Linux (3.5.0-25-generic x86_64) and I am using a cross-compiler to generate 32bit elf files.