CVS commit: src/sys/arch/m68k

2020-12-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 15 05:48:30 UTC 2020

Modified Files:
src/sys/arch/m68k: Makefile.cmachflags

Log Message:
Make comments are not C comments - use # instead of /* ... */


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

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/Makefile.cmachflags
diff -u src/sys/arch/m68k/Makefile.cmachflags:1.2 src/sys/arch/m68k/Makefile.cmachflags:1.3
--- src/sys/arch/m68k/Makefile.cmachflags:1.2	Mon Jul 12 02:45:31 2010
+++ src/sys/arch/m68k/Makefile.cmachflags	Tue Dec 15 05:48:30 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.cmachflags,v 1.2 2010/07/12 02:45:31 mrg Exp $
+#	$NetBSD: Makefile.cmachflags,v 1.3 2020/12/15 05:48:30 martin Exp $
 
 # Set CMACHFLAGS best target the specific CPU combination, based on
 # their "options" setting.
@@ -45,11 +45,11 @@ CMACHFLAGS=	-m68060
 .elif ${HAVE_M68040} != "no"
 . if ${HAVE_M68020} != "no" || ${HAVE_M68030} != "no"
 CMACHFLAGS=	-m68020-40
-. else /* !-DM68060 */
+. else	# !-DM68060
 CMACHFLAGS=	-m68040
 . endif
 .elif ${HAVE_M68020} != "no"
 CMACHFLAGS=	-m68020
 .else
 CMACHFLAGS=	-m68030
-.endif /* !-DM68060 */
+.endif	# !-DM68060



CVS commit: src/sys/arch/m68k

2020-03-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Mar  8 06:12:01 UTC 2020

Modified Files:
src/sys/arch/m68k/include: mutex.h
src/sys/arch/m68k/m68k: lock_stubs.s

Log Message:
Remove mutex stubs for 68010 that merely fall back to C codes, and
do not work with kern_mutex.c rev 1.85 and later:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_mutex.c#rev1.85
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_mutex.c#rev1.86

Fix sun2 kernel freeze during early boot stage in mutex_exit(9).


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

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

Modified files:

Index: src/sys/arch/m68k/include/mutex.h
diff -u src/sys/arch/m68k/include/mutex.h:1.9 src/sys/arch/m68k/include/mutex.h:1.10
--- src/sys/arch/m68k/include/mutex.h:1.9	Fri Nov 29 22:55:33 2019
+++ src/sys/arch/m68k/include/mutex.h	Sun Mar  8 06:12:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.9 2019/11/29 22:55:33 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.10 2020/03/08 06:12:01 rin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -60,7 +60,9 @@ struct kmutex {
 #define	mtx_lock		u.s.mtxs_lock
 
 #define	__HAVE_SIMPLE_MUTEXES		1
+#ifndef	__mc68010__
 #define	__HAVE_MUTEX_STUBS		1
+#endif
 
 #define	MUTEX_CAS(p, o, n)		(atomic_cas_uint((p), (o), (n)) == (o))
 

Index: src/sys/arch/m68k/m68k/lock_stubs.s
diff -u src/sys/arch/m68k/m68k/lock_stubs.s:1.9 src/sys/arch/m68k/m68k/lock_stubs.s:1.10
--- src/sys/arch/m68k/m68k/lock_stubs.s:1.9	Thu Aug  1 13:42:52 2013
+++ src/sys/arch/m68k/m68k/lock_stubs.s	Sun Mar  8 06:12:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.s,v 1.9 2013/08/01 13:42:52 matt Exp $	*/
+/*	$NetBSD: lock_stubs.s,v 1.10 2020/03/08 06:12:01 rin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -83,32 +83,30 @@ STRONG_ALIAS(_atomic_cas_ulong_ni,_atomi
 
 #if !defined(LOCKDEBUG)
 
+#if !defined(__mc68010__)
 /*
  * void mutex_enter(kmutex_t *mtx);
  */
 ENTRY(mutex_enter)
-#if !defined(__mc68010__)
 	movq	#0,%d0
 	movl	_C_LABEL(curlwp),%d1
 	movl	4(%sp),%a0
 	casl	%d0,%d1,(%a0)
 	bnes	1f
 	rts
-#endif /* !__mc68010__ */
 1:	jra	_C_LABEL(mutex_vector_enter)
 
 /*
  * void mutex_exit(kmutex_t *mtx);
  */
 ENTRY(mutex_exit)
-#if !defined(__mc68010__)
 	movl	_C_LABEL(curlwp),%d0
 	movq	#0,%d1
 	movl	4(%sp),%a0
 	casl	%d0,%d1,(%a0)
 	bnes	1f
 	rts
-#endif /* !__mc68010__ */
 1:	jra	_C_LABEL(mutex_vector_exit)
+#endif /* !__mc68010__ */
 
 #endif	/* !LOCKDEBUG */



CVS commit: src/sys/arch/m68k

2009-05-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 30 17:52:05 UTC 2009

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

Log Message:
Do not use lwp_trampoline for cpu_setfunc, we do not want to call
lwp_startup() after a setfunc. Grow a simplified setfunc_trampoline
instead.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/m68k/include/m68k.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/m68k/m68k/switch_subr.s
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/m68k/m68k/vm_machdep.c

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

Modified files:

Index: src/sys/arch/m68k/include/m68k.h
diff -u src/sys/arch/m68k/include/m68k.h:1.13 src/sys/arch/m68k/include/m68k.h:1.14
--- src/sys/arch/m68k/include/m68k.h:1.13	Wed Oct 17 19:55:05 2007
+++ src/sys/arch/m68k/include/m68k.h	Sat May 30 17:52:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k.h,v 1.13 2007/10/17 19:55:05 garbled Exp $	*/
+/*	$NetBSD: m68k.h,v 1.14 2009/05/30 17:52:05 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -144,7 +144,6 @@
 int 	getsfc(void);
 
 /* switch_subr.s */
-void	lwp_trampoline(void);
 void	savectx(struct pcb *);
 
 /* w16copy.s */

Index: src/sys/arch/m68k/m68k/switch_subr.s
diff -u src/sys/arch/m68k/m68k/switch_subr.s:1.21 src/sys/arch/m68k/m68k/switch_subr.s:1.22
--- src/sys/arch/m68k/m68k/switch_subr.s:1.21	Wed Oct 17 19:55:12 2007
+++ src/sys/arch/m68k/m68k/switch_subr.s	Sat May 30 17:52:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: switch_subr.s,v 1.21 2007/10/17 19:55:12 garbled Exp $	*/
+/*	$NetBSD: switch_subr.s,v 1.22 2009/05/30 17:52:05 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation.
@@ -397,4 +397,17 @@
 	addql	#8,%sp			| toss SP and stack adjust
 	jra	_ASM_LABEL(rei)		| and return
 
+/*
+ * Very similar to lwp_trampoline, but do not call lwp_startup
+ */
+ENTRY_NOPROFILE(setfunc_trampoline)
+	movl	%a3,%...@-		| push function arg
+	jbsr	%a2@			| call function
+	addql	#4,%sp			| pop arg
+	movl	%sp@(FR_SP),%a0		| grab and load
+	movl	%a0,%usp		|   user SP
+	moveml	%...@+,#0x7FFF		| restore most user regs
+	addql	#8,%sp			| toss SP and stack adjust
+	jra	_ASM_LABEL(rei)		| and return
+
 

Index: src/sys/arch/m68k/m68k/vm_machdep.c
diff -u src/sys/arch/m68k/m68k/vm_machdep.c:1.27 src/sys/arch/m68k/m68k/vm_machdep.c:1.28
--- src/sys/arch/m68k/m68k/vm_machdep.c:1.27	Wed Nov 19 18:35:59 2008
+++ src/sys/arch/m68k/m68k/vm_machdep.c	Sat May 30 17:52:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.27 2008/11/19 18:35:59 ad Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.28 2009/05/30 17:52:05 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.27 2008/11/19 18:35:59 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.28 2009/05/30 17:52:05 martin Exp $");
 
 #include 
 #include 
@@ -129,6 +129,7 @@
 	struct trapframe *tf;
 	struct switchframe *sf;
 	extern struct pcb *curpcb;
+	extern void lwp_trampoline(void);
 
 	l2->l_md.md_flags = l1->l_md.md_flags;
 
@@ -171,8 +172,9 @@
 	struct pcb *pcb = &l->l_addr->u_pcb;
 	struct trapframe *tf = (struct trapframe *)l->l_md.md_regs;
 	struct switchframe *sf = (struct switchframe *)tf - 1;
+	extern void setfunc_trampoline(void);
 
-	sf->sf_pc = (u_int)lwp_trampoline;
+	sf->sf_pc = (u_int)setfunc_trampoline;
 	pcb->pcb_regs[6] = (int)func;		/* A2 */
 	pcb->pcb_regs[7] = (int)arg;		/* A3 */
 	pcb->pcb_regs[11] = (int)sf;		/* SSP */



CVS commit: src/sys/arch/m68k

2010-07-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jul 12 02:45:31 UTC 2010

Modified Files:
src/sys/arch/m68k: Makefile.cmachflags

Log Message:
look for the m680[2346]0 options in the opt_m68k_arch.h and set them
appropriately in the kernel config, if not already set.

restores the settings before the M680x0 options became _KERNEL_OPT
options.  tested by myself and mhitch.


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

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/Makefile.cmachflags
diff -u src/sys/arch/m68k/Makefile.cmachflags:1.1 src/sys/arch/m68k/Makefile.cmachflags:1.2
--- src/sys/arch/m68k/Makefile.cmachflags:1.1	Sun Jan 25 22:25:08 2009
+++ src/sys/arch/m68k/Makefile.cmachflags	Mon Jul 12 02:45:31 2010
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile.cmachflags,v 1.1 2009/01/25 22:25:08 abs Exp $
+#	$NetBSD: Makefile.cmachflags,v 1.2 2010/07/12 02:45:31 mrg Exp $
 
 # Set CMACHFLAGS best target the specific CPU combination, based on
-# -DM68020, -DM68030, -DM68040, and -DM68060
+# their "options" setting.
 
 # This should typically be included iff the config file has not already set
 # CMACHFLAGS, eg:
@@ -31,19 +31,24 @@
 # 030 -m68030
 # 020 -m68020
 
-.if !empty(IDENT:M-DM68060)
-.if empty(IDENT:M-DM68020) && empty(IDENT:M-DM68030) && empty(IDENT:M-DM68040)
-CMACHFLAGS=	-m68060
-.else
+HAVE_M68020!=	grep '\#define[ 	]*M68020' opt_m68k_arch.h 2>/dev/null || echo no
+HAVE_M68030!=	grep '\#define[ 	]*M68030' opt_m68k_arch.h 2>/dev/null || echo no
+HAVE_M68040!=	grep '\#define[ 	]*M68040' opt_m68k_arch.h 2>/dev/null || echo no
+HAVE_M68060!=	grep '\#define[ 	]*M68060' opt_m68k_arch.h 2>/dev/null || echo no
+
+.if ${HAVE_M68060} != "no"
+. if ${HAVE_M68020} != "no" || ${HAVE_M68030} != "no" || ${HAVE_M68040} != "no"
 CMACHFLAGS=	-m68020-60
-.endif
-.elif !empty(IDENT:M-DM68040)
-.if empty(IDENT:M-DM68020) && empty(IDENT:M-DM68030)
-CMACHFLAGS=	-m68040
-.else /* !-DM68060 */
+. else
+CMACHFLAGS=	-m68060
+. endif
+.elif ${HAVE_M68040} != "no"
+. if ${HAVE_M68020} != "no" || ${HAVE_M68030} != "no"
 CMACHFLAGS=	-m68020-40
-.endif
-.elif !empty(IDENT:M-DM68020)
+. else /* !-DM68060 */
+CMACHFLAGS=	-m68040
+. endif
+.elif ${HAVE_M68020} != "no"
 CMACHFLAGS=	-m68020
 .else
 CMACHFLAGS=	-m68030



CVS commit: src/sys/arch/m68k

2011-09-19 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Mon Sep 19 19:17:05 UTC 2011

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

Log Message:
Move CACHELINE_* from bus_dma.c to cpu.h (needed for PCI configuration on amiga 
port).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/m68k/include/cpu.h
cvs rdiff -u -r1.31 -r1.32 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/include/cpu.h
diff -u src/sys/arch/m68k/include/cpu.h:1.14 src/sys/arch/m68k/include/cpu.h:1.15
--- src/sys/arch/m68k/include/cpu.h:1.14	Tue Feb  8 20:20:16 2011
+++ src/sys/arch/m68k/include/cpu.h	Mon Sep 19 19:17:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.14 2011/02/08 20:20:16 rmind Exp $	*/
+/*	$NetBSD: cpu.h,v 1.15 2011/09/19 19:17:05 rkujawa Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -159,6 +159,9 @@
 #define	CACHE60_ON	(CACHE40_ON|IC60_CABC|IC60_EBC|DC60_ESB)
 #define	CACHE60_OFF	(CACHE40_OFF|IC60_CABC)
 
+#define CACHELINE_SIZE	16
+#define CACHELINE_MASK	(CACHELINE_SIZE - 1)
+
 #if defined(_KERNEL) || defined(_KMEMUSER)
 #include 
 

Index: src/sys/arch/m68k/m68k/bus_dma.c
diff -u src/sys/arch/m68k/m68k/bus_dma.c:1.31 src/sys/arch/m68k/m68k/bus_dma.c:1.32
--- src/sys/arch/m68k/m68k/bus_dma.c:1.31	Fri Nov 12 13:18:58 2010
+++ src/sys/arch/m68k/m68k/bus_dma.c	Mon Sep 19 19:17:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.31 2010/11/12 13:18:58 uebayasi Exp $ */
+/* $NetBSD: bus_dma.c,v 1.32 2011/09/19 19:17:05 rkujawa Exp $ */
 
 /*
  * This file was taken from 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.31 2010/11/12 13:18:58 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.32 2011/09/19 19:17:05 rkujawa Exp $");
 
 #include 
 #include 
@@ -424,11 +424,6 @@
  * Common function for DMA map synchronization.  May be called
  * by chipset-specific DMA map synchronization functions.
  */
-
-/* XXX these should be in  or  */
-#define CACHELINE_SIZE	16
-#define CACHELINE_MASK	(CACHELINE_SIZE - 1)
-
 void
 _bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
 bus_size_t len, int ops)



CVS commit: src/sys/arch/m68k

2011-10-29 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 29 18:26:20 UTC 2011

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

Log Message:
Use pool(9) for struct pv_entry allocations rather than
uvm_km_alloc(9)/uvm_km_free(9) and ancient homegrown pv_page_info structures.

Calling uvm_km_free(9) during pmap_remove(9) could cause rw_lock error
in uvm_unmap1() as noted in PR port-m68k/45519.

NetBSD/x68k (both real X68030 and XM6i emulator) still gets weird panic
(corrupted kernel stack pointer?) on some heavy load:
---
panic: MMU fault
Stopped in pid 363.1 (X68k) at  netbsd:cpu_Debugger+0x6:unlka6
db> tr
cpu_Debugger(4012004,8,1cbb528,2a618e0,2a5b000) + 6
db>
---
but it also occurs without this change so there might be some more bugs
in m68k pmap...


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/m68k/m68k/pmap_motorola.c

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

Modified files:

Index: src/sys/arch/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.33 src/sys/arch/m68k/include/pmap_motorola.h:1.34
--- src/sys/arch/m68k/include/pmap_motorola.h:1.33	Fri Jun  3 17:03:52 2011
+++ src/sys/arch/m68k/include/pmap_motorola.h	Sat Oct 29 18:26:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.33 2011/06/03 17:03:52 tsutsui Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.34 2011/10/29 18:26:19 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -191,29 +191,6 @@ struct pv_entry {
 	struct pmap	*pv_ptpmap;	/* if pv_ptste, pmap for PT page */
 };
 
-struct pv_page;
-
-struct pv_page_info {
-	TAILQ_ENTRY(pv_page) pgi_list;
-	struct pv_entry *pgi_freelist;
-	int pgi_nfree;
-};
-
-/*
- * This is basically:
- * ((PAGE_SIZE - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
- */
-#if PAGE_SIZE == 8192
-#define	NPVPPG	340
-#else
-#define	NPVPPG	170
-#endif
-
-struct pv_page {
-	struct pv_page_info pvp_pgi;
-	struct pv_entry pvp_pv[NPVPPG];
-};
-
 #define	active_pmap(pm) \
 	((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
 #define	active_user_pmap(pm) \

Index: src/sys/arch/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.62 src/sys/arch/m68k/m68k/pmap_motorola.c:1.63
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.62	Sun Jun 12 03:35:43 2011
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Sat Oct 29 18:26:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.62 2011/06/12 03:35:43 rmind Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.63 2011/10/29 18:26:19 tsutsui 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.62 2011/06/12 03:35:43 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.63 2011/10/29 18:26:19 tsutsui Exp $");
 
 #include 
 #include 
@@ -283,9 +283,10 @@ pt_entry_t	*caddr1_pte;	/* PTE for CADDR
 pt_entry_t	*caddr2_pte;	/* PTE for CADDR2 */
 
 struct pool	pmap_pmap_pool;	/* memory pool for pmap structures */
+struct pool	pmap_pv_pool;	/* memory pool for pv entries */
 
-struct pv_entry *pmap_alloc_pv(void);
-void	pmap_free_pv(struct pv_entry *);
+#define pmap_alloc_pv()		pool_get(&pmap_pv_pool, PR_NOWAIT)
+#define pmap_free_pv(pv)	pool_put(&pmap_pv_pool, (pv))
 
 #define	PAGE_IS_MANAGED(pa)	(pmap_initialized && uvm_pageismanaged(pa))
 
@@ -543,6 +544,12 @@ pmap_init(void)
 	&pool_allocator_nointr, IPL_NONE);
 
 	/*
+	 * Initialize the pv_entry pools.
+	 */
+	pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pvpl",
+	&pool_allocator_nointr, IPL_NONE);
+
+	/*
 	 * Now that this is done, mark the pages shared with the
 	 * hardware page table search as non-CCB (actually, as CI).
 	 *
@@ -579,142 +586,6 @@ pmap_init(void)
 }
 
 /*
- * pmap_alloc_pv:
- *
- *	Allocate a pv_entry.
- */
-struct pv_entry *
-pmap_alloc_pv(void)
-{
-	struct pv_page *pvp;
-	struct pv_entry *pv;
-	int i;
-
-	if (pv_nfree == 0) {
-		pvp = (struct pv_page *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
-		UVM_KMF_WIRED | UVM_KMF_ZERO);
-		if (pvp == NULL)
-			panic("pmap_alloc_pv: uvm_km_alloc() failed");
-		pvp->pvp_pgi.pgi_freelist = pv = &pvp->pvp_pv[1];
-		for (i = NPVPPG - 2; i; i--, pv++)
-			pv->pv_next = pv + 1;
-		pv->pv_next = NULL;
-		pv_nfree += pvp->pvp_pgi.pgi_nfree = NPVPPG - 1;
-		TAILQ_INSERT_HEAD(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
-		pv = &pvp->pvp_pv[0];
-	} else {
-		--pv_nfree;
-		pvp = TAILQ_FIRST(&pv_page_freelist);
-		if (--pvp->pvp_pgi.pgi_nfree == 0) {
-			TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
-		}
-		pv = pvp->pvp_pgi.pgi_freelist;
-#ifdef DIAGNOSTIC
-		if (pv == NULL)
-			panic("pmap_alloc_pv: pgi_nfree inconsistent");
-#endif
-		pvp->pvp_pgi.pgi_freelist = pv->pv_next;
-	}
-	return pv;
-}
-
-

CVS commit: src/sys/arch/m68k

2011-01-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jan  6 13:49:17 UTC 2011

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

Log Message:
Use #ifdef CACHE_HAVE_VAC rather than #ifdef M68K_MMU_HP where
the pmap code indends.
(though currently only MMU_HP machines have VAC in pmap_motorola ports)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/m68k/m68k/pmap_motorola.c

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

Modified files:

Index: src/sys/arch/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.31 src/sys/arch/m68k/include/pmap_motorola.h:1.32
--- src/sys/arch/m68k/include/pmap_motorola.h:1.31	Sun Jan  2 05:21:11 2011
+++ src/sys/arch/m68k/include/pmap_motorola.h	Thu Jan  6 13:49:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.31 2011/01/02 05:21:11 tsutsui Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.32 2011/01/06 13:49:16 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -246,7 +246,7 @@
 #if defined(M68040) || defined(M68060)
 extern u_int		protostfree;
 #endif
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 extern u_int		pmap_aliasmask;
 #endif
 

Index: src/sys/arch/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.58 src/sys/arch/m68k/m68k/pmap_motorola.c:1.59
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.58	Sun Jan  2 05:21:11 2011
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Thu Jan  6 13:49:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.58 2011/01/02 05:21:11 tsutsui Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.59 2011/01/06 13:49:17 tsutsui 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.58 2011/01/02 05:21:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.59 2011/01/06 13:49:17 tsutsui Exp $");
 
 #include 
 #include 
@@ -270,7 +270,7 @@
 TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
 int		pv_nfree;
 
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 u_int		pmap_aliasmask;	/* seperation at which VA aliasing ok */
 #endif
 #if defined(M68040) || defined(M68060)
@@ -913,7 +913,7 @@
 	vaddr_t nssva;
 	pt_entry_t *pte;
 	int flags;
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 	bool firstpage = true, needcflush = false;
 #endif
 
@@ -944,7 +944,7 @@
 			}
 
 			if (pmap_pte_v(pte)) {
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 if (pmap_aliasmask) {
 
 	/*
@@ -976,7 +976,7 @@
 		}
 	}
 
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 
 	/*
 	 * Didn't do anything, no need for cache flushes
@@ -,7 +,7 @@
 		pte = pmap_pte(pmap, sva);
 		while (sva < nssva) {
 			if (pmap_pte_v(pte) && pmap_pte_prot_chg(pte, isro)) {
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 
 /*
  * Purge kernel side of VAC to ensure we
@@ -1313,7 +1313,7 @@
 			npv->pv_ptpmap = NULL;
 			pv->pv_next = npv;
 
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 
 			/*
 			 * Since there is another logical mapping for the
@@ -1391,7 +1391,7 @@
 		pmap->pm_stats.wired_count++;
 
 validate:
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 	/*
 	 * Purge kernel side of VAC to ensure we get correct state
 	 * of HW bits so we don't clobber them.
@@ -1448,7 +1448,7 @@
 	*pte = npte;
 	if (!wired && active_pmap(pmap))
 		TBIS(va);
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 	/*
 	 * The following is executed if we are entering a second
 	 * (or greater) mapping for a physical page and the mappings
@@ -1537,14 +1537,14 @@
 	pt_entry_t *pte;
 	vaddr_t nssva;
 	vaddr_t eva = va + size;
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 	bool firstpage, needcflush;
 #endif
 
 	PMAP_DPRINTF(PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT,
 	("pmap_kremove(%lx, %lx)\n", va, size));
 
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 	firstpage = true;
 	needcflush = false;
 #endif
@@ -1574,7 +1574,7 @@
 va += PAGE_SIZE;
 continue;
 			}
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 			if (pmap_aliasmask) {
 
 /*
@@ -1605,7 +1605,7 @@
 		}
 	}
 
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 
 	/*
 	 * In a couple of cases, we don't need to worry about flushing
@@ -1874,7 +1874,7 @@
 	PMAP_DPRINTF(PDB_FOLLOW, ("pmap_zero_page(%lx)\n", phys));
 
 	npte = phys | PG_V;
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 	if (pmap_aliasmask) {
 
 		/*
@@ -1932,7 +1932,7 @@
 
 	npte1 = src | PG_RO | PG_V;
 	npte2 = dst | PG_V;
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 	if (pmap_aliasmask) {
 
 		/*
@@ -2051,7 +2051,7 @@
 	return m68k_ptob(ppn);
 }
 
-#ifdef M68K_MMU_HP
+#ifdef CACHE_HAVE_VAC
 /*
  * pmap_prefer:			[ INTERFACE ]
  *
@@ -2074,7 +2074,7 @@
 		*vap = va + d;
 	}
 }
-#endif /* M68K_MMU_HP */
+#endif /* CACHE_HAVE_VAC */
 
 /*
  * Miscellaneous support routines follow
@@ -2123,7 +2123,7 

CVS commit: src/sys/arch/m68k

2009-12-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Dec  2 15:47:45 UTC 2009

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

Log Message:
Add a common pmap_bootstrap_finalize() function which initializes
lwp0 uarea, curlwp, and curpcb after MMU is turned on, using
lwp0uarea variable saved during pmap_bootstrap() (or equivalent functions)
for pmap_motorola based ports.  Discussed with rm...@.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/include/pcb.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/m68k/include/pmap_motorola.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/m68k/m68k/pmap_motorola.c

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

Modified files:

Index: src/sys/arch/m68k/include/pcb.h
diff -u src/sys/arch/m68k/include/pcb.h:1.7 src/sys/arch/m68k/include/pcb.h:1.8
--- src/sys/arch/m68k/include/pcb.h:1.7	Sun Mar  4 06:00:04 2007
+++ src/sys/arch/m68k/include/pcb.h	Wed Dec  2 15:47:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.7 2007/03/04 06:00:04 christos Exp $	*/
+/*	$NetBSD: pcb.h,v 1.8 2009/12/02 15:47:45 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -105,4 +105,7 @@
 struct md_coredump {
 	int	md_exec[16];	/* exec structure for HP-UX core dumps */
 };
+
+extern struct pcb *curpcb;
+
 #endif /* _M68K_PCB_H_ */

Index: src/sys/arch/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.21 src/sys/arch/m68k/include/pmap_motorola.h:1.22
--- src/sys/arch/m68k/include/pmap_motorola.h:1.21	Wed Aug 26 00:30:02 2009
+++ src/sys/arch/m68k/include/pmap_motorola.h	Wed Dec  2 15:47:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.21 2009/08/26 00:30:02 thorpej Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.22 2009/12/02 15:47:45 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -191,6 +191,10 @@
 extern void		*CADDR1, *CADDR2;
 extern void		*msgbufaddr;
 
+/* for lwp0 uarea initialization after MMU enabled */
+extern vaddr_t		lwp0uarea;
+void	pmap_bootstrap_finalize(void);
+
 vaddr_t	pmap_map(vaddr_t, paddr_t, paddr_t, int);
 void	pmap_procwr(struct proc *, vaddr_t, size_t);
 #define	PMAP_NEED_PROCWR

Index: src/sys/arch/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.51 src/sys/arch/m68k/m68k/pmap_motorola.c:1.52
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.51	Mon Nov 23 00:11:44 2009
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Wed Dec  2 15:47:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.51 2009/11/23 00:11:44 rmind Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.52 2009/12/02 15:47:45 tsutsui Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -117,7 +117,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.51 2009/11/23 00:11:44 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.52 2009/12/02 15:47:45 tsutsui Exp $");
 
 #include 
 #include 
@@ -240,6 +240,8 @@
 struct vm_map	*st_map, *pt_map;
 struct vm_map_kernel st_map_store, pt_map_store;
 
+vaddr_t		lwp0uarea;	/* lwp0 u-area VA, initialized in bootstrap */
+
 paddr_t		avail_start;	/* PA of first available physical page */
 paddr_t		avail_end;	/* PA of last available physical page */
 vsize_t		mem_size;	/* memory size in bytes */
@@ -314,6 +316,22 @@
 #define	PRM_KEEPPTPAGE	0x04
 
 /*
+ * pmap_bootstrap_finalize:	[ INTERFACE ]
+ *
+ *	Initialize lwp0 uarea, curlwp, and curpcb after MMU is turned on,
+ *	using lwp0uarea variable saved during pmap_bootstrap().
+ */
+void
+pmap_bootstrap_finalize(void)
+{
+
+	memset((void *)lwp0uarea, 0, USPACE);
+	uvm_lwp_setuarea(&lwp0, lwp0uarea);
+	curlwp = &lwp0;
+	curpcb = lwp_getpcb(&lwp0);
+}
+
+/*
  * pmap_virtual_space:		[ INTERFACE ]
  *
  *	Report the range of available kernel virtual address



CVS commit: src/sys/arch/m68k

2009-12-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec 19 13:08:26 UTC 2009

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

Log Message:
Move declaration of lwp_trampoline() into .


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/m68k/include/m68k.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/m68k/m68k/vm_machdep.c

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

Modified files:

Index: src/sys/arch/m68k/include/m68k.h
diff -u src/sys/arch/m68k/include/m68k.h:1.14 src/sys/arch/m68k/include/m68k.h:1.15
--- src/sys/arch/m68k/include/m68k.h:1.14	Sat May 30 17:52:05 2009
+++ src/sys/arch/m68k/include/m68k.h	Sat Dec 19 13:08:26 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k.h,v 1.14 2009/05/30 17:52:05 martin Exp $	*/
+/*	$NetBSD: m68k.h,v 1.15 2009/12/19 13:08:26 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -144,6 +144,7 @@
 int 	getsfc(void);
 
 /* switch_subr.s */
+void	lwp_trampoline(void);
 void	savectx(struct pcb *);
 
 /* w16copy.s */

Index: src/sys/arch/m68k/m68k/vm_machdep.c
diff -u src/sys/arch/m68k/m68k/vm_machdep.c:1.32 src/sys/arch/m68k/m68k/vm_machdep.c:1.33
--- src/sys/arch/m68k/m68k/vm_machdep.c:1.32	Sat Dec 19 12:31:34 2009
+++ src/sys/arch/m68k/m68k/vm_machdep.c	Sat Dec 19 13:08:26 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.32 2009/12/19 12:31:34 tsutsui Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.33 2009/12/19 13:08:26 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.32 2009/12/19 12:31:34 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.33 2009/12/19 13:08:26 tsutsui Exp $");
 
 #include 
 #include 
@@ -127,7 +127,6 @@
 	struct pcb *pcb1, *pcb2;
 	struct trapframe *tf;
 	struct switchframe *sf;
-	extern void lwp_trampoline(void);
 
 	pcb1 = lwp_getpcb(l1);
 	pcb2 = lwp_getpcb(l2);



CVS commit: src/sys/arch/m68k

2009-12-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec 19 18:06:52 UTC 2009

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

Log Message:
Move declaration of setfunc_trampoline() into .


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/include/m68k.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/m68k/m68k/vm_machdep.c

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

Modified files:

Index: src/sys/arch/m68k/include/m68k.h
diff -u src/sys/arch/m68k/include/m68k.h:1.15 src/sys/arch/m68k/include/m68k.h:1.16
--- src/sys/arch/m68k/include/m68k.h:1.15	Sat Dec 19 13:08:26 2009
+++ src/sys/arch/m68k/include/m68k.h	Sat Dec 19 18:06:51 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k.h,v 1.15 2009/12/19 13:08:26 tsutsui Exp $	*/
+/*	$NetBSD: m68k.h,v 1.16 2009/12/19 18:06:51 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -146,6 +146,7 @@
 /* switch_subr.s */
 void	lwp_trampoline(void);
 void	savectx(struct pcb *);
+void	setfunc_trampoline(void);
 
 /* w16copy.s */
 void	w16zero(void *, u_int);

Index: src/sys/arch/m68k/m68k/vm_machdep.c
diff -u src/sys/arch/m68k/m68k/vm_machdep.c:1.33 src/sys/arch/m68k/m68k/vm_machdep.c:1.34
--- src/sys/arch/m68k/m68k/vm_machdep.c:1.33	Sat Dec 19 13:08:26 2009
+++ src/sys/arch/m68k/m68k/vm_machdep.c	Sat Dec 19 18:06:52 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.33 2009/12/19 13:08:26 tsutsui Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.34 2009/12/19 18:06:52 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.33 2009/12/19 13:08:26 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.34 2009/12/19 18:06:52 tsutsui Exp $");
 
 #include 
 #include 
@@ -171,7 +171,6 @@
 	struct pcb *pcb = lwp_getpcb(l);
 	struct trapframe *tf = (struct trapframe *)l->l_md.md_regs;
 	struct switchframe *sf = (struct switchframe *)tf - 1;
-	extern void setfunc_trampoline(void);
 
 	sf->sf_pc = (u_int)setfunc_trampoline;
 	pcb->pcb_regs[6] = (int)func;		/* A2 */



CVS commit: src/sys/arch/m68k

2010-09-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 19 01:35:43 UTC 2010

Modified Files:
src/sys/arch/m68k/conf: files.m68k
Added Files:
src/sys/arch/m68k/m68k: cpu_in_cksum.c

Log Message:
Add m68k MD cpu_in_cksum.c.
Based on sys/netinet/cpu_in_cksum.c but just modified
to use traditional MD m68k/oc_cksum.s.

Makes ~5% improvements of ttcp(1) xfer rates on ATARI TT030 + SMC_TT.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/m68k/conf/files.m68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/m68k/cpu_in_cksum.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/conf/files.m68k
diff -u src/sys/arch/m68k/conf/files.m68k:1.46 src/sys/arch/m68k/conf/files.m68k:1.47
--- src/sys/arch/m68k/conf/files.m68k:1.46	Sun Jun  6 04:51:33 2010
+++ src/sys/arch/m68k/conf/files.m68k	Sun Sep 19 01:35:43 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.m68k,v 1.46 2010/06/06 04:51:33 mrg Exp $
+#	$NetBSD: files.m68k,v 1.47 2010/09/19 01:35:43 tsutsui Exp $
 #
 
 defflag	opt_fpsp.h		FPSP
@@ -13,6 +13,7 @@
 file	arch/m68k/m68k/copy.s
 file	arch/m68k/m68k/copypage.s
 file	arch/m68k/m68k/core_machdep.c		coredump
+file	arch/m68k/m68k/cpu_in_cksum.c		(inet | inet6) & cpu_in_cksum
 file	arch/m68k/m68k/db_disasm.c		ddb
 file	arch/m68k/m68k/db_interface.c		ddb
 file	arch/m68k/m68k/db_trace.c		ddb
@@ -21,7 +22,7 @@
 file	arch/m68k/m68k/lock_stubs.s
 file	arch/m68k/m68k/m68k_machdep.c
 file	arch/m68k/m68k/mappedcopy.c		mappedcopy
-file	arch/m68k/m68k/oc_cksum.s		inet
+file	arch/m68k/m68k/oc_cksum.s		(inet | inet6) & cpu_in_cksum
 file	arch/m68k/m68k/process_machdep.c
 file	arch/m68k/m68k/reenter_syscall.s
 file	arch/m68k/m68k/regdump.c

Added files:

Index: src/sys/arch/m68k/m68k/cpu_in_cksum.c
diff -u /dev/null src/sys/arch/m68k/m68k/cpu_in_cksum.c:1.1
--- /dev/null	Sun Sep 19 01:35:43 2010
+++ src/sys/arch/m68k/m68k/cpu_in_cksum.c	Sun Sep 19 01:35:43 2010
@@ -0,0 +1,123 @@
+/*	$NetBSD: cpu_in_cksum.c,v 1.1 2010/09/19 01:35:43 tsutsui Exp $	*/
+/*-
+ * Copyright (c) 2008 Joerg Sonnenberger .
+ * All rights reserved.
+ *
+ * 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.c,v 1.1 2010/09/19 01:35:43 tsutsui Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+
+/*
+ * Taken from sys/netinet/cpu_in_cksum.c and modified to use old MD oc_cksum().
+ */
+
+/* in  */
+extern int oc_cksum(uint8_t *, int, uint32_t);
+
+int
+cpu_in_cksum(struct mbuf *m, int len, int off, uint32_t initial_sum)
+{
+	int mlen;
+	uint32_t sum, partial;
+	unsigned int final_acc;
+	uint8_t *data;
+	bool needs_swap, started_on_odd;
+
+	KASSERT(len >= 0);
+	KASSERT(off >= 0);
+
+	needs_swap = false;
+	started_on_odd = false;
+	sum = (initial_sum >> 16) + (initial_sum & 0x);
+
+	for (;;) {
+		if (__predict_false(m == NULL)) {
+			printf("in_cksum: out of data\n");
+			return -1;
+		}
+		mlen = m->m_len;
+		if (mlen > off) {
+			mlen -= off;
+			data = mtod(m, uint8_t *) + off;
+			goto post_initial_offset;
+		}
+		off -= mlen;
+		if (len == 0)
+			break;
+		m = m->m_next;
+	}
+
+	for (; len > 0; m = m->m_next) {
+		if (__predict_false(m == NULL)) {
+			printf("in_cksum: out of data\n");
+			return -1;
+		}
+		mlen = m->m_len;
+		data = mtod(m, uint8_t *);
+ post_initial_offset:
+		if (mlen == 0)
+			continue;
+		if (mlen > len)
+			mlen = len;
+		len -= mlen;
+
+		partial = 0;
+		if ((uintptr_t)data & 1) {
+			/* Align on word boundary */
+			started_on_odd = !started_on_odd;
+			/* We are big endian */
+			partial = *data;
+			++data;
+			--mlen;
+		}
+		needs_swap = started_on_odd;
+
+		/* 

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

2020-12-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  6 02:26:33 UTC 2020

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

Log Message:
Don't expose register_t


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

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

Modified files:

Index: src/sys/arch/m68k/include/proc.h
diff -u src/sys/arch/m68k/include/proc.h:1.7 src/sys/arch/m68k/include/proc.h:1.8
--- src/sys/arch/m68k/include/proc.h:1.7	Thu Jan 13 21:06:27 2011
+++ src/sys/arch/m68k/include/proc.h	Sat Dec  5 21:26:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.7 2011/01/14 02:06:27 rmind Exp $	*/
+/*	$NetBSD: proc.h,v 1.8 2020/12/06 02:26:33 christos Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -57,7 +57,7 @@ struct lwp;
  */
 struct mdproc {
 	int	mdp_flags;		/* machine-dependent flags */
-	void	(*md_syscall)(register_t, struct lwp *, struct frame *);
+	void	(*md_syscall)(__register_t, struct lwp *, struct frame *);
 };
 
 /*



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

2020-09-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Sep  7 00:32:00 UTC 2020

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

Log Message:
pass a pointer conversion via uintptr_t *and* the desired type casts.
avoids new GCC 9 warnings with C++ code.


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

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

Modified files:

Index: src/sys/arch/m68k/include/mcontext.h
diff -u src/sys/arch/m68k/include/mcontext.h:1.10 src/sys/arch/m68k/include/mcontext.h:1.11
--- src/sys/arch/m68k/include/mcontext.h:1.10	Thu Feb 15 15:53:56 2018
+++ src/sys/arch/m68k/include/mcontext.h	Mon Sep  7 00:32:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.10 2018/02/15 15:53:56 kamil Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.11 2020/09/07 00:32:00 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -126,7 +126,8 @@ static __inline struct tls_tcb *
 __lwp_gettcb_fast(void)
 {
 	unsigned int __tcb = (unsigned int)_lwp_getprivate();
-	return (void *)(__tcb - TLS_TP_OFFSET - sizeof(struct tls_tcb));
+	return (struct tls_tcb *)(uintptr_t)
+	(__tcb - TLS_TP_OFFSET - sizeof(struct tls_tcb));
 }
 
 static inline void



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:   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-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-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/fpe

2021-03-08 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Mar  8 14:37:55 UTC 2021

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

Log Message:
Remove incorrect byte and word conversions from fpu_explode.
The correct operation here is arithmetic right shift, but nobody calls it.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/fpe/fpu_explode.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_explode.c
diff -u src/sys/arch/m68k/fpe/fpu_explode.c:1.15 src/sys/arch/m68k/fpe/fpu_explode.c:1.16
--- src/sys/arch/m68k/fpe/fpu_explode.c:1.15	Thu Feb  5 12:23:27 2015
+++ src/sys/arch/m68k/fpe/fpu_explode.c	Mon Mar  8 14:37:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_explode.c,v 1.15 2015/02/05 12:23:27 isaki Exp $ */
+/*	$NetBSD: fpu_explode.c,v 1.16 2021/03/08 14:37:55 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.15 2015/02/05 12:23:27 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.16 2021/03/08 14:37:55 isaki Exp $");
 
 #include 
 #include 
@@ -230,11 +230,6 @@ fpu_explode(struct fpemu *fe, struct fpn
 	fp->fp_sign = s >> 31;
 	fp->fp_sticky = 0;
 	switch (type) {
-
-	case FTYPE_BYT:
-		s >>= 8;
-	case FTYPE_WRD:
-		s >>= 16;
 	case FTYPE_LNG:
 		s = fpu_itof(fp, s);
 		break;
@@ -251,6 +246,10 @@ fpu_explode(struct fpemu *fe, struct fpn
 		s = fpu_xtof(fp, s, space[1], space[2]);
 		break;
 
+	case FTYPE_BYT:
+	case FTYPE_WRD:
+		/* Caller must cast it to signed LNG instead of calling this */
+		/* FALLTHROUGH */
 	default:
 		panic("fpu_explode");
 	}



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

2017-07-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  2 14:10:23 UTC 2017

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

Log Message:
remove f_pad, conflicts with new  define.


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

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

Modified files:

Index: src/sys/arch/m68k/include/cpuframe.h
diff -u src/sys/arch/m68k/include/cpuframe.h:1.5 src/sys/arch/m68k/include/cpuframe.h:1.6
--- src/sys/arch/m68k/include/cpuframe.h:1.5	Tue Feb  8 15:20:16 2011
+++ src/sys/arch/m68k/include/cpuframe.h	Sun Jul  2 10:10:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuframe.h,v 1.5 2011/02/08 20:20:16 rmind Exp $	*/
+/*	$NetBSD: cpuframe.h,v 1.6 2017/07/02 14:10:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -128,7 +128,6 @@ struct frame {
 };
 
 #define	f_regs		F_t.tf_regs
-#define	f_pad		F_t.tf_pad
 #define	f_stackadj	F_t.tf_stackadj
 #define	f_sr		F_t.tf_sr
 #define	f_pc		F_t.tf_pc



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

2017-11-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov  5 16:16:26 UTC 2017

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

Log Message:
The XXX comment (do not pull in the uvm headers) might have been a nice idea
at the time, but now all other db_machdep files do this, so we follow suit.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/m68k/include/db_machdep.h

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

Modified files:

Index: src/sys/arch/m68k/include/db_machdep.h
diff -u src/sys/arch/m68k/include/db_machdep.h:1.31 src/sys/arch/m68k/include/db_machdep.h:1.32
--- src/sys/arch/m68k/include/db_machdep.h:1.31	Tue Jan 31 16:17:57 2012
+++ src/sys/arch/m68k/include/db_machdep.h	Sun Nov  5 11:16:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.31 2012/01/31 21:17:57 mlelstv Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.32 2017/11/05 16:16:26 christos Exp $	*/
 
 /* 
  * Mach Operating System
@@ -40,11 +40,7 @@
 
 #include 
 
-/*
- * XXX - Would rather not pull in vm headers, but need boolean_t,
- * at least until boolean_t moves to  or someplace.
- */
-#include 
+#include 
 
 #include 
 #include 



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

2015-09-04 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Sep  4 09:18:12 UTC 2015

Modified Files:
src/sys/arch/m68k/fpsp: Makefile.inc

Log Message:
Fix m68k build.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/fpsp/Makefile.inc

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

Modified files:

Index: src/sys/arch/m68k/fpsp/Makefile.inc
diff -u src/sys/arch/m68k/fpsp/Makefile.inc:1.16 src/sys/arch/m68k/fpsp/Makefile.inc:1.17
--- src/sys/arch/m68k/fpsp/Makefile.inc:1.16	Sat Feb 28 16:11:39 2009
+++ src/sys/arch/m68k/fpsp/Makefile.inc	Fri Sep  4 09:18:11 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.16 2009/02/28 16:11:39 tsutsui Exp $
+#	$NetBSD: Makefile.inc,v 1.17 2015/09/04 09:18:11 uebayasi Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -41,6 +41,9 @@ FPSPMAKE= \
 	FPSPDIR=${FPSPDIR:Q} \
 	${FPSPMISCMAKEFLAGS}
 
+fpsp.o: ${FPSP}
+	ln -sf ${FPSP} $@
+
 ${FPSP}:		.NOTMAIN __always_make_fpsp
 	@echo making sure the 68040 FPSP is up to date...
 	@${FPSPMAKE} fpsp.o



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-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.

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

2017-09-13 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Wed Sep 13 09:55:35 UTC 2017

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

Log Message:
The __fgetenv() macro operates on a fenv_t, not on a fenv_t *.
Fixes a segfault in fegetenv() and feholdexcept().


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

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

Modified files:

Index: src/sys/arch/m68k/include/fenv.h
diff -u src/sys/arch/m68k/include/fenv.h:1.6 src/sys/arch/m68k/include/fenv.h:1.7
--- src/sys/arch/m68k/include/fenv.h:1.6	Wed Mar 22 23:11:09 2017
+++ src/sys/arch/m68k/include/fenv.h	Wed Sep 13 09:55:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.6 2017/03/22 23:11:09 chs Exp $	*/
+/*	$NetBSD: fenv.h,v 1.7 2017/09/13 09:55:35 phx Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -210,7 +210,7 @@ fesetround(int __round)
 __fenv_static inline int
 fegetenv(fenv_t *__envp)
 {
-	__fgetenv(__envp);
+	__fgetenv(*__envp);
 
 	return 0;
 }
@@ -220,7 +220,7 @@ feholdexcept(fenv_t *__envp)
 {
 	fexcept_t __fpcr, __fpsr;
 
-	__fgetenv(__envp);
+	__fgetenv(*__envp);
 	__fpsr = __envp->fpsr & ~FE_ALL_EXCEPT;
 	__set_fpsr(__fpsr);	/* clear all */
 	__fpcr = __envp->fpcr & ~(FE_ALL_EXCEPT << 6);



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

2015-12-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 24 14:12:39 UTC 2015

Modified Files:
src/sys/arch/m68k/include: Makefile
Added Files:
src/sys/arch/m68k/include: fenv.h

Log Message:
fenv for m68k


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/m68k/include/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/m68k/include/fenv.h

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

Modified files:

Index: src/sys/arch/m68k/include/Makefile
diff -u src/sys/arch/m68k/include/Makefile:1.28 src/sys/arch/m68k/include/Makefile:1.29
--- src/sys/arch/m68k/include/Makefile:1.28	Wed Jul 17 01:42:02 2013
+++ src/sys/arch/m68k/include/Makefile	Thu Dec 24 09:12:39 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.28 2013/07/17 05:42:02 matt Exp $
+#	$NetBSD: Makefile,v 1.29 2015/12/24 14:12:39 christos Exp $
 
 INCSDIR= /usr/include/m68k
 
@@ -7,7 +7,7 @@ INCS=	ansi.h aout_machdep.h asm.h asm_si
 	cacheops.h cacheops_20.h cacheops_30.h cacheops_40.h cacheops_60.h \
 	cdefs.h cpu.h cpuframe.h \
 	elf_machdep.h endian.h endian_machdep.h \
-	float.h fpreg.h frame.h \
+	fenv.h float.h fpreg.h frame.h \
 	ieee.h ieeefp.h \
 	int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
 	kcore.h \

Added files:

Index: src/sys/arch/m68k/include/fenv.h
diff -u /dev/null src/sys/arch/m68k/include/fenv.h:1.1
--- /dev/null	Thu Dec 24 09:12:39 2015
+++ src/sys/arch/m68k/include/fenv.h	Thu Dec 24 09:12:39 2015
@@ -0,0 +1,302 @@
+/*	$NetBSD: fenv.h,v 1.1 2015/12/24 14:12:39 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _M68K_FENV_H_
+#define _M68K_FENV_H_
+
+#include 
+#include 
+#include 
+
+#ifndef __fenv_static   
+#define __fenv_static   static
+#endif
+
+/* Exception bits, from FPSR */
+#define	FE_INEXACT	FPSR_AINEX
+#define	FE_DIVBYZERO	FPSR_ADZ
+#define	FE_UNDERFLOW	FPSR_AUNFL
+#define	FE_OVERFLOW	FPSR_AOVFL
+#define	FE_INVALID	FPSR_AIOP
+
+#define FE_ALL_EXCEPT \
+(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* Rounding modes, from FPSR */
+#define FE_TONEAREST	FPCR_NEAR
+#define	FE_TOWARDZERO	FPCR_ZERO
+#define	FE_DOWNWARD	FPCR_MINF
+#define	FE_UPWARD	FPCR_PINF
+
+#define _ROUND_MASK	\
+(FE_TONEAREST | FE_TOWARDZERO | FE_DOWNWARD | FE_UPWARD)
+
+typedef uint32_t fexcept_t;
+
+/* same layout as fmovem */
+typedef struct {
+	uint32_t fpcr;
+	uint32_t fpsr;
+	uint32_t fppc;
+} fenv_t;
+
+#define FE_DFL_ENV	((fenv_t *) -1)
+
+#define __get_fpcr(__fpcr) \
+__asm__ __volatile__ ("fmove%.l %!,%0" : "=dm" (__fpcr))
+#define __set_fpcr(__fpcr) \
+__asm__ __volatile__ ("fmove%.l %0,%!" : : "dm" (__fpcr))
+
+#define __get_fpsr(__fpsr) \
+__asm__ __volatile__ ("fmove%.l %/fpsr,%0" : "=dm" (__fpsr))
+#define __set_fpsr(__fpsr) \
+__asm__ __volatile__ ("fmove%.l %0,%/fpsr" : : "dm" (__fpsr))
+
+#define __fmul(__s, __t, __d) \
+do { \
+	__t d = __d; \
+	__asm__ __volatile__ ("fmul" __s "; fnop" : "=f" (d) : "0" (d)); \
+} while (/*CONSTCOND*/0) 
+
+#define __fdiv(__s, __t, __d) \
+do { \
+	__t d = __d; \
+	__asm__ __volatile__ ("fdiv" __s "; fnop" : "=f" (d) : "0" (d)); \
+} while (/*CONSTCOND*/0) 
+
+#define __fetox(__s, __t, __d) \
+do { \
+	__t d = __d; \
+	__asm__ __volatile__ ("fetox" __s "; fnop" : "=f" (d) : "0" (d)); \
+} while (/*CONSTCOND*/0) 
+
+#define __fgetenv(__envp) \
+__asm__ __volatile__ ("fmovem%.l %/fpcr/%/fpsr/%/fpiar,%0" :

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

2015-12-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 25 06:03:06 UTC 2015

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

Log Message:
get rid of dup fenv.


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

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

Modified files:

Index: src/sys/arch/m68k/include/ieeefp.h
diff -u src/sys/arch/m68k/include/ieeefp.h:1.7 src/sys/arch/m68k/include/ieeefp.h:1.8
--- src/sys/arch/m68k/include/ieeefp.h:1.7	Tue Jan 27 14:04:39 2009
+++ src/sys/arch/m68k/include/ieeefp.h	Fri Dec 25 01:03:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieeefp.h,v 1.7 2009/01/27 19:04:39 martin Exp $	*/
+/*	$NetBSD: ieeefp.h,v 1.8 2015/12/25 06:03:06 christos Exp $	*/
 
 /* 
  * Written by J.T. Conklin, Apr 6, 1995
@@ -13,21 +13,7 @@
 
 #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
 
-typedef int fenv_t;
-typedef int fexcept_t;
-
-#define	FE_INEXACT	0x01	/* imprecise (loss of precision) */
-#define	FE_DIVBYZERO	0x02	/* divide-by-zero exception */
-#define	FE_UNDERFLOW	0x04	/* overflow exception */
-#define	FE_OVERFLOW	0x08	/* underflow exception */
-#define	FE_INVALID	0x10	/* invalid operation exception */
-
-#define	FE_ALL_EXCEPT	0x1f
-
-#define	FE_TONEAREST	0	/* round to nearest representable number */
-#define	FE_TOWARDZERO	1	/* round to zero (truncate) */
-#define	FE_DOWNWARD	2	/* round toward negative infinity */
-#define	FE_UPWARD	3	/* round toward positive infinity */
+#include 
 
 #if !defined(_ISOC99_SOURCE)
 
@@ -52,11 +38,10 @@ typedef enum {
 FP_PD=2			/* double-precision (53-bit) */
 } fp_prec;
 
-#endif /* defined(_NETBSD_SOURCE) */
+#endif /* !_ISOC99_SOURCE */
 
 #define	__HAVE_FP_PREC
 
-
 #endif	/* _NETBSD_SOURCE || _ISOC99_SOURCE */
 
 #endif /* _M68K_IEEEFP_H_ */



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

2015-12-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 25 16:19:38 UTC 2015

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

Log Message:
make this compile for c++


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

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

Modified files:

Index: src/sys/arch/m68k/include/fenv.h
diff -u src/sys/arch/m68k/include/fenv.h:1.1 src/sys/arch/m68k/include/fenv.h:1.2
--- src/sys/arch/m68k/include/fenv.h:1.1	Thu Dec 24 09:12:39 2015
+++ src/sys/arch/m68k/include/fenv.h	Fri Dec 25 11:19:38 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.1 2015/12/24 14:12:39 christos Exp $	*/
+/*	$NetBSD: fenv.h,v 1.2 2015/12/25 16:19:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -104,6 +104,8 @@ typedef struct {
 #define __fsetenv(__envp) \
 __asm__ __volatile__ ("fmovem%.l %0,%/fpcr/%/fpsr/%/fpiar" : : "m" (__envp))
 
+__BEGIN_DECLS
+
 __fenv_static inline int
 feclearexcept(int __excepts)
 {
@@ -218,9 +220,9 @@ feholdexcept(fenv_t *__envp)
 
 	__fgetenv(__envp);
 	__fpsr = __envp->fpsr & ~FE_ALL_EXCEPT;
-	__fset_fpsr(__fpsr);	/* clear all */
+	__set_fpsr(__fpsr);	/* clear all */
 	__fpcr = __envp->fpcr & ~(FE_ALL_EXCEPT << 6);
-	__fset_fpcr(__fpcr);	/* set non/stop */
+	__set_fpcr(__fpcr);	/* set non/stop */
 
 	return 0;
 }



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

2015-12-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 29 16:02:37 UTC 2015

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

Log Message:
disable code that does not work for sun2/coldfire


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

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

Modified files:

Index: src/sys/arch/m68k/include/fenv.h
diff -u src/sys/arch/m68k/include/fenv.h:1.2 src/sys/arch/m68k/include/fenv.h:1.3
--- src/sys/arch/m68k/include/fenv.h:1.2	Fri Dec 25 11:19:38 2015
+++ src/sys/arch/m68k/include/fenv.h	Tue Dec 29 11:02:37 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.2 2015/12/25 16:19:38 christos Exp $	*/
+/*	$NetBSD: fenv.h,v 1.3 2015/12/29 16:02:37 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -59,6 +59,8 @@
 #define _ROUND_MASK	\
 (FE_TONEAREST | FE_TOWARDZERO | FE_DOWNWARD | FE_UPWARD)
 
+#if !defined(__mc68010__) && !defined(__mcoldfire__)
+
 typedef uint32_t fexcept_t;
 
 /* same layout as fmovem */
@@ -299,6 +301,8 @@ fegetexcept(void)
 
 #endif /* _NETBSD_SOURCE || _GNU_SOURCE */
 
+#endif /* !__m68010__ && !__mcoldfire__ */
+
 __END_DECLS
 
 #endif /* _M68K_FENV_H_ */



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

2016-01-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Jan  5 00:47:08 UTC 2016

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

Log Message:
Fix #endif; it should be after __END_DECLS

This unbreaks the build of sun2.


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

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

Modified files:

Index: src/sys/arch/m68k/include/fenv.h
diff -u src/sys/arch/m68k/include/fenv.h:1.3 src/sys/arch/m68k/include/fenv.h:1.4
--- src/sys/arch/m68k/include/fenv.h:1.3	Tue Dec 29 16:02:37 2015
+++ src/sys/arch/m68k/include/fenv.h	Tue Jan  5 00:47:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.3 2015/12/29 16:02:37 christos Exp $	*/
+/*	$NetBSD: fenv.h,v 1.4 2016/01/05 00:47:08 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -301,8 +301,8 @@ fegetexcept(void)
 
 #endif /* _NETBSD_SOURCE || _GNU_SOURCE */
 
-#endif /* !__m68010__ && !__mcoldfire__ */
-
 __END_DECLS
 
+#endif /* !__m68010__ && !__mcoldfire__ */
+
 #endif /* _M68K_FENV_H_ */



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

2016-12-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Dec  5 15:31:01 UTC 2016

Modified Files:
src/sys/arch/m68k/fpe: fpu_exp.c fpu_hyperb.c

Log Message:
Improve the exponential and hyperbolic function's performance
10..100 times faster.
PR port-m68k/51645 from rin@ (and modified by me)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/fpe/fpu_exp.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/fpe/fpu_hyperb.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_exp.c
diff -u src/sys/arch/m68k/fpe/fpu_exp.c:1.8 src/sys/arch/m68k/fpe/fpu_exp.c:1.9
--- src/sys/arch/m68k/fpe/fpu_exp.c:1.8	Sat Apr 20 04:54:22 2013
+++ src/sys/arch/m68k/fpe/fpu_exp.c	Mon Dec  5 15:31:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_exp.c,v 1.8 2013/04/20 04:54:22 isaki Exp $	*/
+/*	$NetBSD: fpu_exp.c,v 1.9 2016/12/05 15:31:01 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_exp.c,v 1.8 2013/04/20 04:54:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_exp.c,v 1.9 2016/12/05 15:31:01 isaki Exp $");
 
 #include 
 
@@ -100,12 +100,16 @@ fpu_etox_taylor(struct fpemu *fe)
 }
 
 /*
- * exp(x)
+ * exp(x) = 2^k * exp(r) with k = round(x / ln2) and r = x - k * ln2
+ *
+ * Algorithm partially taken from libm, where exp(r) is approximated by a
+ * rational function of r. We use the Taylor expansion instead.
  */
 struct fpn *
 fpu_etox(struct fpemu *fe)
 {
-	struct fpn *fp;
+	struct fpn x, *fp;
+	int j, k;
 
 	if (ISNAN(&fe->fe_f2))
 		return &fe->fe_f2;
@@ -115,19 +119,47 @@ fpu_etox(struct fpemu *fe)
 		return &fe->fe_f2;
 	}
 
-	if (fe->fe_f2.fp_sign == 0) {
-		/* exp(x) */
-		fp = fpu_etox_taylor(fe);
-	} else {
-		/* 1/exp(-x) */
-		fe->fe_f2.fp_sign = 0;
-		fp = fpu_etox_taylor(fe);
+	CPYFPN(&x, &fe->fe_f2);
 
-		CPYFPN(&fe->fe_f2, fp);
-		fpu_const(&fe->fe_f1, FPU_CONST_1);
-		fp = fpu_div(fe);
+	/* k = round(x / ln2) */
+	CPYFPN(&fe->fe_f1, &fe->fe_f2);
+	fpu_const(&fe->fe_f2, FPU_CONST_LN_2);
+	fp = fpu_div(fe);
+	CPYFPN(&fe->fe_f2, fp);
+	fp = fpu_int(fe);
+	if (ISZERO(fp)) {
+		/* k = 0 */
+		CPYFPN(&fe->fe_f2, &x);
+		fp = fpu_etox_taylor(fe);
+		return fp;
+	}
+	/* extract k as integer format from fpn format */
+	j = FP_LG - fp->fp_exp;
+	if (j < 0) {
+		if (fp->fp_sign)
+			fp->fp_class = FPC_ZERO;		/* k < -2^18 */
+		else
+			fp->fp_class = FPC_INF;			/* k >  2^18 */
+		return fp;
 	}
-	
+	k = fp->fp_mant[0] >> j;
+	if (fp->fp_sign)
+		k *= -1;
+
+	/* exp(r) = exp(x - k * ln2) */
+	CPYFPN(&fe->fe_f1, fp);
+	fpu_const(&fe->fe_f2, FPU_CONST_LN_2);
+	fp = fpu_mul(fe);
+	fp->fp_sign = !fp->fp_sign;
+	CPYFPN(&fe->fe_f1, fp);
+	CPYFPN(&fe->fe_f2, &x);
+	fp = fpu_add(fe);
+	CPYFPN(&fe->fe_f2, fp);
+	fp = fpu_etox_taylor(fe);
+
+	/* 2^k */
+	fp->fp_exp += k;
+
 	return fp;
 }
 

Index: src/sys/arch/m68k/fpe/fpu_hyperb.c
diff -u src/sys/arch/m68k/fpe/fpu_hyperb.c:1.16 src/sys/arch/m68k/fpe/fpu_hyperb.c:1.17
--- src/sys/arch/m68k/fpe/fpu_hyperb.c:1.16	Fri Oct 11 03:37:08 2013
+++ src/sys/arch/m68k/fpe/fpu_hyperb.c	Mon Dec  5 15:31:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_hyperb.c,v 1.16 2013/10/11 03:37:08 isaki Exp $	*/
+/*	$NetBSD: fpu_hyperb.c,v 1.17 2016/12/05 15:31:01 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -57,15 +57,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_hyperb.c,v 1.16 2013/10/11 03:37:08 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_hyperb.c,v 1.17 2016/12/05 15:31:01 isaki Exp $");
 
 #include 
 
 #include "fpu_emulate.h"
 
-/* The number of items to terminate the Taylor expansion */
-#define MAX_ITEMS	(2000)
-
 /*
  * fpu_hyperb.c: defines the following functions
  *
@@ -137,71 +134,14 @@ fpu_atanh(struct fpemu *fe)
 }
 
 /*
- * taylor expansion used by sinh(), cosh().
+ *exp(x) + exp(-x)
+ * cosh(x) = --
+ *   2
  */
-static struct fpn *
-__fpu_sinhcosh_taylor(struct fpemu *fe, struct fpn *s0, uint32_t f)
-{
-	struct fpn res;
-	struct fpn x2;
-	struct fpn *s1;
-	struct fpn *r;
-	int sign;
-	uint32_t k;
-
-	/* x2 := x * x */
-	CPYFPN(&fe->fe_f1, &fe->fe_f2);
-	r = fpu_mul(fe);
-	CPYFPN(&x2, r);
-
-	/* res := s0 */
-	CPYFPN(&res, s0);
-
-	sign = 1;	/* sign := (-1)^n */
-
-	for (; f < (2 * MAX_ITEMS); ) {
-		/* (f1 :=) s0 * x^2 */
-		CPYFPN(&fe->fe_f1, s0);
-		CPYFPN(&fe->fe_f2, &x2);
-		r = fpu_mul(fe);
-		CPYFPN(&fe->fe_f1, r);
-
-		/*
-		 * for sinh(),  s1 := s0 * x^2 / (2n+1)2n
-		 * for cosh(),  s1 := s0 * x^2 / 2n(2n-1)
-		 */
-		k = f * (f + 1);
-		fpu_explode(fe, &fe->fe_f2, FTYPE_LNG, &k);
-		s1 = fpu_div(fe);
-
-		/* break if s1 is enough small */
-		if (ISZERO(s1))
-			break;
-		if (res.fp_exp - s1->fp_exp >= EXT_FRACBITS)
-			break;
-
-		/* s0 := s1 for next loop */
-		CPYFPN(s0, s1);
-
-		/* res += s1 */
-		CPYFPN(&fe->fe_f2, s1);
-		CPYFPN(&fe->fe_f1, &res);
-		r = fpu_add(fe);
-		CPYFPN(&res, r);
-
-		f +=

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

2016-12-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Dec  6 05:58:19 UTC 2016

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

Log Message:
Remove fpu_cordit2() and atanh_table[] completely.
Since cordit1 (for trigonometric functions) and cordit2 (for
hyperbolic functions) are very similar, so I implemented both
at first, but I didn't use cordit2 after all :(


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/fpe/fpu_cordic.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/m68k/fpe/fpu_emulate.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/fpe/fpu_cordic.c
diff -u src/sys/arch/m68k/fpe/fpu_cordic.c:1.3 src/sys/arch/m68k/fpe/fpu_cordic.c:1.4
--- src/sys/arch/m68k/fpe/fpu_cordic.c:1.3	Thu Aug  4 05:35:18 2016
+++ src/sys/arch/m68k/fpe/fpu_cordic.c	Tue Dec  6 05:58:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_cordic.c,v 1.3 2016/08/04 05:35:18 isaki Exp $	*/
+/*	$NetBSD: fpu_cordic.c,v 1.4 2016/12/06 05:58:19 isaki Exp $	*/
 
 /*
  * Copyright (c) 2013 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_cordic.c,v 1.3 2016/08/04 05:35:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_cordic.c,v 1.4 2016/12/06 05:58:19 isaki Exp $");
 
 #include 
 
@@ -46,7 +46,7 @@ struct sfpn {
 #if defined(CORDIC_BOOTSTRAP)
 /*
  * This is a bootstrap code to generate a pre-calculated tables such as
- * atan_table[] and atanh_table[].  However, it's just for reference.
+ * atan_table[].  However, it's just for reference.
  * If you want to run the bootstrap, you will define CORDIC_BOOTSTRAP
  * and modify these files as a userland application.
  */
@@ -58,19 +58,13 @@ struct sfpn {
 
 static void prepare_cordic_const(struct fpemu *);
 static struct fpn *fpu_gain1_cordic(struct fpemu *);
-static struct fpn *fpu_gain2_cordic(struct fpemu *);
 static struct fpn *fpu_atan_taylor(struct fpemu *);
 static void printf_fpn(const struct fpn *);
 static void printf_sfpn(const struct sfpn *);
 static void fpn_to_sfpn(struct sfpn *, const struct fpn *);
 
 static struct sfpn atan_table[EXT_FRACBITS];
-static struct sfpn atanh_table[EXT_FRACBITS];
 static struct fpn inv_gain1;
-static struct fpn inv_gain2;
-
-static void fpu_cordit2(struct fpemu *,
-	struct fpn *, struct fpn *, struct fpn *, const struct fpn *);
 
 int
 main(int argc, char *argv[])
@@ -91,21 +85,9 @@ main(int argc, char *argv[])
 	}
 	printf("};\n\n");
 
-	printf("static const struct sfpn atanh_table[] = {\n");
-	for (i = 0; i < EXT_FRACBITS; i++) {
-		printf("\t");
-		printf_sfpn(&atanh_table[i]);
-		printf(",\n");
-	}
-	printf("};\n\n");
-
 	printf("const struct fpn fpu_cordic_inv_gain1 =\n\t");
 	printf_fpn(&inv_gain1);
 	printf(";\n\n");
-
-	printf("const struct fpn fpu_cordic_inv_gain2 =\n\t");
-	printf_fpn(&inv_gain2);
-	printf(";\n\n");
 }
 
 /*
@@ -120,7 +102,7 @@ prepare_cordic_const(struct fpemu *fe)
 	struct fpn *r;
 	int i;
 
-	/* atan_table and atanh_table */
+	/* atan_table */
 	fpu_const(&t, FPU_CONST_1);
 	for (i = 0; i < EXT_FRACBITS; i++) {
 		/* atan(t) */
@@ -130,32 +112,6 @@ prepare_cordic_const(struct fpemu *fe)
 
 		/* t /= 2 */
 		t.fp_exp--;
-
-		/* (1-t) */
-		fpu_const(&fe->fe_f1, FPU_CONST_1);
-		CPYFPN(&fe->fe_f2, &t);
-		fe->fe_f2.fp_sign = 1;
-		r = fpu_add(fe);
-		CPYFPN(&x, r);
-
-		/* (1+t) */
-		fpu_const(&fe->fe_f1, FPU_CONST_1);
-		CPYFPN(&fe->fe_f2, &t);
-		r = fpu_add(fe);
-
-		/* r = (1+t)/(1-t) */
-		CPYFPN(&fe->fe_f1, r);
-		CPYFPN(&fe->fe_f2, &x);
-		r = fpu_div(fe);
-
-		/* r = log(r) */
-		CPYFPN(&fe->fe_f2, r);
-		r = fpu_logn(fe);
-
-		/* r /= 2 */
-		r->fp_exp--;
-
-		fpn_to_sfpn(&atanh_table[i], r);
 	}
 
 	/* inv_gain1 = 1 / gain1cordic() */
@@ -164,13 +120,6 @@ prepare_cordic_const(struct fpemu *fe)
 	fpu_const(&fe->fe_f1, FPU_CONST_1);
 	r = fpu_div(fe);
 	CPYFPN(&inv_gain1, r);
-
-	/* inv_gain2 = 1 / gain2cordic() */
-	r = fpu_gain2_cordic(fe);
-	CPYFPN(&fe->fe_f2, r);
-	fpu_const(&fe->fe_f1, FPU_CONST_1);
-	r = fpu_div(fe);
-	CPYFPN(&inv_gain2, r);
 }
 
 static struct fpn *
@@ -192,25 +141,6 @@ fpu_gain1_cordic(struct fpemu *fe)
 	return &fe->fe_f2;
 }
 
-static struct fpn *
-fpu_gain2_cordic(struct fpemu *fe)
-{
-	struct fpn x;
-	struct fpn y;
-	struct fpn z;
-	struct fpn v;
-
-	fpu_const(&x, FPU_CONST_1);
-	fpu_const(&y, FPU_CONST_0);
-	fpu_const(&z, FPU_CONST_0);
-	CPYFPN(&v, &x);
-	v.fp_sign = !v.fp_sign;
-
-	fpu_cordit2(fe, &x, &y, &z, &v);
-	CPYFPN(&fe->fe_f2, &x);
-	return &fe->fe_f2;
-}
-
 /*
  * arctan(x) = pi/4 (for |x| = 1)
  *
@@ -373,79 +303,9 @@ static const struct sfpn atan_table[] = 
 	{ 0xc104, 0x, 0x, },
 };
 
-static const struct sfpn atanh_table[] = {
-	{ 0xff0464fa, 0x9eab40c2, 0xa5dc43f6, },
-	{ 0xfe04162b, 0xbea04514, 0x69ca8e4a, },
-	{ 0xfd040562, 0x4727abbd, 0xda654b67, },
-	{ 0xfc040156, 0x22b4dd6b, 0x372a679c, },
-	{ 0xfb040055, 0x62246bb8, 0x92d60b35, },
-	

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

2016-12-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Dec  6 06:41:14 UTC 2016

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

Log Message:
Fix sign of NAN.  Found by XM6i.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_mul.c
diff -u src/sys/arch/m68k/fpe/fpu_mul.c:1.8 src/sys/arch/m68k/fpe/fpu_mul.c:1.9
--- src/sys/arch/m68k/fpe/fpu_mul.c:1.8	Tue Mar 26 11:30:21 2013
+++ src/sys/arch/m68k/fpe/fpu_mul.c	Tue Dec  6 06:41:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_mul.c,v 1.8 2013/03/26 11:30:21 isaki Exp $ */
+/*	$NetBSD: fpu_mul.c,v 1.9 2016/12/06 06:41:14 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.8 2013/03/26 11:30:21 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.9 2016/12/06 06:41:14 isaki Exp $");
 
 #include 
 
@@ -122,7 +122,6 @@ fpu_mul(struct fpemu *fe)
 	 */
 	ORDER(x, y);
 	if (ISNAN(y)) {
-		y->fp_sign ^= x->fp_sign;
 		return (y);
 	}
 	if (ISINF(y)) {



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

2016-12-07 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Dec  7 11:27:18 UTC 2016

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

Log Message:
Fix sign of zero in case of x > -(2^18).
# By the way, I will modify this case later.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_exp.c
diff -u src/sys/arch/m68k/fpe/fpu_exp.c:1.9 src/sys/arch/m68k/fpe/fpu_exp.c:1.10
--- src/sys/arch/m68k/fpe/fpu_exp.c:1.9	Mon Dec  5 15:31:01 2016
+++ src/sys/arch/m68k/fpe/fpu_exp.c	Wed Dec  7 11:27:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_exp.c,v 1.9 2016/12/05 15:31:01 isaki Exp $	*/
+/*	$NetBSD: fpu_exp.c,v 1.10 2016/12/07 11:27:18 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_exp.c,v 1.9 2016/12/05 15:31:01 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_exp.c,v 1.10 2016/12/07 11:27:18 isaki Exp $");
 
 #include 
 
@@ -136,10 +136,12 @@ fpu_etox(struct fpemu *fe)
 	/* extract k as integer format from fpn format */
 	j = FP_LG - fp->fp_exp;
 	if (j < 0) {
-		if (fp->fp_sign)
+		if (fp->fp_sign) {
 			fp->fp_class = FPC_ZERO;		/* k < -2^18 */
-		else
+			fp->fp_sign = 0;
+		} else {
 			fp->fp_class = FPC_INF;			/* k >  2^18 */
+		}
 		return fp;
 	}
 	k = fp->fp_mant[0] >> j;



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

2016-08-03 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Aug  4 05:35:19 UTC 2016

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

Log Message:
Move fpu_cordit2() to #ifdef CORDIC_BOOTSTRAP section.
This reduces ~2KB text segment.
Reported by Krister Walfridsson on tech-kern two months ago.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/m68k/fpe/fpu_cordic.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/fpe/fpu_emulate.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/fpe/fpu_cordic.c
diff -u src/sys/arch/m68k/fpe/fpu_cordic.c:1.2 src/sys/arch/m68k/fpe/fpu_cordic.c:1.3
--- src/sys/arch/m68k/fpe/fpu_cordic.c:1.2	Sat Apr 20 01:48:20 2013
+++ src/sys/arch/m68k/fpe/fpu_cordic.c	Thu Aug  4 05:35:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_cordic.c,v 1.2 2013/04/20 01:48:20 isaki Exp $	*/
+/*	$NetBSD: fpu_cordic.c,v 1.3 2016/08/04 05:35:18 isaki Exp $	*/
 
 /*
  * Copyright (c) 2013 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_cordic.c,v 1.2 2013/04/20 01:48:20 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_cordic.c,v 1.3 2016/08/04 05:35:18 isaki Exp $");
 
 #include 
 
@@ -69,6 +69,9 @@ static struct sfpn atanh_table[EXT_FRACB
 static struct fpn inv_gain1;
 static struct fpn inv_gain2;
 
+static void fpu_cordit2(struct fpemu *,
+	struct fpn *, struct fpn *, struct fpn *, const struct fpn *);
+
 int
 main(int argc, char *argv[])
 {
@@ -548,7 +551,8 @@ fpu_cordit1(struct fpemu *fe, struct fpn
 	CPYFPN(z0, &z);
 }
 
-void
+#if defined(CORDIC_BOOTSTRAP)
+static void
 fpu_cordit2(struct fpemu *fe, struct fpn *x0, struct fpn *y0, struct fpn *z0,
 	const struct fpn *vecmode)
 {
@@ -644,3 +648,4 @@ fpu_cordit2(struct fpemu *fe, struct fpn
 	CPYFPN(y0, &y);
 	CPYFPN(z0, &z);
 }
+#endif /* CORDIC_BOOTSTRAP */

Index: src/sys/arch/m68k/fpe/fpu_emulate.h
diff -u src/sys/arch/m68k/fpe/fpu_emulate.h:1.24 src/sys/arch/m68k/fpe/fpu_emulate.h:1.25
--- src/sys/arch/m68k/fpe/fpu_emulate.h:1.24	Fri Apr 19 13:31:11 2013
+++ src/sys/arch/m68k/fpe/fpu_emulate.h	Thu Aug  4 05:35:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.h,v 1.24 2013/04/19 13:31:11 isaki Exp $	*/
+/*	$NetBSD: fpu_emulate.h,v 1.25 2016/08/04 05:35:18 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon Ross
@@ -251,8 +251,6 @@ extern const struct fpn fpu_cordic_inv_g
 extern const struct fpn fpu_cordic_inv_gain2;
 void fpu_cordit1(struct fpemu *,
 	struct fpn *, struct fpn *, struct fpn *, const struct fpn *);
-void fpu_cordit2(struct fpemu *,
-	struct fpn *, struct fpn *, struct fpn *, const struct fpn *);
 
 /*
  * "helper" functions



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

2016-08-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug  6 00:58:55 UTC 2016

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

Log Message:
Modify fpu_sin()'s logic to avoid GCC's warning that has been
pointed out in the previous commit.
For fpu_cos() there is no such problem, but sync with fpu_sin().


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_trig.c
diff -u src/sys/arch/m68k/fpe/fpu_trig.c:1.16 src/sys/arch/m68k/fpe/fpu_trig.c:1.17
--- src/sys/arch/m68k/fpe/fpu_trig.c:1.16	Wed Mar 23 05:25:51 2016
+++ src/sys/arch/m68k/fpe/fpu_trig.c	Sat Aug  6 00:58:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_trig.c,v 1.16 2016/03/23 05:25:51 mrg Exp $	*/
+/*	$NetBSD: fpu_trig.c,v 1.17 2016/08/06 00:58:55 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_trig.c,v 1.16 2016/03/23 05:25:51 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_trig.c,v 1.17 2016/08/06 00:58:55 isaki Exp $");
 
 #include "fpu_emulate.h"
 
@@ -229,11 +229,10 @@ fpu_cos(struct fpemu *fe)
 	if (ISINF(&fe->fe_f2))
 		return fpu_newnan(fe);
 
-	CPYFPN(&x, &fe->fe_f2);
-
 	/* x = abs(input) */
-	x.fp_sign = 0;
 	sign = 0;
+	CPYFPN(&x, &fe->fe_f2);
+	x.fp_sign = 0;
 
 	/* p <- 2*pi */
 	fpu_const(&p, FPU_CONST_PI);
@@ -334,13 +333,9 @@ fpu_sin(struct fpemu *fe)
 	if (ISZERO(&fe->fe_f2))
 		return &fe->fe_f2;
 
-#if defined(__GNUC__) && (__GNUC__ >= 5) && defined(__OPTIMIZE__)
-	x.fp_sign = 0;
-#endif
-	CPYFPN(&x, &fe->fe_f2);
-
 	/* x = abs(input) */
-	sign = x.fp_sign;
+	sign = fe->fe_f2.fp_sign;
+	CPYFPN(&x, &fe->fe_f2);
 	x.fp_sign = 0;
 
 	/* p <- 2*pi */



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: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-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, &kpa);
+		if (!pmap_extract(pmap, pv->pv_va, &kpa)) {
+			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-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(&mcp->__mc_pad.__mc_frame.__mcf_exframe,
 		&frame->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(&frame->F_u,



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

2017-01-15 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Jan 15 11:56:11 UTC 2017

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

Log Message:
exp(>11356) is +inf even if extended precision.
exp(<-11401) is 0 even if extended precision.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_exp.c
diff -u src/sys/arch/m68k/fpe/fpu_exp.c:1.10 src/sys/arch/m68k/fpe/fpu_exp.c:1.11
--- src/sys/arch/m68k/fpe/fpu_exp.c:1.10	Wed Dec  7 11:27:18 2016
+++ src/sys/arch/m68k/fpe/fpu_exp.c	Sun Jan 15 11:56:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_exp.c,v 1.10 2016/12/07 11:27:18 isaki Exp $	*/
+/*	$NetBSD: fpu_exp.c,v 1.11 2017/01/15 11:56:11 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_exp.c,v 1.10 2016/12/07 11:27:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_exp.c,v 1.11 2017/01/15 11:56:11 isaki Exp $");
 
 #include 
 
@@ -109,7 +109,7 @@ struct fpn *
 fpu_etox(struct fpemu *fe)
 {
 	struct fpn x, *fp;
-	int j, k;
+	int k;
 
 	if (ISNAN(&fe->fe_f2))
 		return &fe->fe_f2;
@@ -119,6 +119,20 @@ fpu_etox(struct fpemu *fe)
 		return &fe->fe_f2;
 	}
 
+	/*
+	 * return inf if x >=  2^14
+	 * return +0  if x <= -2^14
+	 */
+	if (fe->fe_f2.fp_exp >= 14) {
+		if (fe->fe_f2.fp_sign) {
+			fe->fe_f2.fp_class = FPC_ZERO;
+			fe->fe_f2.fp_sign = 0;
+		} else {
+			fe->fe_f2.fp_class = FPC_INF;
+		}
+		return &fe->fe_f2;
+	}
+
 	CPYFPN(&x, &fe->fe_f2);
 
 	/* k = round(x / ln2) */
@@ -134,17 +148,7 @@ fpu_etox(struct fpemu *fe)
 		return fp;
 	}
 	/* extract k as integer format from fpn format */
-	j = FP_LG - fp->fp_exp;
-	if (j < 0) {
-		if (fp->fp_sign) {
-			fp->fp_class = FPC_ZERO;		/* k < -2^18 */
-			fp->fp_sign = 0;
-		} else {
-			fp->fp_class = FPC_INF;			/* k >  2^18 */
-		}
-		return fp;
-	}
-	k = fp->fp_mant[0] >> j;
+	k = fp->fp_mant[0] >> (FP_LG - fp->fp_exp);
 	if (fp->fp_sign)
 		k *= -1;
 



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

2017-01-16 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Jan 16 12:05:40 UTC 2017

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

Log Message:
FSINCOS: Fix register address which writes cosine value back.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_trig.c
diff -u src/sys/arch/m68k/fpe/fpu_trig.c:1.17 src/sys/arch/m68k/fpe/fpu_trig.c:1.18
--- src/sys/arch/m68k/fpe/fpu_trig.c:1.17	Sat Aug  6 00:58:55 2016
+++ src/sys/arch/m68k/fpe/fpu_trig.c	Mon Jan 16 12:05:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_trig.c,v 1.17 2016/08/06 00:58:55 isaki Exp $	*/
+/*	$NetBSD: fpu_trig.c,v 1.18 2017/01/16 12:05:40 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_trig.c,v 1.17 2016/08/06 00:58:55 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_trig.c,v 1.18 2017/01/16 12:05:40 isaki Exp $");
 
 #include "fpu_emulate.h"
 
@@ -438,7 +438,7 @@ fpu_sincos(struct fpemu *fe, int regc)
 	__fpu_sincos_cordic(fe, &fe->fe_f2);
 
 	/* cos(x) */
-	fpu_implode(fe, &fe->fe_f2, FTYPE_EXT, &fe->fe_fpframe->fpf_regs[regc]);
+	fpu_implode(fe, &fe->fe_f2, FTYPE_EXT, &fe->fe_fpframe->fpf_regs[regc * 3]);
 
 	/* sin(x) */
 	return &fe->fe_f1;



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

2017-02-26 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb 27 06:47:30 UTC 2017

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

Log Message:
use FPCR instead of FPSR to manipulate the exception mask.


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

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

Modified files:

Index: src/sys/arch/m68k/include/fenv.h
diff -u src/sys/arch/m68k/include/fenv.h:1.4 src/sys/arch/m68k/include/fenv.h:1.5
--- src/sys/arch/m68k/include/fenv.h:1.4	Tue Jan  5 00:47:08 2016
+++ src/sys/arch/m68k/include/fenv.h	Mon Feb 27 06:47:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.h,v 1.4 2016/01/05 00:47:08 ozaki-r Exp $	*/
+/*	$NetBSD: fenv.h,v 1.5 2017/02/27 06:47:30 chs Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
 #define FE_ALL_EXCEPT \
 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
 
-/* Rounding modes, from FPSR */
+/* Rounding modes, from FPCR */
 #define FE_TONEAREST	FPCR_NEAR
 #define	FE_TOWARDZERO	FPCR_ZERO
 #define	FE_DOWNWARD	FPCR_MINF
@@ -266,12 +266,12 @@ feupdateenv(const fenv_t *__envp)
 static inline int
 feenableexcept(int __mask)
 {
-	fexcept_t __fpsr, __oldmask;
+	fexcept_t __fpcr, __oldmask;
 
-	__get_fpsr(__fpsr);
-	__oldmask = __fpsr & FE_ALL_EXCEPT;
-	__fpsr |= __mask & FE_ALL_EXCEPT;
-	__set_fpsr(__fpsr);
+	__get_fpcr(__fpcr);
+	__oldmask = (__fpcr >> 6) & FE_ALL_EXCEPT;
+	__fpcr |= (__mask & FE_ALL_EXCEPT) << 6;
+	__set_fpcr(__fpcr);
 
 	return __oldmask;
 }
@@ -279,12 +279,12 @@ feenableexcept(int __mask)
 static inline int
 fedisableexcept(int __mask)
 {
-	fexcept_t __fpsr, __oldmask;
+	fexcept_t __fpcr, __oldmask;
 
-	__get_fpsr(__fpsr);
-	__oldmask = __fpsr & FE_ALL_EXCEPT;
-	__fpsr &= ~(__mask & FE_ALL_EXCEPT);
-	__set_fpsr(__fpsr);
+	__get_fpcr(__fpcr);
+	__oldmask = (__fpcr >> 6) & FE_ALL_EXCEPT;
+	__fpcr &= ~((__mask & FE_ALL_EXCEPT) << 6);
+	__set_fpcr(__fpcr);
 
 	return __oldmask;
 }
@@ -292,11 +292,11 @@ fedisableexcept(int __mask)
 static inline int
 fegetexcept(void)
 {
-	fexcept_t __fpsr;
+	fexcept_t __fpcr;
 
-	__get_fpsr(__fpsr);
+	__get_fpcr(__fpcr);
 
-	return __fpsr & FE_ALL_EXCEPT;
+	return (__fpcr >> 6) & FE_ALL_EXCEPT;
 }
 
 #endif /* _NETBSD_SOURCE || _GNU_SOURCE */



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

2017-02-26 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb 27 06:47:58 UTC 2017

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

Log Message:
the FP_* constants need to be different from the new FE_* constants
to preserve the ABI, so shift them as needed when using them.


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

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

Modified files:

Index: src/sys/arch/m68k/include/ieeefp.h
diff -u src/sys/arch/m68k/include/ieeefp.h:1.8 src/sys/arch/m68k/include/ieeefp.h:1.9
--- src/sys/arch/m68k/include/ieeefp.h:1.8	Fri Dec 25 06:03:06 2015
+++ src/sys/arch/m68k/include/ieeefp.h	Mon Feb 27 06:47:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieeefp.h,v 1.8 2015/12/25 06:03:06 christos Exp $	*/
+/*	$NetBSD: ieeefp.h,v 1.9 2017/02/27 06:47:58 chs Exp $	*/
 
 /* 
  * Written by J.T. Conklin, Apr 6, 1995
@@ -19,17 +19,21 @@
 
 typedef int fp_except;
 
-#define FP_X_IMP	FE_INEXACT	/* imprecise (loss of precision) */
-#define FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
-#define FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
-#define FP_X_OFL	FE_OVERFLOW	/* overflow exception */
-#define FP_X_INV	FE_INVALID	/* invalid operation exception */
+/* adjust for FP_* and FE_* value differences */ 
+#define	__FPE(x) ((x) >> 3)
+#define	__FPR(x) ((x) >> 4)
+
+#define FP_X_IMP	__FPE(FE_INEXACT)	/* imprecise (loss of precision) */
+#define FP_X_DZ		__FPE(FE_DIVBYZERO)	/* divide-by-zero exception */
+#define FP_X_UFL	__FPE(FE_UNDERFLOW)	/* underflow exception */
+#define FP_X_OFL	__FPE(FE_OVERFLOW)	/* overflow exception */
+#define FP_X_INV	__FPE(FE_INVALID)	/* invalid operation exception */
 
 typedef enum {
-FP_RN=FE_TONEAREST,		/* round to nearest representable number */
-FP_RZ=FE_TOWARDZERO,	/* round to zero (truncate) */
-FP_RM=FE_DOWNWARD,		/* round toward negative infinity */
-FP_RP=FE_UPWARD		/* round toward positive infinity */
+FP_RN=__FPR(FE_TONEAREST),	/* round to nearest representable number */
+FP_RZ=__FPR(FE_TOWARDZERO),	/* round to zero (truncate) */
+FP_RM=__FPR(FE_DOWNWARD),	/* round toward negative infinity */
+FP_RP=__FPR(FE_UPWARD)	/* round toward positive infinity */
 } fp_rnd;
 
 typedef enum {



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

2016-03-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 23 05:25:51 UTC 2016

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

Log Message:
avoid a GCC warning with this:

+#if defined(__GNUC__) && (__GNUC__ >= 5) && defined(__OPTIMIZE__)
+   x.fp_sign = 0;
+#endif

(ridiculous, but seems better than disabling the warning entirely.)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/fpe/fpu_trig.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_trig.c
diff -u src/sys/arch/m68k/fpe/fpu_trig.c:1.15 src/sys/arch/m68k/fpe/fpu_trig.c:1.16
--- src/sys/arch/m68k/fpe/fpu_trig.c:1.15	Sat Apr 20 07:32:45 2013
+++ src/sys/arch/m68k/fpe/fpu_trig.c	Wed Mar 23 05:25:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_trig.c,v 1.15 2013/04/20 07:32:45 isaki Exp $	*/
+/*	$NetBSD: fpu_trig.c,v 1.16 2016/03/23 05:25:51 mrg Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_trig.c,v 1.15 2013/04/20 07:32:45 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_trig.c,v 1.16 2016/03/23 05:25:51 mrg Exp $");
 
 #include "fpu_emulate.h"
 
@@ -334,6 +334,9 @@ fpu_sin(struct fpemu *fe)
 	if (ISZERO(&fe->fe_f2))
 		return &fe->fe_f2;
 
+#if defined(__GNUC__) && (__GNUC__ >= 5) && defined(__OPTIMIZE__)
+	x.fp_sign = 0;
+#endif
 	CPYFPN(&x, &fe->fe_f2);
 
 	/* x = abs(input) */



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

2013-03-19 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Mar 19 09:17:17 UTC 2013

Modified Files:
src/sys/arch/m68k/fpe: fpu_add.c fpu_arith.h fpu_div.c fpu_emulate.h
fpu_explode.c fpu_implode.c fpu_int.c fpu_mul.c fpu_sqrt.c
fpu_subr.c

Log Message:
Remove 'register'.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/fpe/fpu_add.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/fpe/fpu_arith.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/fpe/fpu_div.c \
src/sys/arch/m68k/fpe/fpu_mul.c src/sys/arch/m68k/fpe/fpu_sqrt.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/m68k/fpe/fpu_emulate.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/m68k/fpe/fpu_explode.c \
src/sys/arch/m68k/fpe/fpu_int.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/fpe/fpu_implode.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/fpe/fpu_subr.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_add.c
diff -u src/sys/arch/m68k/fpe/fpu_add.c:1.7 src/sys/arch/m68k/fpe/fpu_add.c:1.8
--- src/sys/arch/m68k/fpe/fpu_add.c:1.7	Sat Mar 14 15:36:09 2009
+++ src/sys/arch/m68k/fpe/fpu_add.c	Tue Mar 19 09:17:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_add.c,v 1.7 2009/03/14 15:36:09 dsl Exp $ */
+/*	$NetBSD: fpu_add.c,v 1.8 2013/03/19 09:17:17 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.7 2009/03/14 15:36:09 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.8 2013/03/19 09:17:17 isaki Exp $");
 
 #include 
 #include 
@@ -58,11 +58,11 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 
 #include "fpu_emulate.h"
 
 struct fpn *
-fpu_add(register struct fpemu *fe)
+fpu_add(struct fpemu *fe)
 {
-	register struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2, *r;
-	register u_int r0, r1, r2;
-	register int rd;
+	struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2, *r;
+	u_int r0, r1, r2;
+	int rd;
 
 	/*
 	 * Put the `heavier' operand on the right (see fpu_emu.h).

Index: src/sys/arch/m68k/fpe/fpu_arith.h
diff -u src/sys/arch/m68k/fpe/fpu_arith.h:1.5 src/sys/arch/m68k/fpe/fpu_arith.h:1.6
--- src/sys/arch/m68k/fpe/fpu_arith.h:1.5	Sat Dec 24 22:45:35 2005
+++ src/sys/arch/m68k/fpe/fpu_arith.h	Tue Mar 19 09:17:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_arith.h,v 1.5 2005/12/24 22:45:35 perry Exp $ */
+/*	$NetBSD: fpu_arith.h,v 1.6 2013/03/19 09:17:17 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -110,7 +110,7 @@
 #else
 
 /* set up for extended-precision arithemtic */
-#define	FPU_DECL_CARRY register int fpu_tmp;
+#define	FPU_DECL_CARRY int fpu_tmp;
 
 /*
  * We have three kinds of add:

Index: src/sys/arch/m68k/fpe/fpu_div.c
diff -u src/sys/arch/m68k/fpe/fpu_div.c:1.6 src/sys/arch/m68k/fpe/fpu_div.c:1.7
--- src/sys/arch/m68k/fpe/fpu_div.c:1.6	Sat Mar 14 15:36:09 2009
+++ src/sys/arch/m68k/fpe/fpu_div.c	Tue Mar 19 09:17:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_div.c,v 1.6 2009/03/14 15:36:09 dsl Exp $ */
+/*	$NetBSD: fpu_div.c,v 1.7 2013/03/19 09:17:17 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.6 2009/03/14 15:36:09 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.7 2013/03/19 09:17:17 isaki Exp $");
 
 #include 
 
@@ -150,11 +150,11 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 
  */
 
 struct fpn *
-fpu_div(register struct fpemu *fe)
+fpu_div(struct fpemu *fe)
 {
-	register struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2;
-	register u_int q, bit;
-	register u_int r0, r1, r2, d0, d1, d2, y0, y1, y2;
+	struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2;
+	u_int q, bit;
+	u_int r0, r1, r2, d0, d1, d2, y0, y1, y2;
 	FPU_DECL_CARRY
 
 	fe->fe_fpsr &= ~FPSR_EXCP; /* clear all exceptions */
Index: src/sys/arch/m68k/fpe/fpu_mul.c
diff -u src/sys/arch/m68k/fpe/fpu_mul.c:1.6 src/sys/arch/m68k/fpe/fpu_mul.c:1.7
--- src/sys/arch/m68k/fpe/fpu_mul.c:1.6	Sat Mar 14 15:36:09 2009
+++ src/sys/arch/m68k/fpe/fpu_mul.c	Tue Mar 19 09:17:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_mul.c,v 1.6 2009/03/14 15:36:09 dsl Exp $ */
+/*	$NetBSD: fpu_mul.c,v 1.7 2013/03/19 09:17:17 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.6 2009/03/14 15:36:09 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.7 2013/03/19 09:17:17 isaki Exp $");
 
 #include 
 
@@ -77,8 +77,6 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 
  *
  * Since we do not have efficient multiword arithmetic, we code the
  * accumulator as four separate words, just like any other mantissa.
- * We use local `register' variables in the hope that this is faster
- * than memory.  We keep x->fp_mant in locals for the same reason.
  *
  * In the algorithm above, the bits in y are inspected one at a time.
  * We will pick them up 32 at a time and then deal with those 32, one
@@ -99,11 +97,11 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 
  * until we rea

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

2013-03-19 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Mar 19 09:28:40 UTC 2013

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

Log Message:
const-ify.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/m68k/fpe/fpu_emulate.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/fpe/fpu_explode.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_emulate.h
diff -u src/sys/arch/m68k/fpe/fpu_emulate.h:1.20 src/sys/arch/m68k/fpe/fpu_emulate.h:1.21
--- src/sys/arch/m68k/fpe/fpu_emulate.h:1.20	Tue Mar 19 09:17:17 2013
+++ src/sys/arch/m68k/fpe/fpu_emulate.h	Tue Mar 19 09:28:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.h,v 1.20 2013/03/19 09:17:17 isaki Exp $	*/
+/*	$NetBSD: fpu_emulate.h,v 1.21 2013/03/19 09:28:39 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon Ross
@@ -227,7 +227,7 @@ int	fpu_shr(struct fpn *, int);
 int	fpu_round(struct fpemu *, struct fpn *);
 
 /* type conversion */
-void	fpu_explode(struct fpemu *, struct fpn *, int t, u_int *);
+void	fpu_explode(struct fpemu *, struct fpn *, int t, const u_int *);
 void	fpu_implode(struct fpemu *, struct fpn *, int t, u_int *);
 
 /*

Index: src/sys/arch/m68k/fpe/fpu_explode.c
diff -u src/sys/arch/m68k/fpe/fpu_explode.c:1.12 src/sys/arch/m68k/fpe/fpu_explode.c:1.13
--- src/sys/arch/m68k/fpe/fpu_explode.c:1.12	Tue Mar 19 09:17:17 2013
+++ src/sys/arch/m68k/fpe/fpu_explode.c	Tue Mar 19 09:28:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_explode.c,v 1.12 2013/03/19 09:17:17 isaki Exp $ */
+/*	$NetBSD: fpu_explode.c,v 1.13 2013/03/19 09:28:39 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.12 2013/03/19 09:17:17 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.13 2013/03/19 09:28:39 isaki Exp $");
 
 #include 
 #include 
@@ -222,7 +222,7 @@ fpu_xtof(struct fpn *fp, u_int i, u_int 
  * Explode the contents of a memory operand.
  */
 void
-fpu_explode(struct fpemu *fe, struct fpn *fp, int type, u_int *space)
+fpu_explode(struct fpemu *fe, struct fpn *fp, int type, const u_int *space)
 {
 	u_int s;
 



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

2013-07-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 16 21:01:03 UTC 2013

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

Log Message:
Add an END macro.  reorder EXTBL macro


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/m68k/include/asm.h

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

Modified files:

Index: src/sys/arch/m68k/include/asm.h
diff -u src/sys/arch/m68k/include/asm.h:1.28 src/sys/arch/m68k/include/asm.h:1.29
--- src/sys/arch/m68k/include/asm.h:1.28	Sat Feb 12 16:32:36 2011
+++ src/sys/arch/m68k/include/asm.h	Tue Jul 16 21:01:03 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.28 2011/02/12 16:32:36 matt Exp $	*/
+/*	$NetBSD: asm.h,v 1.29 2013/07/16 21:01:03 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -97,6 +97,7 @@
 
 #define	_ENTRY(name) \
 	.text; .even; .globl name; .type name,@function; name:
+#define	END(name)	.size name,.-name
 
 #ifdef __ELF__
 #define	MCOUNT_ENTRY	__mcount
@@ -245,13 +246,13 @@
 /*
  * Macros to hide shortcomings in the 68010.
  */
-#ifndef __mc68010__
-#define	EXTBL(reg)	\
-	extbl	reg
-#else	/* __mc68010__ */
+#ifdef __mc68010__
 #define	EXTBL(reg)	\
 	extw	reg		;			\
 	extl	reg
+#else	/* __mc68010__ */
+#define	EXTBL(reg)	\
+	extbl	reg
 #endif	/* __mc68010__ */
 
 #endif /* _M68K_ASM_H_ */



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

2013-07-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 16 22:23:15 UTC 2013

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

Log Message:
Remove non __ELF__ clauses.
Add GOT_SETUP and LEA_LCL macros.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/m68k/include/asm.h

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

Modified files:

Index: src/sys/arch/m68k/include/asm.h
diff -u src/sys/arch/m68k/include/asm.h:1.29 src/sys/arch/m68k/include/asm.h:1.30
--- src/sys/arch/m68k/include/asm.h:1.29	Tue Jul 16 21:01:03 2013
+++ src/sys/arch/m68k/include/asm.h	Tue Jul 16 22:23:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.29 2013/07/16 21:01:03 matt Exp $	*/
+/*	$NetBSD: asm.h,v 1.30 2013/07/16 22:23:15 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -73,25 +73,22 @@
 #ifndef _M68K_ASM_H_
 #define _M68K_ASM_H_
 
-#if defined(__ELF__) && defined(PIC)
-#define PIC_PLT(name)	name@PLTPC
+#if defined(PIC)
+#define PIC_PLT(name)		name@PLTPC
+#define LEA_LCL(name,reg)	lea	(name,%pc),reg
+#define GOT_SETUP(reg)		lea	(_GLOBAL_OFFSET_TABLE_@GOTPC,%pc),reg
 #else
-#define PIC_PLT(name)	name
+#define	__IMMEDIATE		#
+#define PIC_PLT(name)		name
+#define LEA_LCL(name,reg)	movl	__IMMEDIATE name,reg
+#define GOT_SETUP(reg)		/* nothing */
 #endif
 
-#ifdef __ELF__
-# if __STDC__
-#  define _C_LABEL(name)	name
-# else
-#  define _C_LABEL(name)	name
+#if __STDC__
+# define _C_LABEL(name)	name
+#else
+# define _C_LABEL(name)	name
 #endif /* __STDC__ */
-#else /* __ELF__ */
-# if __STDC__
-#  define _C_LABEL(name)	_ ## name
-# else
-#  define _C_LABEL(name)	_/**/name
-# endif /* __STDC__ */
-#endif /* __ELF__ */
 
 #define	_ASM_LABEL(name)	name
 
@@ -99,11 +96,7 @@
 	.text; .even; .globl name; .type name,@function; name:
 #define	END(name)	.size name,.-name
 
-#ifdef __ELF__
 #define	MCOUNT_ENTRY	__mcount
-#else
-#define	MCOUNT_ENTRY	mcount
-#endif
 
 #ifdef GPROF
 #define _PROF_PROLOG	link %a6,#0; jbsr MCOUNT_ENTRY; unlk %a6
@@ -219,11 +212,10 @@
 #define	VECTOR_UNUSED	\
 	.long	0
 
-#ifdef __ELF__
 #define	WEAK_ALIAS(alias,sym)		\
 	.weak alias;			\
 	alias = sym
-#endif
+
 /*
  * STRONG_ALIAS: create a strong alias.
  */



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

2013-07-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jul 16 23:01:05 UTC 2013

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

Log Message:
Make INTERRUPT_{SAVE,RESTORE}REG visible to userland


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/m68k/include/asm.h

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

Modified files:

Index: src/sys/arch/m68k/include/asm.h
diff -u src/sys/arch/m68k/include/asm.h:1.30 src/sys/arch/m68k/include/asm.h:1.31
--- src/sys/arch/m68k/include/asm.h:1.30	Tue Jul 16 22:23:15 2013
+++ src/sys/arch/m68k/include/asm.h	Tue Jul 16 23:01:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.30 2013/07/16 22:23:15 matt Exp $	*/
+/*	$NetBSD: asm.h,v 1.31 2013/07/16 23:01:05 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -162,6 +162,13 @@
 #define	ASBSS(name, size)\
 	.comm	_ASM_LABEL(name),size
 
+/*
+ * Need a better place for these but these are common across
+ * all m68k ports so let's define just once.
+ */
+#define INTERRUPT_SAVEREG	moveml	#0xC0C0,%sp@-
+#define INTERRUPT_RESTOREREG	moveml	%sp@+,#0x0303
+
 #ifdef _KERNEL
 /*
  * Shorthand for calling panic().
@@ -173,13 +180,6 @@
 	9:	.asciz	x			;	\
 		.even
 
-/*
- * Need a better place for these but these are common across
- * all m68k ports so let's define just once.
- */
-#define INTERRUPT_SAVEREG	moveml	#0xC0C0,%sp@-
-#define INTERRUPT_RESTOREREG	moveml	%sp@+,#0x0303
-
 /* 64-bit counter increments */
 #define CPUINFO_INCREMENT(n)	\
 	lea	_C_LABEL(cpu_info_store)+(n)+4,%a1;		\



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

2013-07-16 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 17 05:42:02 UTC 2013

Modified Files:
src/sys/arch/m68k/include: Makefile

Log Message:
Export fpreg.h for libc


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/m68k/include/Makefile

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

Modified files:

Index: src/sys/arch/m68k/include/Makefile
diff -u src/sys/arch/m68k/include/Makefile:1.27 src/sys/arch/m68k/include/Makefile:1.28
--- src/sys/arch/m68k/include/Makefile:1.27	Sun Jul 17 20:54:43 2011
+++ src/sys/arch/m68k/include/Makefile	Wed Jul 17 05:42:02 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.27 2011/07/17 20:54:43 joerg Exp $
+#	$NetBSD: Makefile,v 1.28 2013/07/17 05:42:02 matt Exp $
 
 INCSDIR= /usr/include/m68k
 
@@ -7,7 +7,7 @@ INCS=	ansi.h aout_machdep.h asm.h asm_si
 	cacheops.h cacheops_20.h cacheops_30.h cacheops_40.h cacheops_60.h \
 	cdefs.h cpu.h cpuframe.h \
 	elf_machdep.h endian.h endian_machdep.h \
-	float.h frame.h \
+	float.h fpreg.h frame.h \
 	ieee.h ieeefp.h \
 	int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
 	kcore.h \



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

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 22:18:31 UTC 2013

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

Log Message:
Fix some definitions


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

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

Modified files:

Index: src/sys/arch/m68k/include/fpreg.h
diff -u src/sys/arch/m68k/include/fpreg.h:1.1 src/sys/arch/m68k/include/fpreg.h:1.2
--- src/sys/arch/m68k/include/fpreg.h:1.1	Tue Jan 27 20:03:12 2009
+++ src/sys/arch/m68k/include/fpreg.h	Thu Jul 18 22:18:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpreg.h,v 1.1 2009/01/27 20:03:12 martin Exp $	*/
+/*	$NetBSD: fpreg.h,v 1.2 2013/07/18 22:18:31 matt Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon Ross
@@ -49,6 +49,7 @@
 # define FPSR_QSG   0x0080
 # define FPSR_QUO   0x007f
 #define FPSR_EXCP   0xff00
+#define FPSR_EXCP2  0x3e00
 # define FPSR_BSUN  0x8000
 # define FPSR_SNAN  0x4000
 # define FPSR_OPERR 0x2000
@@ -57,7 +58,7 @@
 # define FPSR_DZ0x0400
 # define FPSR_INEX2 0x0200
 # define FPSR_INEX1 0x0100
-#define FPSR_AEX0x00ff
+#define FPSR_AEX0x00f8
 # define FPSR_AIOP  0x0080
 # define FPSR_AOVFL 0x0040
 # define FPSR_AUNFL 0x0020
@@ -66,6 +67,7 @@
 
 /* fpcr */
 #define FPCR_EXCP   FPSR_EXCP
+#define FPCR_EXCP2  FPSR_EXCP2
 # define FPCR_BSUN  FPSR_BSUN
 # define FPCR_SNAN  FPSR_SNAN
 # define FPCR_OPERR FPSR_OPERR



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

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 22:17:57 UTC 2013

Modified Files:
src/sys/arch/m68k/include: float.h math.h profile.h

Log Message:
Coldfire FPU looks like the 68010 FPU (no long double)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/m68k/include/float.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/include/math.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/m68k/include/profile.h

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

Modified files:

Index: src/sys/arch/m68k/include/float.h
diff -u src/sys/arch/m68k/include/float.h:1.19 src/sys/arch/m68k/include/float.h:1.20
--- src/sys/arch/m68k/include/float.h:1.19	Sun Dec 11 12:17:53 2005
+++ src/sys/arch/m68k/include/float.h	Thu Jul 18 22:17:57 2013
@@ -1,9 +1,19 @@
-/*	$NetBSD: float.h,v 1.19 2005/12/11 12:17:53 christos Exp $	*/
+/*	$NetBSD: float.h,v 1.20 2013/07/18 22:17:57 matt Exp $	*/
 
 #ifndef _M68K_FLOAT_H_
 #define _M68K_FLOAT_H_
 
-#ifndef __mc68010__
+#if defined(__LDBL_MANT_DIG__)
+#define LDBL_MANT_DIG	__LDBL_MANT_DIG__
+#define LDBL_EPSILON	__LDBL_EPSILON__
+#define LDBL_DIG	__LDBL_DIG__
+#define LDBL_MIN_EXP	__LDBL_MIN_EXP__
+#define LDBL_MIN	__LDBL_MIN__
+#define LDBL_MIN_10_EXP	__LDBL_MIN_10_EXP__
+#define LDBL_MAX_EXP	__LDBL_MAX_EXP__
+#define LDBL_MAX	__LDBL_MAX__
+#define LDBL_MAX_10_EXP	__LDBL_MAX_10_EXP__
+#elif !defined(__mc68010__) && !defined(__mcoldfire__)
 #define LDBL_MANT_DIG	64
 #define LDBL_EPSILON	1.0842021724855044340E-19L
 #define LDBL_DIG	18
@@ -17,7 +27,7 @@
 
 #include 
 
-#ifndef __mc68010__
+#if !defined(__mc68010__) && !defined(__mcoldfire__)
 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
 !defined(_XOPEN_SOURCE) || \
 ((__STDC_VERSION__ - 0) >= 199901L) || \
@@ -26,6 +36,6 @@
 defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
 #define	DECIMAL_DIG	21
 #endif /* !defined(_ANSI_SOURCE) && ... */
-#endif /* !__mc68010__ */
+#endif /* !__mc68010__ && !__mcoldfire__ */
 
 #endif	/* !_M68K_FLOAT_H_ */

Index: src/sys/arch/m68k/include/math.h
diff -u src/sys/arch/m68k/include/math.h:1.7 src/sys/arch/m68k/include/math.h:1.8
--- src/sys/arch/m68k/include/math.h:1.7	Sun Dec 11 12:17:53 2005
+++ src/sys/arch/m68k/include/math.h	Thu Jul 18 22:17:57 2013
@@ -1,6 +1,6 @@
-/*	$NetBSD: math.h,v 1.7 2005/12/11 12:17:53 christos Exp $	*/
+/*	$NetBSD: math.h,v 1.8 2013/07/18 22:17:57 matt Exp $	*/
 
-#ifndef __mc68010__
+#if !defined(__mc68010__) && !defined(__mcoldfire__)
 #define	__HAVE_LONG_DOUBLE
 #endif
 #define	__HAVE_NANF

Index: src/sys/arch/m68k/include/profile.h
diff -u src/sys/arch/m68k/include/profile.h:1.20 src/sys/arch/m68k/include/profile.h:1.21
--- src/sys/arch/m68k/include/profile.h:1.20	Wed Mar 21 19:59:18 2012
+++ src/sys/arch/m68k/include/profile.h	Thu Jul 18 22:17:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.h,v 1.20 2012/03/21 19:59:18 he Exp $	*/
+/*	$NetBSD: profile.h,v 1.21 2013/07/18 22:17:57 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
 #define	MCOUNT_ENTRY	"mcount"
 #endif
 
-#ifndef	__mc68010__
+#if !defined(__mc68010__) && !defined(__mcoldfire__)
 #define	MCOUNT \
 extern void mcount(void) __asm(MCOUNT_ENTRY) \
 	__attribute__((__no_instrument_function__)); \



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

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 22:21:31 UTC 2013

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

Log Message:
Adjust LEA_LCL, GOT_SETUP, INTERRUPT_{SAVE,RESTORE}REG for Coldfire


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/m68k/include/asm.h

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

Modified files:

Index: src/sys/arch/m68k/include/asm.h
diff -u src/sys/arch/m68k/include/asm.h:1.31 src/sys/arch/m68k/include/asm.h:1.32
--- src/sys/arch/m68k/include/asm.h:1.31	Tue Jul 16 23:01:05 2013
+++ src/sys/arch/m68k/include/asm.h	Thu Jul 18 22:21:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.31 2013/07/16 23:01:05 matt Exp $	*/
+/*	$NetBSD: asm.h,v 1.32 2013/07/18 22:21:31 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -73,12 +73,22 @@
 #ifndef _M68K_ASM_H_
 #define _M68K_ASM_H_
 
-#if defined(PIC)
+#define __IMMEDIATE		#
+
+#if defined(PIC) || defined(__pic__)
 #define PIC_PLT(name)		name@PLTPC
+#ifdef __mcoldfire__
+#define LEA_LCL(name,reg) \
+	movl	__IMMEDIATE name - .,reg ; \
+	lea	(-6,%pc,reg),reg
+#define GOT_SETUP(reg) \
+	movl	__IMMEDIATE _GLOBAL_OFFSET_TABLE_@GOTPC,reg ; \
+	lea	(-6,%pc,reg),reg
+#else
 #define LEA_LCL(name,reg)	lea	(name,%pc),reg
 #define GOT_SETUP(reg)		lea	(_GLOBAL_OFFSET_TABLE_@GOTPC,%pc),reg
+#endif
 #else
-#define	__IMMEDIATE		#
 #define PIC_PLT(name)		name
 #define LEA_LCL(name,reg)	movl	__IMMEDIATE name,reg
 #define GOT_SETUP(reg)		/* nothing */
@@ -166,8 +176,13 @@
  * Need a better place for these but these are common across
  * all m68k ports so let's define just once.
  */
-#define INTERRUPT_SAVEREG	moveml	#0xC0C0,%sp@-
-#define INTERRUPT_RESTOREREG	moveml	%sp@+,#0x0303
+#ifdef __mcoldfire__
+#define INTERRUPT_SAVEREG	lea -16(%sp),%sp; moveml #0xC0C0,(%sp)
+#define INTERRUPT_RESTOREREG	moveml (%sp),#0x0303; lea 16(%sp),%sp
+#else
+#define INTERRUPT_SAVEREG	moveml	#0xC0C0,-(%sp)
+#define INTERRUPT_RESTOREREG	moveml	(%sp)+,#0x0303
+#endif
 
 #ifdef _KERNEL
 /*



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

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 22:20:48 UTC 2013

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

Log Message:
Teach to use coldfire isac byterev if available, otherwise let the compiler
figure it since there is rorw instruction to fall back on.


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

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

Modified files:

Index: src/sys/arch/m68k/include/byte_swap.h
diff -u src/sys/arch/m68k/include/byte_swap.h:1.9 src/sys/arch/m68k/include/byte_swap.h:1.10
--- src/sys/arch/m68k/include/byte_swap.h:1.9	Mon Apr 28 20:23:26 2008
+++ src/sys/arch/m68k/include/byte_swap.h	Thu Jul 18 22:20:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: byte_swap.h,v 1.9 2008/04/28 20:23:26 martin Exp $	*/
+/*	$NetBSD: byte_swap.h,v 1.10 2013/07/18 22:20:48 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,8 +42,14 @@ static __inline uint16_t __byte_swap_u16
 static __inline uint16_t
 __byte_swap_u16_variable(uint16_t var)
 {
+#if defined(__mcfisac__)
+	__asm volatile ("swap %0; byterev %0" : "=d"(var) : "0" (var));
+#elif defined(__mcoldfire__)
+	return (var >> 8) || (var << 8);
+#else
 	__asm volatile ("rorw #8, %0" : "=d" (var) : "0" (var));
 	return (var);
+#endif
 }
 
 #define	__BYTE_SWAP_U32_VARIABLE __byte_swap_u32_variable
@@ -51,8 +57,15 @@ static __inline uint32_t __byte_swap_u32
 static __inline uint32_t
 __byte_swap_u32_variable(uint32_t var)
 {
+#if defined(__mcfisac__)
+	__asm volatile ("byterev %0" : "=d"(var) : "0" (var));
+#elif defined(__mcoldfire__)
+	return (var >> 24) | (var << 24) | ((var & 0x00ff) >> 8)
+	| ((var << 8) & 0x00ff);
+#else
 	__asm volatile (
 		"rorw #8, %0; swap %0; rorw #8, %0" : "=d" (var) : "0" (var));
+#endif
 	return (var);
 }
 



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

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 22:24:53 UTC 2013

Added Files:
src/sys/arch/m68k/include: pmap_coldfire.h pte_coldfire.h

Log Message:
pte and pmap files for the soft tlb on coldfire cpus.
(uncompiled and mostly probably wrong.)


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

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

Added files:

Index: src/sys/arch/m68k/include/pmap_coldfire.h
diff -u /dev/null src/sys/arch/m68k/include/pmap_coldfire.h:1.1
--- /dev/null	Thu Jul 18 22:24:53 2013
+++ src/sys/arch/m68k/include/pmap_coldfire.h	Thu Jul 18 22:24:53 2013
@@ -0,0 +1,145 @@
+/*	$NetBSD: pmap_coldfire.h,v 1.1 2013/07/18 22:24:53 matt Exp $	*/
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _M68K_PMAP_COLDFIRE_H_
+#define M68K_PMAP_COLDFIRE_H_
+
+#ifdef _LOCORE
+#error use assym.h instead
+#endif
+
+#if defined(_MODULE)
+#error this file should not be included by loadable kernel modules
+#endif
+
+#ifdef _KERNEL_OPT
+#include "opt_pmap.h"
+#endif
+
+#include 
+#include 
+#include 
+#ifdef __PMAP_PRIVATE
+#include 
+#include 
+#endif
+
+#define	PMAP_NEED_PROCWR
+
+#include 
+
+#include 
+
+#define	NBSEG		(NBPG*NPTEPG)
+#define	SEGSHIFT	(PGSHIFT + PGSHIFT - 2)
+#define SEGOFSET	((1 << SEGSHIFT) - 1)
+#define PMAP_SEGTABSIZE	(1 << (32 - SEGSHIFT))
+#define	NPTEPG		(NBPG >> 2)
+
+#define	KERNEL_PID	0
+
+#define PMAP_TLB_MAX			  1
+#define	PMAP_TLB_NUM_PIDS		256
+#define	PMAP_INVALID_SEGTAB_ADDRESS	((pmap_segtab_t *)0xfeeddead)
+
+#define	pmap_phys_address(x)		(x)
+
+void	pmap_procwr(struct proc *, vaddr_t, size_t);
+#define	PMAP_NEED_PROCWR
+
+#ifdef __PMAP_PRIVATE
+struct vm_page *
+	pmap_md_alloc_poolpage(int flags);
+vaddr_t	pmap_md_map_poolpage(paddr_t, vsize_t);
+void	pmap_md_unmap_poolpage(vaddr_t, vsize_t);
+bool	pmap_md_direct_mapped_vaddr_p(vaddr_t);
+bool	pmap_md_io_vaddr_p(vaddr_t);
+paddr_t	pmap_md_direct_mapped_vaddr_to_paddr(vaddr_t);
+vaddr_t	pmap_md_direct_map_paddr(paddr_t);
+void	pmap_md_init(void);
+
+bool	pmap_md_tlb_check_entry(void *, vaddr_t, tlb_asid_t, pt_entry_t);
+
+#ifdef PMAP_MINIMALTLB
+vaddr_t	pmap_kvptefill(vaddr_t, vaddr_t, pt_entry_t);
+#endif
+#endif
+
+void	pmap_md_page_syncicache(struct vm_page *, const kcpuset_t *);
+vaddr_t	pmap_bootstrap(vaddr_t, vaddr_t, phys_ram_seg_t *, size_t);
+bool	pmap_extract(struct pmap *, vaddr_t, paddr_t *);
+
+static inline paddr_t vtophys(vaddr_t);
+
+static inline paddr_t
+vtophys(vaddr_t va)
+{
+	paddr_t pa;
+
+	if (pmap_extract(pmap_kernel(), va, &pa))
+		return pa;
+	KASSERT(0);
+	return (paddr_t) -1;
+}
+
+#ifdef __PMAP_PRIVATE
+/*
+ * Virtual Cache Alias helper routines.  Not a problem for Booke CPUs.
+ */
+static inline bool
+pmap_md_vca_add(struct vm_page *pg, vaddr_t va, pt_entry_t *nptep)
+{
+	return false;
+}
+
+static inline void
+pmap_md_vca_remove(struct vm_page *pg, vaddr_t va)
+{
+
+}
+
+static inline void
+pmap_md_vca_clean(struct vm_page *pg, vaddr_t va, int op)
+{
+}
+
+static inline size_t
+pmap_md_tlb_asid_max(void)
+{
+	return PMAP_TLB_NUM_PIDS - 1;
+}
+#endif
+
+#define	POOL_VTOPHYS(va)	((paddr_t)(vaddr_t)(va))
+#define	POOL_PHYSTOV(pa)	((vaddr_t)(paddr_t)(pa))
+
+#include 
+
+#endif /* !_M68K_PMAP_COLDFIRE_H_ */
Index: src/sys/arch/m68k/include/pte_coldfire.h
diff -u /dev/null src/sys/arch/m68k/include/pte_coldfire.h:1.1
--- /dev/null	Thu Ju

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-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, 

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 13:42:52

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

2012-03-21 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Mar 21 19:59:18 UTC 2012

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

Log Message:
Use c89 function declarations in MCOUNT definition.


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

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

Modified files:

Index: src/sys/arch/m68k/include/profile.h
diff -u src/sys/arch/m68k/include/profile.h:1.19 src/sys/arch/m68k/include/profile.h:1.20
--- src/sys/arch/m68k/include/profile.h:1.19	Mon Aug  7 23:24:55 2006
+++ src/sys/arch/m68k/include/profile.h	Wed Mar 21 19:59:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.h,v 1.19 2006/08/07 23:24:55 tsutsui Exp $	*/
+/*	$NetBSD: profile.h,v 1.20 2012/03/21 19:59:18 he Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -43,7 +43,7 @@
 #define	MCOUNT \
 extern void mcount(void) __asm(MCOUNT_ENTRY) \
 	__attribute__((__no_instrument_function__)); \
-void mcount() { \
+void mcount(void) { \
 	int selfpc, frompcindex; \
 	__asm("movl %%a6@(4),%0" : "=r" (selfpc)); \
 	__asm("movl %%a6@(0)@(4),%0" : "=r" (frompcindex)); \
@@ -56,7 +56,7 @@ void mcount() { \
  * to do something different.
  */
 #define	MCOUNT \
-extern void mcount(void) __asm("mcount"); void mcount() { \
+extern void mcount(void) __asm("mcount"); void mcount(void) { \
 	int selfpc, frompcindex; \
 	__asm("movl %%a6@(4),%0" : "=r" (selfpc)); \
 	__asm("movl %%a6@(0),%%a0 ; movl %%a0@(4),%0" : "=r" (frompcindex) : /* no inputs */ : "a0"); \



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

2012-06-24 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Jun 25 04:52:23 UTC 2012

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

Log Message:
Rewrite fpu_int().
Especially, remove the special treatment when |x| < 1
because it forgets to consider FPCR round mode.
See PR/46627 for the detail.  Thanks Y.Sugahara for advice.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_int.c
diff -u src/sys/arch/m68k/fpe/fpu_int.c:1.10 src/sys/arch/m68k/fpe/fpu_int.c:1.11
--- src/sys/arch/m68k/fpe/fpu_int.c:1.10	Mon Jul 18 14:11:27 2011
+++ src/sys/arch/m68k/fpe/fpu_int.c	Mon Jun 25 04:52:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_int.c,v 1.10 2011/07/18 14:11:27 isaki Exp $	*/
+/*	$NetBSD: fpu_int.c,v 1.11 2012/06/25 04:52:23 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995 Ken Nakata
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_int.c,v 1.10 2011/07/18 14:11:27 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_int.c,v 1.11 2012/06/25 04:52:23 isaki Exp $");
 
 #include 
 
@@ -78,50 +78,28 @@ struct fpn *
 fpu_int(struct fpemu *fe)
 {
 	register struct fpn *x = &fe->fe_f2;
-	register int rsh, lsh, wsh, i;
+	register int rsh;
 
 	/* special cases first */
 	if (x->fp_class != FPC_NUM) {
 		return x;
 	}
-	/*
-	 * even if we have exponent == -1, we still have possiblity
-	 * that the result >= 1.0 when mantissa ~= 1.0 and rounded up
-	 */
-	if (x->fp_exp < -1) {
-		x->fp_class = FPC_ZERO;
-		x->fp_mant[0] = x->fp_mant[1] = x->fp_mant[2] = 0;
-		return x;
-	}
 
-	/* real work */
 	rsh = FP_NMANT - 1 - x->fp_exp;
-	if (rsh - FP_NG <= 0) {
+	if (rsh <= FP_NG) {
 		return x;
 	}
 
-	fpu_shr(x, rsh - FP_NG);	/* shift to the right */
+	/* shift to the right */
+	x->fp_exp = 0;
+	fpu_shr(x, rsh - FP_NG);
 
-	if (fpu_round(fe, x) == 1 /* rounded up */ &&
-	x->fp_mant[2 - (FP_NMANT-rsh)/32] & (1 << ((FP_NMANT-rsh)%32))
-	/* x >= 2.0 */) {
-		rsh--;			/* reduce shift count by 1 */
-		x->fp_exp++;		/* adjust exponent */
-	}
+	/* round according to FPCR round mode */
+	fpu_round(fe, x);
 
 	/* shift it back to the left */
-	wsh = rsh / 32;
-	lsh = rsh % 32;
-	rsh = 32 - lsh;
-	for (i = 0; i + wsh < 2; i++) {
-		x->fp_mant[i] = (x->fp_mant[i+wsh] << lsh) |
-		(x->fp_mant[i+wsh+1] >> rsh);
-	}
-	x->fp_mant[i] = (x->fp_mant[i+wsh] << lsh);
-	i++;
-	for (; i < 3; i++) {
-		x->fp_mant[i] = 0;
-	}
+	x->fp_exp = FP_NMANT - 1;
+	fpu_norm(x);
 
 	return x;
 }



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

2013-10-10 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Oct 11 03:37:08 UTC 2013

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

Log Message:
FATANH(-0) is -0, not +0.
This bug was introduced by the mistake of my test program.
Last week, I talked about the probelm (my FATANH(-0) returns +0 ?)
by NetBSD seminar at Open Source Conference 2013 Hiroshima,
and tsutsui@ confirmed that returns -0.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/fpe/fpu_hyperb.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_hyperb.c
diff -u src/sys/arch/m68k/fpe/fpu_hyperb.c:1.15 src/sys/arch/m68k/fpe/fpu_hyperb.c:1.16
--- src/sys/arch/m68k/fpe/fpu_hyperb.c:1.15	Sat Apr 20 07:33:05 2013
+++ src/sys/arch/m68k/fpe/fpu_hyperb.c	Fri Oct 11 03:37:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_hyperb.c,v 1.15 2013/04/20 07:33:05 isaki Exp $	*/
+/*	$NetBSD: fpu_hyperb.c,v 1.16 2013/10/11 03:37:08 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_hyperb.c,v 1.15 2013/04/20 07:33:05 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_hyperb.c,v 1.16 2013/10/11 03:37:08 isaki Exp $");
 
 #include 
 
@@ -89,14 +89,9 @@ fpu_atanh(struct fpemu *fe)
 	if (ISINF(&fe->fe_f2))
 		return fpu_newnan(fe);
 
-	/*
-	 * if x is +0/-0, 68000PRM.pdf says it returns +0/-0 but
-	 * my real 68882 returns +0 for both.
-	 */
-	if (ISZERO(&fe->fe_f2)) {
-		fe->fe_f2.fp_sign = 0;
+	/* if x is +0/-0, return +0/-0 */
+	if (ISZERO(&fe->fe_f2))
 		return &fe->fe_f2;
-	}
 
 	/*
 	 * -INF if x == -1



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-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 			/* 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 
 #include 
@@ -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 
-__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 
 #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-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 
-__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 
-__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 
 #include 
@@ -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 
-__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 
 #include 
@@ -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/fpe

2013-10-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 25 21:32:46 UTC 2013

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

Log Message:
Comment unused stuff (for documentation purposes)


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.37 src/sys/arch/m68k/fpe/fpu_emulate.c:1.38
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.37	Tue Mar 26 11:30:20 2013
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Fri Oct 25 21:32:45 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.37 2013/03/26 11:30:20 isaki Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.38 2013/10/25 21:32:45 martin Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.37 2013/03/26 11:30:20 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.38 2013/10/25 21:32:45 martin Exp $");
 
 #include 
 #include 
@@ -421,7 +421,7 @@ fpu_emul_fmovm(struct fpemu *fe, struct 
 	int word1, sig;
 	int reglist, regmask, regnum;
 	int fpu_to_mem, order;
-	int w1_post_incr;
+	/* int w1_post_incr; */
 	int *fpregs;
 
 	insn->is_advance = 4;
@@ -438,7 +438,7 @@ fpu_emul_fmovm(struct fpemu *fe, struct 
 	 * 1,0: Static  reg list, post-incr.
 	 * 1,1: Dynamic reg list, post-incr
 	 */
-	w1_post_incr = word1 & 0x1000;
+	/* w1_post_incr = word1 & 0x1000; */
 	if (word1 & 0x0800) {
 		/* dynamic reg list */
 		reglist = frame->f_regs[(word1 & 0x70) >> 4];



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 
-__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 
 #include 
@@ -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/fpe

2013-12-31 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jan  1 05:22:22 UTC 2014

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

Log Message:
Fix a sign when a source or destination is either (plus/minus)zero
or (plus/minus)infinity.  Found by XM6i.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_div.c
diff -u src/sys/arch/m68k/fpe/fpu_div.c:1.8 src/sys/arch/m68k/fpe/fpu_div.c:1.9
--- src/sys/arch/m68k/fpe/fpu_div.c:1.8	Tue Mar 26 11:30:20 2013
+++ src/sys/arch/m68k/fpe/fpu_div.c	Wed Jan  1 05:22:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_div.c,v 1.8 2013/03/26 11:30:20 isaki Exp $ */
+/*	$NetBSD: fpu_div.c,v 1.9 2014/01/01 05:22:22 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.8 2013/03/26 11:30:20 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.9 2014/01/01 05:22:22 isaki Exp $");
 
 #include 
 
@@ -166,10 +166,10 @@ fpu_div(struct fpemu *fe)
 	 * return it.  Otherwise we have the following cases:
 	 *
 	 *	Inf / Inf = NaN, plus NV exception
-	 *	Inf / num = Inf [i.e., return x]
-	 *	Inf / 0   = Inf [i.e., return x]
-	 *	0 / Inf = 0 [i.e., return x]
-	 *	0 / num = 0 [i.e., return x]
+	 *	Inf / num = Inf
+	 *	Inf / 0   = Inf
+	 *	0 / Inf = 0
+	 *	0 / num = 0
 	 *	0 / 0   = NaN, plus NV exception
 	 *	num / Inf = 0
 	 *	num / num = num (do the divide)
@@ -182,6 +182,8 @@ fpu_div(struct fpemu *fe)
 	if (ISINF(x) || ISZERO(x)) {
 		if (x->fp_class == y->fp_class)
 			return (fpu_newnan(fe));
+		/* all results at this point use XOR of operand signs */
+		x->fp_sign ^= y->fp_sign;
 		return (x);
 	}
 



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

2013-12-31 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jan  1 05:23:40 UTC 2014

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

Log Message:
indent fix in a comment.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_div.c
diff -u src/sys/arch/m68k/fpe/fpu_div.c:1.9 src/sys/arch/m68k/fpe/fpu_div.c:1.10
--- src/sys/arch/m68k/fpe/fpu_div.c:1.9	Wed Jan  1 05:22:22 2014
+++ src/sys/arch/m68k/fpe/fpu_div.c	Wed Jan  1 05:23:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_div.c,v 1.9 2014/01/01 05:22:22 isaki Exp $ */
+/*	$NetBSD: fpu_div.c,v 1.10 2014/01/01 05:23:40 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.9 2014/01/01 05:22:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.10 2014/01/01 05:23:40 isaki Exp $");
 
 #include 
 
@@ -168,9 +168,9 @@ fpu_div(struct fpemu *fe)
 	 *	Inf / Inf = NaN, plus NV exception
 	 *	Inf / num = Inf
 	 *	Inf / 0   = Inf
-	 *	0 / Inf = 0
-	 *	0 / num = 0
-	 *	0 / 0   = NaN, plus NV exception
+	 *	0   / Inf = 0
+	 *	0   / num = 0
+	 *	0   / 0   = NaN, plus NV exception
 	 *	num / Inf = 0
 	 *	num / num = num (do the divide)
 	 *	num / 0   = Inf, plus DZ exception



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

2014-01-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Jan  4 13:23:22 UTC 2014

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

Log Message:
FLOGNP1(-0.0) is -0.0, not +0.0.  Found by XM6i.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_log.c
diff -u src/sys/arch/m68k/fpe/fpu_log.c:1.17 src/sys/arch/m68k/fpe/fpu_log.c:1.18
--- src/sys/arch/m68k/fpe/fpu_log.c:1.17	Sat Apr 20 05:27:05 2013
+++ src/sys/arch/m68k/fpe/fpu_log.c	Sat Jan  4 13:23:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_log.c,v 1.17 2013/04/20 05:27:05 isaki Exp $	*/
+/*	$NetBSD: fpu_log.c,v 1.18 2014/01/04 13:23:22 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_log.c,v 1.17 2013/04/20 05:27:05 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_log.c,v 1.18 2014/01/04 13:23:22 isaki Exp $");
 
 #include 
 #include 
@@ -593,6 +593,10 @@ fpu_lognp1(struct fpemu *fe)
 {
 	struct fpn *fp;
 
+	/* if src is +0/-0, return +0/-0 */
+	if (ISZERO(&fe->fe_f2))
+		return &fe->fe_f2;
+
 	/* build a 1.0 */
 	fp = fpu_const(&fe->fe_f1, FPU_CONST_1);
 	/* fp = 1.0 + f2 */



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

2009-10-11 Thread Michael L. Hitch
Module Name:src
Committed By:   mhitch
Date:   Sun Oct 11 20:37:47 UTC 2009

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

Log Message:
Fix DEBUG build - pv_flags does not exist anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 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.46 src/sys/arch/m68k/m68k/pmap_motorola.c:1.47
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.46	Wed Aug 26 00:30:02 2009
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Sun Oct 11 20:37:47 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.46 2009/08/26 00:30:02 thorpej Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.47 2009/10/11 20:37:47 mhitch Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -117,7 +117,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.46 2009/08/26 00:30:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.47 2009/10/11 20:37:47 mhitch Exp $");
 
 #include 
 #include 
@@ -2885,9 +2885,8 @@
 	printf("pa %lx", pa);
 	pvh = pa_to_pvh(pa);
 	for (pv = &pvh->pvh_first; pv; pv = pv->pv_next)
-		printf(" -> pmap %p, va %lx, ptste %p, ptpmap %p, flags %x",
-		pv->pv_pmap, pv->pv_va, pv->pv_ptste, pv->pv_ptpmap,
-		pv->pv_flags);
+		printf(" -> pmap %p, va %lx, ptste %p, ptpmap %p",
+		pv->pv_pmap, pv->pv_va, pv->pv_ptste, pv->pv_ptpmap);
 	printf("\n");
 }
 



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

2009-11-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov 11 11:25:53 UTC 2009

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

Log Message:
Remove unnecessary and incorrect STRONG_ALIAS.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/lock_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/lock_stubs.s
diff -u src/sys/arch/m68k/m68k/lock_stubs.s:1.7 src/sys/arch/m68k/m68k/lock_stubs.s:1.8
--- src/sys/arch/m68k/m68k/lock_stubs.s:1.7	Sun May 25 15:56:12 2008
+++ src/sys/arch/m68k/m68k/lock_stubs.s	Wed Nov 11 11:25:52 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.s,v 1.7 2008/05/25 15:56:12 chs Exp $	*/
+/*	$NetBSD: lock_stubs.s,v 1.8 2009/11/11 11:25:52 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -69,7 +69,6 @@
 STRONG_ALIAS(atomic_cas_ulong,_atomic_cas_32)
 STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
 STRONG_ALIAS(atomic_cas_32,_atomic_cas_32)
-STRONG_ALIAS(_atomic_cas_32,_atomic_cas_32)
 
 STRONG_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
 STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)



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

2009-05-06 Thread Michael L. Hitch
Module Name:src
Committed By:   mhitch
Date:   Wed May  6 21:37:40 UTC 2009

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

Log Message:
Add memory clobber to the instructions that change the IPL in the status
register.  See also kern/38637.


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

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

Modified files:

Index: src/sys/arch/m68k/include/psl.h
diff -u src/sys/arch/m68k/include/psl.h:1.13 src/sys/arch/m68k/include/psl.h:1.14
--- src/sys/arch/m68k/include/psl.h:1.13	Thu Feb 16 20:17:13 2006
+++ src/sys/arch/m68k/include/psl.h	Wed May  6 21:37:40 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.13 2006/02/16 20:17:13 perry Exp $	*/
+/*	$NetBSD: psl.h,v 1.14 2009/05/06 21:37:40 mhitch Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -79,7 +79,7 @@
 	int sr;
 
 	__asm volatile ("movew %%sr,%0; movew %1,%%sr" :
-	"=&d" (sr) : "di" (s));
+	"=&d" (sr) : "di" (s) : "memory");
 
 	return sr;
 }
@@ -92,7 +92,7 @@
 	__asm volatile("movw %%sr,%0" : "=d" (sr));
 
 	if ((u_int16_t)level >= PSL_HIGHIPL || (u_int16_t)level > (u_int16_t)sr)
-		__asm volatile("movw %0,%%sr" :: "di" (level));
+		__asm volatile("movw %0,%%sr" :: "di" (level) : "memory");
 
 	return sr;
 }



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

2011-05-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon May 23 14:52:31 UTC 2011

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

Log Message:
KNF, mostly indent. No binary change.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.31 src/sys/arch/m68k/fpe/fpu_emulate.c:1.32
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.31	Sat May 14 16:17:55 2011
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Mon May 23 14:52:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.31 2011/05/14 16:17:55 tsutsui Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.32 2011/05/23 14:52:31 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.31 2011/05/14 16:17:55 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.32 2011/05/23 14:52:31 tsutsui Exp $");
 
 #include 
 #include 
@@ -51,29 +51,29 @@
 
 #include "fpu_emulate.h"
 
-#define	fpe_abort(tfp, ksi, signo, code) 		\
-do {		\
-	(ksi)->ksi_signo = (signo);			\
-	(ksi)->ksi_code = (code);			\
-	(ksi)->ksi_addr = (void *)(frame)->f_pc;	\
-	return -1;	\
-} while (/*CONSTCOND*/0)
-
-static int fpu_emul_fmovmcr(struct fpemu *fe, struct instruction *insn);
-static int fpu_emul_fmovm(struct fpemu *fe, struct instruction *insn);
-static int fpu_emul_arith(struct fpemu *fe, struct instruction *insn);
-static int fpu_emul_type1(struct fpemu *fe, struct instruction *insn);
-static int fpu_emul_brcc(struct fpemu *fe, struct instruction *insn);
-static int test_cc(struct fpemu *fe, int pred);
-static struct fpn *fpu_cmp(struct fpemu *fe);
-
-#if DEBUG_FPE
-#  define DUMP_INSN(insn)		\
-printf("fpu_emulate: insn={adv=%d,siz=%d,op=%04x,w1=%04x}\n",	\
-	   (insn)->is_advance, (insn)->is_datasize,			\
-	   (insn)->is_opcode, (insn)->is_word1)
+#define	fpe_abort(tfp, ksi, signo, code)			\
+	do {			\
+		(ksi)->ksi_signo = (signo);			\
+		(ksi)->ksi_code = (code);			\
+		(ksi)->ksi_addr = (void *)(frame)->f_pc;	\
+		return -1;	\
+	} while (/* CONSTCOND */ 0)
+
+static int fpu_emul_fmovmcr(struct fpemu *, struct instruction *);
+static int fpu_emul_fmovm(struct fpemu *, struct instruction *);
+static int fpu_emul_arith(struct fpemu *, struct instruction *);
+static int fpu_emul_type1(struct fpemu *, struct instruction *);
+static int fpu_emul_brcc(struct fpemu *, struct instruction *);
+static int test_cc(struct fpemu *, int);
+static struct fpn *fpu_cmp(struct fpemu *);
+
+#if DEBUG_FPE
+#define DUMP_INSN(insn)			\
+	printf("fpu_emulate: insn={adv=%d,siz=%d,op=%04x,w1=%04x}\n",	\
+	(insn)->is_advance, (insn)->is_datasize,			\
+	(insn)->is_opcode, (insn)->is_word1)
 #else
-#  define DUMP_INSN(insn)
+#define DUMP_INSN(insn)
 #endif
 
 /*
@@ -84,370 +84,378 @@
 int
 fpu_emulate(struct frame *frame, struct fpframe *fpf, ksiginfo_t *ksi)
 {
-static struct instruction insn;
-static struct fpemu fe;
-int word, optype, sig;
-
-
-/* initialize insn.is_datasize to tell it is *not* initialized */
-insn.is_datasize = -1;
-
-fe.fe_frame = frame;
-fe.fe_fpframe = fpf;
-fe.fe_fpsr = fpf->fpf_fpsr;
-fe.fe_fpcr = fpf->fpf_fpcr;
-
-#if DEBUG_FPE
-printf("ENTERING fpu_emulate: FPSR=%08x, FPCR=%08x\n",
-	   fe.fe_fpsr, fe.fe_fpcr);
+	static struct instruction insn;
+	static struct fpemu fe;
+	int word, optype, sig;
+
+
+	/* initialize insn.is_datasize to tell it is *not* initialized */
+	insn.is_datasize = -1;
+
+	fe.fe_frame = frame;
+	fe.fe_fpframe = fpf;
+	fe.fe_fpsr = fpf->fpf_fpsr;
+	fe.fe_fpcr = fpf->fpf_fpcr;
+
+#if DEBUG_FPE
+	printf("ENTERING fpu_emulate: FPSR=%08x, FPCR=%08x\n",
+	fe.fe_fpsr, fe.fe_fpcr);
+#endif
+
+	/* always set this (to avoid a warning) */
+	insn.is_pc = frame->f_pc;
+	insn.is_nextpc = 0;
+	if (frame->f_format == 4) {
+		/*
+		 * A format 4 is generated by the 68{EC,LC}040.  The PC is
+		 * already set to the instruction following the faulting
+		 * instruction.  We need to calculate that, anyway.  The
+		 * fslw is the PC of the faulted instruction, which is what
+		 * we expect to be in f_pc.
+		 *
+		 * XXX - This is a hack; it assumes we at least know the
+		 * sizes of all instructions we run across.
+		 * XXX TODO: This may not be true, so we might want to save
+		 * the PC in order to restore it later.
+		 */
+#if 0
+		insn.is_nextpc = frame->f_pc;
 #endif
+		insn.is_pc = frame->f_fmt4.f_fslw;
+		frame->f_pc = insn.is_pc;
+	}
 
-/* always set this (to avoid a warning) */
-insn.is_pc = frame->f_pc;
-insn.is_nextpc = 0;
-if (frame->f_format == 4) {
-	/*
-	 * A format 4 is generated by the 68{EC,LC}040.  The PC is
-	 * already set to the instruction following the faulting
-	 * instruction.  We need 

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

2011-05-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon May 23 15:40:34 UTC 2011

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

Log Message:
- use DPRINTF() style debug printfs
- use __func__ to print function names
- consistently use #ifdef DEBUG_FPE
- add some missing debug messages including \n in error paths


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.32 src/sys/arch/m68k/fpe/fpu_emulate.c:1.33
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.32	Mon May 23 14:52:31 2011
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Mon May 23 15:40:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.32 2011/05/23 14:52:31 tsutsui Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.33 2011/05/23 15:40:34 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.32 2011/05/23 14:52:31 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.33 2011/05/23 15:40:34 tsutsui Exp $");
 
 #include 
 #include 
@@ -67,13 +67,16 @@
 static int test_cc(struct fpemu *, int);
 static struct fpn *fpu_cmp(struct fpemu *);
 
-#if DEBUG_FPE
+#ifdef DEBUG_FPE
 #define DUMP_INSN(insn)			\
-	printf("fpu_emulate: insn={adv=%d,siz=%d,op=%04x,w1=%04x}\n",	\
+	printf("%s: insn={adv=%d,siz=%d,op=%04x,w1=%04x}\n",		\
+	__func__,			\
 	(insn)->is_advance, (insn)->is_datasize,			\
 	(insn)->is_opcode, (insn)->is_word1)
+#define DPRINTF(x)	printf x
 #else
-#define DUMP_INSN(insn)
+#define DUMP_INSN(insn)	do {} while (/* CONSTCOND */ 0)
+#define DPRINTF(x)	do {} while (/* CONSTCOND */ 0)
 #endif
 
 /*
@@ -97,10 +100,8 @@
 	fe.fe_fpsr = fpf->fpf_fpsr;
 	fe.fe_fpcr = fpf->fpf_fpcr;
 
-#if DEBUG_FPE
-	printf("ENTERING fpu_emulate: FPSR=%08x, FPCR=%08x\n",
-	fe.fe_fpsr, fe.fe_fpcr);
-#endif
+	DPRINTF(("%s: ENTERING: FPSR=%08x, FPCR=%08x\n",
+	__func__, fe.fe_fpsr, fe.fe_fpcr));
 
 	/* always set this (to avoid a warning) */
 	insn.is_pc = frame->f_pc;
@@ -127,23 +128,18 @@
 
 	word = fusword((void *)(insn.is_pc));
 	if (word < 0) {
-#ifdef DEBUG
-		printf("fpu_emulate: fault reading opcode\n");
-#endif
+		DPRINTF(("%s: fault reading opcode\n", __func__));
 		fpe_abort(frame, ksi, SIGSEGV, SEGV_ACCERR);
 	}
 
 	if ((word & 0xf000) != 0xf000) {
-#ifdef DEBUG
-		printf("fpu_emulate: not coproc. insn.: opcode=0x%x\n", word);
-#endif
+		DPRINTF(("%s: not coproc. insn.: opcode=0x%x\n",
+		__func__, word));
 		fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
 	}
 
 	if ((word & 0x0E00) != 0x0200) {
-#ifdef DEBUG
-		printf("fpu_emulate: bad coproc. id: opcode=0x%x\n", word);
-#endif
+		DPRINTF(("%s: bad coproc. id: opcode=0x%x\n", __func__, word));
 		fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
 	}
 
@@ -152,9 +148,7 @@
 
 	word = fusword((void *)(insn.is_pc + 2));
 	if (word < 0) {
-#ifdef DEBUG
-		printf("fpu_emulate: fault reading word1\n");
-#endif
+		DPRINTF(("%s: fault reading word1\n", __func__));
 		fpe_abort(frame, ksi, SIGSEGV, SEGV_ACCERR);
 	}
 	insn.is_word1 = word;
@@ -171,68 +165,48 @@
 	if (optype == 0x) {
 		/* type=0: generic */
 		if ((word & 0xc000) == 0xc000) {
-#if DEBUG_FPE
-			printf("fpu_emulate: fmovm FPr\n");
-#endif
+			DPRINTF(("%s: fmovm FPr\n", __func__));
 			sig = fpu_emul_fmovm(&fe, &insn);
 		} else if ((word & 0xc000) == 0x8000) {
-#if DEBUG_FPE
-			printf("fpu_emulate: fmovm FPcr\n");
-#endif
+			DPRINTF(("%s: fmovm FPcr\n", __func__));
 			sig = fpu_emul_fmovmcr(&fe, &insn);
 		} else if ((word & 0xe000) == 0x6000) {
 			/* fstore = fmove FPn,mem */
-#if DEBUG_FPE
-			printf("fpu_emulate: fmove to mem\n");
-#endif
+			DPRINTF(("%s: fmove to mem\n", __func__));
 			sig = fpu_emul_fstore(&fe, &insn);
 		} else if ((word & 0xfc00) == 0x5c00) {
 			/* fmovecr */
-#if DEBUG_FPE
-			printf("fpu_emulate: fmovecr\n");
-#endif
+			DPRINTF(("%s: fmovecr\n", __func__));
 			sig = fpu_emul_fmovecr(&fe, &insn);
 		} else if ((word & 0xa07f) == 0x26) {
 			/* fscale */
-#if DEBUG_FPE
-			printf("fpu_emulate: fscale\n");
-#endif
+			DPRINTF(("%s: fscale\n", __func__));
 			sig = fpu_emul_fscale(&fe, &insn);
 		} else {
-#if DEBUG_FPE
-			printf("fpu_emulate: other type0\n");
-#endif
+			DPRINTF(("%s: other type0\n", __func__));
 			/* all other type0 insns are arithmetic */
 			sig = fpu_emul_arith(&fe, &insn);
 		}
 		if (sig == 0) {
-#if DEBUG_FPE
-			printf("fpu_emulate: type 0 returned 0\n");
-#endif
+			DPRINTF(("%s: type 0 returned 0\n", __func__));
 			sig = fpu_upd_excp(&fe);
 		}
 	} else if (optype == 0x0080 || optype == 0x00C0) {
 		/* type=2 or 3: fbcc, short or long disp. */
-#if DEBUG_FPE
-		printf("fpu_emulate: fbcc %s\n",
-		(optype & 0x40) ? "long" : "short");
-#endif
+		DPRINTF(("%s: fbcc %s\n", __func__,
+		(optype & 0x4

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

2011-05-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed May 25 15:17:21 UTC 2011

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

Log Message:
KNF. No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/fpe/fpu_calcea.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_calcea.c
diff -u src/sys/arch/m68k/fpe/fpu_calcea.c:1.22 src/sys/arch/m68k/fpe/fpu_calcea.c:1.23
--- src/sys/arch/m68k/fpe/fpu_calcea.c:1.22	Sun Jun  6 04:50:07 2010
+++ src/sys/arch/m68k/fpe/fpu_calcea.c	Wed May 25 15:17:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_calcea.c,v 1.22 2010/06/06 04:50:07 mrg Exp $	*/
+/*	$NetBSD: fpu_calcea.c,v 1.23 2011/05/25 15:17:21 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -34,7 +34,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_calcea.c,v 1.22 2010/06/06 04:50:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_calcea.c,v 1.23 2011/05/25 15:17:21 tsutsui Exp $");
 
 #include 
 #include 
@@ -47,13 +47,11 @@
 /*
  * Prototypes of static functions
  */
-static int decode_ea6(struct frame *frame, struct instruction *insn,
-			   struct insn_ea *ea, int modreg);
-static int fetch_immed(struct frame *frame, struct instruction *insn,
-			int *dst);
-static int fetch_disp(struct frame *frame, struct instruction *insn,
-			   int size, int *res);
-static int calc_ea(struct insn_ea *ea, char *ptr, char **eaddr);
+static int decode_ea6(struct frame *, struct instruction *,
+		  struct insn_ea *, int);
+static int fetch_immed(struct frame *, struct instruction *, int *);
+static int fetch_disp(struct frame *, struct instruction *, int, int *);
+static int calc_ea(struct insn_ea *, char *, char **);
 
 /*
  * Helper routines for dealing with "effective address" values.
@@ -64,248 +62,253 @@
  * Returns zero on success, else signal number.
  */
 int
-fpu_decode_ea(struct frame *frame, struct instruction *insn, struct insn_ea *ea, int modreg)
+fpu_decode_ea(struct frame *frame, struct instruction *insn,
+struct insn_ea *ea, int modreg)
 {
-int sig;
+	int sig;
 
 #ifdef DEBUG
-if (insn->is_datasize < 0) {
-	panic("decode_ea: called with uninitialized datasize");
-}
+	if (insn->is_datasize < 0)
+		panic("decode_ea: called with uninitialized datasize");
 #endif
 
-sig = 0;
+	sig = 0;
 
-/* Set the most common value here. */
-ea->ea_regnum = 8 + (modreg & 7);
+	/* Set the most common value here. */
+	ea->ea_regnum = 8 + (modreg & 7);
 
-if ((modreg & 060) == 0) {
-	/* register direct */
-	ea->ea_regnum = modreg & 0xf;
-	ea->ea_flags = EA_DIRECT;
+	if ((modreg & 060) == 0) {
+		/* register direct */
+		ea->ea_regnum = modreg & 0xf;
+		ea->ea_flags = EA_DIRECT;
 #ifdef DEBUG_FPE
-	printf("decode_ea: register direct reg=%d\n", ea->ea_regnum);
+		printf("decode_ea: register direct reg=%d\n", ea->ea_regnum);
 #endif
-} else if ((modreg & 077) == 074) {
-	/* immediate */
-	ea->ea_flags = EA_IMMED;
-	sig = fetch_immed(frame, insn, &ea->ea_immed[0]);
+	} else if ((modreg & 077) == 074) {
+		/* immediate */
+		ea->ea_flags = EA_IMMED;
+		sig = fetch_immed(frame, insn, &ea->ea_immed[0]);
 #ifdef DEBUG_FPE
-	printf("decode_ea: immediate size=%d\n", insn->is_datasize);
+		printf("decode_ea: immediate size=%d\n", insn->is_datasize);
 #endif
-}
-/*
- * rest of the address modes need to be separately
- * handled for the LC040 and the others.
- */
+	}
+	/*
+	 * rest of the address modes need to be separately
+	 * handled for the LC040 and the others.
+	 */
 #if 0 /* XXX */
-else if (frame->f_format == 4 && frame->f_fmt4.f_fa) {
-	/* LC040 */
-	ea->ea_flags = EA_FRAME_EA;
-	ea->ea_fea = frame->f_fmt4.f_fa;
-#ifdef DEBUG_FPE
-	printf("decode_ea: 68LC040 - in-frame EA (%p) size %d\n",
-		(void *)ea->ea_fea, insn->is_datasize);
-#endif
-	if ((modreg & 070) == 030) {
-	/* postincrement mode */
-	ea->ea_flags |= EA_POSTINCR;
-	} else if ((modreg & 070) == 040) {
-	/* predecrement mode */
-	ea->ea_flags |= EA_PREDECR;
+	else if (frame->f_format == 4 && frame->f_fmt4.f_fa) {
+		/* LC040 */
+		ea->ea_flags = EA_FRAME_EA;
+		ea->ea_fea = frame->f_fmt4.f_fa;
+#ifdef DEBUG_FPE
+		printf("decode_ea: 68LC040 - in-frame EA (%p) size %d\n",
+		(void *)ea->ea_fea, insn->is_datasize);
+#endif
+		if ((modreg & 070) == 030) {
+			/* postincrement mode */
+			ea->ea_flags |= EA_POSTINCR;
+		} else if ((modreg & 070) == 040) {
+			/* predecrement mode */
+			ea->ea_flags |= EA_PREDECR;
 #ifdef M68060
 #if defined(M68020) || defined(M68030) || defined(M68040)
-	if (cputype == CPU_68060)
+			if (cputype == CPU_68060)
 #endif
-		if (insn->is_datasize == 12)
-			ea->ea_fea -= 8;
+if (insn->is_datasize == 12)
+	ea->ea_fea -= 8;
 #endif
+		}
 	}
-}
 #endif /* XXX */
-else {
-	/* 020/030 */
-	switch (modreg & 070) {
+	else {
+		/* 020/030 */

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

2011-05-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed May 25 15:47:19 UTC 2011

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

Log Message:
- consistently use #ifdef DEBUG_FPE and #ifdef DIAGNOSTIC
- use DPRINTF() style debug printfs
- use __func__ to print function names


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/fpe/fpu_calcea.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_calcea.c
diff -u src/sys/arch/m68k/fpe/fpu_calcea.c:1.23 src/sys/arch/m68k/fpe/fpu_calcea.c:1.24
--- src/sys/arch/m68k/fpe/fpu_calcea.c:1.23	Wed May 25 15:17:21 2011
+++ src/sys/arch/m68k/fpe/fpu_calcea.c	Wed May 25 15:47:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_calcea.c,v 1.23 2011/05/25 15:17:21 tsutsui Exp $	*/
+/*	$NetBSD: fpu_calcea.c,v 1.24 2011/05/25 15:47:19 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -34,7 +34,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_calcea.c,v 1.23 2011/05/25 15:17:21 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_calcea.c,v 1.24 2011/05/25 15:47:19 tsutsui Exp $");
 
 #include 
 #include 
@@ -44,6 +44,12 @@
 
 #include "fpu_emulate.h"
 
+#ifdef DEBUG_FPE
+#define DPRINTF(x)	printf x
+#else
+#define DPRINTF(x)	do {} while (/* CONSTCOND */ 0)
+#endif
+
 /*
  * Prototypes of static functions
  */
@@ -67,9 +73,9 @@
 {
 	int sig;
 
-#ifdef DEBUG
+#ifdef DIAGNOSTIC
 	if (insn->is_datasize < 0)
-		panic("decode_ea: called with uninitialized datasize");
+		panic("%s: called with uninitialized datasize", __func__);
 #endif
 
 	sig = 0;
@@ -81,16 +87,14 @@
 		/* register direct */
 		ea->ea_regnum = modreg & 0xf;
 		ea->ea_flags = EA_DIRECT;
-#ifdef DEBUG_FPE
-		printf("decode_ea: register direct reg=%d\n", ea->ea_regnum);
-#endif
+		DPRINTF(("%s: register direct reg=%d\n",
+		__func__, ea->ea_regnum));
 	} else if ((modreg & 077) == 074) {
 		/* immediate */
 		ea->ea_flags = EA_IMMED;
 		sig = fetch_immed(frame, insn, &ea->ea_immed[0]);
-#ifdef DEBUG_FPE
-		printf("decode_ea: immediate size=%d\n", insn->is_datasize);
-#endif
+		DPRINTF(("%s: immediate size=%d\n",
+		__func__, insn->is_datasize));
 	}
 	/*
 	 * rest of the address modes need to be separately
@@ -101,10 +105,8 @@
 		/* LC040 */
 		ea->ea_flags = EA_FRAME_EA;
 		ea->ea_fea = frame->f_fmt4.f_fa;
-#ifdef DEBUG_FPE
-		printf("decode_ea: 68LC040 - in-frame EA (%p) size %d\n",
-		(void *)ea->ea_fea, insn->is_datasize);
-#endif
+		DPRINTF(("%s: 68LC040 - in-frame EA (%p) size %d\n",
+		__func__, (void *)ea->ea_fea, insn->is_datasize));
 		if ((modreg & 070) == 030) {
 			/* postincrement mode */
 			ea->ea_flags |= EA_POSTINCR;
@@ -127,35 +129,27 @@
 
 		case 020:			/* (An) */
 			ea->ea_flags = 0;
-#ifdef DEBUG_FPE
-			printf("decode_ea: register indirect reg=%d\n",
-			ea->ea_regnum);
-#endif
+			DPRINTF(("%s: register indirect reg=%d\n",
+			__func__, ea->ea_regnum));
 			break;
 
 		case 030:			/* (An)+ */
 			ea->ea_flags = EA_POSTINCR;
-#ifdef DEBUG_FPE
-			printf("decode_ea: reg indirect postincrement reg=%d\n",
-			ea->ea_regnum);
-#endif
+			DPRINTF(("%s: reg indirect postincrement reg=%d\n",
+			__func__, ea->ea_regnum));
 			break;
 
 		case 040:			/* -(An) */
 			ea->ea_flags = EA_PREDECR;
-#ifdef DEBUG_FPE
-			printf("decode_ea: reg indirect predecrement reg=%d\n",
-			ea->ea_regnum);
-#endif
+			DPRINTF(("%s: reg indirect predecrement reg=%d\n",
+			__func__, ea->ea_regnum));
 			break;
 
 		case 050:			/* (d16,An) */
 			ea->ea_flags = EA_OFFSET;
 			sig = fetch_disp(frame, insn, 1, &ea->ea_offset);
-#ifdef DEBUG_FPE
-			printf("decode_ea: reg indirect with displacement "
-			"reg=%d\n", ea->ea_regnum);
-#endif
+			DPRINTF(("%s: reg indirect with displacement reg=%d\n",
+			__func__, ea->ea_regnum));
 		break;
 
 		case 060:			/* (d8,An,Xn) */
@@ -171,28 +165,24 @@
 ea->ea_flags = EA_ABS;
 sig = fetch_disp(frame, insn, 1,
 &ea->ea_absaddr);
-#ifdef DEBUG_FPE
-printf("decode_ea: absolute address (word)\n");
-#endif
+DPRINTF(("%s: absolute address (word)\n",
+__func__));
 break;
 
 			case 1:			/* ().L */
 ea->ea_flags = EA_ABS;
 sig = fetch_disp(frame, insn, 2,
 &ea->ea_absaddr);
-#ifdef DEBUG_FPE
-printf("decode_ea: absolute address (long)\n");
-#endif
+DPRINTF(("%s: absolute address (long)\n",
+__func__));
 break;
 
 			case 2:			/* (d16,PC) */
 ea->ea_flags = EA_PC_REL | EA_OFFSET;
 sig = fetch_disp(frame, insn, 1,
 &ea->ea_absaddr);
-#ifdef DEBUG_FPE
-printf("decode_ea: pc relative word "
-"displacement\n");
-#endif
+DPRINTF(("%s: pc relative word displacement\n",
+__func__));
 break;
 
 			case 3:			/* (d8,PC,Xn) */
@@ -203,10 +193,8 @@
 			case 4:			/* #data */
 /* it should have been taken care of earlier */
 			default:
-#ifde

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

2010-04-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Apr 26 15:07:01 UTC 2010

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

Log Message:
lwp_uc_pool has been replaced with kmem(9)
so also replace  with .


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 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.40 src/sys/arch/m68k/m68k/m68k_syscall.c:1.41
--- src/sys/arch/m68k/m68k/m68k_syscall.c:1.40	Fri Apr 23 19:18:09 2010
+++ src/sys/arch/m68k/m68k/m68k_syscall.c	Mon Apr 26 15:07:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_syscall.c,v 1.40 2010/04/23 19:18:09 rmind Exp $	*/
+/*	$NetBSD: m68k_syscall.c,v 1.41 2010/04/26 15:07:01 tsutsui Exp $	*/
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.40 2010/04/23 19:18:09 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.41 2010/04/26 15:07:01 tsutsui Exp $");
 
 #include "opt_execfmt.h"
 #include "opt_compat_netbsd.h"
@@ -120,7 +120,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 



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

2010-06-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jun  6 04:51:33 UTC 2010

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

Log Message:
fix PR 6724 - convert m68k options to defflag's.  this means that
M680[12346] are now available from opt_m68k_arch.h.  FPSP meantioned
in the PR has already been fixed, and i could not find any more.

i built these kernels to ensure i did not break their builds:

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC


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

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

Modified files:

Index: src/sys/arch/m68k/conf/files.m68k
diff -u src/sys/arch/m68k/conf/files.m68k:1.45 src/sys/arch/m68k/conf/files.m68k:1.46
--- src/sys/arch/m68k/conf/files.m68k:1.45	Wed Nov 19 18:35:59 2008
+++ src/sys/arch/m68k/conf/files.m68k	Sun Jun  6 04:51:33 2010
@@ -1,7 +1,12 @@
-#	$NetBSD: files.m68k,v 1.45 2008/11/19 18:35:59 ad Exp $
+#	$NetBSD: files.m68k,v 1.46 2010/06/06 04:51:33 mrg Exp $
 #
 
 defflag	opt_fpsp.h		FPSP
+defflag	opt_m68k_arch.h		M68010
+defflag	opt_m68k_arch.h		M68020
+defflag	opt_m68k_arch.h		M68030
+defflag	opt_m68k_arch.h		M68040
+defflag	opt_m68k_arch.h		M68060
 defflagFPU_EMULATE
 defflagPMAP_DEBUG
 



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

2010-06-06 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Jun  6 11:41:06 UTC 2010

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

Log Message:
Only include opt_m68k_arch.h if _KERNEL_OPT is defined, so that librump
builds again.  OK'ed by m...@.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/m68k/include/pmap_motorola.h

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

Modified files:

Index: src/sys/arch/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.29 src/sys/arch/m68k/include/pmap_motorola.h:1.30
--- src/sys/arch/m68k/include/pmap_motorola.h:1.29	Sun Jun  6 04:50:07 2010
+++ src/sys/arch/m68k/include/pmap_motorola.h	Sun Jun  6 11:41:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.29 2010/06/06 04:50:07 mrg Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.30 2010/06/06 11:41:06 he Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -76,7 +76,9 @@
 #ifndef	_M68K_PMAP_MOTOROLA_H_
 #define	_M68K_PMAP_MOTOROLA_H_
 
+#ifdef _KERNEL_OPT
 #include "opt_m68k_arch.h"
+#endif
 
 #include 
 #include 



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

2011-03-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Mar  5 14:32:32 UTC 2011

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

Log Message:
If _KERNEL is not defined, force MACHINE to be "m68k".  Userland should be
using uname/sysctl to get this value.


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

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

Modified files:

Index: src/sys/arch/m68k/include/param.h
diff -u src/sys/arch/m68k/include/param.h:1.18 src/sys/arch/m68k/include/param.h:1.19
--- src/sys/arch/m68k/include/param.h:1.18	Tue Feb  8 20:20:16 2011
+++ src/sys/arch/m68k/include/param.h	Sat Mar  5 14:32:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.18 2011/02/08 20:20:16 rmind Exp $	*/
+/*	$NetBSD: param.h,v 1.19 2011/03/05 14:32:32 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -51,6 +51,10 @@
 #ifndef	MID_MACHINE
 #define	MID_MACHINE	MID_M68K
 #endif
+#ifndef _KERNEL
+#undef MACHINE
+#define MACHINE "m68k"
+#endif
 
 /*
  * Round p (pointer or byte index) up to a correctly-aligned value for all



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

2011-05-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May 14 16:17:55 UTC 2011

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

Log Message:
Fix botch in rev 1.28 that causes wrong results of fcmp and ftst in FPE.
fpu_upd_fpsr() should be called even in discard_result case if an emulated
instruction gets proper result without signal.

Fixes weird behavior of awk(1) seen on /etc/rc.d/postfix on XM6i and
TME emulating sun3 without 68881.

Should be pulled up to all netbsd-4 and netbsd-5 branches.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.30 src/sys/arch/m68k/fpe/fpu_emulate.c:1.31
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.30	Sat Mar 14 15:36:09 2009
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Sat May 14 16:17:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.30 2009/03/14 15:36:09 dsl Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.31 2011/05/14 16:17:55 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.30 2009/03/14 15:36:09 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.31 2011/05/14 16:17:55 tsutsui Exp $");
 
 #include 
 #include 
@@ -909,27 +909,34 @@
 if (res == NULL)
 	sig = SIGILL;
 
-if (!discard_result && sig == 0) {
-	fpu_implode(fe, res, FTYPE_EXT, &fpregs[regnum * 3]);
+if (sig == 0) {
+	if (!discard_result)
+	fpu_implode(fe, res, FTYPE_EXT, &fpregs[regnum * 3]);
 
 	/* update fpsr according to the result of operation */
 	fpu_upd_fpsr(fe, res);
 #if DEBUG_FPE
-	printf("fpu_emul_arith: %08x,%08x,%08x stored in FP%d\n",
-	   fpregs[regnum*3], fpregs[regnum*3+1],
-	   fpregs[regnum*3+2], regnum);
-} else if (sig == 0) {
-	static const char *class_name[] =
-	{ "SNAN", "QNAN", "ZERO", "NUM", "INF" };
-	printf("fpu_emul_arith: result(%s,%c,%d,%08x,%08x,%08x) discarded\n",
-	   class_name[res->fp_class + 2],
-	   res->fp_sign ? '-' : '+', res->fp_exp,
-	   res->fp_mant[0], res->fp_mant[1],
-	   res->fp_mant[2]);
-} else {
-	printf("fpu_emul_arith: received signal %d\n", sig);
+	if (!discard_result) {
+	printf("fpu_emul_arith: %08x,%08x,%08x stored in FP%d\n",
+		fpregs[regnum*3], fpregs[regnum*3+1],
+		fpregs[regnum*3+2], regnum);
+	} else {
+	static const char *class_name[] =
+		{ "SNAN", "QNAN", "ZERO", "NUM", "INF" };
+	printf("fpu_emul_arith: result(%s,%c,%d,%08x,%08x,%08x)"
+		" discarded\n",
+		class_name[res->fp_class + 2],
+		res->fp_sign ? '-' : '+', res->fp_exp,
+		res->fp_mant[0], res->fp_mant[1],
+		res->fp_mant[2]);
+	}
 #endif
 }
+#if DEBUG_FPE
+else {
+	printf("fpu_emul_arith: received signal %d\n", sig);
+}
+#endif
 
 #if DEBUG_FPE
 printf("fpu_emul_arith: FPSR = %08x, FPCR = %08x\n",



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

2011-10-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct  9 01:34:20 UTC 2011

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

Log Message:
Use static inline structure assignment for CPYFPN().  From isaki@.
Tested on XM6i.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/fpe/fpu_emulate.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/fpe/fpu_emulate.h
diff -u src/sys/arch/m68k/fpe/fpu_emulate.h:1.16 src/sys/arch/m68k/fpe/fpu_emulate.h:1.17
--- src/sys/arch/m68k/fpe/fpu_emulate.h:1.16	Mon Jul 18 07:44:30 2011
+++ src/sys/arch/m68k/fpe/fpu_emulate.h	Sun Oct  9 01:34:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.h,v 1.16 2011/07/18 07:44:30 isaki Exp $	*/
+/*	$NetBSD: fpu_emulate.h,v 1.17 2011/10/09 01:34:19 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon Ross
@@ -91,15 +91,15 @@ struct fpn {
 #define	FP_1		(1 << FP_LG)		/* 1.0 in fp_mant[0] */
 #define	FP_2		(1 << (FP_LG + 1))	/* 2.0 in fp_mant[0] */
 
-#define CPYFPN(dst, src)		\
-if ((dst) != (src)) {			\
-	(dst)->fp_class = (src)->fp_class;\
-	(dst)->fp_sign = (src)->fp_sign;\
-	(dst)->fp_exp = (src)->fp_exp;	\
-	(dst)->fp_sticky = (src)->fp_sticky;\
-	(dst)->fp_mant[0] = (src)->fp_mant[0];\
-	(dst)->fp_mant[1] = (src)->fp_mant[1];\
-	(dst)->fp_mant[2] = (src)->fp_mant[2];\
+static inline void CPYFPN(struct fpn * dst, const struct fpn * src);
+
+static inline void
+CPYFPN(struct fpn * dst, const struct fpn * src)
+{
+
+	if (dst != src) {
+		*dst = *src;
+	}
 }
 
 /*



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

2011-10-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 15 15:14:30 UTC 2011

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

Log Message:
Add hyperboric and trigonometric functions to m68k FPE, written by isaki@.
With these emulations (~4KB text) xeyes on XM6i works better.
Discussed with isaki@ at OSC 2011 Hiroshima.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/m68k/fpe/fpu_emulate.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/m68k/fpe/fpu_emulate.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/fpe/fpu_hyperb.c \
src/sys/arch/m68k/fpe/fpu_trig.c

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

Modified files:

Index: src/sys/arch/m68k/fpe/fpu_emulate.c
diff -u src/sys/arch/m68k/fpe/fpu_emulate.c:1.35 src/sys/arch/m68k/fpe/fpu_emulate.c:1.36
--- src/sys/arch/m68k/fpe/fpu_emulate.c:1.35	Mon Jul 18 14:11:27 2011
+++ src/sys/arch/m68k/fpe/fpu_emulate.c	Sat Oct 15 15:14:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.c,v 1.35 2011/07/18 14:11:27 isaki Exp $	*/
+/*	$NetBSD: fpu_emulate.c,v 1.36 2011/10/15 15:14:29 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.35 2011/07/18 14:11:27 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.36 2011/10/15 15:14:29 tsutsui Exp $");
 
 #include 
 #include 
@@ -65,7 +65,6 @@ static int fpu_emul_arith(struct fpemu *
 static int fpu_emul_type1(struct fpemu *, struct instruction *);
 static int fpu_emul_brcc(struct fpemu *, struct instruction *);
 static int test_cc(struct fpemu *, int);
-static struct fpn *fpu_cmp(struct fpemu *);
 
 #ifdef DEBUG_FPE
 #define DUMP_INSN(insn)			\
@@ -494,7 +493,7 @@ fpu_emul_fmovm(struct fpemu *fe, struct 
 	return sig;
 }
 
-static struct fpn *
+struct fpn *
 fpu_cmp(struct fpemu *fe)
 {
 	struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2;

Index: src/sys/arch/m68k/fpe/fpu_emulate.h
diff -u src/sys/arch/m68k/fpe/fpu_emulate.h:1.17 src/sys/arch/m68k/fpe/fpu_emulate.h:1.18
--- src/sys/arch/m68k/fpe/fpu_emulate.h:1.17	Sun Oct  9 01:34:19 2011
+++ src/sys/arch/m68k/fpe/fpu_emulate.h	Sat Oct 15 15:14:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.h,v 1.17 2011/10/09 01:34:19 tsutsui Exp $	*/
+/*	$NetBSD: fpu_emulate.h,v 1.18 2011/10/15 15:14:30 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon Ross
@@ -244,6 +244,9 @@ int fpu_emul_fscale(struct fpemu *fe, st
 #include "fpu_arith_proto.h"
 
 int fpu_emulate(struct frame *frame, struct fpframe *fpf, ksiginfo_t *ksi);
+struct fpn *fpu_cmp(struct fpemu *);
+
+struct fpn *fpu_sincos_taylor(struct fpemu *, struct fpn *, u_int, int);
 
 /*
  * "helper" functions

Index: src/sys/arch/m68k/fpe/fpu_hyperb.c
diff -u src/sys/arch/m68k/fpe/fpu_hyperb.c:1.5 src/sys/arch/m68k/fpe/fpu_hyperb.c:1.6
--- src/sys/arch/m68k/fpe/fpu_hyperb.c:1.5	Mon Jul 18 07:44:30 2011
+++ src/sys/arch/m68k/fpe/fpu_hyperb.c	Sat Oct 15 15:14:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_hyperb.c,v 1.5 2011/07/18 07:44:30 isaki Exp $	*/
+/*	$NetBSD: fpu_hyperb.c,v 1.6 2011/10/15 15:14:30 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -31,8 +31,33 @@
  *	@(#)fpu_hyperb.c	10/24/95
  */
 
+/*
+ * Copyright (c) 2011 Tetsuya Isaki. All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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.
+ */
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_hyperb.c,v 1.5 2011/07/18 07:44:30 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_hyperb.c,v 1.6 2011/10/15 15:14:30 tsutsui Exp $");
 
 #include "fpu_emulate.h"
 
@@ -52,20 +77,87 @@ fpu_atanh(struct fpemu *fe)
 struct fpn *
 fpu_cosh(struct fpemu *fe)
 {
-	/* stub */
+	struct fpn s0;
+	struct fpn *r;
+	in

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

2011-10-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 15 15:24:28 UTC 2011

Modified Files:
src/sys/arch/m68k/fpe: README

Log Message:
Update implemented/unimplemented FP functions.


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

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

Modified files:

Index: src/sys/arch/m68k/fpe/README
diff -u src/sys/arch/m68k/fpe/README:1.4 src/sys/arch/m68k/fpe/README:1.5
--- src/sys/arch/m68k/fpe/README:1.4	Sun Nov  5 04:23:00 1995
+++ src/sys/arch/m68k/fpe/README	Sat Oct 15 15:24:28 2011
@@ -1,7 +1,7 @@
-* $NetBSD: README,v 1.4 1995/11/05 04:23:00 briggs Exp $
+* $NetBSD: README,v 1.5 2011/10/15 15:24:28 tsutsui Exp $
 * NetBSD/m68k FPE (floating point emulation) README file
 * Created Oct/??/95 by k...@remus.rutgers.edu (Ken Nakata)
-* Last updated Nov/04/95 by kenn
+* Last updated Oct/15/2011 by tsutsui
 
 1. INSTALLATION AND COMPILATION
 
@@ -67,7 +67,8 @@ Type field = bit 8-6 of opcode word
 Type=0: FMOVE (mem->FPr), FINT, FINTRZ, FSQRT, FABS, FNEG, FGETEXP,
 	FGETMAN, FDIV, FADD, FMUL, FSGLDIV(*), FSCALE, FSGLMUL(*), FSUB,
 	FCMP, FTST, FMOVE (FPr->mem), FMOVEM (FPr), FMOVEM (FPcr),
-	FMOVECR, FLOGNP1, FLOGN, FLOG10, FLOG2, FMOD, FREM
+	FMOVECR, FLOGNP1, FLOGN, FLOG10, FLOG2, FMOD, FREM,
+	FCOSH, FSINH, FTANH, FCOS, FSIN, FTAN, FSINCOS
 
 Type=1: FDBcc, FScc, FTRAPcc,
 
@@ -84,8 +85,7 @@ Type=5: none
 
 * Unimplemented Instructions
 
-Type=0: FSINH, FETOXM1, FTANH, FATAN, FASIN, FATANH, FSIN, FTAN,
-	FETOX, FTWOTOX, FTENTOX, FCOSH, FACOS, FCOS, FSINCOS
+Type=0: FETOX, FETOXM1, FTENTOX, FTWOTOX, FATANH, FACOS, FASIN, FATAN
 
 Type=1: none
 



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

2011-10-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 15 15:34:06 UTC 2011

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

Log Message:
- remove variable names from function declarations
- some KNF


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/m68k/fpe/fpu_emulate.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/fpe/fpu_emulate.h
diff -u src/sys/arch/m68k/fpe/fpu_emulate.h:1.18 src/sys/arch/m68k/fpe/fpu_emulate.h:1.19
--- src/sys/arch/m68k/fpe/fpu_emulate.h:1.18	Sat Oct 15 15:14:30 2011
+++ src/sys/arch/m68k/fpe/fpu_emulate.h	Sat Oct 15 15:34:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emulate.h,v 1.18 2011/10/15 15:14:30 tsutsui Exp $	*/
+/*	$NetBSD: fpu_emulate.h,v 1.19 2011/10/15 15:34:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon Ross
@@ -91,10 +91,10 @@ struct fpn {
 #define	FP_1		(1 << FP_LG)		/* 1.0 in fp_mant[0] */
 #define	FP_2		(1 << (FP_LG + 1))	/* 2.0 in fp_mant[0] */
 
-static inline void CPYFPN(struct fpn * dst, const struct fpn * src);
+static inline void CPYFPN(struct fpn *, const struct fpn *);
 
 static inline void
-CPYFPN(struct fpn * dst, const struct fpn * src)
+CPYFPN(struct fpn *dst, const struct fpn *src)
 {
 
 	if (dst != src) {
@@ -213,37 +213,37 @@ struct instruction {
  */
 
 /* Build a new Quiet NaN (sign=0, frac=all 1's). */
-struct	fpn *fpu_newnan(struct fpemu *fe);
+struct	fpn *fpu_newnan(struct fpemu *);
 
 /*
  * Shift a number right some number of bits, taking care of round/sticky.
  * Note that the result is probably not a well-formed number (it will lack
  * the normal 1-bit mant[0]&FP_1).
  */
-int	fpu_shr(struct fpn * fp, int shr);
+int	fpu_shr(struct fpn *, int);
 /*
  * Round a number according to the round mode in FPCR
  */
-int	fpu_round(register struct fpemu *fe, register struct fpn *fp);
+int	fpu_round(register struct fpemu *, register struct fpn *);
 
 /* type conversion */
-void	fpu_explode(struct fpemu *fe, struct fpn *fp, int t, u_int *src);
-void	fpu_implode(struct fpemu *fe, struct fpn *fp, int t, u_int *dst);
+void	fpu_explode(struct fpemu *, struct fpn *, int t, u_int *);
+void	fpu_implode(struct fpemu *, struct fpn *, int t, u_int *);
 
 /*
  * non-static emulation functions
  */
 /* type 0 */
-int fpu_emul_fmovecr(struct fpemu *fe, struct instruction *insn);
-int fpu_emul_fstore(struct fpemu *fe, struct instruction *insn);
-int fpu_emul_fscale(struct fpemu *fe, struct instruction *insn);
+int fpu_emul_fmovecr(struct fpemu *, struct instruction *);
+int fpu_emul_fstore(struct fpemu *, struct instruction *);
+int fpu_emul_fscale(struct fpemu *, struct instruction *);
 
 /*
  * include function declarations of those which are called by fpu_emul_arith()
  */
 #include "fpu_arith_proto.h"
 
-int fpu_emulate(struct frame *frame, struct fpframe *fpf, ksiginfo_t *ksi);
+int fpu_emulate(struct frame *, struct fpframe *, ksiginfo_t *);
 struct fpn *fpu_cmp(struct fpemu *);
 
 struct fpn *fpu_sincos_taylor(struct fpemu *, struct fpn *, u_int, int);
@@ -252,21 +252,21 @@ struct fpn *fpu_sincos_taylor(struct fpe
  * "helper" functions
  */
 /* return values from constant rom */
-struct fpn *fpu_const(struct fpn *fp, u_int offset);
+struct fpn *fpu_const(struct fpn *, u_int);
 /* update exceptions and FPSR */
-int fpu_upd_excp(struct fpemu *fe);
-u_int fpu_upd_fpsr(struct fpemu *fe, struct fpn *fp);
+int fpu_upd_excp(struct fpemu *);
+u_int fpu_upd_fpsr(struct fpemu *, struct fpn *);
 
 /* address mode decoder, and load/store */
-int fpu_decode_ea(struct frame *frame, struct instruction *insn,
-		   struct insn_ea *ea, int modreg);
-int fpu_load_ea(struct frame *frame, struct instruction *insn,
-		 struct insn_ea *ea, char *dst);
-int fpu_store_ea(struct frame *frame, struct instruction *insn,
-		  struct insn_ea *ea, char *src);
+int fpu_decode_ea(struct frame *, struct instruction *,
+		   struct insn_ea *, int);
+int fpu_load_ea(struct frame *, struct instruction *,
+		 struct insn_ea *, char *);
+int fpu_store_ea(struct frame *, struct instruction *,
+		  struct insn_ea *, char *);
 
 /* fpu_subr.c */
-void fpu_norm(register struct fpn *fp);
+void fpu_norm(register struct fpn *);
 
 #if !defined(FPE_DEBUG)
 #  define FPE_DEBUG 0



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 
-__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 
 #include 
@@ -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/include

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

Removed Files:
src/sys/arch/m68k/include: softintr.h

Log Message:
Remove obsolete header.


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

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 .


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 
-__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 
 
 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 
-__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 
-__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 
 #include 
@@ -60,8 +60,6 @@ __KERNEL_RCSID(0, "$NetBSD: svr4_machdep
 #include 
 
 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/include

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

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

Log Message:
Adjust for function merge and move.


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

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

Modified files:

Index: src/sys/arch/m68k/include/m68k.h
diff -u src/sys/arch/m68k/include/m68k.h:1.20 src/sys/arch/m68k/include/m68k.h:1.21
--- src/sys/arch/m68k/include/m68k.h:1.20	Tue Nov 15 12:23:22 2011
+++ src/sys/arch/m68k/include/m68k.h	Thu Dec 22 15:50:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k.h,v 1.20 2011/11/15 12:23:22 tsutsui Exp $	*/
+/*	$NetBSD: m68k.h,v 1.21 2011/12/22 15:50:37 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -103,14 +103,14 @@ void	copypage040(void *fromaddr, void *t
 void	copypage(void *fromaddr, void *toaddr);
 void	zeropage(void *addr);
 
-/* locore.s (XXX: move to support.s?) */
+/* support.s */
 int 	getdfc(void);
 int 	getsfc(void);
-void	m68881_save(struct fpframe *);
-void	m68881_restore(struct fpframe *); 
 
 /* switch_subr.s */
 void	lwp_trampoline(void);
+void	m68881_save(struct fpframe *);
+void	m68881_restore(struct fpframe *); 
 void	savectx(struct pcb *);
 void	setfunc_trampoline(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.

Modified files:

Index: src/sys/arch/m68k/m68k/oc_cksum.s
diff -u src/sys/arch/m68k/m68k/oc_cksum.s:1.5 src/sys/arch/m68k/m68k/oc_cksum.s:1.6
--- src/sys/arch/m68k/m68k/oc_cksum.s:1.5	Wed Nov 10 23:17:21 1999
+++ src/sys/arch/m68k/m68k/oc_cksum.s	Fri Dec 23 05:06:19 2011
@@ -1,4 +1,4 @@
-|	$NetBSD: oc_cksum.s,v 1.5 1999/11/10 23:17:21 thorpej Exp $
+|	$NetBSD: oc_cksum.s,v 1.6 2011/12/23 05:06:19 tsutsui Exp $
 
 | Copyright (c) 1988 Regents of the University of California.
 | All rights reserved.
@@ -11,11 +11,7 @@
 | 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. All advertising materials mentioning features or use of this software
-|must display the following acknowledgement:
-|	This product includes software developed by the University of
-|	California, Berkeley and its contributors.
-| 4. Neither the name of the University nor the names of its contributors
+| 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.
 |



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

2011-02-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Feb 12 16:32:37 UTC 2011

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

Log Message:
Put RCSIDs in section .ident.  (use .pushsection/.popsection)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/m68k/include/asm.h

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

Modified files:

Index: src/sys/arch/m68k/include/asm.h
diff -u src/sys/arch/m68k/include/asm.h:1.27 src/sys/arch/m68k/include/asm.h:1.28
--- src/sys/arch/m68k/include/asm.h:1.27	Mon Dec 20 21:11:25 2010
+++ src/sys/arch/m68k/include/asm.h	Sat Feb 12 16:32:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.27 2010/12/20 21:11:25 joerg Exp $	*/
+/*	$NetBSD: asm.h,v 1.28 2011/02/12 16:32:36 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -135,9 +135,9 @@
 #define ALTENTRY(name, rname)	_ENTRY(_C_LABEL(name))
 #endif
 
-#define RCSID(x)	.text			;	\
+#define RCSID(x)	.pushsection ".ident"	;	\
 			.asciz x		;	\
-			.even
+			.popsection
 
 /*
  * Global variables of whatever sort.



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

2009-12-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Dec  7 14:23:46 UTC 2009

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

Log Message:
Remove "#if defined(amiga) || defined(atari)" for PG_SHIFT.
Use PGSHIFT from  instead.


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

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

Modified files:

Index: src/sys/arch/m68k/include/pte_motorola.h
diff -u src/sys/arch/m68k/include/pte_motorola.h:1.6 src/sys/arch/m68k/include/pte_motorola.h:1.7
--- src/sys/arch/m68k/include/pte_motorola.h:1.6	Sat Jan 17 01:38:10 2009
+++ src/sys/arch/m68k/include/pte_motorola.h	Mon Dec  7 14:23:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pte_motorola.h,v 1.6 2009/01/17 01:38:10 tsutsui Exp $	*/
+/*	$NetBSD: pte_motorola.h,v 1.7 2009/12/07 14:23:45 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -89,11 +89,7 @@
 #define	PT_ENTRY_NULL	NULL
 #define	ST_ENTRY_NULL	NULL
 
-#if defined(amiga) || defined(atari)
-#define PG_SHIFT	13
-#else
-#define PG_SHIFT	12
-#endif
+#define PG_SHIFT	PGSHIFT
 
 #define	SG_V		0x0002	/* segment is valid */
 #define	SG_NV		0x



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

2009-12-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Dec  8 15:32:01 UTC 2009

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

Log Message:
Remove unused M68K_SEG_SIZE macro. All sources use NBSEG directly.

XXX: It looks NBSEG definitions in 
XXX: for all m68k port are incorrect, since 1997 or 2002.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/include/pmap_motorola.h

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

Modified files:

Index: src/sys/arch/m68k/include/pmap_motorola.h
diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.24 src/sys/arch/m68k/include/pmap_motorola.h:1.25
--- src/sys/arch/m68k/include/pmap_motorola.h:1.24	Sun Dec  6 06:41:30 2009
+++ src/sys/arch/m68k/include/pmap_motorola.h	Tue Dec  8 15:32:01 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.h,v 1.24 2009/12/06 06:41:30 tsutsui Exp $	*/
+/*	$NetBSD: pmap_motorola.h,v 1.25 2009/12/08 15:32:01 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -80,8 +80,6 @@
 #include 
 #include 
 
-#define M68K_SEG_SIZE	NBSEG
-
 /*
  * Pmap stuff
  */



  1   2   >