CVS commit: src/sys/modules/lua

2021-08-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Aug  8 22:26:32 UTC 2021

Modified Files:
src/sys/modules/lua: lua.c

Log Message:
Fix LIST operations, found by strictly-aligned CPUs, i.e., ARMv5 and IBM403:
- Initialize LIST_HEAD.
- Use LIST_FOREACH_SAFE() where necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/modules/lua/lua.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/modules/lua/lua.c
diff -u src/sys/modules/lua/lua.c:1.26 src/sys/modules/lua/lua.c:1.27
--- src/sys/modules/lua/lua.c:1.26	Sat Aug  7 04:19:31 2021
+++ src/sys/modules/lua/lua.c	Sun Aug  8 22:26:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.c,v 1.26 2021/08/07 04:19:31 rin Exp $ */
+/*	$NetBSD: lua.c,v 1.27 2021/08/08 22:26:32 rin Exp $ */
 
 /*
  * Copyright (c) 2011 - 2017 by Marc Balmer .
@@ -74,8 +74,10 @@ static bool	lua_bytecode_on = false;
 static int	lua_verbose;
 static int	lua_max_instr;
 
-static LIST_HEAD(, lua_state)	lua_states;
-static LIST_HEAD(, lua_module)	lua_modules;
+static LIST_HEAD(, lua_state)	lua_states =
+LIST_HEAD_INITIALIZER(lua_states);
+static LIST_HEAD(, lua_module)	lua_modules =
+LIST_HEAD_INITIALIZER(lua_modules);
 
 static int lua_match(device_t, cfdata_t, void *);
 static void lua_attach(device_t, device_t, void *);
@@ -723,7 +725,7 @@ kluaL_newstate(const char *name, const c
 void
 klua_close(klua_State *K)
 {
-	struct lua_state *s;
+	struct lua_state *s, *ns;
 	struct lua_softc *sc;
 	struct lua_module *m;
 	int error = 0;
@@ -747,7 +749,7 @@ klua_close(klua_State *K)
 	if (error)
 		return;		/* Nothing we can do... */
 
-	LIST_FOREACH(s, _states, lua_next)
+	LIST_FOREACH_SAFE(s, _states, lua_next, ns)
 		if (s->K == K) {
 			LIST_REMOVE(s, lua_next);
 			LIST_FOREACH(m, >lua_modules, mod_next)



CVS commit: src/sys/modules/lua

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug  7 04:19:31 UTC 2021

Modified Files:
src/sys/modules/lua: lua.c

Log Message:
Make sure that buffers allocated by lua_alloc() are aligned to 8-byte
boundaries as done by kmem_alloc(9).

Fix alignment faults on armv5te; GCC emits ldrd/strd instructions for
memory operands that are guaranteed to be aligned properly.

Drop unnecessary __packed attribute from alloc_header_t at the same time.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/modules/lua/lua.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/modules/lua/lua.c
diff -u src/sys/modules/lua/lua.c:1.25 src/sys/modules/lua/lua.c:1.26
--- src/sys/modules/lua/lua.c:1.25	Tue Jun 29 22:40:53 2021
+++ src/sys/modules/lua/lua.c	Sat Aug  7 04:19:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.c,v 1.25 2021/06/29 22:40:53 dholland Exp $ */
+/*	$NetBSD: lua.c,v 1.26 2021/08/07 04:19:31 rin Exp $ */
 
 /*
  * Copyright (c) 2011 - 2017 by Marc Balmer .
@@ -547,14 +547,18 @@ lua_require(lua_State *L)
 
 typedef struct {
 	size_t size;
-} __packed alloc_header_t;
+} alloc_header_t;
 
 static void *
 lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
 {
 	void *nptr = NULL;
 
-	const size_t hdr_size = sizeof(alloc_header_t);
+	/*
+	 * Make sure that buffers allocated by lua_alloc() are aligned to
+	 * 8-byte boundaries as done by kmem_alloc(9).
+	 */
+	const size_t hdr_size = roundup(sizeof(alloc_header_t), 8);
 	alloc_header_t *hdr = (alloc_header_t *) ((char *) ptr - hdr_size);
 
 	if (nsize == 0) { /* freeing */



CVS commit: src/sys/arch/arm/xscale

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  6 09:01:36 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_icu.c i80321var.h

Log Message:
Simplify i80321_intr_calculate_masks().

G/C unused members of struct intrq.

No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/xscale/i80321_icu.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/i80321var.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/arm/xscale/i80321_icu.c
diff -u src/sys/arch/arm/xscale/i80321_icu.c:1.26 src/sys/arch/arm/xscale/i80321_icu.c:1.27
--- src/sys/arch/arm/xscale/i80321_icu.c:1.26	Fri Nov 20 18:49:45 2020
+++ src/sys/arch/arm/xscale/i80321_icu.c	Fri Aug  6 09:01:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_icu.c,v 1.26 2020/11/20 18:49:45 thorpej Exp $	*/
+/*	$NetBSD: i80321_icu.c,v 1.27 2021/08/06 09:01:36 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.26 2020/11/20 18:49:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.27 2021/08/06 09:01:36 rin Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define	EVBARM_SPL_NOINLINE
@@ -166,26 +166,22 @@ i80321_intr_calculate_masks(void)
 	struct intrhand *ih;
 	int irq, ipl;
 
-	/* First, figure out which IPLs each IRQ has. */
+	/* Disable all IRQs. */
+	for (irq = 0; irq < NIRQ; irq++)
+		i80321_disable_irq(irq);
+
+	/* Figure out which IRQs are used by each IPL. */
+	for (ipl = 0; ipl < NIPL; ipl++)
+		i80321_imask[ipl] = 0;
 	for (irq = 0; irq < NIRQ; irq++) {
-		int levels = 0;
 		iq = [irq];
-		i80321_disable_irq(irq);
-		for (ih = TAILQ_FIRST(>iq_list); ih != NULL;
-		 ih = TAILQ_NEXT(ih, ih_list))
-			levels |= (1U << ih->ih_ipl);
-		iq->iq_levels = levels;
+		TAILQ_FOREACH(ih, >iq_list, ih_list)
+			i80321_imask[ih->ih_ipl] |= (1U << irq);
 	}
 
-	/* Next, figure out which IRQs are used by each IPL. */
-	for (ipl = 0; ipl < NIPL; ipl++) {
-		int irqs = 0;
-		for (irq = 0; irq < NIRQ; irq++) {
-			if (intrq[irq].iq_levels & (1U << ipl))
-irqs |= (1U << irq);
-		}
-		i80321_imask[ipl] = irqs;
-	}
+	/* All IPLs block everything blocked by any lower IPL. */
+	for (ipl = 1; ipl < NIPL; ipl++)
+		i80321_imask[ipl] |= i80321_imask[ipl - 1];
 
 	KASSERT(i80321_imask[IPL_NONE] == 0);
 	KASSERT(i80321_imask[IPL_SOFTCLOCK] == 0);
@@ -193,38 +189,11 @@ i80321_intr_calculate_masks(void)
 	KASSERT(i80321_imask[IPL_SOFTNET] == 0);
 	KASSERT(i80321_imask[IPL_SOFTSERIAL] == 0);
 
-	/*
-	 * Enforce a hierarchy that gives "slow" device (or devices with
-	 * limited input buffer space/"real-time" requirements) a better
-	 * chance at not dropping data.
-	 */
-
-#if 0
-	/*
-	 * This assert might be useful, but only after some interrupts
-	 * are configured.  As it stands now, it will always fire early
-	 * in the initialization phase.  If it's useful enough to re-
-	 * enable, it should be conditionalized on something else like
-	 * having at least something in the levels/irqs above.
-	 */
-	KASSERT(i80321_imask[IPL_VM] != 0);
-#endif
-	i80321_imask[IPL_SCHED] |= i80321_imask[IPL_VM];
-	i80321_imask[IPL_HIGH] |= i80321_imask[IPL_SCHED];
-
-	/*
-	 * Now compute which IRQs must be blocked when servicing any
-	 * given IRQ.
-	 */
+	/* Enable IRQs in use. */
 	for (irq = 0; irq < NIRQ; irq++) {
-		int irqs = (1U << irq);
 		iq = [irq];
-		if (TAILQ_FIRST(>iq_list) != NULL)
+		if (!TAILQ_EMPTY(>iq_list))
 			i80321_enable_irq(irq);
-		for (ih = TAILQ_FIRST(>iq_list); ih != NULL;
-		 ih = TAILQ_NEXT(ih, ih_list))
-			irqs |= i80321_imask[ih->ih_ipl];
-		iq->iq_mask = irqs;
 	}
 }
 

Index: src/sys/arch/arm/xscale/i80321var.h
diff -u src/sys/arch/arm/xscale/i80321var.h:1.13 src/sys/arch/arm/xscale/i80321var.h:1.14
--- src/sys/arch/arm/xscale/i80321var.h:1.13	Sun Feb 12 16:31:01 2012
+++ src/sys/arch/arm/xscale/i80321var.h	Fri Aug  6 09:01:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321var.h,v 1.13 2012/02/12 16:31:01 matt Exp $	*/
+/*	$NetBSD: i80321var.h,v 1.14 2021/08/06 09:01:36 rin Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -59,8 +59,6 @@ struct intrhand {
 struct intrq {
 	TAILQ_HEAD(, intrhand) iq_list;	/* handler list */
 	struct evcnt iq_ev;		/* event counter */
-	int iq_mask;			/* IRQs to mask while handling */
-	int iq_levels;			/* IPL_*'s this IRQ has */
 	int iq_ist;			/* share type */
 };
 



CVS commit: src/sys/arch/arm/xscale

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  6 08:58:42 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_intr.h

Log Message:
Do *NOT* lower IPL in i80321_splraise().

Fix various strange crashes for DIAGNOSTIC kernel on evbarm/HDL_G,
including one worked around by if_wm.c rev 1.706:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/if_wm.c#rev1.706


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/xscale/i80321_intr.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/arm/xscale/i80321_intr.h
diff -u src/sys/arch/arm/xscale/i80321_intr.h:1.12 src/sys/arch/arm/xscale/i80321_intr.h:1.13
--- src/sys/arch/arm/xscale/i80321_intr.h:1.12	Wed Jan 24 09:04:45 2018
+++ src/sys/arch/arm/xscale/i80321_intr.h	Fri Aug  6 08:58:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_intr.h,v 1.12 2018/01/24 09:04:45 skrll Exp $	*/
+/*	$NetBSD: i80321_intr.h,v 1.13 2021/08/06 08:58:42 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc.
@@ -95,10 +95,15 @@ static inline int __attribute__((__unuse
 i80321_splraise(int ipl)
 {
 	int old = curcpl();
-	set_curcpl(ipl);
 
-	/* Don't let the compiler re-order this code with subsequent code */
-	__insn_barrier();
+	if (ipl > old) {
+		set_curcpl(ipl);
+		/*
+		 * Don't let the compiler re-order this code with
+		 * subsequent code
+		 */
+		__insn_barrier();
+	}
 
 	return (old);
 }



CVS commit: src

2021-08-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug  3 09:25:44 UTC 2021

Modified Files:
src/doc: CHANGES
src/sys/arch/evbppc/dht: machdep.c
src/sys/arch/evbppc/evbppc: evbppc_machdep.c
src/sys/arch/evbppc/explora: machdep.c
src/sys/arch/evbppc/include: cpu.h
src/sys/arch/evbppc/obs405: obs200_machdep.c obs266_machdep.c
obs600_machdep.c
src/sys/arch/evbppc/virtex: machdep.c
src/sys/arch/evbppc/walnut: machdep.c
src/sys/modules/arch: archdirs.mk
Removed Files:
src/sys/modules/arch/powerpc/powerpc-ibm4xx: Makefile
bsd.powerpc-ibm4xx.mk

Log Message:
Switch evbppc/ibm4xx to generic evbppc (same as oea) kernel modules.

I've confirmed that kernels similar to amd64/conf/MODULAR work fine
both on 403 and 405.

XXX
Unfortunately, we cannot immediately switch evbppc/booke to generic
kernel modules yet; it has its own intr.h implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.2816 -r1.2817 src/doc/CHANGES
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbppc/dht/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbppc/evbppc/evbppc_machdep.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbppc/explora/machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbppc/include/cpu.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbppc/obs405/obs200_machdep.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbppc/obs405/obs266_machdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbppc/obs405/obs600_machdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbppc/virtex/machdep.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/evbppc/walnut/machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/modules/arch/archdirs.mk
cvs rdiff -u -r1.1 -r0 src/sys/modules/arch/powerpc/powerpc-ibm4xx/Makefile \
src/sys/modules/arch/powerpc/powerpc-ibm4xx/bsd.powerpc-ibm4xx.mk

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2816 src/doc/CHANGES:1.2817
--- src/doc/CHANGES:1.2816	Tue Jul 27 12:40:07 2021
+++ src/doc/CHANGES	Tue Aug  3 09:25:43 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2816 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2817 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -389,3 +389,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		[tsutsui 20210709]
 	kernel: Tie the maximum file lock per unprivilegied uid to 
 		kern.maxfiles [manu 20210727]
+	evbppc: Switch ibm4xx to generic evbppc kernel modules. [rin 20210803]

Index: src/sys/arch/evbppc/dht/machdep.c
diff -u src/sys/arch/evbppc/dht/machdep.c:1.1 src/sys/arch/evbppc/dht/machdep.c:1.2
--- src/sys/arch/evbppc/dht/machdep.c:1.1	Fri Apr  2 07:00:33 2021
+++ src/sys/arch/evbppc/dht/machdep.c	Tue Aug  3 09:25:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.1 2021/04/02 07:00:33 rin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.2 2021/08/03 09:25:43 rin Exp $	*/
 
 /*
  * Taken from src/sys/arch/evbppc/walnut/machdep.c:
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2021/04/02 07:00:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2021/08/03 09:25:43 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pci.h"
@@ -188,9 +188,6 @@ initppc(vaddr_t startkernel, vaddr_t end
 	if (boothowto & RB_KDB)
 		Debugger();
 #endif
-
-	/* Look for the ibm4xx modules in the right place */
-	module_machine = module_machine_ibm4xx;
 }
 
 void

Index: src/sys/arch/evbppc/evbppc/evbppc_machdep.c
diff -u src/sys/arch/evbppc/evbppc/evbppc_machdep.c:1.14 src/sys/arch/evbppc/evbppc/evbppc_machdep.c:1.15
--- src/sys/arch/evbppc/evbppc/evbppc_machdep.c:1.14	Tue Mar 30 02:41:14 2021
+++ src/sys/arch/evbppc/evbppc/evbppc_machdep.c	Tue Aug  3 09:25:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: evbppc_machdep.c,v 1.14 2021/03/30 02:41:14 rin Exp $	*/
+/*	$NetBSD: evbppc_machdep.c,v 1.15 2021/08/03 09:25:43 rin Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: evbppc_machdep.c,v 1.14 2021/03/30 02:41:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evbppc_machdep.c,v 1.15 2021/08/03 09:25:43 rin Exp $");
 
 #include 
 #include 
@@ -91,11 +91,6 @@ struct vm_map *phys_map = NULL;
 char machine[] = MACHINE;
 char machine_arch[] = MACHINE_ARCH;
 
-/*
- * ibm4xx kernels need to set module_machine to this for modules to work.
- */
-char module_machine_ibm4xx[] = "powerpc-ibm4xx";
-
 int fake_mapiodev = 1;
 
 /*

Index: src/sys/arch/evbppc/explora/machdep.c
diff -u src/sys/arch/evbppc/explora/machdep.c:1.51 src/sys/arch/evbppc/explora/machdep.c:1.52
--- src/sys/arch/evbppc/explora/machdep.c:1.51	Tue Mar 30 03:20:13 2021
+++ src/sys/arch/evbppc/explora/machdep.c	Tue Aug  3 09:25:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.51 2021/03/30 03:20:13 rin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.52 2021/08/03 09:25:43 rin Exp $	*/
 
 

CVS commit: src

2021-07-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 26 12:49:13 UTC 2021

Modified Files:
src/lib/libc/arch/powerpc/string: Makefile.inc
src/sys/lib/libkern/arch/powerpc: Makefile.inc

Log Message:
Improve previous:

- Add suffix ``d'' for mkdep(1).
- Improve comment a little...


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/arch/powerpc/string/Makefile.inc
cvs rdiff -u -r1.32 -r1.33 src/sys/lib/libkern/arch/powerpc/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/lib/libc/arch/powerpc/string/Makefile.inc
diff -u src/lib/libc/arch/powerpc/string/Makefile.inc:1.14 src/lib/libc/arch/powerpc/string/Makefile.inc:1.15
--- src/lib/libc/arch/powerpc/string/Makefile.inc:1.14	Sat Jul 24 05:27:25 2021
+++ src/lib/libc/arch/powerpc/string/Makefile.inc	Mon Jul 26 12:49:13 2021
@@ -1,14 +1,13 @@
-#	$NetBSD: Makefile.inc,v 1.14 2021/07/24 05:27:25 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2021/07/26 12:49:13 rin Exp $
 
 SRCS+=  bzero.S ffs.S strlen.S
 NO_SRCS+= memset.S
 
-# disable the asm versions of these because they break the explora.
-# the special rules here are to override the suffix rules which seem
-# to prefer .S files over .c
+# XXX
+# Disable asm versions that use unaligned memory access and thus break 403.
 .if ${MACHINE} == "evbppc"
 .  for name in bcopy memcmp memcpy memmove
-.for suffix in o po pico go
+.for suffix in o po pico go d
 ${name}.${suffix}: ${name}.c
 .endfor
 .  endfor

Index: src/sys/lib/libkern/arch/powerpc/Makefile.inc
diff -u src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.32 src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.33
--- src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.32	Sat Jul 24 05:29:26 2021
+++ src/sys/lib/libkern/arch/powerpc/Makefile.inc	Mon Jul 26 12:49:13 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.32 2021/07/24 05:29:26 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.33 2021/07/26 12:49:13 rin Exp $
 
 SRCS+=	bswap16.c bswap32.c
 SRCS+=	htonl.c htons.c ntohl.c ntohs.c
@@ -7,10 +7,11 @@ SRCS+=	syncicache.c
 SRCS+=	ffs.S memset.S strlen.S
 SRCS+=	gprsavrest.S
 
-# Disable the asm versions on evbppc because they break the Explora
+# XXX
+# Disable asm versions that use unaligned memory access and thus break 403.
 .if ${MACHINE} == "evbppc"
 .  for name in memcmp memcpy memmove
-.for suffix in o po pico go
+.for suffix in o po pico go d
 ${name}.${suffix}: ${name}.c
 .endfor
 .  endfor



CVS commit: src/tests/lib/libc/sys

2021-07-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul 24 08:39:54 UTC 2021

Modified Files:
src/tests/lib/libc/sys: t_ptrace_core_wait.h

Log Message:
For sh3, increment PC when PT_CONTINUE from trigger_trap(), as already
done for aarch64, arm, and powerpc. Otherwise, child is trapped to the
PTRACE_BREAKPOINT_ASM (== trapa) instruction indefinitely.

Fix tests/lib/libc/sys/t_ptrace_wait*:core_dump_procinfo.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_ptrace_core_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_core_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_core_wait.h:1.3 src/tests/lib/libc/sys/t_ptrace_core_wait.h:1.4
--- src/tests/lib/libc/sys/t_ptrace_core_wait.h:1.3	Thu Oct 15 22:59:50 2020
+++ src/tests/lib/libc/sys/t_ptrace_core_wait.h	Sat Jul 24 08:39:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_core_wait.h,v 1.3 2020/10/15 22:59:50 rin Exp $	*/
+/*	$NetBSD: t_ptrace_core_wait.h,v 1.4 2021/07/24 08:39:54 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc.
@@ -208,7 +208,8 @@ ATF_TC_BODY(core_dump_procinfo, tc)
 	DPRINTF("Before resuming the child process where it left off and "
 	"without signal to be sent\n");
 
-#if defined(__aarch64__) || defined(__arm__) || defined(__powerpc__)
+#if defined(__aarch64__) || defined(__arm__) || defined(__powerpc__) || \
+defined(__sh3__)
 	/*
 	 * For these archs, program counter is not automatically incremented
 	 * by a trap instruction. We cannot increment PC in the trap handler,
@@ -220,12 +221,7 @@ ATF_TC_BODY(core_dump_procinfo, tc)
 
 	SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, , 0) != -1);
 	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child,
-#  if defined(__aarch64__) || defined(__arm__)
-	(void *)(r.r_pc + PTRACE_BREAKPOINT_SIZE),
-#  elif defined(__powerpc__)
-	(void *)(r.pc + PTRACE_BREAKPOINT_SIZE),
-#  endif
-	0) != -1);
+	(void *)(PTRACE_REG_PC() + PTRACE_BREAKPOINT_SIZE), 0) != -1);
 #else
 	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
 #endif



CVS commit: src/sys/lib/libkern/arch/powerpc

2021-07-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul 24 05:29:26 UTC 2021

Modified Files:
src/sys/lib/libkern/arch/powerpc: Makefile.inc

Log Message:
For evbppc, use C version of memcpy(3), memcmp(3), and memmove(3)
consistently for *.{po,pico,go} (for RUMP), in order to avoid
alignment faults for 403.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libkern/arch/powerpc/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/lib/libkern/arch/powerpc/Makefile.inc
diff -u src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.31 src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.32
--- src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.31	Sat Jul  2 03:35:03 2011
+++ src/sys/lib/libkern/arch/powerpc/Makefile.inc	Sat Jul 24 05:29:26 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.31 2011/07/02 03:35:03 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.32 2021/07/24 05:29:26 rin Exp $
 
 SRCS+=	bswap16.c bswap32.c
 SRCS+=	htonl.c htons.c ntohl.c ntohs.c
@@ -9,7 +9,9 @@ SRCS+=	gprsavrest.S
 
 # Disable the asm versions on evbppc because they break the Explora
 .if ${MACHINE} == "evbppc"
-memcpy.o: memcpy.c
-memcmp.o: memcmp.c
-memmove.o: memmove.c
+.  for name in memcmp memcpy memmove
+.for suffix in o po pico go
+${name}.${suffix}: ${name}.c
+.endfor
+.  endfor
 .endif



CVS commit: src/lib/libc/arch/powerpc/string

2021-07-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul 24 05:27:26 UTC 2021

Modified Files:
src/lib/libc/arch/powerpc/string: Makefile.inc

Log Message:
For evbppc, use C version of bcopy(3), memcpy(3), memcmp(3), and
memmove(3) consistently for debug library (*.go) in order to avoid
alignment faults for 403.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/arch/powerpc/string/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/lib/libc/arch/powerpc/string/Makefile.inc
diff -u src/lib/libc/arch/powerpc/string/Makefile.inc:1.13 src/lib/libc/arch/powerpc/string/Makefile.inc:1.14
--- src/lib/libc/arch/powerpc/string/Makefile.inc:1.13	Sun Mar 14 00:26:10 2010
+++ src/lib/libc/arch/powerpc/string/Makefile.inc	Sat Jul 24 05:27:25 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.13 2010/03/14 00:26:10 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2021/07/24 05:27:25 rin Exp $
 
 SRCS+=  bzero.S ffs.S strlen.S
 NO_SRCS+= memset.S
@@ -7,18 +7,11 @@ NO_SRCS+= memset.S
 # the special rules here are to override the suffix rules which seem
 # to prefer .S files over .c
 .if ${MACHINE} == "evbppc"
-bcopy.o: bcopy.c
-bcopy.po: bcopy.c
-bcopy.pico: bcopy.c
-memcpy.o: memcpy.c
-memcpy.po: memcpy.c
-memcpy.pico: memcpy.c
-memcmp.o: memcmp.c
-memcmp.po: memcmp.c
-memcmp.pico: memcmp.c
-memmove.o: memmove.c
-memmove.po: memmove.c
-memmove.pico: memmove.c
+.  for name in bcopy memcmp memcpy memmove
+.for suffix in o po pico go
+${name}.${suffix}: ${name}.c
+.endfor
+.  endfor
 .else
 SRCS+=	memcmp.S bcopy.S memcpy.S memmove.S
 .endif



CVS commit: src/doc

2021-07-18 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 19 01:34:03 UTC 2021

Modified Files:
src/doc: 3RDPARTY

Log Message:
binutils 2.37 has been released.


To generate a diff of this commit:
cvs rdiff -u -r1.1807 -r1.1808 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1807 src/doc/3RDPARTY:1.1808
--- src/doc/3RDPARTY:1.1807	Sun Jul 11 21:28:17 2021
+++ src/doc/3RDPARTY	Mon Jul 19 01:34:03 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1807 2021/07/11 21:28:17 mrg Exp $
+#	$NetBSD: 3RDPARTY,v 1.1808 2021/07/19 01:34:03 rin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -498,11 +498,11 @@ When updating GDB, it is imperative to t
 
 Package:	binutils
 Version:	2.34
-Current Vers:	2.36.1
+Current Vers:	2.37
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/binutils/
 Home Page:	http://www.gnu.org/software/binutils/
-Date:		2021-03-15
+Date:		2021-07-19
 Mailing List:	bug-gnu-ut...@gnu.org
 Responsible:	thorpej, mrg
 License:	GPLv3, LGPLv3, GPLv2, LGPLv2, BSD



CVS commit: src/doc

2021-07-16 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jul 16 10:02:50 UTC 2021

Modified Files:
src/doc: HACKS

Log Message:
PR port-sh3/56311

Correct misinterpretation for the cause of the problem, and link to
the bug report for upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.223 src/doc/HACKS:1.224
--- src/doc/HACKS:1.223	Thu Jul 15 08:02:47 2021
+++ src/doc/HACKS	Fri Jul 16 10:02:50 2021
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.223 2021/07/15 08:02:47 rin Exp $
+# $NetBSD: HACKS,v 1.224 2021/07/16 10:02:50 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -1001,9 +1001,12 @@ kcah
 port	sh3
 hack	compile lint1/initdecl() with -O0 for sh3 (port-sh3/56311)
 cdate	Thu Jul 15 07:58:05 UTC 2021
+mdate	Fri Jul 16 10:00:00 UTC 2021
 who	rin
 file	src/usr.bin/xlint/lint1/decl.c: 1.200
-descr	GCC 9 and 10 miscompile initdecl() due to improper use of scratch
-	register, as described in the PR. Compiling this function with -O0
-	works around the problem.
+descr	GCC 9 and 10 miscompile initdecl() due to mischoice of register,
+	as described in the PR. Compiling this function with -O0 works
+	around the problem.
+	The problem has been reported to upstream as GCC Bug 101469:
+	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101469
 kcah



CVS commit: src/doc

2021-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jul 15 08:02:47 UTC 2021

Modified Files:
src/doc: HACKS

Log Message:
PR port-sh3/56311

Document -O0 workaround for initdecl() in doc/HACKS.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.222 src/doc/HACKS:1.223
--- src/doc/HACKS:1.222	Tue Jul  6 12:42:12 2021
+++ src/doc/HACKS	Thu Jul 15 08:02:47 2021
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.222 2021/07/06 12:42:12 thorpej Exp $
+# $NetBSD: HACKS,v 1.223 2021/07/15 08:02:47 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -997,3 +997,13 @@ port	sh3
 
 		https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101177
 kcah
+
+port	sh3
+hack	compile lint1/initdecl() with -O0 for sh3 (port-sh3/56311)
+cdate	Thu Jul 15 07:58:05 UTC 2021
+who	rin
+file	src/usr.bin/xlint/lint1/decl.c: 1.200
+descr	GCC 9 and 10 miscompile initdecl() due to improper use of scratch
+	register, as described in the PR. Compiling this function with -O0
+	works around the problem.
+kcah



CVS commit: src/usr.bin/xlint/lint1

2021-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jul 15 07:58:05 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
PR port-sh3/56311

As a workaround for GCC bug, compile initdecl() with -O0 for sh3.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/decl.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.199 src/usr.bin/xlint/lint1/decl.c:1.200
--- src/usr.bin/xlint/lint1/decl.c:1.199	Tue Jul 13 22:01:34 2021
+++ src/usr.bin/xlint/lint1/decl.c	Thu Jul 15 07:58:05 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.199 2021/07/13 22:01:34 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.199 2021/07/13 22:01:34 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $");
 #endif
 
 #include 
@@ -86,6 +86,10 @@ static	void	check_global_variable_size(c
  * initializes all global vars used in declarations
  */
 void
+#ifdef __sh3__
+/* XXX port-sh3/56311 */
+__attribute__((optimize("O0")))
+#endif
 initdecl(void)
 {
 	int i;



CVS commit: src/sys/arch/landisk/dev

2021-07-14 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jul 15 05:07:50 UTC 2021

Modified Files:
src/sys/arch/landisk/dev: btn_obio.c button.c buttonvar.h

Log Message:
Migrate btn_init() from btnopen() (with RUN_ONCE) to btn_obio_attach().

Fix uninitialized use of btn_event_list_lock in btn_event_register().

Found by LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/landisk/dev/btn_obio.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/landisk/dev/button.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/landisk/dev/buttonvar.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/landisk/dev/btn_obio.c
diff -u src/sys/arch/landisk/dev/btn_obio.c:1.6 src/sys/arch/landisk/dev/btn_obio.c:1.7
--- src/sys/arch/landisk/dev/btn_obio.c:1.6	Sat Jan 21 19:44:29 2012
+++ src/sys/arch/landisk/dev/btn_obio.c	Thu Jul 15 05:07:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: btn_obio.c,v 1.6 2012/01/21 19:44:29 nonaka Exp $	*/
+/*	$NetBSD: btn_obio.c,v 1.7 2021/07/15 05:07:50 rin Exp $	*/
 
 /*-
  * Copyright (C) 2005 NONAKA Kimihiro 
@@ -28,7 +28,7 @@
 #include "pwrsw_obio.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: btn_obio.c,v 1.6 2012/01/21 19:44:29 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btn_obio.c,v 1.7 2021/07/15 05:07:50 rin Exp $");
 
 #include 
 #include 
@@ -141,6 +141,7 @@ btn_obio_attach(device_t parent, device_
 	}
 	sc->sc_mask |= BTN_RESET_BIT;
 
+	btn_init();
 	for (i = 0; i < NBUTTON; i++) {
 		int idx = btnlist[i].idx;
 		sc->sc_bev[idx].bev_name = btnlist[i].name;

Index: src/sys/arch/landisk/dev/button.c
diff -u src/sys/arch/landisk/dev/button.c:1.10 src/sys/arch/landisk/dev/button.c:1.11
--- src/sys/arch/landisk/dev/button.c:1.10	Sat Dec 19 21:25:03 2020
+++ src/sys/arch/landisk/dev/button.c	Thu Jul 15 05:07:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: button.c,v 1.10 2020/12/19 21:25:03 thorpej Exp $	*/
+/*	$NetBSD: button.c,v 1.11 2021/07/15 05:07:50 rin Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.10 2020/12/19 21:25:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.11 2021/07/15 05:07:50 rin Exp $");
 
 #include 
 #include 
@@ -59,7 +59,6 @@ __KERNEL_RCSID(0, "$NetBSD: button.c,v 1
 /*
  * event handler
  */
-static ONCE_DECL(btn_once);
 static LIST_HEAD(, btn_event) btn_event_list;
 static kmutex_t btn_event_list_lock;
 
@@ -105,7 +104,7 @@ const struct cdevsw button_cdevsw = {
 	.d_flag = 0
 };
 
-static int
+int
 btn_init(void)
 {
 
@@ -161,11 +160,6 @@ btnopen(dev_t dev, int flag, int mode, s
 {
 	int error;
 
-	error = RUN_ONCE(_once, btn_init);
-	if (error) {
-		return error;
-	}
-
 	if (minor(dev) != 0) {
 		return (ENODEV);
 	}

Index: src/sys/arch/landisk/dev/buttonvar.h
diff -u src/sys/arch/landisk/dev/buttonvar.h:1.1 src/sys/arch/landisk/dev/buttonvar.h:1.2
--- src/sys/arch/landisk/dev/buttonvar.h:1.1	Fri Sep  1 21:26:18 2006
+++ src/sys/arch/landisk/dev/buttonvar.h	Thu Jul 15 05:07:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: buttonvar.h,v 1.1 2006/09/01 21:26:18 uwe Exp $	*/
+/*	$NetBSD: buttonvar.h,v 1.2 2021/07/15 05:07:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -45,6 +45,8 @@ struct btn_event {
 	LIST_ENTRY(btn_event) bev_list;
 };
 
+int	btn_init(void);
+
 void	btn_settype(const char *type);
 
 int	btn_event_register(struct btn_event *bev);



CVS commit: src/sys/arch/sh3/sh3

2021-07-14 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jul 15 04:58:33 UTC 2021

Modified Files:
src/sys/arch/sh3/sh3: locore_subr.S

Log Message:
For cpu_switchto(), inherit PSL_IMASK field of SR between lwp's.

Otherwise, IPL is lost during context switch, which allows improper
interrupts when, e.g., spin mutexes are hold.

With this fix, full ATF is successfully completed on DIAGNOSTIC
kernel (with one KASSERT in uvm_map.c, which triggers kern/51254,
converted to printf).

Thanks uwe@ for review and suggesting optimization.

Also thanks ad@ for useful comment, and ryo@ for giving me reference
manuals of SH-4!


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/sh3/sh3/locore_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/sh3/sh3/locore_subr.S
diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.60 src/sys/arch/sh3/sh3/locore_subr.S:1.61
--- src/sys/arch/sh3/sh3/locore_subr.S:1.60	Mon Aug  3 16:43:44 2020
+++ src/sys/arch/sh3/sh3/locore_subr.S	Thu Jul 15 04:58:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_subr.S,v 1.60 2020/08/03 16:43:44 uwe Exp $	*/
+/*	$NetBSD: locore_subr.S,v 1.61 2021/07/15 04:58:33 rin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #include 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.60 2020/08/03 16:43:44 uwe Exp $")
+__KERNEL_RCSID(0, "$NetBSD: locore_subr.S,v 1.61 2021/07/15 04:58:33 rin Exp $")
 
 
 /*
@@ -140,7 +140,22 @@ ENTRY(cpu_switchto)
 	mov	r10, r1		! >l_md.md_pcb->pcb_sf
 	mov	r9, r0		! return olwp (we are about to clobber r9)
 	ldc.l	@r1+, gbr
-	ldc.l	@r1+, sr
+
+	/*
+	 * We cannot simply pop SR here; PSL_IMASK field should be
+	 * inherited to nlwp. Otherwise, IPL is lost during context
+	 * switch, which allows improper interrupts when, e.g.,
+	 * spin mutexes are hold.
+	 */
+	mov.l	@r1+, r8	! r8  = new SR
+	mov	#0x78, r9
+	shll	r9		! r9  =  PSL_IMASK
+	not	r9, r10		! r10 = ~PSL_IMASK
+	and	r9, r11		! r11 = old SR & PSL_IMASK
+	and	r10, r8
+	or	r11, r8
+	ldc	r8, sr
+
 	lds.l	@r1+, pr
 	mov.l	@r1+, r8
 	mov.l	@r1+, r9



CVS commit: src/lib/libc/arch/arm

2021-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 30 00:00:49 UTC 2021

Modified Files:
src/lib/libc/arch/arm/gen: swapcontext.S
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
Fix previous. For Thumb-1:
- sp cannot be manipulated directly
- {add,sub}s should be used instead of {add,sub}


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/arch/arm/gen/swapcontext.S
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/arm/sys/__clone.S

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

Modified files:

Index: src/lib/libc/arch/arm/gen/swapcontext.S
diff -u src/lib/libc/arch/arm/gen/swapcontext.S:1.16 src/lib/libc/arch/arm/gen/swapcontext.S:1.17
--- src/lib/libc/arch/arm/gen/swapcontext.S:1.16	Tue Jun 29 23:29:12 2021
+++ src/lib/libc/arch/arm/gen/swapcontext.S	Wed Jun 30 00:00:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $	*/
+/*	$NetBSD: swapcontext.S,v 1.17 2021/06/30 00:00:49 rin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-RCSID("$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $")
+RCSID("$NetBSD: swapcontext.S,v 1.17 2021/06/30 00:00:49 rin Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 ENTRY(swapcontext)
@@ -85,9 +85,13 @@ ENTRY(swapcontext)
 	b	PLT_SYM(_C_LABEL(setcontext))
 #else
 	push	{lr}
-	sub	sp, #4
+	mov	r1, sp
+	subs	r1, #4
+	mov	sp, r1
 	bl	PLT_SYM(_C_LABEL(setcontext))
-	add	sp, #4
+	mov	r1, sp
+	adds	r1, #4
+	mov	sp, r1
 	pop	{pc}
 #endif
 #if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)

Index: src/lib/libc/arch/arm/sys/__clone.S
diff -u src/lib/libc/arch/arm/sys/__clone.S:1.10 src/lib/libc/arch/arm/sys/__clone.S:1.11
--- src/lib/libc/arch/arm/sys/__clone.S:1.10	Tue Jun 29 23:29:12 2021
+++ src/lib/libc/arch/arm/sys/__clone.S	Wed Jun 30 00:00:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.10 2021/06/29 23:29:12 rin Exp $ */
+/* $NetBSD: __clone.S,v 1.11 2021/06/30 00:00:49 rin Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher Gilbert
@@ -122,9 +122,13 @@ ENTRY(__clone)
 #else
 .Lcerror:
 	push	{lr}
-	sub	sp, #4
+	mov	r1, sp
+	subs	r1, #4
+	mov	sp, r1
 	bl	CERROR
-	add	sp, #4
+	mov	r1, sp
+	adds	r1, #4
+	mov	sp, r1
 	pop	{pc}
 #endif
 END(__clone)



CVS commit: src/lib/libc/arch/arm

2021-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 29 23:29:12 UTC 2021

Modified Files:
src/lib/libc/arch/arm/gen: swapcontext.S
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
Align sp to 8-byte boundary as required by EABI.

IIUC, this change only affects libc compiled for ``Thumb-mode userland'',
which we've not officially supported yet.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/arch/arm/gen/swapcontext.S
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/arm/sys/__clone.S

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

Modified files:

Index: src/lib/libc/arch/arm/gen/swapcontext.S
diff -u src/lib/libc/arch/arm/gen/swapcontext.S:1.15 src/lib/libc/arch/arm/gen/swapcontext.S:1.16
--- src/lib/libc/arch/arm/gen/swapcontext.S:1.15	Wed Nov 21 21:01:41 2018
+++ src/lib/libc/arch/arm/gen/swapcontext.S	Tue Jun 29 23:29:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.15 2018/11/21 21:01:41 skrll Exp $	*/
+/*	$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-RCSID("$NetBSD: swapcontext.S,v 1.15 2018/11/21 21:01:41 skrll Exp $")
+RCSID("$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 ENTRY(swapcontext)
@@ -85,7 +85,9 @@ ENTRY(swapcontext)
 	b	PLT_SYM(_C_LABEL(setcontext))
 #else
 	push	{lr}
+	sub	sp, #4
 	bl	PLT_SYM(_C_LABEL(setcontext))
+	add	sp, #4
 	pop	{pc}
 #endif
 #if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)

Index: src/lib/libc/arch/arm/sys/__clone.S
diff -u src/lib/libc/arch/arm/sys/__clone.S:1.9 src/lib/libc/arch/arm/sys/__clone.S:1.10
--- src/lib/libc/arch/arm/sys/__clone.S:1.9	Sat Nov 30 20:20:42 2013
+++ src/lib/libc/arch/arm/sys/__clone.S	Tue Jun 29 23:29:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.9 2013/11/30 20:20:42 joerg Exp $ */
+/* $NetBSD: __clone.S,v 1.10 2021/06/29 23:29:12 rin Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher Gilbert
@@ -122,7 +122,9 @@ ENTRY(__clone)
 #else
 .Lcerror:
 	push	{lr}
+	sub	sp, #4
 	bl	CERROR
+	add	sp, #4
 	pop	{pc}
 #endif
 END(__clone)



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm

2021-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 29 23:26:00 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm: aeabi_cfcmp.S
divmodsi4.S divsi3.S modsi3.S

Log Message:
Align sp to 8-byte boundary as required by EABI.

This is especially important for non-leaf functions; GCC optimizes codes
based on assumption that sp is aligned properly.

Mostly fix broken earmv5 userland compiled by GCC10 due to alignment
faults in ld.elf_so, where {ld,st}rd are used for [sp, #8x].

No regression for ATF is observed for earmv[67]{,hf}{,eb}.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.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/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.1.1.1 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.1.1.1	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S	Tue Jun 29 23:26:00 2021
@@ -28,8 +28,10 @@
 .p2align 2
 DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmpeq)
 push {r0-r3, lr}
+sub sp, #4
 bl __aeabi_cfcmpeq_check_nan
 cmp r0, #1
+add sp, #4
 pop {r0-r3, lr}
 
 // NaN has been ruled out, so __aeabi_cfcmple can't trap
@@ -56,13 +58,16 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmp
 // Per the RTABI, this function must preserve r0-r11.
 // Save lr in the same instruction for compactness
 push {r0-r3, lr}
+sub sp, #4
 
 bl __aeabi_fcmplt
 cmp r0, #1
 moveq ip, #0
 beq 1f
 
+add sp, #4
 ldm sp, {r0-r3}
+sub sp, #4
 bl __aeabi_fcmpeq
 cmp r0, #1
 moveq ip, #(APSR_C | APSR_Z)
@@ -70,6 +75,7 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmp
 
 1:
 msr CPSR_f, ip
+add sp, #4
 pop {r0-r3}
 POP_PC()
 END_COMPILERRT_FUNCTION(__aeabi_cfcmple)

Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.1.1.4	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S	Tue Jun 29 23:26:00 2021
@@ -17,8 +17,10 @@
 
 #define ESTABLISH_FRAME\
 push   {r4-r7, lr}   ;\
-add r7, sp, #12
+add r7, sp, #12   ;\
+sub sp, #4
 #define CLEAR_FRAME_AND_RETURN \
+add sp, #4   ;\
 pop{r4-r7, pc}
 
 	.syntax unified
Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.1.1.4	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S	Tue Jun 29 23:26:00 2021
@@ -16,8 +16,10 @@
 
 #define ESTABLISH_FRAME \
 push   {r4, r7, lr};\
-add r7, sp, #4
+add r7, sp, #4   ;\
+sub sp, #4
 #define CLEAR_FRAME_AND_RETURN \
+add sp, #4   ;\
 pop{r4, r7, pc}
 
 	.syntax unified
Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.1.1.4	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S	Tue Jun 29 23:26:00 2021
@@ -16,8 +16,10 @@
 
 #define ESTABLISH_FRAME \
 push   {r4, r7, lr};\
-add r7, sp, #4
+add r7, sp, #4   ;\
+sub sp, #4
 #define CLEAR_FRAME_AND_RETURN \
+add sp, #4   ;\
 pop{r4, r7, pc}
 
 	.syntax unified



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

2021-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 29 11:35:28 UTC 2021

Modified Files:
src/sys/arch/evbarm/conf: std.hdl_g

Log Message:
KERNEL_BASE is 0xc000 for HDL_G.

With this change, HDL-G boots multiuser!


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/std.hdl_g

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/evbarm/conf/std.hdl_g
diff -u src/sys/arch/evbarm/conf/std.hdl_g:1.7 src/sys/arch/evbarm/conf/std.hdl_g:1.8
--- src/sys/arch/evbarm/conf/std.hdl_g:1.7	Sun Oct  7 07:48:44 2018
+++ src/sys/arch/evbarm/conf/std.hdl_g	Tue Jun 29 11:35:28 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.hdl_g,v 1.7 2018/10/07 07:48:44 skrll Exp $
+#	$NetBSD: std.hdl_g,v 1.8 2021/06/29 11:35:28 rin Exp $
 #
 # standard NetBSD/evbarm for I-O DATA HDL-G options
 
@@ -15,3 +15,5 @@ options 	ARM_INTR_IMPL="

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

2021-06-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun 26 09:13:00 UTC 2021

Modified Files:
src/sys/arch/evbarm/conf: README.evbarm

Log Message:
ARMADILLO-IOT-G3 kernel was gone; it is now supported by GENERIC.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/evbarm/conf/README.evbarm

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/evbarm/conf/README.evbarm
diff -u src/sys/arch/evbarm/conf/README.evbarm:1.32 src/sys/arch/evbarm/conf/README.evbarm:1.33
--- src/sys/arch/evbarm/conf/README.evbarm:1.32	Thu Nov  5 13:04:05 2020
+++ src/sys/arch/evbarm/conf/README.evbarm	Sat Jun 26 09:13:00 2021
@@ -1,10 +1,9 @@
-$NetBSD: README.evbarm,v 1.32 2020/11/05 13:04:05 rin Exp $
+$NetBSD: README.evbarm,v 1.33 2021/06/26 09:13:00 rin Exp $
 
 config		date		boards
 ---
 ADI_BRH		2003/01/25	ADI Eng. Big Read Head i80200 eval board
 ARMADAXP	2013/05/29	Marvell Armada XP development board
-ARMADILLO-IOT-G3 2016/05/17	Atmark Techno Armadillo-IoT G3 boards
 ARMADILLO210	2006/02/06	Atmark Techno Armadillo-210
 ARMADILLO9	2005/11/13	Atmark Techno Armadillo-9
 BCM5301X	2012/08/31	Broadcom BCM95301X evaluation/reference board



CVS commit: src/sys/arch

2021-06-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun 26 09:11:31 UTC 2021

Modified Files:
src/sys/arch/hpcarm/conf: std.hpcarm
src/sys/arch/hpcmips/conf: std.hpcmips

Log Message:
Set VMSWAP_DEFAULT_PLAINTEXT for hpcarm and hpcmips, that suffer from
slow CPU as well as memory shortage.

For hpcsh, this option is already enabled by std.sh3.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hpcarm/conf/std.hpcarm
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hpcmips/conf/std.hpcmips

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/hpcarm/conf/std.hpcarm
diff -u src/sys/arch/hpcarm/conf/std.hpcarm:1.8 src/sys/arch/hpcarm/conf/std.hpcarm:1.9
--- src/sys/arch/hpcarm/conf/std.hpcarm:1.8	Sun Jan 27 12:37:12 2008
+++ src/sys/arch/hpcarm/conf/std.hpcarm	Sat Jun 26 09:11:31 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.hpcarm,v 1.8 2008/01/27 12:37:12 chris Exp $
+#	$NetBSD: std.hpcarm,v 1.9 2021/06/26 09:11:31 rin Exp $
 #
 # standard NetBSD/hpcarm options
 
@@ -12,3 +12,6 @@ options 	EXEC_SCRIPT
 
 # To support easy transit to ../arch/arm/arm32
 options 	ARM32
+
+options 	VMSWAP_DEFAULT_PLAINTEXT	# do not encrypt swap by
+		# default (slow cpu)

Index: src/sys/arch/hpcmips/conf/std.hpcmips
diff -u src/sys/arch/hpcmips/conf/std.hpcmips:1.20 src/sys/arch/hpcmips/conf/std.hpcmips:1.21
--- src/sys/arch/hpcmips/conf/std.hpcmips:1.20	Sun Feb 20 07:58:13 2011
+++ src/sys/arch/hpcmips/conf/std.hpcmips	Sat Jun 26 09:11:31 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.hpcmips,v 1.20 2011/02/20 07:58:13 matt Exp $
+#	$NetBSD: std.hpcmips,v 1.21 2021/06/26 09:11:31 rin Exp $
 # standard, required hpcmips info
 
 machine hpcmips mips
@@ -17,3 +17,6 @@ options 	EXEC_SCRIPT		# may be unsafe
 
 makeoptions	DEFTEXTADDR="0x80001000"
 makeoptions	DEFCOPTS="-Os -mmemcpy"
+
+options 	VMSWAP_DEFAULT_PLAINTEXT	# do not encrypt swap by
+		# default (slow cpu)



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

2021-06-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun 26 09:03:46 UTC 2021

Modified Files:
src/sys/arch/evbppc/conf: std.explora

Log Message:
Oops, revert unintentional part of the previous.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbppc/conf/std.explora

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/evbppc/conf/std.explora
diff -u src/sys/arch/evbppc/conf/std.explora:1.8 src/sys/arch/evbppc/conf/std.explora:1.9
--- src/sys/arch/evbppc/conf/std.explora:1.8	Sat Jun 26 09:00:39 2021
+++ src/sys/arch/evbppc/conf/std.explora	Sat Jun 26 09:03:46 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.explora,v 1.8 2021/06/26 09:00:39 rin Exp $
+#	$NetBSD: std.explora,v 1.9 2021/06/26 09:03:46 rin Exp $
 #
 # Standard/required options for NetBSD/explora.
 
@@ -28,5 +28,3 @@ options 	INTSTK=16384
 options 	PPC_CPU_FREQ=6600	# XXX hack for pckbc_cnattach()
 
 include		"arch/evbppc/conf/files.explora"
-
-options 	PPC_PCI_MACHDEP_IMPL=""



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

2021-06-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun 26 09:00:39 UTC 2021

Modified Files:
src/sys/arch/evbppc/conf: std.explora

Log Message:
Set VMSWAP_DEFAULT_PLAINTEXT for Explora 450 (IBM_PPC403).
(slow CPU & memory shortage)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbppc/conf/std.explora

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/evbppc/conf/std.explora
diff -u src/sys/arch/evbppc/conf/std.explora:1.7 src/sys/arch/evbppc/conf/std.explora:1.8
--- src/sys/arch/evbppc/conf/std.explora:1.7	Fri Mar  5 06:45:12 2021
+++ src/sys/arch/evbppc/conf/std.explora	Sat Jun 26 09:00:39 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.explora,v 1.7 2021/03/05 06:45:12 rin Exp $
+#	$NetBSD: std.explora,v 1.8 2021/06/26 09:00:39 rin Exp $
 #
 # Standard/required options for NetBSD/explora.
 
@@ -9,6 +9,9 @@ include		"conf/std"	# MI standard option
 options 	PPC_IBM4XX	# IBM 40x family
 options 	PPC_IBM403	# IBM 403GCX
 
+options 	VMSWAP_DEFAULT_PLAINTEXT	# do not encrypt swap by
+		# default (slow cpu)
+
 # Executable support:
 options 	EXEC_ELF32	# (native) ELF32 binary support
 options 	EXEC_AOUT	# (native) a.out binary support (deprecated)
@@ -25,3 +28,5 @@ options 	INTSTK=16384
 options 	PPC_CPU_FREQ=6600	# XXX hack for pckbc_cnattach()
 
 include		"arch/evbppc/conf/files.explora"
+
+options 	PPC_PCI_MACHDEP_IMPL=""



CVS commit: src/external/bsd/libfido2/lib

2021-06-17 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun 17 06:20:56 UTC 2021

Modified Files:
src/external/bsd/libfido2/lib: Makefile

Log Message:
Unbreak build; new libfido2 requires OpenBSD-compatible freezero().


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libfido2/lib/Makefile

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

Modified files:

Index: src/external/bsd/libfido2/lib/Makefile
diff -u src/external/bsd/libfido2/lib/Makefile:1.4 src/external/bsd/libfido2/lib/Makefile:1.5
--- src/external/bsd/libfido2/lib/Makefile:1.4	Thu Jun 17 01:15:46 2021
+++ src/external/bsd/libfido2/lib/Makefile	Thu Jun 17 06:20:56 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2021/06/17 01:15:46 christos Exp $
+# $NetBSD: Makefile,v 1.5 2021/06/17 06:20:56 rin Exp $
 
 NOLINT=
 .include 
@@ -48,6 +48,7 @@ u2f.c
 
 SRCS+= \
 explicit_bzero.c \
+freezero.c \
 recallocarray.c \
 timingsafe_bcmp.c
 



CVS commit: src/sys/sys

2021-06-16 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 11:55:10 UTC 2021

Modified Files:
src/sys/sys: systm.h

Log Message:
Provide KERNEL_LOCK facilities also for MODULAR, in addition to
MULTIPROCESSOR and _MODULE.

Otherwise, inconsistencies occur between UP kernel and modules,
that have been observed as:

http://mail-index.netbsd.org/port-powerpc/2020/07/07/msg003590.html
http://mail-index.netbsd.org/source-changes-d/2021/06/16/msg013369.html


To generate a diff of this commit:
cvs rdiff -u -r1.300 -r1.301 src/sys/sys/systm.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/sys/systm.h
diff -u src/sys/sys/systm.h:1.300 src/sys/sys/systm.h:1.301
--- src/sys/sys/systm.h:1.300	Sun Mar 14 02:53:57 2021
+++ src/sys/sys/systm.h	Wed Jun 16 11:55:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: systm.h,v 1.300 2021/03/14 02:53:57 rin Exp $	*/
+/*	$NetBSD: systm.h,v 1.301 2021/06/16 11:55:10 rin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -46,6 +46,7 @@
 #include "opt_kasan.h"
 #include "opt_kcsan.h"
 #include "opt_kmsan.h"
+#include "opt_modular.h"
 #include "opt_wsdisplay_compat.h"
 #endif
 #if !defined(_KERNEL) && !defined(_STANDALONE)
@@ -728,7 +729,7 @@ void	kernconfig_unlock(void);
 bool	kernconfig_is_held(void);
 #endif
 
-#if defined(MULTIPROCESSOR) || defined(_MODULE)
+#if defined(MULTIPROCESSOR) || defined(MODULAR) || defined(_MODULE)
 #define	KERNEL_LOCK(count, lwp)			\
 do {		\
 	if ((count) != 0)			\



CVS commit: src

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 05:21:09 UTC 2021

Modified Files:
src/lib/libc/compiler_rt: Makefile.inc
src/lib/libm/compiler_rt: Makefile.inc
src/sys/lib/libkern: Makefile.compiler-rt
Added Files:
src/sys/external/bsd/compiler_rt: abi.mk

Log Message:
PR port-arm/55897

Fix ABI mismatch for armhf runtime routines for floating-point arithmetics;
For hard-float arm variants, provide

(1) generic runtime routines with correct calling convention, and
(2) EABI runtime routines at the same time.

I've confirmed that no binary changes for kernels.

LGTM by skrll


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/compiler_rt/Makefile.inc
cvs rdiff -u -r1.10 -r1.11 src/lib/libm/compiler_rt/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/compiler_rt/abi.mk
cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/lib/libc/compiler_rt/Makefile.inc
diff -u src/lib/libc/compiler_rt/Makefile.inc:1.39 src/lib/libc/compiler_rt/Makefile.inc:1.40
--- src/lib/libc/compiler_rt/Makefile.inc:1.39	Wed Sep  2 16:22:45 2020
+++ src/lib/libc/compiler_rt/Makefile.inc	Wed Jun 16 05:21:08 2021
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.39 2020/09/02 16:22:45 jakllsch Exp $
+# $NetBSD: Makefile.inc,v 1.40 2021/06/16 05:21:08 rin Exp $
 
-COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
+COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
 
 .if ${LIBC_MACHINE_ARCH} == "powerpc" || ${LIBC_MACHINE_ARCH} == "powerpc64"
 COMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/ppc
@@ -299,3 +300,5 @@ COPTS.${src}+=	-Wno-missing-prototypes \
 COPTS.${src}+=	-D__SOFT_FP__
 .endif
 .endfor
+
+.include "${COMPILER_RT_DIR}/abi.mk"

Index: src/lib/libm/compiler_rt/Makefile.inc
diff -u src/lib/libm/compiler_rt/Makefile.inc:1.10 src/lib/libm/compiler_rt/Makefile.inc:1.11
--- src/lib/libm/compiler_rt/Makefile.inc:1.10	Sat Feb 27 19:06:56 2016
+++ src/lib/libm/compiler_rt/Makefile.inc	Wed Jun 16 05:21:08 2021
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.10 2016/02/27 19:06:56 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.11 2021/06/16 05:21:08 rin Exp $
 
-COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
+COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
 
 .if ${MACHINE_CPU} == "powerpc"
 COMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/ppc
@@ -38,3 +39,5 @@ SRCS+=	${src}
 COPTS.${src}+=	-Wno-error=missing-prototypes
 .  endif
 .endfor
+
+.include "${COMPILER_RT_DIR}/abi.mk"

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.12 src/sys/lib/libkern/Makefile.compiler-rt:1.13
--- src/sys/lib/libkern/Makefile.compiler-rt:1.12	Fri Apr 24 00:22:57 2020
+++ src/sys/lib/libkern/Makefile.compiler-rt	Wed Jun 16 05:21:09 2021
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile.compiler-rt,v 1.12 2020/04/24 00:22:57 rin Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.13 2021/06/16 05:21:09 rin Exp $
 
-COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
+COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
 
 .if ${MACHINE_ARCH} == "powerpc"
 COMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/ppc
@@ -134,3 +135,6 @@ CPPFLAGS.int_util.c+=	-DKERNEL_USE
 COPTS.udivmoddi4.c+=	-fnon-call-exceptions
 . endif
 .endif
+
+# XXX This makes no binary changes at the moment.
+.include "${COMPILER_RT_DIR}/abi.mk"

Added files:

Index: src/sys/external/bsd/compiler_rt/abi.mk
diff -u /dev/null src/sys/external/bsd/compiler_rt/abi.mk:1.1
--- /dev/null	Wed Jun 16 05:21:09 2021
+++ src/sys/external/bsd/compiler_rt/abi.mk	Wed Jun 16 05:21:08 2021
@@ -0,0 +1,5 @@
+# $NetBSD: abi.mk,v 1.1 2021/06/16 05:21:08 rin Exp $
+
+.if !empty(MACHINE_ARCH:Mearm*hf*)
+CPPFLAGS+=	-DCOMPILER_RT_ARMHF_TARGET
+.endif



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 05:07:49 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins: adddf3.c addsf3.c
ashldi3.c ashrdi3.c comparedf2.c comparesf2.c divdf3.c divsf3.c
divsi3.c extendhfsf2.c extendsfdf2.c fixdfdi.c fixdfsi.c fixsfdi.c
fixsfsi.c fixunsdfdi.c fixunsdfsi.c fixunssfdi.c fixunssfsi.c
floatdidf.c floatdisf.c floatsidf.c floatsisf.c floatundidf.c
floatundisf.c floatunsidf.c floatunsisf.c int_lib.h lshrdi3.c
muldf3.c muldi3.c mulsf3.c negdf2.c negsf2.c subdf3.c subsf3.c
truncdfhf2.c truncdfsf2.c truncsfhf2.c udivsi3.c

Log Message:
PR port-arm/55897

Cherry-pick upstream commit llvm-svn: 314851:

https://github.com/llvm/llvm-project/commit/0d586d06a756b126a7eb43a21ecc12bd243d7cd8#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007

[PATCH] [compiler-rt] Add back ARM EABI aliases where legal.

r303188 removed all the uses of aliases for EABI functions from
compiler-rt, because some of them had mismatched calling conventions.
Obviously, we can't use aliases for functions which don't have the same
calling convention, but that's only an issue for floating-point
functions with the hardfloat ABI.  In other cases, the stubs increase
size and reduce performance for no benefit.

This patch adds back the aliases, with appropriate checks to make sure
they're only used in cases where the calling convention matches.

llvm-svn: 314851


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfdi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfsi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfdi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfsi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfdi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfsi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfdi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfsi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdisf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatsidf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatsisf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatundisf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsidf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsisf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/lshrdi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/muldf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/muldi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/mulsf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/negdf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/negsf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/subdf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/subsf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfhf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfsf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/truncsfhf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/udivsi3.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatundidf.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.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/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c:1.2 src/sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c:1.3
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c:1.2	Wed Jun 16 05:06:45 2021
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c	Wed Jun 16 05:07:49 2021
@@ -20,8 +20,11 @@ COMPILER_RT_ABI double __adddf3(double a
 }
 
 #if 

CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 05:07:18 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins: floatdidf.c

Log Message:
PR port-arm/55897

Cherry-pick upstream commit llvm-svn: 303207:

https://github.com/llvm/llvm-project/commit/4a45838d10085defac0f3b3003a5263e34536f3b#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007

[PATCH] builtins: fix guard __AEABI__ -> __ARM_EABI__

llvm-svn: 303207


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.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/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c:1.3 src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c:1.4
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c:1.3	Wed Jun 16 05:06:45 2021
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c	Wed Jun 16 05:07:18 2021
@@ -104,7 +104,7 @@ __floatdidf(di_int a)
 }
 #endif
 
-#if defined(__AEABI__)
+#if defined(__ARM_EABI__)
 AEABI_RTABI double __aeabi_l2d(di_int a) {
   return __floatdidf(a);
 }



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 05:06:46 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins: adddf3.c addsf3.c
ashldi3.c ashrdi3.c comparedf2.c comparesf2.c divdf3.c divsf3.c
divsi3.c extendhfsf2.c extendsfdf2.c fixdfdi.c fixdfsi.c fixsfdi.c
fixsfsi.c fixunsdfdi.c fixunsdfsi.c fixunssfdi.c fixunssfsi.c
floatdidf.c floatdisf.c floatsidf.c floatsisf.c floatundidf.c
floatundisf.c floatunsidf.c floatunsisf.c int_lib.h lshrdi3.c
muldf3.c muldi3.c mulsf3.c negdf2.c negsf2.c subdf3.c subsf3.c
truncdfhf2.c truncdfsf2.c truncsfhf2.c udivsi3.c
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm:
aeabi_cdcmpeq_check_nan.c aeabi_cfcmpeq_check_nan.c aeabi_div0.c
aeabi_drsub.c aeabi_frsub.c

Log Message:
PR port-arm/55897

Cherry-pick upstream commit llvm-svn: 303188:

https://github.com/llvm/llvm-project/commit/36ac5ddff7377586390a71cb3261f0a40d274308#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007

[PATCH] builtins: expand out the AEABI function stubs

These actually may change calling conventions.  We cannot simply provide
function aliases as the aliased function may have a different calling
convention.  Provide a forwarding function instead to permit the
compiler to synthesize the calling convention adjustment thunk.

Remove the `ARM_EABI_FNALIAS` macro as that is not safe to use.

Resolves PR33030!

llvm-svn: 303188


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfdi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfsi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/subdf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/subsf3.c
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdisf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatundisf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/lshrdi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/muldi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/negsf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfhf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/truncsfhf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/udivsi3.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfdi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfsi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfdi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfsi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfdi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfsi.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatsidf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatsisf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsidf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsisf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/muldf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/mulsf3.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/negdf2.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfsf2.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/floatundidf.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c
 \

src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c
 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_div0.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_drsub.c \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_frsub.c

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

CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 05:06:21 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins: int_lib.h

Log Message:
PR port-arm/55897

Cherry-pick upstream commit llvm-svn: 303138:

https://github.com/llvm/llvm-project/commit/44c45717b9e9f3dc194508d2eeeb8599a9d76949#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007

[PATCH] builtins: use reserved spelling (NFC)

llvm-svn: 303138


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.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/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.3 src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.4
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.3	Wed Jun 16 05:05:49 2021
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h	Wed Jun 16 05:06:21 2021
@@ -35,7 +35,7 @@
 # ifdef COMPILER_RT_ARMHF_TARGET
 #   define COMPILER_RT_ABI
 # else
-#   define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
+#   define COMPILER_RT_ABI __attribute__((__pcs__("aapcs")))
 # endif
 #else
 # define ARM_EABI_FNALIAS(aeabi_name, name)



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 05:05:49 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins: int_lib.h

Log Message:
PR port-arm/55897

Cherry-pick upstream commit llvm-svn: 298974 for lib/builtins/int_lib.h.

https://github.com/llvm/llvm-project/commit/d8ca74176e25bd4080ee81982819e2ef7a36553f#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007

[Builtin] Unxfail tests for armhf

Summary:
Originally, a few tests fail for armhf target due to:
1) COMPILER_RT_ARMHF_TARGET was not set when building the lib
2) COMPILER_RT_ABI should not be defined as `__attribute__((pcs("aapcs")))` for 
armhf when building for both lib and tests

This address https://bugs.llvm.org//show_bug.cgi?id=32261

mulsc3_test.c is a newly exposed issue, which will be addressed separately.

Reviewers: rengolin, compnerd

Reviewed By: compnerd

Subscribers: aemerson, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D31448

llvm-svn: 298974


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.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/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.2 src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.3
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.2	Wed Jun 16 05:05:03 2021
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h	Wed Jun 16 05:05:49 2021
@@ -32,7 +32,11 @@
 #if __ARM_EABI__
 # define ARM_EABI_FNALIAS(aeabi_name, name) \
   void __aeabi_##aeabi_name() __attribute__((alias("__" #name)));
-# define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
+# ifdef COMPILER_RT_ARMHF_TARGET
+#   define COMPILER_RT_ABI
+# else
+#   define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
+# endif
 #else
 # define ARM_EABI_FNALIAS(aeabi_name, name)
 # define COMPILER_RT_ABI



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 05:05:03 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins: int_lib.h

Log Message:
PR port-arm/55897

Cherry-pick upstream commit llvm-svn: 266891:

https://github.com/llvm/llvm-project/commit/28e1b977d4694c6b3a5c4d8107570a969be71e77#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007

[PATCH] builtins: remove use of __attribute__((pcs("aapcs"))) on
 Windows

Windows does not honour the __attribute__((pcs)) on ARM.  Although this will
result in ABI mismatches, compiler-rt should largely be unneeded for resolving
dependencies as we generate MS ABI compliant library calls now for the most
part.

llvm-svn: 266891


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.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/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h:1.1.1.4	Sat Feb 27 18:59:30 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h	Wed Jun 16 05:05:03 2021
@@ -35,11 +35,7 @@
 # define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
 #else
 # define ARM_EABI_FNALIAS(aeabi_name, name)
-# if defined(__arm__) && defined(_WIN32) && (!defined(_MSC_VER) || defined(__clang__))
-#   define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
-# else
-#   define COMPILER_RT_ABI
-# endif
+# define COMPILER_RT_ABI
 #endif
 
 #ifdef _MSC_VER



CVS commit: src/external/gpl3/gcc

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 16 00:56:16 UTC 2021

Modified Files:
src/external/gpl3/gcc: README.gcc10

Log Message:
Update earmv[67]{,hf}{,eb}: hazard has gone, just working fine!

Note that kernel texts for soft-float variants are just same as that for
hard-float counterparts.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/gpl3/gcc/README.gcc10

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

Modified files:

Index: src/external/gpl3/gcc/README.gcc10
diff -u src/external/gpl3/gcc/README.gcc10:1.21 src/external/gpl3/gcc/README.gcc10:1.22
--- src/external/gpl3/gcc/README.gcc10:1.21	Thu May 27 06:58:27 2021
+++ src/external/gpl3/gcc/README.gcc10	Wed Jun 16 00:56:16 2021
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc10,v 1.21 2021/05/27 06:58:27 mrg Exp $
+$NetBSD: README.gcc10,v 1.22 2021/06/16 00:56:16 rin Exp $
 
 
 new stuff:
@@ -39,14 +39,14 @@ earmv5		y	b	y	y		y		y	y	n
 earmv5eb	y	b	y	y		y		?	?	?
 earmv5hf	y	y	y	y		y		?	?	?
 earmv5hfeb	y	b	y	y		y		?	?	?
-earmv6		y	b	y	y		y		y	?	?
-earmv6eb	y	b	y	y		y		y	?	?
-earmv6hf	y	y	y	y		y		y[2]	?	?
-earmv6hfeb	y	b	y	y		y		y[2]	?	?
-earmv7		y	b	y	y		y		?	?	?
-earmv7eb	y	b	y	y		y		?	?	?
+earmv6		y	b	y	y		y		y	y	n
+earmv6eb	y	b	y	y		y		y	y	n
+earmv6hf	y	y	y	y		y		y	y	n
+earmv6hfeb	y	y	y	y		y		y	y	n
+earmv7		y	b	y	y		y		y	y	n
+earmv7eb	y	b	y	y		y		y	y	n
 earmv7hf	y	y	y	y		y		y	y	n
-earmv7hfeb	y	b	y	y		y		y	y	n
+earmv7hfeb	y	y	y	y		y		y	y	n
 hppa		y	y	y	y		y		y	y	y
 i386		y	y	y	y		y		y	n[8]	y
 ia64		y	y	y	y		y		?	N/A	y
@@ -72,14 +72,6 @@ coldfire	?	N/A	?	?		?		N/A	N/A
 architecture	tools	kernels	libgcc	native-gcc	make release	runs	atf
 
 [1] - ramdisk.fs is too large, needs fixing.
-[2] - armv6hf (both little and big endian) has new problems:
-  rpi# cat bar.s
-  .cfi_startproc
-  .cfi_endproc
-  rpi# as bar.s
-  bar.s: Assembler messages:
-  bar.s: Internal error (Illegal instruction).
-  Please report this bug.
 [6] - vax vs c++ exceptions issue, same as it ever was
 [7] - fails just as poorly in gxemul/landisk as GCC 9
 [8] - i386 seems to have a signal delivery issue.  pthread tests hang and then



CVS commit: src/sys/arch/amiga/dev

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 15 09:00:33 UTC 2021

Modified Files:
src/sys/arch/amiga/dev: amidisplaycc.c

Log Message:
Remove parentheses from return. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/amiga/dev/amidisplaycc.c

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

Modified files:

Index: src/sys/arch/amiga/dev/amidisplaycc.c
diff -u src/sys/arch/amiga/dev/amidisplaycc.c:1.35 src/sys/arch/amiga/dev/amidisplaycc.c:1.36
--- src/sys/arch/amiga/dev/amidisplaycc.c:1.35	Tue Jun 15 08:53:47 2021
+++ src/sys/arch/amiga/dev/amidisplaycc.c	Tue Jun 15 09:00:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: amidisplaycc.c,v 1.35 2021/06/15 08:53:47 rin Exp $ */
+/*	$NetBSD: amidisplaycc.c,v 1.36 2021/06/15 09:00:33 rin Exp $ */
 
 /*-
  * Copyright (c) 2000 Jukka Andberg.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.35 2021/06/15 08:53:47 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.36 2021/06/15 09:00:33 rin Exp $");
 
 /*
  * wscons interface to amiga custom chips. Contains the necessary functions
@@ -403,11 +403,11 @@ amidisplaycc_match(device_t parent, cfda
 	char *name = aux;
 
 	if (matchname("amidisplaycc", name) == 0)
-		return (0);
+		return 0;
 
 	/* Allow only one of us. */
 	if (amidisplaycc_attached)
-		return (0);
+		return 0;
 
 	return 1;
 }
@@ -542,10 +542,10 @@ amidisplaycc_mapchar(void *screen, int c
 {
 	if (ch > 0 && ch < 256) {
 		*chp = ch;
-		return (5);
+		return 5;
 	}
 	*chp = ' ';
-	return (0);
+	return 0;
 }
 
 /*
@@ -1001,7 +1001,7 @@ amidisplaycc_allocattr(void *screen, int
 #endif
 	*attrp = MAKEATTR(newfg, newbg, flags);
 
-	return (0);
+	return 0;
 }
 
 int
@@ -1014,7 +1014,7 @@ amidisplaycc_ioctl(void *dp, void *vs, u
 
 	if (adp == NULL) {
 		printf("amidisplaycc_ioctl: adp==NULL\n");
-		return (EINVAL);
+		return EINVAL;
 	}
 
 #define UINTDATA (*(u_int*)data)
@@ -1025,20 +1025,20 @@ amidisplaycc_ioctl(void *dp, void *vs, u
 	{
 	case WSDISPLAYIO_GTYPE:
 		UINTDATA = WSDISPLAY_TYPE_AMIGACC;
-		return (0);
+		return 0;
 
 	case WSDISPLAYIO_SVIDEO:
 		dprintf("amidisplaycc: WSDISPLAYIO_SVIDEO %s\n",
 			UINTDATA ? "On" : "Off");
 
-		return (amidisplaycc_setvideo(adp, UINTDATA));
+		return amidisplaycc_setvideo(adp, UINTDATA);
 
 	case WSDISPLAYIO_GVIDEO:
 		dprintf("amidisplaycc: WSDISPLAYIO_GVIDEO\n");
 		UINTDATA = adp->ison ?
 		WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF;
 
-		return (0);
+		return 0;
 
 	case WSDISPLAYIO_SMODE:
 		switch (INTDATA) {
@@ -1048,7 +1048,7 @@ amidisplaycc_ioctl(void *dp, void *vs, u
 		case WSDISPLAYIO_MODE_DUMBFB:
 			return amidisplaycc_setgfxview(adp, 1);
 		default:
-			return (EINVAL);
+			return EINVAL;
 		}
 
 	case WSDISPLAYIO_GINFO:
@@ -1056,19 +1056,18 @@ amidisplaycc_ioctl(void *dp, void *vs, u
 		FBINFO.height = adp->gfxheight;
 		FBINFO.depth  = adp->gfxdepth;
 		FBINFO.cmsize = 1 << FBINFO.depth;
-		return (0);
+		return 0;
 
 	case WSDISPLAYIO_PUTCMAP:
 	case WSDISPLAYIO_GETCMAP:
-		return (amidisplaycc_cmapioctl(adp->gfxview,
-	   cmd,
-	   (struct wsdisplay_cmap*)data));
+		return amidisplaycc_cmapioctl(adp->gfxview, cmd,
+	   (struct wsdisplay_cmap*)data);
 	case WSDISPLAYIO_GET_FBINFO:
 		amidisplaycc_initgfxview(adp);
 		return amidisplaycc_getfbinfo(adp, data);
 	}
 
-	return (EPASSTHROUGH);
+	return EPASSTHROUGH;
 
 #undef UINTDATA
 #undef INTDATA
@@ -1101,7 +1100,7 @@ amidisplaycc_getfbinfo(struct amidisplay
 	fbinfo->fbi_flags = 0;
 	fbinfo->fbi_subtype.fbi_cmapinfo.cmap_entries = 1 << adp->gfxdepth;
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -1137,7 +1136,7 @@ amidisplaycc_setgfxview(struct amidispla
 
 	/* Current mode same as requested mode? */
 	if ( (on > 0) == (adp->gfxon > 0) )
-		return (0);
+		return 0;
 
 	if (!on) {
 		/*
@@ -1151,7 +1150,7 @@ amidisplaycc_setgfxview(struct amidispla
 		else if (adp->gfxview)
 			grf_remove_view(adp->gfxview);
 
-		return (0);
+		return 0;
 	}
 
 	/* switch to mapped mode then */
@@ -1163,9 +1162,9 @@ amidisplaycc_setgfxview(struct amidispla
 		grf_display_view(adp->gfxview);
 	} else {
 		printf("amidisplaycc: failed to make mapped screen\n");
-		return (ENOMEM);
+		return ENOMEM;
 	}
-	return (0);
+	return 0;
 }
 
 /*
@@ -1247,9 +1246,9 @@ amidisplaycc_alloc_screen(void *dp, cons
 
 	/* Sanity checks because of fixed buffers */
 	if (depth > MAXDEPTH || maxcolor >= MAXCOLORS)
-		return (ENOMEM);
+		return ENOMEM;
 	if (screenp->nrows > MAXROWS)
-		return (ENOMEM);
+		return ENOMEM;
 
 	fontwidth = screenp->fontwidth;
 	fontheight = screenp->fontheight;
@@ -1264,7 +1263,7 @@ amidisplaycc_alloc_screen(void *dp, cons
 
 	view = grf_alloc_view(NULL, , depth);
 	if (view == NULL)
-		return (ENOMEM);
+		return ENOMEM;
 
 	/*
 	 * First screen gets the statically allocated console screen.
@@ -1383,7 +1382,7 @@ amidisplaycc_alloc_screen(void *dp, cons
 			

CVS commit: src/sys/arch/amiga/dev

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 15 08:53:47 UTC 2021

Modified Files:
src/sys/arch/amiga/dev: amidisplaycc.c

Log Message:
Add support for WSDISPLAYIO_MODE_DUMBFB to WSDISPLAYIO_SMODE.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amiga/dev/amidisplaycc.c

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

Modified files:

Index: src/sys/arch/amiga/dev/amidisplaycc.c
diff -u src/sys/arch/amiga/dev/amidisplaycc.c:1.34 src/sys/arch/amiga/dev/amidisplaycc.c:1.35
--- src/sys/arch/amiga/dev/amidisplaycc.c:1.34	Sat Apr 24 23:36:24 2021
+++ src/sys/arch/amiga/dev/amidisplaycc.c	Tue Jun 15 08:53:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: amidisplaycc.c,v 1.34 2021/04/24 23:36:24 thorpej Exp $ */
+/*	$NetBSD: amidisplaycc.c,v 1.35 2021/06/15 08:53:47 rin Exp $ */
 
 /*-
  * Copyright (c) 2000 Jukka Andberg.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.34 2021/04/24 23:36:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.35 2021/06/15 08:53:47 rin Exp $");
 
 /*
  * wscons interface to amiga custom chips. Contains the necessary functions
@@ -1041,11 +1041,15 @@ amidisplaycc_ioctl(void *dp, void *vs, u
 		return (0);
 
 	case WSDISPLAYIO_SMODE:
-		if (INTDATA == WSDISPLAYIO_MODE_EMUL)
+		switch (INTDATA) {
+		case WSDISPLAYIO_MODE_EMUL:
 			return amidisplaycc_setgfxview(adp, 0);
-		if (INTDATA == WSDISPLAYIO_MODE_MAPPED)
+		case WSDISPLAYIO_MODE_MAPPED:
+		case WSDISPLAYIO_MODE_DUMBFB:
 			return amidisplaycc_setgfxview(adp, 1);
-		return (EINVAL);
+		default:
+			return (EINVAL);
+		}
 
 	case WSDISPLAYIO_GINFO:
 		FBINFO.width  = adp->gfxwidth;



CVS commit: src/external/gpl3/gcc/dist/gcc

2021-06-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun 15 08:22:23 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc: config.gcc

Log Message:
Fix GCC10 for arm.

Include order of bpapi.h and netbsd-elf.h was swapped when official
support for arm*--netbsdelf-eabi{,hf} was added to GCC10. This seems to
cause critical inconsistencies, which results in SIGSEGV for as(1) on
earmv6hf{,eb} and some other regressions for many arm variants.

With this fix, everything work just fine as far as I can see.

Thanks skrll and mrg for discussion!


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/external/gpl3/gcc/dist/gcc/config.gcc

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config.gcc
diff -u src/external/gpl3/gcc/dist/gcc/config.gcc:1.69 src/external/gpl3/gcc/dist/gcc/config.gcc:1.70
--- src/external/gpl3/gcc/dist/gcc/config.gcc:1.69	Sun Apr 25 23:12:53 2021
+++ src/external/gpl3/gcc/dist/gcc/config.gcc	Tue Jun 15 08:22:23 2021
@@ -1280,7 +1280,7 @@ arm*-*-netbsdelf*)
 	esac
 	case ${target} in
 	arm*-*-netbsdelf-*eabi*)
-	tm_file="${tm_file} arm/bpabi.h arm/netbsd-elf.h arm/netbsd-eabi.h"
+	tm_file="${tm_file} arm/netbsd-elf.h arm/bpabi.h arm/netbsd-eabi.h"
 	# GCC 7 vs NetBSD/eabi -> avoid arm unwinder
 	#tmake_file="$tmake_file arm/t-bpabi"
 	tmake_file="$tmake_file arm/t-netbsdeabi"
@@ -1288,7 +1288,7 @@ arm*-*-netbsdelf*)
 	default_use_cxa_atexit=yes
 	;;
 	*)
-	tm_file="$tm_file arm/bpabi.h arm/netbsd-elf.h"
+	tm_file="$tm_file arm/netbsd-elf.h arm/bpabi.h"
 	#tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
 	tmake_file="$tmake_file arm/t-netbsd"
 	;;



CVS commit: src/sys/dev/hpc

2021-06-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun  5 02:27:08 UTC 2021

Modified Files:
src/sys/dev/hpc: hpcfb.c

Log Message:
hpcfb_cnattach(): If fbconf == NULL, this is for early console output
(used for hpcmips/VR41xx machines), and wsdisplay_preattach() should be
used instead of wsdisplay_cnattach().

Fix KASSERT failure for double attach of wsdisplay, reported in port-mips.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/hpc/hpcfb.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/dev/hpc/hpcfb.c
diff -u src/sys/dev/hpc/hpcfb.c:1.61 src/sys/dev/hpc/hpcfb.c:1.62
--- src/sys/dev/hpc/hpcfb.c:1.61	Sat Apr 24 23:36:54 2021
+++ src/sys/dev/hpc/hpcfb.c	Sat Jun  5 02:27:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcfb.c,v 1.61 2021/04/24 23:36:54 thorpej Exp $	*/
+/*	$NetBSD: hpcfb.c,v 1.62 2021/06/05 02:27:08 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.61 2021/04/24 23:36:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.62 2021/06/05 02:27:08 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hpcfb.h"
@@ -410,8 +410,17 @@ hpcfb_cnattach(struct hpcfb_fbconf *fbco
 	hpcfb_console_wsscreen.capabilities = hpcfb_console_dc.dc_rinfo.ri_caps;
 	hpcfb_allocattr(_console_dc,
 			WSCOL_WHITE, WSCOL_BLACK, 0, );
-	wsdisplay_cnattach(_console_wsscreen, _console_dc,
-	0, 0, defattr);
+#if NBIVIDEO > 0
+	/*
+	 * This is early console. Do not really attach wsdisplay.
+	 */
+	if (fbconf == &__fbconf)
+		wsdisplay_preattach(_console_wsscreen, _console_dc,
+		0, 0, defattr);
+	else
+#endif
+		wsdisplay_cnattach(_console_wsscreen, _console_dc,
+		0, 0, defattr);
 	hpcfbconsole = 1;
 
 	return (0);



CVS commit: src/external/gpl3/gdb/dist/gdb

2021-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun  4 01:42:14 UTC 2021

Modified Files:
src/external/gpl3/gdb/dist/gdb: aarch64-nbsd-tdep.c

Log Message:
Add missing nbsd_init_abi() call to aarch64_nbsd_init_abi().

Fix tests/usr.bin/gdb/t_regress:pie on aarch64eb (types of auxv was
misinterpreted), and hopefully other strange behaviors on aarch64{,eb}.

This is a regression introduced in GDB11. Neither gdb.old nor release
branches are affected.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-tdep.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-tdep.c:1.7 src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-tdep.c:1.8
--- src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-tdep.c:1.7	Fri Dec 11 18:23:25 2020
+++ src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-tdep.c	Fri Jun  4 01:42:14 2021
@@ -182,6 +182,8 @@ aarch64_nbsd_init_abi (struct gdbarch_in
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
+  nbsd_init_abi (info, gdbarch);
+
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
 	 svr4_lp64_fetch_link_map_offsets);
 



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

2021-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun  3 09:09:22 UTC 2021

Modified Files:
src/sys/arch/evbppc/conf: DHT

Log Message:
- Add some more things necessary for ATF.
- Add makphy(4) found in recent wm(4) models.
- Style.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbppc/conf/DHT

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/evbppc/conf/DHT
diff -u src/sys/arch/evbppc/conf/DHT:1.1 src/sys/arch/evbppc/conf/DHT:1.2
--- src/sys/arch/evbppc/conf/DHT:1.1	Fri Apr  2 07:00:33 2021
+++ src/sys/arch/evbppc/conf/DHT	Thu Jun  3 09:09:22 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: DHT,v 1.1 2021/04/02 07:00:33 rin Exp $
+#	$NetBSD: DHT,v 1.2 2021/06/03 09:09:22 rin Exp $
 #
 #	DHT --- DHT Walnut 405GP Evaluation Board
 #		(Digital Home Technologies PCB 01070201 Rev. 1.1)
@@ -8,7 +8,7 @@ include 	"arch/evbppc/conf/std.dht"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"DHT-$Revision: 1.1 $"
+#ident 		"DHT-$Revision: 1.2 $"
 
 maxusers	32
 
@@ -49,7 +49,7 @@ options 	DIAGNOSTIC		# cheap kernel cons
 options 	DDB			# in-kernel debugger
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 #options 	TRAP_PANICWAIT
-makeoptions	COPY_SYMTAB=1	# size for embedded symbol table
+makeoptions	COPY_SYMTAB=1		# size for embedded symbol table
 
 makeoptions	DEBUG="-g"		# compile full symbol table
 
@@ -177,6 +177,7 @@ siisata* at pci? dev ? function ?	# SiI 
 
 wm*	at pci? dev ? function ?	# Intel 82543/82544 gigabit
 igphy*	at mii? phy ?			# Intel IGP01E1000
+makphy* at mii? phy ?			# Marvell Semiconductor 88E1000 PHYs
 ukphy*	at mii? phy ?			# generic unknown PHYs
 
 xhci*	at pci?	dev ? function ?	# eXtensible Host Controller
@@ -204,7 +205,7 @@ pseudo-device	swcrypto		# software crypt
 #pseudo-device	cgd			# cryptographic disk devices
 #pseudo-device	raid			# RAIDframe disk driver
 #options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
-#pseudo-device	fss			# file system snapshot device
+pseudo-device	fss			# file system snapshot device
 #pseudo-device	md			# memory disk device
 pseudo-device	vnd			# disk-like interface to files
 
@@ -231,6 +232,7 @@ pseudo-device	agr			# IEEE 802.3ad link 
 # miscellaneous pseudo-devices
 pseudo-device	pty			# pseudo-terminals
 pseudo-device	clockctl		# user control of clock subsystem
+pseudo-device	drvctl			# user control of drive subsystem
 pseudo-device	ksyms			# /dev/ksyms
 pseudo-device	putter			# for puffs and pud
 



CVS commit: src/share/mk

2021-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun  3 07:40:48 UTC 2021

Modified Files:
src/share/mk: bsd.own.mk bsd.x11.mk

Log Message:
Switch amiga to Xorg server 1.20; wsfb(4) is only graphic driver both for
1.10 and 1.20 (Xamiga was gone a long ago...), and there is no reason to
stay with 1.10.

At least, 1.20 works fine on wsdisplay(4) at amidisplaycc(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1255 -r1.1256 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.138 -r1.139 src/share/mk/bsd.x11.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1255 src/share/mk/bsd.own.mk:1.1256
--- src/share/mk/bsd.own.mk:1.1255	Sat May 29 12:25:08 2021
+++ src/share/mk/bsd.own.mk	Thu Jun  3 07:40:48 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1255 2021/05/29 12:25:08 rin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1256 2021/06/03 07:40:48 rin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1580,7 +1580,6 @@ X11SRCDIR.${_proto}proto?=		${X11SRCDIRM
 # During transition from xorg-server 1.10 to 1.20
 .if \
 ${MACHINE} == "alpha"	|| \
-${MACHINE} == "amiga"	|| \
 ${MACHINE} == "netwinder"	|| \
 ${MACHINE} == "sgimips"	|| \
 ${MACHINE} == "vax"

Index: src/share/mk/bsd.x11.mk
diff -u src/share/mk/bsd.x11.mk:1.138 src/share/mk/bsd.x11.mk:1.139
--- src/share/mk/bsd.x11.mk:1.138	Tue Apr 27 04:02:09 2021
+++ src/share/mk/bsd.x11.mk	Thu Jun  3 07:40:48 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.x11.mk,v 1.138 2021/04/27 04:02:09 mrg Exp $
+#	$NetBSD: bsd.x11.mk,v 1.139 2021/06/03 07:40:48 rin Exp $
 
 .include 
 
@@ -82,7 +82,6 @@ X11FLAGS.OS_DEFINES=	-DDDXOSINIT -DSERVE
 			-DDDXOSVERRORF -DDDXTIME -DUSB_HID
 
 .if !(${MACHINE} == "acorn32"	|| \
-${MACHINE} == "amiga"	|| \
 ${MACHINE} == "pmax"	|| \
 ${MACHINE} == "sun3"	|| \
 ${MACHINE} == "x68k"	|| \



CVS commit: src/external/mit/xorg/server/drivers/xf86-input-keyboard

2021-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun  3 07:37:01 UTC 2021

Modified Files:
src/external/mit/xorg/server/drivers/xf86-input-keyboard: Makefile

Log Message:
Sort ${MACHINE}'s. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.18 src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.19
--- src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.18	Thu Jun  3 07:34:29 2021
+++ src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile	Thu Jun  3 07:37:00 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2021/06/03 07:34:29 rin Exp $
+#	$NetBSD: Makefile,v 1.19 2021/06/03 07:37:00 rin Exp $
 
 DRIVER=		xf86-input-keyboard
 DRIVER_NAME=	kbd_drv
@@ -13,11 +13,15 @@ CPPFLAGS+=	-DPCVT_SUPPORT
 # turns out we can't use wskbd everywhere without a couple more translation
 # tables in the X driver so make it the default only where we know it will work
 
-.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE} == "sparc" || \
-${MACHINE} == "sparc64" || ${MACHINE} == "sgimips" || \
-${MACHINE} == "shark" || ${MACHINE} == "vax" || \
-${MACHINE} == "evbarm" || ${MACHINE} == "mac68k" || \
-${MACHINE} == "amiga"
+.if ${MACHINE_ARCH} == "powerpc" || \
+${MACHINE} == "amiga" || \
+${MACHINE} == "evbarm" || \
+${MACHINE} == "mac68k" || \
+${MACHINE} == "sgimips" || \
+${MACHINE} == "shark" || \
+${MACHINE} == "sparc" || \
+${MACHINE} == "sparc64" || \
+${MACHINE} == "vax"
 CPPFLAGS+=	-DDEFAULT_TO_WSKBD
 .endif
 



CVS commit: src/external/mit/xorg/server/drivers/xf86-input-keyboard

2021-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun  3 07:34:30 UTC 2021

Modified Files:
src/external/mit/xorg/server/drivers/xf86-input-keyboard: Makefile

Log Message:
For amiga, use wskbd as default, which is only supported protocol today.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.17 src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.18
--- src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.17	Sat May 29 12:15:32 2021
+++ src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile	Thu Jun  3 07:34:29 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2021/05/29 12:15:32 rin Exp $
+#	$NetBSD: Makefile,v 1.18 2021/06/03 07:34:29 rin Exp $
 
 DRIVER=		xf86-input-keyboard
 DRIVER_NAME=	kbd_drv
@@ -16,7 +16,8 @@ CPPFLAGS+=	-DPCVT_SUPPORT
 .if ${MACHINE_ARCH} == "powerpc" || ${MACHINE} == "sparc" || \
 ${MACHINE} == "sparc64" || ${MACHINE} == "sgimips" || \
 ${MACHINE} == "shark" || ${MACHINE} == "vax" || \
-${MACHINE} == "evbarm" || ${MACHINE} == "mac68k"
+${MACHINE} == "evbarm" || ${MACHINE} == "mac68k" || \
+${MACHINE} == "amiga"
 CPPFLAGS+=	-DDEFAULT_TO_WSKBD
 .endif
 



CVS commit: src/sys/arch/amiga/dev

2021-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun  3 07:31:20 UTC 2021

Modified Files:
src/sys/arch/amiga/dev: kbd.c ms.c

Log Message:
kbd(4) and ms(4) carry multiple interface attributes. They are configurable
both as standalone drivers for legacy framebuffer console, or parents of
wskbd(4) and wsmouse(4), respectively. For the latter, be explicit about
using "wskbddev" and "wsmousedev" interface attributes for children.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/amiga/dev/kbd.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/amiga/dev/ms.c

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

Modified files:

Index: src/sys/arch/amiga/dev/kbd.c
diff -u src/sys/arch/amiga/dev/kbd.c:1.59 src/sys/arch/amiga/dev/kbd.c:1.60
--- src/sys/arch/amiga/dev/kbd.c:1.59	Sat Apr 24 23:36:24 2021
+++ src/sys/arch/amiga/dev/kbd.c	Thu Jun  3 07:31:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.59 2021/04/24 23:36:24 thorpej Exp $ */
+/*	$NetBSD: kbd.c,v 1.60 2021/06/03 07:31:20 rin Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.59 2021/04/24 23:36:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.60 2021/06/03 07:31:20 rin Exp $");
 
 #include 
 #include 
@@ -220,6 +220,7 @@ kbdattach(device_t parent, device_t self
 		waa.accessops = _accessops;
 		waa.accesscookie = NULL;
 		kbd_softc.k_wskbddev = config_found(self, , wskbddevprint,
+		CFARG_IATTR, "wskbddev",
 		CFARG_EOL);
 
 		kbd_softc.k_pollingmode = 0;

Index: src/sys/arch/amiga/dev/ms.c
diff -u src/sys/arch/amiga/dev/ms.c:1.40 src/sys/arch/amiga/dev/ms.c:1.41
--- src/sys/arch/amiga/dev/ms.c:1.40	Sat Apr 24 23:36:24 2021
+++ src/sys/arch/amiga/dev/ms.c	Thu Jun  3 07:31:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ms.c,v 1.40 2021/04/24 23:36:24 thorpej Exp $ */
+/*	$NetBSD: ms.c,v 1.41 2021/06/03 07:31:20 rin Exp $ */
 
 /*
  * based on:
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.40 2021/04/24 23:36:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.41 2021/06/03 07:31:20 rin Exp $");
 
 /*
  * Mouse driver.
@@ -202,7 +202,9 @@ msattach(device_t parent, device_t self,
 		
 		sc->sc_ports[i].ms_wsenabled = 0;
 		sc->sc_ports[i].ms_wsmousedev = 
-		config_found(self, , wsmousedevprint, CFARG_EOL);
+		config_found(self, , wsmousedevprint,
+			CFARG_IATTR, "wsmousedev",
+			CFARG_EOL);
 #endif
 	}
 }



CVS commit: src/sys/kern

2021-06-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun  2 15:43:33 UTC 2021

Modified Files:
src/sys/kern: kern_ksyms.c

Log Message:
Fix regression introduced in rev 1.90:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_ksyms.c#rev1.90

in which the last element of ksyms_symtabs is skipped by mistake.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/kern/kern_ksyms.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/kern/kern_ksyms.c
diff -u src/sys/kern/kern_ksyms.c:1.93 src/sys/kern/kern_ksyms.c:1.94
--- src/sys/kern/kern_ksyms.c:1.93	Wed Jun  2 08:46:16 2021
+++ src/sys/kern/kern_ksyms.c	Wed Jun  2 15:43:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ksyms.c,v 1.93 2021/06/02 08:46:16 riastradh Exp $	*/
+/*	$NetBSD: kern_ksyms.c,v 1.94 2021/06/02 15:43:33 rin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.93 2021/06/02 08:46:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.94 2021/06/02 15:43:33 rin Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_copy_symtab.h"
@@ -1087,7 +1087,7 @@ ksymsread(dev_t dev, struct uio *uio, in
 	 */
 	filepos = sizeof(struct ksyms_hdr);
 	for (st = TAILQ_FIRST(_symtabs);
-	 st != ksyms_last_snapshot;
+	 st != TAILQ_NEXT(ksyms_last_snapshot, sd_queue);
 	 st = TAILQ_NEXT(st, sd_queue)) {
 		if (__predict_false(st->sd_gone))
 			continue;
@@ -1109,7 +1109,7 @@ ksymsread(dev_t dev, struct uio *uio, in
 	KASSERT(filepos <= sizeof(struct ksyms_hdr) +
 	ksyms_hdr.kh_shdr[SYMTAB].sh_size);
 	for (st = TAILQ_FIRST(_symtabs);
-	 st != ksyms_last_snapshot;
+	 st != TAILQ_NEXT(ksyms_last_snapshot, sd_queue);
 	 st = TAILQ_NEXT(st, sd_queue)) {
 		if (__predict_false(st->sd_gone))
 			continue;



CVS commit: xsrc/external/mit/xorg-server.old/dist/hw/xfree86/os-support/bsd

2021-06-02 Thread Rin Okuyama
Module Name:xsrc
Committed By:   rin
Date:   Wed Jun  2 15:01:18 UTC 2021

Modified Files:
xsrc/external/mit/xorg-server.old/dist/hw/xfree86/os-support/bsd:
ppc_video.c

Log Message:
Declare IOPortBase for mips, as done for xorg-server.

Fix build for sgimips, which still uses xorg-server.old.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xorg-server.old/dist/hw/xfree86/os-support/bsd/ppc_video.c

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

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/hw/xfree86/os-support/bsd/ppc_video.c
diff -u xsrc/external/mit/xorg-server.old/dist/hw/xfree86/os-support/bsd/ppc_video.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/hw/xfree86/os-support/bsd/ppc_video.c:1.2
--- xsrc/external/mit/xorg-server.old/dist/hw/xfree86/os-support/bsd/ppc_video.c:1.1.1.1	Thu Jun  9 09:07:59 2016
+++ xsrc/external/mit/xorg-server.old/dist/hw/xfree86/os-support/bsd/ppc_video.c	Wed Jun  2 15:01:18 2021
@@ -145,7 +145,7 @@ xf86EnableInterrupts()
 }
 
 /* XXX why the hell is this necessary?! */
-#ifdef __arm__
+#if defined(__arm__) || defined(__mips__)
 unsigned int IOPortBase = (int)MAP_FAILED;
 #endif
 



CVS commit: src/sys/arch/arm/vfp

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun  1 00:30:22 UTC 2021

Modified Files:
src/sys/arch/arm/vfp: vfp_init.c

Log Message:
PR port-arm/55790

Fix KASSERT failure with floating-point exception in userland.

Consider the case in which curlwp owns enabled FPU in vfp_handler().
If FPE is raised, we must skip pcu_load(9) rather than just falling
through. Otherwise, KASSERT fires in vfp_state_load(), since curlwp
already owns enabled FPU.

No regression for ATF is introduced.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/arm/vfp/vfp_init.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/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.73 src/sys/arch/arm/vfp/vfp_init.c:1.74
--- src/sys/arch/arm/vfp/vfp_init.c:1.73	Tue Jun  1 00:13:19 2021
+++ src/sys/arch/arm/vfp/vfp_init.c	Tue Jun  1 00:30:22 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $ */
+/*  $NetBSD: vfp_init.c,v 1.74 2021/06/01 00:30:22 rin Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -32,7 +32,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.74 2021/06/01 00:30:22 rin Exp $");
 
 #include 
 #include 
@@ -423,6 +423,7 @@ static int
 vfp_handler(u_int address, u_int insn, trapframe_t *frame, int fault_code)
 {
 	struct cpu_info * const ci = curcpu();
+	uint32_t fpexc;
 
 	/* This shouldn't ever happen.  */
 	if (fault_code != FAULT_USER &&
@@ -436,12 +437,19 @@ vfp_handler(u_int address, u_int insn, t
 
 	/* 
 	 * If we already own the FPU and it's enabled (and no exception), raise
-	 * SIGILL.  If there is an exception, drop through to raise a SIGFPE.
+	 * SIGILL.  If there is an exception, raise SIGFPE.
 	 */
-	if (curlwp->l_pcu_cpu[PCU_FPU] == ci
-	&& (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN) {
+	if (curlwp->l_pcu_cpu[PCU_FPU] == ci) {
 		KASSERT(ci->ci_pcu_curlwp[PCU_FPU] == curlwp);
-		return 1;
+
+		fpexc = armreg_fpexc_read();
+		if (fpexc & VFP_FPEXC_EN) {
+			if ((fpexc & VFP_FPEXC_EX) == 0) {
+return 1;	/* SIGILL */
+			} else {
+goto fpe;	/* SIGFPE; skip pcu_load(9) */
+			}
+		}
 	}
 
 	/*
@@ -449,11 +457,12 @@ vfp_handler(u_int address, u_int insn, t
 	 */
 	pcu_load(_vfp_ops);
 
-	uint32_t fpexc = armreg_fpexc_read();
+	fpexc = armreg_fpexc_read();
 	if (fpexc & VFP_FPEXC_EX) {
 		ksiginfo_t ksi;
 		KASSERT(fpexc & VFP_FPEXC_EN);
 
+fpe:
 		curcpu()->ci_vfp_evs[2].ev_count++;
 
 		/*



CVS commit: src/sys/arch/arm/vfp

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jun  1 00:13:19 UTC 2021

Modified Files:
src/sys/arch/arm/vfp: vfp_init.c

Log Message:
PR port-arm/55790

Style fix for clarity, in preparation of main fix.

Replace condition ``curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp'' with
``curlwp->l_pcu_cpu[PCU_FPU] == curcpu()''. And add KASSERT to check
the two conditions are equivalent, as done for MI pcu code:

https://nxr.netbsd.org/xref/src/sys/kern/subr_pcu.c#323

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/arm/vfp/vfp_init.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/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.72 src/sys/arch/arm/vfp/vfp_init.c:1.73
--- src/sys/arch/arm/vfp/vfp_init.c:1.72	Fri Oct 30 18:54:37 2020
+++ src/sys/arch/arm/vfp/vfp_init.c	Tue Jun  1 00:13:19 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: vfp_init.c,v 1.72 2020/10/30 18:54:37 skrll Exp $ */
+/*  $NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -32,7 +32,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.72 2020/10/30 18:54:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $");
 
 #include 
 #include 
@@ -438,9 +438,11 @@ vfp_handler(u_int address, u_int insn, t
 	 * If we already own the FPU and it's enabled (and no exception), raise
 	 * SIGILL.  If there is an exception, drop through to raise a SIGFPE.
 	 */
-	if (curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp
-	&& (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN)
+	if (curlwp->l_pcu_cpu[PCU_FPU] == ci
+	&& (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN) {
+		KASSERT(ci->ci_pcu_curlwp[PCU_FPU] == curlwp);
 		return 1;
+	}
 
 	/*
 	 * Make sure we own the FP.



CVS commit: src

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 22:33:19 UTC 2021

Modified Files:
src/doc: HACKS
src/external/gpl3/gdb.old/lib/libgdb: Makefile
src/external/gpl3/gdb/lib/libgdb: Makefile

Log Message:
PR toolchain/55837

Get rid of -O0 hack for GDB for hard-float arm. This was necessary because
libunwind did not support s0-s31. Note that for *most* cases (not all!),
-O0 stops using VFP registers for general purposes.

Also note that this hack was incomplete. We had to compile every functions
with -O0, that can be unwinded. Otherwise, GDB crashed every time exceptions
were raised.


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/doc/HACKS
cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gdb.old/lib/libgdb/Makefile
cvs rdiff -u -r1.30 -r1.31 src/external/gpl3/gdb/lib/libgdb/Makefile

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.217 src/doc/HACKS:1.218
--- src/doc/HACKS:1.217	Sat May  8 12:27:21 2021
+++ src/doc/HACKS	Mon May 31 22:33:19 2021
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.217 2021/05/08 12:27:21 christos Exp $
+# $NetBSD: HACKS,v 1.218 2021/05/31 22:33:19 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -975,19 +975,6 @@ descr	Disable optimization on tc.c, loge
 	function "__int64_t llvm::MachineFrameInfo::getObjectOffset(int) const"
 kcah
 
-port	arm
-hack	compile gdb/dwarf2{expr,loc}.c with -O0 for GCC[89] (PR/54820, 54877)
-cdate	Wed Apr 29 11:04:58 UTC 2020
-mdate	Thu Oct  8 17:00:00 JST 2020
-who	rin
-file	src/external/gpl3/gdb/lib/libgdb/Makefile: 1.22
-descr	For earmv7hf{,eb}, GCC 8.4 and 9.3 miscompile dwarf2expr.c with -O[21].
-	For earmv5hf{,eb}, GCC 9.3 miscompiles dwarf2{expr,loc}.c with -O2
-	(GCC9 -O1 and GCC8 -O2 work fine). These result in GDB crash with
-	``gdb_exception_RETURN_MASK_ERROR''. For everyone's safety, compile
-	these files with -O0 for all arm variants with GCC >= 8.
-kcah
-
 port	m68k
 hack	compile aes_ccm_tag() with -O0 for GCC8 and GCC9
 cdate	Mon Aug 10 06:27:29 UTC 2020

Index: src/external/gpl3/gdb.old/lib/libgdb/Makefile
diff -u src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.12 src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.13
--- src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.12	Fri May  7 12:19:48 2021
+++ src/external/gpl3/gdb.old/lib/libgdb/Makefile	Mon May 31 22:33:19 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2021/05/07 12:19:48 rin Exp $
+#	$NetBSD: Makefile,v 1.13 2021/05/31 22:33:19 rin Exp $
 
 NOCTF=
 HOSTPROG_CXX=   1
@@ -54,16 +54,6 @@ CFLAGS:=		${CXXFLAGS} -std=gnu++11 -Wno-
 
 ada-exp.c: ada-lex.c
 
-.if ${MACHINE_CPU} == "arm"
-. if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
-# GCC 8.4/9.3 miscompile this with -O[21] for earmv7hf{,eb}.
-# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
-COPTS.dwarf2expr.c+=	-O0
-# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
-COPTS.dwarf2loc.c+=	-O0
-. endif
-.endif
-
 # These are generated by implicit rules and are not easy to generate
 CLEANDIRFILES+= \
 	ada-exp.c ada-lex.c \

Index: src/external/gpl3/gdb/lib/libgdb/Makefile
diff -u src/external/gpl3/gdb/lib/libgdb/Makefile:1.30 src/external/gpl3/gdb/lib/libgdb/Makefile:1.31
--- src/external/gpl3/gdb/lib/libgdb/Makefile:1.30	Sun May 30 02:23:25 2021
+++ src/external/gpl3/gdb/lib/libgdb/Makefile	Mon May 31 22:33:19 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2021/05/30 02:23:25 joerg Exp $
+#	$NetBSD: Makefile,v 1.31 2021/05/31 22:33:19 rin Exp $
 
 NOCTF=
 HOSTPROG_CXX=   1
@@ -59,17 +59,6 @@ CFLAGS:=		${CXXFLAGS} -std=gnu++17 -Wno-
 
 ada-exp.c: ada-lex.c
 
-.if ${MACHINE_CPU} == "arm"
-. if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
-# XXX taken from GDB 8.3; not tested for GDB 11:
-# GCC 8.4/9.3 miscompile this with -O[21] for earmv7hf{,eb}.
-# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
-COPTS.expr.c+=	-O0
-# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
-COPTS.loc.c+=	-O0
-. endif
-.endif
-
 .if ${MACHINE} == "vax"
 . if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
 COPTS.read.c+=	-O0



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 21:31:34 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Stop using enum for flags, as per request from joerg.

#define constants and #undef after use.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.27 src/sys/lib/libunwind/Registers.hpp:1.28
--- src/sys/lib/libunwind/Registers.hpp:1.27	Mon May 31 12:12:24 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 21:31:33 2021
@@ -332,6 +332,11 @@ enum {
   REGNO_ARM32_S31 = 80,
 };
 
+#define	FLAGS_VFPV2_USED		0x1
+#define	FLAGS_VFPV3_USED		0x2
+#define	FLAGS_LEGACY_VFPV2_REGNO	0x4
+#define	FLAGS_EXTENDED_VFPV2_REGNO	0x8
+
 class Registers_arm32 {
 public:
   enum {
@@ -438,15 +443,13 @@ private:
   uint32_t reg[REGNO_ARM32_SPSR + 1];
   uint32_t flags;
   uint64_t fpreg[32];
-
-  enum {
-FLAGS_VFPV2_USED = 0x1,
-FLAGS_VFPV3_USED = 0x2,
-FLAGS_LEGACY_VFPV2_REGNO = 0x4,
-FLAGS_EXTENDED_VFPV2_REGNO = 0x8,
-  };
 };
 
+#undef	FLAGS_VFPV2_USED
+#undef	FLAGS_VFPV3_USED
+#undef	FLAGS_LEGACY_VFPV2_REGNO
+#undef	FLAGS_EXTENDED_VFPV2_REGNO
+
 enum {
   DWARF_VAX_R0 = 0,
   DWARF_VAX_R15 = 15,



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 12:12:24 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Bump LAST_REGISTER and LAST_RESTORE_REG to REGNO_ARM32_S31 for arm.

There are two numbering schemes for VFPv2 registers: s0-s31 and d0-d15.
The former is used by GCC, and the latter is by LLVM. Since libunwind was
derived from LLVM, it has never supported the former. This results in
crashes for GCC-compiled binaries in exception handler of C++, if it
encounters VFPv2 registers when unwinding frames.

This commit adds support for s0-s31 numbering to libunwind. I choose an
implementation in which VFPv2 registers are ``double-counted'' as s0-s31
AND d0-d15. This does not cause real problems, since the former is only
used by GCC, and the later is by LLVM. That is, different numbering
schemes cannot appear in a same frame. To make sure, assertions are added
in order to check this.

I've confirmed that no regression for ATF both for GCC- and LLVM-compiled
userlands.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.26 src/sys/lib/libunwind/Registers.hpp:1.27
--- src/sys/lib/libunwind/Registers.hpp:1.26	Mon May 31 11:57:28 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 12:12:24 2021
@@ -335,8 +335,8 @@ enum {
 class Registers_arm32 {
 public:
   enum {
-LAST_REGISTER = REGNO_ARM32_D31,
-LAST_RESTORE_REG = REGNO_ARM32_D31,
+LAST_REGISTER = REGNO_ARM32_S31,
+LAST_RESTORE_REG = REGNO_ARM32_S31,
 RETURN_OFFSET = 0,
 RETURN_MASK = 0,
   };
@@ -385,6 +385,14 @@ public:
 assert(validFloatVectorRegister(num));
 const void *addr = reinterpret_cast(addr_);
 if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) {
+  /*
+   * XXX
+   * There are two numbering schemes for VFPv2 registers: s0-s31
+   * (used by GCC) and d0-d15 (used by LLVM). We won't support both
+   * schemes simultaneously in a same frame.
+   */
+  assert((flags & FLAGS_EXTENDED_VFPV2_REGNO) == 0);
+  flags |= FLAGS_LEGACY_VFPV2_REGNO;
   if ((flags & FLAGS_VFPV2_USED) == 0) {
 lazyVFPv2();
 flags |= FLAGS_VFPV2_USED;
@@ -402,6 +410,12 @@ public:
 addr, sizeof(fpreg[0]) / 2);
 } else {
   if (num <= REGNO_ARM32_D15) {
+	/*
+	 * XXX
+	 * See XXX comment above.
+	 */
+assert((flags & FLAGS_LEGACY_VFPV2_REGNO) == 0);
+flags |= FLAGS_EXTENDED_VFPV2_REGNO;
 if ((flags & FLAGS_VFPV2_USED) == 0) {
   lazyVFPv2();
   flags |= FLAGS_VFPV2_USED;
@@ -428,6 +442,8 @@ private:
   enum {
 FLAGS_VFPV2_USED = 0x1,
 FLAGS_VFPV3_USED = 0x2,
+FLAGS_LEGACY_VFPV2_REGNO = 0x4,
+FLAGS_EXTENDED_VFPV2_REGNO = 0x8,
   };
 };
 



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:57:28 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Fix logic error in copyFloatVectorRegister() for arm; copy s0-s31 or
d0-d31, not both.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.25 src/sys/lib/libunwind/Registers.hpp:1.26
--- src/sys/lib/libunwind/Registers.hpp:1.25	Mon May 31 11:54:01 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:57:28 2021
@@ -400,19 +400,20 @@ public:
 #endif
   memcpy((uint8_t *)(fpreg + dnum) + part * sizeof(fpreg[0]) / 2,
 addr, sizeof(fpreg[0]) / 2);
-}
-if (num <= REGNO_ARM32_D15) {
-  if ((flags & FLAGS_VFPV2_USED) == 0) {
-lazyVFPv2();
-flags |= FLAGS_VFPV2_USED;
-  }
 } else {
-  if ((flags & FLAGS_VFPV3_USED) == 0) {
-lazyVFPv3();
-flags |= FLAGS_VFPV3_USED;
+  if (num <= REGNO_ARM32_D15) {
+if ((flags & FLAGS_VFPV2_USED) == 0) {
+  lazyVFPv2();
+  flags |= FLAGS_VFPV2_USED;
+}
+  } else {
+if ((flags & FLAGS_VFPV3_USED) == 0) {
+  lazyVFPv3();
+  flags |= FLAGS_VFPV3_USED;
+}
   }
+  memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0]));
 }
-memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0]));
   }
 
   __dso_hidden void lazyVFPv2();



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:54:01 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Fix pointer arithmetic when copying s0-s31 registers for arm.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.24 src/sys/lib/libunwind/Registers.hpp:1.25
--- src/sys/lib/libunwind/Registers.hpp:1.24	Mon May 31 11:50:43 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:54:01 2021
@@ -398,7 +398,7 @@ public:
 #if _BYTE_ORDER == _BIG_ENDIAN
   part = 1 - part;
 #endif
-  memcpy(fpreg + dnum + part * sizeof(fpreg[0]) / 2,
+  memcpy((uint8_t *)(fpreg + dnum) + part * sizeof(fpreg[0]) / 2,
 addr, sizeof(fpreg[0]) / 2);
 }
 if (num <= REGNO_ARM32_D15) {



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:50:43 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

Fix DWARF/internal register numbers of s31 for arm.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.23 src/sys/lib/libunwind/Registers.hpp:1.24
--- src/sys/lib/libunwind/Registers.hpp:1.23	Mon May 31 11:44:06 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:50:43 2021
@@ -318,7 +318,7 @@ enum {
   DWARF_ARM32_R15 = 15,
   DWARF_ARM32_SPSR = 128,
   DWARF_ARM32_S0 = 64,
-  DWARF_ARM32_S31 = 91,
+  DWARF_ARM32_S31 = 95,
   DWARF_ARM32_D0 = 256,
   DWARF_ARM32_D31 = 287,
   REGNO_ARM32_R0 = 0,
@@ -329,7 +329,7 @@ enum {
   REGNO_ARM32_D15 = 32,
   REGNO_ARM32_D31 = 48,
   REGNO_ARM32_S0 = 49,
-  REGNO_ARM32_S31 = 70,
+  REGNO_ARM32_S31 = 80,
 };
 
 class Registers_arm32 {



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:47:18 UTC 2021

Modified Files:
src/sys/lib/libunwind: unwind_registers.S

Log Message:
PR toolchain/55837

Fix for jumpto() armeb; use word-wise load for flags, instead of byte-wise one.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/lib/libunwind/unwind_registers.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/lib/libunwind/unwind_registers.S
diff -u src/sys/lib/libunwind/unwind_registers.S:1.19 src/sys/lib/libunwind/unwind_registers.S:1.20
--- src/sys/lib/libunwind/unwind_registers.S:1.19	Mon May 31 11:41:22 2021
+++ src/sys/lib/libunwind/unwind_registers.S	Mon May 31 11:47:18 2021
@@ -380,7 +380,7 @@ END(_ZN7_Unwind15Registers_arm329lazyVFP
 
 	.hidden _ZNK7_Unwind15Registers_arm326jumptoEv
 ARM_ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv)
-	ldrb	r1, [r0, #68]	/* flags */
+	ldr	r1, [r0, #68]	/* flags */
 	tst	r1, #1
 	beq	.Lnovfpv2
 	add	r2, r0, #72



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:44:07 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
PR toolchain/55837

copyFloatVectorRegister(): Assert register number is valid to make sure.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.22 src/sys/lib/libunwind/Registers.hpp:1.23
--- src/sys/lib/libunwind/Registers.hpp:1.22	Mon May 31 11:41:22 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:44:06 2021
@@ -382,6 +382,7 @@ public:
   }
 
   void copyFloatVectorRegister(int num, uint64_t addr_) {
+assert(validFloatVectorRegister(num));
 const void *addr = reinterpret_cast(addr_);
 if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) {
   if ((flags & FLAGS_VFPV2_USED) == 0) {



CVS commit: src/sys/lib/libunwind

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:41:22 UTC 2021

Modified Files:
src/sys/lib/libunwind: Registers.hpp unwind_registers.S

Log Message:
PR toolchain/55837

Misc style fixes for clarity:

- Rename lazyVFP1() and lazyVFP3() to lazyVFPv2() and lazyVFPv3(),
  respectively. Note that VFPv1 was obsoleted and replaced by VFPv2.

- Introduce enum for flags.

- Add few comments.

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/lib/libunwind/Registers.hpp
cvs rdiff -u -r1.18 -r1.19 src/sys/lib/libunwind/unwind_registers.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/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.21 src/sys/lib/libunwind/Registers.hpp:1.22
--- src/sys/lib/libunwind/Registers.hpp:1.21	Tue Feb 23 15:09:27 2021
+++ src/sys/lib/libunwind/Registers.hpp	Mon May 31 11:41:22 2021
@@ -350,9 +350,8 @@ public:
   return REGNO_ARM32_SPSR;
 if (num >= DWARF_ARM32_D0 && num <= DWARF_ARM32_D31)
   return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0);
-if (num >= DWARF_ARM32_S0 && num <= DWARF_ARM32_S31) {
+if (num >= DWARF_ARM32_S0 && num <= DWARF_ARM32_S31)
   return REGNO_ARM32_S0 + (num - DWARF_ARM32_S0);
-}
 return LAST_REGISTER + 1;
   }
 
@@ -385,9 +384,9 @@ public:
   void copyFloatVectorRegister(int num, uint64_t addr_) {
 const void *addr = reinterpret_cast(addr_);
 if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) {
-  if ((flags & 1) == 0) {
-lazyVFP1();
-flags |= 1;
+  if ((flags & FLAGS_VFPV2_USED) == 0) {
+lazyVFPv2();
+flags |= FLAGS_VFPV2_USED;
   }
   /*
* Emulate single precision register as half of the
@@ -402,27 +401,32 @@ public:
 addr, sizeof(fpreg[0]) / 2);
 }
 if (num <= REGNO_ARM32_D15) {
-  if ((flags & 1) == 0) {
-lazyVFP1();
-flags |= 1;
+  if ((flags & FLAGS_VFPV2_USED) == 0) {
+lazyVFPv2();
+flags |= FLAGS_VFPV2_USED;
   }
 } else {
-  if ((flags & 2) == 0) {
-lazyVFP3();
-flags |= 2;
+  if ((flags & FLAGS_VFPV3_USED) == 0) {
+lazyVFPv3();
+flags |= FLAGS_VFPV3_USED;
   }
 }
 memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0]));
   }
 
-  __dso_hidden void lazyVFP1();
-  __dso_hidden void lazyVFP3();
+  __dso_hidden void lazyVFPv2();
+  __dso_hidden void lazyVFPv3();
   __dso_hidden void jumpto() const __dead;
 
 private:
   uint32_t reg[REGNO_ARM32_SPSR + 1];
   uint32_t flags;
   uint64_t fpreg[32];
+
+  enum {
+FLAGS_VFPV2_USED = 0x1,
+FLAGS_VFPV3_USED = 0x2,
+  };
 };
 
 enum {

Index: src/sys/lib/libunwind/unwind_registers.S
diff -u src/sys/lib/libunwind/unwind_registers.S:1.18 src/sys/lib/libunwind/unwind_registers.S:1.19
--- src/sys/lib/libunwind/unwind_registers.S:1.18	Tue Feb 23 15:09:27 2021
+++ src/sys/lib/libunwind/unwind_registers.S	Mon May 31 11:41:22 2021
@@ -360,37 +360,37 @@ ARM_ENTRY(_ZN7_Unwind15Registers_arm32C1
 	mrs	r1, cpsr
 	str	r1, [r0, #64]	/* CPSR */
 	mov	r1, #0
-	str	r1, [r0, #68]
+	str	r1, [r0, #68]	/* flags */
 	RET
 END(_ZN7_Unwind15Registers_arm32C1Ev)
 
-	.hidden _ZN7_Unwind15Registers_arm328lazyVFP1Ev
-ARM_ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev)
+	.hidden _ZN7_Unwind15Registers_arm329lazyVFPv2Ev
+ARM_ENTRY(_ZN7_Unwind15Registers_arm329lazyVFPv2Ev)
 	add	r0, #72
 	vstmia	r0, {d0-d15}
 	RET
-END(_ZN7_Unwind15Registers_arm328lazyVFP1Ev)
+END(_ZN7_Unwind15Registers_arm329lazyVFPv2Ev)
 
-	.hidden _ZN7_Unwind15Registers_arm328lazyVFP3Ev
-ARM_ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev)
+	.hidden _ZN7_Unwind15Registers_arm329lazyVFPv3Ev
+ARM_ENTRY(_ZN7_Unwind15Registers_arm329lazyVFPv3Ev)
 	add	r0, #200
 	vstmia	r0, {d16-d31}
 	RET
-END(_ZN7_Unwind15Registers_arm328lazyVFP3Ev)
+END(_ZN7_Unwind15Registers_arm329lazyVFPv3Ev)
 
 	.hidden _ZNK7_Unwind15Registers_arm326jumptoEv
 ARM_ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv)
-	ldrb	r1, [r0, #68]
+	ldrb	r1, [r0, #68]	/* flags */
 	tst	r1, #1
-	beq	.Lnovfp1
+	beq	.Lnovfpv2
 	add	r2, r0, #72
 	vldmia	r2, {d0-d15}
-.Lnovfp1:
+.Lnovfpv2:
 	tst	r1, #2
-	beq	.Lnovfp3
+	beq	.Lnovfpv3
 	add	r2, r0, #200
 	vldmia	r2, {d16-d31}
-.Lnovfp3:
+.Lnovfpv3:
 	ldr	r1, [r0, #64]
 	msr	cpsr_sxc, r1
 	ldmia	r0, {r0-r15}



CVS commit: src/sys/stand/efiboot

2021-05-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 31 11:12:42 UTC 2021

Modified Files:
src/sys/stand/efiboot: boot.c

Log Message:
Generalize boot.cfg workaround for ISO9660; fallback to default_device
whenever efi_file_path() fails (due to broken firmware), in addition to
the case of ISO9660 (for which efi_file_path() succeeds but does not
work correctly).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/stand/efiboot/boot.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/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.29 src/sys/stand/efiboot/boot.c:1.30
--- src/sys/stand/efiboot/boot.c:1.29	Sat Nov 28 14:02:09 2020
+++ src/sys/stand/efiboot/boot.c	Mon May 31 11:12:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.29 2020/11/28 14:02:09 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.30 2021/05/31 11:12:42 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -132,22 +132,18 @@ const struct boot_command commands[] = {
 static int
 bootcfg_path(char *pathbuf, size_t pathbuflen)
 {
-	/*
-	 * Special handling of boot.cfg on ISO9660 because fs protocol doesn't
-	 * seem to work.
-	 */
-	if (default_fstype == FS_ISO9660) {
-		snprintf(pathbuf, pathbuflen, "%s:%s", default_device, BOOTCFG_FILENAME);
-		return 0;
-	}
 
 	/*
-	 * Fall back to fs protocol for loading boot.cfg
+	 * Fallback to default_device
+	 * - for ISO9660 (efi_file_path() succeeds but does not work correctly)
+	 * - or whenever efi_file_path() fails (due to broken firmware)
 	 */
-	if (efi_bootdp == NULL)
-		return ENXIO;
+	if (default_fstype == FS_ISO9660 || efi_bootdp == NULL ||
+	efi_file_path(efi_bootdp, BOOTCFG_FILENAME, pathbuf, pathbuflen))
+		snprintf(pathbuf, pathbuflen, "%s:%s", default_device,
+		BOOTCFG_FILENAME);
 
-	return efi_file_path(efi_bootdp, BOOTCFG_FILENAME, pathbuf, pathbuflen);
+	return 0;
 }
 
 void



CVS commit: src/sys/arch/arm/include/arm32

2021-05-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 30 07:20:00 UTC 2021

Modified Files:
src/sys/arch/arm/include/arm32: param.h

Log Message:
Include opt_param.h for MSGBUFSIZE ifdef _KERNEL_OPT.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/include/arm32/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/arm/include/arm32/param.h
diff -u src/sys/arch/arm/include/arm32/param.h:1.33 src/sys/arch/arm/include/arm32/param.h:1.34
--- src/sys/arch/arm/include/arm32/param.h:1.33	Fri Jul 10 12:25:09 2020
+++ src/sys/arch/arm/include/arm32/param.h	Sun May 30 07:20:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.33 2020/07/10 12:25:09 skrll Exp $	*/
+/*	$NetBSD: param.h,v 1.34 2021/05/30 07:20:00 rin Exp $	*/
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe.
@@ -38,6 +38,7 @@
 #ifdef _KERNEL_OPT
 #include "opt_arm32_pmap.h"
 #include "opt_kasan.h"
+#include "opt_param.h"
 #endif
 
 /*



CVS commit: src/sys/arch/aarch64/aarch64

2021-05-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May 30 05:40:57 UTC 2021

Modified Files:
src/sys/arch/aarch64/aarch64: netbsd32_machdep.c

Log Message:
Fix conversion between aarch64 and aarch32 fpreg's; in aarch32 mode,
d0-d31 are packed into v0-v15 (== q0-q15).

This fixes crashes in VFP-optimized codes running on COMPAT_NETBSD32.

OK ryo


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/aarch64/netbsd32_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/aarch64/aarch64/netbsd32_machdep.c
diff -u src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.17 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.18
--- src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.17	Fri Dec 11 18:03:33 2020
+++ src/sys/arch/aarch64/aarch64/netbsd32_machdep.c	Sun May 30 05:40:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.17 2020/12/11 18:03:33 skrll Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.18 2021/05/30 05:40:56 rin Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.17 2020/12/11 18:03:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.18 2021/05/30 05:40:56 rin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -158,7 +158,7 @@ netbsd32_process_read_fpregs(struct lwp 
 {
 	struct proc * const p = l->l_proc;
 	struct pcb * const pcb = lwp_getpcb(l);
-	int i;
+	int i, j;
 
 	if ((p->p_flag & PK_32) == 0)
 		return EINVAL;
@@ -180,11 +180,17 @@ netbsd32_process_read_fpregs(struct lwp 
 	fpregs->fpr_vfp.vfp_fpinst = 0;
 	fpregs->fpr_vfp.vfp_fpinst2 = 0;
 
-	for (i = 0; i < 32; i++) {
+	for (i = j = 0; i < 16; i++) {
 #ifdef __AARCH64EB__
-		fpregs->fpr_vfp.vfp_regs[i] = pcb->pcb_fpregs.fp_reg[i].u64[1];
+		fpregs->fpr_vfp.vfp_regs[j++] =
+		pcb->pcb_fpregs.fp_reg[i].u64[1];
+		fpregs->fpr_vfp.vfp_regs[j++] =
+		pcb->pcb_fpregs.fp_reg[i].u64[0];
 #else
-		fpregs->fpr_vfp.vfp_regs[i] = pcb->pcb_fpregs.fp_reg[i].u64[0];
+		fpregs->fpr_vfp.vfp_regs[j++] =
+		pcb->pcb_fpregs.fp_reg[i].u64[0];
+		fpregs->fpr_vfp.vfp_regs[j++] =
+		pcb->pcb_fpregs.fp_reg[i].u64[1];
 #endif
 	}
 
@@ -226,7 +232,7 @@ netbsd32_process_write_fpregs(struct lwp
 {
 	struct proc * const p = l->l_proc;
 	struct pcb * const pcb = lwp_getpcb(l);
-	int i;
+	int i, j;
 
 	if ((p->p_flag & PK_32) == 0)
 		return EINVAL;
@@ -237,17 +243,18 @@ netbsd32_process_write_fpregs(struct lwp
 	pcb->pcb_fpregs.fpsr = fpregs->fpr_vfp.vfp_fpscr & FPSR_BITS;
 	pcb->pcb_fpregs.fpcr = fpregs->fpr_vfp.vfp_fpscr & FPCR_BITS;
 
-	CTASSERT(__arraycount(fpregs->fpr_vfp.vfp_regs) ==
-	__arraycount(pcb->pcb_fpregs.fp_reg) + 1);
-	for (i = 0; i < __arraycount(pcb->pcb_fpregs.fp_reg); i++) {
+	for (i = j = 0; i < 16; i++) {
 #ifdef __AARCH64EB__
-		pcb->pcb_fpregs.fp_reg[i].u64[0] = 0;
 		pcb->pcb_fpregs.fp_reg[i].u64[1] =
+		fpregs->fpr_vfp.vfp_regs[j++];
+		pcb->pcb_fpregs.fp_reg[i].u64[0] =
+		fpregs->fpr_vfp.vfp_regs[j++];
 #else
-		pcb->pcb_fpregs.fp_reg[i].u64[1] = 0;
 		pcb->pcb_fpregs.fp_reg[i].u64[0] =
+		fpregs->fpr_vfp.vfp_regs[j++];
+		pcb->pcb_fpregs.fp_reg[i].u64[1] =
+		fpregs->fpr_vfp.vfp_regs[j++];
 #endif
-		fpregs->fpr_vfp.vfp_regs[i];
 	}
 
 	return 0;
@@ -458,18 +465,21 @@ cpu_getmcontext32(struct lwp *l, mcontex
 	/* fpu context */
 	if (fpu_used_p(l)) {
 		const struct pcb * const pcb = lwp_getpcb(l);
-		int i;
+		int i, j;
 
 		fpu_save(l);
 
-		CTASSERT(__arraycount(mcp->__vfpregs.__vfp_fstmx) ==
-		__arraycount(pcb->pcb_fpregs.fp_reg));
-		for (i = 0; i < __arraycount(pcb->pcb_fpregs.fp_reg); i++) {
-			mcp->__vfpregs.__vfp_fstmx[i] =
+		for (i = j = 0; i < 16; i++) {
 #ifdef __AARCH64EB__
+			mcp->__vfpregs.__vfp_fstmx[j++] =
 			pcb->pcb_fpregs.fp_reg[i].u64[1];
+			mcp->__vfpregs.__vfp_fstmx[j++] =
+			pcb->pcb_fpregs.fp_reg[i].u64[0];
 #else
+			mcp->__vfpregs.__vfp_fstmx[j++] =
 			pcb->pcb_fpregs.fp_reg[i].u64[0];
+			mcp->__vfpregs.__vfp_fstmx[j++] =
+			pcb->pcb_fpregs.fp_reg[i].u64[1];
 #endif
 		}
 
@@ -491,7 +501,7 @@ cpu_setmcontext32(struct lwp *l, const m
 	struct trapframe * const tf = l->l_md.md_utf;
 	const __greg32_t * const gr = mcp->__gregs;
 	struct proc * const p = l->l_proc;
-	int error, i;
+	int error, i, j;
 
 	if (flags & _UC_CPU) {
 		error = cpu_mcontext32_validate(l, mcp);
@@ -521,17 +531,18 @@ cpu_setmcontext32(struct lwp *l, const m
 		struct pcb * const pcb = lwp_getpcb(l);
 		fpu_discard(l, true);
 
-		CTASSERT(__arraycount(mcp->__vfpregs.__vfp_fstmx) ==
-		__arraycount(pcb->pcb_fpregs.fp_reg));
-		for (i = 0; i < __arraycount(pcb->pcb_fpregs.fp_reg); i++) {
+		for (i = j = 0; i < 16; i++) {
 #ifdef __AARCH64EB__
-			pcb->pcb_fpregs.fp_reg[i].u64[0] = 0;
 			pcb->pcb_fpregs.fp_reg[i].u64[1] =
+			mcp->__vfpregs.__vfp_fstmx[j++];
+			pcb->pcb_fpregs.fp_reg[i].u64[0] 

CVS commit: src/share/mk

2021-05-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 29 12:25:08 UTC 2021

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Switch mac68k to Xorg server 1.20. Only available driver is wsfb(4) both
for 1.10 and 1.20, and there is no reason to stay with 1.10.

XXX
1.20 works fine on WSFB* kernels with genfb(4), whereas both 1.10 and
1.20 fail for GENERIC* kernels with macfb(4) as some mandatory ioctl's
are missing. It would be better to make genfb(4) default before netbsd-10
is branched.


To generate a diff of this commit:
cvs rdiff -u -r1.1254 -r1.1255 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1254 src/share/mk/bsd.own.mk:1.1255
--- src/share/mk/bsd.own.mk:1.1254	Thu May 27 21:02:56 2021
+++ src/share/mk/bsd.own.mk	Sat May 29 12:25:08 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1254 2021/05/27 21:02:56 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1255 2021/05/29 12:25:08 rin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1581,7 +1581,6 @@ X11SRCDIR.${_proto}proto?=		${X11SRCDIRM
 .if \
 ${MACHINE} == "alpha"	|| \
 ${MACHINE} == "amiga"	|| \
-${MACHINE} == "mac68k"	|| \
 ${MACHINE} == "netwinder"	|| \
 ${MACHINE} == "sgimips"	|| \
 ${MACHINE} == "vax"



CVS commit: src/external/mit/xorg/server/drivers/xf86-input-keyboard

2021-05-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 29 12:15:32 UTC 2021

Modified Files:
src/external/mit/xorg/server/drivers/xf86-input-keyboard: Makefile

Log Message:
Make wskbd(4) default for mac68k; no other protocol is available.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.16 src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.17
--- src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile:1.16	Mon Dec 31 11:58:43 2018
+++ src/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile	Sat May 29 12:15:32 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2018/12/31 11:58:43 mrg Exp $
+#	$NetBSD: Makefile,v 1.17 2021/05/29 12:15:32 rin Exp $
 
 DRIVER=		xf86-input-keyboard
 DRIVER_NAME=	kbd_drv
@@ -16,7 +16,7 @@ CPPFLAGS+=	-DPCVT_SUPPORT
 .if ${MACHINE_ARCH} == "powerpc" || ${MACHINE} == "sparc" || \
 ${MACHINE} == "sparc64" || ${MACHINE} == "sgimips" || \
 ${MACHINE} == "shark" || ${MACHINE} == "vax" || \
-${MACHINE} == "evbarm"
+${MACHINE} == "evbarm" || ${MACHINE} == "mac68k"
 CPPFLAGS+=	-DDEFAULT_TO_WSKBD
 .endif
 



CVS commit: src/etc/etc.evbarm

2021-05-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu May 27 08:43:02 UTC 2021

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Switch arm64.img to big-endian for aarch64eb, as libsa/efiboot support
bi-endian FFS/disklabel now.

Many thanks to mrg@ for working on this!!


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/etc/etc.evbarm/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/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.122 src/etc/etc.evbarm/Makefile.inc:1.123
--- src/etc/etc.evbarm/Makefile.inc:1.122	Tue Dec  1 04:20:21 2020
+++ src/etc/etc.evbarm/Makefile.inc	Thu May 27 08:43:02 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.122 2020/12/01 04:20:21 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.123 2021/05/27 08:43:02 rin Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -12,12 +12,7 @@ EVBARM_BOARDS=
 EVBARM_BOARDS.${i}=
 .endfor
 
-.if ${MACHINE_ARCH} == "aarch64eb"
-# For AArch64 BE images, we need a LE image for efiboot to be able to
-# read the target file-system (no libsa FFS EI support).
-IMAGEENDIAN=	le
-KERNEL_SETS.arm64+=		GENERIC64
-.elif !empty(MACHINE_ARCH:M*eb)
+.if !empty(MACHINE_ARCH:M*eb)
 IMAGEENDIAN=	be
 # big endian boards
 KERNEL_SETS.armv4+=		IXM1200
@@ -32,6 +27,7 @@ KERNEL_SETS.armv6hf+=	 	RPI2
 
 KERNEL_SETS.armv7+=		GENERIC
 KERNEL_SETS.armv7hf+=		GENERIC
+KERNEL_SETS.arm64+=		GENERIC64
 .else
 IMAGEENDIAN=	le
 # little endian boards



CVS commit: src/external/bsd/nvi/dist/regex

2021-05-16 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 17 04:01:58 UTC 2021

Modified Files:
src/external/bsd/nvi/dist/regex: regcomp.c

Log Message:
Fix search for collating symbols in form of [[.foo.]], as in a similar
manner as already done for POSIX character classes by upstream:

https://github.com/visrc/nvi/commit/fd5795cc9890581b9783a0ff96e0b44d6b38e26a#diff-42d58222b328681b9923634991312932089876a0242f78cf488157aa24969c1a

(We already have this change since initial import to external/bsd/nvi.)

Found by tnozaki. Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/nvi/dist/regex/regcomp.c

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

Modified files:

Index: src/external/bsd/nvi/dist/regex/regcomp.c
diff -u src/external/bsd/nvi/dist/regex/regcomp.c:1.7 src/external/bsd/nvi/dist/regex/regcomp.c:1.8
--- src/external/bsd/nvi/dist/regex/regcomp.c:1.7	Sun Nov 12 16:33:31 2017
+++ src/external/bsd/nvi/dist/regex/regcomp.c	Mon May 17 04:01:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: regcomp.c,v 1.7 2017/11/12 16:33:31 christos Exp $ */
+/*	$NetBSD: regcomp.c,v 1.8 2021/05/17 04:01:57 rin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
@@ -44,7 +44,7 @@
 static char sccsid[] = "@(#)regcomp.c	8.4 (Berkeley) 3/19/94";
 #endif /* LIBC_SCCS and not lint */
 #else
-__RCSID("$NetBSD: regcomp.c,v 1.7 2017/11/12 16:33:31 christos Exp $");
+__RCSID("$NetBSD: regcomp.c,v 1.8 2021/05/17 04:01:57 rin Exp $");
 #endif
 
 #include 
@@ -934,7 +934,7 @@ p_b_coll_elem(struct parse *p, int endc)
 	}
 	len = p->next - sp;
 	for (cp = cnames; cp->name != NULL; cp++)
-		if (STRLEN(cp->name) == len && MEMCMP(cp->name, sp, len))
+		if (STRLEN(cp->name) == len && !MEMCMP(cp->name, sp, len))
 			return(cp->code);	/* known name */
 	if (len == 1)
 		return(*sp);	/* single character */



CVS commit: src/sys/arch/aarch64/aarch64

2021-05-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 15 11:39:20 UTC 2021

Modified Files:
src/sys/arch/aarch64/aarch64: aarch32_syscall.c

Log Message:
Wrap long line. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/aarch32_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/aarch64/aarch64/aarch32_syscall.c
diff -u src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.4 src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.5
--- src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.4	Sat May 15 11:38:26 2021
+++ src/sys/arch/aarch64/aarch64/aarch32_syscall.c	Sat May 15 11:39:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch32_syscall.c,v 1.4 2021/05/15 11:38:26 rin Exp $	*/
+/*	$NetBSD: aarch32_syscall.c,v 1.5 2021/05/15 11:39:20 rin Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aarch32_syscall.c,v 1.4 2021/05/15 11:38:26 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aarch32_syscall.c,v 1.5 2021/05/15 11:39:20 rin Exp $");
 
 #include 
 #include 
@@ -151,7 +151,8 @@ EMULNAME(syscall)(struct trapframe *tf)
 	do_trace = p->p_trace_enabled &&
 	((callp->sy_flags & SYCALL_INDIRECT) == 0);
 	if (__predict_false(do_trace ||
-	KDTRACE_ENTRY(callp->sy_entry) || KDTRACE_ENTRY(callp->sy_return))) {
+	KDTRACE_ENTRY(callp->sy_entry) ||
+	KDTRACE_ENTRY(callp->sy_return))) {
 		/* build 64bit args for trace_enter()/trace_exit() */
 		int nargs = callp->sy_narg;
 		for (i = 0; i < nargs; i++)



CVS commit: src/sys/arch/aarch64/aarch64

2021-05-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 15 11:38:26 UTC 2021

Modified Files:
src/sys/arch/aarch64/aarch64: aarch32_syscall.c

Log Message:
Fix __syscall(2) for COMPAT_NETBSD32 on aarch64{,eb}.

The 1st argument for __syscall(2) is quad_t, which is stored in r0 and r1.

Now, tests/lib/libc/t_syscall:mmap___syscall passes for COMPAT_NETBSD32.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/aarch32_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/aarch64/aarch64/aarch32_syscall.c
diff -u src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.3 src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.4
--- src/sys/arch/aarch64/aarch64/aarch32_syscall.c:1.3	Fri Apr 12 09:29:26 2019
+++ src/sys/arch/aarch64/aarch64/aarch32_syscall.c	Sat May 15 11:38:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch32_syscall.c,v 1.3 2019/04/12 09:29:26 ryo Exp $	*/
+/*	$NetBSD: aarch32_syscall.c,v 1.4 2021/05/15 11:38:26 rin Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aarch32_syscall.c,v 1.3 2019/04/12 09:29:26 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aarch32_syscall.c,v 1.4 2021/05/15 11:38:26 rin Exp $");
 
 #include 
 #include 
@@ -91,9 +91,24 @@ EMULNAME(syscall)(struct trapframe *tf)
 	code %= EMULNAMEU(SYS_NSYSENT);
 	callp = p->p_emul->e_sysent + code;
 	if (__predict_false(callp->sy_flags & SYCALL_INDIRECT)) {
-		nargs_reg -= 1;
-		regstart = 1;	/* args start from r1 */
-		code = tf->tf_reg[0] % EMULNAMEU(SYS_NSYSENT);
+		int off = 1;
+#ifdef NETBSD32_SYS_netbsd32syscall /* XXX ugly: apply only for NETBSD32 */
+		/*
+		 * For __syscall(2), 1st argument is quad_t, which is
+		 * stored in r0 and r1.
+		 */
+		if (code == NETBSD32_SYS_netbsd32syscall)
+			off = 2;
+#endif
+		nargs_reg -= off;
+		regstart = off;	/* args start from r1 or r2 */
+#ifdef __AARCH64EB__
+		if (off == 2)
+			code = tf->tf_reg[1];
+		else
+#endif
+			code = tf->tf_reg[0];
+		code %= EMULNAMEU(SYS_NSYSENT);
 		callp = p->p_emul->e_sysent + code;
 
 		/* don't allow nested syscall */



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-05-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue May 11 01:47:21 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Cherry-pick upstream fix for GCC10 regression to -misel option.

Assembler codes generated by GCC are identical with that of our local
fix in rev 1.26 for 32-bit processors, and no significant changes for
64-bit processors also.

master: https://gcc.gnu.org/g:6156df483fa50a08f561b6c248819f2992aa380d
gcc-10: https://gcc.gnu.org/g:5f665c1ca452673e9812cd92b07bd31441c0ac5b
(diffs are same)

commit r12-9-g6156df483fa50a08f561b6c248819f2992aa380d
Author: Segher Boessenkool 
Date:   Tue Apr 20 12:00:50 2021 +

rs6000: Fix cpu selection w/ isel (PR100108)

There are various non-IBM CPUs with isel as well, so it is easiest if we
just don't consider that flag here (it is not needed).

2021-04-20  Segher Boessenkool  

PR target/100108
* config/rs6000/rs6000.c (rs6000_machine_from_flags): Do not 
consider
OPTION_MASK_ISEL.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.28 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.29
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.28	Tue May 11 01:39:09 2021
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	Tue May 11 01:47:20 2021
@@ -5550,7 +5550,7 @@ rs6000_machine_from_flags (void)
   HOST_WIDE_INT flags = rs6000_isa_flags;
 
   /* Disable the flags that should never influence the .machine selection.  */
-  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT);
+  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL);
 
   if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
 return "power10";



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-05-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue May 11 01:39:09 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
In preparation to import upstream fix, revert our local fix in rev 1.26:

http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c#rev1.26

> Fix regression introduced to GCC10, where it wrongly recognizes 32-bit
> processors as POWER9 if -misel flag is specified.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.27 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.28
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.27	Fri Apr 16 02:33:28 2021
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	Tue May 11 01:39:09 2021
@@ -5552,8 +5552,6 @@ rs6000_machine_from_flags (void)
   /* Disable the flags that should never influence the .machine selection.  */
   flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT);
 
-  if ((flags & OPTION_MASK_POWERPC64) == 0)
-return "ppc";
   if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
 return "power10";
   if ((flags & (ISA_3_0_MASKS_SERVER & ~ISA_2_7_MASKS_SERVER)) != 0)
@@ -5568,7 +5566,9 @@ rs6000_machine_from_flags (void)
 return "power5";
   if ((flags & ISA_2_1_MASKS) != 0)
 return "power4";
-  return "ppc64";
+  if ((flags & OPTION_MASK_POWERPC64) != 0)
+return "ppc64";
+  return "ppc";
 }
 
 void



CVS commit: src/sys/dev/pci/ixgbe

2021-05-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue May 11 01:30:30 UTC 2021

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
DMA buffer. Also, when the buffer is already freed, do not call
bus_dmamap_unload(9) (no resource leaks with this change).

Otherwise, MMU fault occurs for some bus_dma(9) implementations.

With this fix, X550-T1 and X540-T1 work fine on alpha (at least
DS10 with PCI-PCIe reverse bridge).

Discussed with msaitoh. Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/ixgbe/ix_txrx.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/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.71 src/sys/dev/pci/ixgbe/ix_txrx.c:1.72
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.71	Fri Apr 30 06:55:32 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue May 11 01:30:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.71 2021/04/30 06:55:32 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.72 2021/05/11 01:30:30 rin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.71 2021/04/30 06:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.72 2021/05/11 01:30:30 rin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1766,16 +1766,17 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
 	if (rbuf->fmp != NULL) {/* Partial chain ? */
 		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
 		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
+		ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
 		m_freem(rbuf->fmp);
 		rbuf->fmp = NULL;
 		rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */
 	} else if (rbuf->buf) {
 		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
 		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
+		ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
 		m_free(rbuf->buf);
 		rbuf->buf = NULL;
 	}
-	ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
 
 	rbuf->flags = 0;
 



CVS commit: src/etc/etc.mac68k

2021-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  8 10:08:33 UTC 2021

Modified Files:
src/etc/etc.mac68k: ttys

Log Message:
Turn on constty instead of ttyE0 as done for majority of other ports
in order to make both framebuffer and serial consoles happy.

Also, change TERM from vt220 to vt100 for console and constty
in accordance with other ports.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/etc/etc.mac68k/ttys

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

Modified files:

Index: src/etc/etc.mac68k/ttys
diff -u src/etc/etc.mac68k/ttys:1.20 src/etc/etc.mac68k/ttys:1.21
--- src/etc/etc.mac68k/ttys:1.20	Wed Jun 13 20:49:14 2012
+++ src/etc/etc.mac68k/ttys	Sat May  8 10:08:33 2021
@@ -1,16 +1,16 @@
 #
-#	$NetBSD: ttys,v 1.20 2012/06/13 20:49:14 martin Exp $
+#	$NetBSD: ttys,v 1.21 2021/05/08 10:08:33 rin Exp $
 #	from: @(#)ttys	5.1 (Berkeley) 4/17/89
 #
 # name	gettytype	status		comments
 #
 # If the console is marked insecure, single-user requires
 # the root password.
-console	"/usr/libexec/getty Pc"		vt220	off secure
-constty	"/usr/libexec/getty Pc"		vt220	off secure
+console	"/usr/libexec/getty Pc"		vt100	off secure
+constty	"/usr/libexec/getty Pc"		vt100	on secure
 
 # Define the console that we actually run getty on.
-ttyE0	"/usr/libexec/getty Pc"		wsvt25	on secure
+ttyE0	"/usr/libexec/getty Pc"		wsvt25	off secure
 
 # Mac Build-in serial ports
 ttyZ0	"/usr/libexec/getty std.9600"	unknown off secure



CVS commit: src/distrib/sets/lists/debug

2021-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  8 09:23:37 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
Add missing aiomixer.debug to fix debug build.

XXX
I *really* hope someone(TM) invent better replacement of
distrib/sets/lists...


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.351 src/distrib/sets/lists/debug/mi:1.352
--- src/distrib/sets/lists/debug/mi:1.351	Fri Apr 23 22:50:06 2021
+++ src/distrib/sets/lists/debug/mi	Sat May  8 09:23:37 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.351 2021/04/23 22:50:06 mrg Exp $
+# $NetBSD: mi,v 1.352 2021/05/08 09:23:37 rin Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -460,6 +460,7 @@
 ./usr/libdata/debug/usr/bin/addftinfo.debug	comp-groff-debug	groff,debug
 ./usr/libdata/debug/usr/bin/addr2line.debug	comp-debug-debug	binutils,debug
 ./usr/libdata/debug/usr/bin/agrep.debug		comp-util-debug		debug
+./usr/libdata/debug/usr/bin/aiomixer.debug	comp-audio-debug	debug
 ./usr/libdata/debug/usr/bin/apply.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/apropos.debug	comp-man-debug		debug
 ./usr/libdata/debug/usr/bin/ar.debug		comp-util-debug		binutils,debug



CVS commit: src/sys/arch/vax/vsa

2021-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  8 09:03:30 UTC 2021

Modified Files:
src/sys/arch/vax/vsa: tc_vsbus.c

Log Message:
Catch up with this commit:

http://www.nerv.org/netbsd/?q=id:20210507T165558Z.d4aba9e0e053181f2a98ee4ee43012b50949921b

by which per slot tcs_used flag was obsoleted.

No need to initialize __BIT(0) of sc_slots_used here; it is zero anyway
before calling tcattach().


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/vax/vsa/tc_vsbus.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/vax/vsa/tc_vsbus.c
diff -u src/sys/arch/vax/vsa/tc_vsbus.c:1.9 src/sys/arch/vax/vsa/tc_vsbus.c:1.10
--- src/sys/arch/vax/vsa/tc_vsbus.c:1.9	Fri Jun  9 18:02:40 2017
+++ src/sys/arch/vax/vsa/tc_vsbus.c	Sat May  8 09:03:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tc_vsbus.c,v 1.9 2017/06/09 18:02:40 flxd Exp $	*/
+/*	$NetBSD: tc_vsbus.c,v 1.10 2021/05/08 09:03:30 rin Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tc_vsbus.c,v 1.9 2017/06/09 18:02:40 flxd Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tc_vsbus.c,v 1.10 2021/05/08 09:03:30 rin Exp $");
 
 #include 
 #include 
@@ -252,7 +252,6 @@ tc_vsbus_attach(device_t parent, device_
 	/* Pass pre-mapped space for TC drivers not bus_space'ified yet. */
 	sc->sc_slots[0].tcs_addr = (tc_addr_t)bus_space_vaddr(bst, bsh_slot);
 	sc->sc_slots[0].tcs_cookie = sc;
-	sc->sc_slots[0].tcs_used = 0;
 
 	tba.tba_busname = "tc";
 	/* Tag with custom methods for pre-mapped bus_space. */



CVS commit: src/external/gpl3/gdb.old/lib/libgdb

2021-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri May  7 12:19:48 UTC 2021

Modified Files:
src/external/gpl3/gdb.old/lib/libgdb: Makefile

Log Message:
For GCC10, add -Wno-unused-result for alloca(0) here and there.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gdb.old/lib/libgdb/Makefile

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

Modified files:

Index: src/external/gpl3/gdb.old/lib/libgdb/Makefile
diff -u src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.11 src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.12
--- src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.11	Thu Oct  8 08:31:37 2020
+++ src/external/gpl3/gdb.old/lib/libgdb/Makefile	Fri May  7 12:19:48 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2020/10/08 08:31:37 rin Exp $
+#	$NetBSD: Makefile,v 1.12 2021/05/07 12:19:48 rin Exp $
 
 NOCTF=
 HOSTPROG_CXX=   1
@@ -79,3 +79,6 @@ CLEANDIRFILES+= \
 
 # corelow.c
 CWARNFLAGS.gcc+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -Wno-error=alloca-larger-than= :}
+
+# for alloca(0)
+CWARNFLAGS.gcc+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-unused-result :}



CVS commit: src

2021-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu May  6 13:23:36 UTC 2021

Modified Files:
src/share/mk: bsd.own.mk
src/sys/arch/mvme68k/stand: Makefile Makefile.booters
src/sys/arch/mvme68k/stand/wrtvid: Makefile wrtvid.c
src/tools: Makefile
Added Files:
src/tools/mvme68k-wrtvid: Makefile

Log Message:
PR port-mvme68k/56146

Build wrtvid as tools.


To generate a diff of this commit:
cvs rdiff -u -r1.1246 -r1.1247 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mvme68k/stand/Makefile
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mvme68k/stand/Makefile.booters
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mvme68k/stand/wrtvid/Makefile
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mvme68k/stand/wrtvid/wrtvid.c
cvs rdiff -u -r1.208 -r1.209 src/tools/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/mvme68k-wrtvid/Makefile

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1246 src/share/mk/bsd.own.mk:1.1247
--- src/share/mk/bsd.own.mk:1.1246	Sun Apr 25 21:55:58 2021
+++ src/share/mk/bsd.own.mk	Thu May  6 13:23:36 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1246 2021/04/25 21:55:58 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1247 2021/05/06 13:23:36 rin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -492,6 +492,7 @@ TOOL_MKUBOOTIMAGE=	${TOOLDIR}/bin/${_TOO
 TOOL_ELFTOSB=		${TOOLDIR}/bin/${_TOOL_PREFIX}elftosb
 TOOL_MSGC=		MSGDEF=${TOOLDIR}/share/misc ${TOOLDIR}/bin/${_TOOL_PREFIX}msgc
 TOOL_MTREE=		${TOOLDIR}/bin/${_TOOL_PREFIX}mtree
+TOOL_MVME68KWRTVID=	${TOOLDIR}/bin/${_TOOL_PREFIX}mvme68k-wrtvid
 TOOL_NBPERF=		${TOOLDIR}/bin/${_TOOL_PREFIX}perf
 TOOL_NCDCS=		${TOOLDIR}/bin/${_TOOL_PREFIX}ibmnws-ncdcs
 TOOL_PAX=		${TOOLDIR}/bin/${_TOOL_PREFIX}pax
@@ -606,6 +607,7 @@ TOOL_MKUBOOTIMAGE=	mkubootimage
 TOOL_ELFTOSB=		elftosb
 TOOL_MSGC=		msgc
 TOOL_MTREE=		mtree
+TOOL_MVME68KWRTVID=	wrtvid
 TOOL_NBPERF=		nbperf
 TOOL_NCDCS=		ncdcs
 TOOL_PAX=		pax

Index: src/sys/arch/mvme68k/stand/Makefile
diff -u src/sys/arch/mvme68k/stand/Makefile:1.6 src/sys/arch/mvme68k/stand/Makefile:1.7
--- src/sys/arch/mvme68k/stand/Makefile:1.6	Mon Jan 19 23:09:16 2009
+++ src/sys/arch/mvme68k/stand/Makefile	Thu May  6 13:23:36 2021
@@ -1,10 +1,6 @@
-#	$NetBSD: Makefile,v 1.6 2009/01/19 23:09:16 he Exp $
+#	$NetBSD: Makefile,v 1.7 2021/05/06 13:23:36 rin Exp $
 
 SUBDIR= libbug libsa .WAIT sboot netboot bootxx bootsd bootst \
 	installboot
 
-.ifmake !install
-SUBDIR+= wrtvid
-.endif
-
 .include 

Index: src/sys/arch/mvme68k/stand/Makefile.booters
diff -u src/sys/arch/mvme68k/stand/Makefile.booters:1.27 src/sys/arch/mvme68k/stand/Makefile.booters:1.28
--- src/sys/arch/mvme68k/stand/Makefile.booters:1.27	Thu Apr 15 01:54:39 2021
+++ src/sys/arch/mvme68k/stand/Makefile.booters	Thu May  6 13:23:36 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.booters,v 1.27 2021/04/15 01:54:39 mrg Exp $
+#	$NetBSD: Makefile.booters,v 1.28 2021/05/06 13:23:36 rin Exp $
 
 S?=		${.CURDIR}/../../../..
 MDEC_DIR?=	/usr/mdec
@@ -73,13 +73,6 @@ $(BUGCRT):
 	@echo making sure the bugcrt is up to date...
 	@(cd ${LIB_BUG_DIR}; ${MAKE} bugstart.o)
 
-WRTVID_BOOT_DIR=  ${.CURDIR}/../wrtvid
-WRTVID_DIR!=	cd ${WRTVID_BOOT_DIR} && ${PRINTOBJDIR}
-WRTVID=${WRTVID_DIR}/wrtvid
-
-.PHONY: ${WRTVID}
-${WRTVID}:
-	@echo making sure the wrtvid is up to date...
-	@(cd ${WRTVID_BOOT_DIR}; ${MAKE} dependall)
+WRTVID=	${TOOL_MVME68KWRTVID}
 
 .endif

Index: src/sys/arch/mvme68k/stand/wrtvid/Makefile
diff -u src/sys/arch/mvme68k/stand/wrtvid/Makefile:1.12 src/sys/arch/mvme68k/stand/wrtvid/Makefile:1.13
--- src/sys/arch/mvme68k/stand/wrtvid/Makefile:1.12	Tue May  1 19:59:45 2018
+++ src/sys/arch/mvme68k/stand/wrtvid/Makefile	Thu May  6 13:23:36 2021
@@ -1,12 +1,8 @@
-#	$NetBSD: Makefile,v 1.12 2018/05/01 19:59:45 christos Exp $
+#	$NetBSD: Makefile,v 1.13 2021/05/06 13:23:36 rin Exp $
 
-S=${.CURDIR}/../../../../
+.include 
 
-.include 
+PROG=	wrtvid
+MKMAN=	no
 
-HOSTPROG=	wrtvid
-
-# only needed during build
-proginstall::
-
-.include 
+.include 

Index: src/sys/arch/mvme68k/stand/wrtvid/wrtvid.c
diff -u src/sys/arch/mvme68k/stand/wrtvid/wrtvid.c:1.9 src/sys/arch/mvme68k/stand/wrtvid/wrtvid.c:1.10
--- src/sys/arch/mvme68k/stand/wrtvid/wrtvid.c:1.9	Tue Jan  8 00:00:53 2019
+++ src/sys/arch/mvme68k/stand/wrtvid/wrtvid.c	Thu May  6 13:23:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: wrtvid.c,v 1.9 2019/01/08 00:00:53 rin Exp $	*/
+/*	$NetBSD: wrtvid.c,v 1.10 2021/05/06 13:23:36 rin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -29,6 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 #include 
 #include 
 #include 

Index: src/tools/Makefile
diff -u src/tools/Makefile:1.208 src/tools/Makefile:1.209
--- src/tools/Makefile:1.208	Sun Apr 25 15:11:28 2021
+++ src/tools/Makefile	Thu May  6 13:23:36 

CVS commit: src/sys/arch/amiga/stand/bootblock

2021-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu May  6 13:07:00 UTC 2021

Modified Files:
src/sys/arch/amiga/stand/bootblock: Makefile

Log Message:
Unhook elf2bb and txlt as they are built as tools.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/stand/bootblock/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/amiga/stand/bootblock/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/Makefile:1.5 src/sys/arch/amiga/stand/bootblock/Makefile:1.6
--- src/sys/arch/amiga/stand/bootblock/Makefile:1.5	Thu Feb 25 03:42:14 2021
+++ src/sys/arch/amiga/stand/bootblock/Makefile	Thu May  6 13:07:00 2021
@@ -1,15 +1,7 @@
-#	$NetBSD: Makefile,v 1.5 2021/02/25 03:42:14 rin Exp $
+#	$NetBSD: Makefile,v 1.6 2021/05/06 13:07:00 rin Exp $
 
 .include 
 
-# Don't install these, but make them first:
-.ifnmake install
-SUBDIR=txlt
-SUBDIR+=elf2bb
-.endif
-
-# but these:
 SUBDIR+=boot bootxx_ffs bootxx_ffsv2
 
-
 .include 



CVS commit: src/sys/dev

2021-05-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May  3 10:28:26 UTC 2021

Modified Files:
src/sys/dev/acpi: genet_acpi.c
src/sys/dev/fdt: genet_fdt.c
src/sys/dev/ic: bcmgenet.c bcmgenetvar.h

Log Message:
genet(4): Add support for rnd(9).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/genet_acpi.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/genet_fdt.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/bcmgenet.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/bcmgenetvar.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/dev/acpi/genet_acpi.c
diff -u src/sys/dev/acpi/genet_acpi.c:1.4 src/sys/dev/acpi/genet_acpi.c:1.5
--- src/sys/dev/acpi/genet_acpi.c:1.4	Fri Jan 29 15:49:55 2021
+++ src/sys/dev/acpi/genet_acpi.c	Mon May  3 10:28:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: genet_acpi.c,v 1.4 2021/01/29 15:49:55 thorpej Exp $ */
+/* $NetBSD: genet_acpi.c,v 1.5 2021/05/03 10:28:26 rin Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -29,13 +29,15 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genet_acpi.c,v 1.4 2021/01/29 15:49:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genet_acpi.c,v 1.5 2021/05/03 10:28:26 rin Exp $");
 
 #include 
 #include 
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 

Index: src/sys/dev/fdt/genet_fdt.c
diff -u src/sys/dev/fdt/genet_fdt.c:1.5 src/sys/dev/fdt/genet_fdt.c:1.6
--- src/sys/dev/fdt/genet_fdt.c:1.5	Mon Mar  8 13:15:06 2021
+++ src/sys/dev/fdt/genet_fdt.c	Mon May  3 10:28:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: genet_fdt.c,v 1.5 2021/03/08 13:15:06 mlelstv Exp $ */
+/* $NetBSD: genet_fdt.c,v 1.6 2021/05/03 10:28:26 rin Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,v 1.5 2021/03/08 13:15:06 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,v 1.6 2021/05/03 10:28:26 rin Exp $");
 
 #include 
 #include 
@@ -38,6 +38,8 @@ __KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 

Index: src/sys/dev/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.8 src/sys/dev/ic/bcmgenet.c:1.9
--- src/sys/dev/ic/bcmgenet.c:1.8	Mon Mar  8 13:14:44 2021
+++ src/sys/dev/ic/bcmgenet.c	Mon May  3 10:28:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.8 2021/03/08 13:14:44 mlelstv Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.8 2021/03/08 13:14:44 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $");
 
 #include 
 #include 
@@ -46,6 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -681,6 +683,7 @@ genet_rxintr(struct genet_softc *sc, int
 	int error, index, len, n;
 	struct mbuf *m, *m0;
 	uint32_t status, pidx, total;
+	int pkts = 0;
 
 	pidx = RD4(sc, GENET_RX_DMA_PROD_INDEX(qid)) & 0x;
 	total = (pidx - sc->sc_rx.cidx) & 0x;
@@ -749,6 +752,7 @@ genet_rxintr(struct genet_softc *sc, int
 		m_adj(m, ETHER_ALIGN);
 
 		if_percpuq_enqueue(ifp->if_percpuq, m);
+		++pkts;
 
 next:
 		index = RX_NEXT(index);
@@ -756,6 +760,9 @@ next:
 		sc->sc_rx.cidx = (sc->sc_rx.cidx + 1) & 0x;
 		WR4(sc, GENET_RX_DMA_CONS_INDEX(qid), sc->sc_rx.cidx);
 	}
+
+	if (pkts != 0)
+		rnd_add_uint32(>sc_rndsource, pkts);
 }
 
 static void
@@ -785,6 +792,9 @@ genet_txintr(struct genet_softc *sc, int
 	}
 
 	if_statadd(ifp, if_opackets, pkts);
+
+	if (pkts != 0)
+		rnd_add_uint32(>sc_rndsource, pkts);
 }
 
 static void
@@ -1100,6 +1110,9 @@ genet_attach(struct genet_softc *sc)
 	/* Attach ethernet interface */
 	ether_ifattach(ifp, eaddr);
 
+	rnd_attach_source(>sc_rndsource, ifp->if_xname, RND_TYPE_NET,
+	RND_FLAG_DEFAULT);
+
 	return 0;
 }
 

Index: src/sys/dev/ic/bcmgenetvar.h
diff -u src/sys/dev/ic/bcmgenetvar.h:1.3 src/sys/dev/ic/bcmgenetvar.h:1.4
--- src/sys/dev/ic/bcmgenetvar.h:1.3	Mon Mar  8 13:14:44 2021
+++ src/sys/dev/ic/bcmgenetvar.h	Mon May  3 10:28:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenetvar.h,v 1.3 2021/03/08 13:14:44 mlelstv Exp $ */
+/* $NetBSD: bcmgenetvar.h,v 1.4 2021/05/03 10:28:26 rin Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -70,6 +70,8 @@ struct genet_softc {
 
 	struct genet_ring	sc_tx;
 	struct genet_ring	sc_rx;
+
+	krndsource_t		sc_rndsource;
 };
 
 int	genet_attach(struct genet_softc *);



CVS commit: src/sys/arch/mac68k/mac68k

2021-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 28 02:28:06 UTC 2021

Modified Files:
src/sys/arch/mac68k/mac68k: machdep.c

Log Message:
Change sccA address for Quadra 800 from base + 0xc000 to 0xc020.

The H/W partially decodes its address, and sccA is available at
offsets 0xc000, 0xc020,  The functionality is same, but Mac
toolbox ROM routines use 0xc020, and QEMU for Quadra 800 only
supports this address.

Thanks Mark Cave-Ayland for discussion, who is working on NetBSD
support to QEMU for Quadra 800!


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.362 src/sys/arch/mac68k/mac68k/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/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.361 src/sys/arch/mac68k/mac68k/machdep.c:1.362
--- src/sys/arch/mac68k/mac68k/machdep.c:1.361	Wed Apr 28 02:00:58 2021
+++ src/sys/arch/mac68k/mac68k/machdep.c	Wed Apr 28 02:28:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.361 2021/04/28 02:00:58 rin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.362 2021/04/28 02:28:05 rin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.361 2021/04/28 02:00:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.362 2021/04/28 02:28:05 rin Exp $");
 
 #include "opt_adb.h"
 #include "opt_compat_netbsd.h"
@@ -2122,6 +2122,15 @@ mac68k_set_io_offsets(vaddr_t base)
 			mac68k_machine.scsi96_2 = 1;
 			iop_init(0);	/* For console */
 			break;
+		case MACH_MACQ800:
+			/*
+			 * The H/W partially decode address for sccA; it is
+			 * available at offsets 0xc000, 0xc020,  Here,
+			 * we choose 0xc020, where Mac toolbox ROM uses.
+			 */
+			sccA = (volatile u_char *)base + 0xc020;
+			SCSIBase = base + 0x1;
+			break;
 		case MACH_MACQ700:
 			sccA = (volatile u_char *)base + 0xc000;
 			SCSIBase = base + 0xf000;



CVS commit: src/distrib/sets/lists/comp

2021-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 28 02:15:03 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
config_found_ia.9 and config_found_sm_loc.9 have been obsoleted.
Should fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.2384 -r1.2385 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2384 src/distrib/sets/lists/comp/mi:1.2385
--- src/distrib/sets/lists/comp/mi:1.2384	Wed Apr 28 00:49:22 2021
+++ src/distrib/sets/lists/comp/mi	Wed Apr 28 02:15:03 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2384 2021/04/28 00:49:22 thorpej Exp $
+#	$NetBSD: mi,v 1.2385 2021/04/28 02:15:03 rin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -27833,9 +27833,9 @@
 ./usr/share/man/man9/config_detach_release.9	comp-sys-man		.man
 ./usr/share/man/man9/config_finalize_register.9 comp-sys-man		.man
 ./usr/share/man/man9/config_found.9		comp-sys-man		.man
-./usr/share/man/man9/config_found_ia.9		comp-sys-man		.man
+./usr/share/man/man9/config_found_ia.9		comp-obsolete		obsolete
 ./usr/share/man/man9/config_found_sm.9		comp-obsolete		obsolete
-./usr/share/man/man9/config_found_sm_loc.9	comp-sys-man		.man
+./usr/share/man/man9/config_found_sm_loc.9	comp-sys-man		obsolete
 ./usr/share/man/man9/config_interrupts.9	comp-sys-man		.man
 ./usr/share/man/man9/config_match.9		comp-sys-man		.man
 ./usr/share/man/man9/config_mountroot.9		comp-sys-man		.man



CVS commit: src/sys/arch/mac68k/mac68k

2021-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 28 02:00:59 UTC 2021

Modified Files:
src/sys/arch/mac68k/mac68k: machdep.c

Log Message:
Make mac68k_set_io_offsets() a little bit cleaner:

- Via1Base is always ``base'' for all supported models.
- Set sccA and SCSIBase for each model of MACH_CLASSQ class.
- Some style fixes.

No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.360 -r1.361 src/sys/arch/mac68k/mac68k/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/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.360 src/sys/arch/mac68k/mac68k/machdep.c:1.361
--- src/sys/arch/mac68k/mac68k/machdep.c:1.360	Fri Feb 26 10:54:12 2021
+++ src/sys/arch/mac68k/mac68k/machdep.c	Wed Apr 28 02:00:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.360 2021/02/26 10:54:12 rin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.361 2021/04/28 02:00:58 rin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.360 2021/02/26 10:54:12 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.361 2021/04/28 02:00:58 rin Exp $");
 
 #include "opt_adb.h"
 #include "opt_compat_netbsd.h"
@@ -2110,24 +2110,24 @@ void
 mac68k_set_io_offsets(vaddr_t base)
 {
 
+	Via1Base = (volatile u_char *)base;
+	Via2Base = Via1Base + 0x2000 * VIA2;
 	switch (current_mac_model->class) {
 	case MACH_CLASSQ:
-		Via1Base = (volatile u_char *)base;
-
-		/* The following two may be overridden. */
-		sccA = (volatile u_char *)base + 0xc000;
-		SCSIBase = base + 0xf000;
-
 		switch (current_mac_model->machineid) {
 		case MACH_MACQ900:
 		case MACH_MACQ950:
-			mac68k_machine.scsi96_2 = 1;
 			sccA = (volatile u_char *)base + 0xc020;
+			SCSIBase = base + 0xf000;
+			mac68k_machine.scsi96_2 = 1;
 			iop_init(0);	/* For console */
 			break;
 		case MACH_MACQ700:
+			sccA = (volatile u_char *)base + 0xc000;
+			SCSIBase = base + 0xf000;
 			break;
 		default:
+			sccA = (volatile u_char *)base + 0xc000;
 			SCSIBase = base + 0x1;
 			break;
 		}
@@ -2138,7 +2138,6 @@ mac68k_set_io_offsets(vaddr_t base)
 		 * machines.  This seems to be common on many of the
 		 * Quadra-type machines.
 		 */
-		Via1Base = (volatile u_char *)base;
 		sccA = (volatile u_char *)base + 0xc020;
 		SCSIBase = base + 0x1;
 		break;
@@ -2147,12 +2146,10 @@ mac68k_set_io_offsets(vaddr_t base)
 		 * Here's a queer bird... it seems to be a cross between
 		 * the two different Quadra classes.
 		 */
-		Via1Base = (volatile u_char *) base;
-		sccA = (volatile u_char *) base + 0xc020;
+		sccA = (volatile u_char *)base + 0xc020;
 		SCSIBase = base;
 		break;
 	case MACH_CLASSAV:
-		Via1Base = (volatile u_char *)base;
 		sccA = (volatile u_char *)base + 0x4000;
 		SCSIBase = base + 0x18000;
 		PSCBase = (volatile u_char *)base + 0x31000;
@@ -2164,8 +2161,7 @@ mac68k_set_io_offsets(vaddr_t base)
 	case MACH_CLASSIIsi:
 	case MACH_CLASSIIvx:
 	case MACH_CLASSLC:
-		Via1Base = (volatile u_char *)base;
-		sccA = (volatile u_char *) base + 0x4000;
+		sccA = (volatile u_char *)base + 0x4000;
 		SCSIBase = base;
 		break;
 	case MACH_CLASSIIfx:
@@ -2174,7 +2170,6 @@ mac68k_set_io_offsets(vaddr_t base)
 		 * the serial port in `compatible' mode (set in
 		 * the Serial Switch control panel before booting).
 		 */
-		Via1Base = (volatile u_char *)base;
 		sccA = (volatile u_char *)base + 0x4020;
 		SCSIBase = base;
 		iop_init(0);	/* For console */
@@ -2185,7 +2180,6 @@ mac68k_set_io_offsets(vaddr_t base)
 		current_mac_model->class);
 		break;
 	}
-	Via2Base = Via1Base + 0x2000 * VIA2;
 }
 
 #if GRAYBARS



CVS commit: src/sys/arch/amiga/clockport

2021-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 28 00:35:47 UTC 2021

Modified Files:
src/sys/arch/amiga/clockport: files.clockport

Log Message:
clockport_common does not need its own interface attribute.
All children are attached to clockportbus.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/clockport/files.clockport

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

Modified files:

Index: src/sys/arch/amiga/clockport/files.clockport
diff -u src/sys/arch/amiga/clockport/files.clockport:1.5 src/sys/arch/amiga/clockport/files.clockport:1.6
--- src/sys/arch/amiga/clockport/files.clockport:1.5	Sun Dec 22 23:02:38 2013
+++ src/sys/arch/amiga/clockport/files.clockport	Wed Apr 28 00:35:47 2021
@@ -1,8 +1,8 @@
-#	$NetBSD: files.clockport,v 1.5 2013/12/22 23:02:38 rkujawa Exp $
+#	$NetBSD: files.clockport,v 1.6 2021/04/28 00:35:47 rin Exp $
 
 define	clockportbus {}
 
-define	clockport_common {}
+define	clockport_common
 file	arch/amiga/clockport/clockport_common.c clockport_common
 
 # Generic clockport (can be attached on top of Zorro boards)



CVS commit: src/external/gpl3/gdb/lib/libctf

2021-04-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Apr 26 23:51:08 UTC 2021

Removed Files:
src/external/gpl3/gdb/lib/libctf: ctf-error.h

Log Message:
Remove accidentally committed autogen file.
Should fix periodic snapshot builds with RO mounted /usr/src.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/external/gpl3/gdb/lib/libctf/ctf-error.h

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



CVS commit: src/share/mk

2021-04-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Apr 25 15:33:15 UTC 2021

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Add missing \ for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.1244 -r1.1245 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1244 src/share/mk/bsd.own.mk:1.1245
--- src/share/mk/bsd.own.mk:1.1244	Sun Apr 25 14:32:20 2021
+++ src/share/mk/bsd.own.mk	Sun Apr 25 15:33:15 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1244 2021/04/25 14:32:20 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1245 2021/04/25 15:33:15 rin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1044,7 +1044,7 @@ MK${var}:=	yes
 # aarch64eb is not yet supported.
 #
 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64" \
-|| ${MACHINE_MIPS64}
+|| ${MACHINE_MIPS64} \
 || ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "aarch64" \
 || ${MACHINE_ARCH} == "riscv64" || !empty(MACHINE_ARCH:Mearm*)
 MKCOMPAT?=	yes



CVS commit: src/external/gpl3/gcc

2021-04-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Apr 25 15:32:25 UTC 2021

Modified Files:
src/external/gpl3/gcc: README.gcc10

Log Message:
Update as(1) failure on armv6; it occurs also for earmv6hfeb, whereas it
does not for earmv6{,eb}.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/gpl3/gcc/README.gcc10

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

Modified files:

Index: src/external/gpl3/gcc/README.gcc10
diff -u src/external/gpl3/gcc/README.gcc10:1.19 src/external/gpl3/gcc/README.gcc10:1.20
--- src/external/gpl3/gcc/README.gcc10:1.19	Sun Apr 25 10:08:25 2021
+++ src/external/gpl3/gcc/README.gcc10	Sun Apr 25 15:32:24 2021
@@ -1,4 +1,4 @@
-$NetBSD: README.gcc10,v 1.19 2021/04/25 10:08:25 mrg Exp $
+$NetBSD: README.gcc10,v 1.20 2021/04/25 15:32:24 rin Exp $
 
 
 new stuff:
@@ -39,10 +39,10 @@ earmv5		y	b	y	y		y		y	y	n
 earmv5eb	y	b	y	y		y		?	?	?
 earmv5hf	y	y	y	y		y		?	?	?
 earmv5hfeb	y	b	y	y		y		?	?	?
-earmv6		y	b	y	y		y		y[2]	?	?
+earmv6		y	b	y	y		y		y	?	?
 earmv6eb	y	b	y	y		y		y	?	?
 earmv6hf	y	y	y	y		y		y[2]	?	?
-earmv6hfeb	y	b	y	y		y		y	?	?
+earmv6hfeb	y	b	y	y		y		y[2]	?	?
 earmv7		y	b	y	y		y		?	?	?
 earmv7eb	y	b	y	y		y		?	?	?
 earmv7hf	y	y	y	y		y		y	y	n
@@ -72,7 +72,7 @@ coldfire	?	N/A	?	?		?		N/A	N/A
 architecture	tools	kernels	libgcc	native-gcc	make release	runs	atf
 
 [1] - ramdisk.fs is too large, needs fixing.
-[2] - armv6 little endian has new problems:
+[2] - armv6hf (both little and big endian) has new problems:
   rpi# cat bar.s
   .cfi_startproc
   .cfi_endproc



CVS commit: src/sys/dev/usb

2021-04-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Apr 25 05:16:27 UTC 2021

Modified Files:
src/sys/dev/usb: if_smsc.c

Log Message:
Sample # of RX packets as entropy source.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/if_smsc.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/dev/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.69 src/sys/dev/usb/if_smsc.c:1.70
--- src/sys/dev/usb/if_smsc.c:1.69	Sat Jun 27 13:33:26 2020
+++ src/sys/dev/usb/if_smsc.c	Sun Apr 25 05:16:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.69 2020/06/27 13:33:26 jmcneill Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.70 2021/04/25 05:16:26 rin Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.69 2020/06/27 13:33:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.70 2021/04/25 05:16:26 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -918,13 +918,15 @@ smsc_attach(device_t parent, device_t se
 }
 
 static void
-smsc_uno_rx_loop(struct usbnet * un, struct usbnet_chain *c, uint32_t total_len)
+smsc_uno_rx_loop(struct usbnet *un, struct usbnet_chain *c, uint32_t total_len)
 {
 	USMSCHIST_FUNC(); USMSCHIST_CALLED();
 	struct smsc_softc * const sc = usbnet_softc(un);
 	struct ifnet *ifp = usbnet_ifp(un);
 	uint8_t *buf = c->unc_buf;
+	int count;
 
+	count = 0;
 	DPRINTF("total_len %jd/%#jx", total_len, total_len, 0, 0);
 	while (total_len != 0) {
 		uint32_t rxhdr;
@@ -1045,7 +1047,12 @@ smsc_uno_rx_loop(struct usbnet * un, str
 		/* push the packet up */
 		usbnet_enqueue(un, pktbuf, buflen, csum_flags, csum_data,
 		mbuf_flags);
+
+		count++;
 	}
+
+	if (count != 0)
+		rnd_add_uint32(usbnet_rndsrc(un), count);
 }
 
 static unsigned



CVS commit: src/sys/dev/usb

2021-04-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Apr 25 05:15:20 UTC 2021

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
Sample # of TX packets as entropy source.

For RX packets, individual drivers need to be modified.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/usbnet.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/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.40 src/sys/dev/usb/usbnet.c:1.41
--- src/sys/dev/usb/usbnet.c:1.40	Mon Mar  1 17:41:44 2021
+++ src/sys/dev/usb/usbnet.c	Sun Apr 25 05:15:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.40 2021/03/01 17:41:44 jakllsch Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.41 2021/04/25 05:15:20 rin Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.40 2021/03/01 17:41:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.41 2021/04/25 05:15:20 rin Exp $");
 
 #include 
 #include 
@@ -478,7 +478,7 @@ usbnet_start_locked(struct ifnet *ifp)
 	struct mbuf *m;
 	unsigned length;
 	bool done_transmit = false;
-	int idx;
+	int idx, count;
 
 	USBNETHIST_CALLARGS("%jd: tx_cnt %jd list_cnt %jd link %jd",
 	unp->unp_number, cd->uncd_tx_cnt, un->un_tx_list_cnt,
@@ -500,6 +500,7 @@ usbnet_start_locked(struct ifnet *ifp)
 	}
 
 	idx = cd->uncd_tx_prod;
+	count = 0;
 	while (cd->uncd_tx_cnt < un->un_tx_list_cnt) {
 		IFQ_POLL(>if_snd, m);
 		if (m == NULL) {
@@ -547,6 +548,7 @@ usbnet_start_locked(struct ifnet *ifp)
 
 		idx = (idx + 1) % un->un_tx_list_cnt;
 		cd->uncd_tx_cnt++;
+		count++;
 	}
 	cd->uncd_tx_prod = idx;
 
@@ -558,6 +560,9 @@ usbnet_start_locked(struct ifnet *ifp)
 	 */
 	if (done_transmit)
 		unp->unp_timer = 5;
+
+	if (count != 0)
+		rnd_add_uint32(>unp_rndsrc, count);
 }
 
 static void



CVS commit: src/external/gpl3/gcc/lib/libgcc

2021-04-24 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 24 06:34:53 UTC 2021

Modified Files:
src/external/gpl3/gcc/lib/libgcc: Makefile.inc

Log Message:
Fix build with MKDEBUG=yes for aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/external/gpl3/gcc/lib/libgcc/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/external/gpl3/gcc/lib/libgcc/Makefile.inc
diff -u src/external/gpl3/gcc/lib/libgcc/Makefile.inc:1.49 src/external/gpl3/gcc/lib/libgcc/Makefile.inc:1.50
--- src/external/gpl3/gcc/lib/libgcc/Makefile.inc:1.49	Sat Apr 17 22:01:02 2021
+++ src/external/gpl3/gcc/lib/libgcc/Makefile.inc	Sat Apr 24 06:34:52 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.49 2021/04/17 22:01:02 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.50 2021/04/24 06:34:52 rin Exp $
 
 LIBGCC_MACHINE_ARCH?=${MACHINE_ARCH:S/earmv5/earm/}
 GCC_MACHINE_SUBDIR=${MACHINE_CPU:C/powerpc.*/rs6000/:C/x86_64/i386/}
@@ -197,6 +197,11 @@ ${LSE_NAMES:=.o}: ${LSE_SRC} Makefile
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} ${CPPFLAGS.${.TARGET:T:.o=}} -o ${.TARGET} ${LSE_SRC}
 
+${LSE_NAMES:=.go}: ${LSE_SRC} Makefile
+	${_MKTARGET_COMPILE}
+	${COMPILE.S} ${DEBUGFLAGS} ${CPPFLAGS.${.TARGET:T:.go=}} -o ${.TARGET} \
+		${LSE_SRC}
+
 # lse-init.c currently compiles to nothing for us
 G_LIB2ADD+=	${GNUHOSTDIST}/libgcc/config/aarch64/lse-init.c
 



CVS commit: src/distrib/sets/lists/debug

2021-04-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 23 15:21:49 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
Add lto-dump.debug.


To generate a diff of this commit:
cvs rdiff -u -r1.349 -r1.350 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.349 src/distrib/sets/lists/debug/mi:1.350
--- src/distrib/sets/lists/debug/mi:1.349	Mon Apr 12 02:09:00 2021
+++ src/distrib/sets/lists/debug/mi	Fri Apr 23 15:21:49 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.349 2021/04/12 02:09:00 mrg Exp $
+# $NetBSD: mi,v 1.350 2021/04/23 15:21:49 rin Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -659,6 +659,7 @@
 ./usr/libdata/debug/usr/bin/lpq.debug		comp-lpr-debug		debug
 ./usr/libdata/debug/usr/bin/lpr.debug		comp-lpr-debug		debug
 ./usr/libdata/debug/usr/bin/lprm.debug		comp-lpr-debug		debug
+./usr/libdata/debug/usr/bin/lto-dump.debug	comp-c-debug		gcccmds,gcc=10,debug
 ./usr/libdata/debug/usr/bin/lua.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/luac.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/lzf.debug		comp-util-debug		debug



CVS commit: src/share/man/man8/man8.x86

2021-04-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 22 01:36:25 UTC 2021

Modified Files:
src/share/man/man8/man8.x86: boot.8

Log Message:
Capitalize /EFI and /EFI/NetBSD as usual. Both are case-insensitive although.
Maybe not worth bumping dates...


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/share/man/man8/man8.x86/boot.8

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

Modified files:

Index: src/share/man/man8/man8.x86/boot.8
diff -u src/share/man/man8/man8.x86/boot.8:1.23 src/share/man/man8/man8.x86/boot.8:1.24
--- src/share/man/man8/man8.x86/boot.8:1.23	Mon Aug 10 01:10:26 2020
+++ src/share/man/man8/man8.x86/boot.8	Thu Apr 22 01:36:25 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: boot.8,v 1.23 2020/08/10 01:10:26 uwe Exp $
+.\"	$NetBSD: boot.8,v 1.24 2021/04/22 01:36:25 rin Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -797,7 +797,7 @@ bootstraps for
 and
 .Nx Ns /amd64 ,
 which should be copied to the
-.Pa /efi/boot
+.Pa /EFI/boot
 directory in a
 .Tn FAT
 formatted partition of type
@@ -812,7 +812,7 @@ section).
 .Nx
 .Tn UEFI
 bootstrap reads its configuration from the
-.Pa /efi/netBSD/boot.cfg
+.Pa /EFI/NetBSD/boot.cfg
 file in the
 .Tn EFI
 partition.



CVS commit: src/sys/arch/powerpc/booke/dev

2021-04-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 22 01:33:18 UTC 2021

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c

Log Message:
Fix rnd(9) support; events were not sampled actually in the previous.

Remove #if-0'ed and wrap long line for clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/powerpc/booke/dev/pq3etsec.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/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.52 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.53
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.52	Sun Jan 24 05:16:56 2021
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Thu Apr 22 01:33:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.52 2021/01/24 05:16:56 rin Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.53 2021/04/22 01:33:18 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.52 2021/01/24 05:16:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.53 2021/04/22 01:33:18 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1640,14 +1640,14 @@ pq3etsec_rxq_consume(
 			rxq->rxq_consumer = consumer;
 			rxq->rxq_inuse -= rxconsumed;
 			KASSERT(rxq->rxq_inuse == 0);
-			return;
+			break;
 		}
 		pq3etsec_rxq_desc_postsync(sc, rxq, consumer, 1);
 		const uint16_t rxbd_flags = consumer->rxbd_flags;
 		if (rxbd_flags & RXBD_E) {
 			rxq->rxq_consumer = consumer;
 			rxq->rxq_inuse -= rxconsumed;
-			return;
+			break;
 		}
 		KASSERT(rxq->rxq_mconsumer != NULL);
 #ifdef ETSEC_DEBUG
@@ -2178,6 +2178,7 @@ pq3etsec_txq_consume(
 	struct ifnet * const ifp = >sc_if;
 	volatile struct txbd *consumer = txq->txq_consumer;
 	size_t txfree = 0;
+	bool ret;
 
 #if 0
 	printf("%s: entry: free=%zu\n", __func__, txq->txq_free);
@@ -2189,13 +2190,11 @@ pq3etsec_txq_consume(
 			txq->txq_consumer = consumer;
 			txq->txq_free += txfree;
 			txq->txq_lastintr -= uimin(txq->txq_lastintr, txfree);
-#if 0
-			printf("%s: empty: freed %zu descriptors going form %zu to %zu\n",
-			__func__, txfree, txq->txq_free - txfree, txq->txq_free);
-#endif
 			KASSERT(txq->txq_lastintr == 0);
-			KASSERT(txq->txq_free == txq->txq_last - txq->txq_first - 1);
-			return true;
+			KASSERT(txq->txq_free ==
+			txq->txq_last - txq->txq_first - 1);
+			ret = true;
+			break;
 		}
 		pq3etsec_txq_desc_postsync(sc, txq, consumer, 1);
 		const uint16_t txbd_flags = consumer->txbd_flags;
@@ -2203,11 +2202,8 @@ pq3etsec_txq_consume(
 			txq->txq_consumer = consumer;
 			txq->txq_free += txfree;
 			txq->txq_lastintr -= uimin(txq->txq_lastintr, txfree);
-#if 0
-			printf("%s: freed %zu descriptors\n",
-			__func__, txfree);
-#endif
-			return pq3etsec_txq_fillable_p(sc, txq);
+			ret = pq3etsec_txq_fillable_p(sc, txq);
+			break;
 		}
 
 		/*
@@ -2274,6 +2270,7 @@ pq3etsec_txq_consume(
 
 	if (txfree != 0)
 		rnd_add_uint32(>rnd_source, txfree);
+	return ret;
 }
 
 static void



CVS commit: src/external/gpl3/binutils.old/dist/bfd

2021-04-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 22 01:14:18 UTC 2021

Modified Files:
src/external/gpl3/binutils.old/dist/bfd: elf32-ppc.c elf64-ppc.c

Log Message:
Apply this fix also for binutils.old.

http://www.nerv.org/netbsd/?q=id:20210422T010948Z.f87d2246188cfedb66a0d5a012c107b6a2b9f395

> Fix regression where ld(1) is trapped into infinite loop when
> linking binary whose text does not fit within R_PPC_REL24.
>
> Reported upstream as Bug 27755:
> https://sourceware.org/bugzilla/show_bug.cgi?id=27755
>
> This problem was introduced to binutils-2-31-1 for our tree.
> netbsd-9 is affected, while netbsd-8 is not.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c

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

Modified files:

Index: src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c
diff -u src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.7 src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.8
--- src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c:1.7	Fri Apr  3 17:51:04 2020
+++ src/external/gpl3/binutils.old/dist/bfd/elf32-ppc.c	Thu Apr 22 01:14:18 2021
@@ -5392,7 +5392,7 @@ ppc_elf_inline_plt (struct bfd_link_info
 	  return FALSE;
 
 	relend = relstart + sec->reloc_count;
-	for (rel = relstart; rel < relend; )
+	for (rel = relstart; rel < relend; rel++)
 	  {
 		enum elf_ppc_reloc_type r_type;
 		unsigned long r_symndx;

Index: src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c
diff -u src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.8 src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.9
--- src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c:1.8	Fri Apr  3 17:51:04 2020
+++ src/external/gpl3/binutils.old/dist/bfd/elf64-ppc.c	Thu Apr 22 01:14:18 2021
@@ -8391,7 +8391,7 @@ ppc64_elf_inline_plt (struct bfd_link_in
 	  return FALSE;
 
 	relend = relstart + sec->reloc_count;
-	for (rel = relstart; rel < relend; )
+	for (rel = relstart; rel < relend; rel++)
 	  {
 		enum elf_ppc64_reloc_type r_type;
 		unsigned long r_symndx;



CVS commit: src/external/gpl3/binutils/dist/bfd

2021-04-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 22 01:09:48 UTC 2021

Modified Files:
src/external/gpl3/binutils/dist/bfd: elf32-ppc.c elf64-ppc.c

Log Message:
Fix regression where ld(1) is trapped into infinite loop when
linking binary whose text does not fit within R_PPC_REL24.

Reported upstream as Bug 27755:
https://sourceware.org/bugzilla/show_bug.cgi?id=27755

This problem was introduced to binutils-2-31-1 for our tree.
netbsd-9 is affected, while netbsd-8 is not.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/gpl3/binutils/dist/bfd/elf32-ppc.c \
src/external/gpl3/binutils/dist/bfd/elf64-ppc.c

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

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/elf32-ppc.c
diff -u src/external/gpl3/binutils/dist/bfd/elf32-ppc.c:1.15 src/external/gpl3/binutils/dist/bfd/elf32-ppc.c:1.16
--- src/external/gpl3/binutils/dist/bfd/elf32-ppc.c:1.15	Fri Apr  3 23:48:46 2020
+++ src/external/gpl3/binutils/dist/bfd/elf32-ppc.c	Thu Apr 22 01:09:48 2021
@@ -4235,7 +4235,7 @@ ppc_elf_inline_plt (struct bfd_link_info
 	  return FALSE;
 
 	relend = relstart + sec->reloc_count;
-	for (rel = relstart; rel < relend; )
+	for (rel = relstart; rel < relend; rel++)
 	  {
 		enum elf_ppc_reloc_type r_type;
 		unsigned long r_symndx;
Index: src/external/gpl3/binutils/dist/bfd/elf64-ppc.c
diff -u src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.15 src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.16
--- src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.15	Fri Apr  3 23:48:46 2020
+++ src/external/gpl3/binutils/dist/bfd/elf64-ppc.c	Thu Apr 22 01:09:48 2021
@@ -7507,7 +7507,7 @@ ppc64_elf_inline_plt (struct bfd_link_in
 	  return FALSE;
 
 	relend = relstart + sec->reloc_count;
-	for (rel = relstart; rel < relend; )
+	for (rel = relstart; rel < relend; rel++)
 	  {
 		enum elf_ppc64_reloc_type r_type;
 		unsigned long r_symndx;



CVS commit: src/sys/arch/powerpc/include/booke

2021-04-17 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 17 13:25:57 UTC 2021

Modified Files:
src/sys/arch/powerpc/include/booke: vmparam.h

Log Message:
Sync MAXfoo params with oea:

  MAXTSIZ: 512MB -> 128MB
  MAXDSIZ: 3.25GB -> 1GB

There should be no particular reasons for having different values.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/include/booke/vmparam.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/powerpc/include/booke/vmparam.h
diff -u src/sys/arch/powerpc/include/booke/vmparam.h:1.8 src/sys/arch/powerpc/include/booke/vmparam.h:1.9
--- src/sys/arch/powerpc/include/booke/vmparam.h:1.8	Sat Apr 17 13:23:24 2021
+++ src/sys/arch/powerpc/include/booke/vmparam.h	Sat Apr 17 13:25:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.8 2021/04/17 13:23:24 rin Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.9 2021/04/17 13:25:57 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -56,11 +56,11 @@
 #endif
 
 #ifndef	MAXTSIZ
-#define	MAXTSIZ		(2*256*1024*1024)	/* maximum text size */
+#define	MAXTSIZ		(128*1024*1024)		/* maximum text size */
 #endif
 
 #ifndef	MAXDSIZ
-#define	MAXDSIZ		(13*256*1024*1024U)	/* maximum data size */
+#define	MAXDSIZ		(1024*1024*1024)	/* maximum data size */
 #endif
 
 #ifndef	MAXSSIZ



CVS commit: src/sys/arch/powerpc/include/booke

2021-04-17 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 17 13:23:24 UTC 2021

Modified Files:
src/sys/arch/powerpc/include/booke: vmparam.h

Log Message:
PR port-powerpc/56107

Decrease MAXSSIZ from ~256MB to 32MB (same as oea).

This fixes tests in /usr/tests/usr.bin/make, that run with "ulimit -v 20",
fail with "Cannot map anonymous memory".

Although I'm not fully convinced whether this limit is reasonable or not,
old MAXSSIZ of ~256MB is too much anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/include/booke/vmparam.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/powerpc/include/booke/vmparam.h
diff -u src/sys/arch/powerpc/include/booke/vmparam.h:1.7 src/sys/arch/powerpc/include/booke/vmparam.h:1.8
--- src/sys/arch/powerpc/include/booke/vmparam.h:1.7	Tue Oct  2 23:51:39 2012
+++ src/sys/arch/powerpc/include/booke/vmparam.h	Sat Apr 17 13:23:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.7 2012/10/02 23:51:39 christos Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.8 2021/04/17 13:23:24 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -64,7 +64,7 @@
 #endif
 
 #ifndef	MAXSSIZ
-#define	MAXSSIZ		(1*256*1024*1024-PAGE_SIZE) /* maximum stack size */
+#define	MAXSSIZ		(32*1024*1024)		/* maximum stack size */
 #endif
 
 #ifndef	DFLDSIZ



CVS commit: src/sys/arch/powerpc/include/oea

2021-04-17 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 17 09:22:29 UTC 2021

Modified Files:
src/sys/arch/powerpc/include/oea: vmparam.h

Log Message:
Adjust TABs. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/include/oea/vmparam.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/powerpc/include/oea/vmparam.h
diff -u src/sys/arch/powerpc/include/oea/vmparam.h:1.20 src/sys/arch/powerpc/include/oea/vmparam.h:1.21
--- src/sys/arch/powerpc/include/oea/vmparam.h:1.20	Thu Aug 17 22:55:47 2017
+++ src/sys/arch/powerpc/include/oea/vmparam.h	Sat Apr 17 09:22:28 2021
@@ -47,54 +47,54 @@
 #define	PAGE_MASK	(PAGE_SIZE - 1)
 
 #ifndef	USRSTACK
-#define	USRSTACK		VM_MAXUSER_ADDRESS
+#define	USRSTACK	VM_MAXUSER_ADDRESS
 #endif
 
 #ifndef	USRSTACK32
-#define	USRSTACK32		VM_MAXUSER_ADDRESS32
+#define	USRSTACK32	VM_MAXUSER_ADDRESS32
 #endif
 
 #ifndef	MAXTSIZ
-#define	MAXTSIZ			(128*1024*1024)		/* maximum text size */
+#define	MAXTSIZ		(128*1024*1024)		/* maximum text size */
 #endif
 
 #ifndef	MAXDSIZ
-#define	MAXDSIZ			(1024*1024*1024)	/* maximum data size */
+#define	MAXDSIZ		(1024*1024*1024)	/* maximum data size */
 #endif
 
 #ifndef	MAXDSIZ32
-#define	MAXDSIZ32		(1024*1024*1024)	/* maximum data size */
+#define	MAXDSIZ32	(1024*1024*1024)	/* maximum data size */
 #endif
 
 #ifndef	MAXSSIZ
-#define	MAXSSIZ			(32*1024*1024)		/* maximum stack size */
+#define	MAXSSIZ		(32*1024*1024)		/* maximum stack size */
 #endif
 
 #ifndef	MAXSSIZ32
-#define	MAXSSIZ32		(32*1024*1024)		/* maximum stack size */
+#define	MAXSSIZ32	(32*1024*1024)		/* maximum stack size */
 #endif
 
 #ifndef	DFLDSIZ
-#define	DFLDSIZ			(256*1024*1024)		/* default data size */
+#define	DFLDSIZ		(256*1024*1024)		/* default data size */
 #endif
 
 #ifndef	DFLDSIZ32
-#define	DFLSSIZ32		(256*1024*1024)
+#define	DFLSSIZ32	(256*1024*1024)
 #endif
 
 #ifndef	DFLSSIZ
-#define	DFLSSIZ			(2*1024*1024)		/* default stack size */
+#define	DFLSSIZ		(2*1024*1024)		/* default stack size */
 #endif
 
 #ifndef	DFLSSIZ32
-#define	DFLSSIZ32		(2*1024*1024)		/* default stack size */
+#define	DFLSSIZ32	(2*1024*1024)		/* default stack size */
 #endif
 
 /*
  * Default number of pages in the user raw I/O map.
  */
 #ifndef USRIOSIZE
-#define	USRIOSIZE		1024
+#define	USRIOSIZE	1024
 #endif
 
 /*
@@ -102,7 +102,7 @@
  * considered very swappable.
  */
 #ifndef MAXSLP
-#define	MAXSLP			20
+#define	MAXSLP		20
 #endif
 
 /*



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:33:28 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Restore our local change to remove GNU_STACK program header:


http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c#rev1.13

This was removed accidentally when merging GCC10 into our tree.

Note that some firmwares, e.g., Explora, refuse to execute ELF
kernel image if this program header is present.

Now, GCC10 becomes just fine for all three powerpc sub-archs, i.e.,
oea, booke, and ibm4xx, as far as I can see. No regressions are
observed for ATF.

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.26 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.27
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.26	Fri Apr 16 02:26:43 2021
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	Fri Apr 16 02:33:28 2021
@@ -20284,7 +20284,7 @@ rs6000_elf_file_end (void)
 		 aix_struct_return ? 2 : 1);
 }
 #endif
-#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) || defined(POWERPC_NETBSD)
+#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD)
   if (TARGET_32BIT || DEFAULT_ABI == ABI_ELFv2)
 file_end_indicate_exec_stack ();
 #endif



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:26:43 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Fix regression introduced to GCC10, where it wrongly recognizes 32-bit
processors as POWER9 if -misel flag is specified.

rs6000_machine_from_flags() assumes ISEL instructions are supported only
for POWER9 and successors. However, ISEL is also implemented for 32-bit
booke processors.

Since our kernel for booke is compiled with -misel, this regression
completely breaks it.

As a fix, check whether CPU is 64-bit capable or not, before checking
-misel flag.

The problem has been reported as 100108 to upstream:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100108

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.25 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.26
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.25	Fri Apr 16 02:18:04 2021
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	Fri Apr 16 02:26:43 2021
@@ -5552,6 +5552,8 @@ rs6000_machine_from_flags (void)
   /* Disable the flags that should never influence the .machine selection.  */
   flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT);
 
+  if ((flags & OPTION_MASK_POWERPC64) == 0)
+return "ppc";
   if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
 return "power10";
   if ((flags & (ISA_3_0_MASKS_SERVER & ~ISA_2_7_MASKS_SERVER)) != 0)
@@ -5566,9 +5568,7 @@ rs6000_machine_from_flags (void)
 return "power5";
   if ((flags & ISA_2_1_MASKS) != 0)
 return "power4";
-  if ((flags & OPTION_MASK_POWERPC64) != 0)
-return "ppc64";
-  return "ppc";
+  return "ppc64";
 }
 
 void



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:18:04 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Fix regression introduced to GCC10, by which inline assembler codes for
403/405 are miscompiled.

Redundant .machine directive introduced by upstream commit
2d94f7dea9c73ef3c116a0ddc722724578a860fe:


https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2d94f7dea9c73ef3c116a0ddc722724578a860fe

clobbers CPU flags passed to assembler. This results in miscompile for
inline assembler codes specific to 403/405 processors, at least.

Therefore, revert this commit locally.

The problem has been reported as 100107 to upstream:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100107

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.24 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.25
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.24	Mon Apr 12 07:23:06 2021
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	Fri Apr 16 02:18:04 2021
@@ -5644,7 +5644,9 @@ rs6000_file_start (void)
 
 #ifdef USING_ELFOS_H
   rs6000_machine = rs6000_machine_from_flags ();
-  emit_asm_machine ();
+  if (!(rs6000_default_cpu && rs6000_default_cpu[0])
+	&& !global_options_set.x_rs6000_cpu_index)
+emit_asm_machine ();
 #endif
 
   if (DEFAULT_ABI == ABI_ELFv2)



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

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 15 08:23:24 UTC 2021

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

Log Message:
Fix fallout from alpha/interrupt.c rev 1.93:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/alpha/alpha/interrupt.c#rev1.93

by which interrupts *seem* to occupy 100% CPU time.

Now, we bump ci_intrdepth for clock interrupt. Therefore, if ci_intrdepth > 1
is observed in statclock(), CPU is actually occupied by interrupts.

Thanks jklos and thorpej for notice!


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/alpha/include/cpu.h

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

Modified files:

Index: src/sys/arch/alpha/include/cpu.h
diff -u src/sys/arch/alpha/include/cpu.h:1.99 src/sys/arch/alpha/include/cpu.h:1.100
--- src/sys/arch/alpha/include/cpu.h:1.99	Thu Oct 15 01:00:01 2020
+++ src/sys/arch/alpha/include/cpu.h	Thu Apr 15 08:23:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.99 2020/10/15 01:00:01 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.100 2021/04/15 08:23:24 rin Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -205,7 +205,8 @@ struct clockframe {
  * r/m/w cycle is complete, we won't be counted... but it's not
  * like this stastic has to be extremely accurate.
  */
-#define	CLKF_INTR(framep)	(curcpu()->ci_intrdepth)
+#define	CLKF_INTR(framep)		\
+	(curcpu()->ci_intrdepth > 1)	/* one for clock interrupt itself */
 
 /*
  * This is used during profiling to integrate system time.  It can safely



CVS commit: src/sys/kern

2021-04-14 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 15 00:37:31 UTC 2021

Modified Files:
src/sys/kern: subr_evcnt.c

Log Message:
intrcnt[] is changed from long to u_int. Use sizeof(var) instead of
sizeof(type) to catch up with this change.

No binary changes as all ports with __HAVE_LEGACY_INTRCNT are ILP32, IIUC.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/kern/subr_evcnt.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/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.15 src/sys/kern/subr_evcnt.c:1.16
--- src/sys/kern/subr_evcnt.c:1.15	Fri Apr  2 10:39:22 2021
+++ src/sys/kern/subr_evcnt.c	Thu Apr 15 00:37:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.15 2021/04/02 10:39:22 simonb Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.16 2021/04/15 00:37:31 rin Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.15 2021/04/02 10:39:22 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.16 2021/04/15 00:37:31 rin Exp $");
 
 #include 
 #include 
@@ -393,7 +393,7 @@ evcnt_attach_legacy_intrcnt(void)
 	size_t i;
 	const char *cp;
 
-	nintr = ((intptr_t)eintrcnt - (intptr_t)intrcnt) / sizeof(long);
+	nintr = ((intptr_t)eintrcnt - (intptr_t)intrcnt) / sizeof(intrcnt[0]);
 	intr_evcnts = kmem_alloc(sizeof(struct evcnt) * nintr, KM_SLEEP);
 	for (cp = intrnames, i = 0; i < nintr; i++) {
 		evcnt_attach_dynamic(_evcnts[i], EVCNT_TYPE_INTR,



CVS commit: src/sys/dev

2021-04-14 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 15 00:32:50 UTC 2021

Modified Files:
src/sys/dev: dksubr.c

Log Message:
dk_start(): retry device-dependent start() routine later, also when it
returns ENOMEM in addition to EAGAIN.

Device-dependent start() routine may allocate buffer directly, or via
bus_dma(9) API (some implementations for bus_dma(9) like alpha allocate
memory internally).

If these attempts fail with ENOMEM, this is not a disk error, therefore
we must retry later, as already done for EAGAIN.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/dksubr.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/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.112 src/sys/dev/dksubr.c:1.113
--- src/sys/dev/dksubr.c:1.112	Sun Mar  1 03:21:54 2020
+++ src/sys/dev/dksubr.c	Thu Apr 15 00:32:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.112 2020/03/01 03:21:54 riastradh Exp $ */
+/* $NetBSD: dksubr.c,v 1.113 2021/04/15 00:32:50 rin Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.112 2020/03/01 03:21:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.113 2021/04/15 00:32:50 rin Exp $");
 
 #include 
 #include 
@@ -428,7 +428,10 @@ dk_start(struct dk_softc *dksc, struct b
 			mutex_exit(>sc_iolock);
 			error = dkd->d_diskstart(dksc->sc_dev, bp);
 			mutex_enter(>sc_iolock);
-			if (error == EAGAIN) {
+			if (error == EAGAIN || error == ENOMEM) {
+/*
+ * Not a disk error. Retry later.
+ */
 KASSERT(dksc->sc_deferred == NULL);
 dksc->sc_deferred = bp;
 disk_unbusy(>sc_dkdev, 0, (bp->b_flags & B_READ));



CVS commit: src/sys/arch/alpha/alpha

2021-04-14 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 15 00:19:52 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: interrupt.c

Log Message:
Contrary to comment here, nowadays hardclock() and statclock() should be
called with cpu_intr_p() is turning on, if used from the interrupt context.

Otherwise, entropy_enter() is used instead of entropy_enter_intr(), which
results in KASSERT() failure.

Therefore, bump ci_intrdepth for clock interrupt. Remove stale comment also.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/alpha/alpha/interrupt.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/alpha/alpha/interrupt.c
diff -u src/sys/arch/alpha/alpha/interrupt.c:1.92 src/sys/arch/alpha/alpha/interrupt.c:1.93
--- src/sys/arch/alpha/alpha/interrupt.c:1.92	Sat Oct 10 03:05:04 2020
+++ src/sys/arch/alpha/alpha/interrupt.c	Thu Apr 15 00:19:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.92 2020/10/10 03:05:04 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.93 2021/04/15 00:19:52 rin Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.92 2020/10/10 03:05:04 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.93 2021/04/15 00:19:52 rin Exp $");
 
 #include 
 #include 
@@ -212,12 +212,7 @@ interrupt(unsigned long a0, unsigned lon
 		break;
 		
 	case ALPHA_INTR_CLOCK:	/* clock interrupt */
-		/*
-		 * We don't increment the interrupt depth for the
-		 * clock interrupt, since it is *sampled* from
-		 * the clock interrupt, so if we did, all system
-		 * time would be counted as interrupt time.
-		 */
+		atomic_inc_ulong(>ci_intrdepth);
 		sc->sc_evcnt_clock.ev_count++;
 		ci->ci_data.cpu_nintr++;
 		if (platform.clockintr) {
@@ -242,6 +237,7 @@ interrupt(unsigned long a0, unsigned lon
 			schedhz != 0)
 schedclock(ci->ci_curlwp);
 		}
+		atomic_dec_ulong(>ci_intrdepth);
 		break;
 
 	case ALPHA_INTR_ERROR:	/* Machine Check or Correctable Error */



  1   2   3   4   5   6   7   8   9   10   >