updates from Tony Bennett.
Broke the setjmp/longjmp pair in the context switch into a separate routine so no code depended on local variables surviving the jump.