HPET is enabled, but the interrupt handler is called once

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Samsonium
Posts: 2
Joined: Thu Sep 19, 2024 7:11 am

HPET is enabled, but the interrupt handler is called once

Post by Samsonium »

Hello, everyone!

I recently finished with ACPI parsing and successfully got LAPIC, IO APIC addresses and now trying to get HPET or PIT working (if HPET is not available). However, despite spending several days debugging and re-reading the wiki articles several times, I still can't get either timer to work. When running from HPET, the interrupt is called once and then fails. When using PIT, the handler is not called at all.

My guess is that the problem is probably either in how the IRQ is routed through the APIC IO, or in acknowledgement

Here is my code for this part of operating system:
ACPI: header, source
Timer: source

PS in the given links not all the content is indicated, as the files are quite large and I have given the necessary parts for easier reading
sebihepp
Member
Member
Posts: 186
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: HPET is enabled, but the interrupt handler is called once

Post by sebihepp »

Declare the variable ticks as volatile - maybe the compiler optimizes it away.
User avatar
GoingNuts
Posts: 3
Joined: Fri Jun 17, 2022 7:36 pm
Libera.chat IRC: GoingNuts

Re: HPET is enabled, but the interrupt handler is called once

Post by GoingNuts »

Been using HPET for a couple of years but all in assembly, why do you have to declare your own Frequency?, did you re-map all IRQs in accordance to Maximum Redirection Entry?
Octocontrabass
Member
Member
Posts: 5577
Joined: Mon Mar 25, 2013 7:01 pm

Re: HPET is enabled, but the interrupt handler is called once

Post by Octocontrabass »

Why does hpet_eoi write to the APIC EOI register twice?

Why do you route PIT interrupts through the PICs and HPET interrupts through the APICs?

Are you trying to use PICs and APICs at the same time?

Which virtual machine are you using? QEMU has monitor commands ("info pic" and "info lapic") you can use to check the interrupt controllers.

What is the CPU doing when the second interrupt is supposed to arrive? Are interrupts enabled?
Post Reply