CVS commit: src/sys/arch/m68k/060sp

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 13 00:10:07 UTC 2024

Modified Files:
src/sys/arch/m68k/060sp: inetbsd.S
src/sys/arch/m68k/060sp/dist: iskeletn.s

Log Message:
s/Instrcution/Instruction/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/060sp/inetbsd.S
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/060sp/dist/iskeletn.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/m68k/060sp/inetbsd.S
diff -u src/sys/arch/m68k/060sp/inetbsd.S:1.4 src/sys/arch/m68k/060sp/inetbsd.S:1.5
--- src/sys/arch/m68k/060sp/inetbsd.S:1.4	Thu Nov 30 21:00:51 2000
+++ src/sys/arch/m68k/060sp/inetbsd.S	Mon May 13 00:10:06 2024
@@ -1,6 +1,6 @@
 /*
 #
-# $NetBSD: inetbsd.S,v 1.4 2000/11/30 21:00:51 scw Exp $
+# $NetBSD: inetbsd.S,v 1.5 2024/05/13 00:10:06 msaitoh Exp $
 #
 #
 # MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
@@ -83,7 +83,7 @@ ASENTRY_NOPROFILE(_060_isp_done)
 # This is an alternate exit point for the Unimplemented Integer
 # Instruction exception handler. If the instruction was a "chk2"
 # and the operand was out of bounds, then _isp_unimp() creates
-# a CHK exception stack frame from the Unimplemented Integer Instrcution
+# a CHK exception stack frame from the Unimplemented Integer Instruction
 # stack frame and branches to this routine.
 #
 */

Index: src/sys/arch/m68k/060sp/dist/iskeletn.s
diff -u src/sys/arch/m68k/060sp/dist/iskeletn.s:1.1 src/sys/arch/m68k/060sp/dist/iskeletn.s:1.2
--- src/sys/arch/m68k/060sp/dist/iskeletn.s:1.1	Fri Apr 14 20:24:39 2000
+++ src/sys/arch/m68k/060sp/dist/iskeletn.s	Mon May 13 00:10:06 2024
@@ -1,5 +1,5 @@
 #
-# $NetBSD: iskeletn.s,v 1.1 2000/04/14 20:24:39 is Exp $
+# $NetBSD: iskeletn.s,v 1.2 2024/05/13 00:10:06 msaitoh Exp $
 #
 
 #
@@ -81,7 +81,7 @@ _060_isp_done:
 # This is an alternate exit point for the Unimplemented Integer
 # Instruction exception handler. If the instruction was a "chk2"
 # and the operand was out of bounds, then _isp_unimp() creates
-# a CHK exception stack frame from the Unimplemented Integer Instrcution
+# a CHK exception stack frame from the Unimplemented Integer Instruction
 # stack frame and branches to this routine.
 #
 	global		_060_real_chk



CVS commit: src/sys/arch/m68k/060sp

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 13 00:10:07 UTC 2024

Modified Files:
src/sys/arch/m68k/060sp: inetbsd.S
src/sys/arch/m68k/060sp/dist: iskeletn.s

Log Message:
s/Instrcution/Instruction/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/060sp/inetbsd.S
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/060sp/dist/iskeletn.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-02-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Feb  1 22:00:29 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h

Log Message:
s/Prototol/Protocol/ and s/Umimplemented/Unimplemented/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/vectors.h

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/m68k/include/vectors.h
diff -u src/sys/arch/m68k/include/vectors.h:1.5 src/sys/arch/m68k/include/vectors.h:1.6
--- src/sys/arch/m68k/include/vectors.h:1.5	Fri Jan 19 05:45:28 2024
+++ src/sys/arch/m68k/include/vectors.h	Thu Feb  1 22:00:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.5 2024/01/19 05:45:28 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.6 2024/02/01 22:00:29 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 #define	VECI_LINE1010		10	/* Line 1010 Emulator */
 #define	VECI_LINE		11	/* Line  Emulator */
 #define	VECI_rsvd12		12	/* unassigned, reserved */
-#define	VECI_CPV		13	/* Coprocessor Prototol Violation */
+#define	VECI_CPV		13	/* Coprocessor Protocol Violation */
 #define	VECI_FORMATERR		14	/* Format Error */
 #define	VECI_UNINT_INTR		15	/* Uninitialized Interrupt */
 #define	VECI_rsvd16		16	/* unassigned, reserved */
@@ -109,7 +109,7 @@
 #define	VECI_PMMU_ACCESS	58	/* PMMU Access Level Violation */
 #define	VECI_rsvd59		59	/* unassigned, reserved */
 #define	VECI_UNIMP_EA		60	/* Unimplemented Effective Address */
-#define	VECI_UNIMP_II		61	/* Umimplemented Integer Instruction */
+#define	VECI_UNIMP_II		61	/* Unimplemented Integer Instruction */
 #define	VECI_rsvd62		62	/* unassigned, reserved */
 #define	VECI_rsvd63		63	/* unassigned, reserved */
 #define	VECI_USRVEC_START	64	/* User defined vectors (192) */



CVS commit: src/sys/arch/m68k/include

2024-02-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Feb  1 22:00:29 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h

Log Message:
s/Prototol/Protocol/ and s/Umimplemented/Unimplemented/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/vectors.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:37:25 UTC 2024

Modified Files:
src/sys/arch/m68k/include: ieee.h

Log Message:
Add multiple inclusion protection guard - the long double math routines
have a tendency to sometimes make that happen.

This seems to fix the sun3 build, and probably other m68k builds which
were working before the libm upgrades (it will do nothing for any that
were failing before that).


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/include/ieee.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:37:25 UTC 2024

Modified Files:
src/sys/arch/m68k/include: ieee.h

Log Message:
Add multiple inclusion protection guard - the long double math routines
have a tendency to sometimes make that happen.

This seems to fix the sun3 build, and probably other m68k builds which
were working before the libm upgrades (it will do nothing for any that
were failing before that).


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/include/ieee.h

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/m68k/include/ieee.h
diff -u src/sys/arch/m68k/include/ieee.h:1.16 src/sys/arch/m68k/include/ieee.h:1.17
--- src/sys/arch/m68k/include/ieee.h:1.16	Mon Sep 20 16:13:35 2010
+++ src/sys/arch/m68k/include/ieee.h	Mon Jan 22 14:37:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee.h,v 1.16 2010/09/20 16:13:35 christos Exp $	*/
+/*	$NetBSD: ieee.h,v 1.17 2024/01/22 14:37:25 kre Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,6 +40,9 @@
  *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
  */
 
+#ifndef	__68K_IEEE_H_INCLUDED
+#define	__68K_IEEE_H_INCLUDED
+
 /*
  * ieee.h defines the machine-dependent layout of the machine's IEEE
  * floating point.  It does *not* define (yet?) any of the rounding
@@ -111,3 +114,5 @@ union ieee_ext_u {
 #define LDBL_NBIT	0x8000
 #define mask_nbit_l(u)	((u).extu_frach &= ~LDBL_NBIT)
 #endif /* !__mc68010__ || _KERNEL */
+
+#endif /* __68K_IEEE_H_INCLUDED */



CVS commit: src/sys/arch/m68k/include

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 20 02:23:15 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h

Log Message:
What good are comments, really, if you can't have a little color?  Add
a note above CLKF_INTR() about why NetBSD will likely never switch to
using the "master" stack for the kernel, and thus why the not-enabled
version of CLKF_INTR() will never be enabled.

(Adding the comment here, rather than just deleting the code, has value,
I think, for future retrocomputing archeologists.)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/include/cpu.h

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/m68k/include/cpu.h
diff -u src/sys/arch/m68k/include/cpu.h:1.22 src/sys/arch/m68k/include/cpu.h:1.23
--- src/sys/arch/m68k/include/cpu.h:1.22	Sat Jan 20 00:15:31 2024
+++ src/sys/arch/m68k/include/cpu.h	Sat Jan 20 02:23:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.22 2024/01/20 00:15:31 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.23 2024/01/20 02:23:15 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -168,6 +168,13 @@ struct clockframe {
  *
  * XXX Actually, we can't, because we don't use the master stack
  * XXX right now.
+ *
+ * (Actually, it's unlikely that we'll ever use the master stack in NetBSD.
+ * It would complicate the spl*() functions considerably and it just doesn't
+ * seem like a good trade-off for what seems like extremely marginal gains.
+ * So, just blissfully run the kernel on the interrupt stack all the time,
+ * and it's been that way for >30 years and no one has really complained
+ * about it.)
  */
 #define	CLKF_INTR(framep)	(((framep)->cf_sr & PSL_M) == 0)
 #else



CVS commit: src/sys/arch/m68k/include

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 20 02:23:15 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h

Log Message:
What good are comments, really, if you can't have a little color?  Add
a note above CLKF_INTR() about why NetBSD will likely never switch to
using the "master" stack for the kernel, and thus why the not-enabled
version of CLKF_INTR() will never be enabled.

(Adding the comment here, rather than just deleting the code, has value,
I think, for future retrocomputing archeologists.)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/include/cpu.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 05:45:28 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Ensuire VECO_TO_VECI() returns an 8-bit index.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/m68k/m68k_intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 05:45:28 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Ensuire VECO_TO_VECI() returns an 8-bit index.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/m68k/m68k_intr.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/m68k/include/vectors.h
diff -u src/sys/arch/m68k/include/vectors.h:1.4 src/sys/arch/m68k/include/vectors.h:1.5
--- src/sys/arch/m68k/include/vectors.h:1.4	Sun Jan 14 00:00:15 2024
+++ src/sys/arch/m68k/include/vectors.h	Fri Jan 19 05:45:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.4 2024/01/14 00:00:15 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.5 2024/01/19 05:45:28 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -122,7 +122,7 @@
 #define	VECI_TRAP(x)		((x) + VECI_TRAP0)
 
 #define	VECI_TO_VECO(x)		((x) << 2)
-#define	VECO_TO_VECI(x)		((unsigned int)(x) >> 2)
+#define	VECO_TO_VECI(x)		((uint8_t)((unsigned int)(x) >> 2))
 
 #ifdef _KERNEL
 

Index: src/sys/arch/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.10 src/sys/arch/m68k/m68k/m68k_intr.c:1.11
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.10	Tue Jan 16 02:36:49 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Fri Jan 19 05:45:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.10 2024/01/16 02:36:49 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.11 2024/01/19 05:45:28 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.10 2024/01/16 02:36:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.11 2024/01/19 05:45:28 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -389,7 +389,7 @@ void	m68k_intr_autovec(struct clockframe
 void
 m68k_intr_autovec(struct clockframe frame)
 {
-	const int ipl = VECO_TO_VECI(frame.cf_vo & 0xfff) - VECI_INTRAV0;
+	const int ipl = VECO_TO_VECI(frame.cf_vo) - VECI_INTRAV0;
 	struct m68k_intrhand *ih;
 	bool rv = false;
 
@@ -420,7 +420,7 @@ void	m68k_intr_vectored(struct clockfram
 void
 m68k_intr_vectored(struct clockframe frame)
 {
-	const int vec = VECO_TO_VECI(frame.cf_vo & 0xfff);
+	const int vec = VECO_TO_VECI(frame.cf_vo);
 	const int ipl = (getsr() >> 8) & 7;
 	struct m68k_intrhand *ih;
 



CVS commit: src/sys/arch/m68k/m68k

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 03:35:31 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c vm_machdep.c

Log Message:
Move physaccess(), physunaccess(), and kvtop() from vm_machdep.c to
pmap_motorola.c.  They're legacy functions tied to that pmap implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/m68k/m68k/vm_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 03:35:31 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c vm_machdep.c

Log Message:
Move physaccess(), physunaccess(), and kvtop() from vm_machdep.c to
pmap_motorola.c.  They're legacy functions tied to that pmap implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/m68k/m68k/vm_machdep.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/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.88 src/sys/arch/m68k/m68k/pmap_motorola.c:1.89
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.88	Thu Jan 18 14:39:06 2024
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Fri Jan 19 03:35:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.88 2024/01/18 14:39:06 thorpej Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.89 2024/01/19 03:35:31 thorpej Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -120,7 +120,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.88 2024/01/18 14:39:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.89 2024/01/19 03:35:31 thorpej Exp $");
 
 #include 
 #include 
@@ -2951,3 +2951,48 @@ pmap_check_wiring(const char *str, vaddr
 		   str, va, pg->wire_count, count);
 }
 #endif /* DEBUG */
+
+/*
+ * XXX XXX XXX These are legacy remants and should go away XXX XXX XXX
+ * (Cribbed from vm_machdep.c because they're tied to this pmap impl.)
+ */
+
+/*  
+ * Map `size' bytes of physical memory starting at `paddr' into
+ * kernel VA space at `vaddr'.  Read/write and cache-inhibit status
+ * are specified by `prot'.
+ */
+void
+physaccess(void *vaddr, void *paddr, int size, int prot)
+{
+	pt_entry_t *pte;
+	u_int page;
+
+	pte = kvtopte(vaddr);
+	page = (u_int)paddr & PG_FRAME;
+	for (size = btoc(size); size; size--) {
+		*pte++ = PG_V | prot | page;
+		page += PAGE_SIZE;
+	}
+	TBIAS();
+}
+
+void
+physunaccess(void *vaddr, int size)
+{
+	 pt_entry_t *pte;
+
+	 pte = kvtopte(vaddr);
+	 for (size = btoc(size); size; size--)
+	 	*pte++ = PG_NV;
+	TBIAS();
+}
+
+/*
+ * Convert kernel VA to physical address
+ */
+int
+kvtop(void *addr)
+{
+	return (int)vtophys((vaddr_t)addr);
+}

Index: src/sys/arch/m68k/m68k/vm_machdep.c
diff -u src/sys/arch/m68k/m68k/vm_machdep.c:1.42 src/sys/arch/m68k/m68k/vm_machdep.c:1.43
--- src/sys/arch/m68k/m68k/vm_machdep.c:1.42	Sun Dec 31 21:59:24 2023
+++ src/sys/arch/m68k/m68k/vm_machdep.c	Fri Jan 19 03:35:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.42 2023/12/31 21:59:24 thorpej Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.43 2024/01/19 03:35:31 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.42 2023/12/31 21:59:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.43 2024/01/19 03:35:31 thorpej Exp $");
 
 #include 
 #include 
@@ -209,51 +209,3 @@ vunmapbuf(struct buf *bp, vsize_t len)
 	bp->b_data = bp->b_saveaddr;
 	bp->b_saveaddr = 0;
 }
-
-
-#if defined(M68K_MMU_MOTOROLA) || defined(M68K_MMU_HP)
-
-#include 
-
-/*
- * Map `size' bytes of physical memory starting at `paddr' into
- * kernel VA space at `vaddr'.  Read/write and cache-inhibit status
- * are specified by `prot'.
- */
-void
-physaccess(void *vaddr, void *paddr, int size, int prot)
-{
-	pt_entry_t *pte;
-	u_int page;
-
-	pte = kvtopte(vaddr);
-	page = (u_int)paddr & PG_FRAME;
-	for (size = btoc(size); size; size--) {
-		*pte++ = PG_V | prot | page;
-		page += PAGE_SIZE;
-	}
-	TBIAS();
-}
-
-void
-physunaccess(void *vaddr, int size)
-{
-	pt_entry_t *pte;
-
-	pte = kvtopte(vaddr);
-	for (size = btoc(size); size; size--)
-		*pte++ = PG_NV;
-	TBIAS();
-}
-
-/*
- * Convert kernel VA to physical address
- */
-int
-kvtop(void *addr)
-{
-	return (int)vtophys((vaddr_t)addr);
-}
-
-#endif
-



CVS commit: src/sys/arch/m68k/include

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 18 14:42:09 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h

Log Message:
Remove a comment that is no longer applicable.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/m68k/include/cpu.h

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/m68k/include/cpu.h
diff -u src/sys/arch/m68k/include/cpu.h:1.20 src/sys/arch/m68k/include/cpu.h:1.21
--- src/sys/arch/m68k/include/cpu.h:1.20	Thu Jan 18 14:39:06 2024
+++ src/sys/arch/m68k/include/cpu.h	Thu Jan 18 14:42:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.20 2024/01/18 14:39:06 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.21 2024/01/18 14:42:09 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -47,24 +47,6 @@
 
 /*
  * Exported definitions common to Motorola m68k-based ports.
- *
- * Note that are some port-specific definitions here, such as
- * HP and Sun MMU types.  These facilitate adding very small
- * amounts of port-specific code to what would otherwise be
- * identical.  The is especially true in the case of the HP
- * and other m68k pmaps.
- *
- * Individual ports are expected to define the following CPP symbols
- * in  to enable conditional code:
- *
- *	M68K_MMU_MOTOROLA	Machine has a Motorola MMU (incl.
- *68851, 68030, 68040, 68060)
- *
- *	M68K_MMU_HP		Machine has an HP MMU.
- *
- * Note also that while m68k-generic code conditionalizes on the
- * M68K_MMU_HP CPP symbol, none of the HP MMU definitions are in this
- * file (since none are used in otherwise sharable code).
  */
 
 /*



CVS commit: src/sys/arch/m68k/include

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 18 14:42:09 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h

Log Message:
Remove a comment that is no longer applicable.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/m68k/include/cpu.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/conf

2024-01-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 18 05:42:29 UTC 2024

Modified Files:
src/sys/arch/m68k/conf: files.m68k

Log Message:
Bump required version (mkflagvar).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/m68k/conf/files.m68k

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/conf

2024-01-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 18 05:42:29 UTC 2024

Modified Files:
src/sys/arch/m68k/conf: files.m68k

Log Message:
Bump required version (mkflagvar).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/m68k/conf/files.m68k

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/m68k/conf/files.m68k
diff -u src/sys/arch/m68k/conf/files.m68k:1.55 src/sys/arch/m68k/conf/files.m68k:1.56
--- src/sys/arch/m68k/conf/files.m68k:1.55	Thu Jan 18 05:04:13 2024
+++ src/sys/arch/m68k/conf/files.m68k	Thu Jan 18 05:42:29 2024
@@ -1,6 +1,8 @@
-#	$NetBSD: files.m68k,v 1.55 2024/01/18 05:04:13 thorpej Exp $
+#	$NetBSD: files.m68k,v 1.56 2024/01/18 05:42:29 thorpej Exp $
 #
 
+version	20240118		# mkflagvar
+
 defflag	opt_fpsp.h		FPSP
 defflag	opt_m68k_arch.h		M68010
 defflag	opt_m68k_arch.h		M68020



CVS commit: src/sys/arch/m68k/conf

2024-01-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 18 05:04:13 UTC 2024

Modified Files:
src/sys/arch/m68k/conf: files.m68k

Log Message:
mkflagvar M68010 M68020 M68030 M68040 M68060


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/m68k/conf/files.m68k

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/conf

2024-01-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 18 05:04:13 UTC 2024

Modified Files:
src/sys/arch/m68k/conf: files.m68k

Log Message:
mkflagvar M68010 M68020 M68030 M68040 M68060


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/m68k/conf/files.m68k

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/m68k/conf/files.m68k
diff -u src/sys/arch/m68k/conf/files.m68k:1.54 src/sys/arch/m68k/conf/files.m68k:1.55
--- src/sys/arch/m68k/conf/files.m68k:1.54	Wed Jan 17 12:33:51 2024
+++ src/sys/arch/m68k/conf/files.m68k	Thu Jan 18 05:04:13 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.m68k,v 1.54 2024/01/17 12:33:51 thorpej Exp $
+#	$NetBSD: files.m68k,v 1.55 2024/01/18 05:04:13 thorpej Exp $
 #
 
 defflag	opt_fpsp.h		FPSP
@@ -7,6 +7,11 @@ defflag	opt_m68k_arch.h		M68020
 defflag	opt_m68k_arch.h		M68030
 defflag	opt_m68k_arch.h		M68040
 defflag	opt_m68k_arch.h		M68060
+
+# Emit Makefile vars for these kernel options so that compiler flags
+# can be tuned for CPU support.
+mkflagvar M68010 M68020 M68030 M68040 M68060
+
 defflagFPU_EMULATE
 defflagPMAP_DEBUG
 



CVS commit: src/sys/arch/m68k/m68k

2024-01-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 17 05:41:57 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: switch_subr.s

Log Message:
cpu_switchto(): No need for the pmap_activate() dance here; it's
already done for us in mi_switch().


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/m68k/m68k/switch_subr.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/m68k/m68k/switch_subr.s
diff -u src/sys/arch/m68k/m68k/switch_subr.s:1.36 src/sys/arch/m68k/m68k/switch_subr.s:1.37
--- src/sys/arch/m68k/m68k/switch_subr.s:1.36	Tue Sep 26 14:33:55 2023
+++ src/sys/arch/m68k/m68k/switch_subr.s	Wed Jan 17 05:41:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: switch_subr.s,v 1.36 2023/09/26 14:33:55 tsutsui Exp $	*/
+/*	$NetBSD: switch_subr.s,v 1.37 2024/01/17 05:41:57 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation.
@@ -88,7 +88,7 @@ GLOBAL(_Idle)/* For sun2/sun3's cloc
  * Switch to the specific next LWP.
  */
 ENTRY(cpu_switchto)
-	movl	4(%sp),%a1		| fetch `current' lwp
+	movl	4(%sp),%a1		| fetch outgoing lwp
 	/*
 	 * Save state of previous process in its pcb.
 	 */
@@ -133,78 +133,38 @@ ENTRY(cpu_switchto)
 #endif	/* !_M68K_CUSTOM_FPU_CTX */
 
 	movl	8(%sp),%a0		| get newlwp
-	movl	%a0,_C_LABEL(curlwp)
+	movl	%a0,_C_LABEL(curlwp)	| curlwp = new lwp
 	movl	L_PCB(%a0),%a1		| get its pcb
-	movl	%a1,_C_LABEL(curpcb)
+	movl	%a1,_C_LABEL(curpcb)	| curpcb = new pcb
 
-#if defined(sun2) || defined(sun3)
-	movl	L_PROC(%a0),%a2
-	movl	P_VMSPACE(%a2),%a2	| vm = p->p_vmspace
-#if defined(DIAGNOSTIC) && !defined(sun2)
-	tstl	%a2			| vm == VM_MAP_NULL?
-	jeq	.Lcpu_switch_badsw	| panic
-#endif
-	pea	(%a0)			| save newlwp
-#if !defined(_SUN3X_) || defined(PMAP_DEBUG)
-	movl	VM_PMAP(%a2),-(%sp)	| push vm->vm_map.pmap
-	jbsr	_C_LABEL(_pmap_switch)	| _pmap_switch(pmap)
-	addql	#4,%sp
-	movl	_C_LABEL(curpcb),%a1	| restore curpcb
-| Note: _pmap_switch() will clear the cache if needed.
-#else
-	/* Use this inline version on sun3x when not debugging the pmap. */
-	lea	_C_LABEL(kernel_crp),%a3 | our CPU Root Ptr. (CRP)
-	movl	VM_PMAP(%a2),%a2	| pmap = vm->vm_map.pmap
-	movl	PM_A_PHYS(%a2),%d0	| phys = pmap->pm_a_phys
-	cmpl	4(%a3),%d0		|  == kernel_crp.rp_addr ?
-	jeq	.Lsame_mmuctx		| skip loadcrp/flush
-	/* OK, it is a new MMU context.  Load it up. */
-	movl	%d0,4(%a3)
-	movl	#CACHE_CLR,%d0
-	movc	%d0,%cacr		| invalidate cache(s)
-	pflusha| flush entire TLB
-	pmove	(%a3),%crp		| load new user root pointer
-.Lsame_mmuctx:
-#endif	/* !defined(_SUN3X_) || defined(PMAP_DEBUG) */
-#else	/* !defined(sun2) && !defined(sun3) */
 	/*
-	 * Activate process's address space.
-	 * XXX Should remember the last USTP value loaded, and call this
-	 * XXX only of it has changed.
+	 * Check for restartable atomic sequences (RAS)
 	 */
-	pea	(%a0)			| push newlwp
-	jbsr	_C_LABEL(pmap_activate)	| pmap_activate(newlwp)
-	/* Note that newlwp will be popped off the stack later. */
-#endif
-
-	/*
-	 *  Check for restartable atomic sequences (RAS)
-	 */
-	movl	_C_LABEL(curlwp),%a0
 	movl	L_PROC(%a0),%a2
-	tstl	P_RASLIST(%a2)
-	jeq	1f
+	tstl	P_RASLIST(%a2)		| p->p_raslist == NULL?
+	jeq	2f			| yes, skip it.
 	movl	L_MD_REGS(%a0),%a1
-	movl	TF_PC(%a1),-(%sp)
-	movl	%a2,-(%sp)
-	jbsr	_C_LABEL(ras_lookup)
+	movl	TF_PC(%a1),-(%sp)	| push return PC
+	movl	%a2,-(%sp)		| push proc
+	jbsr	_C_LABEL(ras_lookup)	| a0 = ras_lookup(p, pc)
 	addql	#8,%sp
 	movql	#-1,%d0
-	cmpl	%a0,%d0
-	jeq	1f
+	cmpl	%a0,%d0			| a0 == -1?
+	jeq	1f			| yes, skip it.
 	movl	_C_LABEL(curlwp),%a1
 	movl	L_MD_REGS(%a1),%a1
-	movl	%a0,TF_PC(%a1)
+	movl	%a0,TF_PC(%a1)		| fixup return PC
 1:
-	movl	(%sp)+,%d0		| restore newlwp
-	movl	_C_LABEL(curpcb),%a1	| restore pcb
+	movl	_C_LABEL(curlwp),%a0	| recover new lwp
+	movl	_C_LABEL(curpcb),%a1	| recover new pcb
+2:
+	movl	%a0,%d0			| free up %a0
+	movl	4(%sp),%d1		| get oldlwp for return value
+	lea	_ASM_LABEL(tmpstk),%sp	| switch to tmp stack in case of NMI
 
-	movl	4(%sp),%d1		| restore oldlwp for a return value
-	lea _ASM_LABEL(tmpstk),%sp	| now goto a tmp stack for NMI
-
-	moveml	PCB_REGS(%a1),%d2-%d7/%a2-%a7	| and registers
+	moveml	PCB_REGS(%a1),%d2-%d7/%a2-%a7 | restore registers
 	movl	PCB_USP(%a1),%a0
-	movl	%a0,%usp		| and USP
+	movl	%a0,%usp		  | and USP
 
 #ifdef _M68K_CUSTOM_FPU_CTX
 	moveml	%d0/%d1,-(%sp)
@@ -245,14 +205,10 @@ ENTRY(cpu_switchto)
 #endif /* !_M68K_CUSTOM_FPU_CTX */
 
 .Lcpu_switch_nofprest:
-	movl	%d1,%d0
-	movl	%d0,%a0
+	movl	%d1,%d0			| return outgoing lwp
+	movl	%d0,%a0			| (in a0, too)
 	rts
 
-.Lcpu_switch_badsw:
-	PANIC("switch")
-	/*NOTREACHED*/
-
 /*
  * savectx(pcb)
  * Update pcb, saving current processor state.



CVS commit: src/sys/arch/m68k/m68k

2024-01-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 17 05:41:57 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: switch_subr.s

Log Message:
cpu_switchto(): No need for the pmap_activate() dance here; it's
already done for us in mi_switch().


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/m68k/m68k/switch_subr.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 05:29:44 UTC 2024

Modified Files:
src/sys/arch/m68k/include: psl.h

Log Message:
Provide PSLTOIPL() and IPLTOPSL() macros.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/m68k/include/psl.h

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/m68k/include/psl.h
diff -u src/sys/arch/m68k/include/psl.h:1.18 src/sys/arch/m68k/include/psl.h:1.19
--- src/sys/arch/m68k/include/psl.h:1.18	Sun Jan 14 22:06:03 2024
+++ src/sys/arch/m68k/include/psl.h	Tue Jan 16 05:29:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.18 2024/01/14 22:06:03 thorpej Exp $	*/
+/*	$NetBSD: psl.h,v 1.19 2024/01/16 05:29:44 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -65,6 +65,9 @@
 #define	PSL_USERSET	(0)
 #define	PSL_USERCLR	(PSL_S | PSL_IPL7 | PSL_MBZ)
 
+#define	PSLTOIPL(x)	(((x) >> 8) & 0x7)
+#define	IPLTOPSL(x)	x) & 0x7) << 8) | PSL_S)
+
 #define	USERMODE(ps)	(((ps) & PSL_S) == 0)
 
 #if defined(_KERNEL) && !defined(_LOCORE)



CVS commit: src/sys/arch/m68k/include

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 05:29:44 UTC 2024

Modified Files:
src/sys/arch/m68k/include: psl.h

Log Message:
Provide PSLTOIPL() and IPLTOPSL() macros.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/m68k/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 02:36:49 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Add a hook to allow a platform to suppress reporting stray auto-vectored
interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/m68k/m68k_intr.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/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.9 src/sys/arch/m68k/m68k/m68k_intr.c:1.10
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.9	Tue Jan 16 02:14:33 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Tue Jan 16 02:36:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.9 2024/01/16 02:14:33 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.10 2024/01/16 02:36:49 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.9 2024/01/16 02:14:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.10 2024/01/16 02:36:49 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -377,6 +377,10 @@ m68k_intr_disestablish(void *v)
 
 void	m68k_intr_autovec(struct clockframe);
 
+#ifndef MACHINE_AUTOVEC_IGNORE_STRAY
+#define	MACHINE_AUTOVEC_IGNORE_STRAY(ipl)	0
+#endif
+
 /*
  * m68k_intr_autovec --
  *	Run the interrupt handlers for an auto-vectored interrupt.
@@ -398,8 +402,8 @@ m68k_intr_autovec(struct clockframe fram
 			rv = true;
 		}
 	}
-	if (!rv) {
-		printf("Spurious interrupt on IPL %d\n", ipl);
+	if (!rv && !MACHINE_AUTOVEC_IGNORE_STRAY(ipl)) {
+		printf("Stray level %d interrupt\n", ipl);
 	}
 
 	ATOMIC_CAS_CHECK();
@@ -438,8 +442,8 @@ m68k_intr_vectored(struct clockframe fra
 		 : ) != 0)) {
 		ih->ih_evcnt->ev_count++;
 	} else {
-		printf("Spurious interrupt on vector=0x%0x IPL %d\n",
-		vec, ipl);
+		printf("Stray level %d interrupt vector=0x%x\n",
+		ipl, vec);
 	}
 #ifdef DIAGNOSTIC
  out:



CVS commit: src/sys/arch/m68k/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 02:36:49 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Add a hook to allow a platform to suppress reporting stray auto-vectored
interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/m68k/m68k_intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 02:14:33 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c m68k_intr_stubs.s

Log Message:
Increment and decrement idepth in the assembly stubs, not C code.  This
provides two advantages:
- Greater coverage for detecting "interrupt time".
- More flexibility for platform-specific interrupt stubs that might need
  to do special processing before calling the common dispatcher.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/m68k_intr_stubs.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/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.8 src/sys/arch/m68k/m68k/m68k_intr.c:1.9
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.8	Tue Jan 16 01:16:46 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Tue Jan 16 02:14:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.8 2024/01/16 01:16:46 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.9 2024/01/16 02:14:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.8 2024/01/16 01:16:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.9 2024/01/16 02:14:33 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -70,7 +70,7 @@ extern char intrstub_vectored[];
 /* A dummy event counter where interrupt stats go to die. */
 static struct evcnt bitbucket;
 
-volatile int idepth;
+volatile int idepth;	/* updated in assembly glue */
 
 static struct m68k_intrhand_list m68k_intrhands_autovec[NAUTOVECTORS];
 #ifdef __HAVE_M68K_INTR_VECTORED
@@ -389,8 +389,6 @@ m68k_intr_autovec(struct clockframe fram
 	struct m68k_intrhand *ih;
 	bool rv = false;
 
-	idepth++;
-
 	m68k_count_intr(ipl);
 
 	LIST_FOREACH(ih, _intrhands_autovec[ipl], ih_link) {
@@ -404,8 +402,6 @@ m68k_intr_autovec(struct clockframe fram
 		printf("Spurious interrupt on IPL %d\n", ipl);
 	}
 
-	idepth--;
-
 	ATOMIC_CAS_CHECK();
 }
 
@@ -424,8 +420,6 @@ m68k_intr_vectored(struct clockframe fra
 	const int ipl = (getsr() >> 8) & 7;
 	struct m68k_intrhand *ih;
 
-	idepth++;
-
 	m68k_count_intr(ipl);
 
 #ifdef DIAGNOSTIC
@@ -450,8 +444,6 @@ m68k_intr_vectored(struct clockframe fra
 #ifdef DIAGNOSTIC
  out:
 #endif
-	idepth--;
-
 	ATOMIC_CAS_CHECK();
 }
 #endif /* __HAVE_M68K_INTR_VECTORED */

Index: src/sys/arch/m68k/m68k/m68k_intr_stubs.s
diff -u src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.2 src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.3
--- src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.2	Tue Jan 16 01:16:46 2024
+++ src/sys/arch/m68k/m68k/m68k_intr_stubs.s	Tue Jan 16 02:14:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr_stubs.s,v 1.2 2024/01/16 01:16:46 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr_stubs.s,v 1.3 2024/01/16 02:14:33 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -62,9 +62,11 @@
  */
 	INTRSTUB_ALIGN
 ENTRY_NOPROFILE(intrstub_autovec)
+	addql	#1,_C_LABEL(idepth)
 	INTERRUPT_SAVEREG
 	jbsr	_C_LABEL(m68k_intr_autovec)
 	INTERRUPT_RESTOREREG
+	subql	#1,_C_LABEL(idepth)
 	jra	_ASM_LABEL(rei)
 
 #ifdef __HAVE_M68K_INTR_VECTORED
@@ -73,8 +75,10 @@ ENTRY_NOPROFILE(intrstub_autovec)
  */
 	INTRSTUB_ALIGN
 ENTRY_NOPROFILE(intrstub_vectored)
+	addql	#1,_C_LABEL(idepth)
 	INTERRUPT_SAVEREG
 	jbsr	_C_LABEL(m68k_intr_vectored)
 	INTERRUPT_RESTOREREG
+	subql	#1,_C_LABEL(idepth)
 	jra	_ASM_LABEL(rei)
 #endif /* __HAVE_M68K_INTR_VECTORED */



CVS commit: src/sys/arch/m68k/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 02:14:33 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c m68k_intr_stubs.s

Log Message:
Increment and decrement idepth in the assembly stubs, not C code.  This
provides two advantages:
- Greater coverage for detecting "interrupt time".
- More flexibility for platform-specific interrupt stubs that might need
  to do special processing before calling the common dispatcher.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/m68k_intr_stubs.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 01:16:47 UTC 2024

Modified Files:
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c m68k_intr_stubs.s

Log Message:
- Declare idepth as volatile.
- Provide a m68k_intrvec_intrhand() routine that returns the interrupt
  handle for a given vectored interrupt.  XXX This is gross and should
  burn to the ground, but is needed to support legacy ISR interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/m68k_intr_stubs.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/m68k/include/intr.h
diff -u src/sys/arch/m68k/include/intr.h:1.4 src/sys/arch/m68k/include/intr.h:1.5
--- src/sys/arch/m68k/include/intr.h:1.4	Mon Jan 15 18:47:03 2024
+++ src/sys/arch/m68k/include/intr.h	Tue Jan 16 01:16:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.4 2024/01/15 18:47:03 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.5 2024/01/16 01:16:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023, 2024 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@ typedef struct {
 #endif
 
 #ifdef _KERNEL
-extern int idepth;		/* interrupt depth */
+extern volatile int idepth;		/* interrupt depth */
 extern const uint16_t ipl2psl_table[NIPL];
 
 typedef int ipl_t;		/* logical IPL_* value */
@@ -198,6 +198,10 @@ void	*m68k_intr_establish(int (*)(void *
 	int/*vec*/, int/*m68k ipl*/, int/*isrpri*/, int/*flags*/);
 bool	m68k_intr_disestablish(void *);
 
+#ifdef __HAVE_M68K_INTR_VECTORED
+void	*m68k_intrvec_intrhand(int vec);	/* XXX */
+#endif
+
 #endif /* _KERNEL */
 
 #endif /* _M68k_INTR_H_ */

Index: src/sys/arch/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.7 src/sys/arch/m68k/m68k/m68k_intr.c:1.8
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.7	Mon Jan 15 19:27:16 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Tue Jan 16 01:16:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.7 2024/01/15 19:27:16 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.8 2024/01/16 01:16:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.7 2024/01/15 19:27:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.8 2024/01/16 01:16:46 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -70,7 +70,7 @@ extern char intrstub_vectored[];
 /* A dummy event counter where interrupt stats go to die. */
 static struct evcnt bitbucket;
 
-int idepth;
+volatile int idepth;
 
 static struct m68k_intrhand_list m68k_intrhands_autovec[NAUTOVECTORS];
 #ifdef __HAVE_M68K_INTR_VECTORED
@@ -215,6 +215,16 @@ m68k_intrvec_remove(struct m68k_intrhand
 	*slot = NULL;
 }
 
+/* XXX This is horrible and should burn to the ground. */
+void *
+m68k_intrvec_intrhand(int vec)
+{
+	KASSERT(vec >= MACHINE_USERVEC_START);
+	KASSERT(vec < NVECTORS);
+
+	return m68k_intrhands_vectored[vec - MACHINE_USERVEC_START];
+}
+
 #endif /* __HAVE_M68K_INTR_VECTORED */
 
 /*

Index: src/sys/arch/m68k/m68k/m68k_intr_stubs.s
diff -u src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.1 src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.2
--- src/sys/arch/m68k/m68k/m68k_intr_stubs.s:1.1	Sun Jan 14 22:32:32 2024
+++ src/sys/arch/m68k/m68k/m68k_intr_stubs.s	Tue Jan 16 01:16:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr_stubs.s,v 1.1 2024/01/14 22:32:32 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr_stubs.s,v 1.2 2024/01/16 01:16:46 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -50,6 +50,13 @@
 #endif
 
 /*
+ * XXX Some platforms (e.g. news68k) have hardware-assisted ASTs, and
+ * XXX thus don't need to branch to rei() after an interrupt.  Figure
+ * XXX out a way to handle these platforms.  This works for now; the
+ * XXX hardware-assist is just an optimization.
+ */
+
+/*
  * Vector stub for auto-vectored interrupts.  Calls the dispatch
  * routine with the frame BY VALUE (saves a few instructions).
  */



CVS commit: src/sys/arch/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 01:16:47 UTC 2024

Modified Files:
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c m68k_intr_stubs.s

Log Message:
- Declare idepth as volatile.
- Provide a m68k_intrvec_intrhand() routine that returns the interrupt
  handle for a given vectored interrupt.  XXX This is gross and should
  burn to the ground, but is needed to support legacy ISR interfaces.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/m68k_intr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/m68k_intr_stubs.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 19:27:16 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Insert a spurious interrupt handler at auto-vector IPL 0 that simply
abosrbs them.  They'll get counted during the normal course of auto-vector
interrupt handling.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/m68k/m68k_intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 19:27:16 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Insert a spurious interrupt handler at auto-vector IPL 0 that simply
abosrbs them.  They'll get counted during the normal course of auto-vector
interrupt handling.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/m68k/m68k_intr.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/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.6 src/sys/arch/m68k/m68k/m68k_intr.c:1.7
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.6	Mon Jan 15 18:47:03 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Mon Jan 15 19:27:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.6 2024/01/15 18:47:03 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.7 2024/01/15 19:27:16 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.6 2024/01/15 18:47:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.7 2024/01/15 19:27:16 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -110,6 +110,24 @@ const uint16_t ipl2psl_table[NIPL] = {
 	[IPL_HIGH]	 = PSL_S | PSL_IPL7,
 };
 
+/*
+ * m68k_spurintr --
+ *	Interrupt handler for the "spurious interrupt" that comes in
+ *	on auto-vector level 0.  All we do is claim it; it gets counted
+ *	during the normal course of auto-vector interrupt handling.
+ */
+static int
+m68k_spurintr(void *arg)
+{
+	return 1;
+}
+
+static struct m68k_intrhand m68k_spurintr_ih = {
+	.ih_func  = m68k_spurintr,
+	.ih_arg   = m68k_spurintr,
+	.ih_evcnt = ,
+};
+
 static struct m68k_intrhand *
 m68k_ih_stdalloc(int km_flag)
 {
@@ -140,7 +158,9 @@ static void
 m68k_ih_free(struct m68k_intrhand *ih)
 {
 	KASSERT(ih_allocfuncs != NULL);
-	ih_allocfuncs->free(ih);
+	if (__predict_true(ih != _spurintr_ih)) {
+		ih_allocfuncs->free(ih);
+	}
 }
 
 #ifdef __HAVE_M68K_INTR_VECTORED
@@ -219,6 +239,8 @@ m68k_intr_init(const struct m68k_ih_allo
 		evcnt_attach_static(_intr_evcnt[i]);
 #endif
 	}
+	LIST_INSERT_HEAD(_intrhands_autovec[0],
+	_spurintr_ih, ih_link);
 }
 
 /*



CVS commit: src/sys/arch/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 17:12:00 UTC 2024

Modified Files:
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Use evcnt to count interrupts for the non-__HAVE_LEGACY_INTRCNT case.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/m68k/m68k_intr.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/m68k/include/intr.h
diff -u src/sys/arch/m68k/include/intr.h:1.2 src/sys/arch/m68k/include/intr.h:1.3
--- src/sys/arch/m68k/include/intr.h:1.2	Mon Jan 15 02:13:16 2024
+++ src/sys/arch/m68k/include/intr.h	Mon Jan 15 17:12:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.2 2024/01/15 02:13:16 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.3 2024/01/15 17:12:00 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023, 2024 The NetBSD Foundation, Inc.
@@ -132,7 +132,15 @@ struct m68k_ih_allocfuncs {
 struct m68k_ih_allocfuncs;
 #endif /* _M68K_INTR_PRIVATE */
 
-struct evcnt;
+#include 
+
+#ifndef __HAVE_LEGACY_INTRCNT
+/*
+ * This is exposed here so that platform-specific interrupt handlers
+ * can access it.
+ */
+extern struct evcnt m68k_intr_evcnt[];
+#endif
 
 /*
  * Common m68k interrupt dispatch:

Index: src/sys/arch/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.4 src/sys/arch/m68k/m68k/m68k_intr.c:1.5
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.4	Mon Jan 15 02:13:16 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Mon Jan 15 17:12:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.4 2024/01/15 02:13:16 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.5 2024/01/15 17:12:00 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.4 2024/01/15 02:13:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.5 2024/01/15 17:12:00 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -70,10 +70,6 @@ extern char intrstub_vectored[];
 /* A dummy event counter where interrupt stats go to die. */
 static struct evcnt bitbucket;
 
-#ifdef __HAVE_LEGACY_INTRCNT
-extern u_int intrcnt[];		/* XXX old-style statistics */
-#endif
-
 int idepth;
 
 static struct m68k_intrhand_list m68k_intrhands_autovec[NAUTOVECTORS];
@@ -81,6 +77,33 @@ static struct m68k_intrhand_list m68k_in
 static struct m68k_intrhand *m68k_intrhands_vectored[NVECHANDS];
 #endif
 
+#ifdef __HAVE_LEGACY_INTRCNT
+extern u_int intrcnt[];
+#define	INTRCNT(x)	intrcnt[(x)]++
+#else
+#ifndef MACHINE_INTREVCNT_NAMES
+#define	MACHINE_INTREVCNT_NAMES		\
+	{ "spur", "lev1", "lev2", "lev3", "lev4", "lev5", "lev6", "nmi" }
+#endif
+static const char * const m68k_intr_evcnt_names[] = MACHINE_INTREVCNT_NAMES;
+__CTASSERT(__arraycount(m68k_intr_evcnt_names) == NAUTOVECTORS);
+static const char m68k_intr_evcnt_group[] = "cpu";
+
+#define	INTRCNT_INIT(x)			\
+	EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, m68k_intr_evcnt_group,	\
+			  m68k_intr_evcnt_names[(x)])
+
+struct evcnt m68k_intr_evcnt[] = {
+	INTRCNT_INIT(0), INTRCNT_INIT(1), INTRCNT_INIT(2), INTRCNT_INIT(3),
+	INTRCNT_INIT(4), INTRCNT_INIT(5), INTRCNT_INIT(6), INTRCNT_INIT(7),
+};
+__CTASSERT(__arraycount(m68k_intr_evcnt) == NAUTOVECTORS);
+
+#undef INTRCNT_INIT
+
+#define	INTRCNT(x)	m68k_intr_evcnt[(x)].ev_count++
+#endif /* __HAVE_LEGACY_INTRCNT */
+
 const uint16_t ipl2psl_table[NIPL] = {
 	[IPL_NONE]	 = PSL_S | PSL_IPL0,
 	[IPL_SOFTBIO]	 = PSL_S | MACHINE_PSL_IPL_SOFTBIO,
@@ -197,13 +220,15 @@ m68k_intr_init(const struct m68k_ih_allo
 
 	for (i = 0; i < NAUTOVECTORS; i++) {
 		LIST_INIT(_intrhands_autovec[i]);
+#ifndef __HAVE_LEGACY_INTRCNT
+		evcnt_attach_static(_intr_evcnt[i]);
+#endif
 	}
 }
 
 /*
  * m68k_intr_establish --
  *	Establish an interrupt handler at the specified vector.
- *	XXX We don't do anything with isrpri yet.
  *	XXX We don't do anything with the flags yet.
  */
 void *
@@ -339,9 +364,7 @@ m68k_intr_autovec(struct clockframe fram
 
 	idepth++;
 
-#ifdef __HAVE_LEGACY_INTRCNT
-	intrcnt[ipl]++;		/* XXX */
-#endif
+	INTRCNT(ipl);
 	curcpu()->ci_data.cpu_nintr++;
 
 	LIST_FOREACH(ih, _intrhands_autovec[ipl], ih_link) {
@@ -377,9 +400,7 @@ m68k_intr_vectored(struct clockframe fra
 
 	idepth++;
 
-#ifdef __HAVE_LEGACY_INTRCNT
-	intrcnt[ipl]++;		/* XXX */
-#endif
+	INTRCNT(ipl);
 	curcpu()->ci_data.cpu_nintr++;
 
 #ifdef DIAGNOSTIC
@@ -394,7 +415,10 @@ m68k_intr_vectored(struct clockframe fra
 		vec_set_entry(vec, INTR_FREEVEC);
 	}
 
-	if ((*ih->ih_func)(ih->ih_arg ? ih->ih_arg : ) == 0) {
+	if (__predict_true((*ih->ih_func)(ih->ih_arg ? ih->ih_arg
+		 : ) != 0)) {
+		ih->ih_evcnt->ev_count++;
+	} else {
 		printf("Spurious interrupt on vector=0x%0x IPL %d\n",
 		vec, ipl);
 	}



CVS commit: src/sys/arch/m68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 17:12:00 UTC 2024

Modified Files:
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Use evcnt to count interrupts for the non-__HAVE_LEGACY_INTRCNT case.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/m68k/m68k_intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 02:13:16 UTC 2024

Modified Files:
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Add the "ISR priority" notion that's used on some m68k platforms:

   /*
* Some devices are particularly sensitive to interrupt
* handling latency.  Unbuffered serial ports, for example,
* can lose data if their interrupts aren't handled with
* reasonable speed.  For this reason, we sort interrupt
* handlers by an abstract "ISR" priority, inserting higher-
* priority interrupts before lower-priority interrupts.
*/

(...within the same shared auto-vectored interrupt list.)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/m68k_intr.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/m68k/include/intr.h
diff -u src/sys/arch/m68k/include/intr.h:1.1 src/sys/arch/m68k/include/intr.h:1.2
--- src/sys/arch/m68k/include/intr.h:1.1	Sun Jan 14 22:32:32 2024
+++ src/sys/arch/m68k/include/intr.h	Mon Jan 15 02:13:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.1 2024/01/14 22:32:32 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.2 2024/01/15 02:13:16 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023, 2024 The NetBSD Foundation, Inc.
@@ -49,6 +49,18 @@
 #define	IPL_HIGH	7	/* blocks all interrupts */
 #define	NIPL		8
 
+/*
+ * Abstract ISR priorities.  These allow sorting of latency-sensitive
+ * devices earlier on the shared auto-vectored interrupt lists.
+ */
+#define	ISRPRI_BIO		0	/* a block I/O device */
+#define	ISRPRI_MISC		0	/* misc. devices */
+#define	ISRPRI_NET		1	/* a network interface */
+#define	ISRPRI_TTY		2	/* a serial port */
+#define	ISRPRI_DISPLAY		2	/* display devices / framebuffers */
+#define	ISRPRI_TTYNOBUF		3	/* a particularly bad serial port */
+#define	ISRPRI_AUDIO		4	/* audio devices */
+
 #if defined(_KERNEL) || defined(_KMEMUSER)
 typedef struct {
 	uint16_t _psl;		/* physical manifestation of logical IPL_* */
@@ -108,6 +120,7 @@ struct m68k_intrhand {
 	struct evcnt			*ih_evcnt;
 	intih_ipl;	/* m68k IPL, not IPL_* */
 	intih_vec;
+	intih_isrpri;
 };
 LIST_HEAD(m68k_intrhand_list, m68k_intrhand);
 

Index: src/sys/arch/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.3 src/sys/arch/m68k/m68k/m68k_intr.c:1.4
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.3	Mon Jan 15 00:37:08 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Mon Jan 15 02:13:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.3 2024/01/15 00:37:08 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.4 2024/01/15 02:13:16 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.3 2024/01/15 00:37:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.4 2024/01/15 02:13:16 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -208,7 +208,7 @@ m68k_intr_init(const struct m68k_ih_allo
  */
 void *
 m68k_intr_establish(int (*func)(void *), void *arg, struct evcnt *ev,
-int vec, int ipl, int isrpri __unused, int flags __unused)
+int vec, int ipl, int isrpri, int flags __unused)
 {
 	struct m68k_intrhand *ih;
 	int s;
@@ -242,6 +242,7 @@ m68k_intr_establish(int (*func)(void *),
 	ih->ih_arg = arg;
 	ih->ih_vec = vec;
 	ih->ih_ipl = ipl;
+	ih->ih_isrpri = isrpri;
 	if ((ih->ih_evcnt = ev) == NULL) {
 		ih->ih_evcnt = 
 	}
@@ -260,8 +261,32 @@ m68k_intr_establish(int (*func)(void *),
 	}
 #endif
 
+	/*
+	 * Some devices are particularly sensitive to interrupt
+	 * handling latency.  Unbuffered serial ports, for example,
+	 * can lose data if their interrupts aren't handled with
+	 * reasonable speed.  For this reason, we sort interrupt
+	 * handlers by an abstract "ISR" priority, inserting higher-
+	 * priority interrupts before lower-priority interrupts.
+	 */
+	struct m68k_intrhand_list * const list = _intrhands_autovec[ipl];
+	struct m68k_intrhand *curih;
+
 	s = splhigh();
-	LIST_INSERT_HEAD(_intrhands_autovec[ipl], ih, ih_link);
+	if (LIST_EMPTY(list)) {
+		LIST_INSERT_HEAD(list, ih, ih_link);
+		goto done;
+	}
+	for (curih = LIST_FIRST(list);
+	 LIST_NEXT(curih, ih_link) != NULL;
+	 curih = LIST_NEXT(curih, ih_link)) {
+		if (ih->ih_isrpri > curih->ih_isrpri) {
+			LIST_INSERT_BEFORE(curih, ih, ih_link);
+			goto done;
+		}
+	}
+	LIST_INSERT_AFTER(curih, ih, ih_link);
+ done:
 	splx(s);
 
 	return ih;



CVS commit: src/sys/arch/m68k

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 02:13:16 UTC 2024

Modified Files:
src/sys/arch/m68k/include: intr.h
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Add the "ISR priority" notion that's used on some m68k platforms:

   /*
* Some devices are particularly sensitive to interrupt
* handling latency.  Unbuffered serial ports, for example,
* can lose data if their interrupts aren't handled with
* reasonable speed.  For this reason, we sort interrupt
* handlers by an abstract "ISR" priority, inserting higher-
* priority interrupts before lower-priority interrupts.
*/

(...within the same shared auto-vectored interrupt list.)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/include/intr.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/m68k_intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 00:37:08 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Wrap references to intrcnt[] in __HAVE_LEGACY_INTRCNT.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/m68k_intr.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/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.2 src/sys/arch/m68k/m68k/m68k_intr.c:1.3
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.2	Mon Jan 15 00:25:15 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Mon Jan 15 00:37:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.2 2024/01/15 00:25:15 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.3 2024/01/15 00:37:08 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.2 2024/01/15 00:25:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.3 2024/01/15 00:37:08 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -70,7 +70,9 @@ extern char intrstub_vectored[];
 /* A dummy event counter where interrupt stats go to die. */
 static struct evcnt bitbucket;
 
+#ifdef __HAVE_LEGACY_INTRCNT
 extern u_int intrcnt[];		/* XXX old-style statistics */
+#endif
 
 int idepth;
 
@@ -312,7 +314,9 @@ m68k_intr_autovec(struct clockframe fram
 
 	idepth++;
 
+#ifdef __HAVE_LEGACY_INTRCNT
 	intrcnt[ipl]++;		/* XXX */
+#endif
 	curcpu()->ci_data.cpu_nintr++;
 
 	LIST_FOREACH(ih, _intrhands_autovec[ipl], ih_link) {
@@ -348,7 +352,9 @@ m68k_intr_vectored(struct clockframe fra
 
 	idepth++;
 
+#ifdef __HAVE_LEGACY_INTRCNT
 	intrcnt[ipl]++;		/* XXX */
+#endif
 	curcpu()->ci_data.cpu_nintr++;
 
 #ifdef DIAGNOSTIC



CVS commit: src/sys/arch/m68k/m68k

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 00:37:08 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Wrap references to intrcnt[] in __HAVE_LEGACY_INTRCNT.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/m68k_intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 00:25:16 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Declare intrcnt as a u_int array, and add a missing m68k_ih_free() call
in m68k_intr_disestablish().


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/m68k_intr.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/m68k/m68k/m68k_intr.c
diff -u src/sys/arch/m68k/m68k/m68k_intr.c:1.1 src/sys/arch/m68k/m68k/m68k_intr.c:1.2
--- src/sys/arch/m68k/m68k/m68k_intr.c:1.1	Sun Jan 14 22:32:32 2024
+++ src/sys/arch/m68k/m68k/m68k_intr.c	Mon Jan 15 00:25:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_intr.c,v 1.1 2024/01/14 22:32:32 thorpej Exp $	*/
+/*	$NetBSD: m68k_intr.c,v 1.2 2024/01/15 00:25:15 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023, 2024 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.1 2024/01/14 22:32:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_intr.c,v 1.2 2024/01/15 00:25:15 thorpej Exp $");
 
 #define	_M68K_INTR_PRIVATE
 
@@ -70,7 +70,7 @@ extern char intrstub_vectored[];
 /* A dummy event counter where interrupt stats go to die. */
 static struct evcnt bitbucket;
 
-extern int intrcnt[];		/* XXX old-style statistics */
+extern u_int intrcnt[];		/* XXX old-style statistics */
 
 int idepth;
 
@@ -291,6 +291,8 @@ m68k_intr_disestablish(void *v)
 		splx(s);
 	}
 
+	m68k_ih_free(ih);
+
 	return empty;
 }
 



CVS commit: src/sys/arch/m68k/m68k

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 00:25:16 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: m68k_intr.c

Log Message:
Declare intrcnt as a u_int array, and add a missing m68k_ih_free() call
in m68k_intr_disestablish().


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/m68k_intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 22:06:03 UTC 2024

Modified Files:
src/sys/arch/m68k/include: psl.h

Log Message:
Provide a _splx() inline.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/m68k/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 22:06:03 UTC 2024

Modified Files:
src/sys/arch/m68k/include: psl.h

Log Message:
Provide a _splx() inline.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/m68k/include/psl.h

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/m68k/include/psl.h
diff -u src/sys/arch/m68k/include/psl.h:1.17 src/sys/arch/m68k/include/psl.h:1.18
--- src/sys/arch/m68k/include/psl.h:1.17	Fri Jan 12 23:36:29 2024
+++ src/sys/arch/m68k/include/psl.h	Sun Jan 14 22:06:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.17 2024/01/12 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: psl.h,v 1.18 2024/01/14 22:06:03 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -85,7 +85,7 @@ getsr(void)
 	return sr;
 }
 
-static __inline int
+static inline int
 _spl(int s)
 {
 	int sr;
@@ -96,7 +96,13 @@ _spl(int s)
 	return sr;
 }
 
-static __inline int
+static inline void
+_splx(int s)
+{
+	__asm volatile("movew %0,%%sr" : : "di" (s) : "memory");
+}
+
+static inline int
 _splraise(int level)
 {
 	int sr;



CVS commit: src/sys/arch/m68k/include

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:00:15 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h

Log Message:
Provide NAUTOVECTORS and NUSERVECTORS constants.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/include/vectors.h

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/m68k/include/vectors.h
diff -u src/sys/arch/m68k/include/vectors.h:1.3 src/sys/arch/m68k/include/vectors.h:1.4
--- src/sys/arch/m68k/include/vectors.h:1.3	Sat Jan 13 20:10:36 2024
+++ src/sys/arch/m68k/include/vectors.h	Sun Jan 14 00:00:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.3 2024/01/13 20:10:36 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.4 2024/01/14 00:00:15 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -115,6 +115,8 @@
 #define	VECI_USRVEC_START	64	/* User defined vectors (192) */
 
 #define	NVECTORS		256
+#define	NAUTOVECTORS		8
+#define	NUSERVECTORS		(NVECTORS - VECI_USRVEC_START)
 
 #define	VECI_INTRAV(ipl)	((ipl) + VECI_SPURIOUS_INTR)
 #define	VECI_TRAP(x)		((x) + VECI_TRAP0)



CVS commit: src/sys/arch/m68k/include

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:00:15 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h

Log Message:
Provide NAUTOVECTORS and NUSERVECTORS constants.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/include/vectors.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 20:10:36 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Expose saved_vbr directly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/vectors.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/m68k/include/vectors.h
diff -u src/sys/arch/m68k/include/vectors.h:1.2 src/sys/arch/m68k/include/vectors.h:1.3
--- src/sys/arch/m68k/include/vectors.h:1.2	Sat Jan 13 18:42:11 2024
+++ src/sys/arch/m68k/include/vectors.h	Sat Jan 13 20:10:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.2 2024/01/13 18:42:11 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.3 2024/01/13 20:10:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -125,6 +125,7 @@
 #ifdef _KERNEL
 
 extern void *vectab[NVECTORS];
+extern void **saved_vbr;
 
 void	vec_init(void);
 void	vec_reset(void);

Index: src/sys/arch/m68k/m68k/vectors.c
diff -u src/sys/arch/m68k/m68k/vectors.c:1.2 src/sys/arch/m68k/m68k/vectors.c:1.3
--- src/sys/arch/m68k/m68k/vectors.c:1.2	Sat Jan 13 18:42:11 2024
+++ src/sys/arch/m68k/m68k/vectors.c	Sat Jan 13 20:10:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.c,v 1.2 2024/01/13 18:42:11 thorpej Exp $	*/
+/*	$NetBSD: vectors.c,v 1.3 2024/01/13 20:10:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -516,7 +516,7 @@ void *vectab[NVECTORS] = {
 	[VECI_USRVEC_START+191]	=	badtrap,
 };
 
-static void **saved_vbr;
+void **saved_vbr;
 
 /*
  * vec_init --



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 20:10:36 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Expose saved_vbr directly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/vectors.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:42:11 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Provide some vector table override hooks and interfaces needed by the
sun68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/vectors.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/m68k/include/vectors.h
diff -u src/sys/arch/m68k/include/vectors.h:1.1 src/sys/arch/m68k/include/vectors.h:1.2
--- src/sys/arch/m68k/include/vectors.h:1.1	Sat Jan 13 17:10:03 2024
+++ src/sys/arch/m68k/include/vectors.h	Sat Jan 13 18:42:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.1 2024/01/13 17:10:03 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.2 2024/01/13 18:42:11 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -71,7 +71,8 @@
 #define	VECI_rsvd21		21	/* unassigned, reserved */
 #define	VECI_rsvd22		22	/* unassigned, reserved */
 #define	VECI_rsvd23		23	/* unassigned, reserved */
-#define	VECI_SPURIOUS_INTR	24	/* Spurious Interrupt */
+#define	VECI_INTRAV0		24	/* Spurious Interrupt */
+#define	VECI_SPURIOUS_INTR	VECI_INTRAV0
 #define	VECI_INTRAV1		25	/* Level 1 Interrupt Autovector */
 #define	VECI_INTRAV2		26	/* Level 2 Interrupt Autovector */
 #define	VECI_INTRAV3		27	/* Level 3 Interrupt Autovector */
@@ -118,8 +119,8 @@
 #define	VECI_INTRAV(ipl)	((ipl) + VECI_SPURIOUS_INTR)
 #define	VECI_TRAP(x)		((x) + VECI_TRAP0)
 
-#define	VECI_TO_VEC(x)		((x) << 2)
-#define	VEC_TO_VECI(x)		((unsigned int)(x) >> 2)
+#define	VECI_TO_VECO(x)		((x) << 2)
+#define	VECO_TO_VECI(x)		((unsigned int)(x) >> 2)
 
 #ifdef _KERNEL
 
@@ -127,6 +128,8 @@ extern void *vectab[NVECTORS];
 
 void	vec_init(void);
 void	vec_reset(void);
+void	*vec_get_entry(int);
+void	vec_set_entry(int, void *);
 
 #endif /* _KERNEL */
 

Index: src/sys/arch/m68k/m68k/vectors.c
diff -u src/sys/arch/m68k/m68k/vectors.c:1.1 src/sys/arch/m68k/m68k/vectors.c:1.2
--- src/sys/arch/m68k/m68k/vectors.c:1.1	Sat Jan 13 17:10:03 2024
+++ src/sys/arch/m68k/m68k/vectors.c	Sat Jan 13 18:42:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.c,v 1.1 2024/01/13 17:10:03 thorpej Exp $	*/
+/*	$NetBSD: vectors.c,v 1.2 2024/01/13 18:42:11 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -29,6 +29,11 @@
  * POSSIBILITY OF SUCH DAMAGE.  
  */
 
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_compat_sunos.h"
+#endif 
+
 #include 
 
 #include 
@@ -48,12 +53,12 @@ extern char badtrap[];
 extern char coperr[];
 extern char fmterr[];
 extern char trap0[];
-#ifdef COMPAT_13
+#if defined(COMPAT_13) || defined(COMPAT_SUNOS)
 extern char trap1[];
 #define	TRAP1_HANDLER		trap1
 #else
 #define	TRAP1_HANDLER		illinst
-#endif /* COMPAT_13 */
+#endif /* COMPAT_13 || COMPAT_SUNOS */
 extern char trap2[];
 #ifdef COMPAT_16
 extern char trap3[];
@@ -75,15 +80,39 @@ extern char MACHINE_AV5_HANDLER[];
 extern char MACHINE_AV6_HANDLER[];
 extern char MACHINE_AV7_HANDLER[];
 
-#ifndef __mc68010__
+#ifdef MACHINE_BUSERR_HANDLER
+extern char MACHINE_BUSERR_HANDLER[];
+#endif
+
+#ifdef MACHINE_ADDRERR_HANDLER
+extern char MACHINE_ADDRERR_HANDLER[];
+#endif
+
+#ifdef __mc68010__
+
+#define	BUSERR_HANDLER		MACHINE_BUSERR_HANDLER
+#define	ADDRERR_HANDLER		MACHINE_ADDRERR_HANDLER
+
+#else
 
 #if defined(M68020) || defined(M68030)
-extern char busaddrerr2030[];
+#ifdef MACHINE_BUSERR_HANDLER
+#define	BUSERR_HANDLER2030	MACHINE_BUSERR_HANDLER
+#else
+extern char buserr2030[];
+#define	BUSERR_HANDLER2030	buserr2030
+#endif
+#ifdef MACHINE_ADDRERR_HANDLER
+#define	ADDRERR_HANDLER2030	MACHINE_ADDRERR_HANDLER
+#else
+extern char addrerr2030[];
+#define	ADDRERR_HANDLER2030	addrerr2030
+#endif
 #if defined(M68040) || defined(M68060)
 #define	NEED_FIXUP_2030
 #else
-#define	BUSERR_HANDLER		busaddrerr2030
-#define	ADDRERR_HANDLER		busaddrerr2030
+#define	BUSERR_HANDLER		BUSERR_HANDLER2030
+#define	ADDRERR_HANDLER		ADDRERR_HANDLER2030
 #endif
 #endif /* M68020 || M68030 */
 
@@ -168,6 +197,14 @@ extern char FP_CALL_TOP[], I_CALL_TOP[];
 
 #endif /* __mc68010__ */
 
+#ifndef MACHINE_RESET_SP
+#define	MACHINE_RESET_SP	NULL
+#endif
+
+#ifndef MACHINE_RESET_PC
+#define	MACHINE_RESET_PC	NULL
+#endif
+
 #ifndef BUSERR_HANDLER
 #define	BUSERR_HANDLER		badtrap
 #endif
@@ -221,6 +258,8 @@ extern char FP_CALL_TOP[], I_CALL_TOP[];
 #endif
 
 void *vectab[NVECTORS] = {
+	[VECI_RIISP]		=	MACHINE_RESET_SP,
+	[VECI_RIPC]		=	MACHINE_RESET_PC,
 	[VECI_BUSERR]		=	BUSERR_HANDLER,
 	[VECI_ADDRERR]		=	ADDRERR_HANDLER,
 	[VECI_ILLINST]		=	illinst,
@@ -243,7 +282,7 @@ void *vectab[NVECTORS] = {
 	[VECI_rsvd21]		=	badtrap,
 	[VECI_rsvd22]		=	badtrap,
 	[VECI_rsvd23]		=	badtrap,
-	[VECI_SPURIOUS_INTR]	=	MACHINE_AV0_HANDLER,
+	[VECI_INTRAV0]		=	MACHINE_AV0_HANDLER,
 	

CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:42:11 UTC 2024

Modified Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Provide some vector table override hooks and interfaces needed by the
sun68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/vectors.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:40:12 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: busaddrerr.s

Log Message:
Add buserr2030 and addrerr2030 aliases to busaddrerr2030.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/busaddrerr.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/m68k/m68k/busaddrerr.s
diff -u src/sys/arch/m68k/m68k/busaddrerr.s:1.2 src/sys/arch/m68k/m68k/busaddrerr.s:1.3
--- src/sys/arch/m68k/m68k/busaddrerr.s:1.2	Sat Apr 29 03:17:30 2023
+++ src/sys/arch/m68k/m68k/busaddrerr.s	Sat Jan 13 18:40:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: busaddrerr.s,v 1.2 2023/04/29 03:17:30 isaki Exp $	*/
+/*	$NetBSD: busaddrerr.s,v 1.3 2024/01/13 18:40:12 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -159,6 +159,8 @@ Lberr40:
  */
 #if defined(M68020) || defined(M68030)
 ENTRY_NOPROFILE(busaddrerr2030)
+GLOBAL(buserr2030)
+GLOBAL(addrerr2030)
 	clrl	%sp@-			| stack adjust count
 	moveml	%d0-%d7/%a0-%a7,%sp@-	| save user registers
 	movl	%usp,%a0		| save the user SP



CVS commit: src/sys/arch/m68k/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 18:40:12 UTC 2024

Modified Files:
src/sys/arch/m68k/m68k: busaddrerr.s

Log Message:
Add buserr2030 and addrerr2030 aliases to busaddrerr2030.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/busaddrerr.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:10:03 UTC 2024

Added Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Add a common vector table implementation for m68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/m68k/vectors.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:10:03 UTC 2024

Added Files:
src/sys/arch/m68k/include: vectors.h
src/sys/arch/m68k/m68k: vectors.c

Log Message:
Add a common vector table implementation for m68k platforms.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/include/vectors.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/m68k/vectors.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/m68k/include/vectors.h
diff -u /dev/null src/sys/arch/m68k/include/vectors.h:1.1
--- /dev/null	Sat Jan 13 17:10:03 2024
+++ src/sys/arch/m68k/include/vectors.h	Sat Jan 13 17:10:03 2024
@@ -0,0 +1,133 @@
+/*	$NetBSD: vectors.h,v 1.1 2024/01/13 17:10:03 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _M68K_VECTORS_H_
+#define	_M68K_VECTORS_H_
+
+/*
+ * Vector numbers (*4 for byte offset into table).
+ *
+ * VECI_RIISP and VECI_RIPC are fetched using Supervisor Program
+ * space.  The rest, Supervisor Data space.
+ *
+ * VECI_PMMU_ILLOP and VECI_PMMU_ACCESS are defined for the 68020, but
+ * not used on the 68030.
+ *
+ * VECI_CPV and VECI_PMMU_CONF are defined for the 68020 and 68030, but
+ * not used on the 68040 or 68060.
+ *
+ * VECI_UNIMP_FP_DATA, VECI_UNIMP_EA and VECI_UNIMP_II are defined for
+ * the 68060 and reserved on all other processors.
+ */
+#define	VECI_RIISP		0	/* Reset Initial Interrupt SP */
+#define	VECI_RIPC		1	/* Reset Initial PC */
+#define	VECI_BUSERR		2	/* Bus Error */
+#define	VECI_ADDRERR		3	/* Address Error */
+#define	VECI_ILLINST		4	/* Illegal Instruction */
+#define	VECI_ZERODIV		5	/* Zero Divide */
+#define	VECI_CHK		6	/* CHK, CHK2 instruction */
+#define	VECI_TRAPcc		7	/* cpTRAPcc, TRAPcc, TRAPV */
+#define	VECI_PRIV		8	/* Privilege Violation */
+#define	VECI_TRACE		9	/* Trace */
+#define	VECI_LINE1010		10	/* Line 1010 Emulator */
+#define	VECI_LINE		11	/* Line  Emulator */
+#define	VECI_rsvd12		12	/* unassigned, reserved */
+#define	VECI_CPV		13	/* Coprocessor Prototol Violation */
+#define	VECI_FORMATERR		14	/* Format Error */
+#define	VECI_UNINT_INTR		15	/* Uninitialized Interrupt */
+#define	VECI_rsvd16		16	/* unassigned, reserved */
+#define	VECI_rsvd17		17	/* unassigned, reserved */
+#define	VECI_rsvd18		18	/* unassigned, reserved */
+#define	VECI_rsvd19		19	/* unassigned, reserved */
+#define	VECI_rsvd20		20	/* unassigned, reserved */
+#define	VECI_rsvd21		21	/* unassigned, reserved */
+#define	VECI_rsvd22		22	/* unassigned, reserved */
+#define	VECI_rsvd23		23	/* unassigned, reserved */
+#define	VECI_SPURIOUS_INTR	24	/* Spurious Interrupt */
+#define	VECI_INTRAV1		25	/* Level 1 Interrupt Autovector */
+#define	VECI_INTRAV2		26	/* Level 2 Interrupt Autovector */
+#define	VECI_INTRAV3		27	/* Level 3 Interrupt Autovector */
+#define	VECI_INTRAV4		28	/* Level 4 Interrupt Autovector */
+#define	VECI_INTRAV5		29	/* Level 5 Interrupt Autovector */
+#define	VECI_INTRAV6		30	/* Level 6 Interrupt Autovector */
+#define	VECI_INTRAV7		31	/* Level 7 Interrupt Autovector */
+#define	VECI_TRAP0		32	/* Trap #0 instruction */
+#define	VECI_TRAP1		33	/* Trap #1 instruction */
+#define	VECI_TRAP2		34	/* Trap #2 instruction */
+#define	VECI_TRAP3		35	/* Trap #3 instruction */
+#define	VECI_TRAP4		36	/* Trap #4 instruction */
+#define	VECI_TRAP5		37	/* Trap #5 instruction */
+#define	VECI_TRAP6		38	/* Trap #6 instruction */
+#define	VECI_TRAP7		39	/* Trap 

CVS commit: src/sys/arch/m68k/include

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:07:26 UTC 2024

Modified Files:
src/sys/arch/m68k/include: frame.h

Log Message:
G/C some unused definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/frame.h

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/m68k/include/frame.h
diff -u src/sys/arch/m68k/include/frame.h:1.34 src/sys/arch/m68k/include/frame.h:1.35
--- src/sys/arch/m68k/include/frame.h:1.34	Fri Jan 12 23:46:52 2024
+++ src/sys/arch/m68k/include/frame.h	Sat Jan 13 17:07:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.34 2024/01/12 23:46:52 thorpej Exp $	*/
+/*	$NetBSD: frame.h,v 1.35 2024/01/13 17:07:26 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -70,10 +70,6 @@
 #define	FMTASIZE	sizeof(struct fmtA)
 #define	FMTBSIZE	sizeof(struct fmtB)
 
-#define	V_BUSERR	0x008
-#define	V_ADDRERR	0x00C
-#define	V_TRAP1		0x084
-
 /* 68010 SSW bits */
 #define SSW1_RR		0x8000
 #define SSW1_IF		0x2000



CVS commit: src/sys/arch/m68k/include

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:07:26 UTC 2024

Modified Files:
src/sys/arch/m68k/include: frame.h

Log Message:
G/C some unused definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/frame.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2024-01-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  9 07:21:48 UTC 2024

Added Files:
src/sys/arch/m68k/m68k: mmu_subr.s

Log Message:
Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap.  Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/m68k/mmu_subr.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/m68k/m68k/mmu_subr.s
diff -u /dev/null src/sys/arch/m68k/m68k/mmu_subr.s:1.1
--- /dev/null	Tue Jan  9 07:21:48 2024
+++ src/sys/arch/m68k/m68k/mmu_subr.s	Tue Jan  9 07:21:48 2024
@@ -0,0 +1,141 @@
+/*	$NetBSD: mmu_subr.s,v 1.1 2024/01/09 07:21:48 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2023 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * Copyright (c) 1980, 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: locore.s 1.66 92/12/22$
+ *
+ *	@(#)locore.s	8.6 (Berkeley) 5/27/94
+ */
+
+/*
+ * void mmu_load_urp(paddr_t urp);
+ *
+ *	Load the user root pointer into the MMU.  A version is provided
+ *	for each supported MMU type.
+ *
+ *	We keep the HP MMU versions of these routines here, as well,
+ *	even though they'll only ever be used on the hp300.
+ */
+
+#include "opt_m68k_arch.h"
+
+#include 
+
+#include "assym.h"
+
+	.file	"mmu_subr.s"
+	.text
+
+#if defined(M68K_MMU_MOTOROLA)
+#if defined(M68020) || defined(M68030)
+	.data
+/*
+ * protorp is set up to initialize the Supervisor Root Pointer.
+ * pmap_init() will re-configure it to load the CPU Root Pointer.
+ */
+GLOBAL(protorp)
+	.long	MMU51_CRP_BITS,0	| prototype CPU root pointer
+
+	.text

CVS commit: src/sys/arch/m68k/m68k

2024-01-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  9 07:21:48 UTC 2024

Added Files:
src/sys/arch/m68k/m68k: mmu_subr.s

Log Message:
Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap.  Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/m68k/mmu_subr.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-01-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan  3 12:46:12 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h

Log Message:
G/C some bit defs that are redundant with mmu_{51,40}.h


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/m68k/include/cpu.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-01-03 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan  3 12:46:12 UTC 2024

Modified Files:
src/sys/arch/m68k/include: cpu.h

Log Message:
G/C some bit defs that are redundant with mmu_{51,40}.h


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/m68k/include/cpu.h

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/m68k/include/cpu.h
diff -u src/sys/arch/m68k/include/cpu.h:1.18 src/sys/arch/m68k/include/cpu.h:1.19
--- src/sys/arch/m68k/include/cpu.h:1.18	Wed Dec 27 17:35:35 2023
+++ src/sys/arch/m68k/include/cpu.h	Wed Jan  3 12:46:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.18 2023/12/27 17:35:35 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.19 2024/01/03 12:46:12 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -73,36 +73,6 @@
 
 #include 
 
-/* XXX - Move this stuff into  maybe? */
-
-/*
- * 68851 and 68030 MMU
- */
-#define	PMMU_LVLMASK	0x0007
-#define	PMMU_INV	0x0400
-#define	PMMU_WP		0x0800
-#define	PMMU_ALV	0x1000
-#define	PMMU_SO		0x2000
-#define	PMMU_LV		0x4000
-#define	PMMU_BE		0x8000
-#define	PMMU_FAULT	(PMMU_WP|PMMU_INV)
-
-/* XXX - Move this stuff into  maybe? */
-
-/*
- * 68040 MMU
- */
-#define	MMU40_RES	0x001
-#define	MMU40_TTR	0x002
-#define	MMU40_WP	0x004
-#define	MMU40_MOD	0x010
-#define	MMU40_CMMASK	0x060
-#define	MMU40_SUP	0x080
-#define	MMU40_U0	0x100
-#define	MMU40_U1	0x200
-#define	MMU40_GLB	0x400
-#define	MMU40_BE	0x800
-
 /* XXX - Move this stuff into  maybe? */
 
 /* fields in the 68020 cache control register */



CVS commit: src/sys/arch/m68k/include

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  1 22:47:58 UTC 2024

Modified Files:
src/sys/arch/m68k/include: pte_motorola.h

Log Message:
Define PTE used in the pmap module int terms of the bit definitions
in mmu_{51,40}.h.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/include/pte_motorola.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  1 22:47:58 UTC 2024

Modified Files:
src/sys/arch/m68k/include: pte_motorola.h

Log Message:
Define PTE used in the pmap module int terms of the bit definitions
in mmu_{51,40}.h.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/include/pte_motorola.h

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/m68k/include/pte_motorola.h
diff -u src/sys/arch/m68k/include/pte_motorola.h:1.9 src/sys/arch/m68k/include/pte_motorola.h:1.10
--- src/sys/arch/m68k/include/pte_motorola.h:1.9	Wed Dec 27 03:03:41 2023
+++ src/sys/arch/m68k/include/pte_motorola.h	Mon Jan  1 22:47:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pte_motorola.h,v 1.9 2023/12/27 03:03:41 thorpej Exp $	*/
+/*	$NetBSD: pte_motorola.h,v 1.10 2024/01/01 22:47:58 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -56,55 +56,63 @@ typedef u_int	pt_entry_t;	/* page table 
 
 #define PG_SHIFT	PGSHIFT
 
-#define	SG_V		0x0002	/* segment is valid */
-#define	SG_NV		0x
-#define	SG_PROT		0x0004	/* access protection mask */
-#define	SG_RO		0x0004
+/*
+ * "Segment" Table Entry bits, defined in terms of the 68851 bits
+ * (compatible 68040 bits noted in comments).
+ */
+#define	SG_V		DT51_SHORT	/* == UTE40_RESIDENT */
+#define	SG_NV		DT51_INVALID	/* == UTE40_INVALID */
+#define	SG_RO		DTE51_WP	/* == UTE40_W */
 #define	SG_RW		0x
-#define	SG_U		0x0008	/* modified bit (68040) */
-#define	SG_FRAME	((~0) << PG_SHIFT)
+#define	SG_PROT		DTE51_WP
+#define	SG_U		DTE51_U		/* == UTE40_U */
+#define	SG_FRAME	((~0U) << PG_SHIFT)
 #define	SG_ISHIFT	((PG_SHIFT << 1) - 2)	/* 24 or 22 */
-#define	SG_IMASK	((~0) << SG_ISHIFT)
+#define	SG_IMASK	((~0U) << SG_ISHIFT)
 #define	SG_PSHIFT	PG_SHIFT
-#define	SG_PMASK	(((~0) << SG_PSHIFT) & ~SG_IMASK)
+#define	SG_PMASK	(((~0U) << SG_PSHIFT) & ~SG_IMASK)
 
 /* 68040 additions */
-#define	SG4_MASK1	0xfe00
+#define	SG4_MASK1	0xfe00U
 #define	SG4_SHIFT1	25
-#define	SG4_MASK2	0x01fc
+#define	SG4_MASK2	0x01fcU
 #define	SG4_SHIFT2	18
-#define	SG4_MASK3	(((~0) << PG_SHIFT) & ~(SG4_MASK1 | SG4_MASK2))
+#define	SG4_MASK3	(((~0U) << PG_SHIFT) & ~(SG4_MASK1 | SG4_MASK2))
 #define	SG4_SHIFT3	PG_SHIFT
 #define	SG4_ADDR1	0xfe00
-#define	SG4_ADDR2	((~0) << (20 - PG_SHIFT))
+#define	SG4_ADDR2	((~0U) << (20 - PG_SHIFT))
 #define	SG4_LEV1SIZE	128
 #define	SG4_LEV2SIZE	128
-#define	SG4_LEV3SIZE	(1 << (SG4_SHIFT2 - PG_SHIFT))	/* 64 or 32 */
+#define	SG4_LEV3SIZE	(1U << (SG4_SHIFT2 - PG_SHIFT))	/* 64 or 32 */
 
-#define	PG_V		0x0001
-#define	PG_NV		0x
-#define	PG_PROT		0x0004
-#define	PG_U		0x0008
-#define	PG_M		0x0010
-#define	PG_W		0x0100
-#define	PG_RO		0x0004
+/*
+ * Page Table Entry bits, defined in terms of the 68851 bits
+ * (compatible 68040 bits noted in comments).
+ */
+#define	PG_V		DT51_PAGE	/* == PTE40_RESIDENT */
+#define	PG_NV		DT51_INVALID	/* == PTE40_INVALID */
+#define	PG_RO		PTE51_WP	/* == PTE40_W */
 #define	PG_RW		0x
-#define	PG_FRAME	((~0) << PG_SHIFT)
-#define	PG_CI		0x0040
-#define	PG_PFNUM(x)	(((x) & PG_FRAME) >> PG_SHIFT)
+#define	PG_PROT		PG_RO
+#define	PG_U		PTE51_U		/* == PTE40_U */
+#define	PG_M		PTE51_M		/* == PTE40_M */
+#define	PG_CI		PTE51_CI
+#define	PG_W		__BIT(8)	/* 851 unused bit XXX040 PTE40_U0 */
+#define	PG_FRAME	((~0U) << PG_SHIFT)
+#define	PG_PFNUM(x)	(((uintptr_t)(x) & PG_FRAME) >> PG_SHIFT)
 
 /* 68040 additions */
-#define	PG_CMASK	0x0060	/* cache mode mask */
-#define	PG_CWT		0x	/* writethrough caching */
-#define	PG_CCB		0x0020	/* copyback caching */
-#define	PG_CIS		0x0040	/* cache inhibited serialized */
-#define	PG_CIN		0x0060	/* cache inhibited nonserialized */
-#define	PG_SO		0x0080	/* supervisor only */
+#define	PG_CMASK	PTE40_CM	/* cache mode mask */
+#define	PG_CWT		PTE40_CM_WT	/* writethrough caching */
+#define	PG_CCB		PTE40_CM_CB	/* copyback caching */
+#define	PG_CIS		PTE40_CM_NC_SER	/* cache inhibited serialized */
+#define	PG_CIN		PTE40_CM_NC	/* cache inhibited nonserialized */
+#define	PG_SO		PTE40_S		/* supervisor only */
 
 #define M68K_STSIZE	(MAXUL2SIZE * SG4_LEV2SIZE * sizeof(st_entry_t))
 	/* user process segment table size */
-#define M68K_MAX_PTSIZE	(1 << (32 - PG_SHIFT + 2))	/* max size of UPT */
-#define M68K_MAX_KPTSIZE	(M68K_MAX_PTSIZE >> 2)	/* max memory to allocate to KPT */
+#define M68K_MAX_PTSIZE	 (1U << (32 - PG_SHIFT + 2))	/* max size of UPT */
+#define M68K_MAX_KPTSIZE (M68K_MAX_PTSIZE >> 2)	/* max memory to allocate to KPT */
 #define M68K_PTBASE	0x1000	/* UPT map base address */
 #define M68K_PTMAXSIZE	0x7000	/* UPT map maximum size */
 



CVS commit: src/sys/arch/m68k

2023-12-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec 31 21:59:24 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_motorola.h
src/sys/arch/m68k/m68k: pmap_motorola.c vm_machdep.c

Log Message:
Provide a vtophys() function like other platforms do, and implement
kvtop() (which will be g/c'd shortly) in terms of it.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/m68k/m68k/vm_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2023-12-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec 31 21:59:24 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_motorola.h
src/sys/arch/m68k/m68k: pmap_motorola.c vm_machdep.c

Log Message:
Provide a vtophys() function like other platforms do, and implement
kvtop() (which will be g/c'd shortly) in terms of it.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/m68k/m68k/vm_machdep.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/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.42 src/sys/arch/m68k/include/pmap_motorola.h:1.43
--- src/sys/arch/m68k/include/pmap_motorola.h:1.42	Wed Dec 27 03:03:41 2023
+++ src/sys/arch/m68k/include/pmap_motorola.h	Sun Dec 31 21:59:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.42 2023/12/27 03:03:41 thorpej Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.43 2023/12/31 21:59:24 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -254,4 +254,6 @@ void	_pmap_set_page_cacheable(struct pma
 void	_pmap_set_page_cacheinhibit(struct pmap *, vaddr_t);
 int	_pmap_page_is_cacheable(struct pmap *, vaddr_t);
 
+paddr_t	vtophys(vaddr_t va);
+
 #endif /* !_M68K_PMAP_MOTOROLA_H_ */

Index: src/sys/arch/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.84 src/sys/arch/m68k/m68k/pmap_motorola.c:1.85
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.84	Thu Dec 28 15:33:12 2023
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Sun Dec 31 21:59:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.84 2023/12/28 15:33:12 thorpej Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.85 2023/12/31 21:59:24 thorpej Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.84 2023/12/28 15:33:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.85 2023/12/31 21:59:24 thorpej Exp $");
 
 #include 
 #include 
@@ -1593,6 +1593,22 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
 }
 
 /*
+ * vtophys:		[ INTERFACE-ish ]
+ *
+ *	Kernel virtual to physical.  Use with caution.
+ */
+paddr_t
+vtophys(vaddr_t va)
+{
+	paddr_t pa;
+
+	if (pmap_extract(pmap_kernel(), va, ))
+		return pa;
+	KASSERT(0);
+	return (paddr_t) -1;
+}
+
+/*
  * pmap_copy:		[ INTERFACE ]
  *
  *	Copy the mapping range specified by src_addr/len

Index: src/sys/arch/m68k/m68k/vm_machdep.c
diff -u src/sys/arch/m68k/m68k/vm_machdep.c:1.41 src/sys/arch/m68k/m68k/vm_machdep.c:1.42
--- src/sys/arch/m68k/m68k/vm_machdep.c:1.41	Wed Dec 20 00:40:43 2023
+++ src/sys/arch/m68k/m68k/vm_machdep.c	Sun Dec 31 21:59:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.41 2023/12/20 00:40:43 thorpej Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.42 2023/12/31 21:59:24 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.41 2023/12/20 00:40:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.42 2023/12/31 21:59:24 thorpej Exp $");
 
 #include 
 #include 
@@ -252,11 +252,7 @@ physunaccess(void *vaddr, int size)
 int
 kvtop(void *addr)
 {
-	paddr_t pa;
-
-	if (pmap_extract(pmap_kernel(), (vaddr_t)addr, ) == false)
-		panic("kvtop: zero page frame");
-	return (int)pa;
+	return (int)vtophys((vaddr_t)addr);
 }
 
 #endif



CVS commit: src/sys/arch/m68k/m68k

2023-12-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec 28 15:33:12 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
Missed 2 68060-specific cases in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/m68k/m68k/pmap_motorola.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/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.83 src/sys/arch/m68k/m68k/pmap_motorola.c:1.84
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.83	Thu Dec 28 01:33:05 2023
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Thu Dec 28 15:33:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.83 2023/12/28 01:33:05 thorpej Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.84 2023/12/28 15:33:12 thorpej Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.83 2023/12/28 01:33:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.84 2023/12/28 15:33:12 thorpej Exp $");
 
 #include 
 #include 
@@ -580,13 +580,15 @@ pmap_init(void)
 		paddr_t paddr;
 
 		while (kptp) {
-			pmap_changebit(kptp->kpt_pa, PG_CI, ~PG_CCB);
+			pmap_changebit(kptp->kpt_pa, PG_CI,
+   (pt_entry_t)~PG_CCB);
 			kptp = kptp->kpt_next;
 		}
 
 		paddr = (paddr_t)Segtabzeropa;
 		while (paddr < (paddr_t)Segtabzeropa + M68K_STSIZE) {
-			pmap_changebit(paddr, PG_CI, ~PG_CCB);
+			pmap_changebit(paddr, PG_CI,
+   (pt_entry_t)~PG_CCB);
 			paddr += PAGE_SIZE;
 		}
 



CVS commit: src/sys/arch/m68k/m68k

2023-12-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec 28 15:33:12 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
Missed 2 68060-specific cases in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/m68k/m68k/pmap_motorola.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2023-12-27 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec 28 01:33:06 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
Be more careful with the types used for PTEs.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/m68k/m68k/pmap_motorola.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/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.82 src/sys/arch/m68k/m68k/pmap_motorola.c:1.83
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.82	Tue Dec 26 17:48:38 2023
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Thu Dec 28 01:33:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.82 2023/12/26 17:48:38 thorpej Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.83 2023/12/28 01:33:05 thorpej Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.82 2023/12/26 17:48:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.83 2023/12/28 01:33:05 thorpej Exp $");
 
 #include 
 #include 
@@ -308,7 +308,7 @@ pa_to_pvh(paddr_t pa)
 void	pmap_remove_mapping(pmap_t, vaddr_t, pt_entry_t *, int,
 			struct pv_entry **);
 bool	pmap_testbit(paddr_t, int);
-bool	pmap_changebit(paddr_t, int, int);
+bool	pmap_changebit(paddr_t, pt_entry_t, pt_entry_t);
 int	pmap_enter_ptpage(pmap_t, vaddr_t, bool);
 void	pmap_ptpage_addref(vaddr_t);
 int	pmap_ptpage_delref(vaddr_t);
@@ -1826,7 +1826,7 @@ pmap_zero_page(paddr_t phys)
 void
 pmap_copy_page(paddr_t src, paddr_t dst)
 {
-	int npte1, npte2;
+	pt_entry_t npte1, npte2;
 
 	PMAP_DPRINTF(PDB_FOLLOW, ("pmap_copy_page(%lx, %lx)\n", src, dst));
 
@@ -1890,7 +1890,7 @@ pmap_clear_modify(struct vm_page *pg)
 
 	PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_modify(%p)\n", pg));
 
-	return pmap_changebit(pa, 0, ~PG_M);
+	return pmap_changebit(pa, 0, (pt_entry_t)~PG_M);
 }
 
 /*
@@ -1905,7 +1905,7 @@ pmap_clear_reference(struct vm_page *pg)
 
 	PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_reference(%p)\n", pg));
 
-	return pmap_changebit(pa, 0, ~PG_U);
+	return pmap_changebit(pa, 0, (pt_entry_t)~PG_U);
 }
 
 /*
@@ -2193,7 +2193,7 @@ pmap_remove_mapping(pmap_t pmap, vaddr_t
 		PMAP_DPRINTF(PDB_CACHE,
 		("remove: clearing CI for pa %lx\n", pa));
 		pvh->pvh_attrs &= ~PVH_CI;
-		pmap_changebit(pa, 0, ~PG_CI);
+		pmap_changebit(pa, 0, (pt_entry_t)~PG_CI);
 #ifdef DEBUG
 		if ((pmapdebug & (PDB_CACHE|PDB_PVDUMP)) ==
 		(PDB_CACHE|PDB_PVDUMP))
@@ -2352,7 +2352,7 @@ pmap_testbit(paddr_t pa, int bit)
  */
 /* static */
 bool
-pmap_changebit(paddr_t pa, int set, int mask)
+pmap_changebit(paddr_t pa, pt_entry_t set, pt_entry_t mask)
 {
 	struct pv_header *pvh;
 	struct pv_entry *pv;
@@ -2629,7 +2629,7 @@ pmap_enter_ptpage(pmap_t pmap, vaddr_t v
 			pmap == pmap_kernel() ? "Kernel" : "User",
 			va, ptpa, pte, *pte);
 #endif
-		if (pmap_changebit(ptpa, PG_CI, ~PG_CCB))
+		if (pmap_changebit(ptpa, PG_CI, (pt_entry_t)~PG_CCB))
 			DCIS();
 	}
 #endif
@@ -2769,15 +2769,18 @@ _pmap_set_page_cacheable(pmap_t pmap, va
 #if defined(M68020) || defined(M68030)
 	if (mmutype == MMU_68040) {
 #endif
-	if (pmap_changebit(pmap_pte_pa(pmap_pte(pmap, va)), PG_CCB, ~PG_CI))
+	if (pmap_changebit(pmap_pte_pa(pmap_pte(pmap, va)), PG_CCB,
+			   (pt_entry_t)~PG_CI))
 		DCIS();
 
 #if defined(M68020) || defined(M68030)
 	} else
-		pmap_changebit(pmap_pte_pa(pmap_pte(pmap, va)), 0, ~PG_CI);
+		pmap_changebit(pmap_pte_pa(pmap_pte(pmap, va)), 0,
+			   (pt_entry_t)~PG_CI);
 #endif
 #else
-	pmap_changebit(pmap_pte_pa(pmap_pte(pmap, va)), 0, ~PG_CI);
+	pmap_changebit(pmap_pte_pa(pmap_pte(pmap, va)), 0,
+		   (pt_entry_t)~PG_CI);
 #endif
 }
 
@@ -2792,7 +2795,8 @@ _pmap_set_page_cacheinhibit(pmap_t pmap,
 #if defined(M68020) || defined(M68030)
 	if (mmutype == MMU_68040) {
 #endif
-	if (pmap_changebit(pmap_pte_pa(pmap_pte(pmap, va)), PG_CI, ~PG_CCB))
+	if (pmap_changebit(pmap_pte_pa(pmap_pte(pmap, va)), PG_CI,
+			   (pt_entry_t)~PG_CCB))
 		DCIS();
 #if defined(M68020) || defined(M68030)
 	} else



CVS commit: src/sys/arch/m68k/m68k

2023-12-27 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec 28 01:33:06 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
Be more careful with the types used for PTEs.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/m68k/m68k/pmap_motorola.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2023-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 26 17:48:38 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_motorola.h
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
Move active_pmap() and active_user_pmap() macros into pmap_motorola.c


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/m68k/m68k/pmap_motorola.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/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.40 src/sys/arch/m68k/include/pmap_motorola.h:1.41
--- src/sys/arch/m68k/include/pmap_motorola.h:1.40	Tue Dec 26 17:42:43 2023
+++ src/sys/arch/m68k/include/pmap_motorola.h	Tue Dec 26 17:48:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.40 2023/12/26 17:42:43 thorpej Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.41 2023/12/26 17:48:38 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -182,12 +182,6 @@ struct pv_entry {
 	struct pmap	*pv_ptpmap;	/* if pv_ptste, pmap for PT page */
 };
 
-#define	active_pmap(pm) \
-	((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
-#define	active_user_pmap(pm) \
-	(curproc && \
-	 (pm) != pmap_kernel() && (pm) == curproc->p_vmspace->vm_map.pmap)
-
 extern struct pv_header	*pv_table;	/* array of entries, one per page */
 
 #define	pmap_resident_count(pmap)	((pmap)->pm_stats.resident_count)

Index: src/sys/arch/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.81 src/sys/arch/m68k/m68k/pmap_motorola.c:1.82
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.81	Tue Dec 26 17:42:43 2023
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Tue Dec 26 17:48:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.81 2023/12/26 17:42:43 thorpej Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.82 2023/12/26 17:48:38 thorpej Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.81 2023/12/26 17:42:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.82 2023/12/26 17:48:38 thorpej Exp $");
 
 #include 
 #include 
@@ -325,6 +325,13 @@ void pmap_check_wiring(const char *, vad
 #define	PRM_CFLUSH	0x02
 #define	PRM_KEEPPTPAGE	0x04
 
+#define	active_pmap(pm) \
+	((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
+
+#define	active_user_pmap(pm) \
+	(curproc && \
+	 (pm) != pmap_kernel() && (pm) == curproc->p_vmspace->vm_map.pmap)
+
 /*
  * pmap_bootstrap_finalize:	[ INTERFACE ]
  *



CVS commit: src/sys/arch/m68k

2023-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 26 17:48:38 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_motorola.h
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
Move active_pmap() and active_user_pmap() macros into pmap_motorola.c


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/m68k/m68k/pmap_motorola.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2023-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 26 17:42:43 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_motorola.h
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
- G/C the PMAP_ACTIVATE() macro, just call loadustp() directly.
- In pmap_activate(), rather than checking for an idle LWP and skipping
  the loadustp() in that case, just check if the pmap being activate is
  the kernel pmap.  Also, KASSERT() that the specified lwp is the current
  lwp.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/m68k/m68k/pmap_motorola.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2023-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 26 17:42:43 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_motorola.h
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
- G/C the PMAP_ACTIVATE() macro, just call loadustp() directly.
- In pmap_activate(), rather than checking for an idle LWP and skipping
  the loadustp() in that case, just check if the pmap being activate is
  the kernel pmap.  Also, KASSERT() that the specified lwp is the current
  lwp.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/m68k/m68k/pmap_motorola.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/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.39 src/sys/arch/m68k/include/pmap_motorola.h:1.40
--- src/sys/arch/m68k/include/pmap_motorola.h:1.39	Mon Dec 25 21:32:57 2023
+++ src/sys/arch/m68k/include/pmap_motorola.h	Tue Dec 26 17:42:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.39 2023/12/25 21:32:57 thorpej Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.40 2023/12/26 17:42:43 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -108,7 +108,7 @@ struct pmap {
  *
  * 68020/030 l2 size is chosen per NPTEPG, a number of page table entries
  * per page, to use one whole page for PTEs per one segment table entry,
- * and maybe also because 68020 HP MMU machines use simlar structures.
+ * and maybe also because 68020 HP MMU machines use similar structures.
  *
  * 68040/060 layout is defined by hardware design and not configurable,
  * as defined in .
@@ -171,15 +171,6 @@ struct pmap {
 #define bmtol2(n)	(ffs(n) - 1)
 
 /*
- * Macros for speed
- */
-#define	PMAP_ACTIVATE(pmap, loadhw)	\
-{	\
-	if ((loadhw))			\
-		loadustp((paddr_t)(pmap)->pm_stpa);			\
-}
-
-/*
  * For each struct vm_page, there is a list of all currently valid virtual
  * mappings of that page.  An entry is a pv_entry, the list is pv_table.
  */

Index: src/sys/arch/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.80 src/sys/arch/m68k/m68k/pmap_motorola.c:1.81
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.80	Wed Dec 20 00:40:43 2023
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Tue Dec 26 17:42:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.80 2023/12/20 00:40:43 thorpej Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.81 2023/12/26 17:42:43 thorpej Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.80 2023/12/20 00:40:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.81 2023/12/26 17:42:43 thorpej Exp $");
 
 #include 
 #include 
@@ -753,8 +753,15 @@ pmap_activate(struct lwp *l)
 	PMAP_DPRINTF(PDB_FOLLOW|PDB_SEGTAB,
 	("pmap_activate(%p)\n", l));
 
-	PMAP_ACTIVATE(pmap, (curlwp->l_flag & LW_IDLE) != 0 ||
-	l->l_proc == curproc);
+	KASSERT(l == curlwp);
+
+	/*
+	 * Because the kernel has a separate root pointer, we don't
+	 * need to activate the kernel pmap.
+	 */
+	if (pmap != pmap_kernel()) {
+		loadustp((paddr_t)pmap->pm_stpa);
+	}
 }
 
 /*
@@ -2248,15 +2255,13 @@ pmap_remove_mapping(pmap_t pmap, vaddr_t
 #endif
 	ptpmap->pm_stfree = protostfree;
 #endif
-
 /*
- * XXX may have changed segment table
- * pointer for current process so
- * update now to reload hardware.
+ * Segment table has changed; reload the
+ * MMU if it's the active user pmap.
  */
-
-if (active_user_pmap(ptpmap))
-	PMAP_ACTIVATE(ptpmap, 1);
+if (active_user_pmap(ptpmap)) {
+	loadustp((paddr_t)ptpmap->pm_stpa);
+}
 			}
 		}
 		pvh->pvh_attrs &= ~PVH_PTPAGE;
@@ -2474,11 +2479,12 @@ pmap_enter_ptpage(pmap_t pmap, vaddr_t v
 		}
 #endif
 		/*
-		 * XXX may have changed segment table pointer for current
-		 * process so update now to reload hardware.
+		 * Segment table has changed; reload the
+		 * MMU if it's the active user pmap.
 		 */
-		if (active_user_pmap(pmap))
-			PMAP_ACTIVATE(pmap, 1);
+		if (active_user_pmap(pmap)) {
+			loadustp((paddr_t)pmap->pm_stpa);
+		}
 
 		PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
 		("enter: pmap %p stab %p(%p)\n",



CVS commit: src/sys/arch/m68k/fpe

2023-11-18 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Nov 19 03:58:15 UTC 2023

Modified Files:
src/sys/arch/m68k/fpe: fpu_rem.c

Log Message:
m68k: Remove an unused variable since rev 1.1.
Detected by clang15 (nono emulator has imported and used this FPE).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/m68k/fpe/fpu_rem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/fpe

2023-11-18 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Nov 19 03:58:15 UTC 2023

Modified Files:
src/sys/arch/m68k/fpe: fpu_rem.c

Log Message:
m68k: Remove an unused variable since rev 1.1.
Detected by clang15 (nono emulator has imported and used this FPE).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/m68k/fpe/fpu_rem.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/m68k/fpe/fpu_rem.c
diff -u src/sys/arch/m68k/fpe/fpu_rem.c:1.17 src/sys/arch/m68k/fpe/fpu_rem.c:1.18
--- src/sys/arch/m68k/fpe/fpu_rem.c:1.17	Thu Feb  5 12:22:06 2015
+++ src/sys/arch/m68k/fpe/fpu_rem.c	Sun Nov 19 03:58:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_rem.c,v 1.17 2015/02/05 12:22:06 isaki Exp $	*/
+/*	$NetBSD: fpu_rem.c,v 1.18 2023/11/19 03:58:15 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 1.17 2015/02/05 12:22:06 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 1.18 2023/11/19 03:58:15 isaki Exp $");
 
 #include 
 #include 
@@ -48,7 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 
  *signQ := signX EOR signY. Record whether MOD or REM
  *is requested.
  *
- *   Step 2.  Set L := expo(X)-expo(Y), k := 0, Q := 0.
+ *   Step 2.  Set L := expo(X)-expo(Y), Q := 0.
  *If (L < 0) then
  *   R := X, go to Step 4.
  *else
@@ -59,8 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 
  *3.1 If R = Y, then { Q := Q + 1, R := 0, go to Step 7. }
  *3.2 If R > Y, then { R := R - Y, Q := Q + 1}
  *3.3 If j = 0, go to Step 4.
- *3.4 k := k + 1, j := j - 1, Q := 2Q, R := 2R. Go to
- *Step 3.1.
+ *3.4 j := j - 1, Q := 2Q, R := 2R. Go to Step 3.1.
  *
  *   Step 4.  R := signX*R.
  *
@@ -105,7 +104,7 @@ __fpu_modrem(struct fpemu *fe, int is_mo
 	static struct fpn X, Y;
 	struct fpn *x, *y, *r;
 	uint32_t signX, signY, signQ;
-	int j, k, l, q;
+	int j, l, q;
 	int cmp;
 
 	if (ISNAN(>fe_f1) || ISNAN(>fe_f2))
@@ -138,7 +137,6 @@ __fpu_modrem(struct fpemu *fe, int is_mo
 	 * Step 2
 	 */
 	l = x->fp_exp - y->fp_exp;
-	k = 0;
 	CPYFPN(r, x);
 	if (l >= 0) {
 		r->fp_exp -= l;
@@ -168,7 +166,6 @@ __fpu_modrem(struct fpemu *fe, int is_mo
 goto Step4;
 
 			/* Step 3.4 */
-			k++;
 			j--;
 			q += q;
 			r->fp_exp++;



CVS commit: src/sys/arch/m68k/include

2023-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 28 06:34:22 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_coldfire.h

Log Message:
whitespace nit


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/pmap_coldfire.h

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/m68k/include/pmap_coldfire.h
diff -u src/sys/arch/m68k/include/pmap_coldfire.h:1.5 src/sys/arch/m68k/include/pmap_coldfire.h:1.6
--- src/sys/arch/m68k/include/pmap_coldfire.h:1.5	Thu Sep 28 06:23:43 2023
+++ src/sys/arch/m68k/include/pmap_coldfire.h	Thu Sep 28 06:34:22 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_coldfire.h,v 1.5 2023/09/28 06:23:43 skrll Exp $	*/
+/*	$NetBSD: pmap_coldfire.h,v 1.6 2023/09/28 06:34:22 skrll Exp $	*/
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -65,7 +65,7 @@
 
 #define	KERNEL_PID	0
 
-#define	PMAP_TLB_MAX			  1
+#define	PMAP_TLB_MAX			1
 #define	PMAP_TLB_NUM_PIDS		256
 #define	PMAP_INVALID_SEGTAB_ADDRESS	((pmap_segtab_t *)0xfeeddead)
 



CVS commit: src/sys/arch/m68k/include

2023-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 28 06:34:22 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_coldfire.h

Log Message:
whitespace nit


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/pmap_coldfire.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2023-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 28 06:23:43 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_coldfire.h

Log Message:
#define -> #define for consistency


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/include/pmap_coldfire.h

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/m68k/include/pmap_coldfire.h
diff -u src/sys/arch/m68k/include/pmap_coldfire.h:1.4 src/sys/arch/m68k/include/pmap_coldfire.h:1.5
--- src/sys/arch/m68k/include/pmap_coldfire.h:1.4	Sun Dec 20 16:38:25 2020
+++ src/sys/arch/m68k/include/pmap_coldfire.h	Thu Sep 28 06:23:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_coldfire.h,v 1.4 2020/12/20 16:38:25 skrll Exp $	*/
+/*	$NetBSD: pmap_coldfire.h,v 1.5 2023/09/28 06:23:43 skrll Exp $	*/
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -59,13 +59,13 @@
 
 #define	NBSEG		(NBPG*NPTEPG)
 #define	SEGSHIFT	(PGSHIFT + PGSHIFT - 2)
-#define SEGOFSET	((1 << SEGSHIFT) - 1)
-#define PMAP_SEGTABSIZE	(1 << (32 - SEGSHIFT))
+#define	SEGOFSET	((1 << SEGSHIFT) - 1)
+#define	PMAP_SEGTABSIZE	(1 << (32 - SEGSHIFT))
 #define	NPTEPG		(NBPG >> 2)
 
 #define	KERNEL_PID	0
 
-#define PMAP_TLB_MAX			  1
+#define	PMAP_TLB_MAX			  1
 #define	PMAP_TLB_NUM_PIDS		256
 #define	PMAP_INVALID_SEGTAB_ADDRESS	((pmap_segtab_t *)0xfeeddead)
 



CVS commit: src/sys/arch/m68k/include

2023-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 28 06:23:43 UTC 2023

Modified Files:
src/sys/arch/m68k/include: pmap_coldfire.h

Log Message:
#define -> #define for consistency


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/include/pmap_coldfire.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2023-09-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep 26 14:33:55 UTC 2023

Modified Files:
src/sys/arch/m68k/include: cacheops_60.h cpuframe.h db_machdep.h
frame.h m68k.h pcb.h
src/sys/arch/m68k/m68k: copy.s db_disasm.c db_trace.c oc_cksum.s
pmap_motorola.c sunos_machdep.c sunos_sigcode.s switch_subr.s
vm_machdep.c

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/m68k/include/cacheops_60.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/include/cpuframe.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/db_machdep.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/m68k/include/frame.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/m68k/include/m68k.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/include/pcb.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/m68k/m68k/copy.s
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/m68k/m68k/db_disasm.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/m68k/m68k/db_trace.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/m68k/oc_cksum.s
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/m68k/m68k/sunos_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/m68k/sunos_sigcode.s
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/m68k/m68k/switch_subr.s
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/m68k/m68k/vm_machdep.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/m68k/include/cacheops_60.h
diff -u src/sys/arch/m68k/include/cacheops_60.h:1.13 src/sys/arch/m68k/include/cacheops_60.h:1.14
--- src/sys/arch/m68k/include/cacheops_60.h:1.13	Mon Apr 28 20:23:26 2008
+++ src/sys/arch/m68k/include/cacheops_60.h	Tue Sep 26 14:33:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cacheops_60.h,v 1.13 2008/04/28 20:23:26 martin Exp $	*/
+/*	$NetBSD: cacheops_60.h,v 1.14 2023/09/26 14:33:55 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@ TBIAS_60(void)
 			  " movc  %%cacr,%0;"
 			  " orl   %1,%0;"
 			  " movc  %0,%%cacr" /* clear all branch cache
-			 		entries */
+	entries */
 			  : "=d" (tmp) : "i" (IC60_CABC) );
 }
 
@@ -93,7 +93,7 @@ TBIAU_60(void)
 			  " movc  %%cacr,%0;"
 			  " orl   %1,%0;"
 			  " movc  %0,%%cacr" /* clear all branch cache
-			 		entries */
+	entries */
 			  : "=d" (tmp) : "i" (IC60_CUBC) );
 }
 

Index: src/sys/arch/m68k/include/cpuframe.h
diff -u src/sys/arch/m68k/include/cpuframe.h:1.9 src/sys/arch/m68k/include/cpuframe.h:1.10
--- src/sys/arch/m68k/include/cpuframe.h:1.9	Tue Sep 26 12:46:30 2023
+++ src/sys/arch/m68k/include/cpuframe.h	Tue Sep 26 14:33:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuframe.h,v 1.9 2023/09/26 12:46:30 tsutsui Exp $	*/
+/*	$NetBSD: cpuframe.h,v 1.10 2023/09/26 14:33:55 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -64,8 +64,8 @@ struct frame {
 			u_int	f_fa;
 			u_int	f_fslw;
 			/* for 060FP type 4 FP disabled frames: */
-#define 		f_fea	f_fa
-#define 		f_pcfi	f_fslw
+#define			f_fea	f_fa
+#define			f_pcfi	f_fslw
 		} F_fmt4;
 
 		struct fmt7 {

Index: src/sys/arch/m68k/include/db_machdep.h
diff -u src/sys/arch/m68k/include/db_machdep.h:1.34 src/sys/arch/m68k/include/db_machdep.h:1.35
--- src/sys/arch/m68k/include/db_machdep.h:1.34	Tue Sep 26 12:46:30 2023
+++ src/sys/arch/m68k/include/db_machdep.h	Tue Sep 26 14:33:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.34 2023/09/26 12:46:30 tsutsui Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.35 2023/09/26 14:33:55 tsutsui Exp $	*/
 
 /*
  * Mach Operating System
@@ -102,7 +102,7 @@ typedef long kgdb_reg_t;
 
 void	Debugger(void);		/* XXX */
 void	kdb_kintr(db_regs_t *);
-int 	kdb_trap(int, db_regs_t *);
+int	kdb_trap(int, db_regs_t *);
 
 #endif /* _KERNEL */
 

Index: src/sys/arch/m68k/include/frame.h
diff -u src/sys/arch/m68k/include/frame.h:1.32 src/sys/arch/m68k/include/frame.h:1.33
--- src/sys/arch/m68k/include/frame.h:1.32	Tue Sep 26 12:46:30 2023
+++ src/sys/arch/m68k/include/frame.h	Tue Sep 26 14:33:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.32 2023/09/26 12:46:30 tsutsui Exp $	*/
+/*	$NetBSD: frame.h,v 1.33 2023/09/26 14:33:55 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -147,17 +147,17 @@
 #define FSLW_PBE	0x4000
 #define FSLW_SBE	0x2000
 #define FSLW_PTA	0x1000
-#define FSLW_PTB 	0x0800
-#define FSLW_IL 	0x0400
-#define FSLW_PF 	0x0200
-#define FSLW_SP 	0x0100
-#define FSLW_WP 	0x0080
-#define FSLW_TWE 	0x0040
-#define FSLW_RE 	0x0020
-#define FSLW_WE 	0x0010
-#define FSLW_TTR 	0x0008
-#define FSLW_BPE 	0x0004
-#define FSLW_SEE 	0x0001
+#define FSLW_PTB	0x0800
+#define FSLW_IL		0x0400
+#define FSLW_PF		0x0200
+#define FSLW_SP		0x0100
+#define FSLW_WP		0x0080
+#define FSLW_TWE	0x0040
+#define FSLW_RE		0x0020
+#define FSLW_WE		0x0010
+#define 

CVS commit: src/sys/arch/m68k

2023-09-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep 26 14:33:55 UTC 2023

Modified Files:
src/sys/arch/m68k/include: cacheops_60.h cpuframe.h db_machdep.h
frame.h m68k.h pcb.h
src/sys/arch/m68k/m68k: copy.s db_disasm.c db_trace.c oc_cksum.s
pmap_motorola.c sunos_machdep.c sunos_sigcode.s switch_subr.s
vm_machdep.c

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/m68k/include/cacheops_60.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/include/cpuframe.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/db_machdep.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/m68k/include/frame.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/m68k/include/m68k.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/include/pcb.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/m68k/m68k/copy.s
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/m68k/m68k/db_disasm.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/m68k/m68k/db_trace.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/m68k/oc_cksum.s
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/m68k/m68k/sunos_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/m68k/sunos_sigcode.s
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/m68k/m68k/switch_subr.s
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/m68k/m68k/vm_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k

2023-09-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep 26 12:46:30 UTC 2023

Modified Files:
src/sys/arch/m68k/include: asm.h bus_dma.h cacheops_30.h cpuframe.h
db_machdep.h fenv.h frame.h ieeefp.h int_limits.h m68k.h
pmap_motorola.h
src/sys/arch/m68k/m68k: bus_dma.c copypage.s db_disasm.h db_memrw.c
db_trace.c m68k_machdep.c oc_cksum.s pmap_motorola.c switch_subr.s
trap_subr.s w16copy.s

Log Message:
Remove trailing spaces and TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/asm.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/m68k/include/bus_dma.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/include/cacheops_30.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/include/cpuframe.h \
src/sys/arch/m68k/include/fenv.h src/sys/arch/m68k/include/int_limits.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/m68k/include/db_machdep.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/m68k/include/frame.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/include/ieeefp.h
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/include/m68k.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/m68k/m68k/bus_dma.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/m68k/copypage.s
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/m68k/db_disasm.h \
src/sys/arch/m68k/m68k/m68k_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/db_memrw.c
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/m68k/m68k/db_trace.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/m68k/oc_cksum.s
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/m68k/switch_subr.s
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/m68k/trap_subr.s
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/w16copy.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/m68k/include/asm.h
diff -u src/sys/arch/m68k/include/asm.h:1.34 src/sys/arch/m68k/include/asm.h:1.35
--- src/sys/arch/m68k/include/asm.h:1.34	Fri Apr 17 14:19:43 2020
+++ src/sys/arch/m68k/include/asm.h	Tue Sep 26 12:46:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.34 2020/04/17 14:19:43 joerg Exp $	*/
+/*	$NetBSD: asm.h,v 1.35 2023/09/26 12:46:30 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -122,7 +122,7 @@
 
 /*
  * The m68k ALTENTRY macro is very different than the traditional
- * implementation used by other NetBSD ports.  Usually ALTENTRY 
+ * implementation used by other NetBSD ports.  Usually ALTENTRY
  * simply provides an alternate function entry point.  The m68k
  * definition takes a second argument and jumps inside the second
  * function when profiling is enabled.

Index: src/sys/arch/m68k/include/bus_dma.h
diff -u src/sys/arch/m68k/include/bus_dma.h:1.13 src/sys/arch/m68k/include/bus_dma.h:1.14
--- src/sys/arch/m68k/include/bus_dma.h:1.13	Sun Dec  5 04:54:20 2021
+++ src/sys/arch/m68k/include/bus_dma.h	Tue Sep 26 12:46:30 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.h,v 1.13 2021/12/05 04:54:20 msaitoh Exp $ */
+/* $NetBSD: bus_dma.h,v 1.14 2023/09/26 12:46:30 tsutsui Exp $ */
 
 /*
  * This file was extracted from alpha/include/bus.h
@@ -193,7 +193,7 @@ struct m68k_bus_dma_tag {
 #define	bus_dmamem_mmap(t, sg, n, o, p, f)			\
 	(*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f))
 
-#define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP   
+#define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
 #define bus_dmatag_destroy(t)
 
 /*

Index: src/sys/arch/m68k/include/cacheops_30.h
diff -u src/sys/arch/m68k/include/cacheops_30.h:1.9 src/sys/arch/m68k/include/cacheops_30.h:1.10
--- src/sys/arch/m68k/include/cacheops_30.h:1.9	Mon Apr 28 20:23:26 2008
+++ src/sys/arch/m68k/include/cacheops_30.h	Tue Sep 26 12:46:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cacheops_30.h,v 1.9 2008/04/28 20:23:26 martin Exp $	*/
+/*	$NetBSD: cacheops_30.h,v 1.10 2023/09/26 12:46:30 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@ TBIA_30(void)
 	__asm volatile (" pflusha;"
 			  " movc %0,%%cacr" : : "d" (tmp));
 }
-	
+
 /*
  * Invalidate any TLB entry for given VA (TB Invalidate Single)
  */

Index: src/sys/arch/m68k/include/cpuframe.h
diff -u src/sys/arch/m68k/include/cpuframe.h:1.8 src/sys/arch/m68k/include/cpuframe.h:1.9
--- src/sys/arch/m68k/include/cpuframe.h:1.8	Sun Dec  5 02:53:51 2021
+++ src/sys/arch/m68k/include/cpuframe.h	Tue Sep 26 12:46:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuframe.h,v 1.8 2021/12/05 02:53:51 msaitoh Exp $	*/
+/*	$NetBSD: cpuframe.h,v 1.9 2023/09/26 12:46:30 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -64,7 +64,7 @@ struct frame {
 			u_int	f_fa;
 			u_int	f_fslw;
 			/* for 060FP type 4 FP disabled frames: */
-#define 		f_fea	f_fa	
+#define 		f_fea	f_fa
 #define 		f_pcfi	f_fslw
 		} F_fmt4;
 
@@ -187,8 +187,8 @@ 

CVS commit: src/sys/arch/m68k

2023-09-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep 26 12:46:30 UTC 2023

Modified Files:
src/sys/arch/m68k/include: asm.h bus_dma.h cacheops_30.h cpuframe.h
db_machdep.h fenv.h frame.h ieeefp.h int_limits.h m68k.h
pmap_motorola.h
src/sys/arch/m68k/m68k: bus_dma.c copypage.s db_disasm.h db_memrw.c
db_trace.c m68k_machdep.c oc_cksum.s pmap_motorola.c switch_subr.s
trap_subr.s w16copy.s

Log Message:
Remove trailing spaces and TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/include/asm.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/m68k/include/bus_dma.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/include/cacheops_30.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/include/cpuframe.h \
src/sys/arch/m68k/include/fenv.h src/sys/arch/m68k/include/int_limits.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/m68k/include/db_machdep.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/m68k/include/frame.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/include/ieeefp.h
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/include/m68k.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/m68k/m68k/bus_dma.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/m68k/copypage.s
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/m68k/db_disasm.h \
src/sys/arch/m68k/m68k/m68k_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/db_memrw.c
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/m68k/m68k/db_trace.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/m68k/oc_cksum.s
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/m68k/m68k/switch_subr.s
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/m68k/trap_subr.s
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/w16copy.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/fpe

2023-09-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 17 13:14:08 UTC 2023

Modified Files:
src/sys/arch/m68k/fpe: fpu_emulate.c

Log Message:
word was changed to sval at rev 1.39, but DPRINTF values were not updated.

Fixes DEBUG_FPE enabled build for 68k FPE code.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/m68k/fpe/fpu_emulate.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/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.40 src/sys/arch/m68k/fpe/fpu_emulate.c:1.41
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.40	Fri Dec 27 07:41:23 2019
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Sun Sep 17 13:14:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.40 2019/12/27 07:41:23 msaitoh Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.41 2023/09/17 13:14:08 andvar Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.40 2019/12/27 07:41:23 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.41 2023/09/17 13:14:08 andvar Exp $");
 
 #include 
 #include 
@@ -132,12 +132,12 @@ fpu_emulate(struct frame *frame, struct 
 
 	if ((sval & 0xf000) != 0xf000) {
 		DPRINTF(("%s: not coproc. insn.: opcode=0x%x\n",
-		__func__, word));
+		__func__, sval));
 		fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
 	}
 
 	if ((sval & 0x0E00) != 0x0200) {
-		DPRINTF(("%s: bad coproc. id: opcode=0x%x\n", __func__, word));
+		DPRINTF(("%s: bad coproc. id: opcode=0x%x\n", __func__, sval));
 		fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
 	}
 



CVS commit: src/sys/arch/m68k/fpe

2023-09-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 17 13:14:08 UTC 2023

Modified Files:
src/sys/arch/m68k/fpe: fpu_emulate.c

Log Message:
word was changed to sval at rev 1.39, but DPRINTF values were not updated.

Fixes DEBUG_FPE enabled build for 68k FPE code.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/m68k/fpe/fpu_emulate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2023-04-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 29 10:01:51 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: kobj_machdep.c

Log Message:
Fix build after previous. m68k uses symnum instead of symidx.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/m68k/kobj_machdep.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/m68k/m68k/kobj_machdep.c
diff -u src/sys/arch/m68k/m68k/kobj_machdep.c:1.5 src/sys/arch/m68k/m68k/kobj_machdep.c:1.6
--- src/sys/arch/m68k/m68k/kobj_machdep.c:1.5	Fri Apr 28 07:33:56 2023
+++ src/sys/arch/m68k/m68k/kobj_machdep.c	Sat Apr 29 10:01:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_machdep.c,v 1.5 2023/04/28 07:33:56 skrll Exp $	*/
+/*	$NetBSD: kobj_machdep.c,v 1.6 2023/04/29 10:01:51 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.5 2023/04/28 07:33:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.6 2023/04/29 10:01:51 skrll Exp $");
 
 #define	ELFSIZE		ARCH_ELFSIZE
 
@@ -57,7 +57,7 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas
 	symnum = ELF_R_SYM(rela->r_info);
 	rtype = ELF_R_TYPE(rela->r_info);
 
-	const Elf_Sym *sym = kobj_symbol(ko, symidx);
+	const Elf_Sym *sym = kobj_symbol(ko, symnum);
 
 	if (!local && ELF_ST_BIND(sym->st_info) == STB_LOCAL) {
 		return 0;



CVS commit: src/sys/arch/m68k/m68k

2023-04-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 29 10:01:51 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: kobj_machdep.c

Log Message:
Fix build after previous. m68k uses symnum instead of symidx.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/m68k/kobj_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2023-04-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Apr 29 03:17:30 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: busaddrerr.s

Log Message:
m68k: Support TT(Transparent Translation) for 020/030 buserror handler.
This avoids a panic when trying badaddr() against to an address where
bus error occurs in the TT region.  Only luna68k and news68k use TT.
Discussed on port-m68k.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/busaddrerr.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/m68k/m68k/busaddrerr.s
diff -u src/sys/arch/m68k/m68k/busaddrerr.s:1.1 src/sys/arch/m68k/m68k/busaddrerr.s:1.2
--- src/sys/arch/m68k/m68k/busaddrerr.s:1.1	Sat Mar 15 09:22:36 2014
+++ src/sys/arch/m68k/m68k/busaddrerr.s	Sat Apr 29 03:17:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: busaddrerr.s,v 1.1 2014/03/15 09:22:36 tsutsui Exp $	*/
+/*	$NetBSD: busaddrerr.s,v 1.2 2023/04/29 03:17:30 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -219,7 +219,12 @@ Lbe10:
 	jeq	Lbe10a			| if no, done
 	movql	#5,%d0			| else supervisor program access
 Lbe10a:
-	ptestr	%d0,%a0@,#7		| do a table search
+	ptestr	%d0,%a0@,#0		| only PTEST #0 can detect transparent
+	pmove	%psr,%sp@		|   translation (TT0 or TT1).
+	movw	%sp@,%d1
+	btst	#6,%d1			| transparent (TT0 or TT1)?
+	jne	Lisberr1		| yes -> bus error
+	ptestr	%d0,%a0@,#7		| no, do a table search
 	pmove	%psr,%sp@		| save result
 	movb	%sp@,%d1
 	btst	#2,%d1			| invalid (incl. limit viol. and berr)?



CVS commit: src/sys/arch/m68k/m68k

2023-04-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Apr 29 03:17:30 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: busaddrerr.s

Log Message:
m68k: Support TT(Transparent Translation) for 020/030 buserror handler.
This avoids a panic when trying badaddr() against to an address where
bus error occurs in the TT region.  Only luna68k and news68k use TT.
Discussed on port-m68k.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/m68k/m68k/busaddrerr.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2023-01-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 29 09:24:33 UTC 2023

Modified Files:
src/sys/arch/m68k/include: kcore.h

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/include/kcore.h

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/m68k/include/kcore.h
diff -u src/sys/arch/m68k/include/kcore.h:1.6 src/sys/arch/m68k/include/kcore.h:1.7
--- src/sys/arch/m68k/include/kcore.h:1.6	Fri Jan 27 23:29:14 2023
+++ src/sys/arch/m68k/include/kcore.h	Sun Jan 29 09:24:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kcore.h,v 1.6 2023/01/27 23:29:14 tsutsui Exp $	*/
+/*	$NetBSD: kcore.h,v 1.7 2023/01/29 09:24:33 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -110,7 +110,7 @@ struct sun3x_kcore_hdr {
 	uint32_t	pg_valid;
 	uint32_t	contig_end;
 	uint32_t	kernCbase;	/* VA of kernel level C page table */
-	pys_ram_seg_t	ram_segs[SUN3X_NPHYS_RAM_SEGS];
+	phys_ram_seg_t	ram_segs[SUN3X_NPHYS_RAM_SEGS];
 };
 
 /*



CVS commit: src/sys/arch/m68k/include

2023-01-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 29 09:24:33 UTC 2023

Modified Files:
src/sys/arch/m68k/include: kcore.h

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/include/kcore.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 23:29:15 UTC 2023

Modified Files:
src/sys/arch/m68k/include: kcore.h psl.h

Log Message:
Use proper uintNN_t integer types.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/kcore.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/include/psl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/include

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 23:29:15 UTC 2023

Modified Files:
src/sys/arch/m68k/include: kcore.h psl.h

Log Message:
Use proper uintNN_t integer types.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/kcore.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/include/psl.h

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/m68k/include/kcore.h
diff -u src/sys/arch/m68k/include/kcore.h:1.5 src/sys/arch/m68k/include/kcore.h:1.6
--- src/sys/arch/m68k/include/kcore.h:1.5	Mon Apr 28 20:23:26 2008
+++ src/sys/arch/m68k/include/kcore.h	Fri Jan 27 23:29:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kcore.h,v 1.5 2008/04/28 20:23:26 martin Exp $	*/
+/*	$NetBSD: kcore.h,v 1.6 2023/01/27 23:29:14 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -57,24 +57,24 @@
 #define	M68K_NPHYS_RAM_SEGS	8	/* XXX */
 struct m68k_kcore_hdr {
 	int32_t		mmutype;	/* MMU type */
-	u_int32_t	sg_v;		/* STE bits */
-	u_int32_t	sg_frame;
-	u_int32_t	sg_ishift;
-	u_int32_t	sg_pmask;
-	u_int32_t	sg40_shift1;
-	u_int32_t	sg40_mask2;
-	u_int32_t	sg40_shift2;
-	u_int32_t	sg40_mask3;
-	u_int32_t	sg40_shift3;
-	u_int32_t	sg40_addr1;
-	u_int32_t	sg40_addr2;
-	u_int32_t	pg_v;		/* PTE bits */
-	u_int32_t	pg_frame;
-	u_int32_t	sysseg_pa;	/* PA of Sysseg[] */
-	u_int32_t	reloc;		/* value added to relocate a symbol
+	uint32_t	sg_v;		/* STE bits */
+	uint32_t	sg_frame;
+	uint32_t	sg_ishift;
+	uint32_t	sg_pmask;
+	uint32_t	sg40_shift1;
+	uint32_t	sg40_mask2;
+	uint32_t	sg40_shift2;
+	uint32_t	sg40_mask3;
+	uint32_t	sg40_shift3;
+	uint32_t	sg40_addr1;
+	uint32_t	sg40_addr2;
+	uint32_t	pg_v;		/* PTE bits */
+	uint32_t	pg_frame;
+	uint32_t	sysseg_pa;	/* PA of Sysseg[] */
+	uint32_t	reloc;		/* value added to relocate a symbol
 	   before address translation is
 	   enabled */
-	u_int32_t	relocend;	/* if kernbase < va < relocend, we
+	uint32_t	relocend;	/* if kernbase < va < relocend, we
 	   can do simple relocation to get
 	   the physical address */
 	phys_ram_seg_t	ram_segs[M68K_NPHYS_RAM_SEGS];
@@ -84,20 +84,20 @@ struct m68k_kcore_hdr {
  * kcore information for the sun2
  */
 struct sun2_kcore_hdr {
-	u_int32_t	segshift;
-	u_int32_t	pg_frame;	/* PTE bits */
-	u_int32_t	pg_valid;
-	u_int8_t	ksegmap[512];	/* kernel segment map */
+	uint32_t	segshift;
+	uint32_t	pg_frame;	/* PTE bits */
+	uint32_t	pg_valid;
+	uint8_t		ksegmap[512];	/* kernel segment map */
 };
 
 /*
  * kcore information for the sun3
  */
 struct sun3_kcore_hdr {
-	u_int32_t	segshift;
-	u_int32_t	pg_frame;	/* PTE bits */
-	u_int32_t	pg_valid;
-	u_int8_t	ksegmap[256];	/* kernel segment map */
+	uint32_t	segshift;
+	uint32_t	pg_frame;	/* PTE bits */
+	uint32_t	pg_valid;
+	uint8_t		ksegmap[256];	/* kernel segment map */
 };
 
 /*
@@ -106,11 +106,11 @@ struct sun3_kcore_hdr {
  */
 #define	SUN3X_NPHYS_RAM_SEGS	4
 struct sun3x_kcore_hdr {
-	u_int32_t	pg_frame;	/* PTE bits */
-	u_int32_t	pg_valid;
-	u_int32_t	contig_end;
-	u_int32_t	kernCbase;	/* VA of kernel level C page table */
-	phys_ram_seg_t	ram_segs[SUN3X_NPHYS_RAM_SEGS];
+	uint32_t	pg_frame;	/* PTE bits */
+	uint32_t	pg_valid;
+	uint32_t	contig_end;
+	uint32_t	kernCbase;	/* VA of kernel level C page table */
+	pys_ram_seg_t	ram_segs[SUN3X_NPHYS_RAM_SEGS];
 };
 
 /*
@@ -118,8 +118,8 @@ struct sun3x_kcore_hdr {
  */
 struct cpu_kcore_hdr {
 	char		name[16];	/* machine name */
-	u_int32_t	page_size;	/* hardware page size */
-	u_int32_t	kernbase;	/* start of KVA space */
+	uint32_t	page_size;	/* hardware page size */
+	uint32_t	kernbase;	/* start of KVA space */
 	union {
 		struct m68k_kcore_hdr _m68k;
 		struct sun2_kcore_hdr _sun2;

Index: src/sys/arch/m68k/include/psl.h
diff -u src/sys/arch/m68k/include/psl.h:1.15 src/sys/arch/m68k/include/psl.h:1.16
--- src/sys/arch/m68k/include/psl.h:1.15	Fri Jul 27 05:36:11 2012
+++ src/sys/arch/m68k/include/psl.h	Fri Jan 27 23:29:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.15 2012/07/27 05:36:11 matt Exp $	*/
+/*	$NetBSD: psl.h,v 1.16 2023/01/27 23:29:14 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -93,7 +93,7 @@ _splraise(int level)
 
 	__asm volatile("movw %%sr,%0" : "=d" (sr));
 
-	if ((u_int16_t)level >= PSL_HIGHIPL || (u_int16_t)level > (u_int16_t)sr)
+	if ((uint16_t)level >= PSL_HIGHIPL || (uint16_t)level > (uint16_t)sr)
 		__asm volatile("movw %0,%%sr" :: "di" (level) : "memory");
 
 	return sr;



CVS commit: src/sys/arch/m68k/m68k

2023-01-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jan  5 18:27:48 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: bus_dma.c

Log Message:
Fix out of bounds invalidate (and writeback) in bus_dmamap_sync(9) ops.

Detected by the POOL_REDZONE check in sys/kern/subr_pool.c that
has been activated if options DIAGNOSTIC is enabled on post netbsd-9.
The extra invalidate on DMASYNC_PREREAD op discards redzone pattern
data allocated right after an mbuf cluster without proper writeback
to memory so that it triggers false redzone assertions on freeing mbufs.
This bug was my botch in rev 1.25 committed 15 years ago. (sigh)

Fixes PR/57107 (kernel panic on -current when configuring network
with sn(4) on mac68k), as actually the bus_dma(9) op changes
in the past days were introduced for mac68k sn(4) improvements
by using the MI SONIC (src/sys/dev/ic/dp83932.c) driver.
 https://mail-index.netbsd.org/port-mac68k/2007/06/01/0001.html

Should be pulled up to netbsd-9 and netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/m68k/m68k/bus_dma.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/m68k/m68k/bus_dma.c
diff -u src/sys/arch/m68k/m68k/bus_dma.c:1.38 src/sys/arch/m68k/m68k/bus_dma.c:1.39
--- src/sys/arch/m68k/m68k/bus_dma.c:1.38	Tue Jul 26 20:08:55 2022
+++ src/sys/arch/m68k/m68k/bus_dma.c	Thu Jan  5 18:27:48 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.38 2022/07/26 20:08:55 andvar Exp $ */
+/* $NetBSD: bus_dma.c,v 1.39 2023/01/05 18:27:48 tsutsui Exp $ */
 
 /*
  * This file was taken from alpha/common/bus_dma.c
@@ -41,7 +41,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.38 2022/07/26 20:08:55 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.39 2023/01/05 18:27:48 tsutsui Exp $");
 
 #include 
 #include 
@@ -494,7 +494,8 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 			}
 
 			/* flush cachelines per 128bytes */
-			while ((p < e) && (p & PAGE_MASK) != 0) {
+			while ((p + CACHELINE_SIZE * 8 <= e) &&
+			(p & PAGE_MASK) != 0) {
 DCFL(p);
 p += CACHELINE_SIZE;
 DCFL(p);
@@ -570,7 +571,8 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 			}
 
 			/* purge cachelines per 128bytes */
-			while ((p < e) && (p & PAGE_MASK) != 0) {
+			while ((p + CACHELINE_SIZE * 8 <= e) &&
+			(p & PAGE_MASK) != 0) {
 DCPL(p);
 p += CACHELINE_SIZE;
 DCPL(p);



CVS commit: src/sys/arch/m68k/m68k

2023-01-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jan  5 18:27:48 UTC 2023

Modified Files:
src/sys/arch/m68k/m68k: bus_dma.c

Log Message:
Fix out of bounds invalidate (and writeback) in bus_dmamap_sync(9) ops.

Detected by the POOL_REDZONE check in sys/kern/subr_pool.c that
has been activated if options DIAGNOSTIC is enabled on post netbsd-9.
The extra invalidate on DMASYNC_PREREAD op discards redzone pattern
data allocated right after an mbuf cluster without proper writeback
to memory so that it triggers false redzone assertions on freeing mbufs.
This bug was my botch in rev 1.25 committed 15 years ago. (sigh)

Fixes PR/57107 (kernel panic on -current when configuring network
with sn(4) on mac68k), as actually the bus_dma(9) op changes
in the past days were introduced for mac68k sn(4) improvements
by using the MI SONIC (src/sys/dev/ic/dp83932.c) driver.
 https://mail-index.netbsd.org/port-mac68k/2007/06/01/0001.html

Should be pulled up to netbsd-9 and netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/m68k/m68k/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/m68k

2022-07-31 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Jul 31 17:11:41 UTC 2022

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
in pmap_enter_ptpage(), if we are allowed to fail then fail rather than
waiting for memory to be available.  when we are mapping an anon or uobj page
then we will be holding the lock for that page owner, and sleeping to wait
for memory with a page owner lock held is illegal because the pagedaemon
can wait for that lock, which will lead to deadlock.  fixes PR 56932.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/m68k/m68k/pmap_motorola.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/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.76 src/sys/arch/m68k/m68k/pmap_motorola.c:1.77
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.76	Sat Apr 16 18:15:21 2022
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Sun Jul 31 17:11:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.76 2022/04/16 18:15:21 andvar Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.77 2022/07/31 17:11:41 chs Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.76 2022/04/16 18:15:21 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.77 2022/07/31 17:11:41 chs Exp $");
 
 #include 
 #include 
@@ -2585,6 +2585,10 @@ pmap_enter_ptpage(pmap_t pmap, vaddr_t v
 	   va - vm_map_min(kernel_map),
 	   NULL, UVM_PGA_ZERO)) == NULL) {
 			rw_exit(uvm_kernel_object->vmobjlock);
+			if (can_fail) {
+pmap->pm_sref--;
+return ENOMEM;
+			}
 			uvm_wait("ptpage");
 			rw_enter(uvm_kernel_object->vmobjlock, RW_WRITER);
 		}



CVS commit: src/sys/arch/m68k/m68k

2022-07-31 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Jul 31 17:11:41 UTC 2022

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
in pmap_enter_ptpage(), if we are allowed to fail then fail rather than
waiting for memory to be available.  when we are mapping an anon or uobj page
then we will be holding the lock for that page owner, and sleeping to wait
for memory with a page owner lock held is illegal because the pagedaemon
can wait for that lock, which will lead to deadlock.  fixes PR 56932.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/m68k/m68k/pmap_motorola.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/arch/m68k/m68k

2022-07-28 Thread Tetsuya Isaki
At Tue, 26 Jul 2022 09:52:40 -0700,
Chuck Silvers wrote:
> > This commit breaks usr.sbin/crash on m68k.
> > curlwp is defined only in _KERNEL.  usr.sbin/crash defines _KMEMUSER
> > but not _KERNEL.
> > 
> > Would you look into?
> 
> I fixed it now, sorry about that.

Thank you!
---
Tetsuya Isaki 


Re: CVS commit: src/sys/arch/m68k/m68k

2022-07-26 Thread Chuck Silvers
On Tue, Jul 26, 2022 at 05:25:01PM +0900, Tetsuya Isaki wrote:
> At Mon, 25 Jul 2022 01:59:26 +,
> Chuck Silvers wrote:
> > Module Name:src
> > Committed By:   chs
> > Date:   Mon Jul 25 01:59:26 UTC 2022
> > 
> > Modified Files:
> > src/sys/arch/m68k/m68k: db_trace.c
> > 
> > Log Message:
> > use the pcb of the thread we are tracing rather than always curlwp.
> > 
> > 
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.59 -r1.60 src/sys/arch/m68k/m68k/db_trace.c
> 
> This commit breaks usr.sbin/crash on m68k.
> curlwp is defined only in _KERNEL.  usr.sbin/crash defines _KMEMUSER
> but not _KERNEL.
> 
> Would you look into?

I fixed it now, sorry about that.

-Chuck


CVS commit: src/sys/arch/m68k/m68k

2022-07-26 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Jul 26 16:51:42 UTC 2022

Modified Files:
src/sys/arch/m68k/m68k: db_trace.c

Log Message:
curlwp is only available for ifdef _KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/m68k/m68k/db_trace.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/m68k/m68k/db_trace.c
diff -u src/sys/arch/m68k/m68k/db_trace.c:1.60 src/sys/arch/m68k/m68k/db_trace.c:1.61
--- src/sys/arch/m68k/m68k/db_trace.c:1.60	Mon Jul 25 01:59:26 2022
+++ src/sys/arch/m68k/m68k/db_trace.c	Tue Jul 26 16:51:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.60 2022/07/25 01:59:26 chs Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.61 2022/07/26 16:51:42 chs Exp $	*/
 
 /* 
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.60 2022/07/25 01:59:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.61 2022/07/26 16:51:42 chs Exp $");
 
 #include 
 #include 
@@ -418,7 +418,9 @@ db_stack_trace_print(db_expr_t addr, boo
 		}
 	}
 
+#ifdef _KERNEL
 	l = curlwp;
+#endif
 	if (!have_addr)
 		stacktop(_regs, , pr);
 	else {
@@ -550,7 +552,7 @@ db_stack_trace_print(db_expr_t addr, boo
 		else
 			(*pr)(") + %lx\n", val);
 
-#if _KERNEL
+#ifdef _KERNEL
 		/*
 		 * Stop tracing if frame ptr no longer points into kernel
 		 * stack.



CVS commit: src/sys/arch/m68k/m68k

2022-07-26 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Jul 26 16:51:42 UTC 2022

Modified Files:
src/sys/arch/m68k/m68k: db_trace.c

Log Message:
curlwp is only available for ifdef _KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/m68k/m68k/db_trace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/arch/m68k/m68k

2022-07-26 Thread Tetsuya Isaki
At Mon, 25 Jul 2022 01:59:26 +,
Chuck Silvers wrote:
> Module Name:  src
> Committed By: chs
> Date: Mon Jul 25 01:59:26 UTC 2022
> 
> Modified Files:
>   src/sys/arch/m68k/m68k: db_trace.c
> 
> Log Message:
> use the pcb of the thread we are tracing rather than always curlwp.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.59 -r1.60 src/sys/arch/m68k/m68k/db_trace.c

This commit breaks usr.sbin/crash on m68k.
curlwp is defined only in _KERNEL.  usr.sbin/crash defines _KMEMUSER
but not _KERNEL.

Would you look into?

Thanks,
---
Tetsuya Isaki 



CVS commit: src/sys/arch/m68k/m68k

2022-07-24 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jul 25 01:59:26 UTC 2022

Modified Files:
src/sys/arch/m68k/m68k: db_trace.c

Log Message:
use the pcb of the thread we are tracing rather than always curlwp.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/m68k/m68k/db_trace.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/m68k/m68k/db_trace.c
diff -u src/sys/arch/m68k/m68k/db_trace.c:1.59 src/sys/arch/m68k/m68k/db_trace.c:1.60
--- src/sys/arch/m68k/m68k/db_trace.c:1.59	Sun Oct 18 17:13:32 2015
+++ src/sys/arch/m68k/m68k/db_trace.c	Mon Jul 25 01:59:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.59 2015/10/18 17:13:32 maxv Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.60 2022/07/25 01:59:26 chs Exp $	*/
 
 /* 
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.59 2015/10/18 17:13:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.60 2022/07/25 01:59:26 chs Exp $");
 
 #include 
 #include 
@@ -393,6 +393,7 @@ db_stack_trace_print(db_expr_t addr, boo
 	const char *	name;
 	struct stackpos pos;
 	struct pcb	*pcb;
+	struct lwp	*l;
 #ifdef _KERNEL
 	bool		kernel_only = true;
 #endif
@@ -417,12 +418,12 @@ db_stack_trace_print(db_expr_t addr, boo
 		}
 	}
 
+	l = curlwp;
 	if (!have_addr)
 		stacktop(_regs, , pr);
 	else {
 		if (trace_thread) {
 			struct proc *p;
-			struct lwp *l;
 
 			if (lwpaddr) {
 l = (struct lwp *)addr;
@@ -554,7 +555,7 @@ db_stack_trace_print(db_expr_t addr, boo
 		 * Stop tracing if frame ptr no longer points into kernel
 		 * stack.
 		 */
-		pcb = lwp_getpcb(curlwp);
+		pcb = lwp_getpcb(l);
 		if (kernel_only && !INKERNEL(pos.k_fp, pcb))
 			break;
 		if (nextframe(, pcb, kernel_only, pr) == 0)



CVS commit: src/sys/arch/m68k/m68k

2022-07-24 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jul 25 01:59:26 UTC 2022

Modified Files:
src/sys/arch/m68k/m68k: db_trace.c

Log Message:
use the pcb of the thread we are tracing rather than always curlwp.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/m68k/m68k/db_trace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/m68k/fpsp

2022-04-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Apr  8 14:33:24 UTC 2022

Modified Files:
src/sys/arch/m68k/fpsp: round.sa

Log Message:
s/postions/positions/


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/fpsp/round.sa

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/m68k/fpsp/round.sa
diff -u src/sys/arch/m68k/fpsp/round.sa:1.5 src/sys/arch/m68k/fpsp/round.sa:1.6
--- src/sys/arch/m68k/fpsp/round.sa:1.5	Fri Apr  8 10:17:53 2022
+++ src/sys/arch/m68k/fpsp/round.sa	Fri Apr  8 14:33:24 2022
@@ -1,4 +1,4 @@
-*	$NetBSD: round.sa,v 1.5 2022/04/08 10:17:53 andvar Exp $
+*	$NetBSD: round.sa,v 1.6 2022/04/08 14:33:24 andvar Exp $
 
 *	MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
 *	M68000 Hi-Performance Microprocessor Division
@@ -530,7 +530,7 @@ dnrm_lp:
 	beq.b	not_E3			;not type E3 exception
 	bfextu	WBTEMP_GRS(a6){6:3},d2	;extract guard,round, sticky  bit
 	move.l	#29,d0
-	lsl.l	d0,d2			;shift g,r,s to their postions
+	lsl.l	d0,d2			;shift g,r,s to their positions
 	move.l	d2,d0
 not_E3:
 	move.l	(sp)+,d2		;restore d2



  1   2   >