IDT/IRQ problems
- moondeck
- Member
- Posts: 56
- Joined: Sat Dec 19, 2015 12:18 pm
- Libera.chat IRC: moondeck
- Location: The Zone, Chernobyl
IDT/IRQ problems
So, i have made my IDT setup, tried to fill it with entries, and my ISR code contains an "iret" instruction.
when i run "qemu-system-i386 -kernel kernel.mkern -d in_asm -no-reboot" i see that it stops execution at iret, and then crashes. No such problem occurs when i replace it with "ret".
Could anyone please help me with this?
Code here (irq.c, idt.c and irq.asm files in the arch/i386/ directory):
https://github.com/m00nd3ck/hydrogen
sorry if this is something really stupid
when i run "qemu-system-i386 -kernel kernel.mkern -d in_asm -no-reboot" i see that it stops execution at iret, and then crashes. No such problem occurs when i replace it with "ret".
Could anyone please help me with this?
Code here (irq.c, idt.c and irq.asm files in the arch/i386/ directory):
https://github.com/m00nd3ck/hydrogen
sorry if this is something really stupid
My operating system https://github.com/moondeck/hydrogen/
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: IDT/IRQ problems
Have you tried running it in Bochs yet? The log will give you lots of information about what's going wrong, and you might even be able to figure it out just from that. Post it here if you can't figure it out.
Have you verified that the code you're copying from tutorials is actually correct? Most tutorials have bugs.
Have you verified that the code you're copying from tutorials is actually correct? Most tutorials have bugs.
- moondeck
- Member
- Posts: 56
- Joined: Sat Dec 19, 2015 12:18 pm
- Libera.chat IRC: moondeck
- Location: The Zone, Chernobyl
Re: IDT/IRQ problems
I didnt try to run it in bochs, i could not figure it out, so i've used QEMU.Octocontrabass wrote:Have you tried running it in Bochs yet? The log will give you lots of information about what's going wrong, and you might even be able to figure it out just from that. Post it here if you can't figure it out.
Have you verified that the code you're copying from tutorials is actually correct? Most tutorials have bugs.
Also, yes, i did verify that, but most of my code is actually self-written, i've only used tutorials/manuals as starting points. The ISR code is not copied from anywhere.
My operating system https://github.com/moondeck/hydrogen/
- moondeck
- Member
- Posts: 56
- Joined: Sat Dec 19, 2015 12:18 pm
- Libera.chat IRC: moondeck
- Location: The Zone, Chernobyl
Re: IDT/IRQ problems
last lines of the QEMU logs are:
Code: Select all
IN: idt_install
0x001001b7: add $0x10,%esp
0x001001ba: call 0x100119
----------------
IN:
0x00100119: pusha
0x0010011a: cld
0x0010011b: call 0x100377
----------------
IN: isr
0x00100377: push %ebp
0x00100378: mov %esp,%ebp
0x0010037a: sub $0x8,%esp
0x0010037d: sub $0x8,%esp
0x00100380: push $0x20
0x00100382: push $0x20
0x00100384: call 0x100493
----------------
IN: outb
0x00100493: push %ebp
0x00100494: mov %esp,%ebp
0x00100496: sub $0x8,%esp
0x00100499: mov 0x8(%ebp),%edx
0x0010049c: mov 0xc(%ebp),%eax
0x0010049f: mov %dx,-0x4(%ebp)
0x001004a3: mov %al,-0x8(%ebp)
0x001004a6: movzwl -0x4(%ebp),%edx
0x001004aa: movzbl -0x8(%ebp),%eax
0x001004ae: out %al,(%dx)
0x001004af: nop
0x001004b0: leave
0x001004b1: ret
----------------
IN: isr
0x00100389: add $0x10,%esp
0x0010038c: nop
0x0010038d: leave
0x0010038e: ret
----------------
IN:
0x00100120: popa
0x00100121: iret
My operating system https://github.com/moondeck/hydrogen/
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: IDT/IRQ problems
You have one function that starts with the "pusha" instruction. What is it? Where is it referenced in idt_install? How is it supposed to be referenced in idt_install?moondeck wrote:Code: Select all
IN: idt_install 0x001001b7: add $0x10,%esp 0x001001ba: call 0x100119 ---------------- IN: 0x00100119: pusha
- moondeck
- Member
- Posts: 56
- Joined: Sat Dec 19, 2015 12:18 pm
- Libera.chat IRC: moondeck
- Location: The Zone, Chernobyl
Re: IDT/IRQ problems
The only instruction with "pusha" that is referenced in idt_install is:Octocontrabass wrote:You have one function that starts with the "pusha" instruction. What is it? Where is it referenced in idt_install? How is it supposed to be referenced in idt_install?moondeck wrote:Code: Select all
IN: idt_install 0x001001b7: add $0x10,%esp 0x001001ba: call 0x100119 ---------------- IN: 0x00100119: pusha
Code: Select all
idt_set_gate(0x20,(unsigned)interrupt(),0x08,0x8E);
My operating system https://github.com/moondeck/hydrogen/
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: IDT/IRQ problems
Yes. What is that code supposed to do? What is it actually doing?
- moondeck
- Member
- Posts: 56
- Joined: Sat Dec 19, 2015 12:18 pm
- Libera.chat IRC: moondeck
- Location: The Zone, Chernobyl
Re: IDT/IRQ problems
Its supposed to put the address of an ISR into an IDT entry, but now that i look at it, it does not do itOctocontrabass wrote:Yes. What is that code supposed to do? What is it actually doing?
How can i do it then? I've tried :
Code: Select all
idt_set_gate(0x20,&nterrupt(),0x08,0x8E);
My operating system https://github.com/moondeck/hydrogen/
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: IDT/IRQ problems
That sounds like a question for Google.