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.

Comments:

As of Solaris 10, ss_sp has supposedly been changed to always specify the base address of the stack. Of course, that doesn't exactly make things easier when you want to support compilation under multiple releases!

Posted by Chris Elving on korrik 18, 2006 at 10:18 PD PDT #

Oh ok, i didnt know that, Chris.

Had a tough time once, dealing with crashes. finally
traced the problem to this...:)

Posted by motor on korrik 18, 2006 at 12:32 MD PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

user13334066

Search

Archives
« prill 2014
DieHënMarMërEnjPreSht
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today