diff options
Diffstat (limited to 'sysdeps/mach/hurd/fork.c')
-rw-r--r-- | sysdeps/mach/hurd/fork.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c index 5df993f463..3e7501f9a1 100644 --- a/sysdeps/mach/hurd/fork.c +++ b/sysdeps/mach/hurd/fork.c @@ -505,10 +505,24 @@ __fork (void) (natural_t *) &state, &statecount)) LOSE; #ifdef STACK_GROWTH_UP - if (__hurd_sigthread_stack_base != 0) + if (__hurd_sigthread_stack_base == 0) + { + state.SP &= __hurd_threadvar_stack_mask; + state.SP += __hurd_threadvar_stack_offset; + } + else state.SP = __hurd_sigthread_stack_base; #else - if (__hurd_sigthread_stack_end != 0) + if (__hurd_sigthread_stack_end == 0) + { + /* The signal thread has a stack assigned by cthreads. + The threadvar_stack variables conveniently tell us how + to get to the highest address in the stack, just below + the per-thread variables. */ + state.SP &= __hurd_threadvar_stack_mask; + state.SP += __hurd_threadvar_stack_offset; + } + else state.SP = __hurd_sigthread_stack_end; #endif MACHINE_THREAD_STATE_SET_PC (&state, |