summaryrefslogtreecommitdiff
path: root/libthreads
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-07-08 21:10:56 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-07-08 21:10:56 +0200
commitb66ac0ec5ba12e213bf196276d14bcf8168e1e52 (patch)
treebeaa25dbbc5d0c20a19b47b64eea75451dff573c /libthreads
parentf16e9d281458a62da986a454522a58d9947bfd76 (diff)
Always enable stack red zone
* libthreads/stack.c (setup_stack): Always enable disabling access to end of stack. Add support for stacks growing up.
Diffstat (limited to 'libthreads')
-rw-r--r--libthreads/stack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libthreads/stack.c b/libthreads/stack.c
index d6dd9fff..21a9b6be 100644
--- a/libthreads/stack.c
+++ b/libthreads/stack.c
@@ -176,9 +176,7 @@ setup_stack(p, base)
register cproc_t p;
register vm_address_t base;
{
-#if defined(RED_ZONE)
register kern_return_t r;
-#endif /* defined(RED_ZONE) */
p->stack_base = base;
/*
@@ -188,9 +186,11 @@ setup_stack(p, base)
/*
* Protect red zone.
*/
-#if defined(RED_ZONE)
+#ifdef STACK_GROWTH_UP
+ MACH_CALL(vm_protect(mach_task_self(), base + cthread_stack_size - 2*vm_page_size, vm_page_size, FALSE, VM_PROT_NONE), r);
+#else
MACH_CALL(vm_protect(mach_task_self(), base + vm_page_size, vm_page_size, FALSE, VM_PROT_NONE), r);
-#endif /* defined(RED_ZONE) */
+#endif
/*
* Store self pointer.
*/