Re: someone could port libgc
I'm still undecided about the advisability of this (I'm not checking it in),
but you might try this patch to hurd/exec.c to put the stack at high address.
Index: exec.c
===================================================================
RCS file: /home/cvs/hurd/exec/exec.c,v
retrieving revision 1.72
diff -u -b -p -r1.72 exec.c
--- exec.c 1999/07/18 03:01:29 1.72
+++ exec.c 2000/01/23 20:45:54
@@ -1,5 +1,5 @@
/* GNU Hurd standard exec server.
- Copyright (C) 1992,93,94,95,96,98,99 Free Software Foundation, Inc.
+ Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc.
Written by Roland McGrath.
Can exec ELF format directly.
@@ -1656,11 +1656,25 @@ do_exec (file_t file,
goto out;
/* Start up the initial thread at the entry point. */
- boot->stack_base = 0, boot->stack_size = 0; /* Don't care about values. */
+#ifndef STACK_GROWS_UP /* ? */
+ /* First try for a stack (of some arbitrary "maximal" size, with red zone)
+ at the top of the address space, since some things just like that better.
+ If we can't get that part of the address space, then just go anywhere. */
+ boot->stack_size = (16 * 1024 * 1024); /* 16MB, arbitrary. */
+ boot->stack_base = VM_MAX_ADDRESS - boot->stack_size - vm_page_size;
e.error = mach_setup_thread (newtask, thread,
(void *) (e.interp.section ? interp.entry :
e.entry),
&boot->stack_base, &boot->stack_size);
+ if (e.error == KERN_NO_SPACE)
+#endif
+ {
+ boot->stack_base = 0, boot->stack_size = 0;
+ e.error = mach_setup_thread (newtask, thread,
+ (void *) (e.interp.section ? interp.entry :
+ e.entry),
+ &boot->stack_base, &boot->stack_size);
+ }
if (e.error)
goto out;
Reply to: