Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh3/sh3 use lwp_getpcb() to hide the detail about h...



details:   https://anonhg.NetBSD.org/src/rev/1e08259c8d33
branches:  trunk
changeset: 760159:1e08259c8d33
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Wed Dec 29 13:43:58 2010 +0000

description:
use lwp_getpcb() to hide the detail about how struct pcb is populated.

diffstat:

 sys/arch/sh3/sh3/exception.c  |  10 ++++++----
 sys/arch/sh3/sh3/vm_machdep.c |  12 +++++++-----
 2 files changed, 13 insertions(+), 9 deletions(-)

diffs (91 lines):

diff -r c7ca6fce4e8f -r 1e08259c8d33 sys/arch/sh3/sh3/exception.c
--- a/sys/arch/sh3/sh3/exception.c      Wed Dec 29 13:43:16 2010 +0000
+++ b/sys/arch/sh3/sh3/exception.c      Wed Dec 29 13:43:58 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exception.c,v 1.56 2010/12/20 00:25:43 matt Exp $      */
+/*     $NetBSD: exception.c,v 1.57 2010/12/29 13:43:58 nisimura Exp $  */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.56 2010/12/20 00:25:43 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.57 2010/12/29 13:43:58 nisimura Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -139,6 +139,7 @@
 {
        int expevt = tf->tf_expevt;
        bool usermode = !KERNELMODE(tf->tf_ssr);
+       struct pcb *pcb;
        ksiginfo_t ksi;
        uint32_t trapcode;
 #ifdef DDB
@@ -191,8 +192,9 @@
 
        case EXPEVT_ADDR_ERR_LD: /* FALLTHROUGH */
        case EXPEVT_ADDR_ERR_ST:
-               KDASSERT(l->l_md.md_pcb->pcb_onfault != NULL);
-               tf->tf_spc = (int)l->l_md.md_pcb->pcb_onfault;
+               pcb = lwp_getpcb(l);
+               KDASSERT(pcb->pcb_onfault != NULL);
+               tf->tf_spc = (int)pcb->pcb_onfault;
                tf->tf_r0 = EFAULT;
                if (tf->tf_spc == 0)
                        goto do_panic;
diff -r c7ca6fce4e8f -r 1e08259c8d33 sys/arch/sh3/sh3/vm_machdep.c
--- a/sys/arch/sh3/sh3/vm_machdep.c     Wed Dec 29 13:43:16 2010 +0000
+++ b/sys/arch/sh3/sh3/vm_machdep.c     Wed Dec 29 13:43:58 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.67 2010/04/23 19:18:10 rmind Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.68 2010/12/29 13:43:58 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.67 2010/04/23 19:18:10 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.68 2010/12/29 13:43:58 nisimura Exp $");
 
 #include "opt_kstack_debug.h"
 
@@ -134,6 +134,7 @@
 cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack,
     size_t stacksize, void (*func)(void *), void *arg)
 {
+       struct pcb *pcb;
        struct switchframe *sf;
 
 #if 0 /* FIXME: probably wrong for yamt-idlelwp */
@@ -151,7 +152,8 @@
                l2->l_md.md_regs->tf_r15 = (u_int)stack + stacksize;
 
        /* When l2 is switched to, jump to the trampoline */
-       sf = &l2->l_md.md_pcb->pcb_sf;
+       pcb = lwp_getpcb(l2);
+       sf = &pcb->pcb_sf;
        sf->sf_pr  = (int)lwp_trampoline;
        sf->sf_r10 = (int)l2;   /* "new" lwp for lwp_startup() */
        sf->sf_r11 = (int)arg;  /* hook function/argument */
@@ -166,14 +168,14 @@
 void
 cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)
 {
-       struct switchframe *sf;
+       struct pcb *pcb = lwp_getpcb(l);
+       struct switchframe *sf = &pcb->pcb_sf;
 
        sh3_setup_uarea(l);
 
        l->l_md.md_regs->tf_ssr = PSL_USERSET;
 
        /* When lwp is switched to, jump to the trampoline */
-       sf = &l->l_md.md_pcb->pcb_sf;
        sf->sf_pr  = (int)lwp_setfunc_trampoline;
        sf->sf_r11 = (int)arg;  /* hook function/argument */
        sf->sf_r12 = (int)func;



Home | Main Index | Thread Index | Old Index