-/* $OpenBSD: init_main.c,v 1.49 2000/03/20 15:29:53 deraadt Exp $ */
+/* $OpenBSD: init_main.c,v 1.50 2000/03/22 21:35:37 mickey Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
#endif
for (pathp = &initpaths[0]; (path = *pathp) != NULL; pathp++) {
+#ifdef MACHINE_STACK_GROWS_UP
+ ucp = (char *)addr;
+#else
ucp = (char *)(addr + PAGE_SIZE);
-
+#endif
/*
* Construct the boot flag argument.
*/
#ifdef DEBUG
printf("init: copying out flags `%s' %d\n", flags, i);
#endif
+#ifdef MACHINE_STACK_GROWS_UP
+ arg1 = ucp;
+ (void)copyout((caddr_t)flags, (caddr_t)ucp, i);
+ ucp += i;
+#else
(void)copyout((caddr_t)flags, (caddr_t)(ucp -= i), i);
arg1 = ucp;
+#endif
}
/*
#ifdef DEBUG
printf("init: copying out path `%s' %d\n", path, i);
#endif
+#ifdef MACHINE_STACK_GROWS_UP
+ arg0 = ucp;
+ (void)copyout((caddr_t)path, (caddr_t)ucp, i);
+ ucp += i;
+ ucp = (caddr_t)ALIGN((u_long)ucp);
+ uap = (char **)ucp + 3;
+#else
(void)copyout((caddr_t)path, (caddr_t)(ucp -= i), i);
arg0 = ucp;
-
+ uap = (char **)((u_long)ucp & ~ALIGNBYTES);
+#endif
/*
* Move out the arg pointers.
*/
- uap = (char **)((long)ucp & ~ALIGNBYTES);
(void)suword((caddr_t)--uap, 0); /* terminator */
if (options != 0)
(void)suword((caddr_t)--uap, (long)arg1);
-/* $OpenBSD: kern_exec.c,v 1.39 2000/02/01 04:03:14 assar Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.40 2000/03/22 21:35:37 mickey Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
arginfo.ps_nenvstr = envc;
#ifdef MACHINE_STACK_GROWS_UP
- stack = (char *)USRSTACK;
- slen = len;
+ stack = (char *)USRSTACK + sizeof(arginfo) + szsigcode;
+ slen = len - sizeof(arginfo) - szsigcode;
#else
stack = (char *)(USRSTACK - len);
#endif
/* copy out the process's signal trampoline code */
#ifdef MACHINE_STACK_GROWS_UP
if (szsigcode && copyout((char *)pack.ep_emul->e_sigcode,
- ((char *)PS_STRINGS) + sizeof(struct ps_strings), szsigcode))
+ ((char *)PS_STRINGS) + sizeof(arginfo), szsigcode))
goto exec_abort;
#else
if (szsigcode && copyout((char *)pack.ep_emul->e_sigcode,