CVS commit: src/sys

2020-03-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar  5 07:46:36 UTC 2020

Modified Files:
src/sys/altq: altq_flowvalve.h
src/sys/dist/pf/net: pfvar.h
src/sys/net: slcompress.h

Log Message:
Need opt_inet.h for #ifdef INET, INET6.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/altq/altq_flowvalve.h
cvs rdiff -u -r1.22 -r1.23 src/sys/dist/pf/net/pfvar.h
cvs rdiff -u -r1.19 -r1.20 src/sys/net/slcompress.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/altq/altq_flowvalve.h
diff -u src/sys/altq/altq_flowvalve.h:1.3 src/sys/altq/altq_flowvalve.h:1.4
--- src/sys/altq/altq_flowvalve.h:1.3	Thu Oct 12 19:59:08 2006
+++ src/sys/altq/altq_flowvalve.h	Thu Mar  5 07:46:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_flowvalve.h,v 1.3 2006/10/12 19:59:08 peter Exp $	*/
+/*	$NetBSD: altq_flowvalve.h,v 1.4 2020/03/05 07:46:36 riastradh Exp $	*/
 /*	$KAME: altq_flowvalve.h,v 1.5 2002/04/03 05:38:50 kjc Exp $	*/
 
 /*
@@ -32,6 +32,10 @@
 
 #ifdef _KERNEL
 
+#ifdef _KERNEL_OPT
+#include "opt_inet.h"
+#endif
+
 /* fv_flow structure to define a unique address pair */
 struct fv_flow {
 	int flow_af;		/* address family */

Index: src/sys/dist/pf/net/pfvar.h
diff -u src/sys/dist/pf/net/pfvar.h:1.22 src/sys/dist/pf/net/pfvar.h:1.23
--- src/sys/dist/pf/net/pfvar.h:1.22	Thu Jun  5 23:48:16 2014
+++ src/sys/dist/pf/net/pfvar.h	Thu Mar  5 07:46:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfvar.h,v 1.22 2014/06/05 23:48:16 rmind Exp $	*/
+/*	$NetBSD: pfvar.h,v 1.23 2020/03/05 07:46:36 riastradh Exp $	*/
 /*	$OpenBSD: pfvar.h,v 1.254 2007/07/13 09:17:48 markus Exp $ */
 
 /*
@@ -34,6 +34,10 @@
 #ifndef _NET_PFVAR_H_
 #define _NET_PFVAR_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_inet.h"
+#endif
+
 #include 
 #include 
 #include 

Index: src/sys/net/slcompress.h
diff -u src/sys/net/slcompress.h:1.19 src/sys/net/slcompress.h:1.20
--- src/sys/net/slcompress.h:1.19	Mon Dec 12 15:58:45 2016
+++ src/sys/net/slcompress.h	Thu Mar  5 07:46:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: slcompress.h,v 1.19 2016/12/12 15:58:45 maya Exp $	*/
+/*	$NetBSD: slcompress.h,v 1.20 2020/03/05 07:46:36 riastradh Exp $	*/
 /*	Id: slcompress.h,v 1.4 1994/09/21 06:50:08 paulus Exp 	*/
 
 /*
@@ -42,6 +42,10 @@
 #ifndef _NET_SLCOMPRESS_H_
 #define _NET_SLCOMPRESS_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_inet.h"
+#endif
+
 #define MAX_STATES 16		/* must be > 2 and < 256 */
 #define MAX_HDR MLEN		/* XXX 4bsd-ism: should really be 128 */
 



CVS commit: src/sys/external/bsd/drm2/dist

2020-03-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar  5 07:46:59 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_drv.c
src/sys/external/bsd/drm2/dist/include/drm: drmP.h

Log Message:
Avoid struct inode.

This is an fs-independent structure in Linux.  We don't actually use
it as such; it's just a dummy struct tag.  But we do have an actual
struct inode in ufs and in lfs, and using the same struct tag here
confuses ctf leading to four copies of pretty much every drm data
structure.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/dist/drm/drm_drv.c
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/drm2/dist/include/drm/drmP.h

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.12 src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.13
--- src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.12	Fri Feb 14 14:34:57 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_drv.c	Thu Mar  5 07:46:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_drv.c,v 1.12 2020/02/14 14:34:57 maya Exp $	*/
+/*	$NetBSD: drm_drv.c,v 1.13 2020/03/05 07:46:59 riastradh Exp $	*/
 
 /*
  * Created: Fri Jan 19 10:48:35 2001 by fa...@acm.org
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.12 2020/02/14 14:34:57 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.13 2020/03/05 07:46:59 riastradh Exp $");
 
 #include 
 #include 
@@ -540,16 +540,14 @@ EXPORT_SYMBOL(drm_unplug_dev);
 
 #ifdef __NetBSD__
 
-struct inode;
-
-static struct inode *
+static void *
 drm_fs_inode_new(void)
 {
 	return NULL;
 }
 
 static void
-drm_fs_inode_free(struct inode *inode)
+drm_fs_inode_free(void *inode)
 {
 	KASSERT(inode == NULL);
 }

Index: src/sys/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.37 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.38
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.37	Fri Feb 14 14:34:59 2020
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Thu Mar  5 07:46:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmP.h,v 1.37 2020/02/14 14:34:59 maya Exp $	*/
+/*	$NetBSD: drmP.h,v 1.38 2020/03/05 07:46:59 riastradh Exp $	*/
 
 /*
  * Internal Header for the Direct Rendering Manager
@@ -827,7 +827,7 @@ struct drm_device {
 	struct drm_minor *primary;		/**< Primary node */
 	struct drm_minor *render;		/**< Render node */
 	atomic_t unplugged;			/**< Flag whether dev is dead */
-	struct inode *anon_inode;		/**< inode for private address-space */
+	void *anon_inode;		/**< inode for private address-space */
 	char *unique;/**< unique name of the device */
 	/*@} */
 



CVS commit: src/sys/net

2020-03-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar  5 07:46:49 UTC 2020

Modified Files:
src/sys/net: zlib.h

Log Message:
Avoid duplicate definition of internal_state struct.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/net/zlib.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/net/zlib.h
diff -u src/sys/net/zlib.h:1.14 src/sys/net/zlib.h:1.15
--- src/sys/net/zlib.h:1.14	Wed Mar 25 01:26:12 2009
+++ src/sys/net/zlib.h	Thu Mar  5 07:46:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: zlib.h,v 1.14 2009/03/25 01:26:12 darran Exp $ */
+/* $NetBSD: zlib.h,v 1.15 2020/03/05 07:46:49 riastradh Exp $ */
 
 /* zlib.h -- interface of the 'zlib' general purpose compression library
   version 1.1.4, March 11th, 2002
@@ -43,7 +43,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $Id: zlib.h,v 1.14 2009/03/25 01:26:12 darran Exp $ */
+/* @(#) $Id: zlib.h,v 1.15 2020/03/05 07:46:49 riastradh Exp $ */
 
 #ifndef ZCONF_H
 #define ZCONF_H
@@ -135,6 +135,7 @@
 #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
 #  define NO_DUMMY_DECL
 #endif
+#define NO_DUMMY_DECL
 
 /* Old Borland C incorrectly complains about missing returns: */
 #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)



CVS commit: src/sys/arch/powerpc

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 02:14:53 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c
src/sys/arch/powerpc/include/ibm4xx: pmap.h tlb.h

Log Message:
Retire tlbpid_t (u_short):

- PID (ctx, ASID) is 8-bit length, not half word.
- For struct pmap, no need to use integer types smaller than word as
  pm_ctx because of alignment.
- For ppc4xx_tlb_enter(), we need word-length storage for pid (and msr).

XXX
Better to rewrite pmap module with more suggestive integer types rather
than char, int, long, and so on.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/ibm4xx/pmap.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/include/ibm4xx/pmap.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/include/ibm4xx/tlb.h

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.83 src/sys/arch/powerpc/ibm4xx/pmap.c:1.84
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.83	Thu Mar  5 01:35:00 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Mar  5 02:14:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.83 2020/03/05 01:35:00 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.84 2020/03/05 02:14:52 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.83 2020/03/05 01:35:00 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.84 2020/03/05 02:14:52 rin Exp $");
 
 #include 
 #include 
@@ -1293,8 +1293,7 @@ void
 ppc4xx_tlb_enter(int ctx, vaddr_t va, u_int pte)
 {
 	u_long th, tl, idx;
-	tlbpid_t pid;
-	u_short msr;
+	int msr, pid;
 	paddr_t pa;
 	int sz;
 

Index: src/sys/arch/powerpc/include/ibm4xx/pmap.h
diff -u src/sys/arch/powerpc/include/ibm4xx/pmap.h:1.19 src/sys/arch/powerpc/include/ibm4xx/pmap.h:1.20
--- src/sys/arch/powerpc/include/ibm4xx/pmap.h:1.19	Wed Jul 17 08:39:03 2019
+++ src/sys/arch/powerpc/include/ibm4xx/pmap.h	Thu Mar  5 02:14:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.19 2019/07/17 08:39:03 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.20 2020/03/05 02:14:53 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -143,7 +143,7 @@
  * Pmap stuff
  */
 struct pmap {
-	volatile tlbpid_t pm_ctx;	/* PID to identify PMAP's entries in TLB */
+	volatile int pm_ctx;	/* PID to identify PMAP's entries in TLB */
 	int pm_refs;			/* ref count */
 	struct pmap_statistics pm_stats; /* pmap statistics */
 	volatile u_int *pm_ptbl[STSZ];	/* Array of 64 pointers to page tables. */

Index: src/sys/arch/powerpc/include/ibm4xx/tlb.h
diff -u src/sys/arch/powerpc/include/ibm4xx/tlb.h:1.5 src/sys/arch/powerpc/include/ibm4xx/tlb.h:1.6
--- src/sys/arch/powerpc/include/ibm4xx/tlb.h:1.5	Thu Apr 19 21:50:07 2018
+++ src/sys/arch/powerpc/include/ibm4xx/tlb.h	Thu Mar  5 02:14:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tlb.h,v 1.5 2018/04/19 21:50:07 christos Exp $	*/
+/*	$NetBSD: tlb.h,v 1.6 2020/03/05 02:14:53 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -89,7 +89,6 @@
 
 #ifndef _LOCORE
 
-typedef u_short tlbpid_t;
 typedef struct tlb_s {
 	u_int tlb_hi;
 	u_int tlb_lo;



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

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 02:02:08 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: copyout.c

Log Message:
copyoutstr(9): return ENAMETOOLONG correctly when source string is
not NUL-terminated.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/booke/copyout.c

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

Modified files:

Index: src/sys/arch/powerpc/booke/copyout.c
diff -u src/sys/arch/powerpc/booke/copyout.c:1.7 src/sys/arch/powerpc/booke/copyout.c:1.8
--- src/sys/arch/powerpc/booke/copyout.c:1.7	Thu Mar  5 00:33:56 2020
+++ src/sys/arch/powerpc/booke/copyout.c	Thu Mar  5 02:02:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyout.c,v 1.7 2020/03/05 00:33:56 rin Exp $	*/
+/*	$NetBSD: copyout.c,v 1.8 2020/03/05 02:02:08 rin Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.7 2020/03/05 00:33:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.8 2020/03/05 02:02:08 rin Exp $");
 
 #define	__UFETCHSTORE_PRIVATE
 
@@ -432,13 +432,15 @@ copyoutstr(const void *ksaddr, void *uda
 		const uint8_t data = *ksaddr8++;
 		copyout_uint8(udaddr8++, data, ds_msr);
 		if (data == 0)
-			break;
+			goto out;
 	}
+	rv = ENAMETOOLONG;
 
+out:
 	pcb->pcb_onfault = NULL;
 	if (done)
 		*done = copylen;
-	return 0;
+	return rv;
 }
 #else
 /* XXX This version of copyoutstr(9) has never beeen enabled so far. */



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 01:35:00 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
pmap_procwr(): use dcbst instead of dcbf as a tiny optimization.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/powerpc/ibm4xx/pmap.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.82 src/sys/arch/powerpc/ibm4xx/pmap.c:1.83
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.82	Thu Mar  5 01:33:36 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Mar  5 01:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.82 2020/03/05 01:33:36 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.83 2020/03/05 01:35:00 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.82 2020/03/05 01:33:36 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.83 2020/03/05 01:35:00 rin Exp $");
 
 #include 
 #include 
@@ -1183,7 +1183,7 @@ pmap_procwr(struct proc *p, vaddr_t va, 
 		"mtpid %2;"
 		"sync; isync;"
 		"1:"
-		"dcbf 0,%3;"
+		"dcbst 0,%3;"
 		"icbi 0,%3;"
 		"add %3,%3,%5;"
 		"addc. %4,%4,%6;"



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 01:33:36 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
ppc4xx_tlb_enter(): invalidate entry after clearing MSR for sure.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/powerpc/ibm4xx/pmap.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.81 src/sys/arch/powerpc/ibm4xx/pmap.c:1.82
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.81	Thu Mar  5 01:31:27 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Mar  5 01:33:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.81 2020/03/05 01:31:27 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.82 2020/03/05 01:33:36 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.81 2020/03/05 01:31:27 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.82 2020/03/05 01:33:36 rin Exp $");
 
 #include 
 #include 
@@ -1321,8 +1321,8 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_
 	__asm volatile(
 		"mfmsr %0;"			/* Save MSR */
 		"li %1,0;"
-		"tlbwe %1,%3,0;"		/* Invalidate old entry. */
 		"mtmsr %1;"			/* Clear MSR */
+		"tlbwe %1,%3,0;"		/* Invalidate old entry. */
 		"mfpid %1;"			/* Save old PID */
 		"mtpid %2;"			/* Load translation ctx */
 		"sync; isync;"



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 01:31:27 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Misc non-critical fixes.

- __asm --> __asm volatile for sure
- turn DEBUG code in __asm into DIAGNOSTIC code in C
- style


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/powerpc/ibm4xx/pmap.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.80 src/sys/arch/powerpc/ibm4xx/pmap.c:1.81
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.80	Fri Feb 21 13:16:16 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Mar  5 01:31:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.80 2020/02/21 13:16:16 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.81 2020/03/05 01:31:27 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.80 2020/02/21 13:16:16 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.81 2020/03/05 01:31:27 rin Exp $");
 
 #include 
 #include 
@@ -1173,7 +1173,8 @@ pmap_procwr(struct proc *p, vaddr_t va, 
 		ctx_alloc(pm);
 		ctx = pm->pm_ctx;
 	}
-	__asm volatile("mfmsr %0;"
+	__asm volatile(
+		"mfmsr %0;"
 		"li %1, %7;"
 		"andc %1,%0,%1;"
 		"mtmsr %1;"
@@ -1207,7 +1208,8 @@ ppc4xx_tlb_flush(vaddr_t va, int pid)
 	if (!pid)
 		return;
 
-	__asm( 	"mfpid %1;"		/* Save PID */
+	__asm volatile(
+		"mfpid %1;"		/* Save PID */
 		"mfmsr %2;"		/* Save MSR */
 		"li %0,0;"		/* Now clear MSR */
 		"mtmsr %0;"
@@ -1225,7 +1227,6 @@ ppc4xx_tlb_flush(vaddr_t va, int pid)
 		: "=" (i), "=" (found), "=" (msr)
 		: "r" (va), "r" (pid));
 	if (found && !TLB_LOCKED(i)) {
-
 		/* Now flush translation */
 		__asm volatile(
 			"tlbwe %0,%1,0;"
@@ -1308,7 +1309,7 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_
 	idx = ppc4xx_tlb_find_victim();
 
 #ifdef DIAGNOSTIC
-	if ((idx < tlb_nreserved) || (idx >= NTLB)) {
+	if ((idx < tlb_nreserved) || (idx >= NTLB) || (idx & 63) == 0) {
 		panic("ppc4xx_tlb_enter: replacing entry %ld", idx);
 	}
 #endif
@@ -1325,10 +1326,6 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_
 		"mfpid %1;"			/* Save old PID */
 		"mtpid %2;"			/* Load translation ctx */
 		"sync; isync;"
-#ifdef DEBUG
-		"andi. %3,%3,63;"
-		"tweqi %3,0;" 			/* X DEBUG trap on index 0 */
-#endif
 		"tlbwe %4,%3,1; tlbwe %5,%3,0;"	/* Set TLB */
 		"sync; isync;"
 		"mtpid %1; mtmsr %0;"		/* Restore PID and MSR */



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 01:21:09 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: cpu.c

Log Message:
Cosmetic change. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/ibm4xx/cpu.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/cpu.c
diff -u src/sys/arch/powerpc/ibm4xx/cpu.c:1.33 src/sys/arch/powerpc/ibm4xx/cpu.c:1.34
--- src/sys/arch/powerpc/ibm4xx/cpu.c:1.33	Mon Mar 24 19:29:59 2014
+++ src/sys/arch/powerpc/ibm4xx/cpu.c	Thu Mar  5 01:21:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.33 2014/03/24 19:29:59 christos Exp $	*/
+/*	$NetBSD: cpu.c,v 1.34 2020/03/05 01:21:09 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.33 2014/03/24 19:29:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.34 2020/03/05 01:21:09 rin Exp $");
 
 #include 
 #include 
@@ -317,6 +317,6 @@ dcache_wbinv_page(vaddr_t va)
 		for (size_t i = 0; i < PAGE_SIZE; i += dcache_line_size) {
 			__asm volatile("dcbf %0,%1" : : "b" (va), "r" (i));
 		}
-		__asm volatile("sync;isync" : : );
+		__asm volatile("sync; isync" : : );
 	}
 }



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 01:15:35 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c

Log Message:
Cosmetic changes. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/ibm4xx/copyinstr.c \
src/sys/arch/powerpc/ibm4xx/copyoutstr.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.12 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.13
--- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.12	Thu Mar  5 01:13:00 2020
+++ src/sys/arch/powerpc/ibm4xx/copyinstr.c	Thu Mar  5 01:15:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyinstr.c,v 1.12 2020/03/05 01:13:00 rin Exp $	*/
+/*	$NetBSD: copyinstr.c,v 1.13 2020/03/05 01:15:35 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.12 2020/03/05 01:13:00 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.13 2020/03/05 01:15:35 rin Exp $");
 
 #include 
 #include 
@@ -82,12 +82,13 @@ copyinstr(const void *udaddr, void *kadd
 		"mtpid %4; sync;"		/* Load user ctx */
 		"lbz %2,0(%5); addi %5,%5,1;"	/* Load byte */
 		"sync; isync;"
-		"mtpid %1;sync;"
+		"mtpid %1; sync;"
 		"stb %2,0(%6); dcbst 0,%6; addi %6,%6,1;"
 		/* Store kernel byte */
 		"sync; isync;"
 		"or. %2,%2,%2;"
 		"bdnzf 2,1b;"			/* while(ctr-- && !zero) */
+
 		"mtpid %1; mtmsr %0;"		/* Restore PID, MSR */
 		"sync; isync;"
 		"mfctr %3;"			/* Restore resid */
Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.12 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.13
--- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.12	Thu Mar  5 01:13:00 2020
+++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c	Thu Mar  5 01:15:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyoutstr.c,v 1.12 2020/03/05 01:13:00 rin Exp $	*/
+/*	$NetBSD: copyoutstr.c,v 1.13 2020/03/05 01:15:35 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.12 2020/03/05 01:13:00 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.13 2020/03/05 01:15:35 rin Exp $");
 
 #include 
 #include 
@@ -79,7 +79,7 @@ copyoutstr(const void *kaddr, void *udad
 		"sync; isync;"
 
 		"1:"
-		"mtpid %1;sync;"
+		"mtpid %1; sync;"
 		"lbz %2,0(%6); addi %6,%6,1;"	/* Store kernel byte */
 		"sync; isync;"
 		"mtpid %4; sync;"		/* Load user ctx */



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 01:13:00 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c

Log Message:
Use dcbst instead of dcbf to flush cache; the former does not invalidate
the cache line, which should be used immediately in most cases.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/ibm4xx/copyinstr.c \
src/sys/arch/powerpc/ibm4xx/copyoutstr.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.11 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.12
--- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.11	Thu Mar  5 01:10:57 2020
+++ src/sys/arch/powerpc/ibm4xx/copyinstr.c	Thu Mar  5 01:13:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyinstr.c,v 1.11 2020/03/05 01:10:57 rin Exp $	*/
+/*	$NetBSD: copyinstr.c,v 1.12 2020/03/05 01:13:00 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.11 2020/03/05 01:10:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.12 2020/03/05 01:13:00 rin Exp $");
 
 #include 
 #include 
@@ -83,7 +83,7 @@ copyinstr(const void *udaddr, void *kadd
 		"lbz %2,0(%5); addi %5,%5,1;"	/* Load byte */
 		"sync; isync;"
 		"mtpid %1;sync;"
-		"stb %2,0(%6); dcbf 0,%6; addi %6,%6,1;"
+		"stb %2,0(%6); dcbst 0,%6; addi %6,%6,1;"
 		/* Store kernel byte */
 		"sync; isync;"
 		"or. %2,%2,%2;"
Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.11 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.12
--- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.11	Thu Mar  5 01:10:57 2020
+++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c	Thu Mar  5 01:13:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyoutstr.c,v 1.11 2020/03/05 01:10:57 rin Exp $	*/
+/*	$NetBSD: copyoutstr.c,v 1.12 2020/03/05 01:13:00 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.11 2020/03/05 01:10:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.12 2020/03/05 01:13:00 rin Exp $");
 
 #include 
 #include 
@@ -83,7 +83,7 @@ copyoutstr(const void *kaddr, void *udad
 		"lbz %2,0(%6); addi %6,%6,1;"	/* Store kernel byte */
 		"sync; isync;"
 		"mtpid %4; sync;"		/* Load user ctx */
-		"stb %2,0(%5); dcbf 0,%5; addi %5,%5,1;"
+		"stb %2,0(%5); dcbst 0,%5; addi %5,%5,1;"
 		/* Load byte */
 		"sync; isync;"
 		"or. %2,%2,%2;"



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 01:10:57 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c

Log Message:
copy{in,out}str: Correctly return ENAMETOOLONG if source is not
NUL-terminated.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/ibm4xx/copyinstr.c \
src/sys/arch/powerpc/ibm4xx/copyoutstr.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.10 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.11
--- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.10	Thu Mar  5 00:54:13 2020
+++ src/sys/arch/powerpc/ibm4xx/copyinstr.c	Thu Mar  5 01:10:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyinstr.c,v 1.10 2020/03/05 00:54:13 rin Exp $	*/
+/*	$NetBSD: copyinstr.c,v 1.11 2020/03/05 01:10:57 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.10 2020/03/05 00:54:13 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.11 2020/03/05 01:10:57 rin Exp $");
 
 #include 
 #include 
@@ -46,7 +46,8 @@ int
 copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done)
 {
 	struct pmap *pm = curproc->p_vmspace->vm_map.pmap;
-	int rv, msr, pid, tmp, ctx;
+	size_t resid;
+	int rv, msr, pid, data, ctx;
 	struct faultbuf env;
 
 	if (__predict_false(len == 0)) {
@@ -68,6 +69,7 @@ copyinstr(const void *udaddr, void *kadd
 		ctx = pm->pm_ctx;
 	}
 
+	resid = len;
 	__asm volatile(
 		"mtctr %3;"			/* Set up counter */
 		"mfmsr %0;"			/* Save MSR */
@@ -76,8 +78,6 @@ copyinstr(const void *udaddr, void *kadd
 		"mfpid %1;"			/* Save old PID */
 		"sync; isync;"
 
-		"li %3,0;"			/* Clear len */
-
 		"1: "
 		"mtpid %4; sync;"		/* Load user ctx */
 		"lbz %2,0(%5); addi %5,%5,1;"	/* Load byte */
@@ -86,16 +86,19 @@ copyinstr(const void *udaddr, void *kadd
 		"stb %2,0(%6); dcbf 0,%6; addi %6,%6,1;"
 		/* Store kernel byte */
 		"sync; isync;"
-		"addi %3,%3,1;"			/* Inc len */
 		"or. %2,%2,%2;"
 		"bdnzf 2,1b;"			/* while(ctr-- && !zero) */
 		"mtpid %1; mtmsr %0;"		/* Restore PID, MSR */
 		"sync; isync;"
-		: "=" (msr), "=" (pid), "=" (tmp), "+b" (len)
+		"mfctr %3;"			/* Restore resid */
+		: "=" (msr), "=" (pid), "=" (data), "+r" (resid)
 		: "r" (ctx), "b" (udaddr), "b" (kaddr));
 
 	curpcb->pcb_onfault = NULL;
 	if (done)
-		*done = len;
-	return 0;
+		*done = len - resid;
+	if (resid == 0 && (char)data != '\0')
+		return ENAMETOOLONG;
+	else
+		return 0;
 }
Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.10 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.11
--- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.10	Thu Mar  5 00:54:13 2020
+++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c	Thu Mar  5 01:10:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyoutstr.c,v 1.10 2020/03/05 00:54:13 rin Exp $	*/
+/*	$NetBSD: copyoutstr.c,v 1.11 2020/03/05 01:10:57 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.10 2020/03/05 00:54:13 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.11 2020/03/05 01:10:57 rin Exp $");
 
 #include 
 #include 
@@ -46,7 +46,8 @@ int
 copyoutstr(const void *kaddr, void *udaddr, size_t len, size_t *done)
 {
 	struct pmap *pm = curproc->p_vmspace->vm_map.pmap;
-	int rv, msr, pid, tmp, ctx;
+	size_t resid;
+	int rv, msr, pid, data, ctx;
 	struct faultbuf env;
 
 	if (__predict_false(len == 0)) {
@@ -68,6 +69,7 @@ copyoutstr(const void *kaddr, void *udad
 		ctx = pm->pm_ctx;
 	}
 
+	resid = len;
 	__asm volatile(
 		"mtctr %3;"			/* Set up counter */
 		"mfmsr %0;"			/* Save MSR */
@@ -76,8 +78,6 @@ copyoutstr(const void *kaddr, void *udad
 		"mfpid %1;"			/* Save old PID */
 		"sync; isync;"
 
-		"li %3,0;"			/* Clear len */
-
 		"1:"
 		"mtpid %1;sync;"
 		"lbz %2,0(%6); addi %6,%6,1;"	/* Store kernel byte */
@@ -86,17 +86,20 @@ copyoutstr(const void *kaddr, void *udad
 		"stb %2,0(%5); dcbf 0,%5; addi %5,%5,1;"
 		/* Load byte */
 		"sync; isync;"
-		"addi %3,%3,1;"			/* Inc len */
 		"or. %2,%2,%2;"
 		"bdnzf 2,1b;"			/* while(ctr-- && !zero) */
 
 		"mtpid %1; mtmsr %0;"		/* Restore PID, MSR */
 		"sync; isync;"
-		: "=" (msr), "=" (pid), "=" (tmp), "+b" (len)
+		"mfctr %3;"			/* Restore resid */
+		: "=" (msr), "=" (pid), "=" (data), "+r" (resid)
 		: "r" (ctx), "b" (udaddr), "b" (kaddr));
 
 	curpcb->pcb_onfault = NULL;
 	if (done)
-		*done = len;
-	return 0;
+		*done = len - resid;
+	if (resid == 0 && (char)data != '\0')
+		return ENAMETOOLONG;
+	else
+		return 0;
 }



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 00:54:13 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c

Log Message:
copy{in,out}str: sync style with booke.

- early return in case of len == 0
- *done = 0 on fault


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/ibm4xx/copyinstr.c \
src/sys/arch/powerpc/ibm4xx/copyoutstr.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.9 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.10
--- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.9	Sat Mar 20 23:31:29 2010
+++ src/sys/arch/powerpc/ibm4xx/copyinstr.c	Thu Mar  5 00:54:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyinstr.c,v 1.9 2010/03/20 23:31:29 chs Exp $	*/
+/*	$NetBSD: copyinstr.c,v 1.10 2020/03/05 00:54:13 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.9 2010/03/20 23:31:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.10 2020/03/05 00:54:13 rin Exp $");
 
 #include 
 #include 
@@ -49,11 +49,16 @@ copyinstr(const void *udaddr, void *kadd
 	int rv, msr, pid, tmp, ctx;
 	struct faultbuf env;
 
+	if (__predict_false(len == 0)) {
+		if (done)
+			*done = 0;
+		return 0;
+	}
+
 	if ((rv = setfault())) {
 		curpcb->pcb_onfault = NULL;
-		/*  -- len may be lost on a fault */
 		if (done)
-			*done = len;
+			*done = 0;
 		return rv;
 	}
 
@@ -63,34 +68,32 @@ copyinstr(const void *udaddr, void *kadd
 		ctx = pm->pm_ctx;
 	}
 
-	if (len) {
-		__asm volatile("mtctr %3;"		/* Set up counter */
-			"mfmsr %0;"			/* Save MSR */
-			"li %1,0x20; "
-			"andc %1,%0,%1; mtmsr %1;"	/* Disable IMMU */
-			"mfpid %1;"			/* Save old PID */
-			"sync; isync;"
-
-			"li %3,0;"			/* Clear len */
-
-			"1: "
-			"mtpid %4; sync;"		/* Load user ctx */
-			"lbz %2,0(%5); addi %5,%5,1;"	/* Load byte */
-			"sync; isync;"
-			"mtpid %1;sync;"
-			"stb %2,0(%6);  dcbf 0,%6; addi %6,%6,1;"	/* Store kernel byte */
-			"sync; isync;"
-			"addi %3,%3,1;"			/* Inc len */
-			"or. %2,%2,%2;"
-			"bdnzf 2,1b;"			/*
-			 * while(ctr-- && !zero)
-			 */
-
-			"mtpid %1; mtmsr %0;"		/* Restore PID, MSR */
-			"sync; isync;"
-			: "=" (msr), "=" (pid), "=" (tmp), "+b" (len)
-			: "r" (ctx), "b" (udaddr), "b" (kaddr));
-	}
+	__asm volatile(
+		"mtctr %3;"			/* Set up counter */
+		"mfmsr %0;"			/* Save MSR */
+		"li %1,0x20;"
+		"andc %1,%0,%1; mtmsr %1;"	/* Disable IMMU */
+		"mfpid %1;"			/* Save old PID */
+		"sync; isync;"
+
+		"li %3,0;"			/* Clear len */
+
+		"1: "
+		"mtpid %4; sync;"		/* Load user ctx */
+		"lbz %2,0(%5); addi %5,%5,1;"	/* Load byte */
+		"sync; isync;"
+		"mtpid %1;sync;"
+		"stb %2,0(%6); dcbf 0,%6; addi %6,%6,1;"
+		/* Store kernel byte */
+		"sync; isync;"
+		"addi %3,%3,1;"			/* Inc len */
+		"or. %2,%2,%2;"
+		"bdnzf 2,1b;"			/* while(ctr-- && !zero) */
+		"mtpid %1; mtmsr %0;"		/* Restore PID, MSR */
+		"sync; isync;"
+		: "=" (msr), "=" (pid), "=" (tmp), "+b" (len)
+		: "r" (ctx), "b" (udaddr), "b" (kaddr));
+
 	curpcb->pcb_onfault = NULL;
 	if (done)
 		*done = len;
Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.9 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.10
--- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.9	Sat Mar 20 23:31:29 2010
+++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c	Thu Mar  5 00:54:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyoutstr.c,v 1.9 2010/03/20 23:31:29 chs Exp $	*/
+/*	$NetBSD: copyoutstr.c,v 1.10 2020/03/05 00:54:13 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.9 2010/03/20 23:31:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.10 2020/03/05 00:54:13 rin Exp $");
 
 #include 
 #include 
@@ -49,11 +49,16 @@ copyoutstr(const void *kaddr, void *udad
 	int rv, msr, pid, tmp, ctx;
 	struct faultbuf env;
 
+	if (__predict_false(len == 0)) {
+		if (done)
+			*done = 0;
+		return 0;
+	}
+
 	if ((rv = setfault())) {
 		curpcb->pcb_onfault = NULL;
-		/*  -- len may be lost on a fault */
 		if (done)
-			*done = len;
+			*done = 0;
 		return rv;
 	}
 
@@ -63,34 +68,33 @@ copyoutstr(const void *kaddr, void *udad
 		ctx = pm->pm_ctx;
 	}
 
-	if (len) {
-		__asm volatile("mtctr %3;"		/* Set up counter */
-			"mfmsr %0;"			/* Save MSR */
-			"li %1,0x20; "
-			"andc %1,%0,%1; mtmsr %1;"	/* Disable IMMU */
-			"mfpid %1;"			/* Save old PID */
-			"sync; isync;"
-
-			"li %3,0;"			/* Clear len */
-
-			"1:"
-			"mtpid %1;sync;"
-			"lbz %2,0(%6); addi %6,%6,1;"	/* Store kernel byte */
-			"sync; isync;"
-			"mtpid %4; sync;"		/* Load user ctx */
-			"stb %2,0(%5);  dcbf 0,%5; addi %5,%5,1;"	/* Load byte */
-			"sync; isync;"
-			"addi %3,%3,1;"			/* Inc len */
-			"or. %2,%2,%2;"
-			

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

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Mar  5 00:33:56 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: copyout.c

Log Message:
copyoutstr(9): sync style with copyinstr(9).

- use variable name "done" instead of "lenp"
- return return value from setfault() on fault, instead of hardcoded EFAULT

No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/booke/copyout.c

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

Modified files:

Index: src/sys/arch/powerpc/booke/copyout.c
diff -u src/sys/arch/powerpc/booke/copyout.c:1.6 src/sys/arch/powerpc/booke/copyout.c:1.7
--- src/sys/arch/powerpc/booke/copyout.c:1.6	Wed Mar  4 13:01:52 2020
+++ src/sys/arch/powerpc/booke/copyout.c	Thu Mar  5 00:33:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyout.c,v 1.6 2020/03/04 13:01:52 rin Exp $	*/
+/*	$NetBSD: copyout.c,v 1.7 2020/03/05 00:33:56 rin Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.6 2020/03/04 13:01:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.7 2020/03/05 00:33:56 rin Exp $");
 
 #define	__UFETCHSTORE_PRIVATE
 
@@ -402,22 +402,24 @@ copyout(const void *vksaddr, void *vudad
 
 #if 1
 int
-copyoutstr(const void *ksaddr, void *udaddr, size_t len, size_t *lenp)
+copyoutstr(const void *ksaddr, void *udaddr, size_t len, size_t *done)
 {
 	struct pcb * const pcb = lwp_getpcb(curlwp);
 	struct faultbuf env;
+	int rv;
 
 	if (__predict_false(len == 0)) {
-		if (lenp)
-			*lenp = 0;
+		if (done)
+			*done = 0;
 		return 0;
 	}
 
-	if (setfault()) {
+	rv = setfault();
+	if (rv != 0) {
 		pcb->pcb_onfault = NULL;
-		if (lenp)
-			*lenp = 0;
-		return EFAULT;
+		if (done)
+			*done = 0;
+		return rv;
 	}
 
 	const register_t ds_msr = mfmsr() | PSL_DS;
@@ -434,8 +436,8 @@ copyoutstr(const void *ksaddr, void *uda
 	}
 
 	pcb->pcb_onfault = NULL;
-	if (lenp)
-		*lenp = copylen;
+	if (done)
+		*done = copylen;
 	return 0;
 }
 #else



CVS commit: src/external/bsd

2020-03-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Mar  4 22:56:08 UTC 2020

Modified Files:
src/external/bsd: Makefile

Log Message:
Remove trailing " from pam-u2f subdir name


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/external/bsd/Makefile

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

Modified files:

Index: src/external/bsd/Makefile
diff -u src/external/bsd/Makefile:1.68 src/external/bsd/Makefile:1.69
--- src/external/bsd/Makefile:1.68	Wed Mar  4 22:07:08 2020
+++ src/external/bsd/Makefile	Wed Mar  4 22:56:08 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.68 2020/03/04 22:07:08 christos Exp $
+#	$NetBSD: Makefile,v 1.69 2020/03/04 22:56:08 jmcneill Exp $
 
 .include 
 
@@ -31,7 +31,7 @@ SUBDIR+= libc++
 SUBDIR+= nsd
 .endif
 .if ${MKPAM} != "no"
-SUBDIR+= pam-u2f"
+SUBDIR+= pam-u2f
 .endif
 .if (${MKPCC} != "no")
 SUBDIR+= pcc



CVS commit: src/share/misc

2020-03-04 Thread Frederic Cambus
Module Name:src
Committed By:   fcambus
Date:   Wed Mar  4 22:24:46 UTC 2020

Modified Files:
src/share/misc: inter.phone

Log Message:
Fix area code for Czestochowa and add area code for Tarnow.

While there, fix names for some other Polish cities.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/share/misc/inter.phone

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

Modified files:

Index: src/share/misc/inter.phone
diff -u src/share/misc/inter.phone:1.31 src/share/misc/inter.phone:1.32
--- src/share/misc/inter.phone:1.31	Wed Jun 12 04:10:25 2019
+++ src/share/misc/inter.phone	Wed Mar  4 22:24:46 2020
@@ -1,5 +1,5 @@
 # Country Code : City Code : City : Country
-#	$NetBSD: inter.phone,v 1.31 2019/06/12 04:10:25 mrg Exp $
+#	$NetBSD: inter.phone,v 1.32 2020/03/04 22:24:46 fcambus Exp $
 #	@(#)inter.phone	8.1 (Berkeley) 6/9/93
 7:317:Akmola:Republic of Kazakhstan
 7:329:Aktau:Republic of Kazakhstan
@@ -184,6 +184,7 @@
 47:7:Trondheim:Norway
 48:12:Cracow:Poland
 48:13:Krosno:Poland
+48:14:Tarnow:Poland
 48:15:Tarnobrzeg:Poland
 48:16:Przemysl:Poland
 48:17:Rzeszow:Poland
@@ -194,12 +195,12 @@
 48:25:Siedlce:Poland
 48:29:Ostroleka:Poland
 48:32:Katowice:Poland
-48:33:Bielsko Biala:Poland
-48:33:Czestochowa:Poland
+48:33:Bielsko-Biala:Poland
+48:34:Czestochowa:Poland
 48:41:Kielce:Poland
 48:42:Lodz:Poland
 48:43:Sieradz:Poland
-48:44:Piotrkow:Poland
+48:44:Piotrkow Trybunalski:Poland
 48:46:Skierniewice:Poland
 48:48:Radom:Poland
 48:52:Bydgoszcz:Poland
@@ -229,7 +230,7 @@
 48:89:Olsztyn:Poland
 48:91:Szczecin:Poland
 48:94:Koszalin:Poland
-48:95:Gorzow:Poland
+48:95:Gorzow Wielkopolski:Poland
 49:201:Essen:Germany, Fed. Rep. of
 49:202:Wuppertal:Germany, Fed. Rep. of
 49:203:Duisburg:Germany, Fed. Rep. of



CVS commit: src/distrib/sets/lists

2020-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar  4 22:09:00 UTC 2020

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

Log Message:
fix pam annotations


To generate a diff of this commit:
cvs rdiff -u -r1.1230 -r1.1231 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.295 -r1.296 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1230 src/distrib/sets/lists/base/mi:1.1231
--- src/distrib/sets/lists/base/mi:1.1230	Mon Mar  2 19:38:12 2020
+++ src/distrib/sets/lists/base/mi	Wed Mar  4 17:09:00 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1230 2020/03/03 00:38:12 christos Exp $
+# $NetBSD: mi,v 1.1231 2020/03/04 22:09:00 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -894,7 +894,7 @@
 ./usr/bin/opensslbase-crypto-bin
 ./usr/bin/page	base-util-bin
 ./usr/bin/pagesizebase-util-bin
-./usr/bin/pamu2fcfgbase-util-bin
+./usr/bin/pamu2fcfgbase-util-bin		pam
 ./usr/bin/passwdbase-util-bin
 ./usr/bin/paste	base-util-bin
 ./usr/bin/patch	base-util-bin

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.295 src/distrib/sets/lists/debug/mi:1.296
--- src/distrib/sets/lists/debug/mi:1.295	Mon Mar  2 19:38:12 2020
+++ src/distrib/sets/lists/debug/mi	Wed Mar  4 17:09:00 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.295 2020/03/03 00:38:12 christos Exp $
+# $NetBSD: mi,v 1.296 2020/03/04 22:09:00 christos 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
@@ -706,7 +706,7 @@
 ./usr/libdata/debug/usr/bin/openpgp.debug	comp-obsolete		obsolete
 ./usr/libdata/debug/usr/bin/openssl.debug	comp-crypto-debug	debug
 ./usr/libdata/debug/usr/bin/p++.debug		comp-obsolete		obsolete
-./usr/libdata/debug/usr/bin/pamu2fcfg.debug	comp-util-debug		debug
+./usr/libdata/debug/usr/bin/pamu2fcfg.debug	comp-util-debug		debug,pam
 ./usr/libdata/debug/usr/bin/passwd.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/paste.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/patch.debug		comp-util-debug		debug



CVS commit: src/external/bsd

2020-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar  4 22:07:08 UTC 2020

Modified Files:
src/external/bsd: Makefile

Log Message:
conditionalize on mkpam


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/external/bsd/Makefile

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

Modified files:

Index: src/external/bsd/Makefile
diff -u src/external/bsd/Makefile:1.67 src/external/bsd/Makefile:1.68
--- src/external/bsd/Makefile:1.67	Mon Mar  2 19:29:41 2020
+++ src/external/bsd/Makefile	Wed Mar  4 17:07:08 2020
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile,v 1.67 2020/03/03 00:29:41 christos Exp $
+#	$NetBSD: Makefile,v 1.68 2020/03/04 22:07:08 christos Exp $
 
 .include 
 
 SUBDIR=	acpica am-utils bc byacc cron dhcpcd ekermit elftosb \
 	fetch file flex jemalloc less \
 	libarchive libevent libfido2 liblzf libpcap mdocml \
-	ntp pam-u2f openresolv tcpdump tmux top tre wpa
+	ntp openresolv tcpdump tmux top tre wpa
 
 .if (${MKATF} != "no")
 SUBDIR+= atf
@@ -30,6 +30,9 @@ SUBDIR+= libc++
 .if (${MKNSD} != "no")
 SUBDIR+= nsd
 .endif
+.if ${MKPAM} != "no"
+SUBDIR+= pam-u2f"
+.endif
 .if (${MKPCC} != "no")
 SUBDIR+= pcc
 .endif



CVS commit: src/sys/arch/x86/x86

2020-03-04 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Mar  4 22:00:03 UTC 2020

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
pmap_enter(): ditch pv_entry if unmanaged.  Shouldn't happen I think, but
do for the sake of correctness.


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.362 src/sys/arch/x86/x86/pmap.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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.361 src/sys/arch/x86/x86/pmap.c:1.362
--- src/sys/arch/x86/x86/pmap.c:1.361	Sun Mar  1 21:42:58 2020
+++ src/sys/arch/x86/x86/pmap.c	Wed Mar  4 22:00:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.361 2020/03/01 21:42:58 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.362 2020/03/04 22:00:03 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.361 2020/03/01 21:42:58 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.362 2020/03/04 22:00:03 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4415,8 +4415,8 @@ pmap_enter_ma(struct pmap *pmap, vaddr_t
 		if ((opte & PTE_PVLIST) != 0 && pve != NULL) {
 			KASSERT(pve->pve_pte.pte_ptp == ptp);
 			KASSERT(pve->pve_pte.pte_va == va);
+			pve = NULL;
 		}
-		pve = NULL;
 		goto same_pa;
 	}
 
@@ -5293,8 +5293,8 @@ pmap_ept_enter(struct pmap *pmap, vaddr_
 		if ((opte & EPT_PVLIST) != 0 && pve != NULL) {
 			KASSERT(pve->pve_pte.pte_ptp == ptp);
 			KASSERT(pve->pve_pte.pte_va == va);
+			pve = NULL;
 		}
-		pve = NULL;
 		goto same_pa;
 	}
 



CVS commit: [ad-namecache] src/sys

2020-03-04 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Mar  4 20:26:29 UTC 2020

Modified Files:
src/sys/rump/include/rump [ad-namecache]: rump_namei.h
src/sys/sys [ad-namecache]: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.4 -r1.37.2.5 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.103.2.5 -r1.103.2.6 src/sys/sys/namei.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/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.37.2.4 src/sys/rump/include/rump/rump_namei.h:1.37.2.5
--- src/sys/rump/include/rump/rump_namei.h:1.37.2.4	Sat Jan 25 21:45:00 2020
+++ src/sys/rump/include/rump/rump_namei.h	Wed Mar  4 20:26:28 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.37.2.4 2020/01/25 21:45:00 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.37.2.5 2020/03/04 20:26:28 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.48 2020/01/08 12:04:56 ad Exp 
+ *   from: NetBSD: namei.src,v 1.47.2.7 2020/03/04 20:21:05 ad Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_
@@ -23,10 +23,11 @@
 #define RUMP_NAMEI_FOLLOW	0x0040
 #define RUMP_NAMEI_NOFOLLOW	0x
 #define RUMP_NAMEI_EMULROOTSET	0x0080
+#define RUMP_NAMEI_LOCKSHARED	0x0100
 #define RUMP_NAMEI_NOCHROOT	0x0100
-#define RUMP_NAMEI_MODMASK	0x01fc
-#define RUMP_NAMEI_NOCROSSMOUNT	0x100
-#define RUMP_NAMEI_RDONLY	0x200
+#define RUMP_NAMEI_MODMASK	0x010001fc
+#define RUMP_NAMEI_NOCROSSMOUNT	0x800
+#define RUMP_NAMEI_RDONLY	0x0001000
 #define RUMP_NAMEI_ISDOTDOT	0x0002000
 #define RUMP_NAMEI_MAKEENTRY	0x0004000
 #define RUMP_NAMEI_ISLASTCN	0x0008000
@@ -34,6 +35,6 @@
 #define RUMP_NAMEI_DOWHITEOUT	0x004
 #define RUMP_NAMEI_REQUIREDIR	0x008
 #define RUMP_NAMEI_CREATEDIR	0x020
-#define RUMP_NAMEI_PARAMASK	0x02ee300
+#define RUMP_NAMEI_PARAMASK	0x02ef800
 
 #endif /* _RUMP_RUMP_NAMEI_H_ */

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.103.2.5 src/sys/sys/namei.h:1.103.2.6
--- src/sys/sys/namei.h:1.103.2.5	Fri Jan 24 16:49:12 2020
+++ src/sys/sys/namei.h	Wed Mar  4 20:26:29 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.103.2.5 2020/01/24 16:49:12 ad Exp $	*/
+/*	$NetBSD: namei.h,v 1.103.2.6 2020/03/04 20:26:29 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.47.2.6 2020/01/24 16:48:59 ad Exp 
+ *   from: NetBSD: namei.src,v 1.47.2.7 2020/03/04 20:21:05 ad Exp 
  */
 
 /*
@@ -211,8 +211,7 @@ struct nameidata {
  *
  * This structure describes the elements in the cache of recent names looked
  * up by namei.  It's carefully sized to take up 128 bytes on _LP64, to make
- * good use of space and the CPU caches; nc_name is aligned on an 8-byte
- * boundary to make string comparisons cheaper.
+ * good use of space and the CPU caches.
  *
  * Field markings and their corresponding locks:
  *



CVS commit: [ad-namecache] src/sys/sys

2020-03-04 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Mar  4 20:21:05 UTC 2020

Modified Files:
src/sys/sys [ad-namecache]: namei.src

Log Message:
Fix a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.47.2.6 -r1.47.2.7 src/sys/sys/namei.src

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/namei.src
diff -u src/sys/sys/namei.src:1.47.2.6 src/sys/sys/namei.src:1.47.2.7
--- src/sys/sys/namei.src:1.47.2.6	Fri Jan 24 16:48:59 2020
+++ src/sys/sys/namei.src	Wed Mar  4 20:21:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: namei.src,v 1.47.2.6 2020/01/24 16:48:59 ad Exp $	*/
+/*	$NetBSD: namei.src,v 1.47.2.7 2020/03/04 20:21:05 ad Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -203,8 +203,7 @@ NAMEIFL	PARAMASK	0x02ef800	/* mask of pa
  *
  * This structure describes the elements in the cache of recent names looked
  * up by namei.  It's carefully sized to take up 128 bytes on _LP64, to make
- * good use of space and the CPU caches; nc_name is aligned on an 8-byte
- * boundary to make string comparisons cheaper.
+ * good use of space and the CPU caches.
  *
  * Field markings and their corresponding locks:
  *



CVS commit: src/sys/arch/aarch64

2020-03-04 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Mar  4 19:28:04 UTC 2020

Modified Files:
src/sys/arch/aarch64/conf: Makefile.aarch64
src/sys/arch/aarch64/include: vmparam.h

Log Message:
change kernel vm base address to use more than 256GB of memory. (up to 64TB)

also enlarge KSEG(direct map) region from 512GB to 64TB.
KASAN works ok.

Note: -fasan-shadow-offset=
  KASAN_SHADOW_START - (CANONICAL_BASE >> 3) =
  0x4000 - (0x >> 3) =
  0xDFFF6000


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/aarch64/conf/Makefile.aarch64
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/include/vmparam.h

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

Modified files:

Index: src/sys/arch/aarch64/conf/Makefile.aarch64
diff -u src/sys/arch/aarch64/conf/Makefile.aarch64:1.16 src/sys/arch/aarch64/conf/Makefile.aarch64:1.17
--- src/sys/arch/aarch64/conf/Makefile.aarch64:1.16	Wed Dec  4 11:24:31 2019
+++ src/sys/arch/aarch64/conf/Makefile.aarch64	Wed Mar  4 19:28:04 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.aarch64,v 1.16 2019/12/04 11:24:31 jmcneill Exp $
+#	$NetBSD: Makefile.aarch64,v 1.17 2020/03/04 19:28:04 ryo Exp $
 
 # Makefile for NetBSD
 #
@@ -43,7 +43,7 @@ CFLAGS+=	-mno-omit-leaf-frame-pointer
 KASANFLAGS=	-fsanitize=kernel-address \
 		--param asan-globals=1 --param asan-stack=1 \
 		-fsanitize-address-use-after-scope \
-		-fasan-shadow-offset=0xDFFF2080
+		-fasan-shadow-offset=0xDFFF6000
 .for f in subr_asan.c
 KASANFLAGS.${f}=	# empty
 .endfor
@@ -74,7 +74,7 @@ locore.o: ${ARM}/aarch64/locore.S assym.
 ## (5) link settings
 ##
 KERNLDSCRIPT?=	${ARM}/conf/kern.ldscript
-LOADADDRESS?=	0xffc0
+LOADADDRESS?=	0xc000
 LINKFLAGS_NORMAL=	-X
 
 # Strip AArch64 mapping symbols from the kernel image, as they interfere

Index: src/sys/arch/aarch64/include/vmparam.h
diff -u src/sys/arch/aarch64/include/vmparam.h:1.10 src/sys/arch/aarch64/include/vmparam.h:1.11
--- src/sys/arch/aarch64/include/vmparam.h:1.10	Wed Jan 22 16:59:38 2020
+++ src/sys/arch/aarch64/include/vmparam.h	Wed Mar  4 19:28:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.10 2020/01/22 16:59:38 ad Exp $ */
+/* $NetBSD: vmparam.h,v 1.11 2020/03/04 19:28:04 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -130,10 +130,17 @@
 #define VM_MAXUSER_ADDRESS32	((vaddr_t) 0xf000)
 
 /*
- * Give ourselves 64GB of mappable kernel space.  That leaves the rest
- * to be user for directly mapped (block addressable) addresses.
+ * kernel virtual space layout:
+ *   0x-   64T KSEG(direct mapping)
+ *   0x4000-   32T (KASAN SHADOW MAP)
+ *   0x6000-   32T (not used)
+ *   0x8000-1G EFI_RUNTIME
+ *   0x80004000-   64T (not used)
+ *   0xc000-   64T KERNEL VM Space (including kernel text/data/bss)
+ *   0xf000-  254M KERNEL_IO for pmap_devmap
+ *   0xffe0-2M RESERVED
  */
-#define VM_MIN_KERNEL_ADDRESS	((vaddr_t) 0xffc0L)
+#define VM_MIN_KERNEL_ADDRESS	((vaddr_t) 0xc000L)
 #define VM_MAX_KERNEL_ADDRESS	((vaddr_t) 0xffe0L)
 
 /*
@@ -164,7 +171,7 @@
  * using block page table entries.
  */
 #define AARCH64_KSEG_MASK	((vaddr_t) 0xL)
-#define AARCH64_KSEG_SIZE	(1UL << 39)	/* 512GB */
+#define AARCH64_KSEG_SIZE	(1UL << 46)	/* 64TB */
 #define AARCH64_KSEG_START	AARCH64_KSEG_MASK
 #define AARCH64_KSEG_END	(AARCH64_KSEG_START + AARCH64_KSEG_SIZE)
 #define AARCH64_KMEMORY_BASE	AARCH64_KSEG_MASK



CVS commit: src/external/bsd/pam-u2f

2020-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar  4 17:32:27 UTC 2020

Modified Files:
src/external/bsd/pam-u2f/bin/pamu2fcfg: Makefile
src/external/bsd/pam-u2f/lib/security/pam-u2f: Makefile

Log Message:
Add a libm dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile

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

Modified files:

Index: src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile
diff -u src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.1 src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.2
--- src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.1	Mon Mar  2 22:10:32 2020
+++ src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile	Wed Mar  4 12:32:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2020/03/03 03:10:32 christos Exp $
+# $NetBSD: Makefile,v 1.2 2020/03/04 17:32:27 christos Exp $
 
 NOMAN=
 
@@ -21,7 +21,7 @@ PROG=pamu2fcfg
 SRCS=pamu2fcfg.c cmdline.c b64.c readpassphrase.c explicit_bzero.c util.c
 COPTS.util.c += -Wno-error=stack-protector
 
-LDADD+=-lpam -lfido2 -lcbor -lusbhid -lcrypto
-DPADD+=${LIBPAM} ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO}
+LDADD+=-lpam -lfido2 -lcbor -lusbhid -lcrypto -lm
+DPADD+=${LIBPAM} ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBM}
 
 .include 

Index: src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile
diff -u src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.2 src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.3
--- src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.2	Mon Mar  2 19:44:12 2020
+++ src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile	Wed Mar  4 12:32:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2020/03/03 00:44:12 christos Exp $
+# $NetBSD: Makefile,v 1.3 2020/03/04 17:32:27 christos Exp $
 
 NOMAN=
 .include 
@@ -16,6 +16,7 @@ COPTS.util.c += -Wno-error=stack-protect
 LIBDPLIBS+= \
 	fido2	${NETBSDSRCDIR}/external/bsd/libfido2/lib \
 	cbor	${NETBSDSRCDIR}/external/mit/libcbor/lib \
-	crypto	${NETBSDSRCDIR}/crypto/external/bsd/${EXTERNAL_OPENSSL_SUBDIR}/lib/libcrypto
+	crypto	${NETBSDSRCDIR}/crypto/external/bsd/${EXTERNAL_OPENSSL_SUBDIR}/lib/libcrypto \
+	m	${NETBSDSRCDIR}/lib/libm
 
 .include "${NETBSDSRCDIR}/lib/libpam/modules/mod.mk"



CVS commit: src/crypto/external/bsd/openssh/libexec/ssh-sk-helper

2020-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar  4 17:30:40 UTC 2020

Modified Files:
src/crypto/external/bsd/openssh/libexec/ssh-sk-helper: Makefile

Log Message:
Add a libm dependency


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssh/libexec/ssh-sk-helper/Makefile

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

Modified files:

Index: src/crypto/external/bsd/openssh/libexec/ssh-sk-helper/Makefile
diff -u src/crypto/external/bsd/openssh/libexec/ssh-sk-helper/Makefile:1.2 src/crypto/external/bsd/openssh/libexec/ssh-sk-helper/Makefile:1.3
--- src/crypto/external/bsd/openssh/libexec/ssh-sk-helper/Makefile:1.2	Mon Mar  2 19:43:20 2020
+++ src/crypto/external/bsd/openssh/libexec/ssh-sk-helper/Makefile	Wed Mar  4 12:30:40 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2020/03/03 00:43:20 christos Exp $
+#	$NetBSD: Makefile,v 1.3 2020/03/04 17:30:40 christos Exp $
 
 BINDIR=	/usr/libexec
 
@@ -6,7 +6,7 @@ PROG=	ssh-sk-helper
 SRCS=	ssh-sk-helper.c ssh-sk.c sk-usbhid.c
 MAN=	ssh-sk-helper.8
 
-LDADD+=-lfido2 -lcbor -lusbhid
-DPADD+=${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID}
+LDADD+=-lfido2 -lcbor -lusbhid -lm
+DPADD+=${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBM}
 
 .include 



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

2020-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar  4 17:31:08 UTC 2020

Modified Files:
src/external/bsd/libfido2/bin: Makefile.inc

Log Message:
add a libm dependency


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/libfido2/bin/Makefile.inc

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

Modified files:

Index: src/external/bsd/libfido2/bin/Makefile.inc
diff -u src/external/bsd/libfido2/bin/Makefile.inc:1.1 src/external/bsd/libfido2/bin/Makefile.inc:1.2
--- src/external/bsd/libfido2/bin/Makefile.inc:1.1	Mon Mar  2 19:14:17 2020
+++ src/external/bsd/libfido2/bin/Makefile.inc	Wed Mar  4 12:31:08 2020
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile.inc,v 1.1 2020/03/03 00:14:17 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.2 2020/03/04 17:31:08 christos Exp $
 
 .include "${.PARSEDIR}/../Makefile.inc"
 
 .PATH: ${DIST}/tools ${DIST}/man ${DIST}/openbsd-compat
 
-LDADD+=-lfido2 -lcbor -lusbhid -lcrypto 
-DPADD+=${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO}
+LDADD+=-lfido2 -lcbor -lusbhid -lcrypto  -lm
+DPADD+=${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBM}



CVS commit: src/external/mit/libcbor/lib

2020-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar  4 17:22:49 UTC 2020

Modified Files:
src/external/mit/libcbor/lib: Makefile

Log Message:
Fix vax and platforms that don't have ldexp in libc (aarch64, ppc64, ia64)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/mit/libcbor/lib/Makefile

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

Modified files:

Index: src/external/mit/libcbor/lib/Makefile
diff -u src/external/mit/libcbor/lib/Makefile:1.2 src/external/mit/libcbor/lib/Makefile:1.3
--- src/external/mit/libcbor/lib/Makefile:1.2	Tue Mar  3 18:32:58 2020
+++ src/external/mit/libcbor/lib/Makefile	Wed Mar  4 12:22:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2020/03/03 23:32:58 mlelstv Exp $
+# $NetBSD: Makefile,v 1.3 2020/03/04 17:22:49 christos Exp $
 
 NOLINT=
 NOMAN=
@@ -10,10 +10,18 @@ DIST = ${.CURDIR}/../dist
 
 CPPFLAGS+= -I${DIST}/src -DHAVE_ENDIAN_H -I. -DEIGHT_BYTE_SIZE_T
 
+.if ${MACHINE} == "vax"
+# vax does not have NaN (no ieee754, so this code will not work anyway)
+CPPFLAGS+=-DNAN=INFINITY
+.endif
+
 LIB=cbor
 
 SRCS+=   cbor.c
 
+# For ldexp
+LIBDPLIBS = m ${NETBSDSRCDIR}/lib/libm
+
 VERS_FILE=${DIST}/CMakeLists.txt
 
 .for i in MAJOR MINOR PATCH



CVS commit: src/sys/dev/usb

2020-03-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Mar  4 16:17:23 UTC 2020

Modified Files:
src/sys/dev/usb: ehcivar.h

Log Message:
Consistency in use of #define names.  No functional change as values of
before and after defines are the same.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/usb/ehcivar.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/usb/ehcivar.h
diff -u src/sys/dev/usb/ehcivar.h:1.46 src/sys/dev/usb/ehcivar.h:1.47
--- src/sys/dev/usb/ehcivar.h:1.46	Tue Sep 18 02:00:06 2018
+++ src/sys/dev/usb/ehcivar.h	Wed Mar  4 16:17:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehcivar.h,v 1.46 2018/09/18 02:00:06 mrg Exp $ */
+/*	$NetBSD: ehcivar.h,v 1.47 2020/03/04 16:17:23 skrll Exp $ */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -80,13 +80,13 @@ typedef struct ehci_soft_itd {
 	int slot;
 	struct timeval t; /* store free time */
 } ehci_soft_itd_t;
-#define EHCI_ITD_SIZE ((sizeof(struct ehci_soft_itd) + EHCI_QH_ALIGN - 1) / EHCI_ITD_ALIGN * EHCI_ITD_ALIGN)
+#define EHCI_ITD_SIZE ((sizeof(struct ehci_soft_itd) + EHCI_ITD_ALIGN - 1) / EHCI_ITD_ALIGN * EHCI_ITD_ALIGN)
 #define EHCI_ITD_CHUNK (EHCI_PAGE_SIZE / EHCI_ITD_SIZE)
 
 #define ehci_soft_sitd_t ehci_soft_itd_t
 #define ehci_soft_sitd ehci_soft_itd
 #define sc_softsitds sc_softitds
-#define EHCI_SITD_SIZE ((sizeof(struct ehci_soft_sitd) + EHCI_QH_ALIGN - 1) / EHCI_SITD_ALIGN * EHCI_SITD_ALIGN)
+#define EHCI_SITD_SIZE ((sizeof(struct ehci_soft_sitd) + EHCI_SITD_ALIGN - 1) / EHCI_SITD_ALIGN * EHCI_SITD_ALIGN)
 #define EHCI_SITD_CHUNK (EHCI_PAGE_SIZE / EHCI_SITD_SIZE)
 
 struct ehci_xfer {



CVS commit: src/share/misc

2020-03-04 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Mar  4 14:59:00 UTC 2020

Modified Files:
src/share/misc: airport

Log Message:
Remove ETH (defunct) and add ETM.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/share/misc/airport

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

Modified files:

Index: src/share/misc/airport
diff -u src/share/misc/airport:1.68 src/share/misc/airport:1.69
--- src/share/misc/airport:1.68	Wed Mar  4 14:19:14 2020
+++ src/share/misc/airport	Wed Mar  4 14:59:00 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: airport,v 1.68 2020/03/04 14:19:14 fcambus Exp $
+#	$NetBSD: airport,v 1.69 2020/03/04 14:59:00 maya Exp $
 #	@(#)airport	8.1 (Berkeley) 6/8/93
 #
 # Some of this information is from http://www.mapping.com/airportcodes.html.
@@ -2149,7 +2149,7 @@ ESW:Easton State Airport, WA, USA
 ETB:West Bend Municipal Airport, WI, USA
 ETD:Etadunna, South Australia, Australia
 ETE:Genda Wuha, Ethiopia
-ETH:Elat (Hozman), Israel
+ETM:Eilat, Israel
 ETN:Eastland Municipal Airport, TX, USA
 ETS:Enterprise Municipal Airport, AL, USA
 ETZ:Metz/Nancy (Lorraine), France



CVS commit: src/tests/dev/audio

2020-03-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Mar  4 14:20:44 UTC 2020

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
Sync with sys/dev/audio/audio.c rev1.62.
> Restore backward compatibility with netbsd-7 audio.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/audio/audiotest.c

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

Modified files:

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.6 src/tests/dev/audio/audiotest.c:1.7
--- src/tests/dev/audio/audiotest.c:1.6	Sat Feb 22 05:53:19 2020
+++ src/tests/dev/audio/audiotest.c	Wed Mar  4 14:20:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.6 2020/02/22 05:53:19 isaki Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.7 2020/03/04 14:20:44 isaki Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.6 2020/02/22 05:53:19 isaki Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.7 2020/03/04 14:20:44 isaki Exp $");
 
 #include 
 #include 
@@ -106,7 +106,6 @@ bool xp_sys_eq(int, int, int, const char
 bool xp_sys_ok(int, int, const char *);
 bool xp_sys_ng(int, int, int, const char *);
 bool xp_sys_ptr(int, int, void *, const char *);
-bool xp_buffsize(int, bool, int, const char *);
 int debug_open(int, const char *, int);
 int debug_write(int, int, const void *, size_t);
 int debug_read(int, int, void *, size_t);
@@ -920,29 +919,6 @@ bool xp_sys_ptr(int line, int exp, void 
 	return r;
 }
 
-/*
- * Check ai.*.buffer_size.
- * If exp == true, it expects that buffer_size is non-zero.
- * If exp == false, it expects that buffer_size is zero.
- */
-#define XP_BUFFSIZE(exp, act)	\
-	xp_buffsize(__LINE__, exp, act, #act)
-bool xp_buffsize(int line, bool exp, int act, const char *varname)
-{
-	bool r = true;
-
-	testcount++;
-	if (exp) {
-		if (act == 0)
-			r = xp_fail(line, "%s expects non-zero but %d",
-			varname, act);
-	} else {
-		if (act != 0)
-			r = xp_fail(line, "%s expects zero but %d",
-			varname, act);
-	}
-	return r;
-}
 
 /*
  * REQUIRED_* return immediately if condition does not meet.
@@ -1377,9 +1353,7 @@ mixer_get_outputs_master(int mixerfd)
  */
 
 void test_open_mode(int);
-void test_open_audio(int);
-void test_open_sound(int);
-void test_open_audioctl(int);
+void test_open(const char *, int);
 void test_open_simul(int, int);
 void try_open_multiuser(bool);
 void test_open_multiuser(bool);
@@ -1435,248 +1409,89 @@ DEF(open_mode_RDONLY)	{ test_open_mode(O
 DEF(open_mode_WRONLY)	{ test_open_mode(O_WRONLY); }
 DEF(open_mode_RDWR)	{ test_open_mode(O_RDWR);   }
 
-
 /*
- * The initial parameters are always the same whenever you open /dev/audio.
+ * Check the initial parameters and stickiness.
+ * /dev/audio
+ *	The initial parameters are always the same whenever you open.
+ * /dev/sound and /dev/audioctl
+ *	The initial parameters are inherited from the last /dev/sound or
+ *	/dev/audio.
  */
 void
-test_open_audio(int mode)
+test_open(const char *devname, int mode)
 {
 	struct audio_info ai;
 	struct audio_info ai0;
+	char devfile[16];
 	int fd;
 	int r;
 	int can_play;
 	int can_rec;
-	bool pbuff;
-	bool rbuff;
+	int exp_mode;
+	int exp_encoding;
+	int exp_precision;
+	int exp_channels;
+	int exp_sample_rate;
+	int exp_pause;
+	int exp_popen;
+	int exp_ropen;
 
-	TEST("open_audio_%s", openmode_str[mode] + 2);
+	TEST("open_%s_%s", devname, openmode_str[mode] + 2);
 
+	snprintf(devfile, sizeof(devfile), "/dev/%s%d", devname, unit);
 	can_play = mode2play(mode);
 	can_rec  = mode2rec(mode);
-	if (can_play + can_rec == 0) {
-		/* Check whether it cannot be opened */
-		fd = OPEN(devaudio, mode);
-		XP_SYS_NG(ENXIO, fd);
-		return;
+	if (strcmp(devname, "audioctl") != 0) {
+		if (can_play + can_rec == 0) {
+			/* Check whether it cannot be opened */
+			fd = OPEN(devaudio, mode);
+			XP_SYS_NG(ENXIO, fd);
+			return;
+		}
 	}
 
-	/*
-	 * NetBSD7,8 always has both buffers for playback and recording.
-	 * NetBSD9 only has necessary buffers.
-	 */
-	if (netbsd < 9) {
-		pbuff = true;
-		rbuff = true;
+	/* /dev/audio is always initialized */
+	if (strcmp(devname, "audio") == 0) {
+		exp_encoding = AUDIO_ENCODING_ULAW;
+		exp_precision = 8;
+		exp_channels = 1;
+		exp_sample_rate = 8000;
+		exp_pause = 0;
 	} else {
-		pbuff = can_play;
-		rbuff = can_rec;
+		exp_encoding = AUDIO_ENCODING_SLINEAR_LE;
+		exp_precision = 16;
+		exp_channels = 2;
+		exp_sample_rate = 11025;
+		exp_pause = 1;
 	}
 
-	/*
-	 * Open /dev/audio and check parameters
-	 */
-	fd = OPEN(devaudio, mode);
-	REQUIRED_SYS_OK(fd);
-	memset(, 0, sizeof(ai));
-	r = IOCTL(fd, AUDIO_GETBUFINFO, , "");
-	REQUIRED_SYS_EQ(0, r);
-
-	XP_NE(0, ai.blocksize);
-		/* hiwat/lowat */
-	XP_EQ(mode2aumode(mode), ai.mode);
-	/* ai.play */
-	XP_EQ(8000, ai.play.sample_rate);
-	XP_EQ(1, ai.play.channels);
-	XP_EQ(AUDIO_ENCODING_ULAW, ai.play.encoding);
-		/* gain 

CVS commit: src/sys/dev/audio

2020-03-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Mar  4 14:19:41 UTC 2020

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

Log Message:
Restore backward compatibility with netbsd-7 audio.
For sticky parameters (encoding, precision, channels, sample_rate and pause):
 - AUDIO_SETINFO for nonexistent track updates sticky parameters.
 - AUDIO_GETINFO for nonexistent track reads sticky parameters.
For blocksize, hiwat, lowat and {play.record}.buffer_size:
 - AUDIO_SETINFO for nonexistent track does nothing.
 - AUDIO_GETINFO for nonexistent track returns dummy non-zero values.
Nonexistent track is a playback track on O_RDONLY descriptor for example,
or both tracks on /dev/audioctl.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.61 src/sys/dev/audio/audio.c:1.62
--- src/sys/dev/audio/audio.c:1.61	Sun Mar  1 07:42:07 2020
+++ src/sys/dev/audio/audio.c	Wed Mar  4 14:19:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.61 2020/03/01 07:42:07 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.62 2020/03/04 14:19:41 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.61 2020/03/01 07:42:07 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.62 2020/03/04 14:19:41 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -542,8 +542,8 @@ static int audio_query_devinfo(struct au
 static __inline int audio_track_readablebytes(const audio_track_t *);
 static int audio_file_setinfo(struct audio_softc *, audio_file_t *,
 	const struct audio_info *);
-static int audio_track_setinfo_check(audio_format2_t *,
-	const struct audio_prinfo *, const audio_format2_t *);
+static int audio_track_setinfo_check(audio_track_t *,
+	audio_format2_t *, const struct audio_prinfo *);
 static void audio_track_setinfo_water(audio_track_t *,
 	const struct audio_info *);
 static int audio_hw_setinfo(struct audio_softc *, const struct audio_info *,
@@ -6745,20 +6745,30 @@ audio_file_setinfo(struct audio_softc *s
 	memset(_pfmt, 0, sizeof(saved_pfmt));
 	memset(_rfmt, 0, sizeof(saved_rfmt));
 
-	/* Set default value and save current parameters */
+	/*
+	 * Set default value and save current parameters.
+	 * For backward compatibility, use sticky parameters for nonexistent
+	 * track.
+	 */
 	if (ptrack) {
 		pfmt = ptrack->usrbuf.fmt;
 		saved_pfmt = ptrack->usrbuf.fmt;
 		saved_ai.play.pause = ptrack->is_pause;
+	} else {
+		pfmt = sc->sc_sound_pparams;
 	}
 	if (rtrack) {
 		rfmt = rtrack->usrbuf.fmt;
 		saved_rfmt = rtrack->usrbuf.fmt;
 		saved_ai.record.pause = rtrack->is_pause;
+	} else {
+		rfmt = sc->sc_sound_rparams;
 	}
 	saved_ai.mode = file->mode;
 
-	/* Overwrite if specified */
+	/*
+	 * Overwrite if specified.
+	 */
 	mode = file->mode;
 	if (SPECIFIED(ai->mode)) {
 		/*
@@ -6777,39 +6787,35 @@ audio_file_setinfo(struct audio_softc *s
 		}
 	}
 
-	if (ptrack) {
-		pchanges = audio_track_setinfo_check(, pi,
-		>sc_pmixer->hwbuf.fmt);
-		if (pchanges == -1) {
+	pchanges = audio_track_setinfo_check(ptrack, , pi);
+	if (pchanges == -1) {
 #if defined(AUDIO_DEBUG)
-			TRACET(1, ptrack, "check play.params failed: "
-			"%s %ubit %uch %uHz",
-			audio_encoding_name(pi->encoding),
-			pi->precision,
-			pi->channels,
-			pi->sample_rate);
+		TRACEF(1, file, "check play.params failed: "
+		"%s %ubit %uch %uHz",
+		audio_encoding_name(pi->encoding),
+		pi->precision,
+		pi->channels,
+		pi->sample_rate);
 #endif
-			return EINVAL;
-		}
-		if (SPECIFIED(ai->mode))
-			pchanges = 1;
+		return EINVAL;
 	}
-	if (rtrack) {
-		rchanges = audio_track_setinfo_check(, ri,
-		>sc_rmixer->hwbuf.fmt);
-		if (rchanges == -1) {
+
+	rchanges = audio_track_setinfo_check(rtrack, , ri);
+	if (rchanges == -1) {
 #if defined(AUDIO_DEBUG)
-			TRACET(1, rtrack, "check record.params failed: "
-			"%s %ubit %uch %uHz",
-			audio_encoding_name(ri->encoding),
-			ri->precision,
-			ri->channels,
-			ri->sample_rate);
+		TRACEF(1, file, "check record.params failed: "
+		"%s %ubit %uch %uHz",
+		audio_encoding_name(ri->encoding),
+		ri->precision,
+		ri->channels,
+		ri->sample_rate);
 #endif
-			return EINVAL;
-		}
-		if (SPECIFIED(ai->mode))
-			rchanges = 1;
+		return EINVAL;
+	}
+
+	if (SPECIFIED(ai->mode)) {
+		pchanges = 1;
+		rchanges = 1;
 	}
 
 	/*
@@ -6819,16 +6825,27 @@ audio_file_setinfo(struct audio_softc *s
 	if (pchanges || rchanges) {
 		audio_file_clear(sc, file);
 #if defined(AUDIO_DEBUG)
+		char nbuf[16];
 		char fmtbuf[64];
 		if (pchanges) {
+			if (ptrack) {
+snprintf(nbuf, sizeof(nbuf), "%d", ptrack->id);
+			} else {
+snprintf(nbuf, sizeof(nbuf), "-");
+			}
 			audio_format2_tostr(fmtbuf, sizeof(fmtbuf), 

CVS commit: src/share/misc

2020-03-04 Thread Frederic Cambus
Module Name:src
Committed By:   fcambus
Date:   Wed Mar  4 14:19:14 UTC 2020

Modified Files:
src/share/misc: airport

Log Message:
Add LUZ and WMI airports (Poland).


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/share/misc/airport

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

Modified files:

Index: src/share/misc/airport
diff -u src/share/misc/airport:1.67 src/share/misc/airport:1.68
--- src/share/misc/airport:1.67	Fri Sep 15 19:20:11 2017
+++ src/share/misc/airport	Wed Mar  4 14:19:14 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: airport,v 1.67 2017/09/15 19:20:11 mbalmer Exp $
+#	$NetBSD: airport,v 1.68 2020/03/04 14:19:14 fcambus Exp $
 #	@(#)airport	8.1 (Berkeley) 6/8/93
 #
 # Some of this information is from http://www.mapping.com/airportcodes.html.
@@ -4466,6 +4466,7 @@ LUU:Laura, Queensland, Australia
 LUV:Langgur/Tual, Indonesia
 LUW:Luwuk, Indonesia
 LUX:Luxembourg (Findel), Luxembourg
+LUZ:Lublin (Swidnik), Poland
 LVA:Laval, France
 LVB:Santana do Livramento, RS, Brazil
 LVD:Lime Village Airport, AK, USA
@@ -8412,6 +8413,7 @@ WMC:Winnemucca, NV, USA
 WMD:Mandabe, Madagascar
 WME:Warramboor, Western Australia, Australia
 WMH:Mountain Home (Baxter County), AR, USA
+WMI:Warsaw (Nowy Dwor Mazowiecki), Poland
 WMK:Meyers Chuck (Seaplane Base), AK, USA
 WML:Malaimbandy, Madagascar
 WMN:Maroantsetra, Madagascar



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

2020-03-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Mar  4 13:01:52 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: copyout.c

Log Message:
Comment out full function of optimized version of copyoutstr(9),
which has never been enabled so far.

Only for clarity. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/booke/copyout.c

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

Modified files:

Index: src/sys/arch/powerpc/booke/copyout.c
diff -u src/sys/arch/powerpc/booke/copyout.c:1.5 src/sys/arch/powerpc/booke/copyout.c:1.6
--- src/sys/arch/powerpc/booke/copyout.c:1.5	Sun Apr  7 05:25:55 2019
+++ src/sys/arch/powerpc/booke/copyout.c	Wed Mar  4 13:01:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyout.c,v 1.5 2019/04/07 05:25:55 thorpej Exp $	*/
+/*	$NetBSD: copyout.c,v 1.6 2020/03/04 13:01:52 rin Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.5 2019/04/07 05:25:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.6 2020/03/04 13:01:52 rin Exp $");
 
 #define	__UFETCHSTORE_PRIVATE
 
@@ -400,6 +400,7 @@ copyout(const void *vksaddr, void *vudad
 	return 0;
 }
 
+#if 1
 int
 copyoutstr(const void *ksaddr, void *udaddr, size_t len, size_t *lenp)
 {
@@ -423,7 +424,6 @@ copyoutstr(const void *ksaddr, void *uda
 	const uint8_t *ksaddr8 = ksaddr;
 	size_t copylen = 0;
 
-#if 1
 	uint8_t *udaddr8 = (void *)udaddr;
 
 	while (copylen++ < len) {
@@ -432,7 +432,37 @@ copyoutstr(const void *ksaddr, void *uda
 		if (data == 0)
 			break;
 	}
+
+	pcb->pcb_onfault = NULL;
+	if (lenp)
+		*lenp = copylen;
+	return 0;
+}
 #else
+/* XXX This version of copyoutstr(9) has never beeen enabled so far. */
+int
+copyoutstr(const void *ksaddr, void *udaddr, size_t len, size_t *lenp)
+{
+	struct pcb * const pcb = lwp_getpcb(curlwp);
+	struct faultbuf env;
+
+	if (__predict_false(len == 0)) {
+		if (lenp)
+			*lenp = 0;
+		return 0;
+	}
+
+	if (setfault()) {
+		pcb->pcb_onfault = NULL;
+		if (lenp)
+			*lenp = 0;
+		return EFAULT;
+	}
+
+	const register_t ds_msr = mfmsr() | PSL_DS;
+	const uint8_t *ksaddr8 = ksaddr;
+	size_t copylen = 0;
+
 	uint32_t *udaddr32 = (void *)((uintptr_t)udaddr & ~3);
 
 	size_t boff = (uintptr_t)udaddr & 3;
@@ -523,10 +553,10 @@ copyoutstr(const void *ksaddr, void *uda
 		copyout_le32_with_mask(udaddr32, data, mask, ds_msr);
 		copylen += wlen;
 	}
-#endif
 
 	pcb->pcb_onfault = NULL;
 	if (lenp)
 		*lenp = copylen;
 	return 0;
 }
+#endif



CVS commit: src/usr.sbin/sysinst

2020-03-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Mar  4 11:15:06 UTC 2020

Modified Files:
src/usr.sbin/sysinst: main.c

Log Message:
PR 55045: strlcpy(NULL, ..., 0) considered harmfull in some implementations.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/sysinst/main.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/sysinst/main.c
diff -u src/usr.sbin/sysinst/main.c:1.22 src/usr.sbin/sysinst/main.c:1.23
--- src/usr.sbin/sysinst/main.c:1.22	Wed Feb 19 21:51:21 2020
+++ src/usr.sbin/sysinst/main.c	Wed Mar  4 11:15:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.22 2020/02/19 21:51:21 martin Exp $	*/
+/*	$NetBSD: main.c,v 1.23 2020/03/04 11:15:06 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -144,6 +144,8 @@ init(void)
 	memset(pm_new, 0, sizeof *pm_new);
 
 	for (arg = fflagopts; arg->name != NULL; arg++) {
+		if (arg->var == NULL)
+			continue;
 		if (arg->var == cdrom_dev)
 			get_default_cdrom(arg->var, arg->size);
 		else