I'm reading on how a mode switch is performed in a process image and I'm confused on why a process image has a kernel stack and not just a user stack? This is done when an interrupt has a occurred. Doesn't the user stack and kernel stack do the same things?
It's for security. A process usually has one stack for each processor mode. There is often either a system-wide or process interrupt stack that is an additional kernel mode stack.
The kernel stack is restricted to kernel mode access. This prevents user mode code from mucking with the kernel stack that would case bad things to happen in kernel mode (e.g., changing the return address from a procedure).
Asked in February 2016Viewed 2,906 timesVoted 9Answered 1 times