Source-Changes-HG archive

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

[src/trunk]: src/sys Rename process_frame to lwp_trapframe



details:   https://anonhg.NetBSD.org/src/rev/e9b8f5d47b3f
branches:  trunk
changeset: 781054:e9b8f5d47b3f
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Aug 16 16:41:53 2012 +0000

description:
Rename process_frame to lwp_trapframe

diffstat:

 sys/arch/arm/arm/compat_16_machdep.c      |  19 ++++++++-----------
 sys/arch/arm/arm/process_machdep.c        |  10 +++++-----
 sys/arch/arm/arm/sig_machdep.c            |  31 ++++++++++++++-----------------
 sys/arch/arm/include/frame.h              |   4 ++--
 sys/compat/linux/arch/arm/linux_machdep.c |  18 +++++++-----------
 5 files changed, 36 insertions(+), 46 deletions(-)

diffs (270 lines):

diff -r 639f8e8cd277 -r e9b8f5d47b3f sys/arch/arm/arm/compat_16_machdep.c
--- a/sys/arch/arm/arm/compat_16_machdep.c      Thu Aug 16 16:23:48 2012 +0000
+++ b/sys/arch/arm/arm/compat_16_machdep.c      Thu Aug 16 16:41:53 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_16_machdep.c,v 1.14 2012/01/25 17:38:09 tsutsui Exp $   */
+/*     $NetBSD: compat_16_machdep.c,v 1.15 2012/08/16 16:41:53 matt Exp $      */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.14 2012/01/25 17:38:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.15 2012/08/16 16:41:53 matt Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -84,18 +84,16 @@
 void
 sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
 {
-       struct lwp *l = curlwp;
-       struct proc *p = l->l_proc;
-       struct sigacts *ps = p->p_sigacts;
-       struct trapframe *tf;
+       struct lwp * const l = curlwp;
+       struct proc * const p = l->l_proc;
+       struct sigacts * const ps = p->p_sigacts;
+       struct trapframe * const tf = lwp_trapframe(l);
        struct sigframe_sigcontext *fp, frame;
        int onstack, error;
        int sig = ksi->ksi_signo;
        u_long code = KSI_TRAPCODE(ksi);
        sig_t catcher = SIGACTION(p, sig).sa_handler;
 
-       tf = process_frame(l);
-
        fp = getframe(l, sig, &onstack);
 
        /* make room on the stack */
@@ -216,9 +214,9 @@
        /* {
                syscallarg(struct sigcontext *) sigcntxp;
        } */
+       struct trapframe * const tf = lwp_trapframe(l);
+       struct proc * const p = l->l_proc;
        struct sigcontext *scp, context;
-       struct trapframe *tf;
-       struct proc *p = l->l_proc;
 
        /*
         * we do a rather scary test in userland
@@ -243,7 +241,6 @@
                return EINVAL;
 
        /* Restore register context. */
-       tf = process_frame(l);
        tf->tf_r0    = context.sc_r0;
        tf->tf_r1    = context.sc_r1;
        tf->tf_r2    = context.sc_r2;
diff -r 639f8e8cd277 -r e9b8f5d47b3f sys/arch/arm/arm/process_machdep.c
--- a/sys/arch/arm/arm/process_machdep.c        Thu Aug 16 16:23:48 2012 +0000
+++ b/sys/arch/arm/arm/process_machdep.c        Thu Aug 16 16:41:53 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: process_machdep.c,v 1.22 2009/11/21 20:32:17 rmind Exp $       */
+/*     $NetBSD: process_machdep.c,v 1.23 2012/08/16 16:41:53 matt Exp $        */
 
 /*
  * Copyright (c) 1993 The Regents of the University of California.
@@ -133,7 +133,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.22 2009/11/21 20:32:17 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.23 2012/08/16 16:41:53 matt Exp $");
 
 #include <sys/proc.h>
 #include <sys/ptrace.h>
@@ -152,7 +152,7 @@
 int
 process_read_regs(struct lwp *l, struct reg *regs)
 {
-       struct trapframe *tf = process_frame(l);
+       struct trapframe * const tf = lwp_trapframe(l);
 
        KASSERT(tf != NULL);
        memcpy((void *)regs->r, (void *)&tf->tf_r0, sizeof(regs->r));
@@ -190,7 +190,7 @@
 int
 process_write_regs(struct lwp *l, const struct reg *regs)
 {
-       struct trapframe *tf = process_frame(l);
+       struct trapframe * const tf = lwp_trapframe(l);
 
        KASSERT(tf != NULL);
        memcpy(&tf->tf_r0, regs->r, sizeof(regs->r));
@@ -234,7 +234,7 @@
 int
 process_set_pc(struct lwp *l, void *addr)
 {
-       struct trapframe *tf = process_frame(l);
+       struct trapframe * const tf = lwp_trapframe(l);
 
        KASSERT(tf != NULL);
 #ifdef __PROG32
diff -r 639f8e8cd277 -r e9b8f5d47b3f sys/arch/arm/arm/sig_machdep.c
--- a/sys/arch/arm/arm/sig_machdep.c    Thu Aug 16 16:23:48 2012 +0000
+++ b/sys/arch/arm/arm/sig_machdep.c    Thu Aug 16 16:41:53 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sig_machdep.c,v 1.42 2012/05/21 14:15:17 martin Exp $  */
+/*     $NetBSD: sig_machdep.c,v 1.43 2012/08/16 16:41:53 matt Exp $    */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.42 2012/05/21 14:15:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.43 2012/08/16 16:41:53 matt Exp $");
 
 #include <sys/mount.h>         /* XXX only needed by syscallargs.h */
 #include <sys/proc.h>
@@ -66,8 +66,8 @@
 void *
 getframe(struct lwp *l, int sig, int *onstack)
 {
-       struct proc *p = l->l_proc;
-       struct trapframe *tf = process_frame(l);
+       struct proc * const p = l->l_proc;
+       struct trapframe * const tf = lwp_trapframe(l);
 
        /* Do we need to jump onto the signal stack? */
        *onstack = (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0
@@ -90,18 +90,15 @@
 void
 sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
 {
-       struct lwp *l = curlwp;
-       struct proc *p = l->l_proc;
-       struct sigacts *ps = p->p_sigacts;
-       struct trapframe *tf;
+       struct lwp * const l = curlwp;
+       struct proc * const p = l->l_proc;
+       struct sigacts * const ps = p->p_sigacts;
+       struct trapframe * const tf = lwp_trapframe(l);
        struct sigframe_siginfo *fp, frame;
        int onstack, error;
        int sig = ksi->ksi_signo;
        sig_t catcher = SIGACTION(p, sig).sa_handler;
 
-       /* get the current frame */
-       tf = process_frame(l);
-
        fp = getframe(l, sig, &onstack);
        
        /* make room on the stack */
@@ -165,8 +162,8 @@
 void
 cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags)
 {
-       struct trapframe *tf = process_frame(l);
-       __greg_t *gr = mcp->__gregs;
+       struct trapframe * const tf = lwp_trapframe(l);
+       __greg_t * const gr = mcp->__gregs;
        __greg_t ras_pc;
 
        /* Save General Register context. */
@@ -207,7 +204,7 @@
 int
 cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
 {
-       const __greg_t *gr = mcp->__gregs;
+       const __greg_t * const gr = mcp->__gregs;
 
        /* Make sure the processor mode has not been tampered with. */
        if (!VALID_R15_PSR(gr[_REG_PC], gr[_REG_CPSR]))
@@ -218,9 +215,9 @@
 int
 cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
 {
-       struct trapframe *tf = process_frame(l);
-       const __greg_t *gr = mcp->__gregs;
-       struct proc *p = l->l_proc;
+       struct trapframe * const tf = lwp_trapframe(l);
+       const __greg_t * const gr = mcp->__gregs;
+       struct proc * const p = l->l_proc;
        int error;
 
        if ((flags & _UC_CPU) != 0) {
diff -r 639f8e8cd277 -r e9b8f5d47b3f sys/arch/arm/include/frame.h
--- a/sys/arch/arm/include/frame.h      Thu Aug 16 16:23:48 2012 +0000
+++ b/sys/arch/arm/include/frame.h      Thu Aug 16 16:41:53 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frame.h,v 1.15 2012/08/01 22:46:07 matt Exp $  */
+/*     $NetBSD: frame.h,v 1.16 2012/08/16 16:41:54 matt Exp $  */
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -99,7 +99,7 @@
 void sendsig_sigcontext(const ksiginfo_t *, const sigset_t *);
 void *getframe(struct lwp *, int, int *);
 __END_DECLS
-#define process_frame(l) (((struct pcb *)lwp_getpcb(l))->pcb_tf)
+#define lwp_trapframe(l) (((struct pcb *)lwp_getpcb(l))->pcb_tf)
 #endif
 
 #endif /* _LOCORE */
diff -r 639f8e8cd277 -r e9b8f5d47b3f sys/compat/linux/arch/arm/linux_machdep.c
--- a/sys/compat/linux/arch/arm/linux_machdep.c Thu Aug 16 16:23:48 2012 +0000
+++ b/sys/compat/linux/arch/arm/linux_machdep.c Thu Aug 16 16:41:53 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.29 2010/07/07 01:30:33 chs Exp $   */
+/*     $NetBSD: linux_machdep.c,v 1.30 2012/08/16 16:41:53 matt Exp $  */
 
 /*-
  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.29 2010/07/07 01:30:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.30 2012/08/16 16:41:53 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -76,15 +76,14 @@
 void
 linux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
 {
-       struct lwp *l = curlwp;
-       struct proc *p = l->l_proc;
-       struct trapframe *tf;
+       struct lwp * const l = curlwp;
+       struct proc * const p = l->l_proc;
+       struct trapframe * const tf = lwp_trapframe(l);
        struct linux_sigframe *fp, frame;
        int onstack, error;
        const int sig = ksi->ksi_signo;
        sig_t catcher = SIGACTION(p, sig).sa_handler;
 
-       tf = process_frame(l);
 
        /*
         * The Linux version of this code is in
@@ -195,13 +194,11 @@
 linux_sys_sigreturn(struct lwp *l, const struct linux_sys_sigreturn_args *v,
        register_t *retval)
 {
+       struct trapframe * const tf = lwp_trapframe(l);
+       struct proc * const p = l->l_proc;
        struct linux_sigframe *sfp, frame;
-       struct proc *p = l->l_proc;
-       struct trapframe *tf;
        sigset_t mask;
 
-       tf = process_frame(l);
-
        /*
         * The trampoline code hands us the context.
         * It is unsafe to keep track of it ourselves, in the event that a
@@ -219,7 +216,6 @@
                return EINVAL;
 
        /* Restore register context. */
-       tf = process_frame(l);
        tf->tf_r0    = frame.sf_sc.sc_r0;
        tf->tf_r1    = frame.sf_sc.sc_r1;
        tf->tf_r2    = frame.sf_sc.sc_r2;



Home | Main Index | Thread Index | Old Index