Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm Add an agnostic version of curlwp and curcpu() ...



details:   https://anonhg.NetBSD.org/src/rev/760caa23535c
branches:  trunk
changeset: 337251:760caa23535c
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Apr 08 07:29:44 2015 +0000

description:
Add an agnostic version of curlwp and curcpu() for modules since they won't
know if the kernel was built with TPIDRPRW_IS_CUR{LWP,CPU} or not.

diffstat:

 sys/arch/arm/arm/arm_machdep.c |  21 ++++++++++++++++++---
 sys/arch/arm/include/cpu.h     |  10 +++++++++-
 2 files changed, 27 insertions(+), 4 deletions(-)

diffs (69 lines):

diff -r 6259723a1a2f -r 760caa23535c sys/arch/arm/arm/arm_machdep.c
--- a/sys/arch/arm/arm/arm_machdep.c    Wed Apr 08 06:03:09 2015 +0000
+++ b/sys/arch/arm/arm/arm_machdep.c    Wed Apr 08 07:29:44 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm_machdep.c,v 1.43 2014/10/29 14:14:14 skrll Exp $   */
+/*     $NetBSD: arm_machdep.c,v 1.44 2015/04/08 07:29:44 matt Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -76,10 +76,11 @@
 #include "opt_cputypes.h"
 #include "opt_arm_debug.h"
 #include "opt_multiprocessor.h"
+#include "opt_modular.h"
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.43 2014/10/29 14:14:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.44 2015/04/08 07:29:44 matt Exp $");
 
 #include <sys/exec.h>
 #include <sys/proc.h>
@@ -212,7 +213,7 @@
 void
 startlwp(void *arg)
 {
-       ucontext_t *uc = arg; 
+       ucontext_t *uc = (ucontext_t *)arg; 
        lwp_t *l = curlwp;
        int error __diagused;
 
@@ -306,3 +307,17 @@
                tf->tf_pc = (vaddr_t)ucas_32_ras_start;
        }
 }
+
+#ifdef MODULAR
+struct lwp *
+arm_curlwp(void)
+{
+       return curlwp;
+}
+
+struct cpu_info *
+arm_curcpu(void)
+{
+       return curcpu();
+}
+#endif
diff -r 6259723a1a2f -r 760caa23535c sys/arch/arm/include/cpu.h
--- a/sys/arch/arm/include/cpu.h        Wed Apr 08 06:03:09 2015 +0000
+++ b/sys/arch/arm/include/cpu.h        Wed Apr 08 07:29:44 2015 +0000
@@ -180,7 +180,15 @@
 
 extern struct cpu_info cpu_info_store;
 
-#if defined(TPIDRPRW_IS_CURLWP)
+struct lwp *arm_curlwp(void);
+struct cpu_info *arm_curcpu(void);
+
+#if defined(_MODULE)
+
+#define        curlwp          arm_curlwp()
+#define curcpu()       arm_curcpu()
+
+#elif defined(TPIDRPRW_IS_CURLWP)
 static inline struct lwp *
 _curlwp(void)
 {



Home | Main Index | Thread Index | Old Index