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:49 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-11-19 11:49:49 +0100
commitd7ed4dfddca61bfe570d5098e27872b7bbe874bf (patch)
tree0017b333f03fd091c3d1ce88506a11035889be04 /sysdeps/mach/hurd/fork.c
parent43ff3daffb0a6b1ec946aee818b418fdd1b8b723 (diff)
parent066cacde241cfbc94c9b1f9af7f64f1f6ccbd9bd (diff)
Merge commit 'refs/top-bases/t/gsync-libc-merge' into t/gsync-libc-merge
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,