CVS commit: [netbsd-9] src/doc

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  9 05:37:37 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Ticket #775


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/doc/CHANGES-9.1

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-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.10 src/doc/CHANGES-9.1:1.1.2.11
--- src/doc/CHANGES-9.1:1.1.2.10	Sun Mar  8 11:22:49 2020
+++ src/doc/CHANGES-9.1	Mon Mar  9 05:37:37 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.10 2020/03/08 11:22:49 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.11 2020/03/09 05:37:37 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -436,3 +436,8 @@ sys/kern/kern_mutex.c1.90
 	the dump is written.
 	[chs, ticket #768]
 
+sys/compat/netbsd32/netbsd32_mod.c		1.17,1.18
+
+	Fix MODULE_HOOK_SET arguments (broken in ticket #762).
+	[pgoyette, ticket #775]
+



CVS commit: [netbsd-9] src/sys/compat/netbsd32

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  9 05:36:24 UTC 2020

Modified Files:
src/sys/compat/netbsd32 [netbsd-9]: netbsd32_mod.c

Log Message:
Apply patch, requested by pgoyette in ticket #775 to fix fallout from
ticket #762:

sys/compat/netbsd32/netbsd32_mod.c  (patched)

Fiy arguments to MODULE_HOOK_SET for the new amd64_oosyscall_hook.


To generate a diff of this commit:
cvs rdiff -u -r1.15.4.1 -r1.15.4.2 src/sys/compat/netbsd32/netbsd32_mod.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/compat/netbsd32/netbsd32_mod.c
diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.1 src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.2
--- src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.1	Sun Mar  8 10:54:43 2020
+++ src/sys/compat/netbsd32/netbsd32_mod.c	Mon Mar  9 05:36:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_mod.c,v 1.15.4.1 2020/03/08 10:54:43 martin Exp $	*/
+/*	$NetBSD: netbsd32_mod.c,v 1.15.4.2 2020/03/09 05:36:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.1 2020/03/08 10:54:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.2 2020/03/09 05:36:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -173,7 +173,7 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi
 			netbsd32_machdep_md_init();
 			netbsd32_kern_proc_32_init();
 #if defined(__amd64__)
-			MODULE_HOOK_SET(amd64_oosyscall_hook,
+			MODULE_HOOK_SET(amd64_oosyscall_hook, "nb32oo",
 			amd64_oosyscall_handle);
 #endif
 		}
@@ -194,7 +194,7 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi
 			netbsd32_sysctl_init();
 			netbsd32_machdep_md_init();
 #if defined(__amd64__)
-			MODULE_HOOK_SET(amd64_oosyscall_hook,
+			MODULE_HOOK_SET(amd64_oosyscall_hook, "nb32oo",
 			amd64_oosyscall_handle);
 #endif
 		}



CVS commit: src/usr.sbin/crash

2020-03-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Mar  9 05:10:19 UTC 2020

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Restrict LOCKDEBUG support to archs with REALCRASH.
Fix build failure for other archs.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/crash/Makefile

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

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.43 src/usr.sbin/crash/Makefile:1.44
--- src/usr.sbin/crash/Makefile:1.43	Mon Mar  9 01:54:31 2020
+++ src/usr.sbin/crash/Makefile	Mon Mar  9 05:10:19 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.43 2020/03/09 01:54:31 christos Exp $
+#	$NetBSD: Makefile,v 1.44 2020/03/09 05:10:19 rin Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -30,10 +30,6 @@ REALCRASH=yes
 REALCRASH=no
 .endif
 
-CPPFLAGS +=-DLOCKDEBUG
-CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
-SRCS += subr_lockdebug.c
-
 .if ${REALCRASH} != "no"	# {
 
 S=		${.CURDIR}/../../sys
@@ -58,6 +54,10 @@ SRCS+=	db_disasm.c
 SRCS+=	kern_timeout.c
 CPPFLAGS.kern_timeout.c += -DCRASH -DDDB
 
+CPPFLAGS +=-DLOCKDEBUG
+SRCS += subr_lockdebug.c
+CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
+
 CPPFLAGS+=	-I${S}/arch
 
 . if${MACHINE} == "amd64" \



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

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  9 02:22:20 UTC 2020

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

Log Message:
wrong test name


To generate a diff of this commit:
cvs rdiff -u -r1.833 -r1.834 src/distrib/sets/lists/tests/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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.833 src/distrib/sets/lists/tests/mi:1.834
--- src/distrib/sets/lists/tests/mi:1.833	Sun Mar  8 18:08:46 2020
+++ src/distrib/sets/lists/tests/mi	Sun Mar  8 22:22:20 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.833 2020/03/08 22:08:46 mgorny Exp $
+# $NetBSD: mi,v 1.834 2020/03/09 02:22:20 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4221,7 +4221,7 @@
 ./usr/tests/usr.bin/config/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua
 ./usr/tests/usr.bin/config/Makefile.regress	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/d_deffs_redef	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/config/d_ifconfig		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/config/d_ifdef		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/d_loop		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/d_loop2		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/d_min		tests-usr.bin-tests	compattestfile,atf



CVS commit: src/sys/dev/pci

2020-03-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Mar  9 01:55:16 UTC 2020

Modified Files:
src/sys/dev/pci: if_txp.c

Log Message:
Add an assertion.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/if_txp.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/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.70 src/sys/dev/pci/if_txp.c:1.71
--- src/sys/dev/pci/if_txp.c:1.70	Mon Mar  9 01:53:11 2020
+++ src/sys/dev/pci/if_txp.c	Mon Mar  9 01:55:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.70 2020/03/09 01:53:11 thorpej Exp $ */
+/* $NetBSD: if_txp.c,v 1.71 2020/03/09 01:55:16 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.70 2020/03/09 01:53:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.71 2020/03/09 01:55:16 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -716,6 +716,7 @@ txp_rx_reclaim(struct txp_softc *sc, str
 		}
 
 		/* retrieve stashed pointer */
+		KASSERT(rxd->rx_vaddrlo < RXBUF_ENTRIES);
 		sd = >sc_rxd[rxd->rx_vaddrlo];
 
 		bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0,



CVS commit: src/usr.sbin/crash

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  9 01:54:31 UTC 2020

Modified Files:
src/usr.sbin/crash: Makefile crash.c

Log Message:
Add primitive LOCKDEBUG support.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/crash/crash.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.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.42 src/usr.sbin/crash/Makefile:1.43
--- src/usr.sbin/crash/Makefile:1.42	Sun Oct 13 03:28:18 2019
+++ src/usr.sbin/crash/Makefile	Sun Mar  8 21:54:31 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.42 2019/10/13 07:28:18 mrg Exp $
+#	$NetBSD: Makefile,v 1.43 2020/03/09 01:54:31 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -30,6 +30,10 @@ REALCRASH=yes
 REALCRASH=no
 .endif
 
+CPPFLAGS +=-DLOCKDEBUG
+CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
+SRCS += subr_lockdebug.c
+
 .if ${REALCRASH} != "no"	# {
 
 S=		${.CURDIR}/../../sys

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.11 src/usr.sbin/crash/crash.c:1.12
--- src/usr.sbin/crash/crash.c:1.11	Tue Jan 10 15:57:26 2017
+++ src/usr.sbin/crash/crash.c	Sun Mar  8 21:54:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.11 2017/01/10 20:57:26 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.12 2020/03/09 01:54:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.11 2017/01/10 20:57:26 christos Exp $");
+__RCSID("$NetBSD: crash.c,v 1.12 2020/03/09 01:54:31 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -73,9 +73,24 @@ static struct nlist nl[] = {
 	{ .n_name = "_osrelease" },
 #define	X_PANICSTR	1
 	{ .n_name = "_panicstr" },
+#ifdef LOCKDEBUG
+#define	X_LOCKDEBUG	2
+	{ .n_name = "ld_all" },
+#endif
 	{ .n_name = NULL },
 };
 
+#ifdef LOCKDEBUG
+struct lockdebug;
+TAILQ_HEAD(, lockdebug) ld_all;
+#else
+void lockdebug_lock_print(void);
+void lockdebug_lock_print(void) {
+	warnx("No lockdebug support compiled in");
+}
+#endif
+
+
 static void
 cleanup(void)
 {
@@ -412,6 +427,12 @@ main(int argc, char **argv)
 		errx(EXIT_FAILURE, "cannot read osrelease: %s",
 		kvm_geterr(kd));
 	}
+#ifdef LOCKDEBUG
+	if ((size_t)kvm_read(kd, nl[X_LOCKDEBUG].n_value, _all,
+	sizeof(ld_all)) != sizeof(ld_all))
+		warn("Cannot read ld_all (no LOCKDEBUG kernel?): %s",
+		kvm_geterr(kd));
+#endif
 	printf("Crash version %s, image version %s.\n", osrelease, imgrelease);
 	if (strcmp(osrelease, imgrelease) != 0) {
 		printf("WARNING: versions differ, you may not be able to "



CVS commit: src/sys/dev/pci

2020-03-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Mar  9 01:53:11 UTC 2020

Modified Files:
src/sys/dev/pci: if_txp.c

Log Message:
Now that we're allocating rx software state from a fixed pool, we
don't have to round-trip pointers in a sketchy way -- we can round-
trip indices.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/if_txp.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/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.69 src/sys/dev/pci/if_txp.c:1.70
--- src/sys/dev/pci/if_txp.c:1.69	Mon Mar  9 00:32:53 2020
+++ src/sys/dev/pci/if_txp.c	Mon Mar  9 01:53:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.69 2020/03/09 00:32:53 thorpej Exp $ */
+/* $NetBSD: if_txp.c,v 1.70 2020/03/09 01:53:11 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.69 2020/03/09 00:32:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.70 2020/03/09 01:53:11 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -678,6 +678,13 @@ txp_rxd_free(struct txp_softc *sc, struc
 	sc->sc_rxd_pool[sc->sc_txd_pool_ptr++] = sd;
 }
 
+static inline uint32_t
+txp_rxd_idx(struct txp_softc *sc, struct txp_swdesc *sd)
+{
+	KASSERT(sd >= >sc_rxd[0] && sd < >sc_rxd[RXBUF_ENTRIES]);
+	return (uint32_t)(sd - >sc_rxd[0]);
+}
+
 static void
 txp_rx_reclaim(struct txp_softc *sc, struct txp_rx_ring *r,
 struct txp_dma_alloc *dma)
@@ -709,7 +716,7 @@ txp_rx_reclaim(struct txp_softc *sc, str
 		}
 
 		/* retrieve stashed pointer */
-		memcpy(, __UNVOLATILE(>rx_vaddrlo), sizeof(sd));
+		sd = >sc_rxd[rxd->rx_vaddrlo];
 
 		bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0,
 		sd->sd_map->dm_mapsize, BUS_DMASYNC_POSTREAD);
@@ -834,7 +841,7 @@ txp_rxbuf_reclaim(struct txp_softc *sc)
 		sizeof(struct txp_rxbuf_desc), BUS_DMASYNC_POSTWRITE);
 
 		/* stash away pointer */
-		memcpy(__UNVOLATILE(>rb_vaddrlo), , sizeof(sd));
+		rbd->rb_vaddrlo = txp_rxd_idx(sc, sd);
 
 		rbd->rb_paddrlo =
 		htole32(BUS_ADDR_LO32(sd->sd_map->dm_segs[0].ds_addr));
@@ -1104,9 +,9 @@ txp_alloc_rings(struct txp_softc *sc)
 	sc->sc_rxbufs = (struct txp_rxbuf_desc *)sc->sc_rxbufring_dma.dma_vaddr;
 	for (nb = 0; nb < RXBUF_ENTRIES; nb++) {
 		sd = >sc_rxd[nb];
+
 		/* stash away pointer */
-		memcpy(__UNVOLATILE(>sc_rxbufs[nb].rb_vaddrlo), ,
-		sizeof(sd));
+		sc->sc_rxbufs[nb].rb_vaddrlo = txp_rxd_idx(sc, sd);
 
 		MGETHDR(sd->sd_mbuf, M_WAIT, MT_DATA);
 		if (sd->sd_mbuf == NULL) {



CVS commit: src/sys/kern

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  9 01:47:51 UTC 2020

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

Log Message:
comment out enough stuff to allow crash to print locks.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/subr_lockdebug.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_lockdebug.c
diff -u src/sys/kern/subr_lockdebug.c:1.74 src/sys/kern/subr_lockdebug.c:1.75
--- src/sys/kern/subr_lockdebug.c:1.74	Tue Jan 21 15:31:57 2020
+++ src/sys/kern/subr_lockdebug.c	Sun Mar  8 21:47:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_lockdebug.c,v 1.74 2020/01/21 20:31:57 ad Exp $	*/
+/*	$NetBSD: subr_lockdebug.c,v 1.75 2020/03/09 01:47:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.74 2020/01/21 20:31:57 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.75 2020/03/09 01:47:50 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -97,13 +97,21 @@ typedef _TAILQ_HEAD(lockdebuglist, struc
 
 __cpu_simple_lock_t	ld_mod_lk;
 lockdebuglist_t		ld_free = TAILQ_HEAD_INITIALIZER(ld_free);
+#ifdef _KERNEL
 lockdebuglist_t		ld_all = TAILQ_HEAD_INITIALIZER(ld_all);
+#else
+extern lockdebuglist_t	ld_all;
+#define cpu_name(a)	"?"
+#define cpu_index(a)	-1
+#define curlwp		NULL
+#endif /* _KERNEL */
 int			ld_nfree;
 int			ld_freeptr;
 int			ld_recurse;
 bool			ld_nomore;
 lockdebug_t		ld_prime[LD_BATCH];
 
+#ifdef _KERNEL
 static void	lockdebug_abort1(const char *, size_t, lockdebug_t *, int,
 const char *, bool);
 static int	lockdebug_more(int);
@@ -744,6 +752,13 @@ lockdebug_mem_check(const char *func, si
 	}
 	splx(s);
 }
+#endif /* _KERNEL */
+
+#ifdef DDB
+#include 
+#include 
+#include 
+#endif
 
 /*
  * lockdebug_dump:
@@ -755,6 +770,7 @@ lockdebug_dump(lwp_t *l, lockdebug_t *ld
 __printflike(1, 2))
 {
 	int sleeper = (ld->ld_flags & LD_SLEEPER);
+	lockops_t *lo = ld->ld_lockops;
 
 	(*pr)(
 	"lock address : %#018lx type : %18s\n"
@@ -762,7 +778,12 @@ lockdebug_dump(lwp_t *l, lockdebug_t *ld
 	(long)ld->ld_lock, (sleeper ? "sleep/adaptive" : "spin"),
 	(long)ld->ld_initaddr);
 
-	if (ld->ld_lockops->lo_type == LOCKOPS_CV) {
+#ifndef _KERNEL
+	lockops_t los;
+	lo = 
+	db_read_bytes((db_addr_t)ld->ld_lockops, sizeof(los), (char *)lo);
+#endif
+	if (lo->lo_type == LOCKOPS_CV) {
 		(*pr)(" interlock: %#018lx\n", (long)ld->ld_locked);
 	} else {
 		(*pr)("\n"
@@ -781,14 +802,17 @@ lockdebug_dump(lwp_t *l, lockdebug_t *ld
 		(long)ld->ld_unlocked);
 	}
 
-	if (ld->ld_lockops->lo_dump != NULL)
-		(*ld->ld_lockops->lo_dump)(ld->ld_lock, pr);
+#ifdef _KERNEL
+	if (lo->lo_dump != NULL)
+		(*lo->lo_dump)(ld->ld_lock, pr);
 
 	if (sleeper) {
 		turnstile_print(ld->ld_lock, pr);
 	}
+#endif
 }
 
+#ifdef _KERNEL
 /*
  * lockdebug_abort1:
  *
@@ -821,6 +845,7 @@ lockdebug_abort1(const char *func, size_
 		ld->ld_lockops->lo_name, func, line, msg);
 }
 
+#endif /* _KERNEL */
 #endif	/* LOCKDEBUG */
 
 /*
@@ -829,17 +854,16 @@ lockdebug_abort1(const char *func, size_
  *	Handle the DDB 'show lock' command.
  */
 #ifdef DDB
-#include 
-#include 
-
 void
 lockdebug_lock_print(void *addr,
 void (*pr)(const char *, ...) __printflike(1, 2))
 {
 #ifdef LOCKDEBUG
-	lockdebug_t *ld;
+	lockdebug_t *ld, lds;
 
 	TAILQ_FOREACH(ld, _all, ld_achain) {
+		db_read_bytes((db_addr_t)ld, sizeof(lds), __UNVOLATILE());
+		ld = 
 		if (ld->ld_lock == NULL)
 			continue;
 		if (addr == NULL || ld->ld_lock == addr) {
@@ -857,6 +881,7 @@ lockdebug_lock_print(void *addr,
 #endif	/* LOCKDEBUG */
 }
 
+#ifdef _KERNEL
 #ifdef LOCKDEBUG
 static void
 lockdebug_show_one(lwp_t *l, lockdebug_t *ld, int i,
@@ -864,8 +889,10 @@ lockdebug_show_one(lwp_t *l, lockdebug_t
 {
 	const char *sym;
 
+#ifdef _KERNEL
 	ksyms_getname(NULL, , (vaddr_t)ld->ld_initaddr,
 	KSYMS_CLOSEST|KSYMS_PROC|KSYMS_ANY);
+#endif
 	(*pr)("* Lock %d (initialized at %s)\n", i++, sym);
 	lockdebug_dump(l, ld, pr);
 }
@@ -947,8 +974,10 @@ lockdebug_show_all_locks_cpu(void (*pr)(
 		}
 	}
 }
+#endif /* _KERNEL */
 #endif	/* LOCKDEBUG */
 
+#ifdef _KERNEL
 void
 lockdebug_show_all_locks(void (*pr)(const char *, ...) __printflike(1, 2),
 const char *modif)
@@ -1019,8 +1048,10 @@ lockdebug_show_lockstats(void (*pr)(cons
 	(*pr)("Sorry, kernel not built with the LOCKDEBUG option.\n");
 #endif	/* LOCKDEBUG */
 }
+#endif /* _KERNEL */
 #endif	/* DDB */
 
+#ifdef _KERNEL
 /*
  * lockdebug_dismiss:
  *
@@ -1076,3 +1107,4 @@ lockdebug_abort(const char *func, size_t
 	panic("lock error: %s: %s,%zu: %s: lock %p cpu %d lwp %p",
 	ops->lo_name, func, line, msg, lock, cpu_index(curcpu()), curlwp);
 }
+#endif /* _KERNEL */



CVS commit: src/sys/ddb

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  9 01:46:24 UTC 2020

Modified Files:
src/sys/ddb: db_command.c

Log Message:
print a message for the commands crash does not support.
Allow "show lock"


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/ddb/db_command.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/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.167 src/sys/ddb/db_command.c:1.168
--- src/sys/ddb/db_command.c:1.167	Wed Jan  1 17:57:17 2020
+++ src/sys/ddb/db_command.c	Sun Mar  8 21:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.167 2020/01/01 22:57:17 thorpej Exp $	*/
+/*	$NetBSD: db_command.c,v 1.168 2020/03/09 01:46:24 christos Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009, 2019
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.167 2020/01/01 22:57:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.168 2020/03/09 01:46:24 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -121,6 +121,11 @@ db_addr_t	db_prev;
 db_addr_t	db_next;
 
 
+#ifndef _KERNEL
+#define db_kernelonly() \
+db_printf("%s: can only be used in-kernel.\n", __func__)
+#endif
+
 /*
  * New DDB api for adding and removing commands uses three lists, because
  * we use two types of commands
@@ -1012,6 +1017,8 @@ db_map_print_cmd(db_expr_t addr, bool ha
 		addr = (db_expr_t)(uintptr_t)db_read_ptr("kernel_map");
 
 	uvm_map_printit((struct vm_map *)(uintptr_t) addr, full, db_printf);
+#else
+	db_kernelonly();
 #endif	/* XXX CRASH(8) */
 }
 
@@ -1028,6 +1035,8 @@ db_object_print_cmd(db_expr_t addr, bool
 
 	uvm_object_printit((struct uvm_object *)(uintptr_t) addr, full,
 	db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1043,6 +1052,8 @@ db_page_print_cmd(db_expr_t addr, bool h
 		full = true;
 
 	uvm_page_printit((struct vm_page *)(uintptr_t) addr, full, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1054,6 +1065,8 @@ db_show_all_pages(db_expr_t addr, bool h
 
 #ifdef _KERNEL /* XXX CRASH(8) */
 	uvm_page_printall(db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1069,6 +1082,8 @@ db_buf_print_cmd(db_expr_t addr, bool ha
 		full = true;
 
 	vfs_buf_print((struct buf *)(uintptr_t) addr, full, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1142,6 +1157,8 @@ db_vnode_print_cmd(db_expr_t addr, bool 
 		full = true;
 
 	vfs_vnode_print((struct vnode *)(uintptr_t) addr, full, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1157,6 +1174,8 @@ db_vnode_lock_print_cmd(db_expr_t addr, 
 		full = true;
 
 	vfs_vnode_lock_print((struct vnode *)(uintptr_t) addr, full, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1168,6 +1187,8 @@ db_vmem_print_cmd(db_expr_t addr, bool h
 
 #ifdef _KERNEL /* XXX CRASH(8) */
 	vmem_print((uintptr_t) addr, modif, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1195,6 +1216,8 @@ db_show_all_mount(db_expr_t addr, bool h
 		full = true;
 
 	vfs_mount_print_all(full, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1206,6 +1229,8 @@ db_mbuf_print_cmd(db_expr_t addr, bool h
 
 #ifdef _KERNEL /* XXX CRASH(8) */
 	m_print((const struct mbuf *)(uintptr_t) addr, modif, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1217,6 +1242,8 @@ db_pool_print_cmd(db_expr_t addr, bool h
 
 #ifdef _KERNEL /* XXX CRASH(8) */
 	pool_printit((struct pool *)(uintptr_t) addr, modif, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1228,6 +1255,8 @@ db_namecache_print_cmd(db_expr_t addr, b
 
 #ifdef _KERNEL /* XXX CRASH(8) */
 	namecache_print((struct vnode *)(uintptr_t) addr, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1239,6 +1268,8 @@ db_uvmexp_print_cmd(db_expr_t addr, bool
 
 #ifdef _KERNEL	/* XXX CRASH(8) */
 	uvmexp_print(db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1250,6 +1281,8 @@ db_socket_print_cmd(db_expr_t addr, bool
 
 #ifdef _KERNEL	/* XXX CRASH(8) */
 	socket_print(modif, db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1272,10 +1305,8 @@ db_lock_print_cmd(db_expr_t addr, bool h
 db_expr_t count, const char *modif)
 {
 
-#ifdef _KERNEL	/* XXX CRASH(8) */
 	lockdebug_lock_print(have_addr ? (void *)(uintptr_t)addr : NULL,
 	db_printf);
-#endif
 }
 
 static void
@@ -1285,6 +1316,8 @@ db_show_all_locks(db_expr_t addr, bool h
 
 #ifdef _KERNEL	/* XXX CRASH(8) */
 	lockdebug_show_all_locks(db_printf, modif);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1295,6 +1328,8 @@ db_show_all_freelists(db_expr_t addr, bo
 
 #ifdef _KERNEL	/* XXX CRASH(8) */
 	uvm_page_print_freelists(db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1305,6 +1340,8 @@ db_show_lockstats(db_expr_t addr, bool h
 
 #ifdef _KERNEL	/* XXX CRASH(8) */
 	lockdebug_show_lockstats(db_printf);
+#else
+	db_kernelonly();
 #endif
 }
 
@@ -1368,7 +1405,7 @@ db_fncall(db_expr_t addr, bool have_addr
 			 args[5], 

CVS commit: src/sys/compat/netbsd32

2020-03-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Mar  9 01:06:34 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_mod.c

Log Message:
If a syscall requires a module to be autoloaded, the initial invocation
of that syscall will return ERESTART.  For amd64's netbsd32_syscall()
that means we need to back up the PC saved in the trap frame so we can
re-issue the syscall instruction.  For "normal" syscall traps, we saved
the instruction length in the trap frame, but this was missing for the
oosyscall/lcall path.  Since the PC was not backed up, the kernel-only
value ERESTART was returned to userland, causing all sort of grief for
old compat_netbsd32 executables!

XXX Pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/netbsd32/netbsd32_mod.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/compat/netbsd32/netbsd32_mod.c
diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.18 src/sys/compat/netbsd32/netbsd32_mod.c:1.19
--- src/sys/compat/netbsd32/netbsd32_mod.c:1.18	Sun Mar  8 04:17:49 2020
+++ src/sys/compat/netbsd32/netbsd32_mod.c	Mon Mar  9 01:06:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_mod.c,v 1.18 2020/03/08 04:17:49 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_mod.c,v 1.19 2020/03/09 01:06:34 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.18 2020/03/08 04:17:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.19 2020/03/09 01:06:34 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -148,8 +148,9 @@ amd64_oosyscall_handle(struct proc *p, s
 	copyin((void *)frame->tf_rip, tmp, sz) == 0 &&
 	memcmp(tmp, lcall, sz) == 0) {
 
-		/* Advance past the lcall. */
+		/* Advance past the lcall and save instruction size. */
 		frame->tf_rip += sz;
+		frame->tf_err = sz;
 
 		/* Do the syscall */
 		p->p_md.md_syscall(frame);
@@ -157,7 +158,7 @@ amd64_oosyscall_handle(struct proc *p, s
 	} else
 		return EPASSTHROUGH;
 }
-#endif
+#endif /* defined(__amd64__) */
 
 static int
 compat_netbsd32_modcmd(modcmd_t cmd, void *arg)
@@ -175,14 +176,14 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi
 #if defined(__amd64__)
 			MODULE_HOOK_SET(amd64_oosyscall_hook,
 			amd64_oosyscall_handle);
-#endif
+#endif /* defined(__amd64__) */
 		}
 		return error;
 
 	case MODULE_CMD_FINI:
 #if defined(__amd64__)
 		MODULE_HOOK_UNSET(amd64_oosyscall_hook);
-#endif
+#endif /* defined(__amd64__) */
 		netbsd32_machdep_md_fini();
 		netbsd32_sysctl_fini();
 		netbsd32_kern_proc_32_fini();
@@ -196,7 +197,7 @@ compat_netbsd32_modcmd(modcmd_t cmd, voi
 #if defined(__amd64__)
 			MODULE_HOOK_SET(amd64_oosyscall_hook,
 			amd64_oosyscall_handle);
-#endif
+#endif /* defined(__amd64__) */
 		}
 		return error;
 



CVS commit: src/sys/compat/common

2020-03-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Mar  9 00:42:36 UTC 2020

Modified Files:
src/sys/compat/common: compat_50_quota.c

Log Message:
The compat_50_quota code needs quota support from ufs.  Add dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_50_quota.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/compat/common/compat_50_quota.c
diff -u src/sys/compat/common/compat_50_quota.c:1.2 src/sys/compat/common/compat_50_quota.c:1.3
--- src/sys/compat/common/compat_50_quota.c:1.2	Wed Jan 22 23:41:29 2020
+++ src/sys/compat/common/compat_50_quota.c	Mon Mar  9 00:42:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_50_quota.c,v 1.2 2020/01/22 23:41:29 pgoyette Exp $ */
+/*	$NetBSD: compat_50_quota.c,v 1.3 2020/03/09 00:42:36 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_50_quota.c,v 1.2 2020/01/22 23:41:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_50_quota.c,v 1.3 2020/03/09 00:42:36 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -164,7 +164,7 @@ compat_50_sys_quotactl(struct lwp *l, co
 	return error;
 }
 
-MODULE(MODULE_CLASS_EXEC, compat_50_quota, "compat_50");
+MODULE(MODULE_CLASS_EXEC, compat_50_quota, "compat_50,ufs");
 
 static int
 compat_50_quota_modcmd(modcmd_t cmd, void *arg)



CVS commit: src/sys/dev/pci

2020-03-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Mar  9 00:32:53 UTC 2020

Modified Files:
src/sys/dev/pci: if_txp.c if_txpreg.h

Log Message:
Allocate a static set of receive software state descriptors at attach
time, and create a simple allocator for them for use by the rx reclaim
handlers.  Don't create and destroy DMA maps for receoive buffers
in the interrupt handlers -- just use the maps that are created at
attach time.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/if_txp.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/if_txpreg.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/pci/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.68 src/sys/dev/pci/if_txp.c:1.69
--- src/sys/dev/pci/if_txp.c:1.68	Sun Mar  8 22:26:03 2020
+++ src/sys/dev/pci/if_txp.c	Mon Mar  9 00:32:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.68 2020/03/08 22:26:03 thorpej Exp $ */
+/* $NetBSD: if_txp.c,v 1.69 2020/03/09 00:32:53 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.68 2020/03/08 22:26:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.69 2020/03/09 00:32:53 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -122,6 +122,9 @@ static void txp_rxbuf_reclaim(struct txp
 static void txp_rx_reclaim(struct txp_softc *, struct txp_rx_ring *,
 struct txp_dma_alloc *);
 
+static void txp_rxd_free(struct txp_softc *, struct txp_swdesc *);
+static struct txp_swdesc *txp_rxd_alloc(struct txp_softc *);
+
 CFATTACH_DECL_NEW(txp, sizeof(struct txp_softc), txp_probe, txp_attach,
 	  NULL, NULL);
 
@@ -660,6 +663,21 @@ txp_intr(void *vsc)
 	return (claimed);
 }
 
+static struct txp_swdesc *
+txp_rxd_alloc(struct txp_softc *sc)
+{
+	if (sc->sc_txd_pool_ptr == 0)
+		return NULL;
+	return sc->sc_rxd_pool[--sc->sc_txd_pool_ptr];
+}
+
+static void
+txp_rxd_free(struct txp_softc *sc, struct txp_swdesc *sd)
+{
+	KASSERT(sc->sc_txd_pool_ptr < RXBUF_ENTRIES);
+	sc->sc_rxd_pool[sc->sc_txd_pool_ptr++] = sd;
+}
+
 static void
 txp_rx_reclaim(struct txp_softc *sc, struct txp_rx_ring *r,
 struct txp_dma_alloc *dma)
@@ -696,9 +714,8 @@ txp_rx_reclaim(struct txp_softc *sc, str
 		bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0,
 		sd->sd_map->dm_mapsize, BUS_DMASYNC_POSTREAD);
 		bus_dmamap_unload(sc->sc_dmat, sd->sd_map);
-		bus_dmamap_destroy(sc->sc_dmat, sd->sd_map);
 		m = sd->sd_mbuf;
-		free(sd, M_DEVBUF);
+		txp_rxd_free(sc, sd);
 		m->m_pkthdr.len = m->m_len = le16toh(rxd->rx_len);
 
 #ifdef __STRICT_ALIGNMENT
@@ -794,8 +811,7 @@ txp_rxbuf_reclaim(struct txp_softc *sc)
 	rbd = sc->sc_rxbufs + i;
 
 	while (i != end) {
-		sd = (struct txp_swdesc *)malloc(sizeof(struct txp_swdesc),
-		M_DEVBUF, M_NOWAIT);
+		sd = txp_rxd_alloc(sc);
 		if (sd == NULL)
 			break;
 
@@ -808,12 +824,8 @@ txp_rxbuf_reclaim(struct txp_softc *sc)
 			goto err_mbuf;
 		m_set_rcvif(sd->sd_mbuf, ifp);
 		sd->sd_mbuf->m_pkthdr.len = sd->sd_mbuf->m_len = MCLBYTES;
-		if (bus_dmamap_create(sc->sc_dmat, TXP_MAX_PKTLEN, 1,
-		TXP_MAX_PKTLEN, 0, BUS_DMA_NOWAIT, >sd_map))
-			goto err_mbuf;
 		if (bus_dmamap_load_mbuf(sc->sc_dmat, sd->sd_map, sd->sd_mbuf,
 		BUS_DMA_NOWAIT)) {
-			bus_dmamap_destroy(sc->sc_dmat, sd->sd_map);
 			goto err_mbuf;
 		}
 
@@ -849,7 +861,7 @@ txp_rxbuf_reclaim(struct txp_softc *sc)
 err_mbuf:
 	m_freem(sd->sd_mbuf);
 err_sd:
-	free(sd, M_DEVBUF);
+	txp_rxd_free(sc, sd);
 }
 
 /*
@@ -1091,35 +1103,34 @@ txp_alloc_rings(struct txp_softc *sc)
 	boot->br_rxbuf_siz = htole32(RXBUF_ENTRIES * sizeof(struct txp_rxbuf_desc));
 	sc->sc_rxbufs = (struct txp_rxbuf_desc *)sc->sc_rxbufring_dma.dma_vaddr;
 	for (nb = 0; nb < RXBUF_ENTRIES; nb++) {
-		sd = malloc(sizeof(struct txp_swdesc), M_DEVBUF, M_WAITOK);
+		sd = >sc_rxd[nb];
 		/* stash away pointer */
 		memcpy(__UNVOLATILE(>sc_rxbufs[nb].rb_vaddrlo), ,
 		sizeof(sd));
 
-		MGETHDR(sd->sd_mbuf, M_DONTWAIT, MT_DATA);
+		MGETHDR(sd->sd_mbuf, M_WAIT, MT_DATA);
 		if (sd->sd_mbuf == NULL) {
 			goto bail_rxbufring;
 		}
 
-		MCLGET(sd->sd_mbuf, M_DONTWAIT);
+		MCLGET(sd->sd_mbuf, M_WAIT);
 		if ((sd->sd_mbuf->m_flags & M_EXT) == 0) {
 			goto bail_rxbufring;
 		}
 		sd->sd_mbuf->m_pkthdr.len = sd->sd_mbuf->m_len = MCLBYTES;
 		m_set_rcvif(sd->sd_mbuf, ifp);
 		if (bus_dmamap_create(sc->sc_dmat, TXP_MAX_PKTLEN, 1,
-		TXP_MAX_PKTLEN, 0, BUS_DMA_NOWAIT, >sd_map)) {
+		TXP_MAX_PKTLEN, 0, BUS_DMA_WAITOK, >sd_map)) {
 			goto bail_rxbufring;
 		}
 		if (bus_dmamap_load_mbuf(sc->sc_dmat, sd->sd_map, sd->sd_mbuf,
-		BUS_DMA_NOWAIT)) {
+		BUS_DMA_WAITOK)) {
 			bus_dmamap_destroy(sc->sc_dmat, sd->sd_map);
 			goto bail_rxbufring;
 		}
 		bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0,
 		sd->sd_map->dm_mapsize, BUS_DMASYNC_PREREAD);
 
-
 		sc->sc_rxbufs[nb].rb_paddrlo =
 		htole32(BUS_ADDR_LO32(sd->sd_map->dm_segs[0].ds_addr));
 		

CVS commit: src/sys/rump

2020-03-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Mar  9 00:03:00 UTC 2020

Modified Files:
src/sys/rump: Makefile.rump

Log Message:
Build RUMP with -fno-delete-null-pointer-checks on all compilers

no-delete-null-pointer-checks is required in Clang/LLVM at least for
NULL + 0 operations that trigger LLVM UBSan and could be miscompiled.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/rump/Makefile.rump

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

Modified files:

Index: src/sys/rump/Makefile.rump
diff -u src/sys/rump/Makefile.rump:1.125 src/sys/rump/Makefile.rump:1.126
--- src/sys/rump/Makefile.rump:1.125	Thu Feb 20 22:52:10 2020
+++ src/sys/rump/Makefile.rump	Mon Mar  9 00:03:00 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rump,v 1.125 2020/02/20 22:52:10 joerg Exp $
+#	$NetBSD: Makefile.rump,v 1.126 2020/03/09 00:03:00 kamil Exp $
 #
 
 .if !defined(_RUMP_MK)
@@ -22,7 +22,9 @@ CPPFLAGS+=	-D_RUMPKERNEL -I${RUMPTOP}/li
 # We are compiling the kernel code with no-delete-null-pointer-checks,
 # and compiling without it, causes issues at least on sh3 by adding
 # aborts after kern_assert on NULL pointer checks.
-CFLAGS+=${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :}
+# no-delete-null-pointer-checks is required in Clang/LLVM at least for
+# NULL + 0 operations that trigger LLVM UBSan and could be miscompiled.
+CFLAGS+=-fno-delete-null-pointer-checks
 
 # Define baseline cpu for mips ports, required for
 # rumpcomp_sync_icache() hypercall.



CVS commit: src/distrib/sets/lists

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:42:35 UTC 2020

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/debug: shl.mi

Log Message:
Update libc SOVERSION


To generate a diff of this commit:
cvs rdiff -u -r1.878 -r1.879 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.237 -r1.238 src/distrib/sets/lists/debug/shl.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/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.878 src/distrib/sets/lists/base/shl.mi:1.879
--- src/distrib/sets/lists/base/shl.mi:1.878	Tue Mar  3 00:38:12 2020
+++ src/distrib/sets/lists/base/shl.mi	Sun Mar  8 22:42:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.878 2020/03/03 00:38:12 christos Exp $
+# $NetBSD: shl.mi,v 1.879 2020/03/08 22:42:35 mgorny Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -21,7 +21,7 @@
 ./lib/libblacklist.so.0.0			base-sys-shlib		dynamicroot
 ./lib/libc.so	base-sys-shlib		dynamicroot
 ./lib/libc.so.12base-sys-shlib		dynamicroot
-./lib/libc.so.12.214base-sys-shlib		dynamicroot
+./lib/libc.so.12.215base-sys-shlib		dynamicroot
 ./lib/libcrypt.sobase-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1base-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1.0base-sys-shlib		dynamicroot
@@ -247,7 +247,7 @@
 ./usr/lib/libc++.so.1.0base-sys-shlib		compatfile,libcxx
 ./usr/lib/libc.sobase-sys-shlib		compatfile
 ./usr/lib/libc.so.12base-sys-shlib		compatfile
-./usr/lib/libc.so.12.214			base-sys-shlib		compatfile
+./usr/lib/libc.so.12.215			base-sys-shlib		compatfile
 ./usr/lib/libcbor.sobase-sys-shlib		compatfile
 ./usr/lib/libcbor.so.0base-sys-shlib		compatfile
 ./usr/lib/libcbor.so.0.5			base-sys-shlib		compatfile

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.237 src/distrib/sets/lists/debug/shl.mi:1.238
--- src/distrib/sets/lists/debug/shl.mi:1.237	Tue Mar  3 00:38:13 2020
+++ src/distrib/sets/lists/debug/shl.mi	Sun Mar  8 22:42:35 2020
@@ -1,9 +1,9 @@
-# $NetBSD: shl.mi,v 1.237 2020/03/03 00:38:13 christos Exp $
+# $NetBSD: shl.mi,v 1.238 2020/03/08 22:42:35 mgorny Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libavl.so.0.0.debug			comp-zfs-debug	debug,dynamicroot,zfs
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
-./usr/libdata/debug/lib/libc.so.12.214.debug			comp-sys-debug	debug,dynamicroot
+./usr/libdata/debug/lib/libc.so.12.215.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypt.so.1.0.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypto.so.12.0.debug			comp-sys-debug	debug,dynamicroot,openssl=10
 ./usr/libdata/debug/lib/libcrypto.so.14.0.debug			comp-sys-debug	debug,dynamicroot,openssl=11
@@ -80,7 +80,7 @@
 ./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libbz2.so.1.1.debug			comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libc++.so.1.0.debug			comp-sys-debug	debug,compatfile,libcxx
-./usr/libdata/debug/usr/lib/libc.so.12.214.debug		comp-sys-debug	debug,compatfile
+./usr/libdata/debug/usr/lib/libc.so.12.215.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libcbor.so.0.5.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libcom_err.so.8.0.debug		comp-krb5-debug	debug,compatfile,kerberos
 ./usr/libdata/debug/usr/lib/libcrypt.so.1.0.debug		comp-sys-debug	debug,compatfile



CVS commit: src/lib/libc

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:27:38 UTC 2020

Modified Files:
src/lib/libc: shlib_version

Log Message:
Bump new libc minor due to new errno codes


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/lib/libc/shlib_version

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/shlib_version
diff -u src/lib/libc/shlib_version:1.285 src/lib/libc/shlib_version:1.286
--- src/lib/libc/shlib_version:1.285	Sun Sep 22 22:59:37 2019
+++ src/lib/libc/shlib_version	Sun Mar  8 22:27:38 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.285 2019/09/22 22:59:37 christos Exp $
+#	$NetBSD: shlib_version,v 1.286 2020/03/08 22:27:38 mgorny Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -54,4 +54,4 @@
 # - move statfs() to libcompat since we have statvfs()
 # - the syscall stubs for the (obsolete) lfs syscalls should be removed
 major=12
-minor=214
+minor=215



CVS commit: src/sys/dev/pci

2020-03-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar  8 22:26:03 UTC 2020

Modified Files:
src/sys/dev/pci: if_txp.c if_txpreg.h

Log Message:
Give each Tx DMA map 16 DMA segments rather than the previous absurdly large
number, and structure the loop in txp_start() similarly to other drivers
(e.g. ste_start() in the ste(4) driver).  Similar in spirit to OpenBSD's
rev 1.126, but implemented a bit differently.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pci/if_txp.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/if_txpreg.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/pci/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.67 src/sys/dev/pci/if_txp.c:1.68
--- src/sys/dev/pci/if_txp.c:1.67	Sun Mar  8 20:49:31 2020
+++ src/sys/dev/pci/if_txp.c	Sun Mar  8 22:26:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.67 2020/03/08 20:49:31 thorpej Exp $ */
+/* $NetBSD: if_txp.c,v 1.68 2020/03/08 22:26:03 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.67 2020/03/08 20:49:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.68 2020/03/08 22:26:03 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -978,8 +978,8 @@ txp_alloc_rings(struct txp_softc *sc)
 	sc->sc_txhir.r_off = >sc_hostvar->hv_tx_hi_desc_read_idx;
 	for (i = 0; i < TX_ENTRIES; i++) {
 		if (bus_dmamap_create(sc->sc_dmat, TXP_MAX_PKTLEN,
-		TX_ENTRIES - 4, TXP_MAX_SEGLEN, 0,
-		BUS_DMA_NOWAIT, >sc_txd[i].sd_map) != 0) {
+		TXP_MAXTXSEGS, TXP_MAX_SEGLEN, 0, BUS_DMA_NOWAIT,
+		>sc_txd[i].sd_map) != 0) {
 			for (j = 0; j < i; j++) {
 bus_dmamap_destroy(sc->sc_dmat,
 sc->sc_txd[j].sd_map);
@@ -1403,7 +1403,8 @@ txp_start(struct ifnet *ifp)
 	struct txp_frag_desc *fxd;
 	struct mbuf *m, *mnew;
 	struct txp_swdesc *sd;
-	uint32_t firstprod, firstcnt, prod, cnt, i;
+	uint32_t prod, cnt, i;
+	int error;
 
 	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
 		return;
@@ -1412,41 +1413,66 @@ txp_start(struct ifnet *ifp)
 	cnt = r->r_cnt;
 
 	while (1) {
+		if (cnt >= TX_ENTRIES - TXP_MAXTXSEGS - 4) {
+			ifp->if_flags |= IFF_OACTIVE;
+			break;
+		}
+
 		IFQ_POLL(>if_snd, m);
 		if (m == NULL)
 			break;
 		mnew = NULL;
 
-		firstprod = prod;
-		firstcnt = cnt;
-
 		sd = sc->sc_txd + prod;
-		sd->sd_mbuf = m;
 
+		/*
+		 * Load the DMA map.  If this fails, the packet either
+		 * didn't fit in the alloted number of segments, or we
+		 * were short on resources.  In this case, we'll copy
+		 * and try again.
+		 */
 		if (bus_dmamap_load_mbuf(sc->sc_dmat, sd->sd_map, m,
-		BUS_DMA_NOWAIT)) {
+		BUS_DMA_NOWAIT) != 0) {
 			MGETHDR(mnew, M_DONTWAIT, MT_DATA);
-			if (mnew == NULL)
-goto oactive1;
+			if (mnew == NULL) {
+printf("%s: unable to allocate Tx mbuf\n",
+device_xname(sc->sc_dev));
+break;
+			}
 			if (m->m_pkthdr.len > MHLEN) {
 MCLGET(mnew, M_DONTWAIT);
 if ((mnew->m_flags & M_EXT) == 0) {
+	printf("%s: unable to allocate Tx "
+	"cluster\n",
+	device_xname(sc->sc_dev));
 	m_freem(mnew);
-	goto oactive1;
+	break;
 }
 			}
 			m_copydata(m, 0, m->m_pkthdr.len, mtod(mnew, void *));
 			mnew->m_pkthdr.len = mnew->m_len = m->m_pkthdr.len;
-			IFQ_DEQUEUE(>if_snd, m);
+			error = bus_dmamap_load_mbuf(sc->sc_dmat, sd->sd_map,
+			mnew, BUS_DMA_NOWAIT);
+			if (error) {
+printf("%s: unable to load Tx buffer, "
+"error = %d\n", device_xname(sc->sc_dev),
+error);
+m_freem(mnew);
+break;
+			}
+		}
+
+		IFQ_DEQUEUE(>if_snd, m);
+		if (mnew != NULL) {
 			m_freem(m);
 			m = mnew;
-			if (bus_dmamap_load_mbuf(sc->sc_dmat, sd->sd_map, m,
-			BUS_DMA_NOWAIT))
-goto oactive1;
 		}
 
-		if ((TX_ENTRIES - cnt) < 4)
-			goto oactive;
+		/*
+		 * WE ARE NOW COMMITTED TO TRANSMITTING THE PACKET.
+		 */
+
+		sd->sd_mbuf = m;
 
 		txd = r->r_desc + prod;
 		txdidx = prod;
@@ -1461,9 +1487,6 @@ txp_start(struct ifnet *ifp)
 		if (++prod == TX_ENTRIES)
 			prod = 0;
 
-		if (++cnt >= (TX_ENTRIES - 4))
-			goto oactive;
-
 		if (vlan_has_tag(m))
 			txd->tx_pflags = TX_PFLAGS_VLAN |
 			  (htons(vlan_get_tag(m)) << TX_PFLAGS_VLANTAG_S);
@@ -1484,13 +1507,6 @@ txp_start(struct ifnet *ifp)
 
 		fxd = (struct txp_frag_desc *)(r->r_desc + prod);
 		for (i = 0; i < sd->sd_map->dm_nsegs; i++) {
-			if (++cnt >= (TX_ENTRIES - 4)) {
-bus_dmamap_sync(sc->sc_dmat, sd->sd_map,
-0, sd->sd_map->dm_mapsize,
-BUS_DMASYNC_POSTWRITE);
-goto oactive;
-			}
-
 			fxd->frag_flags = FRAG_FLAGS_TYPE_FRAG |
 			FRAG_FLAGS_VALID;
 			fxd->frag_rsvd1 = 0;
@@ -1514,13 +1530,6 @@ txp_start(struct ifnet *ifp)
 
 		}
 
-		/*
-		 * if mnew isn't NULL, we already dequeued and copied
-		 * the packet.
-		 */
-		if (mnew == NULL)
-			IFQ_DEQUEUE(>if_snd, m);
-
 		ifp->if_timer = 5;
 
 		bpf_mtap(ifp, m, 

CVS commit: src/sys/sys

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:19:15 UTC 2020

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

Log Message:
Bump kernel version after errno changes in compat and nfs


To generate a diff of this commit:
cvs rdiff -u -r1.651 -r1.652 src/sys/sys/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/sys/param.h
diff -u src/sys/sys/param.h:1.651 src/sys/sys/param.h:1.652
--- src/sys/sys/param.h:1.651	Sun Feb 23 16:04:58 2020
+++ src/sys/sys/param.h	Sun Mar  8 22:19:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.651 2020/02/23 16:04:58 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.652 2020/03/08 22:19:14 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999004800	/* NetBSD 9.99.48 */
+#define	__NetBSD_Version__	999004900	/* NetBSD 9.99.49 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/nfs

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:12:43 UTC 2020

Modified Files:
src/sys/nfs: nfs_subs.c

Log Message:
Update NFS errno mapping and add assert for correctness

Add the mapping for errno values missing in nfsrv_v2errmap[].  While
at it, add a compile-time assert to make sure that the array does not
become out-of-date again.


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/sys/nfs/nfs_subs.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/nfs/nfs_subs.c
diff -u src/sys/nfs/nfs_subs.c:1.237 src/sys/nfs/nfs_subs.c:1.238
--- src/sys/nfs/nfs_subs.c:1.237	Mon Feb 24 20:18:53 2020
+++ src/sys/nfs/nfs_subs.c	Sun Mar  8 22:12:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_subs.c,v 1.237 2020/02/24 20:18:53 ad Exp $	*/
+/*	$NetBSD: nfs_subs.c,v 1.238 2020/03/08 22:12:42 mgorny Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.237 2020/02/24 20:18:53 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.238 2020/03/08 22:12:42 mgorny Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -207,7 +207,7 @@ const int nfsv2_procid[NFS_NPROCS] = {
  * Use NFSERR_IO as the catch all for ones not specifically defined in
  * RFC 1094.
  */
-static const u_char nfsrv_v2errmap[ELAST] = {
+static const u_char nfsrv_v2errmap[] = {
   NFSERR_PERM,	NFSERR_NOENT,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,
   NFSERR_NXIO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,
   NFSERR_IO,	NFSERR_IO,	NFSERR_ACCES,	NFSERR_IO,	NFSERR_IO,
@@ -224,8 +224,12 @@ static const u_char nfsrv_v2errmap[ELAST
   NFSERR_NOTEMPTY, NFSERR_IO,	NFSERR_IO,	NFSERR_DQUOT,	NFSERR_STALE,
   NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,
   NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,
-  NFSERR_IO,	NFSERR_IO,
+  NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,
+  NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,
+  NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,	NFSERR_IO,
+  NFSERR_IO,	NFSERR_IO,	NFSERR_IO
 };
+__CTASSERT(__arraycount(nfsrv_v2errmap) == ELAST);
 
 /*
  * Maps errno values to nfs error numbers.



CVS commit: src/external/cddl/osnet/lib/libdtrace

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:11:48 UTC 2020

Modified Files:
src/external/cddl/osnet/lib/libdtrace: errno.d
Added Files:
src/external/cddl/osnet/lib/libdtrace: make-errno-d.awk

Log Message:
Update dtrace errno.d mapping and add a script for it

Add a new script to autogenerate errno.d from errno.h, and use it
to regenerate the list to match NetBSD errno codes.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/lib/libdtrace/errno.d
cvs rdiff -u -r0 -r1.1 src/external/cddl/osnet/lib/libdtrace/make-errno-d.awk

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

Modified files:

Index: src/external/cddl/osnet/lib/libdtrace/errno.d
diff -u src/external/cddl/osnet/lib/libdtrace/errno.d:1.3 src/external/cddl/osnet/lib/libdtrace/errno.d:1.4
--- src/external/cddl/osnet/lib/libdtrace/errno.d:1.3	Mon May 28 21:05:09 2018
+++ src/external/cddl/osnet/lib/libdtrace/errno.d	Sun Mar  8 22:11:48 2020
@@ -1,4 +1,10 @@
-/*	$NetBSD: errno.d,v 1.3 2018/05/28 21:05:09 chs Exp $	*/
+/*	$NetBSD: errno.d,v 1.4 2020/03/08 22:11:48 mgorny Exp $	*/
+
+/*
+ * This file is autogenerated.  Please call:
+ *   awk make-errno-d.awk < ../../../../../sys/sys/errno.h
+ * to get new data.
+ */
 
 /*
  * CDDL HEADER START
@@ -122,8 +128,6 @@ inline int ESOCKTNOSUPPORT = 44;
 #pragma D binding "1.0" ESOCKTNOSUPPORT
 inline int EOPNOTSUPP = 45;
 #pragma D binding "1.0" EOPNOTSUPP
-inline int ENOTSUP = EOPNOTSUPP;
-#pragma D binding "1.0" ENOTSUP
 inline int EPFNOSUPPORT = 46;
 #pragma D binding "1.0" EPFNOSUPPORT
 inline int EAFNOSUPPORT = 47;
@@ -202,29 +206,43 @@ inline int ENOMSG = 83;
 #pragma D binding "1.0" ENOMSG
 inline int EOVERFLOW = 84;
 #pragma D binding "1.0" EOVERFLOW
-inline int ECANCELED = 85;
-#pragma D binding "1.0" ECANCELED
-inline int EILSEQ = 86;
+inline int EILSEQ = 85;
 #pragma D binding "1.0" EILSEQ
-inline int ENOATTR = 87;
-#pragma D binding "1.0" ENOATTR
-inline int EDOOFUS = 88;
-#pragma D binding "1.0" EDOOFUS
-inline int EBADMSG = 89;
+inline int ENOTSUP = 86;
+#pragma D binding "1.0" ENOTSUP
+inline int ECANCELED = 87;
+#pragma D binding "1.0" ECANCELED
+inline int EBADMSG = 88;
 #pragma D binding "1.0" EBADMSG
-inline int EMULTIHOP = 90;
+inline int ENODATA = 89;
+#pragma D binding "1.0" ENODATA
+inline int ENOSR = 90;
+#pragma D binding "1.0" ENOSR
+inline int ENOSTR = 91;
+#pragma D binding "1.0" ENOSTR
+inline int ETIME = 92;
+#pragma D binding "1.0" ETIME
+inline int ENOATTR = 93;
+#pragma D binding "1.0" ENOATTR
+inline int EMULTIHOP = 94;
 #pragma D binding "1.0" EMULTIHOP
-inline int ENOLINK = 91;
+inline int ENOLINK = 95;
 #pragma D binding "1.0" ENOLINK
-inline int EPROTO = 92;
+inline int EPROTO = 96;
 #pragma D binding "1.0" EPROTO
-inline int ELAST = 92;
+inline int EOWNERDEAD = 97;
+#pragma D binding "1.0" EOWNERDEAD
+inline int ENOTRECOVERABLE = 98;
+#pragma D binding "1.0" ENOTRECOVERABLE
+inline int ELAST = 98;
 #pragma D binding "1.0" ELAST
-inline int ERESTART = -1;
-#pragma D binding "1.0" ERESTART
 inline int EJUSTRETURN = -2;
 #pragma D binding "1.0" EJUSTRETURN
-inline int ENOIOCTL = -3;
-#pragma D binding "1.0" ENOIOCTL
-inline int EDIRIOCTL = -4;
-#pragma D binding "1.0" EDIRIOCTL
+inline int ERESTART = -3;
+#pragma D binding "1.0" ERESTART
+inline int EPASSTHROUGH = -4;
+#pragma D binding "1.0" EPASSTHROUGH
+inline int EDUPFD = -5;
+#pragma D binding "1.0" EDUPFD
+inline int EMOVEFD = -6;
+#pragma D binding "1.0" EMOVEFD

Added files:

Index: src/external/cddl/osnet/lib/libdtrace/make-errno-d.awk
diff -u /dev/null src/external/cddl/osnet/lib/libdtrace/make-errno-d.awk:1.1
--- /dev/null	Sun Mar  8 22:11:48 2020
+++ src/external/cddl/osnet/lib/libdtrace/make-errno-d.awk	Sun Mar  8 22:11:48 2020
@@ -0,0 +1,45 @@
+BEGIN {
+	print "/*	$NetBSD: make-errno-d.awk,v 1.1 2020/03/08 22:11:48 mgorny Exp $	*/"
+	print ""
+	print "/*"
+	print " * This file is autogenerated.  Please call:"
+	print " *   awk make-errno-d.awk < ../../../../../sys/sys/errno.h"
+	print " * to get new data."
+	print " */"
+	print ""
+	print "/*"
+	print " * CDDL HEADER START"
+	print " *"
+	print " * The contents of this file are subject to the terms of the"
+	print " * Common Development and Distribution License, Version 1.0 only"
+	print " * (the \"License\").  You may not use this file except in compliance"
+	print " * with the License."
+	print " *"
+	print " * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE"
+	print " * or http://www.opensolaris.org/os/licensing.;
+	print " * See the License for the specific language governing permissions"
+	print " * and limitations under the License."
+	print " *"
+	print " * When distributing Covered Code, include this CDDL HEADER in each"
+	print " * file and include the License file at usr/src/OPENSOLARIS.LICENSE."
+	print " * If applicable, add the following below this CDDL HEADER, with the"
+	print " * 

CVS commit: src/external/gpl3

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:11:08 UTC 2020

Modified Files:
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/aarch64: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/alpha: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/arm: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/armeb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/coldfire: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earm: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmeb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmhf: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmhfeb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv4: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv4eb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv6: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv6eb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv6hf: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv6hfeb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv7: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv7eb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv7hf: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/earmv7hfeb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/hppa: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/i386: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/ia64: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/m68000: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/m68k: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/mips64eb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/mips64el: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/mipseb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/mipsel: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/or1k: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/powerpc: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/powerpc64: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/riscv32: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/riscv64: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/sh3eb: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/sh3el: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/sparc: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/sparc64: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/vax: c++config.h
src/external/gpl3/gcc.old/lib/libstdc++-v3/arch/x86_64: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/aarch64: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/alpha: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/arm: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/armeb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earm: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/hppa: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/i386: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/ia64: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/m68000: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/m68k: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb: c++config.h
src/external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el: c++config.h

CVS commit: src

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:09:43 UTC 2020

Modified Files:
src/lib/libc/nls: C.msg
src/lib/libc/sys: intro.2
src/sys/compat/linux/common: linux_errno.c
src/sys/sys: errno.h
src/tests/include: t_errno.c

Log Message:
PR standards/44921: Add errno consts for robust mutexes

Add the two missing errno.h constants: EOWNERDEAD and ENOTRECOVERABLE.
While technically they're used for robust mutexes which we do not
support at the moment, they are listed in POSIX and used by libc++.
While libc++ can be made to build without it, it just locally redefines
the values then, so we may as well define them globally.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/nls/C.msg
cvs rdiff -u -r1.60 -r1.61 src/lib/libc/sys/intro.2
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/linux/common/linux_errno.c
cvs rdiff -u -r1.41 -r1.42 src/sys/sys/errno.h
cvs rdiff -u -r1.1 -r1.2 src/tests/include/t_errno.c

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/nls/C.msg
diff -u src/lib/libc/nls/C.msg:1.16 src/lib/libc/nls/C.msg:1.17
--- src/lib/libc/nls/C.msg:1.16	Sun Mar  8 22:06:05 2020
+++ src/lib/libc/nls/C.msg	Sun Mar  8 22:09:42 2020
@@ -191,6 +191,10 @@ $ ENOLINK
 95 Link has been severed
 $ EPROTO
 96 Protocol error
+$ EOWNERDEAD
+97 Previous owner died
+$ ENOTRECOVERABLE
+98 State not recoverable
 $set 2
 $ SIGHUP
 1 Hangup

Index: src/lib/libc/sys/intro.2
diff -u src/lib/libc/sys/intro.2:1.60 src/lib/libc/sys/intro.2:1.61
--- src/lib/libc/sys/intro.2:1.60	Mon Jul  3 21:32:50 2017
+++ src/lib/libc/sys/intro.2	Sun Mar  8 22:09:42 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: intro.2,v 1.60 2017/07/03 21:32:50 wiz Exp $
+.\"	$NetBSD: intro.2,v 1.61 2020/03/08 22:09:42 mgorny Exp $
 .\"
 .\" Copyright (c) 1980, 1983, 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -505,6 +505,11 @@ Occurs when the link (virtual circuit) c
 Some protocol error occurred.
 This error is device-specific, but is generally not related to a hardware
 failure.
+.It Er 97 EOWNERDEAD Em "Previous owner died" .
+Occurs when the last owner of a robust mutex dies while holding the mutex.
+.It Er 98 ENOTRECOVERABLE Em "State not recoverable" .
+Occurs when the last owner of a robust mutex died and the new owner
+had unlocked the mutex without making its state consistent.
 .El
 .Sh DEFINITIONS
 .Bl -tag -width Ds

Index: src/sys/compat/linux/common/linux_errno.c
diff -u src/sys/compat/linux/common/linux_errno.c:1.15 src/sys/compat/linux/common/linux_errno.c:1.16
--- src/sys/compat/linux/common/linux_errno.c:1.15	Sun Dec 22 17:14:22 2013
+++ src/sys/compat/linux/common/linux_errno.c	Sun Mar  8 22:09:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_errno.c,v 1.15 2013/12/22 17:14:22 njoly Exp $	*/
+/*	$NetBSD: linux_errno.c,v 1.16 2020/03/08 22:09:43 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_errno.c,v 1.15 2013/12/22 17:14:22 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_errno.c,v 1.16 2020/03/08 22:09:43 mgorny Exp $");
 
 #include 
 
@@ -138,5 +138,7 @@ const int native_to_linux_errno[] = {
 	LINUX_SCERR_SIGN LINUX_EMULTIHOP,
 	LINUX_SCERR_SIGN LINUX_ENOLINK,
 	LINUX_SCERR_SIGN LINUX_EPROTO,		/* 96 */
+	LINUX_SCERR_SIGN LINUX_EOWNERDEAD,
+	LINUX_SCERR_SIGN LINUX_ENOTRECOVERABLE,
 };
 __CTASSERT(__arraycount(native_to_linux_errno) == ELAST + 1);

Index: src/sys/sys/errno.h
diff -u src/sys/sys/errno.h:1.41 src/sys/sys/errno.h:1.42
--- src/sys/sys/errno.h:1.41	Sun Mar  8 22:05:40 2020
+++ src/sys/sys/errno.h	Sun Mar  8 22:09:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: errno.h,v 1.41 2020/03/08 22:05:40 mgorny Exp $	*/
+/*	$NetBSD: errno.h,v 1.42 2020/03/08 22:09:43 mgorny Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -172,7 +172,11 @@
 #define	ENOLINK		95		/* Link has been severed */
 #define	EPROTO		96		/* Protocol error */
 
-#define	ELAST		96		/* Must equal largest errno */
+/* Robust mutexes */
+#define	EOWNERDEAD	97		/* Previous owner died */
+#define	ENOTRECOVERABLE	98		/* State not recoverable */
+
+#define	ELAST		98		/* Must equal largest errno */
 
 #if defined(_KERNEL) || defined(_KMEMUSER)
 /* pseudo-errors returned inside kernel to modify return to process */

Index: src/tests/include/t_errno.c
diff -u src/tests/include/t_errno.c:1.1 src/tests/include/t_errno.c:1.2
--- src/tests/include/t_errno.c:1.1	Sun May  1 17:07:05 2011
+++ src/tests/include/t_errno.c	Sun Mar  8 22:09:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_errno.c,v 1.1 2011/05/01 17:07:05 jruoho Exp $ */
+/*	$NetBSD: t_errno.c,v 1.2 2020/03/08 22:09:43 mgorny Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_errno.c,v 1.1 2011/05/01 17:07:05 jruoho Exp 

CVS commit: src

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:08:46 UTC 2020

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/lib/libc: Makefile
Added Files:
src/tests/lib/libc/nls: Makefile t_catalog.c

Log Message:
Add tests for missing libc catalog entries


To generate a diff of this commit:
cvs rdiff -u -r1.297 -r1.298 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.832 -r1.833 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.160 -r1.161 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.49 -r1.50 src/tests/lib/libc/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/nls/Makefile \
src/tests/lib/libc/nls/t_catalog.c

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.297 src/distrib/sets/lists/debug/mi:1.298
--- src/distrib/sets/lists/debug/mi:1.297	Fri Mar  6 18:32:35 2020
+++ src/distrib/sets/lists/debug/mi	Sun Mar  8 22:08:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.297 2020/03/06 18:32:35 kamil Exp $
+# $NetBSD: mi,v 1.298 2020/03/08 22:08:46 mgorny 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
@@ -2027,6 +2027,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/net/t_ether_aton.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/net/t_getprotoent.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/net/t_if_nametoindex.debug	tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/nls/t_catalog.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/regex/h_regex.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/regex/h_regex_att.debug		tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/regex/t_exhaust.debug		tests-lib-debug		debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.832 src/distrib/sets/lists/tests/mi:1.833
--- src/distrib/sets/lists/tests/mi:1.832	Sun Mar  8 17:23:55 2020
+++ src/distrib/sets/lists/tests/mi	Sun Mar  8 22:08:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.832 2020/03/08 17:23:55 christos Exp $
+# $NetBSD: mi,v 1.833 2020/03/08 22:08:46 mgorny Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -107,6 +107,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/misctests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/nettests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/net/getaddrinfo			tests-lib-debug		compattestfile,atf
+./usr/libdata/debug/usr/tests/lib/libc/nlstests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/regextests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/rpctests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libc/setjmptests-lib-debug		compattestfile,atf
@@ -2965,6 +2966,10 @@
 ./usr/tests/lib/libc/net/t_nsdispatch		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/net/t_protoent		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/net/t_servent		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/nls			tests-lib-tests	compattestfile,atf
+./usr/tests/lib/libc/nls/Atffile		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/nls/Kyuafile		tests-lib-tests		compattestfile,atf,kyua
+./usr/tests/lib/libc/nls/t_catalog		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/regex			tests-lib-tests	compattestfile,atf
 ./usr/tests/lib/libc/regex/Atffile		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/regex/Kyuafile		tests-lib-tests		compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.160 src/etc/mtree/NetBSD.dist.tests:1.161
--- src/etc/mtree/NetBSD.dist.tests:1.160	Fri Jan 17 16:09:11 2020
+++ src/etc/mtree/NetBSD.dist.tests	Sun Mar  8 22:08:46 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.160 2020/01/17 16:09:11 christos Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.161 2020/03/08 22:08:46 mgorny Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -88,6 +88,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/misc
 ./usr/libdata/debug/usr/tests/lib/libc/net
 ./usr/libdata/debug/usr/tests/lib/libc/net/getaddrinfo
+./usr/libdata/debug/usr/tests/lib/libc/nls
 ./usr/libdata/debug/usr/tests/lib/libc/regex
 ./usr/libdata/debug/usr/tests/lib/libc/rpc
 ./usr/libdata/debug/usr/tests/lib/libc/setjmp
@@ -278,6 +279,7 @@
 ./usr/tests/lib/libc/net
 ./usr/tests/lib/libc/net/getaddrinfo
 ./usr/tests/lib/libc/net/getaddrinfo/data

CVS commit: src/lib/libc/nls

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:06:06 UTC 2020

Modified Files:
src/lib/libc/nls: C.msg

Log Message:
Sync signal messages between catalog and sys_siglist


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/nls/C.msg

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/nls/C.msg
diff -u src/lib/libc/nls/C.msg:1.15 src/lib/libc/nls/C.msg:1.16
--- src/lib/libc/nls/C.msg:1.15	Sun Mar  8 22:05:40 2020
+++ src/lib/libc/nls/C.msg	Sun Mar  8 22:06:05 2020
@@ -225,9 +225,9 @@ $ SIGTERM
 $ SIGURG
 16 Urgent I/O condition
 $ SIGSTOP
-17 Stopped (signal)
+17 Suspended (signal)
 $ SIGTSTP
-18 Stopped
+18 Suspended
 $ SIGCONT
 19 Continued
 $ SIGCHLD
@@ -239,15 +239,15 @@ $ SIGTTOU
 $ SIGIO
 23 I/O possible
 $ SIGXCPU
-24 Cputime limit exceeded
+24 CPU time limit exceeded
 $ SIGXFSZ
-25 Filesize limit exceeded
+25 File size limit exceeded
 $ SIGVTALRM
 26 Virtual timer expired
 $ SIGPROF
 27 Profiling timer expired
 $ SIGWINCH
-28 Window size changes
+28 Window size changed
 $ SIGINFO
 29 Information request
 $ SIGUSR1



CVS commit: src

2020-03-08 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Sun Mar  8 22:05:41 UTC 2020

Modified Files:
src/lib/libc/nls: C.msg
src/sys/sys: errno.h

Log Message:
Sync errno messages between catalog and errno.h


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/nls/C.msg
cvs rdiff -u -r1.40 -r1.41 src/sys/sys/errno.h

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/nls/C.msg
diff -u src/lib/libc/nls/C.msg:1.14 src/lib/libc/nls/C.msg:1.15
--- src/lib/libc/nls/C.msg:1.14	Tue Oct 31 00:38:07 2006
+++ src/lib/libc/nls/C.msg	Sun Mar  8 22:05:40 2020
@@ -118,7 +118,7 @@ $ ESHUTDOWN
 $ ETOOMANYREFS
 59 Too many references: can't splice
 $ ETIMEDOUT
-60 Connection timed out
+60 Operation timed out
 $ ECONNREFUSED
 61 Connection refused
 $ ELOOP
@@ -172,7 +172,7 @@ $ EILSEQ
 $ ENOTSUP
 86 Not supported
 $ ECANCELED
-87 Operation Canceled
+87 Operation canceled
 $ EBADMSG
 88 Bad or Corrupt message
 $ ENODATA

Index: src/sys/sys/errno.h
diff -u src/sys/sys/errno.h:1.40 src/sys/sys/errno.h:1.41
--- src/sys/sys/errno.h:1.40	Wed Jan  2 18:51:53 2013
+++ src/sys/sys/errno.h	Sun Mar  8 22:05:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: errno.h,v 1.40 2013/01/02 18:51:53 dsl Exp $	*/
+/*	$NetBSD: errno.h,v 1.41 2020/03/08 22:05:40 mgorny Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -168,7 +168,7 @@
 #define	ENOATTR		93		/* Attribute not found */
 
 /* Realtime, XSI STREAMS option errors */
-#define	EMULTIHOP	94		/* Multihop attempted */ 
+#define	EMULTIHOP	94		/* Multihop attempted */
 #define	ENOLINK		95		/* Link has been severed */
 #define	EPROTO		96		/* Protocol error */
 



CVS commit: src/common/lib/libc/misc

2020-03-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar  8 21:35:03 UTC 2020

Modified Files:
src/common/lib/libc/misc: ubsan.c

Log Message:
Add support for alignment_assumptions in uubsan

Cherry-pick from FreeBSD:

>From 7c1bc5ffc2fa68ddc76e5ea8a3a1a6fdfeee57f0 Mon Sep 17 00:00:00 2001
From: andrew 
Date: Tue, 28 May 2019 09:12:15 +
Subject: [PATCH] Teach the kernel KUBSAN runtime about alignment_assumption

This checks the alignment of a given pointer is sufficient for the
requested alignment asked for. This fixes the build with a recent
llvm/clang.

Sponsored by:   DARPA, AFRL


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/misc/ubsan.c

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

Modified files:

Index: src/common/lib/libc/misc/ubsan.c
diff -u src/common/lib/libc/misc/ubsan.c:1.9 src/common/lib/libc/misc/ubsan.c:1.10
--- src/common/lib/libc/misc/ubsan.c:1.9	Fri Nov  1 14:54:07 2019
+++ src/common/lib/libc/misc/ubsan.c	Sun Mar  8 21:35:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsan.c,v 1.9 2019/11/01 14:54:07 kamil Exp $	*/
+/*	$NetBSD: ubsan.c,v 1.10 2020/03/08 21:35:03 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,9 +38,9 @@
 
 #include 
 #if defined(_KERNEL)
-__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.9 2019/11/01 14:54:07 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.10 2020/03/08 21:35:03 kamil Exp $");
 #else
-__RCSID("$NetBSD: ubsan.c,v 1.9 2019/11/01 14:54:07 kamil Exp $");
+__RCSID("$NetBSD: ubsan.c,v 1.10 2020/03/08 21:35:03 kamil Exp $");
 #endif
 
 #if defined(_KERNEL)
@@ -245,6 +245,12 @@ struct CImplicitConversionData {
 	uint8_t mKind;
 };
 
+struct CAlignmentAssumptionData {
+	struct CSourceLocation mLocation;
+	struct CSourceLocation mAssumptionLocation;
+	struct CTypeDescriptor *mType;
+};
+
 /* Local utility functions */
 static void Report(bool isFatal, const char *pFormat, ...) __printflike(2, 3);
 static bool isAlreadyReported(struct CSourceLocation *pLocation);
@@ -278,6 +284,8 @@ intptr_t __ubsan_vptr_type_cache[128];
 /* Public symbols used in the instrumentation of the code generation part */
 void __ubsan_handle_add_overflow(struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS);
 void __ubsan_handle_add_overflow_abort(struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS);
+void __ubsan_handle_alignment_assumption(struct CAlignmentAssumptionData *pData, unsigned long ulPointer, unsigned long ulAlignment, unsigned long ulOffset);
+void __ubsan_handle_alignment_assumption_abort(struct CAlignmentAssumptionData *pData, unsigned long ulPointer, unsigned long ulAlignment, unsigned long ulOffset);
 void __ubsan_handle_builtin_unreachable(struct CUnreachableData *pData);
 void __ubsan_handle_cfi_bad_type(struct CCFICheckFailData *pData, unsigned long ulVtable, bool bValidVtable, bool FromUnrecoverableHandler, unsigned long ProgramCounter, unsigned long FramePointer);
 void __ubsan_handle_cfi_check_fail(struct CCFICheckFailData *pData, unsigned long ulValue, unsigned long ulValidVtable);
@@ -344,6 +352,7 @@ static void HandleMissingReturn(bool isF
 static void HandleNonnullArg(bool isFatal, struct CNonNullArgData *pData);
 static void HandleNonnullReturn(bool isFatal, struct CNonNullReturnData *pData, struct CSourceLocation *pLocationPointer);
 static void HandlePointerOverflow(bool isFatal, struct CPointerOverflowData *pData, unsigned long ulBase, unsigned long ulResult);
+static void HandleAlignmentAssumption(bool isFatal, struct CAlignmentAssumptionData *pData, unsigned long ulPointer, unsigned long ulAlignment, unsigned long ulOffset);
 
 static void
 HandleOverflow(bool isFatal, struct COverflowData *pData, unsigned long ulLHS, unsigned long ulRHS, const char *szOperation)
@@ -716,6 +725,34 @@ HandleImplicitConversion(bool isFatal, s
 	   szLocation, DeserializeImplicitConversionCheckKind(pData->mKind), szFrom, zDeserializeTypeWidth(pData->mFromType), ISSET(pData->mFromType->mTypeInfo, NUMBER_SIGNED_BIT) ? "signed" : "unsigned", pData->mFromType->mTypeName, pData->mToType->mTypeName, szTo, zDeserializeTypeWidth(pData->mToType), ISSET(pData->mToType->mTypeInfo, NUMBER_SIGNED_BIT) ? "signed" : "unsigned");
 }
 
+static void
+HandleAlignmentAssumption(bool isFatal, struct CAlignmentAssumptionData *pData, unsigned long ulPointer, unsigned long ulAlignment, unsigned long ulOffset)
+{
+	char szLocation[LOCATION_MAXLEN];
+	char szAssumptionLocation[LOCATION_MAXLEN];
+	unsigned long ulRealPointer;
+
+	ASSERT(pData);
+
+	if (isAlreadyReported(>mLocation))
+		return;
+
+	DeserializeLocation(szLocation, LOCATION_MAXLEN, >mLocation);
+
+	ulRealPointer = ulPointer - ulOffset;
+
+	if (pData->mAssumptionLocation.mFilename != NULL) {
+		DeserializeLocation(szAssumptionLocation, LOCATION_MAXLEN,
+		>mAssumptionLocation);
+		Report(isFatal, "UBSan: Undefined Behavior in %s, alignment assumption 

CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-03-08 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Mar  8 19:59:45 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
Avoid unnecessary zil_commit on rm.

1. Issue zil_commit only if we're actually updating something --
   there's no need to commit if we're unlinking the file or if
   there's no atime update being applied.

2. Issue zil_commit only if the zfs has sync=always set -- for
   sync=standard there's no need for us to commit anything here since
   no application asked for an explicit sync.

Speeds up untarring base.tgz on top of itself by a factor of about
2x, and speeds up rm by a factor of about 10x, on my system with an
SSD SLOG over SATA.  Histogram of unlink, rmdir, and rename timing
shows dramatic reduction in latency for most samples.

(To be fair, this was not an improvement over zfs; issuing the
unnecessary zil_commit was a self-inflicted performance wound.)


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.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/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.62 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.63
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.62	Sun Feb 23 15:46:38 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Mar  8 19:59:45 2020
@@ -5858,10 +5858,10 @@ zfs_netbsd_reclaim(void *v)
 			zp->z_atime_dirty = 0;
 			dmu_tx_commit(tx);
 		}
-	}
 
-	if (zfsvfs->z_log)
-		zil_commit(zfsvfs->z_log, zp->z_id);
+		if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
+			zil_commit(zfsvfs->z_log, zp->z_id);
+	}
 
 	if (zp->z_sa_hdl == NULL)
 		zfs_znode_free(zp);



CVS commit: src/sys/dev/pci

2020-03-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar  8 19:24:40 UTC 2020

Modified Files:
src/sys/dev/pci: if_txp.c

Log Message:
Follow the example of the MII code and don't register the half-duplex
versions of each media type.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/if_txp.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/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.65 src/sys/dev/pci/if_txp.c:1.66
--- src/sys/dev/pci/if_txp.c:1.65	Sun Mar  8 19:02:03 2020
+++ src/sys/dev/pci/if_txp.c	Sun Mar  8 19:24:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.65 2020/03/08 19:02:03 thorpej Exp $ */
+/* $NetBSD: if_txp.c,v 1.66 2020/03/08 19:24:40 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.65 2020/03/08 19:02:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.66 2020/03/08 19:24:40 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -297,21 +297,15 @@ txp_attach(device_t parent, device_t sel
 	if (flags & TXP_FIBER) {
 		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_100_FX,
 			0, NULL);
-		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_100_FX | IFM_HDX,
-			0, NULL);
 		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_100_FX | IFM_FDX,
 			0, NULL);
 	} else {
 		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_10_T,
 			0, NULL);
-		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_10_T | IFM_HDX,
-			0, NULL);
 		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_10_T | IFM_FDX,
 			0, NULL);
 		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_100_TX,
 			0, NULL);
-		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_100_TX | IFM_HDX,
-			0, NULL);
 		ifmedia_add(>sc_ifmedia, IFM_ETHER | IFM_100_TX | IFM_FDX,
 			0, NULL);
 	}



CVS commit: src/sys/dev/pci

2020-03-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar  8 19:02:03 UTC 2020

Modified Files:
src/sys/dev/pci: if_txp.c if_txpreg.h

Log Message:
- Use BUS_ADDR_{LO,HI}32(), and rather than forcing the descriptor
  DMA addresses into a 64-bit value (and thus using 64-bit shifts
  when unnecessary), just reference the address from the DMA map
  directly.
- Add some missing byte-swaps.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/if_txp.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/if_txpreg.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/pci/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.64 src/sys/dev/pci/if_txp.c:1.65
--- src/sys/dev/pci/if_txp.c:1.64	Sat Feb 29 21:31:55 2020
+++ src/sys/dev/pci/if_txp.c	Sun Mar  8 19:02:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.64 2020/02/29 21:31:55 thorpej Exp $ */
+/* $NetBSD: if_txp.c,v 1.65 2020/03/08 19:02:03 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.64 2020/02/29 21:31:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.65 2020/03/08 19:02:03 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -589,8 +589,8 @@ txp_download_fw_section(struct txp_softc
 	WRITE_REG(sc, TXP_H2A_1, le32toh(sect->nbytes));
 	WRITE_REG(sc, TXP_H2A_2, le32toh(sect->cksum));
 	WRITE_REG(sc, TXP_H2A_3, le32toh(sect->addr));
-	WRITE_REG(sc, TXP_H2A_4, dma.dma_paddr >> 32);
-	WRITE_REG(sc, TXP_H2A_5, dma.dma_paddr & 0x);
+	WRITE_REG(sc, TXP_H2A_4, BUS_ADDR_HI32(dma.dma_paddr));
+	WRITE_REG(sc, TXP_H2A_5, BUS_ADDR_LO32(dma.dma_paddr));
 	WRITE_REG(sc, TXP_H2A_0, TXP_BOOTCMD_SEGMENT_AVAILABLE);
 
 	if (txp_download_fw_wait(sc)) {
@@ -825,10 +825,10 @@ txp_rxbuf_reclaim(struct txp_softc *sc)
 		/* stash away pointer */
 		memcpy(__UNVOLATILE(>rb_vaddrlo), , sizeof(sd));
 
-		rbd->rb_paddrlo = ((uint64_t)sd->sd_map->dm_segs[0].ds_addr)
-		& 0x;
-		rbd->rb_paddrhi = ((uint64_t)sd->sd_map->dm_segs[0].ds_addr)
-		>> 32;
+		rbd->rb_paddrlo =
+		htole32(BUS_ADDR_LO32(sd->sd_map->dm_segs[0].ds_addr));
+		rbd->rb_paddrhi =
+		htole32(BUS_ADDR_HI32(sd->sd_map->dm_segs[0].ds_addr));
 
 		bus_dmamap_sync(sc->sc_dmat, sd->sd_map, 0,
 		sd->sd_map->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -955,8 +955,8 @@ txp_alloc_rings(struct txp_softc *sc)
 		goto bail_boot;
 	}
 	memset(sc->sc_host_dma.dma_vaddr, 0, sizeof(struct txp_hostvar));
-	boot->br_hostvar_lo = htole32(sc->sc_host_dma.dma_paddr & 0x);
-	boot->br_hostvar_hi = htole32(sc->sc_host_dma.dma_paddr >> 32);
+	boot->br_hostvar_lo = htole32(BUS_ADDR_LO32(sc->sc_host_dma.dma_paddr));
+	boot->br_hostvar_hi = htole32(BUS_ADDR_HI32(sc->sc_host_dma.dma_paddr));
 	sc->sc_hostvar = (struct txp_hostvar *)sc->sc_host_dma.dma_vaddr;
 
 	/* high priority tx ring */
@@ -967,11 +967,14 @@ txp_alloc_rings(struct txp_softc *sc)
 	}
 	memset(sc->sc_txhiring_dma.dma_vaddr, 0,
 	sizeof(struct txp_tx_desc) * TX_ENTRIES);
-	boot->br_txhipri_lo = htole32(sc->sc_txhiring_dma.dma_paddr & 0x);
-	boot->br_txhipri_hi = htole32(sc->sc_txhiring_dma.dma_paddr >> 32);
+	boot->br_txhipri_lo =
+	htole32(BUS_ADDR_LO32(sc->sc_txhiring_dma.dma_paddr));
+	boot->br_txhipri_hi =
+	htole32(BUS_ADDR_HI32(sc->sc_txhiring_dma.dma_paddr));
 	boot->br_txhipri_siz = htole32(TX_ENTRIES * sizeof(struct txp_tx_desc));
 	sc->sc_txhir.r_reg = TXP_H2A_1;
-	sc->sc_txhir.r_desc = (struct txp_tx_desc *)sc->sc_txhiring_dma.dma_vaddr;
+	sc->sc_txhir.r_desc =
+	(struct txp_tx_desc *)sc->sc_txhiring_dma.dma_vaddr;
 	sc->sc_txhir.r_cons = sc->sc_txhir.r_prod = sc->sc_txhir.r_cnt = 0;
 	sc->sc_txhir.r_off = >sc_hostvar->hv_tx_hi_desc_read_idx;
 	for (i = 0; i < TX_ENTRIES; i++) {
@@ -995,11 +998,14 @@ txp_alloc_rings(struct txp_softc *sc)
 	}
 	memset(sc->sc_txloring_dma.dma_vaddr, 0,
 	sizeof(struct txp_tx_desc) * TX_ENTRIES);
-	boot->br_txlopri_lo = htole32(sc->sc_txloring_dma.dma_paddr & 0x);
-	boot->br_txlopri_hi = htole32(sc->sc_txloring_dma.dma_paddr >> 32);
+	boot->br_txlopri_lo =
+	htole32(BUS_ADDR_LO32(sc->sc_txloring_dma.dma_paddr));
+	boot->br_txlopri_hi =
+	htole32(BUS_ADDR_HI32(sc->sc_txloring_dma.dma_paddr));
 	boot->br_txlopri_siz = htole32(TX_ENTRIES * sizeof(struct txp_tx_desc));
 	sc->sc_txlor.r_reg = TXP_H2A_3;
-	sc->sc_txlor.r_desc = (struct txp_tx_desc *)sc->sc_txloring_dma.dma_vaddr;
+	sc->sc_txlor.r_desc =
+	(struct txp_tx_desc *)sc->sc_txloring_dma.dma_vaddr;
 	sc->sc_txlor.r_cons = sc->sc_txlor.r_prod = sc->sc_txlor.r_cnt = 0;
 	sc->sc_txlor.r_off = >sc_hostvar->hv_tx_lo_desc_read_idx;
 
@@ -1011,8 +1017,10 @@ txp_alloc_rings(struct txp_softc *sc)
 	}
 	memset(sc->sc_rxhiring_dma.dma_vaddr, 0,
 	sizeof(struct txp_rx_desc) * RX_ENTRIES);
-	boot->br_rxhipri_lo = htole32(sc->sc_rxhiring_dma.dma_paddr & 0x);
-	boot->br_rxhipri_hi = 

CVS commit: src/sys/uvm

2020-03-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar  8 18:40:30 UTC 2020

Modified Files:
src/sys/uvm: uvm_readahead.c

Log Message:
Only need a read lock for uvm_pagelookup().


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/uvm/uvm_readahead.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/uvm/uvm_readahead.c
diff -u src/sys/uvm/uvm_readahead.c:1.11 src/sys/uvm/uvm_readahead.c:1.12
--- src/sys/uvm/uvm_readahead.c:1.11	Sun Feb 23 15:46:43 2020
+++ src/sys/uvm/uvm_readahead.c	Sun Mar  8 18:40:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_readahead.c,v 1.11 2020/02/23 15:46:43 ad Exp $	*/
+/*	$NetBSD: uvm_readahead.c,v 1.12 2020/03/08 18:40:29 ad Exp $	*/
 
 /*-
  * Copyright (c)2003, 2005, 2009 YAMAMOTO Takashi,
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_readahead.c,v 1.11 2020/02/23 15:46:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_readahead.c,v 1.12 2020/03/08 18:40:29 ad Exp $");
 
 #include 
 #include 
@@ -133,7 +133,7 @@ ra_startio(struct uvm_object *uobj, off_
 	 * too. This speeds up I/O using cache, since it avoids lookups and temporary
 	 * allocations done by full pgo_get.
 	 */
-	rw_enter(uobj->vmobjlock, RW_WRITER);
+	rw_enter(uobj->vmobjlock, RW_READER);
 	struct vm_page *pg = uvm_pagelookup(uobj, trunc_page(endoff - 1));
 	rw_exit(uobj->vmobjlock);
 	if (pg != NULL) {



CVS commit: xsrc/external/mit/xf86-video-ati-kms/dist/src

2020-03-08 Thread Maya Rashish
Module Name:xsrc
Committed By:   maya
Date:   Sun Mar  8 18:27:52 UTC 2020

Modified Files:
xsrc/external/mit/xf86-video-ati-kms/dist/src: radeon.h

Log Message:
Backport upstream commits (there is no newer release yet):

>From c0eb5dbd9c1db6b6d5b1574bcd8c584170d7ab54 Mon Sep 17 00:00:00 2001
From: Alexey Sheplyakov 
Date: Wed, 27 Nov 2019 20:50:58 +0400
Subject: Don't crash X server if GPU acceleration is not available

>From 4d84cf438e7f1bebf0053035ef0292e9fed257d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= 
Date: Fri, 29 Nov 2019 16:37:32 +0100
Subject: Handle NULL fb_ptr in pixmap_get_fb

This can happen when HW acceleration is disabled.

>From Onno van der Linden in xsrc/55059.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.10 -r1.2 \
xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon.h

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/xf86-video-ati-kms/dist/src/radeon.h
diff -u xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon.h:1.1.1.10 xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon.h:1.2
--- xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon.h:1.1.1.10	Sun Feb 23 06:17:09 2020
+++ xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon.h	Sun Mar  8 18:27:51 2020
@@ -790,8 +790,8 @@ static inline Bool radeon_set_pixmap_bo(
 
 static inline struct radeon_buffer *radeon_get_pixmap_bo(PixmapPtr pPix)
 {
-#ifdef USE_GLAMOR
 RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(pPix->drawable.pScreen));
+#ifdef USE_GLAMOR
 
 if (info->use_glamor) {
 	struct radeon_pixmap *priv;
@@ -799,7 +799,7 @@ static inline struct radeon_buffer *rade
 	return priv ? priv->bo : NULL;
 } else
 #endif
-{
+if (info->accelOn) {
 	struct radeon_exa_pixmap_priv *driver_priv;
 	driver_priv = exaGetPixmapDriverPrivate(pPix);
 	return driver_priv ? driver_priv->bo : NULL;
@@ -896,7 +896,7 @@ radeon_pixmap_get_fb(PixmapPtr pix)
    handle);
 }
 
-return *fb_ptr;
+return fb_ptr ? *fb_ptr : NULL;
 }
 
 



CVS commit: src/sys/kern

2020-03-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar  8 18:26:59 UTC 2020

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

Log Message:
Typo.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/kern/vfs_wapbl.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/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.103 src/sys/kern/vfs_wapbl.c:1.104
--- src/sys/kern/vfs_wapbl.c:1.103	Mon Dec 10 21:19:33 2018
+++ src/sys/kern/vfs_wapbl.c	Sun Mar  8 18:26:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.103 2018/12/10 21:19:33 jdolecek Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.104 2020/03/08 18:26:59 ad Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.103 2018/12/10 21:19:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.104 2020/03/08 18:26:59 ad Exp $");
 
 #include 
 #include 
@@ -356,7 +356,7 @@ wapbl_sysctl_init(void)
 	rv = sysctl_createv(_sysctl, 0, , ,
 		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
 		   CTLTYPE_INT, "allow_dpofua",
-		   SYSCTL_DESCR("allow use of FUA/DPO instead of cash flush if available"),
+		   SYSCTL_DESCR("allow use of FUA/DPO instead of cache flush if available"),
 		   NULL, 0, _allow_dpofua, 0,
 		   CTL_CREATE, CTL_EOL);
 	if (rv)



CVS commit: src/external/bsd/file/dist/magic/magdir

2020-03-08 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sun Mar  8 17:54:23 UTC 2020

Modified Files:
src/external/bsd/file/dist/magic/magdir: parix

Log Message:
mask was too loose, creating false positives.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/file/dist/magic/magdir/parix

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/file/dist/magic/magdir/parix
diff -u src/external/bsd/file/dist/magic/magdir/parix:1.1.1.2 src/external/bsd/file/dist/magic/magdir/parix:1.2
--- src/external/bsd/file/dist/magic/magdir/parix:1.1.1.2	Thu May 12 20:47:04 2011
+++ src/external/bsd/file/dist/magic/magdir/parix	Sun Mar  8 17:54:23 2020
@@ -5,7 +5,7 @@
 # Parix COFF executables
 # From: Ignatios Souvatzis 
 #
-0	beshort&0xfff	0xACE	PARIX
+0	beshort&0xefff	0x8ACE	PARIX
 >0	byte&0xf0	0x80	T800
 >0	byte&0xf0	0x90	T9000
 >19	byte&0x02	0x02	executable



CVS commit: src/sys/ufs/ext2fs

2020-03-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar  8 17:38:12 UTC 2020

Modified Files:
src/sys/ufs/ext2fs: ext2fs_vnops.c

Log Message:
Perform bit operations on unsigned integer

ext2fs_vnops.c:1002:2, signed integer overflow: 510008 * 4294 cannot be 
represented in type 'int

Maximum usec * 4294 is in the range of unsigned int.

>>> 100*4294
429400
>>> 2**32
4294967296

Patch submitted by Nisarg S. Joshi.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/ufs/ext2fs/ext2fs_vnops.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/ufs/ext2fs/ext2fs_vnops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vnops.c:1.130 src/sys/ufs/ext2fs/ext2fs_vnops.c:1.131
--- src/sys/ufs/ext2fs/ext2fs_vnops.c:1.130	Wed Sep 18 17:59:15 2019
+++ src/sys/ufs/ext2fs/ext2fs_vnops.c	Sun Mar  8 17:38:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_vnops.c,v 1.130 2019/09/18 17:59:15 christos Exp $	*/
+/*	$NetBSD: ext2fs_vnops.c,v 1.131 2020/03/08 17:38:12 kamil Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.130 2019/09/18 17:59:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.131 2020/03/08 17:38:12 kamil Exp $");
 
 #include 
 #include 
@@ -999,7 +999,7 @@ ext2fs_vinit(struct mount *mntp, int (**
 	 */
 	getmicrouptime();
 	SETHIGH(ip->i_modrev, tv.tv_sec);
-	SETLOW(ip->i_modrev, tv.tv_usec * 4294);
+	SETLOW(ip->i_modrev, tv.tv_usec * 4294U);
 	*vpp = vp;
 	return 0;
 }



CVS commit: src/usr.bin/config

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  8 17:38:37 UTC 2020

Modified Files:
src/usr.bin/config: scan.l

Log Message:
Add debugging, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/config/scan.l

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/config/scan.l
diff -u src/usr.bin/config/scan.l:1.29 src/usr.bin/config/scan.l:1.30
--- src/usr.bin/config/scan.l:1.29	Sat Mar  7 19:04:11 2020
+++ src/usr.bin/config/scan.l	Sun Mar  8 13:38:37 2020
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: scan.l,v 1.29 2020/03/08 00:04:11 christos Exp $	*/
+/*	$NetBSD: scan.l,v 1.30 2020/03/08 17:38:37 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: scan.l,v 1.29 2020/03/08 00:04:11 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.30 2020/03/08 17:38:37 christos Exp $");
 
 #include 
 #include 
@@ -79,7 +79,25 @@ int	 ifdefshift = -1;
 #define IDS_PARENT_DISABLED \
 	(ifdefshift > 0 && !IDS_ISMATCH(ifdefstate >> IDS_SHIFT))
 #define IDS_MAX_DEPTH	21 /* 64 / 3 */
- 
+
+#ifdef IDS_DEBUG
+# define IDS_PRINT(s, st, x) \
+	do { \
+		for (int i = 0; i < ifdefshift + 1; i++) \
+			fprintf(stderr, " "); \
+		printf("%s%s [%d,%d,%d] %#" PRIx64 "\n", x, # s, \
+		IDS_PARENT_DISABLED, IDS_ISMATCH(st), getcurifdef(), \
+		ifdefstate); \
+	} while (/*CONSTCOND*/0)
+#else
+# define IDS_PRINT(s, st, x) __nothing
+#endif
+
+#define IDS_ENTER(s, st) \
+	IDS_PRINT(s, st, ">")
+#define IDS_EXIT(s, st) \
+	IDS_PRINT(s, st, "<")
+
 /*
  * Data for returning to previous files from include files.
  */
@@ -175,12 +193,14 @@ with		return WITH;
 		if (++ifdefshift >= IDS_MAX_DEPTH) {
 			yyerror("too many levels of conditional");
 		}
+		IDS_ENTER(ifdef, 0);
 		if (IDS_PARENT_DISABLED || !getcurifdef()) {
 			BEGIN(IGNORED);
 		} else {
 			ifdefstate |= IDS_MATCH;
 			BEGIN(INITIAL);
 		}
+		IDS_EXIT(ifdef, 0);
 		yyline++;
 	}
 
@@ -189,18 +209,21 @@ with		return WITH;
 		if (++ifdefshift >= IDS_MAX_DEPTH) {
 			yyerror("too many levels of conditional");
 		}
+		IDS_ENTER(ifndef, 0);
 		if (IDS_PARENT_DISABLED || getcurifdef()) {
 			BEGIN(IGNORED);
 		} else {
 			ifdefstate |= IDS_MATCH;
 			BEGIN(INITIAL);
 		}
+		IDS_EXIT(ifndef, 0);
 		yyline++;
 	}
 
 
 <*>{WS}elifdef[ \t]+{WORD}{RESTOFLINE} {
 		int st = ifdefstate & IDS_BITS;
+		IDS_ENTER(elifdef, st);
 		if (ifdefshift == -1 || (st & IDS_ELSE) != 0) {
 			yyerror("mismatched elifdef");
 		}
@@ -211,11 +234,13 @@ with		return WITH;
 			BEGIN(INITIAL);
 		}
 		ifdefstate |= IDS_ELIF;
+		IDS_EXIT(elifdef, st);
 		yyline++;
 	}
 
 <*>{WS}elifndef[ \t]+{WORD}{RESTOFLINE} {
 		int st = ifdefstate & IDS_BITS;
+		IDS_ENTER(elifndef, st);
 		if (ifdefshift == -1 || (st & IDS_ELSE) != 0) {
 			yyerror("mismatched elifndef");
 		}
@@ -226,11 +251,13 @@ with		return WITH;
 			BEGIN(INITIAL);
 		}
 		ifdefstate |= IDS_ELIF;
+		IDS_EXIT(elifndef, st);
 		yyline++;
 	}
 
 <*>{WS}else{RESTOFLINE} {
 		int st = ifdefstate & IDS_BITS;
+		IDS_ENTER(else, st);
 		if (ifdefshift == -1 || (st & IDS_ELSE) != 0) {
 			yyerror("mismatched else");
 		}
@@ -241,16 +268,19 @@ with		return WITH;
 			BEGIN(INITIAL);
 		}
 		ifdefstate |= IDS_ELSE;
+		IDS_ENTER(else, st);
 		yyline++;
 	}
 
 <*>{WS}endif{RESTOFLINE} {
+		IDS_ENTER(endif, 0);
 		if (ifdefshift == -1) {
 			yyerror("mismatched endif");
 		}
 		if (!IDS_PARENT_DISABLED) {
 			BEGIN(INITIAL);
 		}
+		IDS_EXIT(endif, 0);
 		ifdefshift--;
 		ifdefstate >>= IDS_SHIFT;
 		yyline++;



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

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  8 17:23:55 UTC 2020

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

Log Message:
new test for ifconfig


To generate a diff of this commit:
cvs rdiff -u -r1.831 -r1.832 src/distrib/sets/lists/tests/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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.831 src/distrib/sets/lists/tests/mi:1.832
--- src/distrib/sets/lists/tests/mi:1.831	Fri Mar  6 13:32:35 2020
+++ src/distrib/sets/lists/tests/mi	Sun Mar  8 13:23:55 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.831 2020/03/06 18:32:35 kamil Exp $
+# $NetBSD: mi,v 1.832 2020/03/08 17:23:55 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4216,6 +4216,7 @@
 ./usr/tests/usr.bin/config/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua
 ./usr/tests/usr.bin/config/Makefile.regress	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/d_deffs_redef	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/config/d_ifconfig		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/d_loop		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/d_loop2		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/d_min		tests-usr.bin-tests	compattestfile,atf



CVS commit: src/tests/usr.bin/config

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  8 17:21:52 UTC 2020

Modified Files:
src/tests/usr.bin/config: Makefile t_config.sh
Added Files:
src/tests/usr.bin/config: d_ifdef

Log Message:
Add an ifdef test


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/config/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/config/d_ifdef
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/config/t_config.sh

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

Modified files:

Index: src/tests/usr.bin/config/Makefile
diff -u src/tests/usr.bin/config/Makefile:1.2 src/tests/usr.bin/config/Makefile:1.3
--- src/tests/usr.bin/config/Makefile:1.2	Wed Oct 29 12:24:32 2014
+++ src/tests/usr.bin/config/Makefile	Sun Mar  8 13:21:52 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2014/10/29 16:24:32 uebayasi Exp $
+# $NetBSD: Makefile,v 1.3 2020/03/08 17:21:52 christos Exp $
 
 SUBDIR=			support
 
@@ -12,6 +12,7 @@ TESTS_SH=		t_config
 
 FILESDIR=		${TESTSDIR}
 FILES=			d_deffs_redef
+FILES+=			d_ifdef
 FILES+=			d_loop
 FILES+=			d_loop2
 FILES+=			d_min

Index: src/tests/usr.bin/config/t_config.sh
diff -u src/tests/usr.bin/config/t_config.sh:1.8 src/tests/usr.bin/config/t_config.sh:1.9
--- src/tests/usr.bin/config/t_config.sh:1.8	Sat Aug 27 08:08:14 2016
+++ src/tests/usr.bin/config/t_config.sh	Sun Mar  8 13:21:52 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_config.sh,v 1.8 2016/08/27 12:08:14 christos Exp $
+# $NetBSD: t_config.sh,v 1.9 2020/03/08 17:21:52 christos Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -260,6 +260,45 @@ min_body() {
 	test_output min
 }
 
+# Check ifdef supper
+test_case ifdef pass "ifdef config"
+check_ifdef_files()
+{
+	test -e Makefile &&
+	test -e config_file.h &&
+	test -e config_time.src &&
+	test -e ioconf.c &&
+	test -e ioconf.h &&
+	test -e locators.h &&
+	test -e swapregress.c &&
+	test -h machine &&
+	test -h regress &&
+	:
+}
+
+check_ifdef_makefile()
+{
+	local f=Makefile
+	local e='-DOK1_1  -DOK2_1  -DOK2_2  -DOK3_1  -DOK3_2  -DOK3_3  -DOK3_4  -DOK3_5  -DMAXUSERS="4"'
+	local r
+	r=$(make -f Makefile -V IDENT)
+	if [ "$r" != "$e" ]; then
+		echo "Expected: '$e'"
+		echo "Result: '$r'"
+		return 1
+	fi
+}
+
+check_ifdef()
+{
+	check_ifdef_files &&
+	check_ifdef_makefile &&
+	:
+}
+ifdef_body() {
+	test_output ifdef
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case shadow_instance
@@ -275,4 +314,5 @@ atf_init_test_cases()
 	atf_add_test_case no_select
 	atf_add_test_case devi
 	atf_add_test_case min
+	atf_add_test_case ifdef
 }

Added files:

Index: src/tests/usr.bin/config/d_ifdef
diff -u /dev/null src/tests/usr.bin/config/d_ifdef:1.1
--- /dev/null	Sun Mar  8 13:21:52 2020
+++ src/tests/usr.bin/config/d_ifdef	Sun Mar  8 13:21:52 2020
@@ -0,0 +1,52 @@
+include "arch/regress/conf/std.regress"
+maxusers 4
+
+define TRUE
+ifdef TRUE
+options OK1_1
+elifdef FALSE
+options BAD1_1
+elifdef TRUE
+options BAD1_2
+else
+options BAD1_3
+endif
+
+ifdef FALSE
+options BAD2_1
+elifdef TRUE
+ifdef FALSE
+options BAD2_2
+elifdef TRUE
+options OK2_1
+else
+options BAD2_3
+endif
+options OK2_2
+endif
+
+ifdef FALSE
+options BAD3_1
+elifdef TRUE
+ifdef FALSE
+options BAD3_2
+else
+options OK3_1
+ifdef TRUE
+ifdef FALSE
+options BAD3_3
+elifdef TRUE
+options OK3_2
+endif
+options OK3_3
+elifdef TRUE
+options BAD3_4
+else
+options BAD3_5
+endif
+options OK3_4
+endif
+options OK3_5
+endif
+
+config regress root on ?



CVS commit: src/sys/kern

2020-03-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar  8 17:04:46 UTC 2020

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

Log Message:
PR kern/55020: dbregs_dr?_dont_inherit_lwp test cases fail on real hardware

lwp_wait(): make the check for deadlock much more permissive.


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/sys/kern/kern_lwp.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_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.228 src/sys/kern/kern_lwp.c:1.229
--- src/sys/kern/kern_lwp.c:1.228	Thu Feb 27 20:52:25 2020
+++ src/sys/kern/kern_lwp.c	Sun Mar  8 17:04:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.228 2020/02/27 20:52:25 ad Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.229 2020/03/08 17:04:45 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020
@@ -211,7 +211,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.228 2020/02/27 20:52:25 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.229 2020/03/08 17:04:45 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -677,12 +677,13 @@ lwp_wait(struct lwp *l, lwpid_t lid, lwp
 		}
 
 		/*
-		 * If all other LWPs are waiting for exits or suspends
-		 * and the supply of zombies and potential zombies is
-		 * exhausted, then we are about to deadlock.
+		 * Break out if the process is exiting, or if all LWPs are
+		 * in _lwp_wait().  There are other ways to hang the process
+		 * with _lwp_wait(), but the sleep is interruptable so
+		 * little point checking for them.
 		 */
 		if ((p->p_sflag & PS_WEXIT) != 0 ||
-		p->p_nrlwps + p->p_nzlwps - p->p_ndlwps <= p->p_nlwpwait) {
+		p->p_nlwpwait == p->p_nlwps) {
 			error = EDEADLK;
 			break;
 		}



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

2020-03-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar  8 15:21:15 UTC 2020

Modified Files:
src/distrib/sets/lists/modules: ad.aarch64

Log Message:
Fix sets


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/modules/ad.aarch64

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/modules/ad.aarch64
diff -u src/distrib/sets/lists/modules/ad.aarch64:1.4 src/distrib/sets/lists/modules/ad.aarch64:1.5
--- src/distrib/sets/lists/modules/ad.aarch64:1.4	Tue Feb 11 11:36:53 2020
+++ src/distrib/sets/lists/modules/ad.aarch64	Sun Mar  8 15:21:15 2020
@@ -1,9 +1,58 @@
-# $NetBSD: ad.aarch64,v 1.4 2020/02/11 11:36:53 uki Exp $
+# $NetBSD: ad.aarch64,v 1.5 2020/03/08 15:21:15 skrll Exp $
 ./@MODULEDIR@/bpfjitmodules-base-kernel	kmod,sljit
 ./@MODULEDIR@/bpfjit/bpfjit.kmod		modules-base-kernel	kmod,sljit
+./@MODULEDIR@/compat_netbsd32			modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32/compat_netbsd32.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_09		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_09/compat_netbsd32_09.kmod modules-base-kernel	kmod
+#./@MODULEDIR@/compat_netbsd32_10		modules-base-kernel	kmod
+#./@MODULEDIR@/compat_netbsd32_10/compat_netbsd32_10.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_12		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_12/compat_netbsd32_12.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_13		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_13/compat_netbsd32_13.kmod modules-base-kernel	kmod
+#./@MODULEDIR@/compat_netbsd32_14		modules-base-kernel	kmod
+#./@MODULEDIR@/compat_netbsd32_14/compat_netbsd32_14.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_16		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_16/compat_netbsd32_16.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_20		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_20/compat_netbsd32_20.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_30		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_30/compat_netbsd32_30.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_40		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_40/compat_netbsd32_40.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_43		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_43/compat_netbsd32_43.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_50		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_50/compat_netbsd32_50.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_60		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_60/compat_netbsd32_60.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_80		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_80/compat_netbsd32_80.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_90		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_90/compat_netbsd32_90.kmod modules-base-kernel	kmod
+#./@MODULEDIR@/compat_netbsd32_43		modules-base-kernel	kmod
+#./@MODULEDIR@/compat_netbsd32_43/compat_netbsd32_43.kmod modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_mqueue		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_mqueue/compat_netbsd32_mqueue.kmod	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_nfssrv		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_nfssrv/compat_netbsd32_nfssrv.kmod	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_ptrace		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_ptrace/compat_netbsd32_ptrace.kmod	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_raid		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_raid/compat_netbsd32_raid.kmod	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_sysvipc		modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_sysvipc/compat_netbsd32_sysvipc.kmod	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_sysvipc_10	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_sysvipc_10/compat_netbsd32_sysvipc_10.kmod	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_sysvipc_14	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_sysvipc_14/compat_netbsd32_sysvipc_14.kmod	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_sysvipc_50	modules-base-kernel	kmod
+./@MODULEDIR@/compat_netbsd32_sysvipc_50/compat_netbsd32_sysvipc_50.kmod	modules-base-kernel	kmod
 ./@MODULEDIR@/exec_elf32			modules-base-kernel	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	modules-base-kernel	kmod
 ./@MODULEDIR@/exec_elf64			modules-base-kernel	kmod
 ./@MODULEDIR@/exec_elf64/exec_elf64.kmod	modules-base-kernel	kmod
 ./@MODULEDIR@/sljitmodules-base-kernel	kmod,sljit
 ./@MODULEDIR@/sljit/sljit.kmod			modules-base-kernel	kmod,sljit
+



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

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 15:07:44 UTC 2020

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

Log Message:
Only inlcude fenv.h if __HAVE_FENV


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libc/sys/t_ptrace_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_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.26 src/tests/lib/libc/sys/t_ptrace_wait.h:1.27
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.26	Sat Mar  7 19:47:44 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Sun Mar  8 15:07:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.26 2020/03/07 19:47:44 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.27 2020/03/08 15:07:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -654,7 +654,9 @@ trigger_ill(void)
 #endif
 }
 
+#ifdef __HAVE_FENV
 #include 
+#endif
 
 #if (__arm__ && !__SOFTFP__) || __aarch64__
 #include  /* only need for ARM Cortex/Neon hack */



CVS commit: src/sys

2020-03-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar  8 15:05:18 UTC 2020

Modified Files:
src/sys/kern: kern_exit.c kern_lock.c kern_softint.c
src/sys/sys: lock.h

Log Message:
Kill off kernel_lock_plug_leak(), and go back to dropping kernel_lock in
exit1(), since there seems little hope of finding the leaking code any
time soon.  Can still be caught with LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.284 -r1.285 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.169 -r1.170 src/sys/kern/kern_lock.c
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/kern_softint.c
cvs rdiff -u -r1.88 -r1.89 src/sys/sys/lock.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/kern/kern_exit.c
diff -u src/sys/kern/kern_exit.c:1.284 src/sys/kern/kern_exit.c:1.285
--- src/sys/kern/kern_exit.c:1.284	Sat Feb 22 21:07:46 2020
+++ src/sys/kern/kern_exit.c	Sun Mar  8 15:05:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.284 2020/02/22 21:07:46 ad Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.285 2020/03/08 15:05:18 ad Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.284 2020/02/22 21:07:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.285 2020/03/08 15:05:18 ad Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -206,12 +206,12 @@ exit1(struct lwp *l, int exitcode, int s
 
 	p = l->l_proc;
 
-	/* XXX Temporary. */
-	kernel_lock_plug_leak();
-
 	/* Verify that we hold no locks other than p->p_lock. */
 	LOCKDEBUG_BARRIER(p->p_lock, 0);
-	KASSERTMSG(curcpu()->ci_biglock_count == 0, "kernel_lock leaked");
+
+	/* XXX Temporary: something is leaking kernel_lock. */
+	KERNEL_UNLOCK_ALL(l, NULL);
+
 	KASSERT(mutex_owned(p->p_lock));
 	KASSERT(p->p_vmspace != NULL);
 

Index: src/sys/kern/kern_lock.c
diff -u src/sys/kern/kern_lock.c:1.169 src/sys/kern/kern_lock.c:1.170
--- src/sys/kern/kern_lock.c:1.169	Mon Feb 10 22:11:09 2020
+++ src/sys/kern/kern_lock.c	Sun Mar  8 15:05:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lock.c,v 1.169 2020/02/10 22:11:09 christos Exp $	*/
+/*	$NetBSD: kern_lock.c,v 1.170 2020/03/08 15:05:18 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.169 2020/02/10 22:11:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.170 2020/03/08 15:05:18 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lockdebug.h"
@@ -343,23 +343,3 @@ _kernel_locked_p(void)
 {
 	return __SIMPLELOCK_LOCKED_P(kernel_lock);
 }
-
-void
-kernel_lock_plug_leak(void)
-{
-#ifndef LOCKDEBUG
-# ifdef DIAGNOSTIC
-	int biglocks = 0;
-	KERNEL_UNLOCK_ALL(curlwp, );
-	if (biglocks != 0) {
-		const char *sym = "(unknown)";
-		ksyms_getname(NULL, , (vaddr_t)curlwp->l_ld_wanted,
-		KSYMS_CLOSEST|KSYMS_PROC|KSYMS_ANY);
-		printf("kernel_lock leak detected. last acquired: %s / %p\n",
-		sym, curlwp->l_ld_wanted);
-	}
-# else
-	KERNEL_UNLOCK_ALL(curlwp, NULL);
-# endif
-#endif
-}

Index: src/sys/kern/kern_softint.c
diff -u src/sys/kern/kern_softint.c:1.61 src/sys/kern/kern_softint.c:1.62
--- src/sys/kern/kern_softint.c:1.61	Mon Feb 17 21:44:42 2020
+++ src/sys/kern/kern_softint.c	Sun Mar  8 15:05:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_softint.c,v 1.61 2020/02/17 21:44:42 ad Exp $	*/
+/*	$NetBSD: kern_softint.c,v 1.62 2020/03/08 15:05:18 ad Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.61 2020/02/17 21:44:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.62 2020/03/08 15:05:18 ad Exp $");
 
 #include 
 #include 
@@ -890,9 +890,6 @@ softint_dispatch(lwp_t *pinned, int s)
 		l->l_pflag &= ~LP_TIMEINTR;
 	}
 
-	/* XXX temporary */
-	kernel_lock_plug_leak();
-
 	/*
 	 * If we blocked while handling the interrupt, the pinned LWP is
 	 * gone so switch to the idle LWP.  It will select a new LWP to

Index: src/sys/sys/lock.h
diff -u src/sys/sys/lock.h:1.88 src/sys/sys/lock.h:1.89
--- src/sys/sys/lock.h:1.88	Mon Jan 27 21:05:43 2020
+++ src/sys/sys/lock.h	Sun Mar  8 15:05:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock.h,v 1.88 2020/01/27 21:05:43 ad Exp $	*/
+/*	$NetBSD: lock.h,v 1.89 2020/03/08 15:05:18 ad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2006, 2007 The NetBSD Foundation, Inc.
@@ -109,8 +109,6 @@ do {\
 
 extern __cpu_simple_lock_t kernel_lock[];
 
-void	kernel_lock_plug_leak(void);
-
 #endif /* _KERNEL */
 
 #endif /* _SYS_LOCK_H_ */



CVS commit: src/sys/uvm

2020-03-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar  8 15:01:50 UTC 2020

Modified Files:
src/sys/uvm: uvm_pdpolicy_clock.c

Log Message:
Don't zap the non-pdpolicy bits in pg->pqflags.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/uvm/uvm_pdpolicy_clock.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/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.33 src/sys/uvm/uvm_pdpolicy_clock.c:1.34
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.33	Sun Feb 23 15:46:43 2020
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Sun Mar  8 15:01:50 2020
@@ -1,8 +1,8 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.33 2020/02/23 15:46:43 ad Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.34 2020/03/08 15:01:50 ad Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*-
- * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -98,7 +98,7 @@
 #else /* defined(PDSIM) */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.33 2020/02/23 15:46:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.34 2020/03/08 15:01:50 ad Exp $");
 
 #include 
 #include 
@@ -455,7 +455,8 @@ uvmpdpol_pagedeactivate_locked(struct vm
 		TAILQ_INSERT_TAIL(_state.s_inactiveq, pg, pdqueue);
 		pdpol_state.s_inactive++;
 	}
-	pg->pqflags = (pg->pqflags & PQ_INTENT_QUEUED) | PQ_INACTIVE;
+	pg->pqflags &= ~(PQ_ACTIVE | PQ_INTENT_SET);
+	pg->pqflags |= PQ_INACTIVE;
 }
 
 void
@@ -486,7 +487,8 @@ uvmpdpol_pageactivate_locked(struct vm_p
 	uvmpdpol_pagedequeue_locked(pg);
 	TAILQ_INSERT_TAIL(_state.s_activeq, pg, pdqueue);
 	pdpol_state.s_active++;
-	pg->pqflags = (pg->pqflags & PQ_INTENT_QUEUED) | PQ_ACTIVE;
+	pg->pqflags &= ~(PQ_INACTIVE | PQ_INTENT_SET);
+	pg->pqflags |= PQ_ACTIVE;
 }
 
 void
@@ -517,7 +519,7 @@ uvmpdpol_pagedequeue_locked(struct vm_pa
 		KASSERT(pdpol_state.s_inactive > 0);
 		pdpol_state.s_inactive--;
 	}
-	pg->pqflags &= PQ_INTENT_QUEUED;
+	pg->pqflags &= ~(PQ_ACTIVE | PQ_INACTIVE | PQ_INTENT_SET);
 }
 
 void



CVS commit: src/sys/kern

2020-03-08 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar  8 15:00:31 UTC 2020

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

Log Message:
sched_preempted(): always clear LP_TELEPORT.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/kern/kern_runq.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_runq.c
diff -u src/sys/kern/kern_runq.c:1.62 src/sys/kern/kern_runq.c:1.63
--- src/sys/kern/kern_runq.c:1.62	Sat Jan 25 15:09:54 2020
+++ src/sys/kern/kern_runq.c	Sun Mar  8 15:00:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_runq.c,v 1.62 2020/01/25 15:09:54 ad Exp $	*/
+/*	$NetBSD: kern_runq.c,v 1.63 2020/03/08 15:00:31 ad Exp $	*/
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.62 2020/01/25 15:09:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.63 2020/03/08 15:00:31 ad Exp $");
 
 #include "opt_dtrace.h"
 
@@ -908,6 +908,7 @@ sched_preempted(struct lwp *l)
 		if ((tspc->spc_flags & flags) == flags &&
 		sched_migratable(l, tci)) {
 			l->l_target_cpu = tci;
+			l->l_pflag &= ~LP_TELEPORT;
 			return;
 		}
 		tci = tci->ci_sibling[CPUREL_CORE];



CVS commit: [netbsd-9] src/sys/dev/pci

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 14:44:06 UTC 2020

Modified Files:
src/sys/dev/pci [netbsd-9]: if_ena.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #759):

sys/dev/pci/if_ena.c: revision 1.24

replace #if condition for irq_slot with __diagused on the cleanup path

fixes PR kern/55044 by Uwe Toenjes


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.1 -r1.15.2.2 src/sys/dev/pci/if_ena.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/if_ena.c
diff -u src/sys/dev/pci/if_ena.c:1.15.2.1 src/sys/dev/pci/if_ena.c:1.15.2.2
--- src/sys/dev/pci/if_ena.c:1.15.2.1	Fri Aug  9 16:06:39 2019
+++ src/sys/dev/pci/if_ena.c	Sun Mar  8 14:44:06 2020
@@ -31,7 +31,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.1 2019/08/09 16:06:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.15.2.2 2020/03/08 14:44:06 martin Exp $");
 
 #include 
 #include 
@@ -2085,9 +2085,7 @@ err:
 	kcpuset_destroy(affinity);
 
 	for (i--; i >= 0; i--) {
-#if defined(DEBUG) || defined(DIAGNOSTIC)
-		int irq_slot = i + irq_off;
-#endif
+		int irq_slot __diagused = i + irq_off;
 		KASSERT(adapter->sc_ihs[irq_slot] != NULL);
 		pci_intr_disestablish(adapter->sc_pa.pa_pc, adapter->sc_ihs[i]);
 		adapter->sc_ihs[i] = NULL;



CVS commit: src/sys/dev/pci

2020-03-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Mar  8 14:10:24 UTC 2020

Modified Files:
src/sys/dev/pci: if_nfe.c

Log Message:
 Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/pci/if_nfe.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/if_nfe.c
diff -u src/sys/dev/pci/if_nfe.c:1.76 src/sys/dev/pci/if_nfe.c:1.77
--- src/sys/dev/pci/if_nfe.c:1.76	Sun Mar  1 16:31:01 2020
+++ src/sys/dev/pci/if_nfe.c	Sun Mar  8 14:10:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_nfe.c,v 1.76 2020/03/01 16:31:01 thorpej Exp $	*/
+/*	$NetBSD: if_nfe.c,v 1.77 2020/03/08 14:10:24 msaitoh Exp $	*/
 /*	$OpenBSD: if_nfe.c,v 1.77 2008/02/05 16:52:50 brad Exp $	*/
 
 /*-
@@ -21,7 +21,7 @@
 /* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.76 2020/03/01 16:31:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.77 2020/03/08 14:10:24 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -1924,11 +1924,11 @@ done:
 	addr[0] |= 0x01;	/* make sure multicast bit is set */
 
 	NFE_WRITE(sc, NFE_MULTIADDR_HI,
-	addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]);
+	(uint32_t)addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]);
 	NFE_WRITE(sc, NFE_MULTIADDR_LO,
 	addr[5] <<  8 | addr[4]);
 	NFE_WRITE(sc, NFE_MULTIMASK_HI,
-	mask[3] << 24 | mask[2] << 16 | mask[1] << 8 | mask[0]);
+	(uint32_t)mask[3] << 24 | mask[2] << 16 | mask[1] << 8 | mask[0]);
 	NFE_WRITE(sc, NFE_MULTIMASK_LO,
 	mask[5] <<  8 | mask[4]);
 
@@ -1971,7 +1971,7 @@ nfe_set_macaddr(struct nfe_softc *sc, co
 	NFE_WRITE(sc, NFE_MACADDR_LO,
 	addr[5] <<  8 | addr[4]);
 	NFE_WRITE(sc, NFE_MACADDR_HI,
-	addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]);
+	(uint32_t)addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]);
 }
 
 void



CVS commit: src/sys/dev/hid

2020-03-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Mar  8 14:09:33 UTC 2020

Modified Files:
src/sys/dev/hid: hid.h

Log Message:
Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hid/hid.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/hid/hid.h
diff -u src/sys/dev/hid/hid.h:1.4 src/sys/dev/hid/hid.h:1.5
--- src/sys/dev/hid/hid.h:1.4	Mon Mar  2 18:15:28 2020
+++ src/sys/dev/hid/hid.h	Sun Mar  8 14:09:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.h,v 1.4 2020/03/02 18:15:28 christos Exp $	*/
+/*	$NetBSD: hid.h,v 1.5 2020/03/08 14:09:32 msaitoh Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/hid.h,v 1.7 1999/11/17 22:33:40 n_hibma Exp $ */
 
 /*
@@ -123,8 +123,8 @@ int hid_is_collection(const void *, int,
 #define HUP_CAMERA_CONTROL	0x0090
 #define HUP_ARCADE		0x0091
 #define HUP_VENDOR		0x00ff
-#define HUP_FIDO		0xf1d0
-#define HUP_MICROSOFT		0xff00
+#define HUP_FIDO		0xf1d0U
+#define HUP_MICROSOFT		0xff00U
 /* XXX compat */
 #define HUP_APPLE		0x00ff
 #define HUP_WACOM		0xff00



CVS commit: [netbsd-9] src/doc

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 11:22:50 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Tickets #757 - #768


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/doc/CHANGES-9.1

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-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.9 src/doc/CHANGES-9.1:1.1.2.10
--- src/doc/CHANGES-9.1:1.1.2.9	Tue Mar  3 18:56:34 2020
+++ src/doc/CHANGES-9.1	Sun Mar  8 11:22:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.9 2020/03/03 18:56:34 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.10 2020/03/08 11:22:49 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -347,3 +347,92 @@ lib/Makefile	1.276
 	Avoid running useless makes in every subdirectory.
 	[riastradh, ticket #756]
 
+sys/conf/files	1.1257-1.1259
+
+	Fix COMPAT_NETBSD32 to properly handle EXEC_AOUT binaries.
+	[pgoyette, ticket #757]
+
+libexec/ld.elf_so/headers.c			1.68
+libexec/ld.elf_so/map_object.c			1.61
+libexec/ld.elf_so/rtld.c			1.203
+
+	PR 55043: fix protection update for the last page of a PT_GNU_RELRO
+	segment.
+	[thorpej, ticket #758]
+
+sys/dev/pci/if_ena.c1.24
+
+	PR 55044: replace #if condition for irq_slot with __diagused on the
+	cleanup path.
+	[jdolecek, ticket #759]
+
+sys/arch/amiga/dev/gayle_pcmcia.c		1.32
+sys/arch/amigappc/include/bus_defs.h		1.8
+
+	The Gayle interface uses swapped (little-endian) word accesses, so we
+	need to use the amiga_bus_stride_1swap methods for the word accesses.
+	[is, ticket #760]
+
+sys/compat/netbsd32/netbsd32_compat_43.c	1.60
+sys/compat/netbsd32/syscalls.master		1.132
+sys/compat/netbsd32/netbsd32_syscallargs.h	(regen)
+sys/compat/netbsd32/netbsd32_syscall.h		(regen)
+sys/compat/netbsd32/netbsd32_sysent.c		(regen)
+sys/compat/netbsd32/netbsd32_syscalls.c		(regen)
+sys/compat/netbsd32/netbsd32_syscalls_autoload.c (regen)
+sys/compat/netbsd32/netbsd32_systrace_args.c	(regen)
+
+	PR 55047: properly mark netbsd32_compat_43 syscalls that are
+	directly implemented by calling their compat_43 equivalents.
+	[pgoyette, ticket #761]
+
+sys/arch/amd64/amd64/trap.c			1.126
+sys/compat/netbsd32/netbsd32_mod.c		1.17,1.18
+sys/sys/compat_stub.h1.23
+
+	PR 55038: fix handling of "oosyscall" under compat_netbsd32.
+	[pgoyette, ticket #762]
+
+lib/libkvm/kvm.c1.105
+lib/libkvm/kvm_x86_64.c1.11
+
+	Only do bounce buffering for character devices.
+	Uuse a binary search in _kvm_pa2off().
+	[chs, ticket #763]
+
+sys/uvm/uvm_fault.c1.207
+
+	 - in uvm_fault_check(), if the map entry is wired, handle the fault
+	   the same way that we would handle UVM_FAULT_WIRE.
+	   Faulting on wired mappings is valid if the mapped object was
+	   truncated and then later grown again.
+
+	 - in uvm_fault_unwire_locked(), we must hold the locks for the
+	   vm_map_entry while calling pmap_extract() in order to avoid
+	   races with the mapped object being truncated while we are
+	   unwiring it.
+	[chs, ticket #764]
+
+sys/dev/acpi/acpi_pci_link.c			1.25
+
+	Fix a use-after-free bug for extended IRQ resource.
+	[chs, ticket #765]
+
+sys/kern/subr_pool.c1.265
+
+	Fix assertions about when it is ok for pool_get() to return NULL.
+	[chs, ticket #766]
+
+sys/ufs/ufs/ufs_dirhash.c			1.38
+
+	In ufsdirhash_free(), only examine dh->dh_onlist after taking the
+	dirhashlist lock.
+	[chs, ticket #767]
+
+sys/kern/kern_mutex.c1.90
+
+	Split an "a && b" assertion into two so it's clear in the dump
+	which condition was not true even if both are true by the time
+	the dump is written.
+	[chs, ticket #768]
+



CVS commit: [netbsd-9] src/sys/kern

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 11:21:29 UTC 2020

Modified Files:
src/sys/kern [netbsd-9]: kern_mutex.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #768):

sys/kern/kern_mutex.c: revision 1.90

split an "a && b" assertion into two so it's clear in the dump which condition
was not true even if both are true by the time the dump is written.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.79.2.1 src/sys/kern/kern_mutex.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_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.79 src/sys/kern/kern_mutex.c:1.79.2.1
--- src/sys/kern/kern_mutex.c:1.79	Thu May  9 05:00:31 2019
+++ src/sys/kern/kern_mutex.c	Sun Mar  8 11:21:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.79 2019/05/09 05:00:31 ozaki-r Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.79.2.1 2020/03/08 11:21:29 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.79 2019/05/09 05:00:31 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.79.2.1 2020/03/08 11:21:29 martin Exp $");
 
 #include 
 #include 
@@ -397,8 +397,8 @@ mutex_destroy(kmutex_t *mtx)
 {
 
 	if (MUTEX_ADAPTIVE_P(mtx)) {
-		MUTEX_ASSERT(mtx, !MUTEX_OWNED(mtx->mtx_owner) &&
-		!MUTEX_HAS_WAITERS(mtx));
+		MUTEX_ASSERT(mtx, !MUTEX_OWNED(mtx->mtx_owner));
+		MUTEX_ASSERT(mtx, !MUTEX_HAS_WAITERS(mtx));
 	} else {
 		MUTEX_ASSERT(mtx, !MUTEX_SPINBIT_LOCKED_P(mtx));
 	}



CVS commit: [netbsd-9] src/sys/ufs/ufs

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 11:07:58 UTC 2020

Modified Files:
src/sys/ufs/ufs [netbsd-9]: ufs_dirhash.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #767):

sys/ufs/ufs/ufs_dirhash.c: revision 1.38

in ufsdirhash_free(), only examine dh->dh_onlist after taking the
dirhashlist lock.  if we skip the lock then we might see that
dh_onlist is zero while ufsdirhash_recycle() is still working on
the dirhash.  the symptom I saw was that ufsdirhash_free() would
try to destroy the dh_lock mutex while it was still held.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.37.22.1 src/sys/ufs/ufs/ufs_dirhash.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/ufs/ufs/ufs_dirhash.c
diff -u src/sys/ufs/ufs/ufs_dirhash.c:1.37 src/sys/ufs/ufs/ufs_dirhash.c:1.37.22.1
--- src/sys/ufs/ufs/ufs_dirhash.c:1.37	Sat Dec 20 00:28:05 2014
+++ src/sys/ufs/ufs/ufs_dirhash.c	Sun Mar  8 11:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_dirhash.c,v 1.37 2014/12/20 00:28:05 christos Exp $	*/
+/*	$NetBSD: ufs_dirhash.c,v 1.37.22.1 2020/03/08 11:07:58 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Ian Dowse.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.37 2014/12/20 00:28:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.37.22.1 2020/03/08 11:07:58 martin Exp $");
 
 /*
  * This implements a hash-based lookup scheme for UFS directories.
@@ -285,12 +285,10 @@ ufsdirhash_free(struct inode *ip)
 
 	ip->i_dirhash = NULL;
 
-	if (dh->dh_onlist) {
-		DIRHASHLIST_LOCK();
-		if (dh->dh_onlist)
-			TAILQ_REMOVE(_list, dh, dh_list);
-		DIRHASHLIST_UNLOCK();
-	}
+	DIRHASHLIST_LOCK();
+	if (dh->dh_onlist)
+		TAILQ_REMOVE(_list, dh, dh_list);
+	DIRHASHLIST_UNLOCK();
 
 	/* The dirhash pointed to by 'dh' is exclusively ours now. */
 	mem = sizeof(*dh);



CVS commit: [netbsd-9] src/sys/kern

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 11:04:43 UTC 2020

Modified Files:
src/sys/kern [netbsd-9]: subr_pool.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #766):

sys/kern/subr_pool.c: revision 1.265

fix assertions about when it is ok for pool_get() to return NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.252.2.2 -r1.252.2.3 src/sys/kern/subr_pool.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_pool.c
diff -u src/sys/kern/subr_pool.c:1.252.2.2 src/sys/kern/subr_pool.c:1.252.2.3
--- src/sys/kern/subr_pool.c:1.252.2.2	Sun Sep  1 10:56:00 2019
+++ src/sys/kern/subr_pool.c	Sun Mar  8 11:04:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.252.2.2 2019/09/01 10:56:00 martin Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.252.2.3 2020/03/08 11:04:43 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252.2.2 2019/09/01 10:56:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252.2.3 2020/03/08 11:04:43 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1062,7 +1062,7 @@ pool_get(struct pool *pp, int flags)
 
 			pp->pr_nfail++;
 			mutex_exit(>pr_lock);
-			KASSERT((flags & (PR_WAITOK|PR_NOWAIT)) == PR_NOWAIT);
+			KASSERT((flags & (PR_NOWAIT|PR_LIMITFAIL)) != 0);
 			return NULL;
 		}
 
@@ -2422,7 +2422,7 @@ pool_cache_get_slow(pool_cache_cpu_t *cc
 	object = pool_get(>pc_pool, flags);
 	*objectp = object;
 	if (__predict_false(object == NULL)) {
-		KASSERT((flags & (PR_WAITOK|PR_NOWAIT)) == PR_NOWAIT);
+		KASSERT((flags & (PR_NOWAIT|PR_LIMITFAIL)) != 0);
 		return false;
 	}
 



CVS commit: [netbsd-9] src/sys/dev/acpi

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 11:03:19 UTC 2020

Modified Files:
src/sys/dev/acpi [netbsd-9]: acpi_pci_link.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #765):

sys/dev/acpi/acpi_pci_link.c: revision 1.25

apply FreeBSD revs r214848 and r214849:

r214849 | jkim | 2010-11-05 13:24:26 -0700 (Fri, 05 Nov 2010) | 2 lines
Add a forgotten change from the previous commit.
r214848 | jkim | 2010-11-05 12:50:09 -0700 (Fri, 05 Nov 2010) | 13 lines

Fix a use-after-free bug for extended IRQ resource[1].  When _PRS buffer is
copied as a template for _SRS, a string pointer for descriptor name is also
copied and it becomes stale as soon as it gets de-allocated[2].  Now _CRS is
used as a template for _SRS as ACPI specification suggests if it is usable.

The template from _PRS is still utilized but only when _CRS is not available
or broken.  To avoid use-after-free the problem in this case, however, only
mandatory fields are copied, optional data is removed, and structure length
is adjusted accordingly.

Reported by:hps[1]
Analyzed by:avg[2]
Tested by:  hps

This also fixes reading past the end of a structure as detected by KASAN.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.26.1 src/sys/dev/acpi/acpi_pci_link.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/acpi/acpi_pci_link.c
diff -u src/sys/dev/acpi/acpi_pci_link.c:1.22 src/sys/dev/acpi/acpi_pci_link.c:1.22.26.1
--- src/sys/dev/acpi/acpi_pci_link.c:1.22	Sun Sep 14 19:54:05 2014
+++ src/sys/dev/acpi/acpi_pci_link.c	Sun Mar  8 11:03:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_pci_link.c,v 1.22 2014/09/14 19:54:05 mrg Exp $	*/
+/*	$NetBSD: acpi_pci_link.c,v 1.22.26.1 2020/03/08 11:03:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002 Mitsuru IWASAKI 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.22 2014/09/14 19:54:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.22.26.1 2020/03/08 11:03:19 martin Exp $");
 
 #include 
 #include 
@@ -255,6 +255,7 @@ link_add_crs(ACPI_RESOURCE *res, void *c
 static ACPI_STATUS
 link_add_prs(ACPI_RESOURCE *res, void *context)
 {
+	ACPI_RESOURCE *tmp;
 	struct link_res_request *req;
 	struct link *link;
 	uint8_t *irqs = NULL;
@@ -301,32 +302,28 @@ link_add_prs(ACPI_RESOURCE *res, void *c
 		req->res_index++;
 
 		/*
-		 * Stash a copy of the resource for later use when
-		 * doing _SRS.
-		 *
-		 * Note that in theory res->Length may exceed the size
-		 * of ACPI_RESOURCE, due to variable length lists in
-		 * subtypes.  However, all uses of l_prs_template only
-		 * rely on lists lengths of zero or one, for which
-		 * sizeof(ACPI_RESOURCE) is sufficient space anyway.
-		 * We cannot read longer than Length bytes, in case we
-		 * read off the end of mapped memory.  So we read
-		 * whichever length is shortest, Length or
-		 * sizeof(ACPI_RESOURCE).
+		 * Stash a copy of the resource for later use when doing
+		 * _SRS.
 		 */
-		KASSERT(res->Length >= ACPI_RS_SIZE_MIN);
+		tmp = >l_prs_template;
+		if (is_ext_irq) {
+			memcpy(tmp, res, ACPI_RS_SIZE(tmp->Data.ExtendedIrq));
 
-		memset(>l_prs_template, 0, sizeof(link->l_prs_template));
-		memcpy(>l_prs_template, res,
-		   MIN(res->Length, sizeof(link->l_prs_template)));
+			/*
+			 * XXX acpi_AppendBufferResource() cannot handle
+			 * optional data.
+			 */
+			memset(>Data.ExtendedIrq.ResourceSource, 0,
+			sizeof(tmp->Data.ExtendedIrq.ResourceSource));
+			tmp->Length = ACPI_RS_SIZE(tmp->Data.ExtendedIrq);
 
-		if (is_ext_irq) {
 			link->l_num_irqs =
 			res->Data.ExtendedIrq.InterruptCount;
 			link->l_trig = res->Data.ExtendedIrq.Triggering;
 			link->l_pol = res->Data.ExtendedIrq.Polarity;
 			ext_irqs = res->Data.ExtendedIrq.Interrupts;
 		} else {
+			memcpy(tmp, res, ACPI_RS_SIZE(tmp->Data.Irq));
 			link->l_num_irqs = res->Data.Irq.InterruptCount;
 			link->l_trig = res->Data.Irq.Triggering;
 			link->l_pol = res->Data.Irq.Polarity;
@@ -737,17 +734,16 @@ acpi_pci_link_add_reference(void *v, int
 static ACPI_STATUS
 acpi_pci_link_srs_from_crs(struct acpi_pci_link_softc *sc, ACPI_BUFFER *srsbuf)
 {
-	ACPI_RESOURCE *resource, *end, newres, *resptr;
-	ACPI_BUFFER crsbuf;
+	ACPI_RESOURCE *end, *res;
 	ACPI_STATUS status;
 	struct link *link;
 	int i, in_dpf;
 
 	/* Fetch the _CRS. */
-	crsbuf.Pointer = NULL;
-	crsbuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
-	status = AcpiGetCurrentResources(sc->pl_handle, );
-	if (ACPI_SUCCESS(status) && crsbuf.Pointer == NULL)
+	srsbuf->Pointer = NULL;
+	srsbuf->Length = ACPI_ALLOCATE_BUFFER;
+	status = AcpiGetCurrentResources(sc->pl_handle, srsbuf);
+	if (ACPI_SUCCESS(status) && srsbuf->Pointer == NULL)
 		status = AE_NO_MEMORY;
 	if (ACPI_FAILURE(status)) {
 		aprint_verbose("%s: Unable to fetch current resources: 

CVS commit: [netbsd-9] src/sys/uvm

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 11:01:22 UTC 2020

Modified Files:
src/sys/uvm [netbsd-9]: uvm_fault.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #764):

sys/uvm/uvm_fault.c: revision 1.207

fix two bugs reported in
https://syzkaller.appspot.com/bug?id=8840dce484094a926e1ec388ffb83acb2fa291c9

 - in uvm_fault_check(), if the map entry is wired, handle the fault the same 
way
   that we would handle UVM_FAULT_WIRE.  faulting on wired mappings is valid
   if the mapped object was truncated and then later grown again.

 - in uvm_fault_unwire_locked(), we must hold the locks for the vm_map_entry
   while calling pmap_extract() in order to avoid races with the mapped object
   being truncated while we are unwiring it.


To generate a diff of this commit:
cvs rdiff -u -r1.206.2.1 -r1.206.2.2 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.206.2.1 src/sys/uvm/uvm_fault.c:1.206.2.2
--- src/sys/uvm/uvm_fault.c:1.206.2.1	Mon Nov 11 17:13:28 2019
+++ src/sys/uvm/uvm_fault.c	Sun Mar  8 11:01:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.206.2.1 2019/11/11 17:13:28 martin Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.206.2.2 2020/03/08 11:01:22 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.206.2.1 2019/11/11 17:13:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.206.2.2 2020/03/08 11:01:22 martin Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -996,8 +996,11 @@ uvm_fault_check(
 	 */
 
 	flt->enter_prot = ufi->entry->protection;
-	if (VM_MAPENT_ISWIRED(ufi->entry))
+	if (VM_MAPENT_ISWIRED(ufi->entry)) {
 		flt->wire_mapping = true;
+		flt->wire_paging = true;
+		flt->narrow = true;
+	}
 
 	if (flt->wire_mapping) {
 		flt->access_type = flt->enter_prot; /* full access for wired */
@@ -2442,8 +2445,6 @@ uvm_fault_unwire_locked(struct vm_map *m
 
 	oentry = NULL;
 	for (va = start; va < end; va += PAGE_SIZE) {
-		if (pmap_extract(pmap, va, ) == false)
-			continue;
 
 		/*
 		 * find the map entry for the current address.
@@ -2474,6 +2475,9 @@ uvm_fault_unwire_locked(struct vm_map *m
 		 * if the entry is no longer wired, tell the pmap.
 		 */
 
+		if (!pmap_extract(pmap, va, ))
+			continue;
+
 		if (VM_MAPENT_ISWIRED(entry) == 0)
 			pmap_unwire(pmap, va);
 



CVS commit: [netbsd-9] src/lib/libkvm

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:57:15 UTC 2020

Modified Files:
src/lib/libkvm [netbsd-9]: kvm.c kvm_x86_64.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #763):

lib/libkvm/kvm.c: revision 1.105
lib/libkvm/kvm_x86_64.c: revision 1.11

only do bounce buffering for character devices.

use a binary search in _kvm_pa2off().  this helps a lot for sparse dumps,
which can have millions of memory segments.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.104.2.1 src/lib/libkvm/kvm.c
cvs rdiff -u -r1.10 -r1.10.28.1 src/lib/libkvm/kvm_x86_64.c

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

Modified files:

Index: src/lib/libkvm/kvm.c
diff -u src/lib/libkvm/kvm.c:1.104 src/lib/libkvm/kvm.c:1.104.2.1
--- src/lib/libkvm/kvm.c:1.104	Mon Nov  5 00:43:30 2018
+++ src/lib/libkvm/kvm.c	Sun Mar  8 10:57:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm.c,v 1.104 2018/11/05 00:43:30 mrg Exp $	*/
+/*	$NetBSD: kvm.c,v 1.104.2.1 2020/03/08 10:57:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm.c	8.2 (Berkeley) 2/13/94";
 #else
-__RCSID("$NetBSD: kvm.c,v 1.104 2018/11/05 00:43:30 mrg Exp $");
+__RCSID("$NetBSD: kvm.c,v 1.104.2.1 2020/03/08 10:57:15 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -352,7 +352,12 @@ _kvm_open(kvm_t *kd, const char *uf, con
 			/* swap is not configured?  not fatal */
 		}
 	} else {
-		kd->fdalign = DEV_BSIZE;	/* XXX */
+		if (S_ISCHR(st.st_mode)) {
+			kd->fdalign = DEV_BSIZE;
+		} else {
+			kd->fdalign = 1;
+		}
+
 		/*
 		 * This is a crash dump.
 		 * Initialize the virtual address translation machinery.

Index: src/lib/libkvm/kvm_x86_64.c
diff -u src/lib/libkvm/kvm_x86_64.c:1.10 src/lib/libkvm/kvm_x86_64.c:1.10.28.1
--- src/lib/libkvm/kvm_x86_64.c:1.10	Wed Feb 19 20:21:22 2014
+++ src/lib/libkvm/kvm_x86_64.c	Sun Mar  8 10:57:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm_x86_64.c,v 1.10 2014/02/19 20:21:22 dsl Exp $	*/
+/*	$NetBSD: kvm_x86_64.c,v 1.10.28.1 2020/03/08 10:57:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)kvm_hp300.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: kvm_x86_64.c,v 1.10 2014/02/19 20:21:22 dsl Exp $");
+__RCSID("$NetBSD: kvm_x86_64.c,v 1.10.28.1 2020/03/08 10:57:15 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -186,6 +186,36 @@ _kvm_kvatop(kvm_t *kd, vaddr_t va, paddr
 	return (0);
 }
 
+struct p2o {
+	paddr_t pa;
+	psize_t sz;
+	off_t off;
+};
+
+static int
+cmp_p2o(const void *a, const void *b)
+{
+	const struct p2o *p1 = a;
+	const struct p2o *p2 = b;
+
+	/* If one range contains the start of the other, it's a match. */
+	if (p1->pa >= p2->pa && p1->pa < p2->pa + p2->sz) {
+		return 0;
+	}
+	if (p2->pa >= p1->pa && p2->pa < p1->pa + p1->sz) {
+		return 0;
+	}
+
+	/* Otherwise sort by pa. */
+	if (p1->pa < p2->pa)
+		return -1;
+	else if (p1->pa > p2->pa)
+		return 1;
+	else
+		return 0;
+}
+
+
 /*
  * Translate a physical address to a file-offset in the crash dump.
  */
@@ -197,19 +227,36 @@ _kvm_pa2off(kvm_t *kd, paddr_t pa)
 	off_t off;
 	int i;
 
+	static struct p2o *map;
+	struct p2o key, *val;
+
 	cpu_kh = kd->cpu_data;
 	ramsegs = (void *)((char *)(void *)cpu_kh + ALIGN(sizeof *cpu_kh));
 
-	off = 0;
-	for (i = 0; i < cpu_kh->nmemsegs; i++) {
-		if (pa >= ramsegs[i].start &&
-		(pa - ramsegs[i].start) < ramsegs[i].size) {
-			off += (pa - ramsegs[i].start);
-			break;
+	if (map == NULL) {
+		map = calloc(sizeof *map, cpu_kh->nmemsegs);
+		off = 0;
+		for (i = 0; i < cpu_kh->nmemsegs; i++) {
+			map[i].pa = ramsegs[i].start;
+			map[i].sz = ramsegs[i].size;
+			map[i].off = off;
+			off += ramsegs[i].size;
 		}
-		off += ramsegs[i].size;
+#if 0
+		/* The array appears to be sorted already */
+		qsort(map, cpu_kh->nmemsegs, sizeof(*map), cmp_p2o);
+#endif
 	}
 
+	key.pa = pa;
+	key.sz = 1;
+	key.off = -1;
+	val = bsearch(, map, cpu_kh->nmemsegs, sizeof (key), cmp_p2o);
+	if (val)
+		off = val->off + pa - val->pa;
+	else
+		off = 0;
+
 	return (kd->dump_off + off);
 }
 



CVS commit: [netbsd-9] src/sys

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:54:43 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: trap.c
src/sys/compat/netbsd32 [netbsd-9]: netbsd32_mod.c
src/sys/sys [netbsd-9]: compat_stub.h

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #762):

sys/arch/amd64/amd64/trap.c: revision 1.126
sys/compat/netbsd32/netbsd32_mod.c: revision 1.17
sys/compat/netbsd32/netbsd32_mod.c: revision 1.18
sys/sys/compat_stub.h: revision 1.23

Fix another left-over from last year's [pgoyette-compat] work.  This
allows recognition of the oosyscall sequence for amd64.

Fixes PR kern/55038
XXX pullup-9

 -

fix indentation.  NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.121.2.1 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.15 -r1.15.4.1 src/sys/compat/netbsd32/netbsd32_mod.c
cvs rdiff -u -r1.18.2.2 -r1.18.2.3 src/sys/sys/compat_stub.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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.121 src/sys/arch/amd64/amd64/trap.c:1.121.2.1
--- src/sys/arch/amd64/amd64/trap.c:1.121	Sat Jul 13 17:03:01 2019
+++ src/sys/arch/amd64/amd64/trap.c	Sun Mar  8 10:54:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.121 2019/07/13 17:03:01 mlelstv Exp $	*/
+/*	$NetBSD: trap.c,v 1.121.2.1 2020/03/08 10:54:43 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121 2019/07/13 17:03:01 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121.2.1 2020/03/08 10:54:43 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -83,14 +83,11 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
-#ifdef COMPAT_NETBSD32
-#include 
-#include 
-#endif
-
 #include 
 #include 
 #include 
@@ -121,6 +118,11 @@ dtrace_trap_func_t	dtrace_trap_func = NU
 dtrace_doubletrap_func_t	dtrace_doubletrap_func = NULL;
 #endif
 
+/*
+ * Module hook for amd64_oosyscall
+ */
+struct amd64_oosyscall_hook_t amd64_oosyscall_hook;
+
 void nmitrap(struct trapframe *);
 void doubletrap(struct trapframe *);
 void trap(struct trapframe *);
@@ -350,32 +352,12 @@ trap(struct trapframe *frame)
 		goto we_re_toast;
 
 	case T_PROTFLT|T_USER:		/* protection fault */
-#if defined(COMPAT_NETBSD32) && defined(COMPAT_10)
-
-/*
- * XXX This code currently not included in loadable module;  it is
- * only included in built-in modules.
- */
-	{
-		static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
-		const size_t sz = sizeof(lcall);
-		char tmp[sz];
-
-		/* Check for the oosyscall lcall instruction. */
-		if (p->p_emul == _netbsd32 &&
-		frame->tf_rip < VM_MAXUSER_ADDRESS32 - sz &&
-		copyin((void *)frame->tf_rip, tmp, sz) == 0 &&
-		memcmp(tmp, lcall, sz) == 0) {
-
-			/* Advance past the lcall. */
-			frame->tf_rip += sz;
+	{	int hook_ret;
 
-			/* Do the syscall. */
-			p->p_md.md_syscall(frame);
-			goto out;
-		}
+		MODULE_HOOK_CALL(amd64_oosyscall_hook, (p, frame),
+			ENOSYS, hook_ret);
+		if (hook_ret == 0)
 	}
-#endif
 		/* FALLTHROUGH */
 	case T_TSSFLT|T_USER:
 	case T_SEGNPFLT|T_USER:

Index: src/sys/compat/netbsd32/netbsd32_mod.c
diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.15 src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.1
--- src/sys/compat/netbsd32/netbsd32_mod.c:1.15	Sun Jan 27 02:08:40 2019
+++ src/sys/compat/netbsd32/netbsd32_mod.c	Sun Mar  8 10:54:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_mod.c,v 1.15 2019/01/27 02:08:40 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_mod.c,v 1.15.4.1 2020/03/08 10:54:43 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,8 +29,37 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum, and by Maxime Villard.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ 

CVS commit: [netbsd-9] src/sys/compat/netbsd32

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:38:10 UTC 2020

Modified Files:
src/sys/compat/netbsd32 [netbsd-9]: netbsd32_syscall.h
netbsd32_syscallargs.h netbsd32_syscalls.c
netbsd32_syscalls_autoload.c netbsd32_sysent.c
netbsd32_systrace_args.c

Log Message:
Regen (for ticket #761)


To generate a diff of this commit:
cvs rdiff -u -r1.142.2.1 -r1.142.2.2 \
src/sys/compat/netbsd32/netbsd32_syscall.h
cvs rdiff -u -r1.141.2.1 -r1.141.2.2 \
src/sys/compat/netbsd32/netbsd32_syscallargs.h \
src/sys/compat/netbsd32/netbsd32_syscalls.c
cvs rdiff -u -r1.21.2.1 -r1.21.2.2 \
src/sys/compat/netbsd32/netbsd32_syscalls_autoload.c
cvs rdiff -u -r1.140.2.1 -r1.140.2.2 \
src/sys/compat/netbsd32/netbsd32_sysent.c
cvs rdiff -u -r1.32.2.1 -r1.32.2.2 \
src/sys/compat/netbsd32/netbsd32_systrace_args.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/compat/netbsd32/netbsd32_syscall.h
diff -u src/sys/compat/netbsd32/netbsd32_syscall.h:1.142.2.1 src/sys/compat/netbsd32/netbsd32_syscall.h:1.142.2.2
--- src/sys/compat/netbsd32/netbsd32_syscall.h:1.142.2.1	Mon Nov  4 14:47:33 2019
+++ src/sys/compat/netbsd32/netbsd32_syscall.h	Sun Mar  8 10:38:10 2020
@@ -1,10 +1,10 @@
-/* $NetBSD: netbsd32_syscall.h,v 1.142.2.1 2019/11/04 14:47:33 martin Exp $ */
+/* $NetBSD: netbsd32_syscall.h,v 1.142.2.2 2020/03/08 10:38:10 martin Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.127.2.1 2019/11/04 14:46:57 martin Exp
+ * created from	NetBSD: syscalls.master,v 1.127.2.2 2020/03/08 10:36:38 martin Exp
  */
 
 #ifndef _NETBSD32_SYS_SYSCALL_H_
@@ -432,13 +432,10 @@
 /* syscall: "compat_50_netbsd32_quotactl" ret: "int" args: "netbsd32_charp" "int" "int" "netbsd32_voidp" */
 #define	NETBSD32_SYS_compat_50_netbsd32_quotactl	148
 
-/* syscall: "compat_43_oquota" ret: "int" args: */
-#define	NETBSD32_SYS_compat_43_oquota	149
-
 #else
 /* 148 is excluded compat_netbsd32_quotactl */
-/* 149 is excluded compat_netbsd32_quota */
 #endif
+/* 149 is excluded compat_netbsd32_quota */
 /* syscall: "compat_43_netbsd32_ogetsockname" ret: "int" args: "int" "netbsd32_voidp" "netbsd32_intp" */
 #define	NETBSD32_SYS_compat_43_netbsd32_ogetsockname	150
 

Index: src/sys/compat/netbsd32/netbsd32_syscallargs.h
diff -u src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.141.2.1 src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.141.2.2
--- src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.141.2.1	Mon Nov  4 14:47:33 2019
+++ src/sys/compat/netbsd32/netbsd32_syscallargs.h	Sun Mar  8 10:38:10 2020
@@ -1,10 +1,10 @@
-/* $NetBSD: netbsd32_syscallargs.h,v 1.141.2.1 2019/11/04 14:47:33 martin Exp $ */
+/* $NetBSD: netbsd32_syscallargs.h,v 1.141.2.2 2020/03/08 10:38:10 martin Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.127.2.1 2019/11/04 14:46:57 martin Exp
+ * created from	NetBSD: syscalls.master,v 1.127.2.2 2020/03/08 10:36:38 martin Exp
  */
 
 #ifndef _NETBSD32_SYS_SYSCALLARGS_H_
@@ -2899,8 +2899,6 @@ int	sys_setsid(struct lwp *, const void 
 #if defined(QUOTA) || !defined(_KERNEL_OPT)
 int	compat_50_netbsd32_quotactl(struct lwp *, const struct compat_50_netbsd32_quotactl_args *, register_t *);
 
-int	compat_43_sys_quota(struct lwp *, const void *, register_t *);
-
 #else
 #endif
 int	compat_43_netbsd32_ogetsockname(struct lwp *, const struct compat_43_netbsd32_ogetsockname_args *, register_t *);
Index: src/sys/compat/netbsd32/netbsd32_syscalls.c
diff -u src/sys/compat/netbsd32/netbsd32_syscalls.c:1.141.2.1 src/sys/compat/netbsd32/netbsd32_syscalls.c:1.141.2.2
--- src/sys/compat/netbsd32/netbsd32_syscalls.c:1.141.2.1	Mon Nov  4 14:47:33 2019
+++ src/sys/compat/netbsd32/netbsd32_syscalls.c	Sun Mar  8 10:38:10 2020
@@ -1,14 +1,14 @@
-/* $NetBSD: netbsd32_syscalls.c,v 1.141.2.1 2019/11/04 14:47:33 martin Exp $ */
+/* $NetBSD: netbsd32_syscalls.c,v 1.141.2.2 2020/03/08 10:38:10 martin Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.127.2.1 2019/11/04 14:46:57 martin Exp
+ * created from	NetBSD: syscalls.master,v 1.127.2.2 2020/03/08 10:36:38 martin Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.141.2.1 2019/11/04 14:47:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.141.2.2 2020/03/08 10:38:10 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
@@ -180,11 +180,10 @@ const char *const netbsd32_syscallnames[
 	/* 147 */	"setsid",
 #if defined(QUOTA) || !defined(_KERNEL_OPT)
 	/* 148 */	"compat_50_netbsd32_quotactl",
-	/* 149 */	"compat_43_oquota",
 #else
 	/* 148 */	"#148 (excluded compat_netbsd32_quotactl)",
-	/* 149 */	

CVS commit: [netbsd-9] src/sys/compat/netbsd32

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:36:38 UTC 2020

Modified Files:
src/sys/compat/netbsd32 [netbsd-9]: netbsd32_compat_43.c
syscalls.master

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #761):

sys/compat/netbsd32/syscalls.master: revision 1.132
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.60

Properly mark netbsd32_compat_43 syscalls that are directly implemented
by calling their compat_43 equivalents.  With these changes, and with
built-in versions of COMPAT_NETBSD32, COMPAT_NOMID, and COMPAT_09, I can
now run a netbsd-0.9 statically linked i386 (32-bit) version of /bin/ls
on a 9.99.x amd64 host!

Addresses PR kern/55047 but more changes coming to handle non-built-in
modules.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.57.4.2 -r1.57.4.3 \
src/sys/compat/netbsd32/netbsd32_compat_43.c
cvs rdiff -u -r1.127.2.1 -r1.127.2.2 src/sys/compat/netbsd32/syscalls.master

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_compat_43.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.2 src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.3
--- src/sys/compat/netbsd32/netbsd32_compat_43.c:1.57.4.2	Thu Jan  2 09:50:34 2020
+++ src/sys/compat/netbsd32/netbsd32_compat_43.c	Sun Mar  8 10:36:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_43.c,v 1.57.4.2 2020/01/02 09:50:34 martin Exp $	*/
+/*	$NetBSD: netbsd32_compat_43.c,v 1.57.4.3 2020/03/08 10:36:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.57.4.2 2020/01/02 09:50:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.57.4.3 2020/03/08 10:36:38 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_43.h"
@@ -769,6 +769,26 @@ static struct syscall_package compat_net
 	(sy_call_t *)compat_43_netbsd32_sigsetmask },
 	{ NETBSD32_SYS_compat_43_netbsd32_osigstack, 0,
 	(sy_call_t *)compat_43_netbsd32_osigstack },
+/*
+ * These syscalls are provided by emul_netbsd compat_43 code, but their
+ * entry points must still be loaded in the emul_netbsd32 disatch table
+ */
+	{ NETBSD32_SYS_compat_43_ogetpagesize, 0,
+	(sy_call_t *)compat_43_sys_getpagesize },
+	{ NETBSD32_SYS_compat_43_ogetdtablesize, 0,
+	(sy_call_t *)compat_43_sys_getdtablesize},
+	{ NETBSD32_SYS_compat_43_ogethostid, 0,
+	(sy_call_t *)compat_43_sys_gethostid },
+	{ NETBSD32_SYS_compat_43_owait, 0,
+	(sy_call_t *)compat_43_sys_wait },
+/*
+ * Skip oquota since it isn't part of compat_43
+ *	{ NETBSD32_SYS_compat_43_oquota, 0,
+ *	(sy_call_t *)compat_43_sys_quota },
+ */
+
+/* End of compat_43 syscalls */
+
 	{ 0, 0, NULL }
 }; 
 

Index: src/sys/compat/netbsd32/syscalls.master
diff -u src/sys/compat/netbsd32/syscalls.master:1.127.2.1 src/sys/compat/netbsd32/syscalls.master:1.127.2.2
--- src/sys/compat/netbsd32/syscalls.master:1.127.2.1	Mon Nov  4 14:46:57 2019
+++ src/sys/compat/netbsd32/syscalls.master	Sun Mar  8 10:36:38 2020
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.127.2.1 2019/11/04 14:46:57 martin Exp $
+	$NetBSD: syscalls.master,v 1.127.2.2 2020/03/08 10:36:38 martin Exp $
 
 ;	from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
@@ -183,7 +183,7 @@
 			{ int|netbsd32||ogetkerninfo(int op, \
 			netbsd32_charp where, netbsd32_intp size, \
 			int arg); }
-64	COMPAT_43 MODULAR compat_netbsd32_43	\
+64	COMPAT_43 MODULAR compat_43	\
 			{ int|sys||getpagesize(void); } ogetpagesize
 65	COMPAT_12 MODULAR compat_netbsd32_12	\
 			{ int|netbsd32||msync(netbsd32_voidp addr, \
@@ -219,7 +219,7 @@
 			{ int|netbsd32||setitimer(int which, \
 			netbsd32_itimerval50p_t itv, \
 			netbsd32_itimerval50p_t oitv); }
-84	COMPAT_43 MODULAR compat_netbsd32_43	\
+84	COMPAT_43 MODULAR compat_43	\
 			{ int|sys||wait(void); } owait
 85	COMPAT_12 MODULAR compat_netbsd32_12	\
 			{ int|netbsd32||oswapon(netbsd32_charp name); }
@@ -232,7 +232,7 @@
 88	COMPAT_43 MODULAR compat_netbsd32_43	\
 			{ int|netbsd32||osethostname(netbsd32_charp hostname, \
 			u_int len); }
-89	COMPAT_43 MODULAR compat_netbsd32_43	\
+89	COMPAT_43 MODULAR compat_43	\
 			{ int|sys||getdtablesize(void); } ogetdtablesize
 90	STD		{ int|netbsd32||dup2(int from, int to); }
 91	UNIMPL		getdopt
@@ -343,7 +343,7 @@
 141	COMPAT_43 MODULAR compat_netbsd32_43	\
 			{ int|netbsd32||ogetpeername(int fdes, \
 			netbsd32_voidp asa, netbsd32_intp alen); }
-142	COMPAT_43 MODULAR compat_netbsd32_43	\
+142	COMPAT_43 MODULAR compat_43	\
 			{ int32_t|sys||gethostid(void); } ogethostid
 143	COMPAT_43 MODULAR compat_netbsd32_43	\
 			{ int|netbsd32||sethostid(int32_t hostid); }
@@ -360,12 +360,10 @@
 148	COMPAT_50 MODULAR compat_netbsd32_50	\
 			{ 

CVS commit: [netbsd-9] src/sys/arch

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:28:17 UTC 2020

Modified Files:
src/sys/arch/amiga/dev [netbsd-9]: gayle_pcmcia.c
src/sys/arch/amigappc/include [netbsd-9]: bus_defs.h

Log Message:
Pull up following revision(s) (requested by is in ticket #760):

sys/arch/amiga/dev/gayle_pcmcia.c: revision 1.32
sys/arch/amigappc/include/bus_defs.h: revision 1.8

The Gayle interface uses swapped (little-endian) word accesses, so we
need to use the amiga_bus_stride_1swap methods for the word accesses.

Analyzed and submitted via port-amiga@ by Martin �berg.

Tested on formerly working hardware
- by Jukka Andberg  with Dlink DE-660+  (ne)
- by Frank Willewith D-Link DFE-670TXD  (ne)

Tested on formerly not working hardware:
- by Martin with 3Com 3c589 Etherling III   (ep)
- by Martin and Frank   with CompactFlash cards (wdc)

 -

gayle wants stride_1swap now, so declare the rest of the bus methods since
we already define them anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.22.1 src/sys/arch/amiga/dev/gayle_pcmcia.c
cvs rdiff -u -r1.6 -r1.6.34.1 src/sys/arch/amigappc/include/bus_defs.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/amiga/dev/gayle_pcmcia.c
diff -u src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31 src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31.22.1
--- src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31	Sun Feb  8 09:55:25 2015
+++ src/sys/arch/amiga/dev/gayle_pcmcia.c	Sun Mar  8 10:28:16 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: gayle_pcmcia.c,v 1.31 2015/02/08 09:55:25 jandberg Exp $ */
+/*	$NetBSD: gayle_pcmcia.c,v 1.31.22.1 2020/03/08 10:28:16 martin Exp $ */
 
 /* public domain */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.31 2015/02/08 09:55:25 jandberg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.31.22.1 2020/03/08 10:28:16 martin Exp $");
 
 /* PCMCIA front-end driver for A1200's and A600's. */
 
@@ -131,7 +131,7 @@ pccard_attach(device_t parent, device_t 
 	pmap_update(vm_map_pmap(kernel_map));
 
 	/* override the one-byte access methods for I/O space */
-	pcmio_bs_methods = amiga_bus_stride_1;
+	pcmio_bs_methods = amiga_bus_stride_1swap;
 	pcmio_bs_methods.bsr1 = pcmio_bsr1;
 	pcmio_bs_methods.bsw1 = pcmio_bsw1;
 	pcmio_bs_methods.bsrm1 = pcmio_bsrm1;

Index: src/sys/arch/amigappc/include/bus_defs.h
diff -u src/sys/arch/amigappc/include/bus_defs.h:1.6 src/sys/arch/amigappc/include/bus_defs.h:1.6.34.1
--- src/sys/arch/amigappc/include/bus_defs.h:1.6	Wed Jan 22 00:24:53 2014
+++ src/sys/arch/amigappc/include/bus_defs.h	Sun Mar  8 10:28:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.6 2014/01/22 00:24:53 christos Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.6.34.1 2020/03/08 10:28:16 martin Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -171,10 +171,13 @@ struct amiga_bus_space_methods {
 #define __BUS_SPACE_HAS_STREAM_METHODS
 
 extern const struct amiga_bus_space_methods amiga_bus_stride_1;
+extern const struct amiga_bus_space_methods amiga_bus_stride_1swap;
+extern const struct amiga_bus_space_methods amiga_bus_stride_1swap_abs;
 extern const struct amiga_bus_space_methods amiga_bus_stride_2;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4swap;
 extern const struct amiga_bus_space_methods amiga_bus_stride_16;
 extern const struct amiga_bus_space_methods amiga_bus_stride_0x1000;
+extern const struct amiga_bus_space_methods amiga_bus_stride_0x4000;
 
 #endif /* _AMIGAPPC_BUS_DEFS_H_ */



CVS commit: [netbsd-9] src/libexec/ld.elf_so

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:22:29 UTC 2020

Modified Files:
src/libexec/ld.elf_so [netbsd-9]: headers.c map_object.c rtld.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #758):

libexec/ld.elf_so/map_object.c: revision 1.61
libexec/ld.elf_so/headers.c: revision 1.68
libexec/ld.elf_so/rtld.c: revision 1.203

PT_GNU_RELRO segments are arranged such that their vaddr + memsz ends
on a linker common page size boundary.  However, if the common page size
used by the linker is less than the VM page size being used by the kernel,
this can end up in the middle of a VM page and when the region is write-
protected, this can cause objects in neighboring .data to get incorrectly
write-protected, resulting in a crash.

Avoid this situation by calculating the end of the RELRO region not by
rounding memsz up to the VM page size, but rather by adding vaddr + memsz
and then truncating to the VM page size.

Fixes PR toolchain/55043.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.65.2.1 src/libexec/ld.elf_so/headers.c
cvs rdiff -u -r1.60 -r1.60.2.1 src/libexec/ld.elf_so/map_object.c
cvs rdiff -u -r1.197.2.2 -r1.197.2.3 src/libexec/ld.elf_so/rtld.c

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

Modified files:

Index: src/libexec/ld.elf_so/headers.c
diff -u src/libexec/ld.elf_so/headers.c:1.65 src/libexec/ld.elf_so/headers.c:1.65.2.1
--- src/libexec/ld.elf_so/headers.c:1.65	Sun Dec 30 11:55:15 2018
+++ src/libexec/ld.elf_so/headers.c	Sun Mar  8 10:22:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: headers.c,v 1.65 2018/12/30 11:55:15 martin Exp $	 */
+/*	$NetBSD: headers.c,v 1.65.2.1 2020/03/08 10:22:29 martin Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.65 2018/12/30 11:55:15 martin Exp $");
+__RCSID("$NetBSD: headers.c,v 1.65.2.1 2020/03/08 10:22:29 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -435,9 +435,9 @@ _rtld_digest_phdr(const Elf_Phdr *phdr, 
 
 #ifdef GNU_RELRO
 		case PT_GNU_RELRO:
-			obj->relro_page = obj->relocbase
-			+ round_down(ph->p_vaddr);
-			obj->relro_size = round_up(ph->p_memsz);
+			/* rounding happens later. */
+			obj->relro_page = obj->relocbase + ph->p_vaddr;
+			obj->relro_size = ph->p_memsz;
 			dbg(("headers: %s %p phsize %" PRImemsz,
 			"PT_GNU_RELRO", (void *)(uintptr_t)vaddr,
 			 ph->p_memsz));

Index: src/libexec/ld.elf_so/map_object.c
diff -u src/libexec/ld.elf_so/map_object.c:1.60 src/libexec/ld.elf_so/map_object.c:1.60.2.1
--- src/libexec/ld.elf_so/map_object.c:1.60	Sun Jan  6 19:44:54 2019
+++ src/libexec/ld.elf_so/map_object.c	Sun Mar  8 10:22:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: map_object.c,v 1.60 2019/01/06 19:44:54 joerg Exp $	 */
+/*	$NetBSD: map_object.c,v 1.60.2.1 2020/03/08 10:22:29 martin Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -34,7 +34,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: map_object.c,v 1.60 2019/01/06 19:44:54 joerg Exp $");
+__RCSID("$NetBSD: map_object.c,v 1.60.2.1 2020/03/08 10:22:29 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -406,8 +406,9 @@ _rtld_map_object(const char *path, int f
 	obj->relocbase = mapbase - base_vaddr;
 
 #ifdef GNU_RELRO
-	obj->relro_page = obj->relocbase + round_down(relro_page);
-	obj->relro_size = round_up(relro_size);
+	/* rounding happens later. */
+	obj->relro_page = obj->relocbase + relro_page;
+	obj->relro_size = relro_size;
 #endif
 
 	if (obj->dynamic)

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.197.2.2 src/libexec/ld.elf_so/rtld.c:1.197.2.3
--- src/libexec/ld.elf_so/rtld.c:1.197.2.2	Mon Dec  9 16:12:16 2019
+++ src/libexec/ld.elf_so/rtld.c	Sun Mar  8 10:22:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.197.2.2 2019/12/09 16:12:16 martin Exp $	 */
+/*	$NetBSD: rtld.c,v 1.197.2.3 2020/03/08 10:22:29 martin Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.197.2.2 2019/12/09 16:12:16 martin Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.197.2.3 2020/03/08 10:22:29 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -1771,13 +1771,25 @@ int
 _rtld_relro(const Obj_Entry *obj, bool wantmain)
 {
 #ifdef GNU_RELRO
-	if (obj->relro_size == 0)
+	/*
+	 * If our VM page size is larger than the page size used by the
+	 * linker when laying out the object, we could end up making data
+	 * read-only that is unintended.  Detect and avoid this situation.
+	 * It may mean we are unable to protect everything we'd like, but
+	 * it's better than crashing.
+	 */
+	uintptr_t relro_end = (uintptr_t)obj->relro_page + obj->relro_size;
+	uintptr_t relro_start = round_down((uintptr_t)obj->relro_page);
+	assert(relro_end >= relro_start);
+	size_t relro_size = round_down(relro_end) - relro_start;
+
+	if (relro_size == 0)
 		return 

CVS commit: [netbsd-9] src/sys/conf

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:18:04 UTC 2020

Modified Files:
src/sys/conf [netbsd-9]: files

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #757):

sys/conf/files: revision 1.1257
sys/conf/files: revision 1.1258
sys/conf/files: revision 1.1259

mips64 has compat_netbsd32 but cannot have exec_aout; all other users
of compat_netbsd32 need exec_aout

Addresses PR kern/55037.
XXX pullup-9

Fix comment - thanks Ryo Shimizu

Also exclude EXEC_AOUT stuff for aarch64
XXX Pullup-9 and -8


To generate a diff of this commit:
cvs rdiff -u -r1.1237.2.4 -r1.1237.2.5 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1237.2.4 src/sys/conf/files:1.1237.2.5
--- src/sys/conf/files:1.1237.2.4	Tue Jan 21 15:53:39 2020
+++ src/sys/conf/files	Sun Mar  8 10:18:04 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1237.2.4 2020/01/21 15:53:39 martin Exp $
+#	$NetBSD: files,v 1.1237.2.5 2020/03/08 10:18:04 martin Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -162,7 +162,17 @@ defflagCOMPAT_FREEBSD: COMPAT_09, CO
 defflagCOMPAT_LINUX: COMPAT_NETBSD, COMPAT_43
 defflagCOMPAT_SUNOS: COMPAT_09, COMPAT_43
 defflagCOMPAT_ULTRIX: COMPAT_50
+
+# mips64 and aarch64 have COMPAT_NETBSD32 but cannot have EXEC_AOUT; all
+# other users of COMPAT_NETBSD32 need EXEC_AOUT
+ifdef mips
+defflagCOMPAT_NETBSD32
+elifdef aarch64
 defflagCOMPAT_NETBSD32
+else
+defflagCOMPAT_NETBSD32	: EXEC_AOUT
+endif
+
 defflagCOMPAT_SYSV
 defflagSYSV_IPC	: SYSVSHM, SYSVSEM, SYSVMSG
 defflagCOMPAT_NETBSD32_SYSVIPC : SYSV_IPC,



CVS commit: [netbsd-8] src/doc

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:03:19 UTC 2020

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Tickets #1514 - #1518


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.104 -r1.1.2.105 src/doc/CHANGES-8.2

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-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.104 src/doc/CHANGES-8.2:1.1.2.105
--- src/doc/CHANGES-8.2:1.1.2.104	Sun Mar  8 09:29:10 2020
+++ src/doc/CHANGES-8.2	Sun Mar  8 10:03:19 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.104 2020/03/08 09:29:10 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.105 2020/03/08 10:03:19 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -2099,3 +2099,30 @@ sys/external/bsd/drm2/nouveau/nouveau_pc
 	Limit the list of supported devices.
 	[mrg, ticket #1512]
 
+sys/conf/files	1.1257-1.1258
+
+	Fix COMPAT_NETBSD32 to properly handle EXEC_AOUT binaries.
+	[pgoyette, ticket #1514]
+
+sys/kern/sys_select.c1.42-1.45
+
+	PR 54158: fix resource limits for poll(2).
+	[mlelstv, ticket #1515]
+
+sys/dev/ic/tms320av110.c			1.24
+
+	Remove unused variables.
+	[is, ticket #1516]
+
+sys/arch/amiga/dev/gayle_pcmcia.c		1.32
+
+	The Gayle interface uses swapped (little-endian) word accesses, so we
+	need to use the amiga_bus_stride_1swap methods for the word accesses.
+	[is, ticket #1517]
+
+sys/arch/amigappc/include/bus_defs.h		1.8
+
+	Gayle wants stride_1swap now, so declare the rest of the bus
+	methods since we already define them anyway.
+	[is, ticket #1518]
+



CVS commit: [netbsd-8] src/sys/arch/amigappc/include

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:01:45 UTC 2020

Modified Files:
src/sys/arch/amigappc/include [netbsd-8]: bus_defs.h

Log Message:
Pull up following revision(s) (requested by is in ticket #1518):

sys/arch/amigappc/include/bus_defs.h: revision 1.8

gayle wants stride_1swap now, so declare the rest of the bus methods since
we already define them anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.22.1 src/sys/arch/amigappc/include/bus_defs.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/amigappc/include/bus_defs.h
diff -u src/sys/arch/amigappc/include/bus_defs.h:1.6 src/sys/arch/amigappc/include/bus_defs.h:1.6.22.1
--- src/sys/arch/amigappc/include/bus_defs.h:1.6	Wed Jan 22 00:24:53 2014
+++ src/sys/arch/amigappc/include/bus_defs.h	Sun Mar  8 10:01:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.6 2014/01/22 00:24:53 christos Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.6.22.1 2020/03/08 10:01:45 martin Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -171,10 +171,13 @@ struct amiga_bus_space_methods {
 #define __BUS_SPACE_HAS_STREAM_METHODS
 
 extern const struct amiga_bus_space_methods amiga_bus_stride_1;
+extern const struct amiga_bus_space_methods amiga_bus_stride_1swap;
+extern const struct amiga_bus_space_methods amiga_bus_stride_1swap_abs;
 extern const struct amiga_bus_space_methods amiga_bus_stride_2;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4swap;
 extern const struct amiga_bus_space_methods amiga_bus_stride_16;
 extern const struct amiga_bus_space_methods amiga_bus_stride_0x1000;
+extern const struct amiga_bus_space_methods amiga_bus_stride_0x4000;
 
 #endif /* _AMIGAPPC_BUS_DEFS_H_ */



CVS commit: [netbsd-8] src/sys/arch/amiga/dev

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 10:00:24 UTC 2020

Modified Files:
src/sys/arch/amiga/dev [netbsd-8]: gayle_pcmcia.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1517):

sys/arch/amiga/dev/gayle_pcmcia.c: revision 1.32

The Gayle interface uses swapped (little-endian) word accesses, so we
need to use the amiga_bus_stride_1swap methods for the word accesses.

Analyzed and submitted via port-amiga@ by Martin �berg.

Tested on formerly working hardware
- by Jukka Andberg  with Dlink DE-660+  (ne)
- by Frank Willewith D-Link DFE-670TXD  (ne)

Tested on formerly not working hardware:
- by Martin with 3Com 3c589 Etherling III   (ep)
- by Martin and Frank   with CompactFlash cards (wdc)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.10.1 src/sys/arch/amiga/dev/gayle_pcmcia.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/gayle_pcmcia.c
diff -u src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31 src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31.10.1
--- src/sys/arch/amiga/dev/gayle_pcmcia.c:1.31	Sun Feb  8 09:55:25 2015
+++ src/sys/arch/amiga/dev/gayle_pcmcia.c	Sun Mar  8 10:00:24 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: gayle_pcmcia.c,v 1.31 2015/02/08 09:55:25 jandberg Exp $ */
+/*	$NetBSD: gayle_pcmcia.c,v 1.31.10.1 2020/03/08 10:00:24 martin Exp $ */
 
 /* public domain */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.31 2015/02/08 09:55:25 jandberg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.31.10.1 2020/03/08 10:00:24 martin Exp $");
 
 /* PCMCIA front-end driver for A1200's and A600's. */
 
@@ -131,7 +131,7 @@ pccard_attach(device_t parent, device_t 
 	pmap_update(vm_map_pmap(kernel_map));
 
 	/* override the one-byte access methods for I/O space */
-	pcmio_bs_methods = amiga_bus_stride_1;
+	pcmio_bs_methods = amiga_bus_stride_1swap;
 	pcmio_bs_methods.bsr1 = pcmio_bsr1;
 	pcmio_bs_methods.bsw1 = pcmio_bsw1;
 	pcmio_bs_methods.bsrm1 = pcmio_bsrm1;



CVS commit: [netbsd-8] src/sys/dev/ic

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:57:50 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: tms320av110.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1516):

sys/dev/ic/tms320av110.c: revision 1.24

Make it compilable (remove unused variables).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.30.1 src/sys/dev/ic/tms320av110.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/ic/tms320av110.c
diff -u src/sys/dev/ic/tms320av110.c:1.23 src/sys/dev/ic/tms320av110.c:1.23.30.1
--- src/sys/dev/ic/tms320av110.c:1.23	Sat Oct 27 17:18:23 2012
+++ src/sys/dev/ic/tms320av110.c	Sun Mar  8 09:57:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tms320av110.c,v 1.23 2012/10/27 17:18:23 chs Exp $	*/
+/*	$NetBSD: tms320av110.c,v 1.23.30.1 2020/03/08 09:57:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.23 2012/10/27 17:18:23 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.23.30.1 2020/03/08 09:57:50 martin Exp $");
 
 #include 
 #include 
@@ -251,9 +251,7 @@ tav_drain(void *hdl)
 int
 tav_query_encoding(void *hdl, struct audio_encoding *ae)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	if (ae->index >= sizeof(tav_encodings)/sizeof(*ae))
 		return EINVAL;
 
@@ -473,9 +471,7 @@ tav_set_params(void *hdl, int setmode, i
 int
 tav_set_port(void *hdl, mixer_ctrl_t *mc)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	/* dummy */
 	return 0;
 }
@@ -483,9 +479,7 @@ tav_set_port(void *hdl, mixer_ctrl_t *mc
 int
 tav_get_port(void *hdl, mixer_ctrl_t *mc)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	/* dummy */
 	return 0;
 }



CVS commit: [netbsd-8] src/sys/kern

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:47:28 UTC 2020

Modified Files:
src/sys/kern [netbsd-8]: sys_select.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1515):

sys/kern/sys_select.c: revision 1.42-1.45

PR/54158: Anthony Mallet: poll(2) does not allow polling all possible fds
(hardcoded limit to 1000 + #). Changed to limit by the max of
the resource limit of open descriptors and the above.

Remove the slop code. Suggested by mrg@

Use the max limit (aka maxfiles or the moral equivalent of OPEN_MAX) which
makes poll(2) align with the Posix documentation (which allows EINVAL if
nfds > OPEN_MAX). From: Anthony Mallet

Add slop of 1000 and explain why.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/kern/sys_select.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/sys_select.c
diff -u src/sys/kern/sys_select.c:1.40 src/sys/kern/sys_select.c:1.40.2.1
--- src/sys/kern/sys_select.c:1.40	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/sys_select.c	Sun Mar  8 09:47:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_select.c,v 1.40 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: sys_select.c,v 1.40.2.1 2020/03/08 09:47:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.40 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.40.2.1 2020/03/08 09:47:28 martin Exp $");
 
 #include 
 #include 
@@ -488,15 +488,28 @@ pollcommon(register_t *retval, struct po
 	int		error;
 	size_t		ni;
 
-	if (nfds > 1000 + curlwp->l_fd->fd_dt->dt_nfiles) {
+	if (nfds > curlwp->l_proc->p_rlimit[RLIMIT_NOFILE].rlim_max + 1000) {
 		/*
-		 * Either the user passed in a very sparse 'fds' or junk!
-		 * The kmem_alloc() call below would be bad news.
-		 * We could process the 'fds' array in chunks, but that
+		 * Prevent userland from causing over-allocation.
+		 * Raising the default limit too high can still cause
+		 * a lot of memory to be allocated, but this also means
+		 * that the file descriptor array will also be large.
+		 *
+		 * To reduce the memory requirements here, we could 
+		 * process the 'fds' array in chunks, but that
 		 * is a lot of code that isn't normally useful.
 		 * (Or just move the copyin/out into pollscan().)
+		 *
 		 * Historically the code silently truncated 'fds' to
 		 * dt_nfiles entries - but that does cause issues.
+		 *
+		 * Using the max limit equivalent to sysctl
+		 * kern.maxfiles is the moral equivalent of OPEN_MAX
+		 * as specified by POSIX.
+		 *
+		 * We add a slop of 1000 in case the resource limit was
+		 * changed after opening descriptors or the same descriptor
+		 * was specified more than once.
 		 */
 		return EINVAL;
 	}



CVS commit: [netbsd-8] src/sys/conf

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:42:29 UTC 2020

Modified Files:
src/sys/conf [netbsd-8]: files

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1514):

sys/conf/files: revision 1.1257
sys/conf/files: revision 1.1258

mips64 has compat_netbsd32 but cannot have exec_aout; all other users
of compat_netbsd32 need exec_aout
Addresses PR kern/55037.
XXX pullup-9

Fix comment - thanks Ryo Shimizu


To generate a diff of this commit:
cvs rdiff -u -r1.1173.2.8 -r1.1173.2.9 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1173.2.8 src/sys/conf/files:1.1173.2.9
--- src/sys/conf/files:1.1173.2.8	Tue Sep  3 12:08:22 2019
+++ src/sys/conf/files	Sun Mar  8 09:42:29 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1173.2.8 2019/09/03 12:08:22 martin Exp $
+#	$NetBSD: files,v 1.1173.2.9 2020/03/08 09:42:29 martin Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20170615
@@ -160,7 +160,13 @@ defflagCOMPAT_OSF1
 defflagCOMPAT_SUNOS: COMPAT_30
 defflag	opt_compat_svr4.h	COMPAT_SVR4 COMPAT_SVR4_32 SVR4_COMPAT_SOLARIS2
 defflagCOMPAT_ULTRIX: COMPAT_50
+# mips64 has COMPAT_NETBSD32 but cannot have EXEC_AOUT; all
+# other users of COMPAT_NETBSD32 need EXEC_AOUT
+ifdef mips
 defflagCOMPAT_NETBSD32
+else
+defflagCOMPAT_NETBSD32	: EXEC_AOUT
+endif
 defflagCOMPAT_LINUX32 : COMPAT_LINUX, COMPAT_NETBSD32
 defflagCOMPAT_AOUT_M68K: COMPAT_40
 defflagCOMPAT_M68K4K



CVS commit: [netbsd-8] src/doc

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:29:10 UTC 2020

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Ticket #1512


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.103 -r1.1.2.104 src/doc/CHANGES-8.2

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-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.103 src/doc/CHANGES-8.2:1.1.2.104
--- src/doc/CHANGES-8.2:1.1.2.103	Tue Mar  3 18:41:42 2020
+++ src/doc/CHANGES-8.2	Sun Mar  8 09:29:10 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.103 2020/03/03 18:41:42 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.104 2020/03/08 09:29:10 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -2092,3 +2092,10 @@ lib/Makefile	1.276
 	Avoid running useless makes in every subdirectory.
 	[riastradh, ticket #1513]
 
+sys/external/bsd/drm2/nouveau/nouveau_pci.c	1.24,1.25 (patch)
+
+	Improve nouveau pci attachment code so it waits for the
+	availability of / before trying to load firmware.
+	Limit the list of supported devices.
+	[mrg, ticket #1512]
+



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/nouveau

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:28:04 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/nouveau [netbsd-8]: nouveau_pci.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1512):

sys/external/bsd/drm2/nouveau/nouveau_pci.c: revision 1.24,1.25
(via patch)

Improve nouveau pci attachment code so it waits for the availability of /
before trying to load firmware.
Fixes my PR 54274.

LGTM mrg

list the PCI ID range for new nvidia TU117 and TU116.

adjust the check to simply be >= 0x1580, which is the
first pciid not support.

should fix PR#54600.


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.2 -r1.8.10.3 \
src/sys/external/bsd/drm2/nouveau/nouveau_pci.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/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.8.10.2 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.8.10.3
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.8.10.2	Tue Dec 25 11:25:00 2018
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Sun Mar  8 09:28:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.8.10.2 2018/12/25 11:25:00 martin Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.8.10.3 2020/03/08 09:28:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.8.10.2 2018/12/25 11:25:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.8.10.3 2020/03/08 09:28:04 martin Exp $");
 
 #include 
 #include 
@@ -51,6 +51,7 @@ SIMPLEQ_HEAD(nouveau_pci_task_head, nouv
 
 struct nouveau_pci_softc {
 	device_t		sc_dev;
+	struct pci_attach_args	sc_pa;
 	enum {
 		NOUVEAU_TASK_ATTACH,
 		NOUVEAU_TASK_WORKQUEUE,
@@ -66,6 +67,7 @@ struct nouveau_pci_softc {
 
 static int	nouveau_pci_match(device_t, cfdata_t, void *);
 static void	nouveau_pci_attach(device_t, device_t, void *);
+static void	nouveau_pci_attach_real(device_t);
 static int	nouveau_pci_detach(device_t, int);
 
 static bool	nouveau_pci_suspend(device_t, const pmf_qual_t *);
@@ -91,17 +93,13 @@ nouveau_pci_match(device_t parent, cfdat
 	if (PCI_CLASS(pa->pa_class) != PCI_CLASS_DISPLAY)
 		return 0;
 
-#define IS_BETWEEN(x,y) \
-	(PCI_PRODUCT(pa->pa_id) >= (x) && PCI_PRODUCT(pa->pa_id) <= (y))
 	/*
-	 * NetBSD drm2 needs missing-so-far firmware for Maxwell-based cards:
-	 *   0x1380-0x13bf 	GM107
-	 */
-	if (IS_BETWEEN(0x1380, 0x13bf))
-		return 0;
-
-	/*
-	 * NetBSD drm2 doesn't support Pascal, Volta or Turing based cards:
+	 * NetBSD 8.x drm2 doesn't support Maxwell, Pascal, Volta or Turing
+	 * based cards:
+	 *   0x1340-0x137f 	GM108   [1]
+	 *   0x1380-0x13bf 	GM107   [1]
+	 *   0x13c0-0x13ff 	GM204
+	 *   0x1400-0x147f 	GM206
 	 *   0x1580-0x15ff 	GP100
 	 *   0x1b00-0x1b7f 	GP102
 	 *   0x1b80-0x1bff 	GP104
@@ -112,20 +110,20 @@ nouveau_pci_match(device_t parent, cfdat
 	 *   0x1e00-0x1e7f 	TU102
 	 *   0x1e80-0x1eff 	TU104
 	 *   0x1f00-0x1f7f 	TU106
+	 *   0x1f80-0x1fff 	TU117
+	 *   0x2180-0x21ff 	TU116
+	 *
+	 * [1] GM107/GM108 may work if firmware files are provided.
+	 * There are Windows and Linux methods to extract them, but they
+	 * are not readily available.  NetBSD-9 drm works.
+	 *
+	 * reduce this to >= 1300, so that new chipsets not explictly
+	 * listed above will be picked up.
+	 *
+	 * XXX perhaps switch this to explicitly match known list.
 	 */
-	
-	if (IS_BETWEEN(0x1580, 0x15ff) ||
-	IS_BETWEEN(0x1b00, 0x1b7f) ||
-	IS_BETWEEN(0x1b80, 0x1bff) ||
-	IS_BETWEEN(0x1c00, 0x1c7f) ||
-	IS_BETWEEN(0x1c80, 0x1cff) ||
-	IS_BETWEEN(0x1d00, 0x1d7f) ||
-	IS_BETWEEN(0x1d80, 0x1dff) ||
-	IS_BETWEEN(0x1e00, 0x1e7f) ||
-	IS_BETWEEN(0x1e80, 0x1eff) ||
-	IS_BETWEEN(0x1f00, 0x1f7f))
+	if (PCI_PRODUCT(pa->pa_id) >= 0x1300)
 		return 0;
-#undef IS_BETWEEN
 
 	return 6;		/* XXX Beat genfb_pci...  */
 }
@@ -138,19 +136,34 @@ nouveau_pci_attach(device_t parent, devi
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
 	const struct pci_attach_args *const pa = aux;
-	uint64_t devname;
-	int error;
 
 	pci_aprint_devinfo(pa, NULL);
 
-	sc->sc_dev = self;
-
-	if (!pmf_device_register(self, _pci_suspend,
-		_pci_resume))
+	if (!pmf_device_register(self, _pci_suspend, _pci_resume))
 		aprint_error_dev(self, "unable to establish power handler\n");
 
-	sc->sc_task_state = NOUVEAU_TASK_ATTACH;
-	SIMPLEQ_INIT(>sc_task_u.attach);
+	/*
+	 * Trivial initialization first; the rest will come after we
+	 * have mounted the root file system and can load firmware
+	 * images.
+	 */
+	sc->sc_dev = NULL;
+	sc->sc_pa = *pa;
+
+	config_mountroot(self, _pci_attach_real);
+}
+ 
+static void
+nouveau_pci_attach_real(device_t self)
+{
+	struct nouveau_pci_softc *const sc = device_private(self);
+	const struct pci_attach_args *const pa = >sc_pa;
+	uint64_t devname;
+	int 

CVS commit: [netbsd-7] src/doc

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:20:52 UTC 2020

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Tickets #1723 - #1725


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.76 -r1.1.2.77 src/doc/CHANGES-7.3

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-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.76 src/doc/CHANGES-7.3:1.1.2.77
--- src/doc/CHANGES-7.3:1.1.2.76	Wed Feb 12 20:21:12 2020
+++ src/doc/CHANGES-7.3	Sun Mar  8 09:20:52 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.76 2020/02/12 20:21:12 martin Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.77 2020/03/08 09:20:52 martin Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -802,3 +802,20 @@ external/bsd/ppp/dist/pppd/eap.c		1.5
 	pppd: Fix bounds check in EAP code
 	[christos, ticket #1722]
 
+sys/dev/ic/tms320av110.c			1.24
+
+	Remove unused variables.
+	[is, ticket #1723]
+
+sys/arch/amiga/dev/gayle_pcmcia.c		1.32
+
+	The Gayle interface uses swapped (little-endian) word accesses, so we
+	need to use the amiga_bus_stride_1swap methods for the word accesses.
+	[is, ticket #1724]
+
+sys/arch/amigappc/include/bus_defs.h		1.8
+
+	Gayle wants stride_1swap now, so declare the rest of
+	the bus methods since we already define them anyway.
+	[is, ticket #1725]
+



CVS commit: [netbsd-7] src/sys/arch/amigappc/include

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:19:55 UTC 2020

Modified Files:
src/sys/arch/amigappc/include [netbsd-7]: bus_defs.h

Log Message:
Pull up following revision(s) (requested by is in ticket #1725):

sys/arch/amigappc/include/bus_defs.h: revision 1.8

gayle wants stride_1swap now, so declare the rest of the bus methods since
we already define them anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/amigappc/include/bus_defs.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/amigappc/include/bus_defs.h
diff -u src/sys/arch/amigappc/include/bus_defs.h:1.6 src/sys/arch/amigappc/include/bus_defs.h:1.6.4.1
--- src/sys/arch/amigappc/include/bus_defs.h:1.6	Wed Jan 22 00:24:53 2014
+++ src/sys/arch/amigappc/include/bus_defs.h	Sun Mar  8 09:19:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.6 2014/01/22 00:24:53 christos Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.6.4.1 2020/03/08 09:19:55 martin Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -171,10 +171,13 @@ struct amiga_bus_space_methods {
 #define __BUS_SPACE_HAS_STREAM_METHODS
 
 extern const struct amiga_bus_space_methods amiga_bus_stride_1;
+extern const struct amiga_bus_space_methods amiga_bus_stride_1swap;
+extern const struct amiga_bus_space_methods amiga_bus_stride_1swap_abs;
 extern const struct amiga_bus_space_methods amiga_bus_stride_2;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4;
 extern const struct amiga_bus_space_methods amiga_bus_stride_4swap;
 extern const struct amiga_bus_space_methods amiga_bus_stride_16;
 extern const struct amiga_bus_space_methods amiga_bus_stride_0x1000;
+extern const struct amiga_bus_space_methods amiga_bus_stride_0x4000;
 
 #endif /* _AMIGAPPC_BUS_DEFS_H_ */



CVS commit: [netbsd-7] src/sys/arch/amiga/dev

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:18:34 UTC 2020

Modified Files:
src/sys/arch/amiga/dev [netbsd-7]: gayle_pcmcia.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1724):

sys/arch/amiga/dev/gayle_pcmcia.c: revision 1.32

The Gayle interface uses swapped (little-endian) word accesses, so we
need to use the amiga_bus_stride_1swap methods for the word accesses.

Analyzed and submitted via port-amiga@ by Martin �berg.

Tested on formerly working hardware
- by Jukka Andberg  with Dlink DE-660+  (ne)
- by Frank Willewith D-Link DFE-670TXD  (ne)

Tested on formerly not working hardware:
- by Martin with 3Com 3c589 Etherling III   (ep)
- by Martin and Frank   with CompactFlash cards (wdc)


To generate a diff of this commit:
cvs rdiff -u -r1.29.4.2 -r1.29.4.3 src/sys/arch/amiga/dev/gayle_pcmcia.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/gayle_pcmcia.c
diff -u src/sys/arch/amiga/dev/gayle_pcmcia.c:1.29.4.2 src/sys/arch/amiga/dev/gayle_pcmcia.c:1.29.4.3
--- src/sys/arch/amiga/dev/gayle_pcmcia.c:1.29.4.2	Mon Feb 16 12:48:32 2015
+++ src/sys/arch/amiga/dev/gayle_pcmcia.c	Sun Mar  8 09:18:34 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: gayle_pcmcia.c,v 1.29.4.2 2015/02/16 12:48:32 martin Exp $ */
+/*	$NetBSD: gayle_pcmcia.c,v 1.29.4.3 2020/03/08 09:18:34 martin Exp $ */
 
 /* public domain */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.29.4.2 2015/02/16 12:48:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gayle_pcmcia.c,v 1.29.4.3 2020/03/08 09:18:34 martin Exp $");
 
 /* PCMCIA front-end driver for A1200's and A600's. */
 
@@ -131,7 +131,7 @@ pccard_attach(device_t parent, device_t 
 	pmap_update(vm_map_pmap(kernel_map));
 
 	/* override the one-byte access methods for I/O space */
-	pcmio_bs_methods = amiga_bus_stride_1;
+	pcmio_bs_methods = amiga_bus_stride_1swap;
 	pcmio_bs_methods.bsr1 = pcmio_bsr1;
 	pcmio_bs_methods.bsw1 = pcmio_bsw1;
 	pcmio_bs_methods.bsrm1 = pcmio_bsrm1;



CVS commit: [netbsd-7] src/sys/dev/ic

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:15:34 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-7]: tms320av110.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1723):

sys/dev/ic/tms320av110.c: revision 1.24

Make it compilable (remove unused variables).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.12.1 src/sys/dev/ic/tms320av110.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/ic/tms320av110.c
diff -u src/sys/dev/ic/tms320av110.c:1.23 src/sys/dev/ic/tms320av110.c:1.23.12.1
--- src/sys/dev/ic/tms320av110.c:1.23	Sat Oct 27 17:18:23 2012
+++ src/sys/dev/ic/tms320av110.c	Sun Mar  8 09:15:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tms320av110.c,v 1.23 2012/10/27 17:18:23 chs Exp $	*/
+/*	$NetBSD: tms320av110.c,v 1.23.12.1 2020/03/08 09:15:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.23 2012/10/27 17:18:23 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.23.12.1 2020/03/08 09:15:34 martin Exp $");
 
 #include 
 #include 
@@ -251,9 +251,7 @@ tav_drain(void *hdl)
 int
 tav_query_encoding(void *hdl, struct audio_encoding *ae)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	if (ae->index >= sizeof(tav_encodings)/sizeof(*ae))
 		return EINVAL;
 
@@ -473,9 +471,7 @@ tav_set_params(void *hdl, int setmode, i
 int
 tav_set_port(void *hdl, mixer_ctrl_t *mc)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	/* dummy */
 	return 0;
 }
@@ -483,9 +479,7 @@ tav_set_port(void *hdl, mixer_ctrl_t *mc
 int
 tav_get_port(void *hdl, mixer_ctrl_t *mc)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	/* dummy */
 	return 0;
 }



CVS commit: src/tests/net/if_vlan

2020-03-08 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sun Mar  8 09:05:34 UTC 2020

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
address to ATF t_vlan failure. adapt ifmcstat(8) output format change.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.16 src/tests/net/if_vlan/t_vlan.sh:1.17
--- src/tests/net/if_vlan/t_vlan.sh:1.16	Mon Nov 11 02:40:48 2019
+++ src/tests/net/if_vlan/t_vlan.sh	Sun Mar  8 09:05:33 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.16 2019/11/11 02:40:48 yamaguchi Exp $
+#	$NetBSD: t_vlan.sh,v 1.17 2020/03/08 09:05:33 nisimura Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -792,7 +792,7 @@ vlan_multicast_body_common()
 	# add an address to different interfaces
 	$atf_siocXmulti add vlan0 $mcaddr
 	$atf_siocXmulti add vlan1 $mcaddr
-	atf_check -s exit:0 -o match:"${eth_mcaddr}: 2" $HIJACKING ifmcstat
+	atf_check -s exit:0 -o match:"${eth_mcaddr} refcount 2" $HIJACKING ifmcstat
 	$atf_siocXmulti del vlan0 $mcaddr
 
 	# delete the address with invalid interface
@@ -805,7 +805,7 @@ vlan_multicast_body_common()
 	$atf_siocXmulti add vlan0 $mcaddr
 	$atf_siocXmulti add vlan0 $mcaddr
 	$atf_siocXmulti add vlan0 $mcaddr
-	atf_check -s exit:0 -o match:"${eth_mcaddr}: 3" $HIJACKING ifmcstat
+	atf_check -s exit:0 -o match:"${eth_mcaddr} refcount 3" $HIJACKING ifmcstat
 	$atf_siocXmulti del vlan0 $mcaddr
 	$atf_siocXmulti del vlan0 $mcaddr
 	$atf_siocXmulti del vlan0 $mcaddr



CVS commit: src/sys

2020-03-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar  8 08:26:54 UTC 2020

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
src/sys/dev/fdt: fdt_subr.c

Log Message:
Fix LOCKDEBUG by calling fdtbus_intr_init as part of cpu_startup_hook, i.e.
later.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/fdt/fdt_subr.c

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

Modified files:

Index: src/sys/arch/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.67 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.68
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.67	Sun Feb 16 14:56:52 2020
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Sun Mar  8 08:26:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.67 2020/02/16 14:56:52 thorpej Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.68 2020/03/08 08:26:54 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.67 2020/02/16 14:56:52 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.68 2020/03/08 08:26:54 skrll Exp $");
 
 #include "opt_machdep.h"
 #include "opt_bootconfig.h"
@@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_machdep.
 #include 
 
 #include 
+#include 
 
 #ifdef EFI_RUNTIME
 #include 
@@ -695,6 +696,8 @@ void
 cpu_startup_hook(void)
 {
 
+	fdtbus_intr_init();
+
 	fdt_setup_rndseed();
 }
 

Index: src/sys/dev/fdt/fdt_subr.c
diff -u src/sys/dev/fdt/fdt_subr.c:1.35 src/sys/dev/fdt/fdt_subr.c:1.36
--- src/sys/dev/fdt/fdt_subr.c:1.35	Mon Feb 24 12:38:57 2020
+++ src/sys/dev/fdt/fdt_subr.c	Sun Mar  8 08:26:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.35 2020/02/24 12:38:57 rin Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.36 2020/03/08 08:26:54 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.35 2020/02/24 12:38:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.36 2020/03/08 08:26:54 skrll Exp $");
 
 #include "opt_fdt.h"
 
@@ -52,9 +52,6 @@ fdtbus_init(const void *data)
 	}
 	fdt_data = data;
 
-	/* Now that we have a FDT blob, initialize other bits that need it. */
-	fdtbus_intr_init();
-
 	return true;
 }
 



CVS commit: src/sys/dev/fdt

2020-03-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar  8 08:25:36 UTC 2020

Modified Files:
src/sys/dev/fdt: fdt_intr.c

Log Message:
Use MUTEX_DEFAULT to avoid confusion


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/fdt/fdt_intr.c

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

Modified files:

Index: src/sys/dev/fdt/fdt_intr.c
diff -u src/sys/dev/fdt/fdt_intr.c:1.25 src/sys/dev/fdt/fdt_intr.c:1.26
--- src/sys/dev/fdt/fdt_intr.c:1.25	Sun Feb 16 20:28:18 2020
+++ src/sys/dev/fdt/fdt_intr.c	Sun Mar  8 08:25:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.25 2020/02/16 20:28:18 thorpej Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.26 2020/03/08 08:25:36 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.25 2020/02/16 20:28:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.26 2020/03/08 08:25:36 skrll Exp $");
 
 #include 
 #include 
@@ -73,7 +73,7 @@ void
 fdtbus_intr_init(void)
 {
 
-	mutex_init(_interrupt_cookie_mutex, MUTEX_SPIN, IPL_HIGH);
+	mutex_init(_interrupt_cookie_mutex, MUTEX_DEFAULT, IPL_HIGH);
 	cv_init(_interrupt_cookie_wait, "fdtintr");
 }