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.
Is this correct?
How do you code an isr that is going to know if a cpl change occurred or not so I can correctly get this stuff from the stack? (ie stick these regs into a threads register storage in a thread control structure for software task switching)
I see plenty of examples but none of them explain how to know whats on the stack (most just print some message and iret) and the intel docs just don't seem to clearly explain this to me.
AJ wrote:
Also, yYou don't need to check the current CS against the pushed CS - just check the lower 2 bits of the pushed CS.
Just to clarify, in case you don't know what he meant, the lower 2 bits of any segment selector is the RPL (requested privilege level) - Will be 3 for user code, 0 for kernel code.
AJ wrote:
Alternatively, if you have a custom process control structure with a flags field, you could create a flag for 'user mode'.
There could be a problem with this method. If interrupt is trigered during execution of sys. call (called from user mode code), then if you only look user-mode flag in your task structure you will PL tranisition even if it has not happened, but still it depends on what you want to do.