Module Name: src Committed By: thorpej Date: Tue Jan 16 00:34:58 UTC 2024
Modified Files: src/sys/arch/next68k/next68k: genassym.cf isr.h locore.s trap.c Removed Files: src/sys/arch/next68k/next68k: isr.c Log Message: Switch next68k over to common interrupt dispatch and G/C __HAVE_LEGACY_INTRCNT. Also included is G/C of the old ssir stuff that's no longer used. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/next68k/next68k/genassym.cf cvs rdiff -u -r1.35 -r0 src/sys/arch/next68k/next68k/isr.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/next68k/next68k/isr.h cvs rdiff -u -r1.81 -r1.82 src/sys/arch/next68k/next68k/locore.s cvs rdiff -u -r1.94 -r1.95 src/sys/arch/next68k/next68k/trap.c 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/next68k/next68k/genassym.cf diff -u src/sys/arch/next68k/next68k/genassym.cf:1.33 src/sys/arch/next68k/next68k/genassym.cf:1.34 --- src/sys/arch/next68k/next68k/genassym.cf:1.33 Tue Jan 9 04:16:26 2024 +++ src/sys/arch/next68k/next68k/genassym.cf Tue Jan 16 00:34:58 2024 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.33 2024/01/09 04:16:26 thorpej Exp $ +# $NetBSD: genassym.cf,v 1.34 2024/01/16 00:34:58 thorpej Exp $ # # Copyright (c) 1982, 1990, 1993 @@ -127,6 +127,7 @@ define P_VMSPACE offsetof(struct proc, # interrupt/fault metering define CI_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr) +define NMI_INTRCNT ((sizeof(struct evcnt)*7) + offsetof(struct evcnt, ev_count32)) # PSL values (should just include psl.h?) define PSL_S PSL_S Index: src/sys/arch/next68k/next68k/isr.h diff -u src/sys/arch/next68k/next68k/isr.h:1.10 src/sys/arch/next68k/next68k/isr.h:1.11 --- src/sys/arch/next68k/next68k/isr.h:1.10 Mon Jan 15 20:28:56 2024 +++ src/sys/arch/next68k/next68k/isr.h Tue Jan 16 00:34:58 2024 @@ -1,14 +1,7 @@ -/* $NetBSD: isr.h,v 1.10 2024/01/15 20:28:56 thorpej Exp $ */ - -/* - * This file was taken from mvme68k/mvme68k/isr.h - * should probably be re-synced when needed. - * Darrin B. Jewell <jew...@mit.edu> Tue Nov 10 05:07:16 1998 - * original cvs id: NetBSD: isr.h,v 1.3 1997/10/09 08:40:06 jtc Exp - */ +/* $NetBSD: isr.h,v 1.11 2024/01/16 00:34:58 thorpej Exp $ */ /*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. + * Copyright (c) 2024 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -36,59 +29,27 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/queue.h> - -/* - * The location and size of the autovectored interrupt portion - * of the vector table. - */ -#define ISRAUTOVEC 0x18 -#define NISRAUTOVEC 8 -#define NIPLS 8 +#ifndef _NEXT68K_ISR_H_ +#define _NEXT68K_ISR_H_ -/* - * The location and size of the vectored interrupt portion - * of the vector table. - */ -#define ISRVECTORED 0x40 +#include <sys/intr.h> /* - * Autovectored interrupt handler cookie. + * Aliases for the legacy next68k ISR routines. */ -struct isr_autovec { - LIST_ENTRY(isr_autovec) isr_link; - int (*isr_func)(void *); - void *isr_arg; - int isr_ipl; - int isr_priority; - struct evcnt *isr_evcnt; -}; -typedef LIST_HEAD(, isr_autovec) isr_autovec_list_t; +static inline void +isrinit(void) +{ + m68k_intr_init(NULL); +} -/* - * Vectored interrupt handler cookie. The handler may request to - * receive the exception frame as an argument by specifying NULL - * when establishing the interrupt. - */ -struct isr_vectored { - int (*isr_func)(void *); - void *isr_arg; - int isr_ipl; - struct evcnt *isr_evcnt; -}; +static inline void +isrlink_autovec(int (*func)(void *), void *arg, int ipl, int isrpri, + struct evcnt *ev) +{ + /* XXX leaks interrupt handle. */ + m68k_intr_establish(func, arg, ev, 0, ipl, isrpri, 0); +} -/* - * Autovectored ISR priorities. These are not the same as interrupt levels. - */ -#define ISRPRI_BIO 0 -#define ISRPRI_NET 1 -#define ISRPRI_TTY 2 -#define ISRPRI_TTYNOBUF 3 - -extern struct evcnt next68k_irq_evcnt[]; - -void isrinit(void); -void isrlink_autovec(int (*)(void *), void *, int, int, struct evcnt *); -void isrdispatch_autovec(struct clockframe *); -void netintr(void); +#endif /* _NEXT68K_ISR_H_ */ Index: src/sys/arch/next68k/next68k/locore.s diff -u src/sys/arch/next68k/next68k/locore.s:1.81 src/sys/arch/next68k/next68k/locore.s:1.82 --- src/sys/arch/next68k/next68k/locore.s:1.81 Sat Jan 13 21:40:54 2024 +++ src/sys/arch/next68k/next68k/locore.s Tue Jan 16 00:34:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.81 2024/01/13 21:40:54 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.82 2024/01/16 00:34:58 thorpej Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell @@ -500,13 +500,7 @@ ENTRY_NOPROFILE(trap0) jbsr _C_LABEL(syscall) | handle it addql #4,%sp | pop syscall arg tstl _C_LABEL(astpending) - jne Lrei2 - tstb _C_LABEL(ssir) - jeq Ltrap1 - movw #SPL1,%sr - tstb _C_LABEL(ssir) - jne Lsir1 -Ltrap1: + jne Lrei movl %sp@(FR_SP),%a0 | grab and restore movl %a0,%usp | user SP moveml %sp@+,#0x7FFF | restore most registers @@ -650,24 +644,8 @@ Lbrkpt3: * interrupt dispatcher will deal with strays. */ -ENTRY_NOPROFILE(spurintr) /* Level 0 */ - addql #1,_C_LABEL(intrcnt)+0 - INTERRUPT_SAVEREG - CPUINFO_INCREMENT(CI_NINTR) - INTERRUPT_RESTOREREG - jra _ASM_LABEL(rei) - -ENTRY_NOPROFILE(intrhand_autovec) /* Levels 1 through 6 */ - addql #1,_C_LABEL(interrupt_depth) - INTERRUPT_SAVEREG - lea %sp@(16),%a1 | get pointer to frame - movl %a1,%sp@- - jbsr _C_LABEL(isrdispatch_autovec) | call dispatcher - addql #4,%sp - jbra Lintrhand_exit - ENTRY_NOPROFILE(lev7intr) /* level 7: parity errors, reset key */ - addql #1,_C_LABEL(intrcnt)+32 + addql #1,_C_LABEL(m68k_intr_evcnt)+NMI_INTRCNT clrl %sp@- moveml #0xFFFF,%sp@- | save registers movl %usp,%a0 | and save @@ -679,13 +657,6 @@ ENTRY_NOPROFILE(lev7intr) /* level 7: pa addql #8,%sp | pop SP and stack adjust jra _ASM_LABEL(rei) | all done -Lintrhand_exit: - INTERRUPT_RESTOREREG - subql #1,_C_LABEL(interrupt_depth) - - /* FALLTHROUGH to rei */ - jra _ASM_LABEL(rei) | all done - /* * Emulation of VAX REI instruction. * @@ -702,16 +673,19 @@ Lintrhand_exit: ASENTRY_NOPROFILE(rei) tstl _C_LABEL(astpending) | AST pending? - jeq Lchksir | no, go check for SIR -Lrei1: + jne 1f | no, done + rte +1: btst #5,%sp@ | yes, are we returning to user mode? - jne Lchksir | no, go check for SIR + jeq 2f | no, done + rte +2: movw #PSL_LOWIPL,%sr | lower SPL clrl %sp@- | stack adjust moveml #0xFFFF,%sp@- | save all registers movl %usp,%a1 | including movl %a1,%sp@(FR_SP) | the users SP -Lrei2: +Lrei: clrl %sp@- | VA == none clrl %sp@- | code == none movl #T_ASTFLT,%sp@- | type == async system trap @@ -736,38 +710,6 @@ Laststkadj: moveml %sp@+,#0x7FFF | restore user registers movl %sp@,%sp | and our SP rte | and do real RTE -Lchksir: - tstb _C_LABEL(ssir) | SIR pending? - jeq Ldorte | no, all done - movl %d0,%sp@- | need a scratch register - movw %sp@(4),%d0 | get SR - andw #PSL_IPL7,%d0 | mask all but IPL - jne Lnosir | came from interrupt, no can do - movl %sp@+,%d0 | restore scratch register -Lgotsir: - movw #SPL1,%sr | prevent others from servicing int - tstb _C_LABEL(ssir) | too late? - jeq Ldorte | yes, oh well... - clrl %sp@- | stack adjust - moveml #0xFFFF,%sp@- | save all registers - movl %usp,%a1 | including - movl %a1,%sp@(FR_SP) | the users SP -Lsir1: - clrl %sp@- | VA == none - clrl %sp@- | code == none - movl #T_SSIR,%sp@- | type == software interrupt - pea %sp@(12) | fp == address of trap frame - jbsr _C_LABEL(trap) | go handle it - lea %sp@(16),%sp | pop value args - movl %sp@(FR_SP),%a0 | restore - movl %a0,%usp | user SP - moveml %sp@+,#0x7FFF | and all remaining registers - addql #8,%sp | pop SP and stack adjust - rte -Lnosir: - movl %sp@+,%d0 | restore scratch register -Ldorte: - rte | real return /* * Use common m68k sigcode. @@ -822,26 +764,6 @@ Lsldone: #endif /* - * Set processor priority level calls. Most are implemented with - * inline asm expansions. However, spl0 requires special handling - * as we need to check for our emulated software interrupts. - */ - -ENTRY(spl0) - moveq #0,%d0 - movw %sr,%d0 | get old SR for return - movw #PSL_LOWIPL,%sr | restore new SR - tstb _C_LABEL(ssir) | software interrupt pending? - jeq Lspldone | no, all done - subql #4,%sp | make room for RTE frame - movl %sp@(4),%sp@(2) | position return address - clrw %sp@(6) | set frame type 0 - movw #PSL_LOWIPL,%sp@ | and new SR - jra Lgotsir | go handle it -Lspldone: - rts - -/* * _delay(u_int N) * * Delay for at least (N/256) microseconds. @@ -979,22 +901,3 @@ ASGLOBAL(fulltflush) ASGLOBAL(fullcflush) .long 0 #endif - -/* interrupt counters */ -GLOBAL(intrnames) - .asciz "spur" - .asciz "lev1" - .asciz "lev2" - .asciz "lev3" - .asciz "lev4" - .asciz "lev5" - .asciz "lev6" - .asciz "lev7" - .asciz "nmi" - .asciz "statclock" -GLOBAL(eintrnames) - .even -GLOBAL(intrcnt) - .long 0,0,0,0,0,0,0,0,0,0 -GLOBAL(eintrcnt) - Index: src/sys/arch/next68k/next68k/trap.c diff -u src/sys/arch/next68k/next68k/trap.c:1.94 src/sys/arch/next68k/next68k/trap.c:1.95 --- src/sys/arch/next68k/next68k/trap.c:1.94 Thu Oct 5 19:41:05 2023 +++ src/sys/arch/next68k/next68k/trap.c Tue Jan 16 00:34:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.94 2023/10/05 19:41:05 ad Exp $ */ +/* $NetBSD: trap.c,v 1.95 2024/01/16 00:34:58 thorpej Exp $ */ /* * This file was taken from mvme68k/mvme68k/trap.c @@ -46,7 +46,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.94 2023/10/05 19:41:05 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.95 2024/01/16 00:34:58 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -555,7 +555,7 @@ trap(struct frame *fp, int type, unsigne } #ifdef DIAGNOSTIC - if (interrupt_depth && !panicking) { + if (idepth && !panicking) { printf("trap: calling uvm_fault() from interrupt!\n"); goto dopanic; }