Module Name:    src
Committed By:   thorpej
Date:           Sun Jan 14 00:17:47 UTC 2024

Modified Files:
        src/sys/arch/luna68k/conf: files.luna68k
        src/sys/arch/luna68k/luna68k: isr.c isr.h locore.s
Added Files:
        src/sys/arch/luna68k/include: vectors.h
Removed Files:
        src/sys/arch/luna68k/luna68k: vectors.s

Log Message:
Switch luna68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/luna68k/isr.h
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.4 -r0 src/sys/arch/luna68k/luna68k/vectors.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/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.32 src/sys/arch/luna68k/conf/files.luna68k:1.33
--- src/sys/arch/luna68k/conf/files.luna68k:1.32	Tue Jan  9 04:16:24 2024
+++ src/sys/arch/luna68k/conf/files.luna68k	Sun Jan 14 00:17:46 2024
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: files.luna68k,v 1.32 2024/01/09 04:16:24 thorpej Exp $
+#	$NetBSD: files.luna68k,v 1.33 2024/01/14 00:17:46 thorpej Exp $
 #
 maxpartitions 8
 maxusers 2 8 64
@@ -23,6 +23,7 @@ file arch/m68k/m68k/mmu_subr.s
 file arch/m68k/m68k/pmap_motorola.c
 file arch/m68k/m68k/procfs_machdep.c	procfs
 file arch/m68k/m68k/sys_machdep.c
+file arch/m68k/m68k/vectors.c
 file arch/m68k/m68k/vm_machdep.c
 file dev/cons.c
 

Index: src/sys/arch/luna68k/luna68k/isr.c
diff -u src/sys/arch/luna68k/luna68k/isr.c:1.26 src/sys/arch/luna68k/luna68k/isr.c:1.27
--- src/sys/arch/luna68k/luna68k/isr.c:1.26	Fri Jan 12 23:36:29 2024
+++ src/sys/arch/luna68k/luna68k/isr.c	Sun Jan 14 00:17:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.26 2024/01/12 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: isr.c,v 1.27 2024/01/14 00:17:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.26 2024/01/12 23:36:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.27 2024/01/14 00:17:46 thorpej Exp $");
 
 /*
  * Link and dispatch interrupts.
@@ -134,51 +134,6 @@ isrlink_autovec(int (*func)(void *), voi
 }
 
 /*
- * Establish a vectored interrupt handler.
- * Called by bus interrupt establish functions.
- */
-void
-isrlink_vectored(int (*func)(void *), void *arg, int ipl, int vec)
-{
-	struct isr_vectored *isr;
-
-	if ((ipl < 0) || (ipl >= NISRAUTOVEC))
-		panic("isrlink_vectored: bad ipl %d", ipl);
-	if ((vec < ISRVECTORED) || (vec >= ISRVECTORED + NISRVECTORED))
-		panic("isrlink_vectored: bad vec 0x%x", vec);
-
-	isr = &isr_vectored[vec - ISRVECTORED];
-
-	if ((vectab[vec] != badtrap) || (isr->isr_func != NULL))
-		panic("isrlink_vectored: vec 0x%x not available", vec);
-
-	/* Fill in the new entry. */
-	isr->isr_func = func;
-	isr->isr_arg = arg;
-	isr->isr_ipl = ipl;
-
-	/* Hook into the vector table. */
-	vectab[vec] = intrhand_vectored;
-}
-
-/*
- * Unhook a vectored interrupt.
- */
-void
-isrunlink_vectored(int vec)
-{
-
-	if ((vec < ISRVECTORED) || (vec >= ISRVECTORED + NISRVECTORED))
-		panic("isrunlink_vectored: bad vec 0x%x", vec);
-
-	if (vectab[vec] != intrhand_vectored)
-		panic("isrunlink_vectored: not vectored interrupt");
-
-	vectab[vec] = badtrap;
-	memset(&isr_vectored[vec - ISRVECTORED], 0, sizeof(struct isr_vectored));
-}
-
-/*
  * This is the dispatcher called by the low-level
  * assembly language autovectored interrupt routine.
  */
@@ -222,42 +177,6 @@ isrdispatch_autovec(int evec)
 	idepth--;
 }
 
-/*
- * This is the dispatcher called by the low-level
- * assembly language vectored interrupt routine.
- */
-void
-isrdispatch_vectored(int pc, int evec, void *frame)
-{
-	struct isr_vectored *isr;
-	int ipl, vec;
-
-	idepth++;
-	vec = (evec & 0xfff) >> 2;
-	ipl = (getsr() >> 8) & 7;
-
-	intrcnt[ipl]++;
-	curcpu()->ci_data.cpu_nintr++;
-
-	if ((vec < ISRVECTORED) || (vec >= (ISRVECTORED + NISRVECTORED)))
-		panic("isrdispatch_vectored: bad vec 0x%x", vec);
-	isr = &isr_vectored[vec - ISRVECTORED];
-
-	if (isr->isr_func == NULL) {
-		printf("isrdispatch_vectored: no handler for vec 0x%x\n", vec);
-		vectab[vec] = badtrap;
-		idepth--;
-		return;
-	}
-
-	/*
-	 * Handler gets exception frame if argument is NULL.
-	 */
-	if ((*isr->isr_func)(isr->isr_arg ? isr->isr_arg : frame) == 0)
-		printf("isrdispatch_vectored: vec 0x%x not claimed\n", vec);
-	idepth--;
-}
-
 bool
 cpu_intr_p(void)
 {

Index: src/sys/arch/luna68k/luna68k/isr.h
diff -u src/sys/arch/luna68k/luna68k/isr.h:1.4 src/sys/arch/luna68k/luna68k/isr.h:1.5
--- src/sys/arch/luna68k/luna68k/isr.h:1.4	Sat Mar 14 14:46:01 2009
+++ src/sys/arch/luna68k/luna68k/isr.h	Sun Jan 14 00:17:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.h,v 1.4 2009/03/14 14:46:01 dsl Exp $	*/
+/*	$NetBSD: isr.h,v 1.5 2024/01/14 00:17:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -79,7 +79,4 @@ struct isr_vectored {
 
 void	isrinit(void);
 void	isrlink_autovec(int (*)(void *), void *, int, int);
-void	isrlink_vectored(int (*)(void *), void *, int, int);
-void	isrunlink_vectored(int);
 void	isrdispatch_autovec(int);
-void	isrdispatch_vectored(int, int, void *);

Index: src/sys/arch/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.75 src/sys/arch/luna68k/luna68k/locore.s:1.76
--- src/sys/arch/luna68k/luna68k/locore.s:1.75	Fri Jan 12 23:36:29 2024
+++ src/sys/arch/luna68k/luna68k/locore.s	Sun Jan 14 00:17:46 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.75 2024/01/12 23:36:29 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.76 2024/01/14 00:17:46 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -73,8 +73,6 @@
 	.space	PAGE_SIZE
 ASLOCAL(tmpstk)
 
-#include <luna68k/luna68k/vectors.s>
-
 /*
  * Macro to relocate a symbol, used before MMU is enabled.
  */
@@ -171,35 +169,6 @@ Lstart1:
 1:	movb	%a0@+,%a1@+		| copy to bootarg
 	dbra	%d0,1b			| upto 63 characters
 
-	/*
-	 * Now that we know what CPU we have, initialize the address error
-	 * and bus error handlers in the vector table:
-	 *
-	 *	vectab+8	bus error
-	 *	vectab+12	address error
-	 */
-	lea	_C_LABEL(cputype),%a0
-	lea	_C_LABEL(vectab),%a2
-#if defined(M68040)
-	cmpl	#CPU_68040,%a0@		| 68040?
-	jne	1f			| no, skip
-	movl	#_C_LABEL(buserr40),%a2@(8)
-	movl	#_C_LABEL(addrerr4060),%a2@(12)
-	jra	Lstart2
-1:
-#endif
-#if defined(M68030)
-	cmpl	#CPU_68030,%a0@		| 68030?
-	jne	1f			| no, skip
-	movl	#_C_LABEL(busaddrerr2030),%a2@(8)
-	movl	#_C_LABEL(busaddrerr2030),%a2@(12)
-	jra	Lstart2
-1:
-#endif
-	/* Config botch; no hope. */
-	PANIC("Config botch in locore")
-
-Lstart2:
 /* initialize source/destination control registers for movs */
 	moveq	#FC_USERD,%d0		| user space
 	movc	%d0,%sfc		|   as source
@@ -294,7 +263,8 @@ Lmotommu1:
  * Should be running mapped from this point on
  */
 Lenab1:
-	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
+	lea	_ASM_LABEL(tmpstk),%sp	| re-load temporary stack
+	jbsr	_C_LABEL(vec_init)	| initialize vector table
 /* call final pmap setup */
 	jbsr	_C_LABEL(pmap_bootstrap_finalize)
 /* set kernel stack, user SP */
@@ -323,8 +293,6 @@ Lenab2:
 Lenab3:
 
 /* final setup for C code */
-	movl	#_C_LABEL(vectab),%d0	| get our %vbr address
-	movc	%d0,%vbr
 	jbsr	_C_LABEL(luna68k_init)	| additional pre-main initialization
 
 /*
@@ -595,8 +563,6 @@ Lbrkpt3:
  * For vectored interrupts, we pull the pc, evec, and exception frame
  * and pass them to the vectored interrupt dispatcher.  The vectored
  * interrupt dispatcher will deal with strays.
- *
- * _intrhand_vectored is the entry point for vectored interrupts.
  */
 
 ENTRY_NOPROFILE(spurintr)		/* Level 0 */
@@ -628,18 +594,6 @@ ENTRY_NOPROFILE(lev7intr)		/* Level 7: N
 	addql	#8,%sp			| pop SP and stack adjust
 	jra	_ASM_LABEL(rei)		| all done
 
-ENTRY_NOPROFILE(intrhand_vectored)
-	INTERRUPT_SAVEREG
-	lea	%sp@(16),%a1		| get pointer to frame
-	movl	%a1,%sp@-
-	movw	%sp@(26),%d0
-	movl	%d0,%sp@-		| push exception vector info
-	movl	%sp@(26),%sp@-		| and PC
-	jbsr	_C_LABEL(isrdispatch_vectored)	| call dispatcher
-	lea	%sp@(12),%sp		| pop value args
-	INTERRUPT_RESTOREREG
-	jra	_ASM_LABEL(rei)		| all done
-
 #if 1	/* XXX wild timer -- how can I disable/enable the interrupt? */
 ENTRY_NOPROFILE(lev5intr)
 	addql	#1,_C_LABEL(idepth)

Added files:

Index: src/sys/arch/luna68k/include/vectors.h
diff -u /dev/null src/sys/arch/luna68k/include/vectors.h:1.1
--- /dev/null	Sun Jan 14 00:17:47 2024
+++ src/sys/arch/luna68k/include/vectors.h	Sun Jan 14 00:17:46 2024
@@ -0,0 +1,50 @@
+/*	$NetBSD: vectors.h,v 1.1 2024/01/14 00:17:46 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LUNA68K_VECTORS_H_
+#define	_LUNA68K_VECTORS_H_
+
+#ifdef _KERNEL
+
+#include <m68k/vectors.h>
+
+#define	MACHINE_AV0_HANDLER	spurintr
+#define	MACHINE_AV1_HANDLER	intrhand_autovec
+#define	MACHINE_AV2_HANDLER	intrhand_autovec
+#define	MACHINE_AV3_HANDLER	intrhand_autovec
+#define	MACHINE_AV4_HANDLER	intrhand_autovec
+#define	MACHINE_AV5_HANDLER	lev5intr
+#define	MACHINE_AV6_HANDLER	intrhand_autovec
+#define	MACHINE_AV7_HANDLER	lev7intr
+
+#endif /* _KERNEL */
+
+#endif /* _LUNA68K_VECTORS_H_ */

Reply via email to