Page 1 of 1

Some confusion about interrupt redirection

Posted: Tue Apr 23, 2013 11:17 am
by 16bitPM
Hello,

I'm sure it's practically a trivial question, but I'm still a bit confused.
The wiki says (right here):

Code: Select all

   uint16_t selector; // a code segment selector in GDT or LDT
Does this mean that interrupt redirection can be done in partial by the CPU? I mean, suppose you wanted your programs to have access to the BOUND exception, could I just set up the IDT to make it point to a fixed LDT entry (which, of course, should be present in all LDT's). So every time a task switch occurs, the BOUND (INT5) vector would potentially point to another piece of code, let's say set up by a user-callable kernel function. This would also mean the LDT selector could be set up to point to CPL=3 code, avoiding privilege switching.

And yet, if I recall correctly, most OSes do the redirection by hand. Why?

So ehrm, comments are welcome.

Re: Some confusion about interrupt redirection

Posted: Tue Apr 23, 2013 12:02 pm
by bluemoon
Note that, "The processor does not permit transfer of execution to an exception- or interrupt-handler procedure in a less privileged code segment (numerically greater privilege level) than the CPL."

So if your exception handler are with CPL=3, things can be messly for kernel exceptions.

Re: Some confusion about interrupt redirection

Posted: Sat Apr 27, 2013 6:32 am
by 16bitPM
bluemoon wrote:Note that, "The processor does not permit transfer of execution to an exception- or interrupt-handler procedure in a less privileged code segment (numerically greater privilege level) than the CPL."

So if your exception handler are with CPL=3, things can be messly for kernel exceptions.
Yes, you are right of course. But I still could make it point to the LDT :-)