makecontext - Sparc Vs X86
By user13334066 on Kor 17, 2006
I believe makecontext has a problem, as far as source level compatability is concerned. On Solaris Sparc, you have to point uc_stack.ss_sp to the end of the allocated chunk. But this is not required on Solaris x86 - It's as if makecontext is acutely aware that the stack grows down and so uses uc_stack.ss_size to set the stack to the "top". On sparc, it doesn't seem to care - the user has to do it before calling makecontext. in other words, we end up with code like:
... ... u.uc_stack.ss_sp = (char \*)malloc(STACK_SIZE); #ifdef SPARC u.uc_stack.ss_sp += STACK_SIZE; // And other stuff like leaving space for a sparc frame, // rounding up to an 8 byte boundary, etc. ... ... #endif u.uc_stack.ss_size = STACK_SIZE; makecontext(&u, func, 1); ... ...
Isn't the above behaviour a nuisance.