This is an article I wish I could have read many months ago. > Hence, the most basic safety issue with setjmp is that if we call it and then return from the function that had called it, the context saved by setjmp is not valid to longjmp to. > longjmp is only safe if it's called at a time when the stack frame used by setjmp could not have possibly been overwritten, since that is the only way to guarantee that the reg…
> What ruins this for C is the existence of pointers. Stacks aren't freely relocatable since pointers into the stack could exist. I sometimes wonder what computing would be like if the 80286 hadn't sucked, if segmentation had won over flat address spaces, and if we'd been able to do relocation pain-free by changing a segment base register in one spot instead of rewriting linear pointers everywhere. We could have done…
Re: Memory Safe Context Switching
#31mmap with MAP_FIXED has allowed you to do this for some time.