summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/include
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2020-09-04 03:53:12 +0000
committerthorpej <thorpej@NetBSD.org>2020-09-04 03:53:12 +0000
commita3f978ce6f32da4391f45429e78b9eb09cfdfd8b (patch)
tree0f0a42a10d5ca3a0fd2b06ff9ffcf381ccc672ab /sys/arch/alpha/include
parent349ada9b9a35f297bd03501a0e97fa1f1c77d449 (diff)
Use SysValue to store curlwp rather than curcpu. curlwp is acceessed
much more frequently, and this makes curlwp preemption-safe.
Diffstat (limited to 'sys/arch/alpha/include')
-rw-r--r--sys/arch/alpha/include/asm.h12
-rw-r--r--sys/arch/alpha/include/cpu.h7
2 files changed, 11 insertions, 8 deletions
diff --git a/sys/arch/alpha/include/asm.h b/sys/arch/alpha/include/asm.h
index b11efeeb821..910167763f3 100644
--- a/sys/arch/alpha/include/asm.h
+++ b/sys/arch/alpha/include/asm.h
@@ -1,4 +1,4 @@
-/* $NetBSD: asm.h,v 1.43 2020/09/04 02:59:44 thorpej Exp $ */
+/* $NetBSD: asm.h,v 1.44 2020/09/04 03:53:12 thorpej Exp $ */
/*
* Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
@@ -662,16 +662,18 @@ label: ASCIZ msg; \
/*
* Get various per-cpu values. A pointer to our cpu_info structure
* is stored in SysValue. These macros clobber v0, t0, t8..t11.
+ * SET_CURLWP also clobbers a0.
*
* All return values are in v0.
*/
#define GET_CURLWP \
- call_pal PAL_OSF1_rdval ; \
- ldq v0, CPU_INFO_CURLWP(v0)
+ call_pal PAL_OSF1_rdval
#define SET_CURLWP(r) \
- call_pal PAL_OSF1_rdval ; \
- stq r, CPU_INFO_CURLWP(v0)
+ ldq v0, L_CPU(r) ; \
+ mov r, a0 ; \
+ stq r, CPU_INFO_CURLWP(v0) ; \
+ call_pal PAL_OSF1_wrval
#else /* if not MULTIPROCESSOR... */
diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h
index e15faf4fcb8..7c78f644548 100644
--- a/sys/arch/alpha/include/cpu.h
+++ b/sys/arch/alpha/include/cpu.h
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.92 2020/09/04 01:57:29 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.93 2020/09/04 03:53:12 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -161,7 +161,8 @@ extern volatile u_long cpus_running;
extern volatile u_long cpus_paused;
extern struct cpu_info *cpu_info[];
-#define curcpu() ((struct cpu_info *)alpha_pal_rdval())
+#define curlwp ((struct lwp *)alpha_pal_rdval())
+#define curcpu() curlwp->l_cpu
#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY)
void cpu_boot_secondary_processors(void);
@@ -170,9 +171,9 @@ void cpu_pause_resume(unsigned long, int);
void cpu_pause_resume_all(int);
#else /* ! MULTIPROCESSOR */
#define curcpu() (&cpu_info_primary)
+#define curlwp curcpu()->ci_curlwp
#endif /* MULTIPROCESSOR */
-#define curlwp curcpu()->ci_curlwp
/*
* definitions of cpu-dependent requirements