Library for setting up RTC interrupts? #1364
-
I found I also created an issue at arceos-org/x86_rtc#2 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It's your OS, so you should probably roll your own solution. Keep in mind that interrupts should be fast, shouldn't lock and shouldn't allocate (all within reason of course). I tend to try to avoid interrupts because of those and more reasons. If you want to have dynamic interrupts (i.e. be able to register certain tasks to be called upon interrupts), you should use a lock-free, allocation free collection. Intrusive linked lists come to mind. You can either implement one on your own (it's really challenging), or use cordyceps' list. Otherwise, depending on what you mean by "setting up the interrupts", x2apic comes to mind. Note that this is not a library to set up you IDT and stuff, but it allows you to configure your IOAPIC, which essentially routes hardware interrupts to cores. If you want to have timekeeping, I'd recommend the following:
(Some information in this answer is technically inaccurate, but I think it's sufficient to build an initial understanding. If you have questions, feel free to ask. If something in this answer contradicts OsDev or some other source, OsDev is probably right. Most design decisions are yours to make, and you can't really go wrong in a hobby os - |
Beta Was this translation helpful? Give feedback.
-
I did not find a library so I added functions to arceos-org/x86_rtc#3 |
Beta Was this translation helpful? Give feedback.
I did not find a library so I added functions to arceos-org/x86_rtc#3