Page 1 of 1

interrupt emitted when I enable maskable interrupts

Posted: Tue Dec 04, 2018 7:30 am
by DridriLaBastos
Hi, I am early in the development of a little kernel, and I am already facing something I don't know how to solve.

I want to enable interrupts but when the line "sti" is executed there is always an interrupt emitted and I don't know why. I set up the IDT to call interrupt handlers that display the interrupt vector of the handler on the screen when it is executed.

I verified with Bochs that everything was well configured by looking what it thought my GDT and IDT was, and watching bits per bits these tables on the RAM, and it was. At least, it was configured the way I want it to be, it may be the wrong way :oops:

When I execute my kernel with Bochs, it always displays me a "(8)" (VirtualBox too) when maskable interrupts are enabled. 8 is for double fault so I tried to run my (tiny little)kernel on real hardware to have more info and I came up with this result "(15)(15)(15)(8)(15)" (photo of the result : https://www.cjoint.com/c/HLenjb7VIDv). An Intel reserved exception is causing the double fault. Well... That won't help me a lot

If somebody can look at my code to tell me what I am doing wrong I will really appreciate it. I have surely misunderstood something but, after about a month of investigations, I can't find it. The code is at https://github.com/DridriLaBastos/Beetl ... -idt-issue

Re: interrupt emitted when I enable maskable interrupts

Posted: Tue Dec 04, 2018 7:52 am
by mallard
I can't see any code in your repository to remap/mask IRQs from the PIC. Thanks to the rather slapdash design of the original IBM PC, by default, the IRQ mappings conflict with the CPU exception interrupts (while these exceptions didn't exist when the PC was designed, the interrupt vectors were always documented as "reserved" by Intel).

As such, I suspect your "double fault" is actually IRQ 0 - the system timer. Interrupt 15 is IRQ 7, which is known to produce "spurious" interrupts on real hardware.

The wiki contains details of how to remap the PIC and mask IRQs.

Re: interrupt emitted when I enable maskable interrupts

Posted: Tue Dec 04, 2018 9:38 am
by DridriLaBastos
mallard wrote:As such, I suspect your "double fault" is actually IRQ 0 - the system timer. Interrupt 15 is IRQ 7, which is known to produce "spurious" interrupts on real hardware.
You were right, I tried to disable the PICs for testing purposes, and then nothing happened on both bochs and real hardware, thank you very much =D>

I am only working with Intel IA32 manual, it's my mistake