Concerns all versions of sthreads.c using ucontext: As far as I know from the Solaris documentation and some experiments, the context treatment in new_context() is not universally correct.
#if defined(__sgi) || (defined(__sparc) && !defined(HAVE___MAKECONTEXT_V2)) ctx->ctx.uc_stack.ss_sp=ctx->stack+STACK_SIZE-8; #else /* not an IRIX or old and buggy Solaris on Sparc */ ctx->ctx.uc_stack.ss_sp=ctx->stack; #endif
The first case is wrong for Solaris 10, since HAVE___MAKECONTEXT_V2 is not defined there but the behavior is _always_ as with HAVE___MAKECONTEXT_V2 in Solaris 9 SPARC. (Solaris 9 SPARC behaves like Solaris 7 and 8 SPARC ["old and buggy"] if HAVE___MAKECONTEXT_V2 is not set, and like Solaris 10 if it is set.)
In the "old and buggy" case, the third argument of makecontext() should be 2 instead of 1 (although the latter _may_ work).
I do not know how this is in Solaris x86. At least, HAVE___MAKECONTEXT_V2 has no meaning there.
On 2005-11-07, at 12:46, Hans Werner Strube wrote:
The first case is wrong for Solaris 10, since HAVE___MAKECONTEXT_V2 is not defined there but the behavior is _always_ as with HAVE___MAKECONTEXT_V2 in Solaris 9 SPARC.
I had no Solaris 10 to test it... So what's the correct way to detect Solaris 10?
(Solaris 9 SPARC behaves like Solaris 7 and 8 SPARC ["old and buggy"] if HAVE___MAKECONTEXT_V2 is not set, and like Solaris 10 if it is set.)
Solaris 9 behaves correctly if __MAKECONTEXT_V2_SOURCE is defined (it is defined in common.h). I've tested this case.
In the "old and buggy" case, the third argument of makecontext() should be 2 instead of 1 (although the latter _may_ work).
The manual claims: The value of argc must match the number of integer arguments passed to func, otherwise the behavior is undefined. (SunOS mion 5.9 Generic_112233-12 sun4u sparc SUNW,Ultra-250)
I only pass single argument...
I do not know how this is in Solaris x86. At least, HAVE___MAKECONTEXT_V2 has no meaning there.
Who uses Solaris x86?
Best regards, Mike
On Mon 07.11.2005 19:09, Michal Trojnara wrote:
Who uses Solaris x86?
I think much person then we know ;-)
If you need help, we use sol10 x86 with:
--- gcc --version gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# uname -a SunOS host 5.10 Generic_118844-20 i86pc i386 i86pc ---
I don't know if you know these links:
http://docs.sun.com/app/docs/doc/816-5168/6mbb3hrdg?q=makecontext&a=view ---from the notes at the bottom . . . The semantics of the uc_stack member of the ucontext_t structure have changed as they apply to inputs to makecontext(). Prior to Solaris 10, the ss_sp member of the uc_stack structure represented the high memory address of the area reserved for the stack. The ss_sp member now represents the base (low memory address), in keeping with other uses of ss_sp.
This change in the meaning of ss_sp is now the default behavior. The -D__MAKECONTEXT_V2_SOURCE compilation flag used in Solaris 9 update releases to access this behavior is obsolete. . . . ---
And here are the hole man-Sections: http://docs.sun.com/app/docs?q=makecontext&p=coll%2F40.10
Solaris 10 Software Developer Collection: http://docs.sun.com/app/docs/coll/45.20
Hth
Aleks
On 2005-11-07, at 23:46, Alexander Lazic wrote:
I don't know if you know these links:
http://docs.sun.com/app/docs/doc/816-5168/6mbb3hrdg? q=makecontext&a=view ---from the notes at the bottom . . .
Cool. I know that (at least most of if). The problem is that have no Solaris 10 account to test a portable and working solution.
Best regards, Mike