summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/fork.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-11-19 11:49:50 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-11-19 11:49:50 +0100
commit651455aa88d24a272cb36d03db7baf7d1d448ad8 (patch)
treed3d59aef7a6f2323b643660970d55b3752457595 /sysdeps/mach/hurd/fork.c
parent96d7b5bbe2ae6cf4fb5c20bc9b769ac91e620b44 (diff)
parentd7ed4dfddca61bfe570d5098e27872b7bbe874bf (diff)
Merge commit 'refs/top-bases/t/gsync-libc' into t/gsync-libc
Diffstat (limited to 'sysdeps/mach/hurd/fork.c')
-rw-r--r--sysdeps/mach/hurd/fork.c18
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,