View Single Post
Old 23 February 2020, 00:34   #8
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
Quote:
Originally Posted by sparhawk View Post
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.
robinsonb5 is offline  
 
Page generated in 0.04232 seconds with 11 queries