From d5ed80d9c65bf521ee7da88de3576cda216c55d3 Mon Sep 17 00:00:00 2001 From: manu Date: Sat, 20 Apr 2002 16:19:22 +0000 Subject: [PATCH] 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). --- sys/compat/irix/irix_exec.c | 27 +++++++++++++++++++++++++-- sys/compat/irix/irix_exec.h | 8 +++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/sys/compat/irix/irix_exec.c b/sys/compat/irix/irix_exec.c index a2d9d900dc6c..2e48bfd9f77c 100644 --- a/sys/compat/irix/irix_exec.c +++ b/sys/compat/irix/irix_exec.c @@ -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 -__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 @@ __KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.13 2002/04/14 21:50:49 manu Exp $"); #include #include +#include + #include #include @@ -262,7 +264,28 @@ irix_e_proc_exec(p, epp) 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 --git a/sys/compat/irix/irix_exec.h b/sys/compat/irix/irix_exec.h index aba4b8fb980c..6d77efeb8c75 100644 --- a/sys/compat/irix/irix_exec.h +++ b/sys/compat/irix/irix_exec.h @@ -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 #include +#include + +/* 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 */