From: mickey Date: Wed, 22 Mar 2000 21:35:37 +0000 (+0000) Subject: some more machine_stack_grows_up X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7590ef911da57e0d296083f93ad3011fec514cc6;p=openbsd some more machine_stack_grows_up --- diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index b6827c12567..e2c7d71a6f1 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -546,8 +546,11 @@ start_init(arg) #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. */ @@ -575,8 +578,14 @@ start_init(arg) #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 } /* @@ -586,13 +595,20 @@ start_init(arg) #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); diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index ae5a6017794..aab946407fe 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $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 $ */ /*- @@ -429,8 +429,8 @@ sys_execve(p, v, retval) 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 @@ -445,7 +445,7 @@ sys_execve(p, v, retval) /* 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,