Adjust the clockframe to be the same as what the common m68k interrupt

dispatch code expects.
This commit is contained in:
thorpej 2024-01-19 05:46:36 +00:00
parent e3146337cf
commit 49351b4376
5 changed files with 23 additions and 22 deletions

View File

@ -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

View File

@ -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

View File

@ -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 *, int);
#include <sys/cpu.h>
#include <sys/device.h>
void intr_dispatch(struct clockframe *);
void intr_dispatch(struct clockframe);
#endif /* _VIRT68K_INTR_PRIVATE */
#endif /* !_LOCORE */

View File

@ -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 2024/01/02 07:48:46 thorpej Exp $");
#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 bufsize)
#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;

View File

@ -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)