GO 46 !


RD Dreams

MacDizzy

DBS

YADBS

SourceForge

SIX

Rally.co.in

Rossi Files

Open Solaris

Meebo

Crash.net

MotoGP

Beginning of End

Elving's blog

Sandeep's page

Sun Forums

Air Cooled RD

MindStorms

LEGO-Robotics

Track Guide

Track Forum

M's blogs

BikesZone

Kawasaki Triples

PhRack

Metallica

Distance Running

RD Shop

SMX - Solaris Minix

Elephant Story

WD40

Dan's M/C Site

Tunnel Rats

Gatorade

Orkut

Free Science

Spiderman McBride

Racing a Fiat

Forsyth

BSM Archives

Bugatti Veyron

RNR Racing

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 [2]




Trackback URL: http://blogs.sun.com/motor/entry/makecontext_sparc_vs_x86
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 05:18 MD 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 07:32 MD PDT #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed