Module Name:    src
Committed By:   thorpej
Date:           Tue Jan 16 01:16:47 UTC 2024

Modified Files:
        src/sys/arch/m68k/include: intr.h
        src/sys/arch/m68k/m68k: m68k_intr.c m68k_intr_stubs.s

Log Message:
- Declare idepth as volatile.
- Provide a m68k_intrvec_intrhand() routine that returns the interrupt
  handle for a given vectored interrupt.  XXX This is gross and should
  burn to the ground, but is needed to support legacy ISR interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.1 -r1.2 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/include/intr.h
diff -u src/sys/arch/m68k/include/intr.h:1.4 src/sys/arch/m68k/include/intr.h:1.5
--- src/sys/arch/m68k/include/intr.h:1.4	Mon Jan 15 18:47:03 2024
+++ src/sys/arch/m68k/include/intr.h	Tue Jan 16 01:16:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.4 2024/01/15 18:47:03 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.5 2024/01/16 01:16:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023, 2024 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@ typedef struct {
 #endif
 
 #ifdef _KERNEL
-extern int idepth;		/* interrupt depth */
+extern volatile int idepth;		/* interrupt depth */
 extern const uint16_t ipl2psl_table[NIPL];
 
 typedef int ipl_t;		/* logical IPL_* value */
@@ -198,6 +198,10 @@ void	*m68k_intr_establish(int (*)(void *
 	    int/*vec*/, int/*m68k ipl*/, int/*isrpri*/, int/*flags*/);
 bool	m68k_intr_disestablish(void *);
 
+#ifdef __HAVE_M68K_INTR_VECTORED
+void	*m68k_intrvec_intrhand(int vec);	/* XXX */
+#endif
+
 #endif /* _KERNEL */
 
 #endif /* _M68k_INTR_H_ */

Index: src/sys/arch/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.7 src/sys/arch/m68k/m68k/m68k_intr.c:1.8
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.7	Mon Jan 15 19:27:16 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Tue Jan 16 01:16:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.7 2024/01/15 19:27:16 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.8 2024/01/16 01:16:46 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.7 2024/01/15 19:27:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.8 2024/01/16 01:16:46 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;
 
-int idepth;
+volatile int idepth;
 
 static struct m68k_intrhand_list m68k_intrhands_autovec[NAUTOVECTORS];
 #ifdef __HAVE_M68K_INTR_VECTORED
@@ -215,6 +215,16 @@ m68k_intrvec_remove(struct m68k_intrhand
 	*slot = NULL;
 }
 
+/* XXX This is horrible and should burn to the ground. */
+void *
+m68k_intrvec_intrhand(int vec)
+{
+	KASSERT(vec >= MACHINE_USERVEC_START);
+	KASSERT(vec < NVECTORS);
+
+	return m68k_intrhands_vectored[vec - MACHINE_USERVEC_START];
+}
+
 #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.1 src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.2
--- src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.1	Sun Jan 14 22:32:32 2024
+++ src/sys/arch/m68k/m68k/m68k_intr_stubs.s	Tue Jan 16 01:16:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr_stubs.s,v 1.1 2024/01/14 22:32:32 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr_stubs.s,v 1.2 2024/01/16 01:16:46 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -50,6 +50,13 @@
 #endif
 
 /*
+ * XXX Some platforms (e.g. news68k) have hardware-assisted ASTs, and
+ * XXX thus don't need to branch to rei() after an interrupt.  Figure
+ * XXX out a way to handle these platforms.  This works for now; the
+ * XXX hardware-assist is just an optimization.
+ */
+
+/*
  * Vector stub for auto-vectored interrupts.  Calls the dispatch
  * routine with the frame BY VALUE (saves a few instructions).
  */

Reply via email to