Module Name: src Committed By: thorpej Date: Sat Jan 20 00:15:33 UTC 2024
Modified Files: src/sys/arch/amiga/amiga: trap.c src/sys/arch/amiga/include: cpu.h src/sys/arch/atari/atari: atari_init.c src/sys/arch/atari/include: cpu.h src/sys/arch/cesfic/cesfic: trap.c src/sys/arch/cesfic/include: cpu.h src/sys/arch/evbcf/include: cpu.h src/sys/arch/hp300/hp300: trap.c src/sys/arch/hp300/include: cpu.h src/sys/arch/luna68k/include: cpu.h src/sys/arch/luna68k/luna68k: trap.c src/sys/arch/m68k/include: cpu.h src/sys/arch/m68k/m68k: m68k_trap.c src/sys/arch/mac68k/include: cpu.h src/sys/arch/mac68k/mac68k: trap.c src/sys/arch/mvme68k/include: cpu.h src/sys/arch/mvme68k/mvme68k: trap.c src/sys/arch/news68k/include: cpu.h types.h src/sys/arch/news68k/news68k: trap.c src/sys/arch/next68k/include: cpu.h src/sys/arch/next68k/next68k: trap.c src/sys/arch/sun2/sun2: trap.c src/sys/arch/sun3/sun3: trap.c src/sys/arch/sun68k/include: cpu.h src/sys/arch/virt68k/include: cpu.h src/sys/arch/virt68k/virt68k: trap.c src/sys/arch/x68k/include: cpu.h src/sys/arch/x68k/x68k: trap.c Log Message: Largely unify the <machine/cpu.h> headers on the m68k platforms. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/sys/arch/amiga/amiga/trap.c cvs rdiff -u -r1.87 -r1.88 src/sys/arch/amiga/include/cpu.h cvs rdiff -u -r1.111 -r1.112 src/sys/arch/atari/atari/atari_init.c cvs rdiff -u -r1.76 -r1.77 src/sys/arch/atari/include/cpu.h cvs rdiff -u -r1.62 -r1.63 src/sys/arch/cesfic/cesfic/trap.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/cesfic/include/cpu.h cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbcf/include/cpu.h cvs rdiff -u -r1.158 -r1.159 src/sys/arch/hp300/hp300/trap.c cvs rdiff -u -r1.77 -r1.78 src/sys/arch/hp300/include/cpu.h cvs rdiff -u -r1.41 -r1.42 src/sys/arch/luna68k/include/cpu.h cvs rdiff -u -r1.79 -r1.80 src/sys/arch/luna68k/luna68k/trap.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/m68k/include/cpu.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/m68k_trap.c cvs rdiff -u -r1.104 -r1.105 src/sys/arch/mac68k/include/cpu.h cvs rdiff -u -r1.153 -r1.154 src/sys/arch/mac68k/mac68k/trap.c cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mvme68k/include/cpu.h cvs rdiff -u -r1.116 -r1.117 src/sys/arch/mvme68k/mvme68k/trap.c cvs rdiff -u -r1.54 -r1.55 src/sys/arch/news68k/include/cpu.h cvs rdiff -u -r1.15 -r1.16 src/sys/arch/news68k/include/types.h cvs rdiff -u -r1.76 -r1.77 src/sys/arch/news68k/news68k/trap.c cvs rdiff -u -r1.57 -r1.58 src/sys/arch/next68k/include/cpu.h cvs rdiff -u -r1.96 -r1.97 src/sys/arch/next68k/next68k/trap.c cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sun2/sun2/trap.c cvs rdiff -u -r1.149 -r1.150 src/sys/arch/sun3/sun3/trap.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sun68k/include/cpu.h cvs rdiff -u -r1.6 -r1.7 src/sys/arch/virt68k/include/cpu.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/trap.c cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x68k/include/cpu.h cvs rdiff -u -r1.113 -r1.114 src/sys/arch/x68k/x68k/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/amiga/amiga/trap.c diff -u src/sys/arch/amiga/amiga/trap.c:1.141 src/sys/arch/amiga/amiga/trap.c:1.142 --- src/sys/arch/amiga/amiga/trap.c:1.141 Wed Dec 27 17:35:34 2023 +++ src/sys/arch/amiga/amiga/trap.c Sat Jan 20 00:15:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.141 2023/12/27 17:35:34 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.142 2024/01/20 00:15:30 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -45,7 +45,7 @@ #include "opt_m68k_arch.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.141 2023/12/27 17:35:34 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.142 2024/01/20 00:15:30 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -137,7 +137,7 @@ extern struct emul emul_sunos; * XXX End hack */ -int astpending; +volatile int astpending; const char *trap_type[] = { "Bus error", Index: src/sys/arch/amiga/include/cpu.h diff -u src/sys/arch/amiga/include/cpu.h:1.87 src/sys/arch/amiga/include/cpu.h:1.88 --- src/sys/arch/amiga/include/cpu.h:1.87 Fri Jan 19 18:18:53 2024 +++ src/sys/arch/amiga/include/cpu.h Sat Jan 20 00:15:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.87 2024/01/19 18:18:53 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.88 2024/01/20 00:15:30 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -51,49 +51,6 @@ #include <m68k/cpu.h> #if defined(_KERNEL) -extern volatile unsigned int intr_depth; -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the amiga, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) -#define CLKF_INTR(framep) (intr_depth > 1) - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - setsoftast(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process from the softclock - * interrupt. On the amiga, request an ast to send us through trap(), - * marking the proc as needing a profiling tick. - */ -#define profile_tick(l, framep) ((l)->l_pflag |= LP_OWEUPC, setsoftast()) -#define cpu_need_proftick(l) ((l)->l_pflag |= LP_OWEUPC, setsoftast()) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) setsoftast() - -extern int astpending; /* need trap before returning to user mode */ -#define setsoftast() (astpending = 1) - /* * The rest of this should probably be moved to ../amiga/amigacpu.h, * although some of it could probably be put into generic 68k headers. Index: src/sys/arch/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.111 src/sys/arch/atari/atari/atari_init.c:1.112 --- src/sys/arch/atari/atari/atari_init.c:1.111 Mon Jan 15 03:14:31 2024 +++ src/sys/arch/atari/atari/atari_init.c Sat Jan 20 00:15:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.111 2024/01/15 03:14:31 thorpej Exp $ */ +/* $NetBSD: atari_init.c,v 1.112 2024/01/20 00:15:30 thorpej Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.111 2024/01/15 03:14:31 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.112 2024/01/20 00:15:30 thorpej Exp $"); #include "opt_ddb.h" #include "opt_mbtype.h" @@ -121,7 +121,7 @@ static u_int milan_probe_bank(paddr_t pa static cpu_kcore_hdr_t cpu_kcore_hdr; extern u_int lowram; -int machineid, mmutype, cputype, astpending; +int machineid, mmutype, cputype; extern char *esym; extern struct pcb *curpcb; Index: src/sys/arch/atari/include/cpu.h diff -u src/sys/arch/atari/include/cpu.h:1.76 src/sys/arch/atari/include/cpu.h:1.77 --- src/sys/arch/atari/include/cpu.h:1.76 Thu Jan 18 14:39:05 2024 +++ src/sys/arch/atari/include/cpu.h Sat Jan 20 00:15:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.76 2024/01/18 14:39:05 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.77 2024/01/20 00:15:30 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -54,56 +54,6 @@ void cpu_proc_fork(struct proc *, struct proc *); /* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the hp300, we use - * what the hardware pushes on an interrupt (frame format 0). - */ -struct clockframe { - u_int cf_regs[4]; /* d0,d1,a0,a1 (see locore.s) */ - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) -#if 0 -/* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0) -#else -/* but until we start using PSL_M, we have to do this instead */ -#define CLKF_INTR(framep) (0) /* XXX */ -#endif - - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - setsoftast(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process from the softclock - * interrupt. On hp300, request an ast to send us through trap(), - * marking the proc as needing a profiling tick. - */ -#define profile_tick(l, framep) ((l)->l_pflag |= LP_OWEUPC, setsoftast()) -#define cpu_need_proftick(l) ((l)->l_pflag |= LP_OWEUPC, setsoftast()) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) setsoftast() - -#define setsoftast() (astpending = 1) - -extern int astpending; /* need trap before returning to user mode */ - -/* * The rest of this should probably be moved to ../atari/ataricpu.h, * although some of it could probably be put into generic 68k headers. */ Index: src/sys/arch/cesfic/cesfic/trap.c diff -u src/sys/arch/cesfic/cesfic/trap.c:1.62 src/sys/arch/cesfic/cesfic/trap.c:1.63 --- src/sys/arch/cesfic/cesfic/trap.c:1.62 Thu Oct 5 19:41:04 2023 +++ src/sys/arch/cesfic/cesfic/trap.c Sat Jan 20 00:15:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.62 2023/10/05 19:41:04 ad Exp $ */ +/* $NetBSD: trap.c,v 1.63 2024/01/20 00:15:30 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.62 2023/10/05 19:41:04 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.63 2024/01/20 00:15:30 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -95,8 +95,6 @@ void dumpwb(int, u_short, u_int, u_int); static inline void userret(struct lwp *l, struct frame *fp, u_quad_t oticks, u_int faultaddr, int fromtrap); -int astpending; - const char *trap_type[] = { "Bus error", "Address error", Index: src/sys/arch/cesfic/include/cpu.h diff -u src/sys/arch/cesfic/include/cpu.h:1.36 src/sys/arch/cesfic/include/cpu.h:1.37 --- src/sys/arch/cesfic/include/cpu.h:1.36 Thu Jan 18 14:39:05 2024 +++ src/sys/arch/cesfic/include/cpu.h Sat Jan 20 00:15:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.36 2024/01/18 14:39:05 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.37 2024/01/20 00:15:31 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -51,56 +51,6 @@ #include <m68k/cpu.h> #if defined(_KERNEL) - -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the cesfic, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) -#if 0 -/* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0) -#else -/* but until we start using PSL_M, we have to do this instead */ -#define CLKF_INTR(framep) (0) /* XXX */ -#endif - - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the cesfic, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) \ - do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */0) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending++) - /* locore.s functions */ void doboot(void) __attribute__((__noreturn__)); Index: src/sys/arch/evbcf/include/cpu.h diff -u src/sys/arch/evbcf/include/cpu.h:1.8 src/sys/arch/evbcf/include/cpu.h:1.9 --- src/sys/arch/evbcf/include/cpu.h:1.8 Fri Jan 19 18:18:53 2024 +++ src/sys/arch/evbcf/include/cpu.h Sat Jan 20 00:15:31 2024 @@ -1,170 +1,3 @@ -/* $NetBSD: cpu.h,v 1.8 2024/01/19 18:18:53 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.9 2024/01/20 00:15:31 thorpej Exp $ */ -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * 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. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. - * - * from: Utah $Hdr: cpu.h 1.16 91/03/25$ - * - * @(#)cpu.h 8.4 (Berkeley) 1/5/94 - */ - -#ifndef _MACHINE_CPU_H_ -#define _MACHINE_CPU_H_ - -#if defined(_KERNEL_OPT) -#include "opt_lockdebug.h" -#endif - -/* - * Get common m68k CPU definitions. - */ #include <m68k/cpu.h> - -#if defined(_KERNEL) -/* - * Exported definitions unique to mvme68k/68k cpu support. - */ -#define M68K_MMU_COLDFIRE - -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the evbcf, we use - * what the hardware pushes on an interrupt (frame format 0). - */ -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) */ -} __attribute__((packed)); - -#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->pc) - -/* - * The clock interrupt handler can determine if it's a nested - * interrupt by checking for interrupt_depth > 1. - * (Remember, the clock interrupt handler itself will cause the - * depth counter to be incremented). - */ -extern volatile unsigned int intr_depth; -#define CLKF_INTR(framep) (intr_depth > 1) - - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) \ - do { aston(); } while (/* CONSTCOND */0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the evbcf, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) \ - do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */0) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending++) - -/* - * Associate MVME models with CPU types. - */ -#define MVME68K 1 - -/* - * MVME-147; 68030 CPU - */ -#if defined(MVME147) && !defined(M68030) -#define M68030 -#endif - -/* - * MVME-162/166/167; 68040 CPU - */ -#if (defined(MVME162) || defined(MVME167)) && !defined(M68040) -#define M68040 -#endif - -/* - * MVME-172/177; 68060 CPU - */ -#if (defined(MVME172) || defined(MVME177)) && !defined(M68060) -#define M68060 -#endif -#endif /* _KERNEL */ - -/* - * Values for machineid; these match the Bug's values. - */ -#define MVME_147 0x147 -#define MVME_162 0x162 -#define MVME_166 0x166 -#define MVME_167 0x167 -#define MVME_172 0x172 -#define MVME_177 0x177 - -#ifdef _KERNEL -extern int machineid; -extern int cpuspeed; -extern char *intiobase, *intiolimit; -extern u_int intiobase_phys, intiotop_phys; -extern u_long ether_data_buff_size; -extern u_char mvme_ea[6]; - -void doboot(int) - __attribute__((__noreturn__)); -int nmihand(void *); -void mvme68k_abort(const char *); -void *iomap(u_long, size_t); -void iounmap(void *, size_t); - -/* physical memory addresses where mvme147's onboard devices live */ -#define INTIOBASE147 (0xfffe0000u) -#define INTIOTOP147 (0xfffe5000u) - -/* ditto for mvme1[67][27] */ -#define INTIOBASE1xx (0xfff40000u) -#define INTIOTOP1xx (0xfffd0000u) - -#endif /* _KERNEL */ - -#endif /* _MACHINE_CPU_H_ */ Index: src/sys/arch/hp300/hp300/trap.c diff -u src/sys/arch/hp300/hp300/trap.c:1.158 src/sys/arch/hp300/hp300/trap.c:1.159 --- src/sys/arch/hp300/hp300/trap.c:1.158 Thu Oct 5 19:41:04 2023 +++ src/sys/arch/hp300/hp300/trap.c Sat Jan 20 00:15:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.158 2023/10/05 19:41:04 ad Exp $ */ +/* $NetBSD: trap.c,v 1.159 2024/01/20 00:15:31 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.158 2023/10/05 19:41:04 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.159 2024/01/20 00:15:31 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -91,8 +91,6 @@ void dumpssw(u_short); void dumpwb(int, u_short, u_int, u_int); #endif -int astpending; - const char *trap_type[] = { "Bus error", "Address error", Index: src/sys/arch/hp300/include/cpu.h diff -u src/sys/arch/hp300/include/cpu.h:1.77 src/sys/arch/hp300/include/cpu.h:1.78 --- src/sys/arch/hp300/include/cpu.h:1.77 Fri Jan 19 18:18:54 2024 +++ src/sys/arch/hp300/include/cpu.h Sat Jan 20 00:15:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.77 2024/01/19 18:18:54 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.78 2024/01/20 00:15:31 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -57,61 +57,6 @@ #include <machine/hp300spu.h> /* - * Get interrupt glue. - */ -#include <machine/intr.h> - -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the hp300, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) -#if 0 -/* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0) -#else -/* but until we start using PSL_M, we have to do this instead */ -#include <machine/intr.h> -#define CLKF_INTR(framep) (intr_depth > 1) /* XXX */ -#endif - - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the hp300, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) \ - do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */0) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending++) - -/* * The rest of this should probably be moved to <machine/hp300spu.h>, * although some of it could probably be put into generic 68k headers. */ @@ -133,7 +78,7 @@ int badbaddr(void *); /* what is this supposed to do? i.e. how is it different than startrtclock? */ #define enablertclock() -#endif +#endif /* _KERNEL */ /* physical memory sections */ #define ROMBASE (0x00000000) Index: src/sys/arch/luna68k/include/cpu.h diff -u src/sys/arch/luna68k/include/cpu.h:1.41 src/sys/arch/luna68k/include/cpu.h:1.42 --- src/sys/arch/luna68k/include/cpu.h:1.41 Thu Jan 18 14:39:06 2024 +++ src/sys/arch/luna68k/include/cpu.h Sat Jan 20 00:15:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.41 2024/01/18 14:39:06 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.42 2024/01/20 00:15:31 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -50,58 +50,6 @@ */ #include <m68k/cpu.h> -#if defined(_KERNEL) -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the luna68k, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) -#if 0 -/* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0) -#else -/* but until we start using PSL_M, we have to do this instead */ -#define CLKF_INTR(framep) (0) /* XXX */ -#endif - - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the luna68k, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) { (l)->l_pflag |= LP_OWEUPC; aston(); } - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -#define aston() (astpending = 1) - -extern int astpending; /* need to trap before returning to user mode */ - -#endif /* _KERNEL */ - /* * Values for machtype */ Index: src/sys/arch/luna68k/luna68k/trap.c diff -u src/sys/arch/luna68k/luna68k/trap.c:1.79 src/sys/arch/luna68k/luna68k/trap.c:1.80 --- src/sys/arch/luna68k/luna68k/trap.c:1.79 Wed Dec 27 17:35:35 2023 +++ src/sys/arch/luna68k/luna68k/trap.c Sat Jan 20 00:15:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.79 2023/12/27 17:35:35 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.80 2024/01/20 00:15:31 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.79 2023/12/27 17:35:35 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.80 2024/01/20 00:15:31 thorpej Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -83,8 +83,6 @@ void dumpwb(int, u_short, u_int, u_int); static inline void userret(struct lwp *l, struct frame *fp, u_quad_t oticks, u_int faultaddr, int fromtrap); -int astpending; - const char *trap_type[] = { "Bus error", "Address error", Index: src/sys/arch/m68k/include/cpu.h diff -u src/sys/arch/m68k/include/cpu.h:1.21 src/sys/arch/m68k/include/cpu.h:1.22 --- src/sys/arch/m68k/include/cpu.h:1.21 Thu Jan 18 14:42:09 2024 +++ src/sys/arch/m68k/include/cpu.h Sat Jan 20 00:15:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.21 2024/01/18 14:42:09 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.22 2024/01/20 00:15:31 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -142,6 +142,80 @@ void cpu_proc_fork(struct proc *, struct #define cpu_number() 0 #define LWP_PC(l) (((struct trapframe *)((l)->l_md.md_regs))->tf_pc) + +/* + * Arguments to hardclock and gatherstats encapsulate the previous + * machine state in an opaque clockframe. On the m68k platforms, we use + * what the interrupt stub puts on the stack before calling C code. + */ +struct clockframe { + /* regs saved on the stack by the interrupt stub */ + u_int cf_regs[4]; /* d0,d1,a0,a1 */ + /* hardware frame */ + 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 HW frame) */ +} __attribute__((__packed__)); + +#define CLKF_USERMODE(framep) (((framep)->cf_sr & PSL_S) == 0) +#define CLKF_PC(framep) ((framep)->cf_pc) + +#if 0 +/* + * We can determine if we were previously in an interrupt context + * if we were running on the interrupt stack (as opposed to the + * "master" stack). + * + * XXX Actually, we can't, because we don't use the master stack + * XXX right now. + */ +#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0) +#else +/* + * The clock interrupt handler can determine if it's a nested + * interrupt by checking for intr_depth > 1. + * (Remember, the clock interrupt handler itself will cause the + * depth counter to be incremented). + */ +extern volatile unsigned int intr_depth; +#define CLKF_INTR(framep) (intr_depth > 1) +#endif + +#ifndef __HAVE_M68K_HW_AST +#define cpu_set_hw_ast(l) __nothing +#endif + +extern volatile int astpending; +#define cpu_set_ast(l) \ + do { \ + __USE(l); astpending = 1; cpu_set_hw_ast(l); \ + } while (/*CONSTCOND*/0) + +/* + * Preempt the current process if in interrupt from user mode, + * or after the current trap/syscall if in system mode. + */ +#define cpu_need_resched(ci, l, flags) \ + do { \ + __USE(ci); __USE(flags); cpu_set_ast(l); \ + } while (/*CONSTCOND*/0) + +/* + * Give a profiling tick to the current process when the user profiling + * buffer pages are invalid. On m68k, request an ast to send us through + * trap, marking the proc as needing a profiling tick. + */ +#define cpu_need_proftick(l) \ + do { \ + (l)->l_pflag |= LP_OWEUPC; cpu_set_ast(l); \ + } while (/*CONSTCOND*/0) + +/* + * Notify the current process (p) that it has a signal pending, + * process as soon as possible. + */ +#define cpu_signotify(l) cpu_set_ast(l) + #endif /* _KERNEL */ #endif /* _M68K_CPU_H_ */ Index: src/sys/arch/m68k/m68k/m68k_trap.c diff -u src/sys/arch/m68k/m68k/m68k_trap.c:1.3 src/sys/arch/m68k/m68k/m68k_trap.c:1.4 --- src/sys/arch/m68k/m68k/m68k_trap.c:1.3 Sat Mar 6 13:32:56 2021 +++ src/sys/arch/m68k/m68k/m68k_trap.c Sat Jan 20 00:15:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: m68k_trap.c,v 1.3 2021/03/06 13:32:56 martin Exp $ */ +/* $NetBSD: m68k_trap.c,v 1.4 2024/01/20 00:15:31 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: m68k_trap.c,v 1.3 2021/03/06 13:32:56 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: m68k_trap.c,v 1.4 2024/01/20 00:15:31 thorpej Exp $"); #include "opt_m68k_arch.h" @@ -59,6 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: m68k_trap.c, extern int suline(void *, void *); /* locore.s */ +volatile int astpending; + #ifdef M68060 #define KDFAULT_060(c) (cputype == CPU_68060 && ((c) & FSLW_TM_SV)) #define WRFAULT_060(c) (cputype == CPU_68060 && ((c) & FSLW_RW_W)) Index: src/sys/arch/mac68k/include/cpu.h diff -u src/sys/arch/mac68k/include/cpu.h:1.104 src/sys/arch/mac68k/include/cpu.h:1.105 --- src/sys/arch/mac68k/include/cpu.h:1.104 Thu Jan 18 14:39:07 2024 +++ src/sys/arch/mac68k/include/cpu.h Sat Jan 20 00:15:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.104 2024/01/18 14:39:07 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.105 2024/01/20 00:15:32 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -69,54 +69,6 @@ */ #include <m68k/cpu.h> -#if defined(_KERNEL) -/* - * Get interrupt glue. - */ -#include <machine/intr.h> - -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the mac68k, we use - * what the hardware pushes on an interrupt (frame format 0). - */ -struct clockframe { - u_short sr; /* sr at time of interrupt */ - u_long pc; /* pc at time of interrupt */ - u_short 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_INTR(framep) (0) /* XXX should use PSL_M (see hp300) */ - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process from the softclock - * interrupt. Request an ast to send us through trap(), - * marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) ( (l)->l_pflag |= LP_OWEUPC, aston() ) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending++) - -#endif /* _KERNEL */ - /* values for machineid -- * These are equivalent to the MacOS Gestalt values. */ #define MACH_MACII 6 Index: src/sys/arch/mac68k/mac68k/trap.c diff -u src/sys/arch/mac68k/mac68k/trap.c:1.153 src/sys/arch/mac68k/mac68k/trap.c:1.154 --- src/sys/arch/mac68k/mac68k/trap.c:1.153 Thu Oct 5 19:41:04 2023 +++ src/sys/arch/mac68k/mac68k/trap.c Sat Jan 20 00:15:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.153 2023/10/05 19:41:04 ad Exp $ */ +/* $NetBSD: trap.c,v 1.154 2024/01/20 00:15:32 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.153 2023/10/05 19:41:04 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.154 2024/01/20 00:15:32 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -85,8 +85,6 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1 extern struct emul emul_sunos; #endif -int astpending; - const char *trap_type[] = { "Bus error", "Address error", Index: src/sys/arch/mvme68k/include/cpu.h diff -u src/sys/arch/mvme68k/include/cpu.h:1.56 src/sys/arch/mvme68k/include/cpu.h:1.57 --- src/sys/arch/mvme68k/include/cpu.h:1.56 Fri Jan 19 18:18:54 2024 +++ src/sys/arch/mvme68k/include/cpu.h Sat Jan 20 00:15:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.56 2024/01/19 18:18:54 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.57 2024/01/20 00:15:32 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -51,54 +51,6 @@ #include <m68k/cpu.h> #if defined(_KERNEL) -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the mvme68k, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) - -/* - * The clock interrupt handler can determine if it's a nested - * interrupt by checking for interrupt_depth > 1. - * (Remember, the clock interrupt handler itself will cause the - * depth counter to be incremented). - */ -#define CLKF_INTR(framep) (intr_depth > 1) - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the mvme68k, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) \ - do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */0) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending++) #define MVME68K 1 /* XXX */ Index: src/sys/arch/mvme68k/mvme68k/trap.c diff -u src/sys/arch/mvme68k/mvme68k/trap.c:1.116 src/sys/arch/mvme68k/mvme68k/trap.c:1.117 --- src/sys/arch/mvme68k/mvme68k/trap.c:1.116 Fri Jan 19 18:18:54 2024 +++ src/sys/arch/mvme68k/mvme68k/trap.c Sat Jan 20 00:15:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.116 2024/01/19 18:18:54 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.117 2024/01/20 00:15:32 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.116 2024/01/19 18:18:54 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.117 2024/01/20 00:15:32 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -91,8 +91,6 @@ void dumpwb(int, u_short, u_int, u_int); static inline void userret(struct lwp *l, struct frame *fp, u_quad_t oticks, u_int faultaddr, int fromtrap); -int astpending; - const char *trap_type[] = { "Bus error", "Address error", Index: src/sys/arch/news68k/include/cpu.h diff -u src/sys/arch/news68k/include/cpu.h:1.54 src/sys/arch/news68k/include/cpu.h:1.55 --- src/sys/arch/news68k/include/cpu.h:1.54 Fri Jan 19 18:18:55 2024 +++ src/sys/arch/news68k/include/cpu.h Sat Jan 20 00:15:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.54 2024/01/19 18:18:55 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.55 2024/01/20 00:15:32 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -72,62 +72,12 @@ #define DCIC_CLR (DC_CLR|IC_CLR) #define CACHE_BE (DC_BE|IC_BE) -/* - * Get interrupt glue. - */ -#include <machine/intr.h> - -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the news68k, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) -#if 0 -/* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0) -#else -/* but until we start using PSL_M, we have to do this instead */ -#include <machine/intr.h> -#define CLKF_INTR(framep) (intr_depth > 1) /* XXX */ -#endif - - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the news68k, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) \ - do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */0) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -extern int astpending; /* need to trap before returning to user mode */ -extern volatile u_char *ctrl_ast; -#define aston() \ - do { astpending++; *ctrl_ast = 0xff; } while (/* CONSTCOND */0) +#define cpu_set_hw_ast(l) \ + do { \ + extern volatile u_char *ctrl_ast; \ + __USE(l); \ + *ctrl_ast = 0xff; \ + } while (/*CONSTCOND*/0) #if defined(news1700) #define CACHE_HAVE_PAC Index: src/sys/arch/news68k/include/types.h diff -u src/sys/arch/news68k/include/types.h:1.15 src/sys/arch/news68k/include/types.h:1.16 --- src/sys/arch/news68k/include/types.h:1.15 Mon Jan 15 20:21:50 2024 +++ src/sys/arch/news68k/include/types.h Sat Jan 20 00:15:32 2024 @@ -1,6 +1,7 @@ -/* $NetBSD: types.h,v 1.15 2024/01/15 20:21:50 thorpej Exp $ */ +/* $NetBSD: types.h,v 1.16 2024/01/20 00:15:32 thorpej Exp $ */ #include <m68k/types.h> #define __HAVE_MM_MD_KERNACC #define __HAVE_M68K_INTR_VECTORED +#define __HAVE_M68K_HW_AST Index: src/sys/arch/news68k/news68k/trap.c diff -u src/sys/arch/news68k/news68k/trap.c:1.76 src/sys/arch/news68k/news68k/trap.c:1.77 --- src/sys/arch/news68k/news68k/trap.c:1.76 Thu Oct 5 19:41:05 2023 +++ src/sys/arch/news68k/news68k/trap.c Sat Jan 20 00:15:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.76 2023/10/05 19:41:05 ad Exp $ */ +/* $NetBSD: trap.c,v 1.77 2024/01/20 00:15:32 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.76 2023/10/05 19:41:05 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.77 2024/01/20 00:15:32 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -84,8 +84,6 @@ void dumpwb(int, u_short, u_int, u_int); static inline void userret(struct lwp *l, struct frame *fp, u_quad_t oticks, u_int faultaddr, int fromtrap); -int astpending; - const char *trap_type[] = { "Bus error", "Address error", Index: src/sys/arch/next68k/include/cpu.h diff -u src/sys/arch/next68k/include/cpu.h:1.57 src/sys/arch/next68k/include/cpu.h:1.58 --- src/sys/arch/next68k/include/cpu.h:1.57 Fri Jan 19 18:18:55 2024 +++ src/sys/arch/next68k/include/cpu.h Sat Jan 20 00:15:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.57 2024/01/19 18:18:55 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.58 2024/01/20 00:15:32 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -51,60 +51,6 @@ #include <m68k/cpu.h> #if defined(_KERNEL) -/* - * Get interrupt glue. - */ -#include <machine/intr.h> - -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the next68k, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) - -/* - * The clock interrupt handler can determine if it's a nested - * interrupt by checking for interrupt_depth > 1. - * (Remember, the clock interrupt handler itself will cause the - * depth counter to be incremented). - */ -#define CLKF_INTR(framep) (intr_depth > 1) - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the next68k, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) ((l)->l_pflag |= LP_OWEUPC, aston()) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -#define aston() (astpending++) - -extern int astpending; /* need to trap before returning to user mode */ - /* locore.s functions */ void doboot(void) __attribute__((__noreturn__)); int nmihand(void *); Index: src/sys/arch/next68k/next68k/trap.c diff -u src/sys/arch/next68k/next68k/trap.c:1.96 src/sys/arch/next68k/next68k/trap.c:1.97 --- src/sys/arch/next68k/next68k/trap.c:1.96 Fri Jan 19 18:18:55 2024 +++ src/sys/arch/next68k/next68k/trap.c Sat Jan 20 00:15:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.96 2024/01/19 18:18:55 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.97 2024/01/20 00:15:32 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.96 2024/01/19 18:18:55 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97 2024/01/20 00:15:32 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -99,8 +99,6 @@ void dumpwb(int, u_short, u_int, u_int); static inline void userret(struct lwp *, struct frame *, u_quad_t, u_int, int); -int astpending; - const char *trap_type[] = { "Bus error", "Address error", Index: src/sys/arch/sun2/sun2/trap.c diff -u src/sys/arch/sun2/sun2/trap.c:1.48 src/sys/arch/sun2/sun2/trap.c:1.49 --- src/sys/arch/sun2/sun2/trap.c:1.48 Wed Dec 27 17:35:37 2023 +++ src/sys/arch/sun2/sun2/trap.c Sat Jan 20 00:15:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.48 2023/12/27 17:35:37 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.49 2024/01/20 00:15:33 thorpej Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -78,7 +78,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.48 2023/12/27 17:35:37 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.49 2024/01/20 00:15:33 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -137,7 +137,7 @@ void straytrap(struct trapframe); static void userret(struct lwp *, struct trapframe *, u_quad_t); -int astpending; +volatile int astpending; const char *trap_type[] = { "Bus error", Index: src/sys/arch/sun3/sun3/trap.c diff -u src/sys/arch/sun3/sun3/trap.c:1.149 src/sys/arch/sun3/sun3/trap.c:1.150 --- src/sys/arch/sun3/sun3/trap.c:1.149 Wed Dec 27 17:35:37 2023 +++ src/sys/arch/sun3/sun3/trap.c Sat Jan 20 00:15:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.149 2023/12/27 17:35:37 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.150 2024/01/20 00:15:33 thorpej Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -78,7 +78,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.149 2023/12/27 17:35:37 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.150 2024/01/20 00:15:33 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -146,7 +146,7 @@ void straytrap(struct trapframe); static void userret(struct lwp *, struct trapframe *, u_quad_t); -int astpending; +volatile int astpending; const char *trap_type[] = { "Bus error", Index: src/sys/arch/sun68k/include/cpu.h diff -u src/sys/arch/sun68k/include/cpu.h:1.27 src/sys/arch/sun68k/include/cpu.h:1.28 --- src/sys/arch/sun68k/include/cpu.h:1.27 Fri Jan 19 18:18:55 2024 +++ src/sys/arch/sun68k/include/cpu.h Sat Jan 20 00:15:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.27 2024/01/19 18:18:55 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.28 2024/01/20 00:15:33 thorpej Exp $ */ /* * Copyright (c) 1982, 1990 The Regents of the University of California. @@ -103,54 +103,6 @@ */ /* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the sun68k, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) -#if 0 -/* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0) -#else -/* but until we start using PSL_M, we have to do this instead */ -#include <machine/intr.h> -#define CLKF_INTR(framep) (intr_depth > 1) /* XXX */ -#endif - -extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending = 1) - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the sun68k, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) ((l)->l_pflag |= LP_OWEUPC, aston()) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -/* * For some reason the sparc has this prototype in its machine/cpu.h, * so for now we do the same. */ Index: src/sys/arch/virt68k/include/cpu.h diff -u src/sys/arch/virt68k/include/cpu.h:1.6 src/sys/arch/virt68k/include/cpu.h:1.7 --- src/sys/arch/virt68k/include/cpu.h:1.6 Fri Jan 19 05:46:36 2024 +++ src/sys/arch/virt68k/include/cpu.h Sat Jan 20 00:15:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.6 2024/01/19 05:46:36 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.7 2024/01/20 00:15:33 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -50,59 +50,6 @@ */ #include <m68k/cpu.h> -#if defined(_KERNEL) -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the virt68k, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) - -/* - * The clock interrupt handler can determine if it's a nested - * interrupt by checking for intr_depth > 1. - * (Remember, the clock interrupt handler itself will cause the - * depth counter to be incremented). - */ -extern volatile unsigned int intr_depth; -#define CLKF_INTR(framep) (intr_depth > 1) - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the virt68k, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) \ - do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */0) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending++) - -#endif /* _KERNEL */ - #ifdef _KERNEL void cpu_set_reset_func(void (*)(void *, int), void *); int nmihand(void *); Index: src/sys/arch/virt68k/virt68k/trap.c diff -u src/sys/arch/virt68k/virt68k/trap.c:1.1 src/sys/arch/virt68k/virt68k/trap.c:1.2 --- src/sys/arch/virt68k/virt68k/trap.c:1.1 Tue Jan 2 07:41:02 2024 +++ src/sys/arch/virt68k/virt68k/trap.c Sat Jan 20 00:15:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.2 2024/01/20 00:15:33 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.2 2024/01/20 00:15:33 thorpej Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -91,8 +91,6 @@ void dumpwb(int, u_short, u_int, u_int); static inline void userret(struct lwp *l, struct frame *fp, u_quad_t oticks, u_int faultaddr, int fromtrap); -int astpending; - const char *trap_type[] = { "Bus error", "Address error", Index: src/sys/arch/x68k/include/cpu.h diff -u src/sys/arch/x68k/include/cpu.h:1.66 src/sys/arch/x68k/include/cpu.h:1.67 --- src/sys/arch/x68k/include/cpu.h:1.66 Fri Jan 19 18:49:10 2024 +++ src/sys/arch/x68k/include/cpu.h Sat Jan 20 00:15:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.66 2024/01/19 18:49:10 thorpej Exp $ */ +/* $NetBSD: cpu.h,v 1.67 2024/01/20 00:15:33 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -52,60 +52,6 @@ #if defined(_KERNEL) /* - * Get interrupt glue. - */ -#include <machine/intr.h> - -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. On the x68k, we use - * what the locore.s glue puts on the stack before calling C-code. - */ -struct clockframe { - 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)->cf_sr & PSL_S) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) -#if 0 -/* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0) -#else -/* but until we start using PSL_M, we have to do this instead */ -#define CLKF_INTR(framep) (0) /* XXX */ -#endif - - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ - aston(); \ -} while (/*CONSTCOND*/0) - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the x68k, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define cpu_need_proftick(l) \ - do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */ 0) - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define cpu_signotify(l) aston() - -extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending++) - -/* * The rest of this should probably be moved to <machine/x68kcpu.h> * although some of it could probably be put into generic 68k headers. */ @@ -120,7 +66,7 @@ void dumpsys(void); int badaddr(volatile void*); int badbaddr(volatile void*); -#endif +#endif /* _KERNEL */ /* physical memory sections */ #define INTIOBASE (0x00C00000) Index: src/sys/arch/x68k/x68k/trap.c diff -u src/sys/arch/x68k/x68k/trap.c:1.113 src/sys/arch/x68k/x68k/trap.c:1.114 --- src/sys/arch/x68k/x68k/trap.c:1.113 Sun Jan 7 07:58:35 2024 +++ src/sys/arch/x68k/x68k/trap.c Sat Jan 20 00:15:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.113 2024/01/07 07:58:35 isaki Exp $ */ +/* $NetBSD: trap.c,v 1.114 2024/01/20 00:15:33 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.113 2024/01/07 07:58:35 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.114 2024/01/20 00:15:33 thorpej Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -92,8 +92,6 @@ void dumpwb(int, u_short, u_int, u_int); static inline void userret(struct lwp *, struct frame *, u_quad_t, u_int, int); -int astpending; - const char *trap_type[] = { "Bus error", "Address error",