Module Name: src Committed By: matt Date: Thu Sep 10 01:52:34 UTC 2009
Modified Files: src/sys/compat/irix [matt-nb5-mips64]: irix_exec.c irix_exec_elf32.c irix_fcntl.c irix_kmem.c irix_prctl.c irix_signal.c irix_sysmp.c irix_syssgi.c irix_types.h Log Message: Make LP64 safe (XXX probably need an irix32). To generate a diff of this commit: cvs rdiff -u -r1.52.14.1 -r1.52.14.2 src/sys/compat/irix/irix_exec.c cvs rdiff -u -r1.15 -r1.15.18.1 src/sys/compat/irix/irix_exec_elf32.c cvs rdiff -u -r1.25 -r1.25.18.1 src/sys/compat/irix/irix_fcntl.c cvs rdiff -u -r1.8 -r1.8.18.1 src/sys/compat/irix/irix_kmem.c cvs rdiff -u -r1.48 -r1.48.14.1 src/sys/compat/irix/irix_prctl.c cvs rdiff -u -r1.48.18.1 -r1.48.18.2 src/sys/compat/irix/irix_signal.c cvs rdiff -u -r1.21 -r1.21.18.1 src/sys/compat/irix/irix_sysmp.c cvs rdiff -u -r1.48 -r1.48.16.1 src/sys/compat/irix/irix_syssgi.c cvs rdiff -u -r1.18 -r1.18.18.1 src/sys/compat/irix/irix_types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/irix/irix_exec.c diff -u src/sys/compat/irix/irix_exec.c:1.52.14.1 src/sys/compat/irix/irix_exec.c:1.52.14.2 --- src/sys/compat/irix/irix_exec.c:1.52.14.1 Wed Aug 26 03:46:40 2009 +++ src/sys/compat/irix/irix_exec.c Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_exec.c,v 1.52.14.1 2009/08/26 03:46:40 matt Exp $ */ +/* $NetBSD: irix_exec.c,v 1.52.14.2 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 2001-2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.52.14.1 2009/08/26 03:46:40 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.52.14.2 2009/09/10 01:52:34 matt Exp $"); #ifdef _KERNEL_OPT #include "opt_syscall_debug.h" @@ -127,7 +127,10 @@ struct frame *f = l->l_md.md_regs; /* Enable 64 bit instructions (eg: sd) */ - f->f_regs[_R_SR] |= MIPS3_SR_UX; + f->f_regs[_R_SR] |= MIPS3_SR_UX | MIPS3_SR_FR; +#ifdef _LP64 + f->f_regs[_R_SR] |= MIPS3_SR_KX; +#endif } /* Index: src/sys/compat/irix/irix_exec_elf32.c diff -u src/sys/compat/irix/irix_exec_elf32.c:1.15 src/sys/compat/irix/irix_exec_elf32.c:1.15.18.1 --- src/sys/compat/irix/irix_exec_elf32.c:1.15 Mon Apr 28 20:23:41 2008 +++ src/sys/compat/irix/irix_exec_elf32.c Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_exec_elf32.c,v 1.15 2008/04/28 20:23:41 martin Exp $ */ +/* $NetBSD: irix_exec_elf32.c,v 1.15.18.1 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,11 +30,15 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: irix_exec_elf32.c,v 1.15 2008/04/28 20:23:41 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_exec_elf32.c,v 1.15.18.1 2009/09/10 01:52:34 matt Exp $"); #ifndef ELFSIZE +#ifdef _LP64 +#define ELFSIZE 64 /* XXX should die */ +#else #define ELFSIZE 32 /* XXX should die */ #endif +#endif #include <sys/param.h> #include <sys/types.h> @@ -56,6 +60,7 @@ #include <compat/irix/irix_exec.h> +#ifdef EXEC_ELF32 /* * IRIX o32 ABI probe function */ @@ -90,6 +95,7 @@ printf("epp->ep_vm_minaddr = 0x%lx\n", epp->ep_vm_minaddr); #endif epp->ep_vm_minaddr = epp->ep_vm_minaddr & ~0xfUL; + l->l_proc->l_md.md_abi = _MIP_BSD_API_O32; return 0; } @@ -126,6 +132,46 @@ printf("epp->ep_vm_minaddr = 0x%lx\n", epp->ep_vm_minaddr); #endif epp->ep_vm_minaddr = epp->ep_vm_minaddr & ~0xfUL; + l->l_proc->l_md.md_abi = _MIP_BSD_API_N32; + return 0; +} +#endif /* EXEC_ELF32 */ + +#ifdef EXEC_ELF64 +/* + * IRIX n32 ABI probe function + */ +int +ELFNAME2(irix,probe_n64)(l, epp, eh, itp, pos) + struct lwp *l; + struct exec_package *epp; + void *eh; + char *itp; + vaddr_t *pos; +{ + int error = 0; + +#ifdef DEBUG_IRIX + printf("irix_probe_n64()\n"); +#endif + if ((((Elf_Ehdr *)epp->ep_hdr)->e_flags & IRIX_EF_IRIX_ABI_MASK) != + IRIX_EF_IRIX_ABI64) + return error; + + if (itp) { + /* n32 binaries use /lib64/libc.so.1 */ + if (strncmp(itp, "/lib64/libc.so", 14) && + strncmp(itp, "/usr/lib64/libc.so", 18)) + return ENOEXEC; + if ((error = emul_find_interp(l, epp, itp))) + return error; + } +#ifdef DEBUG_IRIX + printf("irix_probe_n32: returning 0\n"); + printf("epp->ep_vm_minaddr = 0x%lx\n", epp->ep_vm_minaddr); +#endif + epp->ep_vm_minaddr = epp->ep_vm_minaddr & ~0xfUL; + l->l_proc->l_md.md_abi = _MIP_BSD_API_N32; return 0; } @@ -152,7 +198,7 @@ * the code that sets up the stack in copyargs(): */ #ifdef DEBUG_IRIX - printf("irix_elf32_copyargs(): *stackp = %p\n", *stackp); + printf("%s(): *stackp = %p\n", __func__, *stackp); #endif /* * This is borrowed from sys/kern/kern_exec.c:copyargs() Index: src/sys/compat/irix/irix_fcntl.c diff -u src/sys/compat/irix/irix_fcntl.c:1.25 src/sys/compat/irix/irix_fcntl.c:1.25.18.1 --- src/sys/compat/irix/irix_fcntl.c:1.25 Mon Apr 28 20:23:41 2008 +++ src/sys/compat/irix/irix_fcntl.c Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_fcntl.c,v 1.25 2008/04/28 20:23:41 martin Exp $ */ +/* $NetBSD: irix_fcntl.c,v 1.25.18.1 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 2001-2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c,v 1.25 2008/04/28 20:23:41 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c,v 1.25.18.1 2009/09/10 01:52:34 matt Exp $"); #include <sys/types.h> #include <sys/signal.h> @@ -62,8 +62,8 @@ #include <compat/svr4/svr4_syscallargs.h> static int fd_truncate(struct lwp *, int, int, off_t, register_t *); -static int bsd_to_irix_fcntl_flags(int); -static int irix_to_bsd_fcntl_flags(int); +static uintptr_t bsd_to_irix_fcntl_flags(uintptr_t); +static uintptr_t irix_to_bsd_fcntl_flags(uintptr_t); int irix_sys_lseek64(struct lwp *l, const struct irix_sys_lseek64_args *uap, register_t *retval) @@ -161,12 +161,12 @@ * All unsupported flags are silently ignored * except FDIRECT taht will return EINVAL */ - if ((int)SCARG(uap, arg) & IRIX_FDIRECT) + if ((uintptr_t)SCARG(uap, arg) & IRIX_FDIRECT) return EINVAL; SCARG(&bsd_ua, fd) = SCARG(uap, fd); SCARG(&bsd_ua, arg) = - (char *)irix_to_bsd_fcntl_flags((int)SCARG(uap, arg)); + (char *)irix_to_bsd_fcntl_flags((uintptr_t)SCARG(uap, arg)); SCARG(&bsd_ua, cmd) = F_SETFL; return sys_fcntl(l, &bsd_ua, retval); break; @@ -329,10 +329,10 @@ return 0; } -static int -irix_to_bsd_fcntl_flags(int flags) +static uintptr_t +irix_to_bsd_fcntl_flags(uintptr_t flags) { - int ret = 0; + long ret = 0; if (flags & IRIX_FNDELAY) ret |= FNDELAY; if (flags & IRIX_FAPPEND) ret |= FAPPEND; @@ -355,8 +355,8 @@ return ret; } -static int -bsd_to_irix_fcntl_flags(int flags) +static uintptr_t +bsd_to_irix_fcntl_flags(uintptr_t flags) { int ret = 0; Index: src/sys/compat/irix/irix_kmem.c diff -u src/sys/compat/irix/irix_kmem.c:1.8 src/sys/compat/irix/irix_kmem.c:1.8.18.1 --- src/sys/compat/irix/irix_kmem.c:1.8 Mon Apr 28 20:23:41 2008 +++ src/sys/compat/irix/irix_kmem.c Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_kmem.c,v 1.8 2008/04/28 20:23:41 martin Exp $ */ +/* $NetBSD: irix_kmem.c,v 1.8.18.1 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: irix_kmem.c,v 1.8 2008/04/28 20:23:41 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_kmem.c,v 1.8.18.1 2009/09/10 01:52:34 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -98,7 +98,7 @@ printf("irix_kmemread(): addr = %p\n", uio->uio_iov->iov_base); printf("irix_kmemread(): len = 0x%08lx\n", (long)uio->uio_iov->iov_len); #endif - offset = (void *)(uint32_t)uio->uio_offset; /* XXX */ + offset = (void *)(uintptr_t)uio->uio_offset; /* XXX */ if (offset == &averunnable) { /* load average */ struct irix_loadavg iav; int scale = averunnable.fscale / IRIX_LOADAVG_SCALE; Index: src/sys/compat/irix/irix_prctl.c diff -u src/sys/compat/irix/irix_prctl.c:1.48 src/sys/compat/irix/irix_prctl.c:1.48.14.1 --- src/sys/compat/irix/irix_prctl.c:1.48 Wed Jul 2 19:49:58 2008 +++ src/sys/compat/irix/irix_prctl.c Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_prctl.c,v 1.48 2008/07/02 19:49:58 rmind Exp $ */ +/* $NetBSD: irix_prctl.c,v 1.48.14.1 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 2001-2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.48 2008/07/02 19:49:58 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.48.14.1 2009/09/10 01:52:34 matt Exp $"); #include <sys/errno.h> #include <sys/types.h> @@ -101,9 +101,9 @@ int shmask = 0; struct irix_emuldata *ied; - p2 = pfind((pid_t)SCARG(uap, arg1)); + p2 = pfind((pid_t)(uintptr_t)SCARG(uap, arg1)); - if (p2 == p || SCARG(uap, arg1) == 0) { + if (p2 == p || SCARG(uap, arg1) == NULL) { /* XXX return our own shmask */ return 0; } @@ -160,7 +160,7 @@ } case IRIX_PR_ISBLOCKED: { /* Is process blocked? */ - pid_t pid = (pid_t)SCARG(uap, arg1); + pid_t pid = (pid_t)(uintptr_t)SCARG(uap, arg1); struct irix_emuldata *ied; struct proc *target; Index: src/sys/compat/irix/irix_signal.c diff -u src/sys/compat/irix/irix_signal.c:1.48.18.1 src/sys/compat/irix/irix_signal.c:1.48.18.2 --- src/sys/compat/irix/irix_signal.c:1.48.18.1 Fri Aug 21 17:58:58 2009 +++ src/sys/compat/irix/irix_signal.c Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_signal.c,v 1.48.18.1 2009/08/21 17:58:58 matt Exp $ */ +/* $NetBSD: irix_signal.c,v 1.48.18.2 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 1994, 2001-2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.48.18.1 2009/08/21 17:58:58 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.48.18.2 2009/09/10 01:52:34 matt Exp $"); #include <sys/types.h> #include <sys/signal.h> @@ -141,7 +141,7 @@ } isi->isi_signo = native_to_svr4_signo[sig]; isi->isi_errno = 0; - isi->isi_addr = (irix_app32_ptr_t)addr; + isi->isi_addr = (intptr_t)addr; switch (code) { case T_TLB_MOD: @@ -278,12 +278,12 @@ + l->l_sigstk.ss_size); else /* cast for O64 case */ - sp = (void *)(u_int32_t)f->f_regs[_R_SP]; + sp = (void *)(intptr_t)f->f_regs[_R_SP]; /* * Build the signal frame */ - bzero(&sf, sizeof(sf)); + memset(&sf, 0, sizeof(sf)); if (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_SIGINFO) { irix_set_ucontext(&sf.isf_ctx.iss.iuc, mask, ksi->ksi_trap, l); irix_signal_siginfo(&sf.isf_ctx.iss.iis, ksi->ksi_signo, @@ -295,8 +295,8 @@ /* * Compute the new stack address after copying sigframe */ - sp = (void *)((unsigned long)sp - sizeof(sf.isf_ctx)); - sp = (void *)((unsigned long)sp & ~0xfUL); /* 16 bytes alignement */ + sp = (void *)((intptr_t)sp - sizeof(sf.isf_ctx)); + sp = (void *)((intptr_t)sp & ~0xfUL); /* 16 bytes alignement */ /* * Install the sigframe onto the stack @@ -324,8 +324,8 @@ */ f->f_regs[_R_A0] = native_to_svr4_signo[ksi->ksi_signo];/* signo */ f->f_regs[_R_A1] = 0; /* NULL */ - f->f_regs[_R_A2] = (unsigned long)sp; /* ucontext/sigcontext */ - f->f_regs[_R_A3] = (unsigned long)catcher;/* signal handler address */ + f->f_regs[_R_A2] = (intptr_t)sp; /* ucontext/sigcontext */ + f->f_regs[_R_A3] = (intptr_t)catcher; /* signal handler address */ /* * When siginfo is selected, the higher bit of A0 is set @@ -335,14 +335,14 @@ */ if (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_SIGINFO) { f->f_regs[_R_A0] |= 0x80000000; - f->f_regs[_R_A1] = (u_long)sp + - ((u_long)&sf.isf_ctx.iss.iis - (u_long)&sf); + f->f_regs[_R_A1] = (intptr_t)sp + + ((intptr_t)&sf.isf_ctx.iss.iis - (intptr_t)&sf); } /* * Set up the new stack pointer */ - f->f_regs[_R_SP] = (unsigned long)sp; + f->f_regs[_R_SP] = (intptr_t)sp; #ifdef DEBUG_IRIX printf("stack pointer at %p, A1 = %p\n", sp, (void *)f->f_regs[_R_A1]); #endif /* DEBUG_IRIX */ @@ -353,7 +353,7 @@ * see irix_sys_sigaction for details about how we get * the signal trampoline address. */ - f->f_regs[_R_PC] = (unsigned long) + f->f_regs[_R_PC] = (intptr_t) (((struct irix_emuldata *)(p->p_emuldata))->ied_sigtramp[ksi->ksi_signo]); /* @@ -365,7 +365,6 @@ #ifdef DEBUG_IRIX printf("returning from irix_sendsig()\n"); #endif - return; } static void @@ -393,7 +392,7 @@ } scp->isc_regs[0] = 0; scp->isc_fp_rounded_result = 0; - scp->isc_regmask = ~0x1UL; + scp->isc_regmask = -2; scp->isc_mdhi = f->f_regs[_R_MULHI]; scp->isc_mdlo = f->f_regs[_R_MULLO]; scp->isc_pc = f->f_regs[_R_PC]; Index: src/sys/compat/irix/irix_sysmp.c diff -u src/sys/compat/irix/irix_sysmp.c:1.21 src/sys/compat/irix/irix_sysmp.c:1.21.18.1 --- src/sys/compat/irix/irix_sysmp.c:1.21 Mon Apr 28 20:23:42 2008 +++ src/sys/compat/irix/irix_sysmp.c Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_sysmp.c,v 1.21 2008/04/28 20:23:42 martin Exp $ */ +/* $NetBSD: irix_sysmp.c,v 1.21.18.1 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 2001-2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: irix_sysmp.c,v 1.21 2008/04/28 20:23:42 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_sysmp.c,v 1.21.18.1 2009/09/10 01:52:34 matt Exp $"); #include <sys/errno.h> #include <sys/param.h> @@ -89,16 +89,16 @@ break; case IRIX_MP_KERNADDR: /* Kernel structure addresses */ - return irix_sysmp_kernaddr((int)SCARG(uap, arg1), retval); + return irix_sysmp_kernaddr((intptr_t)SCARG(uap, arg1), retval); break; case IRIX_MP_SASZ: /* System accounting structure size */ - return irix_sysmp_sasz((int)SCARG(uap, arg1), retval); + return irix_sysmp_sasz((intptr_t)SCARG(uap, arg1), retval); break; case IRIX_MP_SAGET1: /* Get system accounting structure for one CPU */ case IRIX_MP_SAGET: /* Get system accounting structure for all CPU */ - return irix_sysmp_saget((int)SCARG(uap, arg1), + return irix_sysmp_saget((intptr_t)SCARG(uap, arg1), (char *)SCARG(uap, arg2), (size_t)SCARG(uap, arg3)); break; Index: src/sys/compat/irix/irix_syssgi.c diff -u src/sys/compat/irix/irix_syssgi.c:1.48 src/sys/compat/irix/irix_syssgi.c:1.48.16.1 --- src/sys/compat/irix/irix_syssgi.c:1.48 Mon Apr 28 20:23:42 2008 +++ src/sys/compat/irix/irix_syssgi.c Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_syssgi.c,v 1.48 2008/04/28 20:23:42 martin Exp $ */ +/* $NetBSD: irix_syssgi.c,v 1.48.16.1 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 2001, 2002, 2008 The NetBSD Foundation, Inc. @@ -30,15 +30,19 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.48 2008/04/28 20:23:42 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.48.16.1 2009/09/10 01:52:34 matt Exp $"); #if defined(_KERNEL_OPT) #include "opt_ddb.h" #endif #ifndef ELFSIZE +#ifdef _LP64 +#define ELFSIZE 64 +#else #define ELFSIZE 32 #endif +#endif /* round up and down to page boundaries. Borrowed from sys/kern/exec_elf32.c */ #define ELF_ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1)) @@ -109,7 +113,7 @@ case IRIX_SGI_SETGROUPS: { /* setgroups(2) */ struct sys_setgroups_args cup; - SCARG(&cup, gidsetsize) = (int)SCARG(uap, arg1); + SCARG(&cup, gidsetsize) = (intptr_t)SCARG(uap, arg1); SCARG(&cup, gidset) = (gid_t *)SCARG(uap, arg2); return (sys_setgroups(l, &cup, retval)); break; @@ -118,7 +122,7 @@ case IRIX_SGI_GETGROUPS: { /* getgroups(2) */ struct sys_getgroups_args cup; - SCARG(&cup, gidsetsize) = (int)SCARG(uap, arg1); + SCARG(&cup, gidsetsize) = (intptr_t)SCARG(uap, arg1); SCARG(&cup, gidset) = (gid_t *)SCARG(uap, arg2); return (sys_getgroups(l, &cup, retval)); break; @@ -131,7 +135,7 @@ case IRIX_SGI_GETSID: { /* Get session ID: getsid(2) */ struct sys_getsid_args cup; - SCARG(&cup, pid) = (pid_t)SCARG(uap, arg1); + SCARG(&cup, pid) = (pid_t)(intptr_t)SCARG(uap, arg1); return (sys_getsid(l, &cup, retval)); break; } @@ -139,7 +143,7 @@ case IRIX_SGI_GETPGID: {/* Get parent process GID: getpgid(2) */ struct sys_getpgid_args cup; - SCARG(&cup, pid) = (pid_t)SCARG(uap, arg1); + SCARG(&cup, pid) = (pid_t)(intptr_t)SCARG(uap, arg1); return (sys_getpgid(l, &cup, retval)); break; } @@ -147,21 +151,21 @@ case IRIX_SGI_SETPGID: {/* Get parent process GID: setpgid(2) */ struct sys_setpgid_args cup; - SCARG(&cup, pid) = (pid_t)SCARG(uap, arg1); - SCARG(&cup, pgid) = (pid_t)SCARG(uap, arg2); + SCARG(&cup, pid) = (pid_t)(intptr_t)SCARG(uap, arg1); + SCARG(&cup, pgid) = (pid_t)(intptr_t)SCARG(uap, arg2); return (sys_setpgid(l, &cup, retval)); break; } case IRIX_SGI_PATHCONF: /* Get file limits: pathconf(3) */ return irix_syssgi_pathconf((char *)SCARG(uap, arg1), - (int)SCARG(uap, arg2), l, retval); + (intptr_t)SCARG(uap, arg2), l, retval); break; case IRIX_SGI_RUSAGE: { /* BSD getrusage(2) */ struct sys_getrusage_args cup; - SCARG(&cup, who) = (int)SCARG(uap, arg1); + SCARG(&cup, who) = (intptr_t)SCARG(uap, arg1); SCARG(&cup, rusage) = (struct rusage *)SCARG(uap, arg2); return sys_getrusage(l, &cup, retval); break; @@ -173,9 +177,9 @@ break; case IRIX_SGI_MODULE_INFO: { /* <sys/systeminfo.h> get_module_info() */ - int module_num = (int)SCARG(uap, arg1); + int module_num = (intptr_t)SCARG(uap, arg1); struct irix_module_info_s *imip = SCARG(uap, arg2); - int mss = (int)SCARG(uap, arg3); + int mss = (intptr_t)SCARG(uap, arg3); struct irix_module_info_s imi; char *idx; @@ -206,7 +210,7 @@ arg1 = SCARG(uap, arg1); /* PID of the process */ arg2 = SCARG(uap, arg2); /* Address of user buffer */ arg3 = SCARG(uap, arg3); /* Length of user buffer */ - tp = pfind((pid_t)arg1); + tp = pfind((pid_t)(intptr_t)arg1); if (tp == NULL || \ tp->p_psstr == NULL || \ tp->p_psstr->ps_argvstr == NULL || \ @@ -231,8 +235,8 @@ arg1 = SCARG(uap, arg1); /* file descriptor */ arg2 = SCARG(uap, arg2); /* ptr to ELF program header array */ arg3 = SCARG(uap, arg3); /* array's length */ - return irix_syssgi_mapelf((int)arg1, (Elf_Phdr *)arg2, - (int)arg3, l, retval); + return irix_syssgi_mapelf((intptr_t)arg1, (Elf_Phdr *)arg2, + (intptr_t)arg3, l, retval); break; case IRIX_SGI_USE_FP_BCOPY: /* bcopy and bzero can use FPU or not */ @@ -250,7 +254,7 @@ case IRIX_SGI_SYSCONF: /* POSIX sysconf */ arg1 = SCARG(uap, arg1); /* system variable name */ - return irix_syssgi_sysconf((int)arg1, l, retval); + return irix_syssgi_sysconf((intptr_t)arg1, l, retval); break; case IRIX_SGI_SATCTL: /* control audit stream */ Index: src/sys/compat/irix/irix_types.h diff -u src/sys/compat/irix/irix_types.h:1.18 src/sys/compat/irix/irix_types.h:1.18.18.1 --- src/sys/compat/irix/irix_types.h:1.18 Mon Apr 28 20:23:42 2008 +++ src/sys/compat/irix/irix_types.h Thu Sep 10 01:52:34 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: irix_types.h,v 1.18 2008/04/28 20:23:42 martin Exp $ */ +/* $NetBSD: irix_types.h,v 1.18.18.1 2009/09/10 01:52:34 matt Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ typedef __uint32_t irix_app32_ptr_t; typedef __uint64_t irix_k_sigset_t; -#if 1 /* _MIPS_SZLONG == 32 */ +#if _MIPS_SZLONG == 32 typedef unsigned long irix_mode_t; typedef unsigned long irix_dev_t; typedef long irix_uid_t; @@ -65,17 +65,17 @@ typedef unsigned long irix_nlink_t; typedef long irix_pid_t; typedef long irix_time_t; -typedef unsigned int irix_size_t; +typedef unsigned long irix_size_t; #endif -#if 0 /* _MIPS_SZLONG == 64 */ +#if _MIPS_SZLONG == 64 typedef __uint32_t irix_dev_t; typedef __uint32_t irix_mode_t; typedef __int32_t irix_uid_t; typedef __int32_t irix_gid_t; typedef __uint32_t irix_nlink_t; typedef __int32_t irix_pid_t; -typedef int irix_time_t; -typedef unsigned long irix_size_t; +typedef __int32_t irix_time_t; +typedef __uint32_t irix_size_t; #endif typedef __int32_t irix_blkcnt_t; typedef __uint64_t irix_ino64_t; @@ -107,46 +107,46 @@ #define IRIX__STAT64_VER 3 struct irix_stat { irix_dev_t ist_dev; - long ist_pad1[3]; + __uint32_t ist_pad1[3]; irix_ino_t ist_ino; irix_mode_t ist_mode; irix_nlink_t ist_nlink; irix_uid_t ist_uid; irix_gid_t ist_gid; irix_dev_t ist_rdev; - long ist_pad2[2]; + __uint32_t ist_pad2[2]; irix_off_t ist_size; - long ist_pad3; + __uint32_t ist_pad3; irix_timespec_t ist_atim; irix_timespec_t ist_mtim; irix_timespec_t ist_ctim; - long ist_blksize; + __int32_t ist_blksize; irix_blkcnt_t ist_blocks; char ist_fstype[16]; - long ist_projid; - long ist_pad4[7]; + __int32_t ist_projid; + __uint32_t ist_pad4[7]; }; struct irix_stat64 { irix_dev_t ist_dev; - long ist_pad1[3]; + __uint32_t ist_pad1[3]; irix_ino64_t ist_ino; irix_mode_t ist_mode; irix_nlink_t ist_nlink; irix_uid_t ist_uid; irix_gid_t ist_gid; irix_dev_t ist_rdev; - long ist_pad2[2]; + __uint32_t ist_pad2[2]; irix_off64_t ist_size; - long ist_pad3; + __uint32_t ist_pad3; irix_timespec_t ist_atim; irix_timespec_t ist_mtim; irix_timespec_t ist_ctim; - long ist_blksize; + __int32_t ist_blksize; irix_blkcnt64_t ist_blocks; char ist_fstype[16]; - long ist_projid; - long ist_pad4[7]; + __int32_t ist_projid; + __uint32_t ist_pad4[7]; }; /* From IRIX's <sys/mount.h> */