Microkernel - asynchronous interrupt handling
Posted: Thu May 15, 2014 2:22 am
Hey!
I couldn't find a topic about this yet (if there is one, please let me know): asynchronous interrupt handling. I'm writing a pure microkernel, therefore I want all drivers to run in userspace (I'm working with the PIC currently). So I have to somehow tell a process that an interrupt has happend. Here are the ways I figured out:
- Redirecting: the driver user process could register itself as an interrupt handling process for a specific interrupt number and provide the address of a handling function. When the interrupt occurs, the kernel would push the current EIP of the userspace process to the user stack, and then set it to that interrupt handling function. Then when returning to userspace, the interrupt handling function does its work when "return"ing it would take the old EIP from it's stack and continue its work. This could work in theory, but it seems to be a really ugly thing to do..
- Messaging: when an interrupt occurs, a message is sent to the process (or to a port as in my system). The process would then have to continuously check if there is a message waiting, what would waste performance. Same thing with..
- Polling: when an interrupt occurs, the kernel itself memorizes that this interrupt has happened. The process must then also continuously poll the kernel via a syscall if that interrupt has happend.. also bad.
What do you think about these ways? Also, how do you solve this in your systems (and when do you ACK)?
Thank you!
Greets, Max
I couldn't find a topic about this yet (if there is one, please let me know): asynchronous interrupt handling. I'm writing a pure microkernel, therefore I want all drivers to run in userspace (I'm working with the PIC currently). So I have to somehow tell a process that an interrupt has happend. Here are the ways I figured out:
- Redirecting: the driver user process could register itself as an interrupt handling process for a specific interrupt number and provide the address of a handling function. When the interrupt occurs, the kernel would push the current EIP of the userspace process to the user stack, and then set it to that interrupt handling function. Then when returning to userspace, the interrupt handling function does its work when "return"ing it would take the old EIP from it's stack and continue its work. This could work in theory, but it seems to be a really ugly thing to do..
- Messaging: when an interrupt occurs, a message is sent to the process (or to a port as in my system). The process would then have to continuously check if there is a message waiting, what would waste performance. Same thing with..
- Polling: when an interrupt occurs, the kernel itself memorizes that this interrupt has happened. The process must then also continuously poll the kernel via a syscall if that interrupt has happend.. also bad.
What do you think about these ways? Also, how do you solve this in your systems (and when do you ACK)?
Thank you!
Greets, Max