Module Name:    src
Committed By:   thorpej
Date:           Sun Jan  7 16:41:24 UTC 2024

Modified Files:
        src/sys/arch/virt68k/virt68k: autoconf.c locore.s

Log Message:
Don't to go IPL0 right before calling main(), instead call spl0() at the
end of cpu_configure().  It seems that Qemu doesn't reset pending interrupts
correctly after a RESET request, which was causing an explosion when an
interrupt was delivered to the new kernel instance.  This change makes
reboot work.

Thx to mlelstv@ for figuring out what the problem was.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/autoconf.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/locore.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/virt68k/virt68k/autoconf.c
diff -u src/sys/arch/virt68k/virt68k/autoconf.c:1.3 src/sys/arch/virt68k/virt68k/autoconf.c:1.4
--- src/sys/arch/virt68k/virt68k/autoconf.c:1.3	Tue Jan  2 16:59:14 2024
+++ src/sys/arch/virt68k/virt68k/autoconf.c	Sun Jan  7 16:41:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.3 2024/01/02 16:59:14 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.4 2024/01/07 16:41:24 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2024/01/02 16:59:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2024/01/07 16:41:24 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -73,6 +73,14 @@ cpu_configure(void)
 
 	if (config_rootfound("mainbus", NULL) == NULL)
 		panic("autoconfig failed, no root");
+
+	/*
+	 * XXX Go ahead and enable interrupts now that we've configured
+	 * XXX everything.
+	 * XXX
+	 * XXX See locore.s, right before main() is called.
+	 */
+	spl0();
 }
 
 void

Index: src/sys/arch/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.2 src/sys/arch/virt68k/virt68k/locore.s:1.3
--- src/sys/arch/virt68k/virt68k/locore.s:1.2	Tue Jan  2 18:10:36 2024
+++ src/sys/arch/virt68k/virt68k/locore.s	Sun Jan  7 16:41:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.2 2024/01/02 18:10:36 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.3 2024/01/07 16:41:24 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -278,7 +278,14 @@ Lenab3:
  * later on.
  */
 	jbsr	_C_LABEL(virt68k_init)	| additional pre-main initialization
+#if 0
+	/*
+	 * XXX Don't do the spl0() here; when Qemu performs a reboot request,
+	 * XXX it seems to not clear pending interrupts, and so we blow up
+	 * XXX early when the new kernel starts up.
+	 */
 	movw	#PSL_LOWIPL,%sr		| lower SPL
+#endif
 	clrw	%sp@-			| vector offset/frame type
 	clrl	%sp@-			| PC - filled in by "execve"
 	movw	#PSL_USER,%sp@-		| in user mode

Reply via email to