Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Fix MULTIPROCESSOR curlwp/curcpu handling.



details:   https://anonhg.NetBSD.org/src/rev/5e5df36e77ff
branches:  trunk
changeset: 761253:5e5df36e77ff
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Jan 22 10:57:07 2011 +0000

description:
Fix MULTIPROCESSOR curlwp/curcpu handling.

diffstat:

 sys/arch/hp700/hp700/genassym.cf |  11 +++++++++--
 sys/arch/hp700/hp700/locore.S    |  14 +++-----------
 sys/arch/hp700/include/cpu.h     |  22 +++++++++++++++++++++-
 sys/arch/hppa/hppa/trap.S        |  14 +++++---------
 4 files changed, 38 insertions(+), 23 deletions(-)

diffs (159 lines):

diff -r 818794cca9a2 -r 5e5df36e77ff sys/arch/hp700/hp700/genassym.cf
--- a/sys/arch/hp700/hp700/genassym.cf  Sat Jan 22 10:37:22 2011 +0000
+++ b/sys/arch/hp700/hp700/genassym.cf  Sat Jan 22 10:57:07 2011 +0000
@@ -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)
diff -r 818794cca9a2 -r 5e5df36e77ff sys/arch/hp700/hp700/locore.S
--- a/sys/arch/hp700/hp700/locore.S     Sat Jan 22 10:37:22 2011 +0000
+++ b/sys/arch/hp700/hp700/locore.S     Sat Jan 22 10:57:07 2011 +0000
@@ -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
diff -r 818794cca9a2 -r 5e5df36e77ff sys/arch/hp700/include/cpu.h
--- a/sys/arch/hp700/include/cpu.h      Sat Jan 22 10:37:22 2011 +0000
+++ b/sys/arch/hp700/include/cpu.h      Sat Jan 22 10:57:07 2011 +0000
@@ -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
 
diff -r 818794cca9a2 -r 5e5df36e77ff sys/arch/hppa/hppa/trap.S
--- a/sys/arch/hppa/hppa/trap.S Sat Jan 22 10:37:22 2011 +0000
+++ b/sys/arch/hppa/hppa/trap.S Sat Jan 22 10:57:07 2011 +0000
@@ -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



Home | Main Index | Thread Index | Old Index