summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2013-09-10 12:35:25 +0000
committerpatrick <patrick@openbsd.org>2013-09-10 12:35:25 +0000
commitf5bc2bf2524a318d54119b004c78901d1140d8f0 (patch)
treede85c11eb1aa76700e3790918ec230a0dd1666ff
parentAdd support for the SM_PATH environment variable. This changes the (diff)
downloadwireguard-openbsd-f5bc2bf2524a318d54119b004c78901d1140d8f0.tar.xz
wireguard-openbsd-f5bc2bf2524a318d54119b004c78901d1140d8f0.zip
Store the current interrupt depth in curcpu, so that it's per CPU
and not just a global variable. ok rapha@
-rw-r--r--sys/arch/arm/arm/fault.c6
-rw-r--r--sys/arch/arm/arm/genassym.cf3
-rw-r--r--sys/arch/arm/arm/irq_dispatch.S22
-rw-r--r--sys/arch/arm/arm/pmap.c4
-rw-r--r--sys/arch/arm/include/cpu.h18
5 files changed, 26 insertions, 27 deletions
diff --git a/sys/arch/arm/arm/fault.c b/sys/arch/arm/arm/fault.c
index c3867259031..c88500b5629 100644
--- a/sys/arch/arm/arm/fault.c
+++ b/sys/arch/arm/arm/fault.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fault.c,v 1.13 2013/04/28 13:27:13 patrick Exp $ */
+/* $OpenBSD: fault.c,v 1.14 2013/09/10 12:35:25 patrick Exp $ */
/* $NetBSD: fault.c,v 1.46 2004/01/21 15:39:21 skrll Exp $ */
/*
@@ -374,7 +374,7 @@ data_abort_handler(trapframe_t *tf)
goto out;
}
- if (__predict_false(current_intr_depth > 0)) {
+ if (__predict_false(curcpu()->ci_idepth > 0)) {
if (pcb->pcb_onfault) {
tf->tf_r0 = EINVAL;
tf->tf_pc = (register_t) pcb->pcb_onfault;
@@ -692,7 +692,7 @@ prefetch_abort_handler(trapframe_t *tf)
goto out;
#ifdef DIAGNOSTIC
- if (__predict_false(current_intr_depth > 0)) {
+ if (__predict_false(curcpu()->ci_idepth > 0)) {
printf("\nNon-emulated prefetch abort with intr_depth > 0\n");
dab_fatal(tf, fsr, far, NULL, NULL);
}
diff --git a/sys/arch/arm/arm/genassym.cf b/sys/arch/arm/arm/genassym.cf
index 1d41dbb7392..8353560d59e 100644
--- a/sys/arch/arm/arm/genassym.cf
+++ b/sys/arch/arm/arm/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.11 2013/04/30 13:04:25 patrick Exp $
+# $OpenBSD: genassym.cf,v 1.12 2013/09/10 12:35:25 patrick Exp $
# $NetBSD: genassym.cf,v 1.27 2003/11/04 10:33:16 dsl Exp$
# Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -158,6 +158,7 @@ struct cpu_info
#member CI_CURPRIORITY ci_schedstate.spc_curpriority
member ci_curproc
#member ci_curpcb
+member ci_idepth
# Constants required for in_cksum() and friends.
define M_LEN offsetof(struct mbuf, m_len)
diff --git a/sys/arch/arm/arm/irq_dispatch.S b/sys/arch/arm/arm/irq_dispatch.S
index da07574381b..516d618ac47 100644
--- a/sys/arch/arm/arm/irq_dispatch.S
+++ b/sys/arch/arm/arm/irq_dispatch.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: irq_dispatch.S,v 1.7 2011/09/20 22:02:11 miod Exp $ */
+/* $OpenBSD: irq_dispatch.S,v 1.8 2013/09/10 12:35:25 patrick Exp $ */
/* $NetBSD: irq_dispatch.S,v 1.5 2003/10/30 08:57:24 scw Exp $ */
/*
@@ -86,8 +86,8 @@
*/
.text
.align 0
-.Lcurrent_intr_depth:
- .word _C_LABEL(current_intr_depth)
+.Lcpu_info_store:
+ .word _C_LABEL(cpu_info_store)
AST_LOCALS
@@ -102,14 +102,14 @@ ASENTRY_NP(irq_entry)
* callee-saved regs here. We use the following registers, which
* we expect to persist:
*
- * r5 address of `current_intr_depth' variable
- * r6 old value of `current_intr_depth'
+ * r5 address of the curcpu struct
+ * r6 old value of curcpu()->ci_idepth
*/
- ldr r5, .Lcurrent_intr_depth
+ ldr r5, .Lcpu_info_store
mov r0, sp /* arg for dispatcher */
- ldr r6, [r5]
+ ldr r6, [r5, #CI_IDEPTH]
add r1, r6, #1
- str r1, [r5]
+ str r1, [r5, #CI_IDEPTH]
bl ARM_IRQ_HANDLER
@@ -117,7 +117,7 @@ ASENTRY_NP(irq_entry)
* Restore the old interrupt depth value (which should be the
* same as decrementing it at this point).
*/
- str r6, [r5]
+ str r6, [r5, #CI_IDEPTH]
DO_AST
PULLFRAMEFROMSVCANDEXIT
@@ -129,7 +129,3 @@ ASENTRY_NP(irq_entry)
.global _C_LABEL(astpending)
_C_LABEL(astpending):
.word 0
-
- .global _C_LABEL(current_intr_depth)
-_C_LABEL(current_intr_depth):
- .word 0
diff --git a/sys/arch/arm/arm/pmap.c b/sys/arch/arm/arm/pmap.c
index 0f8f0dfeb57..25f1b29c13f 100644
--- a/sys/arch/arm/arm/pmap.c
+++ b/sys/arch/arm/arm/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.43 2013/06/09 12:53:42 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.44 2013/09/10 12:35:25 patrick Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@@ -925,7 +925,7 @@ pmap_use_l1(pmap_t pm)
* Access to an L1 by the kernel pmap must not affect
* the LRU list.
*/
- if (current_intr_depth || pm == pmap_kernel())
+ if (curcpu()->ci_idepth || pm == pmap_kernel())
return;
l1 = pm->pm_l1;
diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h
index 5dac9ac0578..c05a6dafc1f 100644
--- a/sys/arch/arm/include/cpu.h
+++ b/sys/arch/arm/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.35 2013/05/31 17:00:58 tedu Exp $ */
+/* $OpenBSD: cpu.h,v 1.36 2013/09/10 12:35:26 patrick Exp $ */
/* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */
/*
@@ -142,8 +142,7 @@ extern int cpu_do_powersave;
* CLKF_INTR: True if we took the interrupt from inside another
* interrupt handler.
*/
-extern int current_intr_depth;
-#define CLKF_INTR(frame) (current_intr_depth > 1)
+#define CLKF_INTR(frame) (curcpu()->ci_idepth > 1)
/*
* CLKF_PC: Extract the program counter from a clockframe
@@ -179,13 +178,11 @@ void arm32_vector_init(vaddr_t, int);
#include <sys/device.h>
#include <sys/sched.h>
struct cpu_info {
+ struct device *ci_dev; /* Device corresponding to this CPU */
+ struct schedstate_percpu ci_schedstate; /* scheduler state */
+
struct proc *ci_curproc;
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#ifdef DIAGNOSTIC
- int ci_mutex_level;
-#endif
- struct device *ci_dev; /* Device corresponding to this CPU */
u_int32_t ci_arm_cpuid; /* aggregate CPU id */
u_int32_t ci_arm_cputype; /* CPU type */
u_int32_t ci_arm_cpurev; /* CPU revision */
@@ -194,6 +191,11 @@ struct cpu_info {
uint32_t ci_cpl;
uint32_t ci_ipending;
+ uint32_t ci_idepth;
+#ifdef DIAGNOSTIC
+ int ci_mutex_level;
+#endif
+
#ifdef GPROF
struct gmonparam *ci_gmon;
#endif