Yet another task switching question (Ring changes)
Posted: Sun Apr 27, 2008 4:23 pm
Hi,
This is in regards to switching from ring3 to ring0 (and back). I've been poring over some tutorials and this forum, and Intel docs, but I can't seem to wrap my head around something.
When an interrupt triggers a task switch from ring 3 to 0, the stack is switched to the kernel's stack and and all of the suspended process' registers are saved there. Ok, that's fine...
Does that mean one would then need to copy them off the stack somewhere else, then copy them back when the scheduler is about to restore the ring 3 process? I find it hard to swallow that all suspended processes' states are simply stored in one kernel stack and then left there until needed... the stack would be blown in no time.
This is the only thing I'm having trouble figuring out.
I have enabled threading support in my kernel (works a treat) but, the threads are all ring 0, so when you save their states, the values are going into their own stacks and are popped off later... but what do you do when a ring 3 process' state is saved into [one of] the kernel's ring 0 stack(s)?
My mind is boggling.......
Thanks for any help / suggestions!
P.S. I'm not looking for code, I can figure that out on my own once I understand what I'm implementing.
This is in regards to switching from ring3 to ring0 (and back). I've been poring over some tutorials and this forum, and Intel docs, but I can't seem to wrap my head around something.
When an interrupt triggers a task switch from ring 3 to 0, the stack is switched to the kernel's stack and and all of the suspended process' registers are saved there. Ok, that's fine...
Does that mean one would then need to copy them off the stack somewhere else, then copy them back when the scheduler is about to restore the ring 3 process? I find it hard to swallow that all suspended processes' states are simply stored in one kernel stack and then left there until needed... the stack would be blown in no time.
This is the only thing I'm having trouble figuring out.
I have enabled threading support in my kernel (works a treat) but, the threads are all ring 0, so when you save their states, the values are going into their own stacks and are popped off later... but what do you do when a ring 3 process' state is saved into [one of] the kernel's ring 0 stack(s)?
My mind is boggling.......
Thanks for any help / suggestions!
P.S. I'm not looking for code, I can figure that out on my own once I understand what I'm implementing.