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

2021-04-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr 24 16:14:08 UTC 2021

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

Log Message:
Restore comments for f_stackadj and reenter_syscall().

Taken from sys/compat/linux/arch/m68k/linux_machdep.c which was
originally implemented to use reenter_syscall() for sigreturn of
Linux binaries.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/m68k/m68k/sig_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/sig_machdep.c
diff -u src/sys/arch/m68k/m68k/sig_machdep.c:1.50 src/sys/arch/m68k/m68k/sig_machdep.c:1.51
--- src/sys/arch/m68k/m68k/sig_machdep.c:1.50	Tue Nov 27 14:09:54 2018
+++ src/sys/arch/m68k/m68k/sig_machdep.c	Sat Apr 24 16:14:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig_machdep.c,v 1.50 2018/11/27 14:09:54 maxv Exp $	*/
+/*	$NetBSD: sig_machdep.c,v 1.51 2021/04/24 16:14:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.50 2018/11/27 14:09:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.51 2021/04/24 16:14:08 tsutsui Exp $");
 
 #define __M68K_SIGNAL_PRIVATE
 
@@ -236,7 +236,16 @@ cpu_getmcontext(struct lwp *l, mcontext_
 		(void)memcpy(>__mc_pad.__mc_frame.__mcf_exframe,
 		>F_u, (size_t)exframesize[format]);
 
-		/* Leave indicators, see above. */
+		/*
+		 * Leave indicators that we need to clean up the kernel
+		 * stack.  We do this by setting the "pad word" above the
+		 * hardware stack frame to the amount the stack must be
+		 * adjusted by.
+		 *
+		 * N.B. we increment rather than just set f_stackadj in
+		 * case we are called from syscall when processing a
+		 * sigreturn.  In that case, f_stackadj may be non-zero.
+		 */
 		frame->f_stackadj += exframesize[format];
 		frame->f_format = frame->f_vector = 0;
 	}
@@ -303,16 +312,26 @@ cpu_setmcontext(struct lwp *l, const mco
 			return (EINVAL);
 
 		if (frame->f_stackadj == 0) {
+			/*
+			 * Extra stack space is required but not allocated.
+			 * Allocate and re-enter syscall().
+			 */
 			reenter_syscall(frame, sz);
 			/* NOTREACHED */
 		}
 
 #ifdef DIAGNOSTIC
+		/* reenter_syscall() should adjust stack for the extra frame. */
 		if (sz != frame->f_stackadj)
 			panic("cpu_setmcontext: %d != %d",
 			sz, frame->f_stackadj);
 #endif
 
+		/*
+		 * Restore long stack frames.  Note that we do not copy
+		 * back the saved SR or PC, they were picked up below from
+		 * the sigcontext structure.
+		 */
 		frame->f_format = format;
 		frame->f_vector = mcp->__mc_pad.__mc_frame.__mcf_vector;
 		(void)memcpy(>F_u,



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

2021-04-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr 24 16:14:08 UTC 2021

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

Log Message:
Restore comments for f_stackadj and reenter_syscall().

Taken from sys/compat/linux/arch/m68k/linux_machdep.c which was
originally implemented to use reenter_syscall() for sigreturn of
Linux binaries.


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

2021-04-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Apr 16 00:13:48 UTC 2021

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

Log Message:
check the result value of pmap_extract() and panic if it fails.
this is a "should never fail" case, and GCC 10 noticed that it
allows an uninitialised variable use.

tested by rin@ on amiga and mac68k.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 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.73 src/sys/arch/m68k/m68k/pmap_motorola.c:1.74
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.73	Mon Feb  1 19:02:27 2021
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Fri Apr 16 00:13:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.73 2021/02/01 19:02:27 skrll Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.74 2021/04/16 00:13:48 mrg 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.73 2021/02/01 19:02:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.74 2021/04/16 00:13:48 mrg Exp $");
 
 #include 
 #include 
@@ -1667,7 +1667,11 @@ pmap_collect1(pmap_t pmap, paddr_t start
 		 * ST and Sysptmap entries.
 		 */
 
-		(void) pmap_extract(pmap, pv->pv_va, );
+		if (!pmap_extract(pmap, pv->pv_va, )) {
+			printf("collect: freeing KPT page at %lx (ste %x@%p)\n",
+			pv->pv_va, *pv->pv_ptste, pv->pv_ptste);
+			panic("pmap_collect: mapping not found");
+		}
 		pmap_remove_mapping(pmap, pv->pv_va, NULL,
 		PRM_TFLUSH|PRM_CFLUSH, NULL);
 



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

2021-04-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Apr 16 00:13:48 UTC 2021

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

Log Message:
check the result value of pmap_extract() and panic if it fails.
this is a "should never fail" case, and GCC 10 noticed that it
allows an uninitialised variable use.

tested by rin@ on amiga and mac68k.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 16:05:17 UTC 2021

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

Log Message:
Remove duplicate db_disasm() prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/m68k/db_disasm.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/m68k/db_disasm.h
diff -u src/sys/arch/m68k/m68k/db_disasm.h:1.9 src/sys/arch/m68k/m68k/db_disasm.h:1.10
--- src/sys/arch/m68k/m68k/db_disasm.h:1.9	Sat Mar 14 14:46:01 2009
+++ src/sys/arch/m68k/m68k/db_disasm.h	Tue Apr  6 16:05:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.h,v 1.9 2009/03/14 14:46:01 dsl Exp $	*/
+/*	$NetBSD: db_disasm.h,v 1.10 2021/04/06 16:05:17 simonb Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -424,5 +424,3 @@ typedef struct dis_buffer dis_buffer_t;
 #define PRINT_FPREG(dbuf, reg) addstr(dbuf, fpregs[reg])
 #define PRINT_DREG(dbuf, reg) addstr(dbuf, dregs[reg])
 #define PRINT_AREG(dbuf, reg) addstr(dbuf, aregs[reg])
-
-db_addr_t	db_disasm(db_addr_t loc, bool moto_syntax);



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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 16:05:17 UTC 2021

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

Log Message:
Remove duplicate db_disasm() prototype.


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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 16:04:44 UTC 2021

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

Log Message:
Include  to get ddb's db_disasm() prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 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.44 src/sys/arch/m68k/m68k/db_disasm.c:1.45
--- src/sys/arch/m68k/m68k/db_disasm.c:1.44	Sat Oct 26 17:50:18 2019
+++ src/sys/arch/m68k/m68k/db_disasm.c	Tue Apr  6 16:04:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.44 2019/10/26 17:50:18 christos Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.45 2021/04/06 16:04:44 simonb Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.44 2019/10/26 17:50:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.45 2021/04/06 16:04:44 simonb Exp $");
 
 #include 
 #ifdef _KERNEL
@@ -72,8 +72,9 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,
 
 #include 
 
-#include 
+#include 
 #include 
+#include 
 #include 
 
 static void	get_modregstr(dis_buffer_t *, int, int, int, int);



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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 16:04:44 UTC 2021

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

Log Message:
Include  to get ddb's db_disasm() prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 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

2021-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar  6 13:32:56 UTC 2021

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

Log Message:
Minimal (but hackish) change to make a DEBUG kernel compilable.


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

2021-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar  6 13:32:56 UTC 2021

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

Log Message:
Minimal (but hackish) change to make a DEBUG kernel compilable.


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

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

Modified files:

Index: src/sys/arch/m68k/m68k/m68k_trap.c
diff -u src/sys/arch/m68k/m68k/m68k_trap.c:1.2 src/sys/arch/m68k/m68k/m68k_trap.c:1.3
--- src/sys/arch/m68k/m68k/m68k_trap.c:1.2	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/m68k/m68k/m68k_trap.c	Sat Mar  6 13:32:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_trap.c,v 1.2 2019/04/06 03:06:26 thorpej Exp $	*/
+/*	$NetBSD: m68k_trap.c,v 1.3 2021/03/06 13:32:56 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_trap.c,v 1.2 2019/04/06 03:06:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_trap.c,v 1.3 2021/03/06 13:32:56 martin Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -91,6 +91,15 @@ extern int suline(void *, void *);	/* lo
 #define	KDFAULT(c)	(KDFAULT_060(c) || KDFAULT_040(c) || KDFAULT_OTH(c))
 #define	WRFAULT(c)	(WRFAULT_060(c) || WRFAULT_040(c) || WRFAULT_OTH(c))
 
+
+#ifdef DEBUG
+extern int mmudebug, mmupid;
+#define MDB_FOLLOW	1
+#define MDB_WBFOLLOW	2
+#define MDB_WBFAILED	4
+#define MDB_ISPID(pid)	((pid) == mmupid)
+#endif
+
 #ifdef M68040
 #ifdef DEBUG
 struct writebackstats {



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

2021-02-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Feb 23 16:54:17 UTC 2021

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

Log Message:
Plug kernel stack leaks in reenter_syscall() for setcontext(2).

This fixes long standing kernel crashes (MMU fault, address error,
and silent freeze by a double bus fault etc. seen for ~10 years)
caused by kernel stack overflow, especially on x68k and sun3 running
Xorg based servers.  See PR/55990 for more details.

"This change seems perfectly reasonable" from thorpej@ and
jklos@ also reported this also solved freeze of his mac68k system
with 10 megabyes of memory.

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


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/m68k/reenter_syscall.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/reenter_syscall.s
diff -u src/sys/arch/m68k/m68k/reenter_syscall.s:1.6 src/sys/arch/m68k/m68k/reenter_syscall.s:1.7
--- src/sys/arch/m68k/m68k/reenter_syscall.s:1.6	Sun Feb 21 07:23:41 2021
+++ src/sys/arch/m68k/m68k/reenter_syscall.s	Tue Feb 23 16:54:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: reenter_syscall.s,v 1.6 2021/02/21 07:23:41 tsutsui Exp $	*/
+/*	$NetBSD: reenter_syscall.s,v 1.7 2021/02/23 16:54:17 tsutsui Exp $	*/
 
 /*
  * Written by ITOH Yasufumi.
@@ -51,6 +51,19 @@ ENTRY_NOPROFILE(reenter_syscall)
 #endif
 	moveal	FR_SP(%sp),%a0		| grab and restore
 	movel	%a0,%usp		|   user SP
+	movw	FR_ADJ(%sp),%d0		| need to adjust stack?
+	jne	.Ladjstk		| yes, go to it
 	moveml	(%sp)+,#0x7FFF		| restore user registers
 	addql	#8,%sp			| pop SP and stack adjust
 	jra	_ASM_LABEL(rei)		| rte
+.Ladjstk:
+	lea	FR_HW(%sp),%a1		| pointer to HW frame
+	addql	#8,%a1			| source pointer
+	movl	%a1,%a0			| source
+	addw	%d0,%a0			|  + hole size = dest pointer
+	movl	-(%a1),-(%a0)		| copy
+	movl	-(%a1),-(%a0)		|  8 bytes
+	movl	%a0,FR_SP(%sp)		| new SSP
+	moveml	(%sp)+,#0x7FFF		| restore user register
+	movl	(%sp),%sp		| and do real RTE
+	jra	_ASM_LABEL(rei)		| rte



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

2021-02-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Feb 23 16:54:17 UTC 2021

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

Log Message:
Plug kernel stack leaks in reenter_syscall() for setcontext(2).

This fixes long standing kernel crashes (MMU fault, address error,
and silent freeze by a double bus fault etc. seen for ~10 years)
caused by kernel stack overflow, especially on x68k and sun3 running
Xorg based servers.  See PR/55990 for more details.

"This change seems perfectly reasonable" from thorpej@ and
jklos@ also reported this also solved freeze of his mac68k system
with 10 megabyes of memory.

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


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

2021-02-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb 21 07:23:41 UTC 2021

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

Log Message:
Consistently use motorola style.  No binary changes.

Seems missed in rev 1.3:
 https://mail-index.netbsd.org/source-changes/2013/08/01/msg046378.html


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/m68k/reenter_syscall.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/reenter_syscall.s
diff -u src/sys/arch/m68k/m68k/reenter_syscall.s:1.5 src/sys/arch/m68k/m68k/reenter_syscall.s:1.6
--- src/sys/arch/m68k/m68k/reenter_syscall.s:1.5	Sat Feb 20 18:04:20 2021
+++ src/sys/arch/m68k/m68k/reenter_syscall.s	Sun Feb 21 07:23:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: reenter_syscall.s,v 1.5 2021/02/20 18:04:20 tsutsui Exp $	*/
+/*	$NetBSD: reenter_syscall.s,v 1.6 2021/02/21 07:23:41 tsutsui Exp $	*/
 
 /*
  * Written by ITOH Yasufumi.
@@ -39,17 +39,17 @@ ENTRY_NOPROFILE(reenter_syscall)
 .Lcpfr:	movel	(%a0)+,(%a1)+
 	dbra	%d0,.Lcpfr
 
-	movew	%d1,%sp@(FR_ADJ)	| set stack adjust count
+	movew	%d1,FR_ADJ(%sp)		| set stack adjust count
 	movel	(%sp),-(%sp)		| push syscall no (original d0 value)
 	jbsr	_C_LABEL(syscall)	| re-enter syscall()
 	addql	#4,%sp			| pop syscall no
 #ifdef DEBUG
-	tstw	%sp@(FR_ADJ)		| stack adjust must be zero
+	tstw	FR_ADJ(%sp)		| stack adjust must be zero
 	jeq	.Ladjzero
 	PANIC("reenter_syscall")
 .Ladjzero:
 #endif
-	moveal	%sp@(FR_SP),%a0		| grab and restore
+	moveal	FR_SP(%sp),%a0		| grab and restore
 	movel	%a0,%usp		|   user SP
 	moveml	(%sp)+,#0x7FFF		| restore user registers
 	addql	#8,%sp			| pop SP and stack adjust



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

2021-02-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb 21 07:23:41 UTC 2021

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

Log Message:
Consistently use motorola style.  No binary changes.

Seems missed in rev 1.3:
 https://mail-index.netbsd.org/source-changes/2013/08/01/msg046378.html


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

2021-02-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 20 18:04:20 UTC 2021

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

Log Message:
Replace magic numbers with proper macros prepared in assym.h.

No binary changes.
Note this is a preparation for a possible fix of PR port-m68k/55990.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/m68k/m68k/reenter_syscall.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/reenter_syscall.s
diff -u src/sys/arch/m68k/m68k/reenter_syscall.s:1.4 src/sys/arch/m68k/m68k/reenter_syscall.s:1.5
--- src/sys/arch/m68k/m68k/reenter_syscall.s:1.4	Sat Sep  7 19:06:29 2013
+++ src/sys/arch/m68k/m68k/reenter_syscall.s	Sat Feb 20 18:04:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: reenter_syscall.s,v 1.4 2013/09/07 19:06:29 chs Exp $	*/
+/*	$NetBSD: reenter_syscall.s,v 1.5 2021/02/20 18:04:20 tsutsui Exp $	*/
 
 /*
  * Written by ITOH Yasufumi.
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include "assym.h"
 
 /*
  * void reenter_syscall(struct frame *fp, int stkadj)
@@ -38,17 +39,17 @@ ENTRY_NOPROFILE(reenter_syscall)
 .Lcpfr:	movel	(%a0)+,(%a1)+
 	dbra	%d0,.Lcpfr
 
-	movew	%d1,%sp@(16*4+2)	| set stack adjust count
+	movew	%d1,%sp@(FR_ADJ)	| set stack adjust count
 	movel	(%sp),-(%sp)		| push syscall no (original d0 value)
 	jbsr	_C_LABEL(syscall)	| re-enter syscall()
 	addql	#4,%sp			| pop syscall no
 #ifdef DEBUG
-	tstw	%sp@(16*4+2)		| stack adjust must be zero
+	tstw	%sp@(FR_ADJ)		| stack adjust must be zero
 	jeq	.Ladjzero
 	PANIC("reenter_syscall")
 .Ladjzero:
 #endif
-	moveal	%sp@(15*4),%a0		| grab and restore
+	moveal	%sp@(FR_SP),%a0		| grab and restore
 	movel	%a0,%usp		|   user SP
 	moveml	(%sp)+,#0x7FFF		| restore user registers
 	addql	#8,%sp			| pop SP and stack adjust



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

2021-02-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 20 18:04:20 UTC 2021

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

Log Message:
Replace magic numbers with proper macros prepared in assym.h.

No binary changes.
Note this is a preparation for a possible fix of PR port-m68k/55990.


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

2020-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 21:39:24 UTC 2020

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

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.35 src/sys/arch/m68k/m68k/bus_dma.c:1.36
--- src/sys/arch/m68k/m68k/bus_dma.c:1.35	Fri Oct 25 09:46:10 2013
+++ src/sys/arch/m68k/m68k/bus_dma.c	Sat Dec 19 21:39:24 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.35 2013/10/25 09:46:10 martin Exp $ */
+/* $NetBSD: bus_dma.c,v 1.36 2020/12/19 21:39:24 thorpej Exp $ */
 
 /*
  * This file was taken from from alpha/common/bus_dma.c
@@ -41,13 +41,13 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2013/10/25 09:46:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.36 2020/12/19 21:39:24 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -63,6 +63,14 @@ int	_bus_dmamap_load_buffer_direct_commo
 	bus_dmamap_t, void *, bus_size_t, struct vmspace *, int,
 	paddr_t *, int *, int);
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct m68k_bus_dmamap) +
+	   (sizeof(bus_dma_segment_t) * (nsegments - 1));
+}  
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -73,7 +81,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct m68k_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map
@@ -87,13 +94,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct m68k_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	if ((mapstore = malloc(mapsize, M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return ENOMEM;
 
-	memset(mapstore, 0, mapsize);
 	map = (struct m68k_bus_dmamap *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -119,7 +123,7 @@ void
 _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
 {
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*



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

2020-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 21:39:24 UTC 2020

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

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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

2020-08-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 10 09:38:48 UTC 2020

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

Log Message:
Forbid to set odd address to PC in process_write_regs() and process_set_pc().

Otherwise, address error occurs in kernel at rte instruction when returning
to the user level.

Found by tests/lib/libc/t_ptrace_*:access_regs_set_unaligned_pc_0x[137].


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/m68k/m68k/process_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/process_machdep.c
diff -u src/sys/arch/m68k/m68k/process_machdep.c:1.30 src/sys/arch/m68k/m68k/process_machdep.c:1.31
--- src/sys/arch/m68k/m68k/process_machdep.c:1.30	Sat Jan  4 00:10:02 2014
+++ src/sys/arch/m68k/m68k/process_machdep.c	Mon Aug 10 09:38:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.30 2014/01/04 00:10:02 dsl Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.31 2020/08/10 09:38:48 rin Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.30 2014/01/04 00:10:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.31 2020/08/10 09:38:48 rin Exp $");
 
 #include 
 #include 
@@ -114,13 +114,10 @@ process_write_regs(struct lwp *l, const 
 	struct frame *frame = process_frame(l);
 
 	/*
-	 * in the hp300 machdep.c _write_regs, PC alignment wasn't
-	 * checked.  If an odd address is placed in the PC and the
-	 * program is allowed to run, it will cause an Address Error
-	 * which will be transmitted to the process by a SIGBUS.
-	 * No reasonable debugger would let this happen, but
-	 * it's not our problem.
+	 * Avoid kernel address error at rte instruction.
 	 */
+	if (regs->r_pc & 1)
+		return EINVAL;
 
 	/*
 	 * XXX
@@ -171,14 +168,10 @@ process_set_pc(struct lwp *l, void *addr
 	struct frame *frame = process_frame(l);
 
 	/*
-	 * in the hp300 machdep.c _set_pc, PC alignment is guaranteed
-	 * by chopping off the low order bit of the new pc.
-	 * If an odd address was placed in the PC and the program
-	 * is allowed to run, it will cause an Address Error
-	 * which will be transmitted to the process by a SIGBUS.
-	 * No reasonable debugger would let this happen, but
-	 * it's not our problem.
+	 * Avoid kernel address error at rte instruction.
 	 */
+	if ((u_int)addr & 1)
+		return EINVAL;
 	frame->f_pc = (u_int)addr;
 
 	return 0;



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

2020-08-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 10 09:38:48 UTC 2020

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

Log Message:
Forbid to set odd address to PC in process_write_regs() and process_set_pc().

Otherwise, address error occurs in kernel at rte instruction when returning
to the user level.

Found by tests/lib/libc/t_ptrace_*:access_regs_set_unaligned_pc_0x[137].


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

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



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

2019-04-11 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 12 03:29:24 UTC 2019

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

Log Message:
Fix an asm-comments-vs-preprocessor-line-continuations mistake in
UFETCH_PROLOGUE and USTORE_PROLOGUE that caused a couple of important
instructions to be omitted, resulting in a fatal trap.

Thanks isaki@ for finding my mistake and providing the fix!


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/m68k/m68k/copy.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/copy.s
diff -u src/sys/arch/m68k/m68k/copy.s:1.47 src/sys/arch/m68k/m68k/copy.s:1.48
--- src/sys/arch/m68k/m68k/copy.s:1.47	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/m68k/m68k/copy.s	Fri Apr 12 03:29:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.s,v 1.47 2019/04/06 03:06:26 thorpej Exp $	*/
+/*	$NetBSD: copy.s,v 1.48 2019/04/12 03:29:24 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2019 The NetBSD Foundation, Inc.
@@ -364,8 +364,8 @@ ENTRY(kcopy)
 
 #define	UFETCH_PROLOGUE			\
 	CHECK_SFC		;	\
-	movl	4(%sp),%a0		| address to read	;	\
-	GETCURPCB(%a1)			| a1 = curpcb		;	\
+	movl	4(%sp),%a0		/* address to read */	;	\
+	GETCURPCB(%a1)			/* a1 = curpcb */	;	\
 	movl	#.Lufetchstore_fault,PCB_ONFAULT(%a1)
 
 /* LINTSTUB: _ufetch_8(const uint8_t *uaddr, uint8_t *valp); */
@@ -394,8 +394,8 @@ ENTRY(_ufetch_32)
 
 #define	USTORE_PROLOGUE			\
 	CHECK_DFC		;	\
-	movl	4(%sp),%a0		| address to write	;	\
-	GETCURPCB(%a1)			| a1 = curpcb		;	\
+	movl	4(%sp),%a0		/* address to write */	;	\
+	GETCURPCB(%a1)			/* a1 = curpcb */	;	\
 	movl	#.Lufetchstore_fault,PCB_ONFAULT(%a1)
 
 /* LINTSTUB: _ustore_8(uint8_t *uaddr, uint8_t val); */



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

2019-04-11 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 12 03:29:24 UTC 2019

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

Log Message:
Fix an asm-comments-vs-preprocessor-line-continuations mistake in
UFETCH_PROLOGUE and USTORE_PROLOGUE that caused a couple of important
instructions to be omitted, resulting in a fatal trap.

Thanks isaki@ for finding my mistake and providing the fix!


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

2019-02-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb  5 07:18:52 UTC 2019

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

Log Message:
add fallthru comment.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 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-02-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb  5 07:18:52 UTC 2019

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

Log Message:
add fallthru comment.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 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.41 src/sys/arch/m68k/m68k/db_disasm.c:1.42
--- src/sys/arch/m68k/m68k/db_disasm.c:1.41	Sun Sep 21 16:32:51 2014
+++ src/sys/arch/m68k/m68k/db_disasm.c	Tue Feb  5 07:18:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.41 2014/09/21 16:32:51 christos Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.42 2019/02/05 07:18:52 mrg Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.41 2014/09/21 16:32:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.42 2019/02/05 07:18:52 mrg Exp $");
 
 #include 
 #ifdef _KERNEL
@@ -1500,6 +1500,7 @@ opcode_fpu(dis_buffer_t *dbuf, u_short o
 			addstr (dbuf, "fnop");
 			return;
 		}
+		/* FALLTHROUGH */
 	case 3:
 		addstr(dbuf, "fb");
 		print_fcond(dbuf, BITFIELD(opc,5,0));



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

2018-10-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Oct  2 18:37:32 UTC 2018

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

Log Message:
fix diagnostic build.

XXX: pullup-7, pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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

2018-10-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Oct  2 18:37:32 UTC 2018

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

Log Message:
fix diagnostic build.

XXX: pullup-7, pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 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.32 src/sys/arch/m68k/m68k/switch_subr.s:1.33
--- src/sys/arch/m68k/m68k/switch_subr.s:1.32	Mon Oct 14 12:20:05 2013
+++ src/sys/arch/m68k/m68k/switch_subr.s	Tue Oct  2 18:37:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: switch_subr.s,v 1.32 2013/10/14 12:20:05 isaki Exp $	*/
+/*	$NetBSD: switch_subr.s,v 1.33 2018/10/02 18:37:31 mrg Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation.
@@ -151,7 +151,7 @@ ENTRY(cpu_switchto)
 	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
+	jeq	.Lcpu_switch_badsw	| panic
 #endif
 	pea	(%a0)			| save newlwp
 #if !defined(_SUN3X_) || defined(PMAP_DEBUG)



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

2015-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar  7 18:54:57 UTC 2015

Modified Files:
src/sys/arch/m68k/m68k: linux_syscall.c m68k_syscall.c sunos_syscall.c

Log Message:
adjust to new trace_{enter,exit} signatures.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/m68k/linux_syscall.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/m68k/m68k/m68k_syscall.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/m68k/sunos_syscall.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/linux_syscall.c
diff -u src/sys/arch/m68k/m68k/linux_syscall.c:1.23 src/sys/arch/m68k/m68k/linux_syscall.c:1.24
--- src/sys/arch/m68k/m68k/linux_syscall.c:1.23	Mon Mar 24 16:06:32 2014
+++ src/sys/arch/m68k/m68k/linux_syscall.c	Sat Mar  7 13:54:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_syscall.c,v 1.23 2014/03/24 20:06:32 christos Exp $	*/
+/*	$NetBSD: linux_syscall.c,v 1.24 2015/03/07 18:54:57 christos Exp $	*/
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_syscall.c,v 1.23 2014/03/24 20:06:32 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_syscall.c,v 1.24 2015/03/07 18:54:57 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_execfmt.h
@@ -216,7 +216,7 @@ linux_syscall_fancy(register_t code, str
 		break;
 	}
 
-	if ((error = trace_enter(code, args, callp-sy_narg)) != 0)
+	if ((error = trace_enter(code, callp, args)) != 0)
 		goto out;
 
 	rval[0] = 0;
@@ -252,5 +252,5 @@ out:
 		break;
 	}
 
-	trace_exit(code, rval, error);
+	trace_exit(code, callp, args, rval, error);
 }

Index: src/sys/arch/m68k/m68k/m68k_syscall.c
diff -u src/sys/arch/m68k/m68k/m68k_syscall.c:1.49 src/sys/arch/m68k/m68k/m68k_syscall.c:1.50
--- src/sys/arch/m68k/m68k/m68k_syscall.c:1.49	Fri Oct 25 16:45:35 2013
+++ src/sys/arch/m68k/m68k/m68k_syscall.c	Sat Mar  7 13:54:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_syscall.c,v 1.49 2013/10/25 20:45:35 martin Exp $	*/
+/*	$NetBSD: m68k_syscall.c,v 1.50 2015/03/07 18:54:57 christos Exp $	*/
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: m68k_syscall.c,v 1.49 2013/10/25 20:45:35 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: m68k_syscall.c,v 1.50 2015/03/07 18:54:57 christos Exp $);
 
 #include opt_execfmt.h
 #include opt_compat_netbsd.h
@@ -335,7 +335,7 @@ syscall_fancy(register_t code, struct lw
 			goto bad;
 	}
 
-	if ((error = trace_enter(code, args, callp-sy_narg)) != 0)
+	if ((error = trace_enter(code, callp, args)) != 0)
 		goto out;
 
 	rval[0] = 0;
@@ -387,7 +387,7 @@ out:
 		break;
 	}
 
-	trace_exit(code, rval, error);
+	trace_exit(code, callp, args, rval, error);
 }
 
 void

Index: src/sys/arch/m68k/m68k/sunos_syscall.c
diff -u src/sys/arch/m68k/m68k/sunos_syscall.c:1.22 src/sys/arch/m68k/m68k/sunos_syscall.c:1.23
--- src/sys/arch/m68k/m68k/sunos_syscall.c:1.22	Tue Feb  8 15:20:16 2011
+++ src/sys/arch/m68k/m68k/sunos_syscall.c	Sat Mar  7 13:54:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunos_syscall.c,v 1.22 2011/02/08 20:20:16 rmind Exp $	*/
+/*	$NetBSD: sunos_syscall.c,v 1.23 2015/03/07 18:54:57 christos Exp $	*/
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sunos_syscall.c,v 1.22 2011/02/08 20:20:16 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: sunos_syscall.c,v 1.23 2015/03/07 18:54:57 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_execfmt.h
@@ -273,7 +273,7 @@ sunos_syscall_fancy(register_t code, str
 			goto bad;
 	}
 
-	if ((error = trace_enter(code, args, callp-sy_narg)) != 0)
+	if ((error = trace_enter(code, callp, args)) != 0)
 		goto out;
 
 	rval[0] = 0;
@@ -315,5 +315,5 @@ out:
 			frame-f_regs[SP] -= sizeof (int);
 	}
 
-	trace_exit(code, rval, error);
+	trace_exit(code, callp, args, rval, error);
 }



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

2015-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar  7 18:54:57 UTC 2015

Modified Files:
src/sys/arch/m68k/m68k: linux_syscall.c m68k_syscall.c sunos_syscall.c

Log Message:
adjust to new trace_{enter,exit} signatures.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/m68k/linux_syscall.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/m68k/m68k/m68k_syscall.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/m68k/sunos_syscall.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

2014-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 21 16:32:51 UTC 2014

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

Log Message:
fix cut-n-paste


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 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.40 src/sys/arch/m68k/m68k/db_disasm.c:1.41
--- src/sys/arch/m68k/m68k/db_disasm.c:1.40	Sat Oct 19 15:13:51 2013
+++ src/sys/arch/m68k/m68k/db_disasm.c	Sun Sep 21 12:32:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.40 2013/10/19 19:13:51 martin Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.41 2014/09/21 16:32:51 christos Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.40 2013/10/19 19:13:51 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.41 2014/09/21 16:32:51 christos Exp $);
 
 #include sys/param.h
 #ifdef _KERNEL
@@ -1189,7 +1189,7 @@ opcode_1000(dis_buffer_t *dbuf, u_short 
 		addstr(dbuf, @-,);
 		PRINT_AREG(dbuf,BITFIELD(opc,11,9));
 		addstr(dbuf, @-);
-	} else if (IS_INST(SBCDA,opc)) {
+	} else if (IS_INST(SBCDD,opc)) {
 		addstr(dbuf, sbcd\t);
 		PRINT_DREG(dbuf,BITFIELD(opc,2,0));
 		addchar(',');
@@ -1247,7 +1247,7 @@ opcode_1100(dis_buffer_t *dbuf, u_short 
 		addstr(dbuf, @-,);
 		PRINT_AREG(dbuf,BITFIELD(opc,11,9));
 		addstr(dbuf, @-);
-	} else if (IS_INST(ABCDA,opc)) {
+	} else if (IS_INST(ABCDD,opc)) {
 		addstr(dbuf, abcd\t);
 		PRINT_DREG(dbuf,BITFIELD(opc,2,0));
 		addchar(',');



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

2014-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 21 16:32:51 UTC 2014

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

Log Message:
fix cut-n-paste


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 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

2014-03-29 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sat Mar 29 11:34:13 UTC 2014

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

Log Message:
procfs_getcpuinfstr's len argument contains the buffer size on entry,
and the number of bytes used on return.  Use the actual buffer size in a
snprintf call, instead of sizeof(*buf), which is always 1.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/m68k/procfs_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/procfs_machdep.c
diff -u src/sys/arch/m68k/m68k/procfs_machdep.c:1.5 src/sys/arch/m68k/m68k/procfs_machdep.c:1.6
--- src/sys/arch/m68k/m68k/procfs_machdep.c:1.5	Sat Jul 22 06:58:17 2006
+++ src/sys/arch/m68k/m68k/procfs_machdep.c	Sat Mar 29 11:34:13 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: procfs_machdep.c,v 1.5 2006/07/22 06:58:17 tsutsui Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.6 2014/03/29 11:34:13 apb Exp $ */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: procfs_machdep.c,v 1.5 2006/07/22 06:58:17 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: procfs_machdep.c,v 1.6 2014/03/29 11:34:13 apb Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -19,8 +19,7 @@ int
 procfs_getcpuinfstr(char *buf, int *len)
 {
 	const char *cpu, *mmu, *fpu;
-
-	*len = 0;
+	int maxlen = *len;
 
 	switch (cputype) {
 	case CPU_68020:
@@ -79,7 +78,7 @@ procfs_getcpuinfstr(char *buf, int *len)
 		break;
 	}
 
-	*len = snprintf(buf, sizeof(buf),
+	*len = snprintf(buf, maxlen,
 	/* as seen in Linux 2.4.27 */
 	CPU:\t\t%s\n
 	MMU:\t\t%s\n



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

2014-03-29 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sat Mar 29 11:34:13 UTC 2014

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

Log Message:
procfs_getcpuinfstr's len argument contains the buffer size on entry,
and the number of bytes used on return.  Use the actual buffer size in a
snprintf call, instead of sizeof(*buf), which is always 1.


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

2014-03-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 15 09:22:37 UTC 2014

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

Log Message:
Add a common source of m68k bus error and address error handlers.

This will be included from each MD locore.s as other common m68k
asm files like trap_subr.s and support.s etc.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 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.

Added files:

Index: src/sys/arch/m68k/m68k/busaddrerr.s
diff -u /dev/null src/sys/arch/m68k/m68k/busaddrerr.s:1.1
--- /dev/null	Sat Mar 15 09:22:37 2014
+++ src/sys/arch/m68k/m68k/busaddrerr.s	Sat Mar 15 09:22:36 2014
@@ -0,0 +1,272 @@
+/*	$NetBSD: busaddrerr.s,v 1.1 2014/03/15 09:22:36 tsutsui Exp $	*/
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * 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
+ */
+
+/*
+ * bus error and address error handler routines common to all m68k ports.
+ */
+
+/*
+ * NOTICE: This is not a standalone file.  To use it, #include it in
+ * your port's locore.s, like so:
+ *
+ *	#include m68k/m68k/busaddrerr.s
+ */
+
+/* assume M68K_MMU_MOTOROLA is default if none is defined */
+#if !defined(M68K_MMU_MOTOROLA)  !defined(M68K_MMU_HP)
+#define M68K_MMU_MOTOROLA
+#endif
+
+/*
+ * address error handler for 68040/68060
+ */
+#if defined(M68040) || defined(M68060)
+ENTRY_NOPROFILE(addrerr4060)
+	clrl	%sp@-			| stack adjust count
+	moveml	%d0-%d7/%a0-%a7,%sp@-	| save user registers
+	movl	%usp,%a0		| save the user SP
+	movl	%a0,%sp@(FR_SP)		|   in the savearea
+	movl	%sp@(FR_HW+8),%sp@-
+	clrl	%sp@-			| dummy code
+	movl	#T_ADDRERR,%sp@-	| mark address error
+	jra	_ASM_LABEL(faultstkadj)	| and deal with it
+#endif
+
+/*
+ * bus error handler for 68060
+ */
+#if defined(M68060)
+ENTRY_NOPROFILE(buserr60)
+	clrl	%sp@-			| stack adjust count
+	moveml	%d0-%d7/%a0-%a7,%sp@-	| save user registers
+	movl	%usp,%a0		| save the user SP
+	movl	%a0,%sp@(FR_SP)		|   in the savearea
+	movel	%sp@(FR_HW+12),%d0	| FSLW
+	btst	#2,%d0			| branch prediction error?
+	jeq	Lnobpe
+	movc	%cacr,%d2
+	orl	#IC60_CABC,%d2		| clear all branch cache entries
+	movc	%d2,%cacr
+	movl	%d0,%d1
+#if defined(amiga) || defined(atari)
+	addql	#1,L60bpe
+#endif
+	andl	#0x7ffd,%d1		| check other faults
+	jeq	_ASM_LABEL(faultstkadjnotrap2)
+Lnobpe:
+| we need to adjust for misaligned addresses
+	movl	%sp@(FR_HW+8),%d1	| grab VA
+	btst	#27,%d0			| check for mis-aligned access
+	jeq	Lberr3			| no, skip
+	addl	#28,%d1			| yes, get into next page
+	| operand case: 3,
+	| instruction case: 4+12+12
+	| XXX instr. case not done yet
+	andl	#PG_FRAME,%d1		| and truncate
+Lberr3:
+	movl	%d1,%sp@-
+	movl	%d0,%sp@-		| code is FSLW now.
+	andw	#0x1f80,%d0
+	jeq	Lberr60			| it is a bus error
+	movl	#T_MMUFLT,%sp@-		| show that we are an MMU fault
+	jra	_ASM_LABEL(faultstkadj)	| and deal with it
+Lberr60:
+	tstl	_C_LABEL(nofault)	| catch bus error?
+	jeq	Lisberr			| no, handle as usual
+#ifdef mac68k
+	movl	%a2,_C_LABEL(mac68k_a2_fromfault) | save %a2
+	movl	%sp@(FR_HW+8+8),_C_LABEL(m68k_fault_addr) 

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

2013-11-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  7 01:49:46 UTC 2013

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

Log Message:
add ifdefs for kernel only variable


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 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.57 src/sys/arch/m68k/m68k/db_trace.c:1.58
--- src/sys/arch/m68k/m68k/db_trace.c:1.57	Tue Jan 31 16:17:57 2012
+++ src/sys/arch/m68k/m68k/db_trace.c	Wed Nov  6 20:49:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.57 2012/01/31 21:17:57 mlelstv Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.58 2013/11/07 01:49:46 christos Exp $	*/
 
 /* 
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.57 2012/01/31 21:17:57 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.58 2013/11/07 01:49:46 christos Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -393,7 +393,9 @@ db_stack_trace_print(db_expr_t addr, boo
 	const char *	name;
 	struct stackpos pos;
 	struct pcb	*pcb;
+#ifdef _KERNEL
 	bool		kernel_only = true;
+#endif
 	bool		trace_thread = false;
 	bool		lwpaddr = false;
 	int		fault_pc = 0;
@@ -408,8 +410,10 @@ db_stack_trace_print(db_expr_t addr, boo
 trace_thread = true;
 			} else if (c == 't')
 trace_thread = true;
+#ifdef _KERNEL
 			else if (c == 'u')
 kernel_only = false;
+#endif
 	}
 
 	if (!have_addr)



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

2013-11-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  7 01:49:46 UTC 2013

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

Log Message:
add ifdefs for kernel only variable


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 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

2013-10-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 25 20:45:35 UTC 2013

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

Log Message:
Mark a diagnostic-only variable


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/m68k/m68k/m68k_syscall.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_syscall.c
diff -u src/sys/arch/m68k/m68k/m68k_syscall.c:1.48 src/sys/arch/m68k/m68k/m68k_syscall.c:1.49
--- src/sys/arch/m68k/m68k/m68k_syscall.c:1.48	Sun Feb 19 21:06:14 2012
+++ src/sys/arch/m68k/m68k/m68k_syscall.c	Fri Oct 25 20:45:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_syscall.c,v 1.48 2012/02/19 21:06:14 rmind Exp $	*/
+/*	$NetBSD: m68k_syscall.c,v 1.49 2013/10/25 20:45:35 martin Exp $	*/
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: m68k_syscall.c,v 1.48 2012/02/19 21:06:14 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: m68k_syscall.c,v 1.49 2013/10/25 20:45:35 martin Exp $);
 
 #include opt_execfmt.h
 #include opt_compat_netbsd.h
@@ -414,7 +414,7 @@ startlwp(void *arg)
 	ucontext_t *uc = arg;
 	lwp_t *l = curlwp;
 	struct frame *f = (struct frame *)l-l_md.md_regs;
-	int error;
+	int error __diagused;
 
 	f-f_regs[D0] = 0;
 	f-f_sr = ~PSL_C;



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

2013-10-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 25 20:51:14 UTC 2013

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

Log Message:
Mark a potentialy unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 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.66 src/sys/arch/m68k/m68k/pmap_motorola.c:1.67
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.66	Mon Jul  9 19:23:45 2012
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Fri Oct 25 20:51:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.66 2012/07/09 19:23:45 rkujawa Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.67 2013/10/25 20:51:14 martin Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_motorola.c,v 1.66 2012/07/09 19:23:45 rkujawa Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_motorola.c,v 1.67 2013/10/25 20:51:14 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -939,7 +939,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v
 {
 	vaddr_t nssva;
 	pt_entry_t *pte;
-	bool firstpage, needtflush;
+	bool firstpage __unused, needtflush;
 	int isro;
 
 	PMAP_DPRINTF(PDB_FOLLOW|PDB_PROTECT,



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

2013-10-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 25 20:53:02 UTC 2013

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

Log Message:
Mark a potentially unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 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/vm_machdep.c
diff -u src/sys/arch/m68k/m68k/vm_machdep.c:1.38 src/sys/arch/m68k/m68k/vm_machdep.c:1.39
--- src/sys/arch/m68k/m68k/vm_machdep.c:1.38	Sun Feb 19 21:06:15 2012
+++ src/sys/arch/m68k/m68k/vm_machdep.c	Fri Oct 25 20:53:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.38 2012/02/19 21:06:15 rmind Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.39 2013/10/25 20:53:02 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.38 2012/02/19 21:06:15 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.39 2013/10/25 20:53:02 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -149,7 +149,7 @@ cpu_lwp_free2(struct lwp *l)
 int
 vmapbuf(struct buf *bp, vsize_t len)
 {
-	struct pmap *upmap, *kpmap;
+	struct pmap *upmap, *kpmap __unused;
 	vaddr_t uva;		/* User VA (map from) */
 	vaddr_t kva;		/* Kernel VA (new to) */
 	paddr_t pa; 		/* physical address */



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

2013-10-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 25 20:45:35 UTC 2013

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

Log Message:
Mark a diagnostic-only variable


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

2013-10-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 25 20:51:14 UTC 2013

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

Log Message:
Mark a potentialy unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 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

2013-10-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 19 19:03:30 UTC 2013

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

Log Message:
Mark a variable that is only tested in DIAGNOSTIC kernels as potentially
unused.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 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.33 src/sys/arch/m68k/m68k/bus_dma.c:1.34
--- src/sys/arch/m68k/m68k/bus_dma.c:1.33	Wed Jul 11 17:13:30 2012
+++ src/sys/arch/m68k/m68k/bus_dma.c	Sat Oct 19 19:03:30 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.33 2012/07/11 17:13:30 rkujawa Exp $ */
+/* $NetBSD: bus_dma.c,v 1.34 2013/10/19 19:03:30 martin Exp $ */
 
 /*
  * This file was taken from from alpha/common/bus_dma.c
@@ -41,7 +41,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.33 2012/07/11 17:13:30 rkujawa Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.34 2013/10/19 19:03:30 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -138,7 +138,7 @@ _bus_dmamap_load_buffer_direct_common(bu
 	vaddr_t vaddr = (vaddr_t)buf;
 	int seg, cacheable, coherent;
 	pmap_t pmap;
-	bool rv;
+	bool rv __unused;
 
 	coherent = BUS_DMA_COHERENT;
 	lastaddr = *lastaddrp;



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

2013-10-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 19 19:13:51 UTC 2013

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

Log Message:
Remove unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 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.39 src/sys/arch/m68k/m68k/db_disasm.c:1.40
--- src/sys/arch/m68k/m68k/db_disasm.c:1.39	Tue Jan 31 21:17:57 2012
+++ src/sys/arch/m68k/m68k/db_disasm.c	Sat Oct 19 19:13:51 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.39 2012/01/31 21:17:57 mlelstv Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.40 2013/10/19 19:13:51 martin Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.39 2012/01/31 21:17:57 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.40 2013/10/19 19:13:51 martin Exp $);
 
 #include sys/param.h
 #ifdef _KERNEL
@@ -849,7 +849,7 @@ opcode_0101(dis_buffer_t *dbuf, u_short 
 static void
 opcode_branch(dis_buffer_t *dbuf, u_short opc)
 {
-	int disp, sz;
+	int disp;
 
 	if (IS_INST(BRA,opc))
 		addstr(dbuf, bra);
@@ -863,20 +863,17 @@ opcode_branch(dis_buffer_t *dbuf, u_shor
 		/* 16-bit signed displacement */
 		disp = *(dbuf-val + 1);
 		dbuf-used++;
-		sz = SIZE_WORD;
 		addchar('w');
 	} else if (disp == 0xff) {
 		/* 32-bit signed displacement */
 		disp = *(long *)(dbuf-val + 1);
 		dbuf-used += 2;
-		sz = SIZE_LONG;
 		addchar('l');
 	} else {
 		/* 8-bit signed displacement in opcode. */
 		/* Needs to be sign-extended... */
 		if (ISBITSET(disp,7))
 			disp -= 256;
-		sz = SIZE_BYTE;
 		addchar('b');
 	}
 	addchar('\t');



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

2013-10-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 19 19:03:30 UTC 2013

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

Log Message:
Mark a variable that is only tested in DIAGNOSTIC kernels as potentially
unused.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 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

2013-10-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Oct 14 12:20:05 UTC 2013

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

Log Message:
Check whether we have an FPU regardless of FPU_EMULATE option.
It prevents a kernel panic when we don't have an FPU and FPU_EMULATE
option is not set.
Thanks tsutsui@ for advice.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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.31 src/sys/arch/m68k/m68k/switch_subr.s:1.32
--- src/sys/arch/m68k/m68k/switch_subr.s:1.31	Sat Sep  7 19:06:29 2013
+++ src/sys/arch/m68k/m68k/switch_subr.s	Mon Oct 14 12:20:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: switch_subr.s,v 1.31 2013/09/07 19:06:29 chs Exp $	*/
+/*	$NetBSD: switch_subr.s,v 1.32 2013/10/14 12:20:05 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation.
@@ -109,10 +109,9 @@ ENTRY(cpu_switchto)
 	jbsr	_ASM_LABEL(m68k_fpuctx_save)
 #else
 #ifdef FPCOPROC
-#ifdef FPU_EMULATE
 	tstl	_C_LABEL(fputype)	| Do we have an FPU?
 	jeq	.Lcpu_switch_nofpsave	| No  Then don't attempt save.
-#endif
+
 	lea	PCB_FPCTX(%a1),%a2	| pointer to FP save area
 	fsave	(%a2)			| save FP state
 #if defined(M68020) || defined(M68030) || defined(M68040)
@@ -222,10 +221,9 @@ ENTRY(cpu_switchto)
 	moveml	(%sp)+,%d0/%d1
 #else
 #ifdef FPCOPROC
-#ifdef FPU_EMULATE
 	tstl	_C_LABEL(fputype)	| Do we have an FPU?
 	jeq	.Lcpu_switch_nofprest	| No  Then don't attempt restore.
-#endif
+
 	lea	PCB_FPCTX(%a1),%a0	| pointer to FP save area
 #if defined(M68020) || defined(M68030) || defined(M68040)
 #if defined(M68060)
@@ -279,10 +277,9 @@ ENTRY(savectx)
 	jbsr	_ASM_LABEL(m68k_fpuctx_save)
 #else
 #ifdef FPCOPROC
-#ifdef FPU_EMULATE
 	tstl	_C_LABEL(fputype)	| Do we have FPU?
 	jeq	.Lsavectx_nofpsave	| No?  Then don't save state.
-#endif
+
 	lea	PCB_FPCTX(%a1),%a0	| pointer to FP save area
 	fsave	(%a0)			| save FP state
 #if defined(M68020) || defined(M68030) || defined(M68040)



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

2013-10-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Oct 14 12:20:05 UTC 2013

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

Log Message:
Check whether we have an FPU regardless of FPU_EMULATE option.
It prevents a kernel panic when we don't have an FPU and FPU_EMULATE
option is not set.
Thanks tsutsui@ for advice.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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

2013-08-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug  1 13:42:52 UTC 2013

Modified Files:
src/sys/arch/m68k/m68k: compat_13_sigreturn13.s compat_16_sigreturn14.s
copypage.s lock_stubs.s reenter_syscall.s sigcode.s sunos_sigcode.s
support.s svr4_sigcode.s switch_subr.s trap_subr.s w16copy.s

Log Message:
Convert to motorola style.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/m68k/compat_13_sigreturn13.s \
src/sys/arch/m68k/m68k/sunos_sigcode.s
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/compat_16_sigreturn14.s
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/m68k/m68k/copypage.s \
src/sys/arch/m68k/m68k/sigcode.s src/sys/arch/m68k/m68k/trap_subr.s
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/m68k/lock_stubs.s
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/reenter_syscall.s \
src/sys/arch/m68k/m68k/w16copy.s
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/support.s \
src/sys/arch/m68k/m68k/svr4_sigcode.s
cvs rdiff -u -r1.29 -r1.30 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/compat_13_sigreturn13.s
diff -u src/sys/arch/m68k/m68k/compat_13_sigreturn13.s:1.5 src/sys/arch/m68k/m68k/compat_13_sigreturn13.s:1.6
--- src/sys/arch/m68k/m68k/compat_13_sigreturn13.s:1.5	Tue Feb  8 20:20:16 2011
+++ src/sys/arch/m68k/m68k/compat_13_sigreturn13.s	Thu Aug  1 13:42:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_13_sigreturn13.s,v 1.5 2011/02/08 20:20:16 rmind Exp $	*/
+/*	$NetBSD: compat_13_sigreturn13.s,v 1.6 2013/08/01 13:42:52 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -48,33 +48,33 @@
  * (possibly much larger) original stack frame.
  */
 ENTRY_NOPROFILE(m68k_compat_13_sigreturn13_stub)
-	lea	%sp@(-84),%sp		| leave enough space for largest frame
-	movl	%sp@(84),%sp@		| move up current 8 byte frame
-	movl	%sp@(88),%sp@(4)
-	movl	#84,%sp@-		| default: adjust by 84 bytes
-	moveml	#0x,%sp@-		| save user registers
+	lea	-84(%sp),%sp		| leave enough space for largest frame
+	movl	84(%sp),(%sp)		| move up current 8 byte frame
+	movl	88(%sp),4(%sp)
+	movl	#84,-(%sp)		| default: adjust by 84 bytes
+	moveml	#0x,-(%sp)		| save user registers
 	movl	%usp,%a0		| save the user SP
-	movl	%a0,%sp@(FR_SP)		|   in the savearea
-	movl	#SYS_compat_13_sigreturn13,%sp@-	| push syscall number
+	movl	%a0,FR_SP(%sp)		|   in the savearea
+	movl	#SYS_compat_13_sigreturn13,-(%sp)	| push syscall number
 	jbsr	_C_LABEL(syscall)	| handle it
 	addql	#4,%sp			| pop syscall#
-	movl	%sp@(FR_SP),%a0		| grab and restore
+	movl	FR_SP(%sp),%a0		| grab and restore
 	movl	%a0,%usp		|   user SP
-	lea	%sp@(FR_HW),%a1		| pointer to HW frame
-	movw	%sp@(FR_ADJ),%d0	| do we need to adjust the stack?
+	lea	FR_HW(%sp),%a1		| pointer to HW frame
+	movw	FR_ADJ(%sp),%d0	| do we need to adjust the stack?
 	jeq	Lc13sigr1		| no, just continue
 	moveq	#92,%d1			| total size
 	subw	%d0,%d1			|  - hole size = frame size
-	lea	%a1@(92),%a0		| destination
+	lea	92(%a1),%a0		| destination
 	addw	%d1,%a1			| source
 	lsrw	#1,%d1			| convert to word count
 	subqw	#1,%d1			| minus 1 for dbf
 Lc13sigrlp:
-	movw	%a1@-,%a0@-		| copy a word
+	movw	-(%a1),-(%a0)		| copy a word
 	dbf	%d1,Lc13sigrlp		| continue
 	movl	%a0,%a1			| new HW frame base
 Lc13sigr1:
-	movl	%a1,%sp@(FR_SP)		| new SP value
-	moveml	%sp@+,#0x7FFF		| restore user registers
-	movl	%sp@,%sp		| and our SP
+	movl	%a1,FR_SP(%sp)		| new SP value
+	moveml	(%sp)+,#0x7FFF		| restore user registers
+	movl	(%sp),%sp		| and our SP
 	jra	_ASM_LABEL(rei)		| all done
Index: src/sys/arch/m68k/m68k/sunos_sigcode.s
diff -u src/sys/arch/m68k/m68k/sunos_sigcode.s:1.5 src/sys/arch/m68k/m68k/sunos_sigcode.s:1.6
--- src/sys/arch/m68k/m68k/sunos_sigcode.s:1.5	Tue Feb  8 20:20:16 2011
+++ src/sys/arch/m68k/m68k/sunos_sigcode.s	Thu Aug  1 13:42:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunos_sigcode.s,v 1.5 2011/02/08 20:20:16 rmind Exp $	*/
+/*	$NetBSD: sunos_sigcode.s,v 1.6 2013/08/01 13:42:52 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -51,11 +51,11 @@
  	.data
  	.align	2
 GLOBAL(sunos_sigcode)
-	movl	%sp@(12),%a0	| signal handler addr	(4 bytes)
-	jsr	%a0@		| call signal handler	(2 bytes)
+	movl	12(%sp),%a0	| signal handler addr	(4 bytes)
+	jsr	(%a0)		| call signal handler	(2 bytes)
 	addql	#4,%sp		| pop signal number	(2 bytes)
 	trap	#1		| special syscall entry	(2 bytes)
-	movl	%d0,%sp@(4)	| save errno		(4 bytes)
+	movl	%d0,4(%sp)	| save errno		(4 bytes)
 	moveq	#1,%d0		| syscall == exit	(2 bytes)
 	trap	#0		| exit(errno)		(2 bytes)
 	.align	2

Index: src/sys/arch/m68k/m68k/compat_16_sigreturn14.s
diff -u src/sys/arch/m68k/m68k/compat_16_sigreturn14.s:1.3 src/sys/arch/m68k/m68k/compat_16_sigreturn14.s:1.4
--- src/sys/arch/m68k/m68k/compat_16_sigreturn14.s:1.3	Tue Feb  8 20:20:16 2011
+++ src/sys/arch/m68k/m68k/compat_16_sigreturn14.s	Thu Aug  1 

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

2013-08-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Aug  1 13:42:52 UTC 2013

Modified Files:
src/sys/arch/m68k/m68k: compat_13_sigreturn13.s compat_16_sigreturn14.s
copypage.s lock_stubs.s reenter_syscall.s sigcode.s sunos_sigcode.s
support.s svr4_sigcode.s switch_subr.s trap_subr.s w16copy.s

Log Message:
Convert to motorola style.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/m68k/compat_13_sigreturn13.s \
src/sys/arch/m68k/m68k/sunos_sigcode.s
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/m68k/compat_16_sigreturn14.s
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/m68k/m68k/copypage.s \
src/sys/arch/m68k/m68k/sigcode.s src/sys/arch/m68k/m68k/trap_subr.s
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/m68k/lock_stubs.s
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/m68k/reenter_syscall.s \
src/sys/arch/m68k/m68k/w16copy.s
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/support.s \
src/sys/arch/m68k/m68k/svr4_sigcode.s
cvs rdiff -u -r1.29 -r1.30 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

2013-07-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 22 17:52:21 UTC 2013

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

Log Message:
Move to motorola syntax
Change all branches to use j.. instead of b.. (branches now use byte offsets)
(this causes it to go from 932 to 848 bytes of text)
Add GETCURPCB macro.
(binary identical before the b - j changes)


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/m68k/m68k/copy.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/copy.s
diff -u src/sys/arch/m68k/m68k/copy.s:1.43 src/sys/arch/m68k/m68k/copy.s:1.44
--- src/sys/arch/m68k/m68k/copy.s:1.43	Wed Jul  7 01:16:25 2010
+++ src/sys/arch/m68k/m68k/copy.s	Mon Jul 22 17:52:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.s,v 1.43 2010/07/07 01:16:25 chs Exp $	*/
+/*	$NetBSD: copy.s,v 1.44 2013/07/22 17:52:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -80,6 +80,12 @@
 	.file	copy.s
 	.text
 
+#ifdef CI_CURPCB
+#define	GETCURPCB(r)	movl	_C_LABEL(cpu_info_store)+CI_CURPCB,r
+#else
+#define	GETCURPCB(r)	movl	_C_LABEL(curpcb),r
+#endif
+
 #ifdef	DIAGNOSTIC
 /*
  * The following routines all use the moves instruction to access
@@ -93,7 +99,7 @@
  */
 Lbadfc:
 	PANIC(copy.s: bad sfc or dfc)
-	bra	Lbadfc
+	jra	Lbadfc
 #define	CHECK_SFC	movec %sfc,%d0; subql #FC_USERD,%d0; bne Lbadfc
 #define	CHECK_DFC	movec %dfc,%d0; subql #FC_USERD,%d0; bne Lbadfc
 #else	/* DIAGNOSTIC */
@@ -114,57 +120,57 @@ Lbadfc:
  */
 ENTRY(copyin)
 	CHECK_SFC
-	movl	%sp@(12),%d0		| check count
-	beq	Lciret			| == 0, don't do anything
+	movl	12(%sp),%d0		| check count
+	jeq	Lciret			| == 0, don't do anything
 #ifdef MAPPEDCOPY
 	cmpl	_C_LABEL(mappedcopysize),%d0 | size = mappedcopysize
-	bcc	_C_LABEL(mappedcopyin)	| yes, go do it the new way
+	jcc	_C_LABEL(mappedcopyin)	| yes, go do it the new way
 #endif
-	movl	%d2,%sp@-		| save scratch register
-	movl	_C_LABEL(curpcb),%a0	| set fault handler
-	movl	#Lcifault,%a0@(PCB_ONFAULT)
-	movl	%sp@(8),%a0		| src address
-	movl	%sp@(12),%a1		| dest address
+	movl	%d2,-(%sp)		| save scratch register
+	GETCURPCB(%a0)			| set fault handler
+	movl	#Lcifault,PCB_ONFAULT(%a0)
+	movl	8(%sp),%a0		| src address
+	movl	12(%sp),%a1		| dest address
 	movl	%a0,%d1
 	btst	#0,%d1			| src address odd?
-	beq	Lcieven			| no, skip alignment
-	movsb	%a0@+,%d2		| yes, copy a byte
-	movb	%d2,%a1@+
+	jeq	Lcieven			| no, skip alignment
+	movsb	(%a0)+,%d2		| yes, copy a byte
+	movb	%d2,(%a1)+
 	subql	#1,%d0			| adjust count
-	beq	Lcidone			| count 0, all done
+	jeq	Lcidone			| count 0, all done
 Lcieven:
 	movl	%a1,%d1
 	btst	#0,%d1			| dest address odd?
-	bne	Lcibytes		| yes, must copy bytes
+	jne	Lcibytes		| yes, must copy bytes
 	movl	%d0,%d1			| OK, both even.  Get count
 	lsrl	#2,%d1			|   and convert to longwords
-	beq	Lcibytes		| count 0, skip longword loop
+	jeq	Lcibytes		| count 0, skip longword loop
 	subql	#1,%d1			| predecrement for dbf
 Lcilloop:
-	movsl	%a0@+,%d2		| copy a longword
-	movl	%d2,%a1@+
+	movsl	(%a0)+,%d2		| copy a longword
+	movl	%d2,(%a1)+
 	dbf	%d1,Lcilloop		| decrement low word of count
 	subil	#0x1,%d1		| decrement high word of count
-	bcc	Lcilloop
+	jcc	Lcilloop
 	andl	#3,%d0			| what remains
-	beq	Lcidone			| nothing, all done
+	jeq	Lcidone			| nothing, all done
 Lcibytes:
 	subql	#1,%d0			| predecrement for dbf
 Lcibloop:
-	movsb	%a0@+,%d2		| copy a byte
-	movb	%d2,%a1@+
+	movsb	(%a0)+,%d2		| copy a byte
+	movb	%d2,(%a1)+
 	dbf	%d0,Lcibloop		| decrement low word of count
 	subil	#0x1,%d0		| decrement high word of count
-	bcc	Lcibloop
+	jcc	Lcibloop
 	clrl	%d0			| no error
 Lcidone:
-	movl	_C_LABEL(curpcb),%a0	| clear fault handler
-	clrl	%a0@(PCB_ONFAULT)
-	movl	%sp@+,%d2		| restore scratch register
+	GETCURPCB(%a0)			| clear fault handler
+	clrl	PCB_ONFAULT(%a0)
+	movl	(%sp)+,%d2		| restore scratch register
 Lciret:
 	rts
 Lcifault:
-	bra	Lcidone
+	jra	Lcidone
 
 /*
  * copyout(void *from, void *to, size_t len);
@@ -179,57 +185,57 @@ Lcifault:
  */
 ENTRY(copyout)
 	CHECK_DFC
-	movl	%sp@(12),%d0		| check count
-	beq	Lcoret			| == 0, don't do anything
+	movl	12(%sp),%d0		| check count
+	jeq	Lcoret			| == 0, don't do anything
 #ifdef MAPPEDCOPY
 	cmpl	_C_LABEL(mappedcopysize),%d0 | size = mappedcopysize
-	bcc	_C_LABEL(mappedcopyout)	| yes, go do it the new way
+	jcc	_C_LABEL(mappedcopyout)	| yes, go do it the new way
 #endif
-	movl	%d2,%sp@-		| save scratch register
-	movl	_C_LABEL(curpcb),%a0	| set fault handler
-	movl	#Lcofault,%a0@(PCB_ONFAULT)
-	movl	%sp@(8),%a0		| src address
-	movl	%sp@(12),%a1		| dest address
+	movl	%d2,-(%sp)		| save scratch register
+	GETCURPCB(%a0)			| set fault handler
+	movl	#Lcofault,PCB_ONFAULT(%a0)
+	movl	8(%sp),%a0		| src address
+	movl	12(%sp),%a1		| dest address
 	movl	%a0,%d1
 	btst	#0,%d1			| src address odd?
-	beq	Lcoeven			| no, skip alignment
-	movb	%a0@+,%d2		| yes, copy a 

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

2013-07-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 22 03:30:38 UTC 2013

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

Log Message:
Use motorola syntax
Adjust for coldfire
(no binary difference for non-coldfire


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/m68k/oc_cksum.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/oc_cksum.s
diff -u src/sys/arch/m68k/m68k/oc_cksum.s:1.6 src/sys/arch/m68k/m68k/oc_cksum.s:1.7
--- src/sys/arch/m68k/m68k/oc_cksum.s:1.6	Fri Dec 23 05:06:19 2011
+++ src/sys/arch/m68k/m68k/oc_cksum.s	Mon Jul 22 03:30:38 2013
@@ -1,4 +1,4 @@
-|	$NetBSD: oc_cksum.s,v 1.6 2011/12/23 05:06:19 tsutsui Exp $
+|	$NetBSD: oc_cksum.s,v 1.7 2013/07/22 03:30:38 matt Exp $
 
 | Copyright (c) 1988 Regents of the University of California.
 | All rights reserved.
@@ -91,10 +91,10 @@
 	.text
 
 ENTRY(oc_cksum)
-	movl	%sp@(4),%a0	| get buffer ptr
-	movl	%sp@(8),%d1	| get byte count
-	movl	%sp@(12),%d0	| get starting value
-	movl	%d2,%sp@-	| free a reg
+	movl	4(%sp),%a0	| get buffer ptr
+	movl	8(%sp),%d1	| get byte count
+	movl	12(%sp),%d0	| get starting value
+	movl	%d2,-(%sp)	| free a reg
 
 	| test for possible 1, 2 or 3 bytes of excess at end
 	| of buffer.  The usual case is no excess (the usual
@@ -108,56 +108,85 @@ ENTRY(oc_cksum)
 	btst	#1,%d1
 	jne	L7		| if two bytes excess
 L1:
-	movl	%d1,%d2
+#ifdef __mcoldfire__
+	movq	#-4,%d2		| mask to clear bottom two bits
+	andl	%d2,%d1		| longword truncate length
+	movl	%d1,%d2		| move length to d2
+	movl	%d1,%a1		| move length to a1
+	addl	%a0,%a1		| add start so a1 now points to end
+	movq	#0x3c,%d1	| then find fractions of a chunk
+	andl	%d1,%d2
+	negl	%d2
+	subl	%d1,%d1		| this can never carry so X is cleared
+#else
+	movl	%d1,%d2		| move to d2
 	lsrl	#6,%d1		| make cnt into # of 64 byte chunks
 	andl	#0x3c,%d2	| then find fractions of a chunk
 	negl	%d2
 	andb	#0xf,%cc	| clear X
-	jmp	%pc@(L3-.-2:b,%d2)
+#endif
+	jmp	(L3-.-2:b,%pc,%d2)
 L2:
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
-	movl	%a0@+,%d2
+	movl	(%a0)+,%d2
 	addxl	%d2,%d0
 L3:
+#ifdef __mcoldfire__
+	cmpal	%a0,%a1		| cmpa doesn't affect X
+	bne	L2		| loop until reached
+#else
 	dbra	%d1,L2		| (NB- dbra doesn't affect X)
+#endif
 
 	movl	%d0,%d1		| fold 32 bit sum to 16 bits
 	swap	%d1		| (NB- swap doesn't affect X)
+#ifdef __mcoldfire__
+	mvzw	%d1,%d1		| zero extend %d1 (doesn't affect X)
+	mvzw	%d0,%d0		| zero extend %d0 (doesn't affect X)
+	addxl	%d1,%d0		| 
+	jcc	L4
+	addql	#1,%d0
+#else
 	addxw	%d1,%d0
 	jcc	L4
 	addw	#1,%d0
+#endif
 L4:
+#ifdef __mcoldfire__
+	mvzw	%d0,%d0
+#else
 	andl	#0x,%d0
-	movl	%sp@+,%d2
+#endif
+	movl	(%sp)+,%d2
 	rts
 
 L5:	| deal with 1 or 3 excess bytes at the end of the buffer.
@@ -166,18 +195,18 @@ L5:	| deal with 1 or 3 excess bytes at t
 
 	| 3 bytes excess
 	clrl	%d2
-	movw	%a0@(-3,%d1:l),%d2	| add in last full word then drop
+	movw	(-3,%a0,%d1:l),%d2	| add in last full word then drop
 	addl	%d2,%d0		|  through to pick up last byte
 
 L6:	| 1 byte excess
 	clrl	%d2
-	movb	%a0@(-1,%d1:l),%d2
+	movb	(-1,%a0,%d1:l),%d2
 	lsll	#8,%d2
 	addl	%d2,%d0
 	jra	L1
 
 L7:	| 2 bytes excess
 	clrl	%d2
-	movw	%a0@(-2,%d1:l),%d2
+	movw	(-2,%a0,%d1:l),%d2
 	addl	%d2,%d0
 	jra	L1



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

2013-07-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 22 03:37:17 UTC 2013

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

Log Message:
use mvz[wb] when possible


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/oc_cksum.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/oc_cksum.s
diff -u src/sys/arch/m68k/m68k/oc_cksum.s:1.7 src/sys/arch/m68k/m68k/oc_cksum.s:1.8
--- src/sys/arch/m68k/m68k/oc_cksum.s:1.7	Mon Jul 22 03:30:38 2013
+++ src/sys/arch/m68k/m68k/oc_cksum.s	Mon Jul 22 03:37:17 2013
@@ -1,4 +1,4 @@
-|	$NetBSD: oc_cksum.s,v 1.7 2013/07/22 03:30:38 matt Exp $
+|	$NetBSD: oc_cksum.s,v 1.8 2013/07/22 03:37:17 matt Exp $
 
 | Copyright (c) 1988 Regents of the University of California.
 | All rights reserved.
@@ -194,19 +194,31 @@ L5:	| deal with 1 or 3 excess bytes at t
 	jeq	L6		| if 1 excess
 
 	| 3 bytes excess
+#ifdef __mcoldfire__
+	mvzw	(-3,%a0,%d1:l),%d2	| add in last full word then drop
+#else
 	clrl	%d2
 	movw	(-3,%a0,%d1:l),%d2	| add in last full word then drop
+#endif
 	addl	%d2,%d0		|  through to pick up last byte
 
 L6:	| 1 byte excess
+#ifdef __mcoldfire__
+	mvzb	(-1,%a0,%d1:l),%d2
+#else
 	clrl	%d2
 	movb	(-1,%a0,%d1:l),%d2
+#endif
 	lsll	#8,%d2
 	addl	%d2,%d0
 	jra	L1
 
 L7:	| 2 bytes excess
+#ifdef __mcoldfire__
+	mvzw	(-2,%a0,%d1:l),%d2
+#else
 	clrl	%d2
 	movw	(-2,%a0,%d1:l),%d2
+#endif
 	addl	%d2,%d0
 	jra	L1



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

2013-07-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 22 03:30:38 UTC 2013

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

Log Message:
Use motorola syntax
Adjust for coldfire
(no binary difference for non-coldfire


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

2013-07-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jul 22 03:37:17 UTC 2013

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

Log Message:
use mvz[wb] when possible


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

2011-12-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Dec 22 15:47:15 UTC 2011

Modified Files:
src/sys/arch/m68k/m68k: compat_16_machdep.c sig_machdep.c
svr4_machdep.c

Log Message:
Remove fuction declarations of m68881_restore() and m68881_save().
They are in m68k/m68k.h.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/m68k/compat_16_machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/m68k/m68k/sig_machdep.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/m68k/m68k/svr4_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/compat_16_machdep.c
diff -u src/sys/arch/m68k/m68k/compat_16_machdep.c:1.15 src/sys/arch/m68k/m68k/compat_16_machdep.c:1.16
--- src/sys/arch/m68k/m68k/compat_16_machdep.c:1.15	Tue Feb  8 20:20:16 2011
+++ src/sys/arch/m68k/m68k/compat_16_machdep.c	Thu Dec 22 15:47:15 2011
@@ -1,4 +1,4 @@
-/*$NetBSD: compat_16_machdep.c,v 1.15 2011/02/08 20:20:16 rmind Exp $   */
+/*$NetBSD: compat_16_machdep.c,v 1.16 2011/12/22 15:47:15 tsutsui Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_16_machdep.c,v 1.15 2011/02/08 20:20:16 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_16_machdep.c,v 1.16 2011/12/22 15:47:15 tsutsui Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -68,8 +68,6 @@ __KERNEL_RCSID(0, $NetBSD: compat_16_ma
 #include machine/frame.h
 
 extern  short exframesize[];
-void	m68881_save(struct fpframe *);
-void	m68881_restore(struct fpframe *);
 
 #ifdef DEBUG
 extern int sigdebug;

Index: src/sys/arch/m68k/m68k/sig_machdep.c
diff -u src/sys/arch/m68k/m68k/sig_machdep.c:1.46 src/sys/arch/m68k/m68k/sig_machdep.c:1.47
--- src/sys/arch/m68k/m68k/sig_machdep.c:1.46	Thu Feb 24 04:28:46 2011
+++ src/sys/arch/m68k/m68k/sig_machdep.c	Thu Dec 22 15:47:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig_machdep.c,v 1.46 2011/02/24 04:28:46 joerg Exp $	*/
+/*	$NetBSD: sig_machdep.c,v 1.47 2011/12/22 15:47:15 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sig_machdep.c,v 1.46 2011/02/24 04:28:46 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: sig_machdep.c,v 1.47 2011/12/22 15:47:15 tsutsui Exp $);
 
 #define __M68K_SIGNAL_PRIVATE
 
@@ -69,8 +69,6 @@ __KERNEL_RCSID(0, $NetBSD: sig_machdep.
 
 extern short exframesize[];
 struct fpframe m68k_cached_fpu_idle_frame;
-void	m68881_save(struct fpframe *);
-void	m68881_restore(struct fpframe *);
 
 #ifdef DEBUG
 int sigdebug = 0;

Index: src/sys/arch/m68k/m68k/svr4_machdep.c
diff -u src/sys/arch/m68k/m68k/svr4_machdep.c:1.32 src/sys/arch/m68k/m68k/svr4_machdep.c:1.33
--- src/sys/arch/m68k/m68k/svr4_machdep.c:1.32	Thu Dec 10 14:13:50 2009
+++ src/sys/arch/m68k/m68k/svr4_machdep.c	Thu Dec 22 15:47:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_machdep.c,v 1.32 2009/12/10 14:13:50 matt Exp $	*/
+/*	$NetBSD: svr4_machdep.c,v 1.33 2011/12/22 15:47:15 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_machdep.c,v 1.32 2009/12/10 14:13:50 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_machdep.c,v 1.33 2011/12/22 15:47:15 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -60,8 +60,6 @@ __KERNEL_RCSID(0, $NetBSD: svr4_machdep
 #include machine/vmparam.h
 
 extern short exframesize[];
-extern void	m68881_restore(struct fpframe *);
-extern void	m68881_save(struct fpframe *);
 static void	svr4_getsiginfo(union svr4_siginfo *, int, unsigned long,
 		void *);
 



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

2011-12-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec 23 05:06:19 UTC 2011

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

Log Message:
Remove UCB clause 3.


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

2011-11-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Nov  3 14:39:05 UTC 2011

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

Log Message:
Use pool_allocator_meta rather than pool_allocator_nointr to allocate
struct pv_entry pool in the previous fix for PR port-m68k/45519.
Per comment from yamt@ on source-changes-d@:
http://mail-index.NetBSD.org/source-changes-d/2011/10/31/msg004211.html


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.63 src/sys/arch/m68k/m68k/pmap_motorola.c:1.64
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.63	Sat Oct 29 18:26:19 2011
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Thu Nov  3 14:39:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.63 2011/10/29 18:26:19 tsutsui Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.64 2011/11/03 14:39:05 tsutsui Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_motorola.c,v 1.63 2011/10/29 18:26:19 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_motorola.c,v 1.64 2011/11/03 14:39:05 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -547,7 +547,7 @@ pmap_init(void)
 	 * Initialize the pv_entry pools.
 	 */
 	pool_init(pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, pvpl,
-	pool_allocator_nointr, IPL_NONE);
+	pool_allocator_meta, IPL_NONE);
 
 	/*
 	 * Now that this is done, mark the pages shared with the



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

2011-11-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Nov  3 14:39:05 UTC 2011

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

Log Message:
Use pool_allocator_meta rather than pool_allocator_nointr to allocate
struct pv_entry pool in the previous fix for PR port-m68k/45519.
Per comment from yamt@ on source-changes-d@:
http://mail-index.NetBSD.org/source-changes-d/2011/10/31/msg004211.html


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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

2010-10-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 15 10:20:10 UTC 2010

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

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/m68k/m68k/m68k_syscall.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_syscall.c
diff -u src/sys/arch/m68k/m68k/m68k_syscall.c:1.42 src/sys/arch/m68k/m68k/m68k_syscall.c:1.43
--- src/sys/arch/m68k/m68k/m68k_syscall.c:1.42	Thu Oct 14 16:34:29 2010
+++ src/sys/arch/m68k/m68k/m68k_syscall.c	Fri Oct 15 10:20:09 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_syscall.c,v 1.42 2010/10/14 16:34:29 tsutsui Exp $	*/
+/*	$NetBSD: m68k_syscall.c,v 1.43 2010/10/15 10:20:09 tsutsui Exp $	*/
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -110,7 +110,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: m68k_syscall.c,v 1.42 2010/10/14 16:34:29 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: m68k_syscall.c,v 1.43 2010/10/15 10:20:09 tsutsui Exp $);
 
 #include opt_execfmt.h
 #include opt_compat_netbsd.h
@@ -290,7 +290,7 @@
 		 * value there. However, -current binaries post 4.0
 		 * but pre-5.0 might still require this copy, so we
 		 * select this behaviour based on COMPAT_50 as we have
-		 * no equivvalent for the exact in-between version.
+		 * no equivalent for the exact in-between version.
 		 */
 #ifdef COMPAT_AOUT_M68K
 		{



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

2010-10-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 15 10:40:53 UTC 2010

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

Log Message:
Get rid of more #ifdef COMPAT_AOUT_M68K dependent part.
Now compat_aoutm68k can be a module.

XXX: linux/svr4 ELF binaries also require a syscall return value in %a0?


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/m68k/m68k/m68k_syscall.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_syscall.c
diff -u src/sys/arch/m68k/m68k/m68k_syscall.c:1.43 src/sys/arch/m68k/m68k/m68k_syscall.c:1.44
--- src/sys/arch/m68k/m68k/m68k_syscall.c:1.43	Fri Oct 15 10:20:09 2010
+++ src/sys/arch/m68k/m68k/m68k_syscall.c	Fri Oct 15 10:40:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_syscall.c,v 1.43 2010/10/15 10:20:09 tsutsui Exp $	*/
+/*	$NetBSD: m68k_syscall.c,v 1.44 2010/10/15 10:40:52 tsutsui Exp $	*/
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -110,7 +110,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: m68k_syscall.c,v 1.43 2010/10/15 10:20:09 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: m68k_syscall.c,v 1.44 2010/10/15 10:40:52 tsutsui Exp $);
 
 #include opt_execfmt.h
 #include opt_compat_netbsd.h
@@ -292,20 +292,13 @@
 		 * select this behaviour based on COMPAT_50 as we have
 		 * no equivalent for the exact in-between version.
 		 */
-#ifdef COMPAT_AOUT_M68K
-		{
-			extern struct emul emul_netbsd_aoutm68k;
-
-			/*
-			 * Some pre-m68k ELF libc assembler stubs assume
-			 * %a0 is preserved across system calls...
-			 */
-			if (p-p_emul != emul_netbsd_aoutm68k)
-frame-f_regs[A0] = rval[0];
-		}
-#else
-		frame-f_regs[A0] = rval[0];
-#endif
+
+		/*
+		 * Some pre-m68k ELF libc assembler stubs assume
+		 * %a0 is preserved across system calls...
+		 */
+		if (p-p_emul == emul_netbsd)
+			frame-f_regs[A0] = rval[0];
 #endif
 		break;
 	case ERESTART:
@@ -416,20 +409,13 @@
 		frame-f_sr = ~PSL_C;	/* carry bit */
 #ifdef COMPAT_50
 		/* see syscall_plain for a comment explaining this */
-#ifdef COMPAT_AOUT_M68K
-		{
-			extern struct emul emul_netbsd_aoutm68k;
-
-			/*
-			 * Some pre-m68k ELF libc assembler stubs assume
-			 * %a0 is preserved across system calls...
-			 */
-			if (p-p_emul != emul_netbsd_aoutm68k)
-frame-f_regs[A0] = rval[0];
-		}
-#else
-		frame-f_regs[A0] = rval[0];
-#endif
+
+		/*
+		 * Some pre-m68k ELF libc assembler stubs assume
+		 * %a0 is preserved across system calls...
+		 */
+		if (p-p_emul == emul_netbsd)
+			frame-f_regs[A0] = rval[0];
 #endif
 		break;
 	case ERESTART:



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

2010-10-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 15 10:20:10 UTC 2010

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

Log Message:
Fix typo.


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

2010-10-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 15 10:40:53 UTC 2010

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

Log Message:
Get rid of more #ifdef COMPAT_AOUT_M68K dependent part.
Now compat_aoutm68k can be a module.

XXX: linux/svr4 ELF binaries also require a syscall return value in %a0?


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

2010-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Oct 14 16:33:50 UTC 2010

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

Log Message:
Fix reloc calcurations (mechanically pulled from working i386 and sh3).
Now options MODULAR works at least on news68k:

# uname -mrs
NetBSD 5.99.39 news68k
# modstat|grep filesys
coredump misc   filesys2 2790 -
exec_aoutmisc   filesys0 1866 coredump
exec_elf32   misc   filesys0 6072 coredump
exec_script  misc   filesys0 972  -
kernfs   vfsfilesys0 9734 -
mfs  vfsfilesys0 3656 ffs
procfs   vfsfilesys0 23924-
#


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/sys/arch/m68k/m68k/kobj_machdep.c:1.3
--- src/sys/arch/m68k/m68k/kobj_machdep.c:1.2	Mon Apr 28 20:23:27 2008
+++ src/sys/arch/m68k/m68k/kobj_machdep.c	Thu Oct 14 16:33:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_machdep.c,v 1.2 2008/04/28 20:23:27 martin Exp $	*/
+/*	$NetBSD: kobj_machdep.c,v 1.3 2010/10/14 16:33:50 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kobj_machdep.c,v 1.2 2008/04/28 20:23:27 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: kobj_machdep.c,v 1.3 2010/10/14 16:33:50 tsutsui Exp $);
 
 #define	ELFSIZE		ARCH_ELFSIZE
 
@@ -64,8 +64,7 @@
 		addr = kobj_sym_lookup(ko, symnum);
 		if (addr == 0)
 			return -1;
-		tmp = (Elf_Addr)(relocbase + addr +
-		rela-r_addend) - (Elf_Addr)where;
+		tmp = (Elf_Addr)(addr + rela-r_addend) - (Elf_Addr)where;
 		if (*where != tmp)
 			*where = tmp;
 		break;
@@ -75,14 +74,12 @@
 		addr = kobj_sym_lookup(ko, symnum);
 		if (addr == 0)
 			return -1;
-		tmp = (Elf_Addr)(relocbase + addr +
-		rela-r_addend);
-		if (*where != tmp)
-			*where = tmp;
+		tmp = (Elf_Addr)(addr + *where + rela-r_addend);
+		*where = tmp;
 		break;
 
 	case R_TYPE(RELATIVE):
-		*where += (Elf_Addr)relocbase;
+		*where += (Elf_Addr)(relocbase + rela-r_addend);
 		break;
 
 	default:



  1   2   >