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.
You should save/restore general purpose and segment registers within interrupt handler. And I think you will have some problems with supporting user mode while using that task switching technique.
Look at my simplified example. Maybe it will be useful for you.
of course! I use the general registers in the ISR, so clearly I need to save them before that. Saving them after that saves the modified values, like what was happening before with ESP.
It seems so obvious now, but I'm not sure if I would have ever figured that out on my own. Thank you so much for helping me out!
If you don't mind though, what do you think the problems will be with supporting user mode?
Luns wrote:If you don't mind though, what do you think the problems will be with supporting user mode?
If timer interrupt will occur in user mode then kernel stack will contain return address for user mode (user mode code selector, offset in user space) and moreover stack pointer for user mode. In this case you can't jump to the return address. I also mentioned about saving/restoring segment registers for supporting user mode because in kernel mode you should use them with specific values to be assured of their correctness.
If you have seen bad English in my words, tell me what's wrong, please.