[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

stack base (was Re: someone could port libgc)

> > Will this solve the problem of 'variable' stack bottom?
> Yes, that would work.  For multithreaded programs, something fancier needs
> to be done (since there are many disjoint stacks); I imagine libgc has some
> code or other to cope with other multithreaded systems (this is an issue
> for almost any thread system)--though I guess it could well just be "use a
> wrapper like that at the base of each thread".
> There isn't any really kosher way to get the stack bounds.  
> There is the unreliable horrible hack approach you can see in
> hurd/libthreads/stack.c::probe_stack (code we don't use).  
> libc gets the information from the exec server (see
> libc/hurd/hurdstartup.[hc]), but doesn't save it anywhere accessible.

Doesn't it store it in __libc_stack_end?  See
libc/sysdeps/generic/libc-start.c .  This program

    extern void* __libc_stack_end;
    main () { printf ("%p\n", __libc_stack_end); }

prints 0xbffffd1c on Linux/i386 and 0x101abfc on Hurd.

John Tobey, late nite hacker <jtobey@john-edwin-tobey.org>
\\\                                                               ///
]]]             With enough bugs, all eyes are shallow.           [[[
///                                                               \\\

Reply to: