Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/include Allow TPIDRPRW_IS_CURLWP to be used wit...



details:   https://anonhg.NetBSD.org/src/rev/1aae0e4e8fc6
branches:  trunk
changeset: 807240:1aae0e4e8fc6
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Apr 02 03:22:51 2015 +0000

description:
Allow TPIDRPRW_IS_CURLWP to be used with MULTIPROCESSOR kernels

diffstat:

 sys/arch/arm/include/cpu.h |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (49 lines):

diff -r 27985908782b -r 1aae0e4e8fc6 sys/arch/arm/include/cpu.h
--- a/sys/arch/arm/include/cpu.h        Thu Apr 02 03:11:34 2015 +0000
+++ b/sys/arch/arm/include/cpu.h        Thu Apr 02 03:22:51 2015 +0000
@@ -128,9 +128,11 @@
 /*
  * Per-CPU information.  For now we assume one CPU.
  */
+#ifdef _KERNEL
 static inline int curcpl(void);
 static inline void set_curcpl(int);
 static inline void cpu_dosoftints(void);
+#endif
 
 #ifdef _KMEMUSER
 #include <sys/intr.h>
@@ -179,9 +181,6 @@
 extern struct cpu_info cpu_info_store;
 
 #if defined(TPIDRPRW_IS_CURLWP)
-#if defined(MULTIPROCESSOR)
-#error MULTIPROCESSOR requires TPIDRPRW_IS_CURCPU not TPIDRPRW_IS_CURLWP
-#else
 static inline struct lwp *
 _curlwp(void)
 {
@@ -194,8 +193,12 @@
        armreg_tpidrprw_write((uintptr_t)l);
 }
 
-#define        curcpu()        (&cpu_info_store)
-#endif
+// Also in <sys/lwp.h> but also here if this was included before <sys/lwp.h> 
+static inline struct cpu_info *lwp_getcpu(struct lwp *);
+
+#define        curlwp          _curlwp()
+// curcpu() expands into two instructions: a mrc and a ldr
+#define        curcpu()        lwp_getcpu(_curlwp())
 #elif defined(TPIDRPRW_IS_CURCPU)
 static inline struct cpu_info *
 curcpu(void)
@@ -205,7 +208,7 @@
 #elif !defined(MULTIPROCESSOR)
 #define        curcpu()        (&cpu_info_store)
 #else
-#error MULTIPROCESSOR requires TPIDRPRW_IS_CURCPU
+#error MULTIPROCESSOR requires TPIDRPRW_IS_CURCPU or TPIDRPRW_IS_CURLWP
 #endif /* !TPIDRPRW_IS_CURCPU && !TPIDRPRW_IS_CURLWP */
 
 #ifndef curlwp



Home | Main Index | Thread Index | Old Index