Hi all,
Just wondering what your thoughts on what ring to run interrupt handlers. I guess it really depends on who uses them the most ring0 or ring3, or maybe even a mixture.
Anyway, what are your thoughts?
thanks.
What Ring for IDT Handlers?
Re:What Ring for IDT Handlers?
Personally speaking unless there's an absolutely overwhelming need for something to be operating in ring 0 it gets dumped as far down the protection rings as possible (Generally into ring 3). I do that because I'm bound to slip up writing the code somewhere along the line (If not already ), and if I do I'd prefer buggy code to be limited to user space.
Curufir
Curufir
Re:What Ring for IDT Handlers?
OK, so I have been reading the manuals and they say that I cannot be in kernel mode (ring0) and exectue interrupt or exception handlers in user mode (ring3), so how do I run my IDT handlers while I am in kernel mode?
thanks.
thanks.
Re:What Ring for IDT Handlers?
You put your IDT handlers in ring 0.
I generally agree with Curufir on this, that system services should be in the lowest ring necessary (for stability, security, etc.). But I think that interrupt handlers should definitely be in ring 0, although there's no reason why those ring 0 handlers can't pass the interrupts to ring 3 if necessary.
I generally agree with Curufir on this, that system services should be in the lowest ring necessary (for stability, security, etc.). But I think that interrupt handlers should definitely be in ring 0, although there's no reason why those ring 0 handlers can't pass the interrupts to ring 3 if necessary.
Re:What Ring for IDT Handlers?
Thanks Tim and Curufir,
So how would I pass the interrupts onto to Ring 3, say for instance the user program has requested to handle an interrupt, how do I pass it to the program after the system has done what it needs to do with it?
Is it just a matter of calling the handler? (However this seems to easy, considering the would need to be a priviledge change)
If this question takes alot to explain just leave it and I will work it out from the manuals, even though your experience would be very beneficial and appreciated.
thanks again.
So how would I pass the interrupts onto to Ring 3, say for instance the user program has requested to handle an interrupt, how do I pass it to the program after the system has done what it needs to do with it?
Is it just a matter of calling the handler? (However this seems to easy, considering the would need to be a priviledge change)
If this question takes alot to explain just leave it and I will work it out from the manuals, even though your experience would be very beneficial and appreciated.
thanks again.
Re:What Ring for IDT Handlers?
Well, that depends on your design, but it's not as easy as calling ring 3 from ring 0: if you did that, then you'd be running the ring 3 code from ring 0.
You'll generally need to implement some inter-process communication system which will allow the kernel to notify whichever user-mode process that asked to be notified about a particular interrupt. See the OpenBLT sources for details.
You'll generally need to implement some inter-process communication system which will allow the kernel to notify whichever user-mode process that asked to be notified about a particular interrupt. See the OpenBLT sources for details.