Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/irix Deal with mips trapframe changes.



details:   https://anonhg.NetBSD.org/src/rev/d3b1b65c602c
branches:  trunk
changeset: 762376:d3b1b65c602c
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Feb 20 08:08:57 2011 +0000

description:
Deal with mips trapframe changes.

diffstat:

 sys/compat/irix/irix_exec.c   |   14 ++-
 sys/compat/irix/irix_prctl.c  |   31 ++++----
 sys/compat/irix/irix_signal.c |  147 ++++++++++++++++++-----------------------
 3 files changed, 89 insertions(+), 103 deletions(-)

diffs (truncated from 474 to 300 lines):

diff -r 879925206813 -r d3b1b65c602c sys/compat/irix/irix_exec.c
--- a/sys/compat/irix/irix_exec.c       Sun Feb 20 08:07:09 2011 +0000
+++ b/sys/compat/irix/irix_exec.c       Sun Feb 20 08:08:57 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irix_exec.c,v 1.58 2010/07/07 01:30:33 chs Exp $ */
+/*     $NetBSD: irix_exec.c,v 1.59 2011/02/20 08:08:57 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.58 2010/07/07 01:30:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.59 2011/02/20 08:08:57 matt Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_syscall_debug.h"
@@ -44,7 +44,9 @@
 #include <sys/types.h>
 #include <sys/malloc.h>
 
-#include <machine/regnum.h>
+#include <mips/locore.h>
+#include <mips/regnum.h>
+
 #include <uvm/uvm_extern.h>
 
 #include <compat/irix/irix_syscall.h>
@@ -123,12 +125,12 @@
 void
 irix_n32_setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
 {
-       struct frame *f = l->l_md.md_regs;
+       struct trapframe *tf = l->l_md.md_utf;
 
        /* Enable 64 bit instructions (eg: sd) */
-       f->f_regs[_R_SR] |= MIPS3_SR_UX | MIPS3_SR_FR;
+       tf->tf_regs[_R_SR] |= MIPS3_SR_UX | MIPS3_SR_FR;
 #ifdef _LP64
-       f->f_regs[_R_SR] |= MIPS3_SR_KX;
+       tf->tf_regs[_R_SR] |= MIPS3_SR_KX;
 #endif
 }
 
diff -r 879925206813 -r d3b1b65c602c sys/compat/irix/irix_prctl.c
--- a/sys/compat/irix/irix_prctl.c      Sun Feb 20 08:07:09 2011 +0000
+++ b/sys/compat/irix/irix_prctl.c      Sun Feb 20 08:08:57 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irix_prctl.c,v 1.51 2010/07/01 02:38:28 rmind Exp $ */
+/*     $NetBSD: irix_prctl.c,v 1.52 2011/02/20 08:08:57 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.51 2010/07/01 02:38:28 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.52 2011/02/20 08:08:57 matt Exp $");
 
 #include <sys/errno.h>
 #include <sys/types.h>
@@ -50,6 +50,7 @@
 #include <uvm/uvm_extern.h>
 #include <uvm/uvm_map.h>
 
+#include <mips/locore.h>
 #include <machine/regnum.h>
 #include <machine/vmparam.h>
 
@@ -400,8 +401,8 @@
        int inh = isc->isc_inh;
        struct lwp *lparent = isc->isc_parent_lwp;
        struct proc *parent = lparent->l_proc;
-       struct frame *tf = (struct frame *)l2->l_md.md_regs;
-       struct frame *ptf = (struct frame *)lparent->l_md.md_regs;
+       struct trapframe *tf = l2->l_md.md_utf;
+       struct trapframe *ptf = lparent->l_md.md_utf;
        kauth_cred_t pc;
        struct irix_emuldata *ied;
        struct irix_emuldata *parent_ied;
@@ -477,21 +478,21 @@
        /*
         * Setup PC to return to the child entry point
         */
-       tf->f_regs[_R_PC] = (unsigned long)isc->isc_entry;
-       tf->f_regs[_R_RA] = 0;
+       tf->tf_regs[_R_PC] = (unsigned long)isc->isc_entry;
+       tf->tf_regs[_R_RA] = 0;
 
        /*
         * Setup child arguments
         */
-       tf->f_regs[_R_A0] = (unsigned long)isc->isc_arg;
-       tf->f_regs[_R_A1] = 0;
-       tf->f_regs[_R_A2] = 0;
-       tf->f_regs[_R_A3] = 0;
-       if (ptf->f_regs[_R_S3] == (unsigned long)isc->isc_len) {
-               tf->f_regs[_R_S0] = ptf->f_regs[_R_S0];
-               tf->f_regs[_R_S1] = ptf->f_regs[_R_S1];
-               tf->f_regs[_R_S2] = ptf->f_regs[_R_S2];
-               tf->f_regs[_R_S3] = ptf->f_regs[_R_S3];
+       tf->tf_regs[_R_A0] = (unsigned long)isc->isc_arg;
+       tf->tf_regs[_R_A1] = 0;
+       tf->tf_regs[_R_A2] = 0;
+       tf->tf_regs[_R_A3] = 0;
+       if (ptf->tf_regs[_R_S3] == (unsigned long)isc->isc_len) {
+               tf->tf_regs[_R_S0] = ptf->tf_regs[_R_S0];
+               tf->tf_regs[_R_S1] = ptf->tf_regs[_R_S1];
+               tf->tf_regs[_R_S2] = ptf->tf_regs[_R_S2];
+               tf->tf_regs[_R_S3] = ptf->tf_regs[_R_S3];
        }
 
        /*
diff -r 879925206813 -r d3b1b65c602c sys/compat/irix/irix_signal.c
--- a/sys/compat/irix/irix_signal.c     Sun Feb 20 08:07:09 2011 +0000
+++ b/sys/compat/irix/irix_signal.c     Sun Feb 20 08:08:57 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: irix_signal.c,v 1.56 2011/02/03 21:45:31 joerg Exp $ */
+/*     $NetBSD: irix_signal.c,v 1.57 2011/02/20 08:08:57 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.56 2011/02/03 21:45:31 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.57 2011/02/20 08:08:57 matt Exp $");
 
 #include <sys/types.h>
 #include <sys/signal.h>
@@ -44,9 +44,10 @@
 #include <sys/vnode.h>
 #include <sys/wait.h>
 
-#include <machine/regnum.h>
-#include <machine/pcb.h>
-#include <machine/trap.h>
+#include <mips/locore.h>
+#include <mips/regnum.h>
+#include <mips/trap.h>
+#include <mips/pcb.h>
 
 #include <compat/common/compat_util.h>
 
@@ -245,7 +246,7 @@
        struct lwp *l = curlwp;
        struct proc *p = l->l_proc;
        void *sp;
-       struct frame *f = l->l_md.md_regs;
+       struct trapframe *tf = l->l_md.md_utf;
        int onstack;
        int error;
        sig_t catcher = SIGACTION(p, ksi->ksi_signo).sa_handler;
@@ -257,7 +258,7 @@
            (void *)catcher, ksi->ksi_signo, ksi->ksi_trap);
        printf("irix_sendsig(): starting [PC=0x%#"PRIxREGISTER
            " SP=%#"PRIxREGISTER" SR=0x%08lx]\n",
-           f->f_regs[_R_PC], f->f_regs[_R_SP], f->f_regs[_R_SR]);
+           tf->tf_regs[_R_PC], tf->tf_regs[_R_SP], tf->tf_regs[_R_SR]);
 #endif /* DEBUG_IRIX */
 
        /*
@@ -278,7 +279,7 @@
                    + l->l_sigstk.ss_size);
        else
                /* cast for O64 case */
-               sp = (void *)(intptr_t)f->f_regs[_R_SP];
+               sp = (void *)(intptr_t)tf->tf_regs[_R_SP];
 
        /*
         * Build the signal frame
@@ -287,7 +288,7 @@
        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,
-                   ksi->ksi_trap, (void *)f->f_regs[_R_BADVADDR]);
+                   ksi->ksi_trap, (void *)tf->tf_regs[_R_BADVADDR]);
        } else {
                irix_set_sigcontext(&sf.isf_ctx.isc, mask, ksi->ksi_trap, l);
        }
@@ -322,10 +323,10 @@
        /*
         * Set up signal trampoline arguments.
         */
-       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] = (intptr_t)sp;        /* ucontext/sigcontext */
-       f->f_regs[_R_A3] = (intptr_t)catcher;   /* signal handler address */
+       tf->tf_regs[_R_A0] = native_to_svr4_signo[ksi->ksi_signo];/* signo */
+       tf->tf_regs[_R_A1] = 0;                 /* NULL */
+       tf->tf_regs[_R_A2] = (intptr_t)sp;      /* ucontext/sigcontext */
+       tf->tf_regs[_R_A3] = (intptr_t)catcher; /* signal handler address */
 
        /*
         * When siginfo is selected, the higher bit of A0 is set
@@ -334,17 +335,17 @@
         * Also, A1 points to struct siginfo instead of being NULL.
         */
        if (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_SIGINFO) {
-               f->f_regs[_R_A0] |= 0x80000000;
-               f->f_regs[_R_A1] = (intptr_t)sp +
+               tf->tf_regs[_R_A0] |= 0x80000000;
+               tf->tf_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] = (intptr_t)sp;
+       tf->tf_regs[_R_SP] = (intptr_t)sp;
 #ifdef DEBUG_IRIX
-       printf("stack pointer at %p, A1 = %p\n", sp, (void *)f->f_regs[_R_A1]);
+       printf("stack pointer at %p, A1 = %p\n", sp, (void *)tf->tf_regs[_R_A1]);
 #endif /* DEBUG_IRIX */
 
        /*
@@ -353,7 +354,7 @@
         * see irix_sys_sigaction for details about how we get
         * the signal trampoline address.
         */
-       f->f_regs[_R_PC] = (intptr_t)
+       tf->tf_regs[_R_PC] = (intptr_t)
            (((struct irix_emuldata *)(p->p_emuldata))->ied_sigtramp[ksi->ksi_signo]);
 
        /*
@@ -371,42 +372,38 @@
 irix_set_sigcontext (struct irix_sigcontext *scp, const sigset_t *mask,
     int code, struct lwp *l)
 {
-       struct frame *f;
-       struct pcb *pcb;
-       int i;
+       struct trapframe * const tf = l->l_md.md_utf;
+       struct pcb * const pcb = lwp_getpcb(l);
 
        KASSERT(mutex_owned(l->l_proc->p_lock));
 
 #ifdef DEBUG_IRIX
        printf("irix_set_sigcontext()\n");
 #endif
-       f = (struct frame *)l->l_md.md_regs;
        /*
         * Build stack frame for signal trampoline.
         */
        native_to_irix_sigset(mask, &scp->isc_sigset);
-       for (i = 1; i < 32; i++) { /* save gpr1 - gpr31 */
-               scp->isc_regs[i] = f->f_regs[i];
+       for (u_int i = 1; i < 32; i++) { /* save gpr1 - gpr31 */
+               scp->isc_regs[i] = tf->tf_regs[i];
        }
        scp->isc_regs[0] = 0;
        scp->isc_fp_rounded_result = 0;
        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];
-       scp->isc_badvaddr = f->f_regs[_R_BADVADDR];
-       scp->isc_cause = f->f_regs[_R_CAUSE];
+       scp->isc_mdhi = tf->tf_regs[_R_MULHI];
+       scp->isc_mdlo = tf->tf_regs[_R_MULLO];
+       scp->isc_pc = tf->tf_regs[_R_PC];
+       scp->isc_badvaddr = tf->tf_regs[_R_BADVADDR];
+       scp->isc_cause = tf->tf_regs[_R_CAUSE];
 
        /*
         * Save the floating-point state, if necessary, then copy it.
         */
-       pcb = lwp_getpcb(l);
-#ifndef SOFTFLOAT
-       scp->isc_ownedfp = l->l_md.md_flags & MDP_FPUSED;
+#if !defined(NOFPU) || defined(FPEMUL)
+       scp->isc_ownedfp = fpu_used_p(l);
        if (scp->isc_ownedfp) {
                /* if FPU has current state, save it first */
-               if (l == fpcurlwp)
-                       savefpregs(l);
+               fpu_save_lwp(l);
                memcpy(&scp->isc_fpregs, &pcb->pcb_fpregs,
                    sizeof(scp->isc_fpregs));
                scp->isc_fpc_csr = pcb->pcb_fpregs.r_regs[32];
@@ -427,8 +424,7 @@
 irix_set_ucontext(struct irix_ucontext *ucp, const sigset_t *mask,
     int code, struct lwp *l)
 {
-       struct frame *f;
-       struct pcb *pcb;
+       struct trapframe * const tf = l->l_md.md_utf;
 
        KASSERT(mutex_owned(l->l_proc->p_lock));
 
@@ -436,28 +432,26 @@
        printf("irix_set_ucontext()\n");
 #endif
 
-       f = (struct frame *)l->l_md.md_regs;
        /*



Home | Main Index | Thread Index | Old Index