Module Name:    src
Committed By:   skrll
Date:           Sat Jan 22 10:57:08 UTC 2011

Modified Files:
        src/sys/arch/hp700/hp700: genassym.cf locore.S
        src/sys/arch/hp700/include: cpu.h
        src/sys/arch/hppa/hppa: trap.S

Log Message:
Fix MULTIPROCESSOR curlwp/curcpu handling.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hp700/hp700/genassym.cf
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/hp700/hp700/locore.S
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/hp700/include/cpu.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/hppa/hppa/trap.S

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/hp700/hp700/genassym.cf
diff -u src/sys/arch/hp700/hp700/genassym.cf:1.25 src/sys/arch/hp700/hp700/genassym.cf:1.26
--- src/sys/arch/hp700/hp700/genassym.cf:1.25	Fri Jan 14 02:06:26 2011
+++ src/sys/arch/hp700/hp700/genassym.cf	Sat Jan 22 10:57:07 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.25 2011/01/14 02:06:26 rmind Exp $
+#	$NetBSD: genassym.cf,v 1.26 2011/01/22 10:57:07 skrll Exp $
 
 #	$OpenBSD: genassym.cf,v 1.18 2001/09/20 18:31:14 mickey Exp $
 
@@ -33,6 +33,10 @@
 #	@(#)genassym.c	8.3 (Berkeley) 1/4/94
 #
 
+if defined(_KERNEL_OPT)
+include "opt_multiprocessor.h"
+endif
+
 quote #define __MUTEX_PRIVATE
 quote #define __RWLOCK_PRIVATE
 
@@ -91,8 +95,11 @@
 #define	CI_INTR_DEPTH		offsetof(struct cpu_info, ci_intr_depth)
 #define	CI_SOFTLWPS		offsetof(struct cpu_info, ci_softlwps)
 define	CI_MTX_COUNT		offsetof(struct cpu_info, ci_mtx_count)
-#define	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
 define	CI_TRAPSAVE		offsetof(struct cpu_info, ci_trapsave)
+ifdef MULTIPROCESSOR
+define	CI_CURLWP               offsetof(struct cpu_info, ci_curlwp)
+endif
+
 
 define	MTX_IPL			offsetof(struct kmutex, mtx_ipl)
 define	MTX_LOCK		offsetof(struct kmutex, mtx_lock)

Index: src/sys/arch/hp700/hp700/locore.S
diff -u src/sys/arch/hp700/hp700/locore.S:1.49 src/sys/arch/hp700/hp700/locore.S:1.50
--- src/sys/arch/hp700/hp700/locore.S:1.49	Mon Jan 17 12:37:46 2011
+++ src/sys/arch/hp700/hp700/locore.S	Sat Jan 22 10:57:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.49 2011/01/17 12:37:46 skrll Exp $	*/
+/*	$NetBSD: locore.S,v 1.50 2011/01/22 10:57:07 skrll Exp $	*/
 /*	$OpenBSD: locore.S,v 1.158 2008/07/28 19:08:46 miod Exp $	*/
 
 /*
@@ -57,12 +57,14 @@
  *  suitability of this software for any purpose.
  */
 
+#include "opt_multiprocessor.h"
 #include "opt_cputype.h"
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
 
 #include <sys/errno.h>
 #include <machine/param.h>
+#include <machine/cpu.h>
 #include <machine/asm.h>
 #include <machine/psl.h>
 #include <machine/trap.h>
@@ -141,16 +143,6 @@
 #define	MTCPU_U(x,r)	.word	0x14001840 | ((r) << 21) | ((x) << 16)
 #endif
 
-#ifdef MULTIPROCESSOR
-#define	GET_CURCPU(r)	mfctl	CR_CURCPU, r
-#define	GET_CURLWP(r)	mfctl	CR_CURCPU, r ! ldw	CI_CURLWP(r), r
-#define	SET_CURLWP(r,s)	mfctl	CR_CURCPU, s ! stw	r, CI_CURLWP(s)
-#else
-#define	GET_CURCPU(r)	mfctl	CR_CURLWP, r ! ldw	L_CPU(r), r
-#define	GET_CURLWP(r)	mfctl	CR_CURLWP, r
-#define	SET_CURLWP(r,s)	mtctl	r, CR_CURLWP
-#endif
-
 	.import	$global$, data
 	.import pdc, data
 	.import	boothowto, data

Index: src/sys/arch/hp700/include/cpu.h
diff -u src/sys/arch/hp700/include/cpu.h:1.57 src/sys/arch/hp700/include/cpu.h:1.58
--- src/sys/arch/hp700/include/cpu.h:1.57	Thu Jan 20 19:47:40 2011
+++ src/sys/arch/hp700/include/cpu.h	Sat Jan 22 10:57:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.57 2011/01/20 19:47:40 skrll Exp $	*/
+/*	$NetBSD: cpu.h,v 1.58 2011/01/22 10:57:07 skrll Exp $	*/
 
 /*	$OpenBSD: cpu.h,v 1.55 2008/07/23 17:39:35 kettenis Exp $	*/
 
@@ -187,6 +187,26 @@
 #define	HPPA_SPA_ENABLE	0x00000020
 #define	HPPA_NMODSPBUS	64
 
+#ifdef MULTIPROCESSOR
+
+#define	GET_CURCPU(r)		mfctl CR_CURCPU, r
+#define	GET_CURCPU_SPACE(s, r)	GET_CURCPU(r)
+#define	GET_CURLWP(r)		mfctl CR_CURCPU, r ! ldw CI_CURLWP(r), r
+#define	GET_CURLWP_SPACE(s, r)	mfctl CR_CURCPU, r ! ldw CI_CURLWP(s, r), r
+
+#define	SET_CURLWP(r,t)		mfctl CR_CURCPU, t ! stw r, CI_CURLWP(t)
+
+#else /*  MULTIPROCESSOR */
+
+#define	GET_CURCPU(r)		mfctl CR_CURLWP, r ! ldw L_CPU(r), r
+#define	GET_CURCPU_SPACE(s, r)	mfctl CR_CURLWP, r ! ldw L_CPU(s, r), r
+#define	GET_CURLWP(r)		mfctl CR_CURLWP, r
+#define	GET_CURLWP_SPACE(s, r)	GET_CURLWP(r)
+
+#define	SET_CURLWP(r,t) mtctl   r, CR_CURLWP
+
+#endif /*  MULTIPROCESSOR */
+
 #ifndef _LOCORE
 #ifdef _KERNEL
 

Index: src/sys/arch/hppa/hppa/trap.S
diff -u src/sys/arch/hppa/hppa/trap.S:1.50 src/sys/arch/hppa/hppa/trap.S:1.51
--- src/sys/arch/hppa/hppa/trap.S:1.50	Sun Jun  6 12:13:36 2010
+++ src/sys/arch/hppa/hppa/trap.S	Sat Jan 22 10:57:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.S,v 1.50 2010/06/06 12:13:36 skrll Exp $	*/
+/*	$NetBSD: trap.S,v 1.51 2011/01/22 10:57:07 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -96,6 +96,7 @@
  */
 
 #include "opt_compat_osf1.h"
+#include "opt_multiprocessor.h"
 #include "opt_cputype.h"
 
 /* 
@@ -203,7 +204,7 @@
 	 */
 
 	/* t2 = curlwp PCB */
-	GET_CURLWP(%t3)
+	GET_CURLWP_SPACE(%sr1, %t3)
 	ldw	L_PCB(%sr1, %t3), %t2			/* XXX can use ,sl */
 
 	/*
@@ -507,12 +508,7 @@
 	ldw	TF_CR30(%sr3, %t3), %t1
 	mtctl	%t1, CR_FPPADDR
 
-#ifdef MULTIPROCESSOR
-	mfctl	CR_CURCPU, %t3
-#else
-	mfctl	CR_CURLWP, %t3
-	ldw	L_CPU(%sr3, %t3), %t3
-#endif
+	GET_CURCPU_SPACE(%sr3, %t3)
 
 	/*
 	 * Clear the system mask, this puts us back into physical mode.  Reload
@@ -1978,7 +1974,7 @@
 	comb,<>	%t1, %t2, L$trap_from_kernel	/* if %t1 != %t2 => kernel */
 	dep	%r0, 31, 6, %sp			/* Assumed stack align step 2 */
 
-	mfctl	CR_CURLWP, %t2
+	GET_CURLWP(%t2)
 	depi	1, T_USER_POS, 1, %r1
 	depi	1, TFF_LAST_POS, 1, %r1
 	ldw	L_PCB(%t2), %sp

Reply via email to