Module Name:    src
Committed By:   nisimura
Date:           Wed Dec 29 13:43:58 UTC 2010

Modified Files:
        src/sys/arch/sh3/sh3: exception.c vm_machdep.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/sh3/sh3/exception.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/sh3/sh3/vm_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sh3/sh3/exception.c
diff -u src/sys/arch/sh3/sh3/exception.c:1.56 src/sys/arch/sh3/sh3/exception.c:1.57
--- src/sys/arch/sh3/sh3/exception.c:1.56	Mon Dec 20 00:25:43 2010
+++ src/sys/arch/sh3/sh3/exception.c	Wed Dec 29 13:43:58 2010
@@ -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;

Index: src/sys/arch/sh3/sh3/vm_machdep.c
diff -u src/sys/arch/sh3/sh3/vm_machdep.c:1.67 src/sys/arch/sh3/sh3/vm_machdep.c:1.68
--- src/sys/arch/sh3/sh3/vm_machdep.c:1.67	Fri Apr 23 19:18:10 2010
+++ src/sys/arch/sh3/sh3/vm_machdep.c	Wed Dec 29 13:43:58 2010
@@ -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;

Reply via email to