Quote:
Originally Posted by sparhawk
When you modify the task stack variables, shouldn't you disable multitasking and interrupts? Or is the supervisor stack used when a taskswitch or interrupt occurs?
|
They should be disabled while the actual swap takes place (and while its documentation doesn't explicitly say so, I'd be astonished if the OS StackSwap() function doesn't take care of that), but once the deed is done the system can continue as normal. Even if the system does write to the user stack, it will only write downwards - it won't read or manipulate anything that was written to the stack previously by the program. As long as the original stack is restored before control flow leaves the function that called StackSwap() it should all work fine.