Source-Changes-HG archive

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

[src/trunk]: src/sys - Introduce a e_fault field in struct proc to provide em...



details:   https://anonhg.NetBSD.org/src/rev/448f140e7ef0
branches:  trunk
changeset: 536775:448f140e7ef0
user:      manu <manu%NetBSD.org@localhost>
date:      Sat Sep 21 21:14:54 2002 +0000

description:
- Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.

diffstat:

 sys/arch/mips/mips/trap.c             |   10 +-
 sys/compat/aout/aout_exec.c           |    8 +-
 sys/compat/aoutm68k/aoutm68k_exec.c   |   10 +-
 sys/compat/freebsd/freebsd_exec.c     |    6 +-
 sys/compat/hpux/hpux_exec.c           |   10 +-
 sys/compat/ibcs2/ibcs2_exec.c         |    7 +-
 sys/compat/irix/irix_exec.c           |   13 +-
 sys/compat/irix/irix_mman.c           |   58 ++++-------
 sys/compat/irix/irix_prctl.c          |  169 +++++++++++----------------------
 sys/compat/irix/irix_prctl.h          |   23 +++-
 sys/compat/irix/irix_syssgi.c         |    9 +-
 sys/compat/linux/common/linux_exec.c  |    5 +-
 sys/compat/mach/mach_exec.c           |    6 +-
 sys/compat/netbsd32/netbsd32_netbsd.c |    6 +-
 sys/compat/osf1/osf1_exec.c           |    6 +-
 sys/compat/pecoff/pecoff_emul.c       |    6 +-
 sys/compat/sunos/sunos_exec.c         |   10 +-
 sys/compat/sunos32/sunos32_exec.c     |    8 +-
 sys/compat/svr4/svr4_exec.c           |    6 +-
 sys/compat/svr4_32/svr4_32_exec.c     |    6 +-
 sys/compat/ultrix/ultrix_misc.c       |    6 +-
 sys/kern/kern_exec.c                  |    6 +-
 sys/sys/proc.h                        |    3 +-
 23 files changed, 191 insertions(+), 206 deletions(-)

diffs (truncated from 969 to 300 lines):

diff -r 2438f0d64889 -r 448f140e7ef0 sys/arch/mips/mips/trap.c
--- a/sys/arch/mips/mips/trap.c Sat Sep 21 20:35:00 2002 +0000
+++ b/sys/arch/mips/mips/trap.c Sat Sep 21 21:14:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.171 2002/08/28 08:34:09 gmcgarry Exp $      */
+/*     $NetBSD: trap.c,v 1.172 2002/09/21 21:15:01 manu Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.171 2002/08/28 08:34:09 gmcgarry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.172 2002/09/21 21:15:01 manu Exp $");
 
 #include "opt_cputype.h"       /* which mips CPU levels do we support? */
 #include "opt_ktrace.h"
@@ -338,7 +338,11 @@
                vm = p->p_vmspace;
                map = &vm->vm_map;
                va = trunc_page(vaddr);
-               rv = uvm_fault(map, va, 0, ftype);
+
+               if (p->p_emul->e_fault)
+                       rv = (*p->p_emul->e_fault)(p, va, 0, ftype);
+               else
+                       rv = uvm_fault(map, va, 0, ftype);
 #ifdef VMFAULT_TRACE
                printf(
            "uvm_fault(%p (pmap %p), %lx (0x%x), 0, %d) -> %d at pc %p\n",
diff -r 2438f0d64889 -r 448f140e7ef0 sys/compat/aout/aout_exec.c
--- a/sys/compat/aout/aout_exec.c       Sat Sep 21 20:35:00 2002 +0000
+++ b/sys/compat/aout/aout_exec.c       Sat Sep 21 21:14:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aout_exec.c,v 1.13 2001/11/13 02:07:52 lukem Exp $     */
+/*     $NetBSD: aout_exec.c,v 1.14 2002/09/21 21:14:55 manu Exp $      */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aout_exec.c,v 1.13 2001/11/13 02:07:52 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aout_exec.c,v 1.14 2002/09/21 21:14:55 manu Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -50,7 +50,7 @@
 #include <sys/signalvar.h>
 
 #include <compat/aout/aout_syscall.h>
- 
+
 extern struct sysent aout_sysent[];
 #ifdef SYSCALL_DEBUG
 extern const char * const aout_syscallnames[];
@@ -90,4 +90,6 @@
 #else
        syscall,
 #endif
+       NULL,
+       NULL,
 };
diff -r 2438f0d64889 -r 448f140e7ef0 sys/compat/aoutm68k/aoutm68k_exec.c
--- a/sys/compat/aoutm68k/aoutm68k_exec.c       Sat Sep 21 20:35:00 2002 +0000
+++ b/sys/compat/aoutm68k/aoutm68k_exec.c       Sat Sep 21 21:14:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aoutm68k_exec.c,v 1.9 2002/07/13 08:28:40 scw Exp $    */
+/*     $NetBSD: aoutm68k_exec.c,v 1.10 2002/09/21 21:14:55 manu Exp $  */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aoutm68k_exec.c,v 1.9 2002/07/13 08:28:40 scw Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aoutm68k_exec.c,v 1.10 2002/09/21 21:14:55 manu Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_syscall_debug.h"
@@ -51,7 +51,7 @@
 #include <sys/signalvar.h>
 
 #include <compat/aoutm68k/aoutm68k_syscall.h>
- 
+
 extern struct sysent aoutm68k_sysent[];
 #ifdef SYSCALL_DEBUG
 extern const char * const aoutm68k_syscallnames[];
@@ -80,5 +80,7 @@
        NULL,
        NULL,
        NULL,
-       aoutm68k_syscall_intern
+       aoutm68k_syscall_intern,
+       NULL,
+       NULL,
 };
diff -r 2438f0d64889 -r 448f140e7ef0 sys/compat/freebsd/freebsd_exec.c
--- a/sys/compat/freebsd/freebsd_exec.c Sat Sep 21 20:35:00 2002 +0000
+++ b/sys/compat/freebsd/freebsd_exec.c Sat Sep 21 21:14:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: freebsd_exec.c,v 1.17 2001/11/13 02:08:06 lukem Exp $  */
+/*     $NetBSD: freebsd_exec.c,v 1.18 2002/09/21 21:14:56 manu Exp $   */
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_exec.c,v 1.17 2001/11/13 02:08:06 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_exec.c,v 1.18 2002/09/21 21:14:56 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -74,4 +74,6 @@
 #else
        syscall,
 #endif
+       NULL,
+       NULL,
 };
diff -r 2438f0d64889 -r 448f140e7ef0 sys/compat/hpux/hpux_exec.c
--- a/sys/compat/hpux/hpux_exec.c       Sat Sep 21 20:35:00 2002 +0000
+++ b/sys/compat/hpux/hpux_exec.c       Sat Sep 21 21:14:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpux_exec.c,v 1.31 2002/08/02 08:43:09 gmcgarry Exp $  */
+/*     $NetBSD: hpux_exec.c,v 1.32 2002/09/21 21:14:56 manu Exp $      */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpux_exec.c,v 1.31 2002/08/02 08:43:09 gmcgarry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpux_exec.c,v 1.32 2002/09/21 21:14:56 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -125,10 +125,12 @@
        NULL,
        NULL,
 #ifdef __HAVE_SYSCALL_INTERN
-       hpux_syscall_intern
+       hpux_syscall_intern,
 #else
-       syscall
+       syscall,
 #endif
+       NULL,
+       NULL,
 };
 
 /*
diff -r 2438f0d64889 -r 448f140e7ef0 sys/compat/ibcs2/ibcs2_exec.c
--- a/sys/compat/ibcs2/ibcs2_exec.c     Sat Sep 21 20:35:00 2002 +0000
+++ b/sys/compat/ibcs2/ibcs2_exec.c     Sat Sep 21 21:14:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_exec.c,v 1.49 2001/11/13 02:08:22 lukem Exp $    */
+/*     $NetBSD: ibcs2_exec.c,v 1.50 2002/09/21 21:14:56 manu Exp $     */
 
 /*
  * Copyright (c) 1994, 1995, 1998 Scott Bartram
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec.c,v 1.49 2001/11/13 02:08:22 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec.c,v 1.50 2002/09/21 21:14:56 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,7 +93,8 @@
 #else
        syscall,
 #endif
-#
+       NULL,
+       NULL,
 };
 
 /*
diff -r 2438f0d64889 -r 448f140e7ef0 sys/compat/irix/irix_exec.c
--- a/sys/compat/irix/irix_exec.c       Sat Sep 21 20:35:00 2002 +0000
+++ b/sys/compat/irix/irix_exec.c       Sat Sep 21 21:14:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irix_exec.c,v 1.20 2002/08/25 19:03:12 manu Exp $ */
+/*     $NetBSD: irix_exec.c,v 1.21 2002/09/21 21:14:57 manu Exp $ */
 
 /*-
  * Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.20 2002/08/25 19:03:12 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.21 2002/09/21 21:14:57 manu Exp $");
 
 #ifndef ELFSIZE
 #define ELFSIZE                32      /* XXX should die */
@@ -48,12 +48,13 @@
 #include <sys/proc.h>
 #include <sys/lock.h>
 #include <sys/exec.h>
+#include <sys/types.h>
 #include <sys/exec_elf.h>
 #include <sys/malloc.h>
 
-#include <uvm/uvm_extern.h>
+#include <machine/regnum.h>
 
-#include <machine/regnum.h>
+#include <uvm/uvm_extern.h>
 
 #include <compat/common/compat_util.h>
 
@@ -110,6 +111,8 @@
 #else
        irix_syscall,
 #endif
+       NULL,
+       irix_vm_fault,
 };
 
 const struct emul emul_irix_n32 = {
@@ -140,6 +143,8 @@
 #else
        irix_syscall,
 #endif
+       NULL,
+       irix_vm_fault,
 };
 
 /*
diff -r 2438f0d64889 -r 448f140e7ef0 sys/compat/irix/irix_mman.c
--- a/sys/compat/irix/irix_mman.c       Sat Sep 21 20:35:00 2002 +0000
+++ b/sys/compat/irix/irix_mman.c       Sat Sep 21 21:14:54 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irix_mman.c,v 1.3 2002/08/02 23:02:51 manu Exp $ */
+/*     $NetBSD: irix_mman.c,v 1.4 2002/09/21 21:14:57 manu Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_mman.c,v 1.3 2002/08/02 23:02:51 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_mman.c,v 1.4 2002/09/21 21:14:57 manu Exp $");
 
 #include "opt_sysv.h"
 
@@ -51,6 +51,7 @@
 #include <sys/vnode.h>
 #include <sys/vnode_if.h>
 #include <sys/mount.h>
+#include <sys/lock.h>
 #include <sys/systm.h>
 #include <sys/syscallargs.h>
 
@@ -223,13 +224,9 @@
        SCARG(&cup, fd) = fd;
        SCARG(&cup, pos) = pos;
 
-       if ((u_long)addr >= (u_long)IRIX_PRDA && 
-           (u_long)addr + len < (u_long)IRIX_PRDA + sizeof(struct irix_prda))
-               printf("Warning: shared mmap() on process private arena\n");
-
-       /* Eventually do it for a whole share group */
-       return irix_sync_saddr_syscall(p, &cup, retval, (void *)sys_mmap);
-};
+       IRIX_VM_SYNC(p, error = sys_mmap(p, &cup, retval));
+       return error;
+}
 
 
 int 
@@ -238,19 +235,10 @@
        void *v;
        register_t *retval;
 {
-       struct irix_sys_munmap_args /* {
-               syscallarg(void *) addr;
-               syscallarg(int) len;
-       } */ *uap = v;
-       void *addr = SCARG(uap, addr);
-       int len = SCARG(uap, len);
+       int error;
 
-       if ((u_long)addr >= (u_long)IRIX_PRDA && 
-           (u_long)addr + len < (u_long)IRIX_PRDA + sizeof(struct irix_prda))
-               printf("Warning: shared munmap() on process private arena\n");
-       
-       /* Eventually do it for a whole share group */
-       return irix_sync_saddr_syscall(p, v, retval, (void *)sys_munmap);



Home | Main Index | Thread Index | Old Index