Module Name: src Committed By: thorpej Date: Fri Jan 19 05:46:36 UTC 2024
Modified Files: src/sys/arch/virt68k/conf: GENERIC src/sys/arch/virt68k/include: cpu.h intr.h src/sys/arch/virt68k/virt68k: intr.c locore.s Log Message: Adjust the clockframe to be the same as what the common m68k interrupt dispatch code expects. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/conf/GENERIC cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/include/cpu.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/intr.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/intr.c cvs rdiff -u -r1.14 -r1.15 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/conf/GENERIC diff -u src/sys/arch/virt68k/conf/GENERIC:1.4 src/sys/arch/virt68k/conf/GENERIC:1.5 --- src/sys/arch/virt68k/conf/GENERIC:1.4 Mon Jan 8 05:11:54 2024 +++ src/sys/arch/virt68k/conf/GENERIC Fri Jan 19 05:46:36 2024 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.4 2024/01/08 05:11:54 thorpej Exp $ +# $NetBSD: GENERIC,v 1.5 2024/01/19 05:46:36 thorpej Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/virt68k/conf/std.virt68k" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.4 $" +#ident "GENERIC-$Revision: 1.5 $" makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk @@ -100,7 +100,9 @@ options INET6 # IPV6 options COMPAT_AOUT_M68K # compatibility with NetBSD/m68k a.out include "conf/compat_netbsd09.config" -#options COMPAT_SUNOS +options COMPAT_SUNOS +options COMPAT_13 +options COMPAT_16 #options COMPAT_M68K4K # compatibility with NetBSD/m68k4k binaries #options COMPAT_LINUX # compatibility with Linux/m68k binaries #options COMPAT_OSSAUDIO # compatibility with Linux/m68k binaries Index: src/sys/arch/virt68k/include/cpu.h diff -u src/sys/arch/virt68k/include/cpu.h:1.5 src/sys/arch/virt68k/include/cpu.h:1.6 --- src/sys/arch/virt68k/include/cpu.h:1.5 Thu Jan 18 14:39:07 2024 +++ src/sys/arch/virt68k/include/cpu.h Fri Jan 19 05:46:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.5 2024/01/18 14:39:07 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.6 2024/01/19 05:46:36 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -54,17 +54,17 @@ /* * Arguments to hardclock and gatherstats encapsulate the previous * machine state in an opaque clockframe. On the virt68k, we use - * what the hardware pushes on an interrupt (frame format 0). + * what the locore.s glue puts on the stack before calling C-code. */ struct clockframe { - u_short sr; /* sr at time of interrupt */ - u_long pc; /* pc at time of interrupt */ - u_short fmt:4, - vec:12; /* vector offset (4-word frame) */ + u_int cf_regs[4]; /* d0,d1,a0,a1 */ + u_short cf_sr; /* sr at time of interrupt */ + u_long cf_pc; /* pc at time of interrupt */ + u_short cf_vo; /* vector offset (4-word frame) */ } __attribute__((packed)); -#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->pc) +#define CLKF_USERMODE(framep) (((framep)->cf_sr & PSL_S) == 0) +#define CLKF_PC(framep) ((framep)->cf_pc) /* * The clock interrupt handler can determine if it's a nested Index: src/sys/arch/virt68k/include/intr.h diff -u src/sys/arch/virt68k/include/intr.h:1.1 src/sys/arch/virt68k/include/intr.h:1.2 --- src/sys/arch/virt68k/include/intr.h:1.1 Tue Jan 2 07:41:00 2024 +++ src/sys/arch/virt68k/include/intr.h Fri Jan 19 05:46:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $ */ +/* $NetBSD: intr.h,v 1.2 2024/01/19 05:46:36 thorpej Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -162,7 +162,7 @@ void intr_register_pic(struct device *, #include <sys/cpu.h> #include <sys/device.h> -void intr_dispatch(struct clockframe *); +void intr_dispatch(struct clockframe); #endif /* _VIRT68K_INTR_PRIVATE */ #endif /* !_LOCORE */ Index: src/sys/arch/virt68k/virt68k/intr.c diff -u src/sys/arch/virt68k/virt68k/intr.c:1.2 src/sys/arch/virt68k/virt68k/intr.c:1.3 --- src/sys/arch/virt68k/virt68k/intr.c:1.2 Tue Jan 2 07:48:46 2024 +++ src/sys/arch/virt68k/virt68k/intr.c Fri Jan 19 05:46:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.2 2024/01/02 07:48:46 thorpej Exp $ */ +/* $NetBSD: intr.c,v 1.3 2024/01/19 05:46:36 thorpej Exp $ */ /*- * Copyright (c) 1996, 2023 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2 2024/01/02 07:48:46 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.3 2024/01/19 05:46:36 thorpej Exp $"); #define _VIRT68K_INTR_PRIVATE @@ -47,6 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2 #include <sys/bus.h> #include <sys/intr.h> +#include <machine/vectors.h> + #include <uvm/uvm_extern.h> #include <dev/goldfish/gfpicvar.h> @@ -267,9 +269,9 @@ intr_string(void *v, char *buf, size_t b #define VEC_AVINTR 0x18 void -intr_dispatch(struct clockframe *frame) +intr_dispatch(struct clockframe frame) { - const int ipl = (frame->vec >> 2) - VEC_AVINTR; + const int ipl = VECO_TO_VECI(frame.cf_vo) - VEC_AVINTR; const int pic = ipl_to_pic(ipl); int pirq; @@ -283,7 +285,7 @@ intr_dispatch(struct clockframe *frame) while ((pirq = gfpic_pending(pics[pic])) >= 0) { LIST_FOREACH(ih, &intrhands[base + pirq], ih_link) { - void *arg = ih->ih_arg ? ih->ih_arg : frame; + void *arg = ih->ih_arg ? ih->ih_arg : &frame; if (ih->ih_func(arg)) { ih->ih_evcnt->ev_count++; rv = true; Index: src/sys/arch/virt68k/virt68k/locore.s diff -u src/sys/arch/virt68k/virt68k/locore.s:1.14 src/sys/arch/virt68k/virt68k/locore.s:1.15 --- src/sys/arch/virt68k/virt68k/locore.s:1.14 Thu Jan 18 12:07:51 2024 +++ src/sys/arch/virt68k/virt68k/locore.s Fri Jan 19 05:46:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.14 2024/01/18 12:07:51 isaki Exp $ */ +/* $NetBSD: locore.s,v 1.15 2024/01/19 05:46:36 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -500,10 +500,7 @@ Lbrkpt3: ENTRY_NOPROFILE(intrhand_autovec) addql #1,_C_LABEL(intr_depth) INTERRUPT_SAVEREG - lea %sp@(16),%a1 | get pointer to frame - movl %a1,%sp@- jbsr _C_LABEL(intr_dispatch) | call dispatcher - addql #4,%sp INTERRUPT_RESTOREREG subql #1,_C_LABEL(intr_depth)