Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/mach The first int on the stack is not the page s...



details:   https://anonhg.NetBSD.org/src/rev/39cf51193839
branches:  trunk
changeset: 541087:39cf51193839
user:      manu <manu%NetBSD.org@localhost>
date:      Wed Jan 01 15:18:25 2003 +0000

description:
The first int on the stack is not the page size, it's the address of the
mach-O header. This is a guess based on what we have on Darwin, we need
to check other Mach systems to see if this value is Darwin specific or not.
Also updated copyright and removed useless debug

diffstat:

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

diffs (86 lines):

diff -r 3a96d558ac95 -r 39cf51193839 sys/compat/mach/mach_exec.c
--- a/sys/compat/mach/mach_exec.c       Wed Jan 01 15:04:01 2003 +0000
+++ b/sys/compat/mach/mach_exec.c       Wed Jan 01 15:18:25 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: mach_exec.c,v 1.21 2002/12/31 15:47:37 manu Exp $       */
+/*     $NetBSD: mach_exec.c,v 1.22 2003/01/01 15:18:25 manu Exp $       */
 
 /*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
+ * by Christos Zoulas and Emmanuel Dreyfus.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.21 2002/12/31 15:47:37 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_exec.c,v 1.22 2003/01/01 15:18:25 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -122,30 +122,27 @@
        void *argp;
 {
        struct exec_macho_emul_arg *emea;
+       struct exec_macho_object_header *macho_hdr;
        size_t len;
        size_t zero = 0;
-       int pagelen = PAGE_SIZE;
        int error;
        
-       emea = (struct exec_macho_emul_arg *)pack->ep_emul_arg;
-       
-       *stackp -= 16;
+       *stackp = (char *)(((unsigned long)*stackp - 1) & ~0xfUL);
 
-       if ((error = copyout(&pagelen, *stackp, sizeof(pagelen))) != 0) {
-               DPRINTF(("mach: copyout pagelen failed\n"));
+       emea = (struct exec_macho_emul_arg *)pack->ep_emul_arg;
+       macho_hdr = (struct exec_macho_object_header *)emea->macho_hdr;
+       if ((error = copyout(&macho_hdr, *stackp, sizeof(macho_hdr))) != 0) 
                return error;
-       }
-       *stackp += sizeof(pagelen);
+       
+       *stackp += sizeof(macho_hdr);
 
        if ((error = copyargs(p, pack, arginfo, stackp, argp)) != 0) {
                DPRINTF(("mach: copyargs failed\n"));
                return error;
        }
 
-       if ((error = copyout(&zero, *stackp, sizeof(zero))) != 0) {
-               DPRINTF(("mach: copyout first zero failed\n"));
+       if ((error = copyout(&zero, *stackp, sizeof(zero))) != 0)
                return error;
-       }
        *stackp += sizeof(zero);
 
        if ((error = copyoutstr(emea->filename, 
@@ -161,17 +158,13 @@
 
        len = len % sizeof(zero);
        if (len) {
-               if ((error = copyout(&zero, *stackp, len)) != 0) {
-                       DPRINTF(("mach: zero align %d failed\n", len));
+               if ((error = copyout(&zero, *stackp, len)) != 0) 
                        return error;
-               }
                *stackp += len;
        }
 
-       if ((error = copyout(&zero, *stackp, sizeof(zero))) != 0) {
-               DPRINTF(("mach: copyout second zero failed\n"));
+       if ((error = copyout(&zero, *stackp, sizeof(zero))) != 0) 
                return error;
-       }
        *stackp += sizeof(zero);
 
        return 0;



Home | Main Index | Thread Index | Old Index