IDT query

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
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

IDT query

Post by Neo »

I have a question on ISR's and IDT handling. When we load an ISR into the IDT the Selector contains a offset address. Now my question is this "is the offset address the address of our handler routine or is it the address where we are going to load out handler routine?".If it is the latter then does it mean that when we give an ISR an offset address in the IDT will the routine automatically be placed in that address if not then what should i do to relocate the handler at that address?. Thank in advance.
also is it better to have the ISR's in a separate segment?
Only Human
Therx

Re:IDT query

Post by Therx »

The offset address is the address of the handler. You don't need to relocate it. If you just load the address of a certain function into the IDT structure at runtime then it will all be 'good'. And if I were you I'd keep you GDT to just five segments (NULL, ring0 code, ring0 data, ring3 code, ring3 data) because then you can control the whole address space through paging. The selector for the ISR will mostly be ring0 code, (may be ring3 code for some syscalls maybe?)

Pete
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:IDT query

Post by Neo »

Thanks for the info could you elaborate the last part of what you said about some syscalls needing ring3? :-\
Only Human
Therx

Re:IDT query

Post by Therx »

They wouldn't 'need' ring 3 but there might be some which didn't need full kernel priviledges and it may be quicker if it doesn't have to ring0 and back.

This is a guess really, could somebody further on it development prove me wrong (or, if i'm lucky right)

Pete
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:IDT query

Post by Pype.Clicker »

i would be tempted to say that if something does not need to be executed at ring 0, then it should rather be in a standard library rather than called through a system call ...

now, on the other side, interrupt handlers can be an option to access library functions, but it seems like "using an uzi to kill a fly" to me.
Post Reply