[SOLVED]PIT interrupt not firing, but IPI work
Posted: Tue Feb 24, 2026 8:33 am
I'm currently developing an OS for x86_64. The PIT has been registered through the IOAPIC (GSI 0, IDT vector 34). When the TSC calls it, it uses one-shot mode with a 30ms timeout. The PIC has been masked, and the PIT has also registered the IDT vector and set up a callback.
During debugging, I set the PIT to mode 2 with an initial value and looped to print the PIT counter. The values decreased gradually, so the PIT counter appears to be working. I also tried changing the polarity when registering with the IOAPIC, but it didn't help. I added another debug check: after writing to the IOAPIC, the PIT initialization code verifies the written values and prints them – they are all correct.
However, for some reason, the interrupt just won't fire. Currently, IPI-triggered interrupts work fine.
My GitHub repository: https://github.com/shizi297/ShiziOS
Tag: pit-bug
Tagged repository link: https://github.com/shizi297/ShiziOS/tree/pit-bug
I'm using QEMU, with the specific configuration in the "run" target of the root CMakeLists.txt file.
During debugging, I set the PIT to mode 2 with an initial value and looped to print the PIT counter. The values decreased gradually, so the PIT counter appears to be working. I also tried changing the polarity when registering with the IOAPIC, but it didn't help. I added another debug check: after writing to the IOAPIC, the PIT initialization code verifies the written values and prints them – they are all correct.
However, for some reason, the interrupt just won't fire. Currently, IPI-triggered interrupts work fine.
My GitHub repository: https://github.com/shizi297/ShiziOS
Tag: pit-bug
Tagged repository link: https://github.com/shizi297/ShiziOS/tree/pit-bug
I'm using QEMU, with the specific configuration in the "run" target of the root CMakeLists.txt file.