Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/vax Cleanup trapframe handling. Instead of keeping...



details:   https://anonhg.NetBSD.org/src/rev/a4f0d70bd519
branches:  trunk
changeset: 766827:a4f0d70bd519
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Jul 03 02:18:20 2011 +0000

description:
Cleanup trapframe handling.  Instead of keeping a trapframe pointer in the
pcb, put in the mdlwp instead.  We had a dummy field so it didn't grow in
size.  This also follows the practice that mips and powerpc follow that a
pointer to the user trapframe is in l->l_md.md_utf.  Make trapframe members
start with tf_

diffstat:

 sys/arch/vax/include/db_machdep.h    |   10 +-
 sys/arch/vax/include/pcb.h           |    3 +-
 sys/arch/vax/include/proc.h          |    4 +-
 sys/arch/vax/include/trap.h          |   40 ++++----
 sys/arch/vax/include/userret.h       |    8 +-
 sys/arch/vax/vax/compat_13_machdep.c |   32 +++----
 sys/arch/vax/vax/compat_16_machdep.c |   38 ++++----
 sys/arch/vax/vax/core_machdep.c      |    8 +-
 sys/arch/vax/vax/db_machdep.c        |   85 ++++++++++----------
 sys/arch/vax/vax/locore.c            |    8 +-
 sys/arch/vax/vax/machdep.c           |  141 +++++++++++++++-------------------
 sys/arch/vax/vax/sig_machdep.c       |   31 +++---
 sys/arch/vax/vax/syscall.c           |   46 +++++------
 sys/arch/vax/vax/trap.c              |  125 ++++++++++++++----------------
 sys/arch/vax/vax/vm_machdep.c        |   38 +++-----
 15 files changed, 285 insertions(+), 332 deletions(-)

diffs (truncated from 1407 to 300 lines):

diff -r b12b90abc3ff -r a4f0d70bd519 sys/arch/vax/include/db_machdep.h
--- a/sys/arch/vax/include/db_machdep.h Sun Jul 03 01:01:06 2011 +0000
+++ b/sys/arch/vax/include/db_machdep.h Sun Jul 03 02:18:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_machdep.h,v 1.18 2011/05/26 15:34:14 joerg Exp $    */
+/*     $NetBSD: db_machdep.h,v 1.19 2011/07/03 02:18:20 matt Exp $     */
 
 /* 
  * Mach Operating System
@@ -47,17 +47,17 @@
 extern db_regs_t       ddb_regs;       /* register state */
 #define        DDB_REGS        (&ddb_regs)
 
-#define        PC_REGS(regs)   (*(db_addr_t *)&(regs)->pc)
+#define        PC_REGS(regs)   (*(db_addr_t *)&(regs)->tf_pc)
 
 #define        BKPT_ADDR(addr) (addr)          /* breakpoint address */
 #define        BKPT_INST       0x03            /* breakpoint instruction */
 #define        BKPT_SIZE       (1)             /* size of breakpoint inst */
 #define        BKPT_SET(inst, addr)    (BKPT_INST)
 
-#define        FIXUP_PC_AFTER_BREAK(regs)      ((regs)->pc -= BKPT_SIZE)
+#define        FIXUP_PC_AFTER_BREAK(regs)      ((regs)->tf_pc -= BKPT_SIZE)
 
-#define        db_clear_single_step(regs)      ((regs)->psl &= ~PSL_T)
-#define        db_set_single_step(regs)        ((regs)->psl |=  PSL_T)
+#define        db_clear_single_step(regs)      ((regs)->tf_psl &= ~PSL_T)
+#define        db_set_single_step(regs)        ((regs)->tf_psl |=  PSL_T)
 
 #define        IS_BREAKPOINT_TRAP(type, code)  ((type) == T_BPTFLT)
 #define IS_WATCHPOINT_TRAP(type, code) ((type) == T_TRCTRAP)
diff -r b12b90abc3ff -r a4f0d70bd519 sys/arch/vax/include/pcb.h
--- a/sys/arch/vax/include/pcb.h        Sun Jul 03 01:01:06 2011 +0000
+++ b/sys/arch/vax/include/pcb.h        Sun Jul 03 02:18:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcb.h,v 1.13 2010/03/20 23:31:30 chs Exp $     */
+/*     $NetBSD: pcb.h,v 1.14 2011/07/03 02:18:20 matt Exp $    */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -56,7 +56,6 @@
        long    P1LR;           /*  Page 1 Length Register    */
 
        /* Software registers, only used by kernel software */
-       void   *framep;         /* Pointer to syscall frame */
        void   *pcb_onfault;    /* Tells whether fault copy */
        paddr_t pcb_paddr;      /* physical address of PCB */
        struct pmap *pcb_pm;    /* owning pmap */
diff -r b12b90abc3ff -r a4f0d70bd519 sys/arch/vax/include/proc.h
--- a/sys/arch/vax/include/proc.h       Sun Jul 03 01:01:06 2011 +0000
+++ b/sys/arch/vax/include/proc.h       Sun Jul 03 02:18:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: proc.h,v 1.14 2011/01/14 02:06:33 rmind Exp $  */
+/*     $NetBSD: proc.h,v 1.15 2011/07/03 02:18:20 matt Exp $   */
 
 /*
  * Copyright (c) 1991 Regents of the University of California.
@@ -38,7 +38,7 @@
  * Machine-dependent lwp struct for vax,
  */
 struct mdlwp {
-       int md_dummy;                   /* Must be at least one field */
+       struct trapframe *md_utf;       /* pointer to user trapframe */
 };
 
 struct trapframe;
diff -r b12b90abc3ff -r a4f0d70bd519 sys/arch/vax/include/trap.h
--- a/sys/arch/vax/include/trap.h       Sun Jul 03 01:01:06 2011 +0000
+++ b/sys/arch/vax/include/trap.h       Sun Jul 03 02:18:20 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: trap.h,v 1.23 2010/11/13 02:23:27 matt Exp $     */
+/*      $NetBSD: trap.h,v 1.24 2011/07/03 02:18:20 matt Exp $     */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -81,25 +81,25 @@
 
 #ifndef _LOCORE
 struct trapframe {
-       long    fp;     /* Stack frame pointer */
-       long    ap;     /* Argument pointer on user stack */
-       long    sp;     /* Stack pointer */
-       long    r0;     /* General registers saved upon trap/syscall */
-       long    r1;
-       long    r2;
-       long    r3;
-       long    r4;
-       long    r5;
-       long    r6;
-       long    r7;
-       long    r8;
-       long    r9;
-       long    r10;
-       long    r11;
-       long    trap;   /* Type of trap */
-        long   code;   /* Trap specific code */
-        long   pc;     /* User pc */
-        long   psl;    /* User psl */
+       long    tf_fp;  /* Stack frame pointer */
+       long    tf_ap;     /* Argument pointer on user stack */
+       long    tf_sp;  /* Stack pointer */
+       long    tf_r0;     /* General registers saved upon trap/syscall */
+       long    tf_r1;
+       long    tf_r2;
+       long    tf_r3;
+       long    tf_r4;
+       long    tf_r5;
+       long    tf_r6;
+       long    tf_r7;
+       long    tf_r8;
+       long    tf_r9;
+       long    tf_r10;
+       long    tf_r11;
+       long    tf_trap;        /* Type of trap */
+        long   tf_code;   /* Trap specific code */
+        long   tf_pc;     /* User pc */
+        long   tf_psl;    /* User psl */
 };
 
 #endif /* _LOCORE */
diff -r b12b90abc3ff -r a4f0d70bd519 sys/arch/vax/include/userret.h
--- a/sys/arch/vax/include/userret.h    Sun Jul 03 01:01:06 2011 +0000
+++ b/sys/arch/vax/include/userret.h    Sun Jul 03 02:18:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: userret.h,v 1.12 2010/02/27 22:12:32 snj Exp $ */
+/*     $NetBSD: userret.h,v 1.13 2011/07/03 02:18:20 matt Exp $        */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -37,9 +37,9 @@
  *     return to usermode.
  */
 static __inline void
-userret(struct lwp *l, struct trapframe *frame, u_quad_t oticks)
+userret(struct lwp *l, struct trapframe *tf, u_quad_t oticks)
 {
-       struct proc *p = l->l_proc;
+       struct proc * const p = l->l_proc;
 
        mi_userret(l);
 
@@ -49,7 +49,7 @@
        if ((p->p_stflag & PST_PROFIL) != 0) {
                extern int psratio;
 
-               addupc_task(l, frame->pc,
+               addupc_task(l, tf->tf_pc,
                    (int)(p->p_sticks - oticks) * psratio);
        }
 }
diff -r b12b90abc3ff -r a4f0d70bd519 sys/arch/vax/vax/compat_13_machdep.c
--- a/sys/arch/vax/vax/compat_13_machdep.c      Sun Jul 03 01:01:06 2011 +0000
+++ b/sys/arch/vax/vax/compat_13_machdep.c      Sun Jul 03 02:18:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_13_machdep.c,v 1.3 2010/12/14 23:44:49 matt Exp $       */
+/*     $NetBSD: compat_13_machdep.c,v 1.4 2011/07/03 02:18:21 matt Exp $       */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.3 2010/12/14 23:44:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.4 2011/07/03 02:18:21 matt Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -123,14 +123,12 @@
        /* {
                syscallarg(struct sigcontext13 *) sigcntxp;
        } */
-       struct proc *p = l->l_proc;
-       struct pcb *pcb = lwp_getpcb(l);
-       struct trapframe *scf;
+       struct proc * const p = l->l_proc;
+       struct trapframe * const tf = l->l_md.md_utf;
        struct sigcontext13 *ucntx;
        struct sigcontext13 ksc;
        sigset_t mask;
 
-       scf = pcb->framep;
        ucntx = SCARG(uap, sigcntxp);
        if (copyin((void *)ucntx, (void *)&ksc, sizeof(struct sigcontext)))
                return EINVAL;
@@ -152,11 +150,11 @@
        (void) sigprocmask1(l, SIG_SETMASK, &mask, 0);
        mutex_exit(p->p_lock);
 
-       scf->fp = ksc.sc_fp;
-       scf->ap = ksc.sc_ap;
-       scf->pc = ksc.sc_pc;
-       scf->sp = ksc.sc_sp;
-       scf->psl = ksc.sc_ps;
+       tf->tf_fp = ksc.sc_fp;
+       tf->tf_ap = ksc.sc_ap;
+       tf->tf_pc = ksc.sc_pc;
+       tf->tf_sp = ksc.sc_sp;
+       tf->tf_psl = ksc.sc_ps;
        return (EJUSTRETURN);
 }
 
@@ -167,14 +165,14 @@
 {
        struct sigcontext sigctx;
        struct otrampframe tramp;
-       struct proc *p = l->l_proc;
+       struct proc * const p = l->l_proc;
        bool error;
 
-       sigctx.sc_pc = tf->pc;
-       sigctx.sc_ps = tf->psl;
-       sigctx.sc_ap = tf->ap;
-       sigctx.sc_fp = tf->fp; 
-       sigctx.sc_sp = tf->sp; 
+       sigctx.sc_pc = tf->tf_pc;
+       sigctx.sc_ps = tf->tf_psl;
+       sigctx.sc_ap = tf->tf_ap;
+       sigctx.sc_fp = tf->tf_fp; 
+       sigctx.sc_sp = tf->tf_sp; 
        sigctx.sc_onstack = onstack ? SS_ONSTACK : 0;
        sigctx.sc_mask = *mask;
        sp -= sizeof(struct sigcontext);
diff -r b12b90abc3ff -r a4f0d70bd519 sys/arch/vax/vax/compat_16_machdep.c
--- a/sys/arch/vax/vax/compat_16_machdep.c      Sun Jul 03 01:01:06 2011 +0000
+++ b/sys/arch/vax/vax/compat_16_machdep.c      Sun Jul 03 02:18:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_16_machdep.c,v 1.3 2010/12/14 23:44:49 matt Exp $       */
+/*     $NetBSD: compat_16_machdep.c,v 1.4 2011/07/03 02:18:21 matt Exp $       */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.3 2010/12/14 23:44:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.4 2011/07/03 02:18:21 matt Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -120,14 +120,11 @@
        /* {
                syscallarg(struct sigcontext *) sigcntxp;
        } */
-       struct proc *p = l->l_proc;
-       struct pcb *pcb = lwp_getpcb(l);
-       struct trapframe *scf;
-       struct sigcontext *ucntx;
+       struct proc * const p = l->l_proc;
+       struct trapframe * const tf = l->l_md.md_utf;
+       struct sigcontext * const ucntx = SCARG(uap, sigcntxp);
        struct sigcontext ksc;
 
-       scf = pcb->framep;
-       ucntx = SCARG(uap, sigcntxp);
 
        if (copyin((void *)ucntx, (void *)&ksc, sizeof(struct sigcontext)))
                return EINVAL;
@@ -143,15 +140,16 @@
                l->l_sigstk.ss_flags |= SS_ONSTACK;
        else
                l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+
        /* Restore signal mask. */
        (void) sigprocmask1(l, SIG_SETMASK, &ksc.sc_mask, 0);
        mutex_exit(p->p_lock);
 
-       scf->fp = ksc.sc_fp;
-       scf->ap = ksc.sc_ap;
-       scf->pc = ksc.sc_pc;
-       scf->sp = ksc.sc_sp;
-       scf->psl = ksc.sc_ps;
+       tf->tf_fp = ksc.sc_fp;
+       tf->tf_ap = ksc.sc_ap;
+       tf->tf_pc = ksc.sc_pc;
+       tf->tf_sp = ksc.sc_sp;
+       tf->tf_psl = ksc.sc_ps;
        return (EJUSTRETURN);
 }
 
@@ -177,15 +175,15 @@
 {
        struct trampoline2 tramp;
        struct sigcontext sigctx;
-       struct proc *p = l->l_proc;
+       struct proc * const p = l->l_proc;
        bool error;
 
        /* The sigcontext struct will be passed back to sigreturn().  */
-       sigctx.sc_pc = tf->pc;
-       sigctx.sc_ps = tf->psl;
-       sigctx.sc_ap = tf->ap;
-       sigctx.sc_fp = tf->fp;
-       sigctx.sc_sp = tf->sp;
+       sigctx.sc_pc = tf->tf_pc;
+       sigctx.sc_ps = tf->tf_psl;
+       sigctx.sc_ap = tf->tf_ap;
+       sigctx.sc_fp = tf->tf_fp;
+       sigctx.sc_sp = tf->tf_sp;



Home | Main Index | Thread Index | Old Index