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/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/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/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/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/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/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/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/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/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/m68k

2019-10-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 26 17:50:18 UTC 2019

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

Log Message:
Add missing FALLTHROUGH (I am not 100% certain if this is correct), but
breaking/returning will end up printing nothing.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/m68k/m68k/db_disasm.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

2019-10-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 26 17:50:18 UTC 2019

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

Log Message:
Add missing FALLTHROUGH (I am not 100% certain if this is correct), but
breaking/returning will end up printing nothing.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/m68k/m68k/db_disasm.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_disasm.c
diff -u src/sys/arch/m68k/m68k/db_disasm.c:1.43 src/sys/arch/m68k/m68k/db_disasm.c:1.44
--- src/sys/arch/m68k/m68k/db_disasm.c:1.43	Wed Jul 10 23:49:51 2019
+++ src/sys/arch/m68k/m68k/db_disasm.c	Sat Oct 26 13:50:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.43 2019/07/11 03:49:51 msaitoh Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.44 2019/10/26 17:50:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.43 2019/07/11 03:49:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.44 2019/10/26 17:50:18 christos Exp $");
 
 #include 
 #ifdef _KERNEL
@@ -1493,6 +1493,7 @@ opcode_fpu(dis_buffer_t *dbuf, u_short o
 			return;
 
 		}
+		/* FALLTHROUGH */
 	/* cpBcc */
 	case 2:
 		if (BITFIELD(opc,5,0) == 0 && *(dbuf->val + 1) == 0) {