summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2024-10-24 05:28:01 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2024-10-24 05:28:01 +0000
commite75e3b8b1d4ca596b6d9012dfdd7d2045e132685 (patch)
tree1f98ec1798e993773c154574bada08abace7477a
parent48ac1c963a8432040dc5fc8754cc2e3c06a95952 (diff)
Add a ci_intrdepth field to struct cpu_info for sh, and use it to implement
CLKF_INTR properly.
-rw-r--r--sys/arch/landisk/landisk/intr.c6
-rw-r--r--sys/arch/sh/include/cpu.h5
2 files changed, 8 insertions, 3 deletions
diff --git a/sys/arch/landisk/landisk/intr.c b/sys/arch/landisk/landisk/intr.c
index 14b00b85f33..4e5d4470de0 100644
--- a/sys/arch/landisk/landisk/intr.c
+++ b/sys/arch/landisk/landisk/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.10 2015/08/29 23:59:19 deraadt Exp $ */
+/* $OpenBSD: intr.c,v 1.11 2024/10/24 05:28:00 miod Exp $ */
/* $NetBSD: intr.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*-
@@ -73,6 +73,8 @@ intc_intr(int ssr, int spc, int ssp)
struct clockframe cf;
int evtcode;
+ curcpu()->ci_intrdepth++;
+
evtcode = _reg_read_4(SH4_INTEVT);
ih = EVTCODE_IH(evtcode);
KDASSERT(ih->ih_func);
@@ -119,6 +121,8 @@ intc_intr(int ssr, int spc, int ssp)
printf("NMI ignored.\n");
break;
}
+
+ curcpu()->ci_intrdepth--;
}
void
diff --git a/sys/arch/sh/include/cpu.h b/sys/arch/sh/include/cpu.h
index e1bb2283c64..f55b9866a6c 100644
--- a/sys/arch/sh/include/cpu.h
+++ b/sys/arch/sh/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.39 2024/06/09 21:15:29 jca Exp $ */
+/* $OpenBSD: cpu.h,v 1.40 2024/10/24 05:28:00 miod Exp $ */
/* $NetBSD: cpu.h,v 1.41 2006/01/21 04:24:12 uwe Exp $ */
/*-
@@ -72,6 +72,7 @@ struct cpu_info {
#endif
int ci_want_resched;
+ int ci_intrdepth;
struct clockqueue ci_queue;
@@ -105,7 +106,7 @@ struct clockframe {
#define CLKF_USERMODE(cf) (!KERNELMODE((cf)->ssr))
#define CLKF_PC(cf) ((cf)->spc)
-#define CLKF_INTR(cf) 0 /* XXX */
+#define CLKF_INTR(cf) (curcpu()->ci_intrdepth > 1)
/*
* This is used during profiling to integrate system time. It can safely