Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/mach Fix the stack layout on program startup. Thi...



details:   https://anonhg.NetBSD.org/src/rev/cf5e1f5e0242
branches:  trunk
changeset: 539275:cf5e1f5e0242
user:      manu <manu%NetBSD.org@localhost>
date:      Tue Nov 12 19:01:18 2002 +0000

description:
Fix the stack layout on program startup. This should be:
(8 bytes boundary) PAGE_SIZE   argc    argv  .... envp

diffstat:

 sys/compat/mach/mach_exec.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r 9daaa68b8731 -r cf5e1f5e0242 sys/compat/mach/mach_exec.c
--- a/sys/compat/mach/mach_exec.c       Tue Nov 12 16:54:45 2002 +0000
+++ b/sys/compat/mach/mach_exec.c       Tue Nov 12 19:01:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_exec.c,v 1.8 2002/11/01 19:26:24 jdolecek Exp $    */
+/*     $NetBSD: mach_exec.c,v 1.9 2002/11/12 19:01:18 manu Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.8 2002/11/01 19:26:24 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.9 2002/11/12 19:01:18 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,6 +47,9 @@
 
 #include <sys/syscall.h>
 
+#include <uvm/uvm_extern.h>
+#include <uvm/uvm_param.h>
+
 #include <compat/mach/mach_types.h>
 #include <compat/mach/mach_exec.h>
 
@@ -103,8 +106,17 @@
 {
        size_t len;
        size_t zero = 0;
+       int pagelen = PAGE_SIZE;
        int error;
 
+       *stackp -= 16;
+
+       if ((error = copyout(&pagelen, *stackp, sizeof(pagelen))) != 0) {
+               DPRINTF(("mach: copyout pagelen failed\n"));
+               return error;
+       }
+       *stackp += sizeof(pagelen);
+
        if ((error = copyargs(p, pack, arginfo, stackp, argp)) != 0) {
                DPRINTF(("mach: copyargs failed\n"));
                return error;



Home | Main Index | Thread Index | Old Index