Module Name: src
Committed By: thorpej
Date: Tue Jan 16 02:14:33 UTC 2024
Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c m68k_intr_stubs.s
Log Message:
Increment and decrement idepth in the assembly stubs, not C code. This
provides two advantages:
- Greater coverage for detecting "interrupt time".
- More flexibility for platform-specific interrupt stubs that might need
to do special processing before calling the common dispatcher.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/m68k_intr_stubs.s
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.8 src/sys/arch/m68k/m68k/m68k_intr.c:1.9
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.8 Tue Jan 16 01:16:46 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c Tue Jan 16 02:14:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: m68k_intr.c,v 1.8 2024/01/16 01:16:46 thorpej Exp $ */
+/* $NetBSD: m68k_intr.c,v 1.9 2024/01/16 02:14:33 thorpej Exp $ */
/*-
* Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.8 2024/01/16 01:16:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.9 2024/01/16 02:14:33 thorpej Exp $");
#define _M68K_INTR_PRIVATE
@@ -70,7 +70,7 @@ extern char intrstub_vectored[];
/* A dummy event counter where interrupt stats go to die. */
static struct evcnt bitbucket;
-volatile int idepth;
+volatile int idepth; /* updated in assembly glue */
static struct m68k_intrhand_list m68k_intrhands_autovec[NAUTOVECTORS];
#ifdef __HAVE_M68K_INTR_VECTORED
@@ -389,8 +389,6 @@ m68k_intr_autovec(struct clockframe fram
struct m68k_intrhand *ih;
bool rv = false;
- idepth++;
-
m68k_count_intr(ipl);
LIST_FOREACH(ih, &m68k_intrhands_autovec[ipl], ih_link) {
@@ -404,8 +402,6 @@ m68k_intr_autovec(struct clockframe fram
printf("Spurious interrupt on IPL %d\n", ipl);
}
- idepth--;
-
ATOMIC_CAS_CHECK(&frame);
}
@@ -424,8 +420,6 @@ m68k_intr_vectored(struct clockframe fra
const int ipl = (getsr() >> 8) & 7;
struct m68k_intrhand *ih;
- idepth++;
-
m68k_count_intr(ipl);
#ifdef DIAGNOSTIC
@@ -450,8 +444,6 @@ m68k_intr_vectored(struct clockframe fra
#ifdef DIAGNOSTIC
out:
#endif
- idepth--;
-
ATOMIC_CAS_CHECK(&frame);
}
#endif /* __HAVE_M68K_INTR_VECTORED */
Index: src/sys/arch/m68k/m68k/m68k_intr_stubs.s
diff -u src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.2 src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.3
--- src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.2 Tue Jan 16 01:16:46 2024
+++ src/sys/arch/m68k/m68k/m68k_intr_stubs.s Tue Jan 16 02:14:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: m68k_intr_stubs.s,v 1.2 2024/01/16 01:16:46 thorpej Exp $ */
+/* $NetBSD: m68k_intr_stubs.s,v 1.3 2024/01/16 02:14:33 thorpej Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -62,9 +62,11 @@
*/
INTRSTUB_ALIGN
ENTRY_NOPROFILE(intrstub_autovec)
+ addql #1,_C_LABEL(idepth)
INTERRUPT_SAVEREG
jbsr _C_LABEL(m68k_intr_autovec)
INTERRUPT_RESTOREREG
+ subql #1,_C_LABEL(idepth)
jra _ASM_LABEL(rei)
#ifdef __HAVE_M68K_INTR_VECTORED
@@ -73,8 +75,10 @@ ENTRY_NOPROFILE(intrstub_autovec)
*/
INTRSTUB_ALIGN
ENTRY_NOPROFILE(intrstub_vectored)
+ addql #1,_C_LABEL(idepth)
INTERRUPT_SAVEREG
jbsr _C_LABEL(m68k_intr_vectored)
INTERRUPT_RESTOREREG
+ subql #1,_C_LABEL(idepth)
jra _ASM_LABEL(rei)
#endif /* __HAVE_M68K_INTR_VECTORED */