https://github.com/ApplePieCodes/lithium
Acording to my irq0, my OS should be printing Tick and Tock when the irq0 is triggered. It doesn't seem too.
PIC not working
-
- Member
- Posts: 5695
- Joined: Mon Mar 25, 2013 7:01 pm
Re: PIC not working
What is the value of RFLAGS when you expect the first IRQ0 to arrive?
-
- Member
- Posts: 197
- Joined: Tue Aug 26, 2008 11:24 am
- GitHub: https://github.com/sebihepp
Re: PIC not working
The problem with your code on github is that you create idt_table_desc on the stack in function idt_reload() - once the function returns, the stack get overwritten by following functions and when the cpu is reading that descriptor later it gets garbage (random values based on which time it reads your descriptor).
-
- Member
- Posts: 5695
- Joined: Mon Mar 25, 2013 7:01 pm
-
- Member
- Posts: 813
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: PIC not working
Octo is correct in asking this. If you use the QEMU monitor you can do `info registers` while your kernel is in an infnite loop. If bit 9 in RFLAGS isn't set then interrupts are off and you won't receive them.Octocontrabass wrote: ↑Thu Feb 06, 2025 11:19 am What is the value of RFLAGS when you expect the first IRQ0 to arrive?
Upon looking at the code you don't actually enable interrupts. After you setup your interrupt handlers/idt you can use this to enable them
Code: Select all
__asm__ ("sti" ::: "memory");