summaryrefslogtreecommitdiff
path: root/mach
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1994-04-20 02:59:06 +0000
committerRoland McGrath <roland@gnu.org>1994-04-20 02:59:06 +0000
commitf1d9a6fa44ecfe6ea1192cebfa6dd42c4734066c (patch)
treebf224a1a669d114b87151b40270cfdcc2574a0c6 /mach
parent3bb0e69c672e4537a26a36fbe5de4300c33968d4 (diff)
Formerly ../mach/setup-thread.c.~7~
Diffstat (limited to 'mach')
-rw-r--r--mach/setup-thread.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mach/setup-thread.c b/mach/setup-thread.c
index 5953e32372..0c855f7259 100644
--- a/mach/setup-thread.c
+++ b/mach/setup-thread.c
@@ -41,7 +41,11 @@ __mach_setup_thread (task_t task, thread_t thread, void *pc)
be left, however, in order to confuse people who wonder why its
here. (Though perhaps that last sentence (and this one) should
be deleted to maximize the effect.) */
+#ifdef STACK_GROWTH_DOWN
stack = VM_MAX_ADDRESS - STACK_SIZE - __vm_page_size;
+#else
+ stack = VM_MIN_ADDRESS;
+#endif
if (error = __vm_allocate (task, &stack, STACK_SIZE + __vm_page_size, 0))
return error;
@@ -52,7 +56,13 @@ __mach_setup_thread (task_t task, thread_t thread, void *pc)
memset (&ts, 0, sizeof (ts));
ts.PC = (int) pc;
+#ifdef STACK_GROWTH_DOWN
ts.SP = stack + STACK_SIZE;
+#elif defined (STACK_GROWTH_UP)
+ ts.SP = stack;
+#else
+ #error stack direction unknown
+#endif
return __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
(int *) &ts, tssize);