Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/irix The IRIX usinit(3) function expects a page o...



details:   https://anonhg.NetBSD.org/src/rev/5cb1c92ded7c
branches:  trunk
changeset: 525906:5cb1c92ded7c
user:      manu <manu%NetBSD.org@localhost>
date:      Sat Apr 20 16:19:22 2002 +0000

description:
The IRIX usinit(3) function expects a page of memory to be available at
address 0x200000 (disasembling usinit shows that this address is hardcoded in
libc). It uses it for locks and semaphres.

We therefore allocate this page of memory, to prevent IRIX process from
faulting when thay call usinit(3).

diffstat:

 sys/compat/irix/irix_exec.c |  27 +++++++++++++++++++++++++--
 sys/compat/irix/irix_exec.h |   8 +++++++-
 2 files changed, 32 insertions(+), 3 deletions(-)

diffs (78 lines):

diff -r 4179b5bb4ab1 -r 5cb1c92ded7c sys/compat/irix/irix_exec.c
--- a/sys/compat/irix/irix_exec.c       Sat Apr 20 15:25:53 2002 +0000
+++ b/sys/compat/irix/irix_exec.c       Sat Apr 20 16:19:22 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irix_exec.c,v 1.13 2002/04/14 21:50:49 manu Exp $ */
+/*     $NetBSD: irix_exec.c,v 1.14 2002/04/20 16:19:22 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.13 2002/04/14 21:50:49 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.14 2002/04/20 16:19:22 manu Exp $");
 
 #ifndef ELFSIZE
 #define ELFSIZE                32      /* XXX should die */
@@ -50,6 +50,8 @@
 #include <sys/exec_elf.h>
 #include <sys/malloc.h>
 
+#include <uvm/uvm_extern.h>
+
 #include <machine/regnum.h>
 
 #include <compat/common/compat_util.h>
@@ -262,7 +264,28 @@
        struct proc *p;
        struct exec_package *epp;
 {
+       int error;
+       struct exec_vmcmd evc;
+
        irix_e_proc_init(p, p->p_vmspace);
+
+       /* 
+        * On IRIX, usinit(3) expects the kernel to prepare one page of 
+        * memory mapped at address 0x200000. It is used for shared 
+        * semaphores and locks.
+        */
+       bzero(&evc, sizeof(evc));
+       evc.ev_addr = IRIX_SH_ARENA_ADDR;
+       evc.ev_len = IRIX_SH_ARENA_SZ;
+       evc.ev_prot = UVM_PROT_RW;
+       evc.ev_proc = *vmcmd_map_zero;
+
+       error = (*evc.ev_proc)(p, &evc);
+#ifdef DEBUG_IRIX
+       printf("irix_e_proc_init(): uvm_map() returned %d\n", error);
+       if (error != 0)
+               printf("irix_e_proc_init(): IRIX_SHARED_ARENA map failed ");
+#endif
 }
 
 /*
diff -r 4179b5bb4ab1 -r 5cb1c92ded7c sys/compat/irix/irix_exec.h
--- a/sys/compat/irix/irix_exec.h       Sat Apr 20 15:25:53 2002 +0000
+++ b/sys/compat/irix/irix_exec.h       Sat Apr 20 16:19:22 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irix_exec.h,v 1.6 2002/04/14 21:50:50 manu Exp $ */
+/*     $NetBSD: irix_exec.h,v 1.7 2002/04/20 16:19:22 manu Exp $ */
 
 /*-
  * Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -43,6 +43,12 @@
 #include <sys/exec.h>
 #include <sys/exec_elf.h>
 
+#include <machine/vmparam.h>
+
+/* Address and size of shared arena used by usinit(3) on IRIX */
+#define IRIX_SH_ARENA_ADDR     0x200000
+#define IRIX_SH_ARENA_SZ       PAGE_SIZE
+
 /* IRIX specific per-process data */
 struct irix_emuldata {
        void *ied_sigtramp;     /* Address of signal trampoline */



Home | Main Index | Thread Index | Old Index