summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/i386/init-first.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-05-20 00:13:43 +0000
committerRoland McGrath <roland@gnu.org>1995-05-20 00:13:43 +0000
commita2fe9c76a9d7645c63288eda807e01a6b1901d29 (patch)
tree68882cda9fe373eda0ecaa70503d34812186138d /sysdeps/mach/hurd/i386/init-first.c
parent2b83a2a4d978012cdf78b648337c31091e20526d (diff)
Fri May 19 17:16:46 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/mach/hurd/i386/init-first.c: In cthreads case, handle args on stack from kernel. * posix/Makefile, sysdeps/alpha/Makefile, * sysdeps/mach/hurd/Makefile, sysdeps/sparc/Makefile, Makefile, * Makerules, Make-dist: Fix "cvs commit" cmds in rules to not fail in the absence of CVS dirs. * hurd/hurdstartup.c: Don't call __mach_init. Grok args from the kernel on the stack properly. * set-init.c: Never call _init/_fini; just run __libc_subinit. * Makerules (LDFLAGS-c.so): Add -nostartfiles. * mach/Machrules (LDFLAGS-$(interface.so)): Likewise. * configure.in: Move defaulting of --with-elf and --with-gnu-* based on host os outside the AC_CACHE_VAL for the sysdirs calculation. * Makeconfig (localedir, nlsdir): New variables. * values.h: New file. * Makefile (headers): Add values.h. * locale/Makefile (distribute): Add error.h. * locale/localedef.c: Include "error.h". (main): Use error_message_count instead of warning_cntr.
Diffstat (limited to 'sysdeps/mach/hurd/i386/init-first.c')
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index 55ffe1aada..d747e75c7d 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -20,6 +20,7 @@ Cambridge, MA 02139, USA. */
#include <hurd.h>
#include <stdio.h>
#include <unistd.h>
+#include <string.h>
#include "hurdstartup.h"
#include "set-hooks.h"
#include "hurdmalloc.h" /* XXX */
@@ -118,9 +119,23 @@ init (int *data, int retaddr)
{
/* Initialize cthreads, which will allocate us a new stack to run on. */
void *newsp = (*_cthread_init_routine) ();
+ struct hurd_startup_data *od;
+
/* Copy the argdata from the old stack to the new one. */
newsp = memcpy (newsp - ((char *) &d[1] - (char *) data), data,
- (char *) &d[1] - (char *) data);
+ (char *) d - (char *) data);
+
+ /* Set up the Hurd startup data block immediately following
+ the argument and environment pointers on the new stack. */
+ od = (newsp + ((char *) d - (char *) data));
+ if ((void *) argv[0] == d)
+ /* We were started up by the kernel with arguments on the stack.
+ There is no Hurd startup data, so zero the block. */
+ memset (od, 0, sizeof *od);
+ else
+ /* Copy the Hurd startup data block to the new stack. */
+ *od = *d;
+
data = newsp;
}