makecontext - Sparc Vs X86
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.
Trackback URL: http://blogs.sun.com/motor/entry/makecontext_sparc_vs_x86
Posted by Chris Elving on korrik 18, 2006 at 05:18 MD PDT #
Had a tough time once, dealing with crashes. finally
traced the problem to this...:)
Posted by motor on korrik 18, 2006 at 07:32 MD PDT #