CVS commit: [pgoyette-compat] src/sys/kern

2018-08-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Aug  2 05:34:09 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: files.kern

Log Message:
Clean up from sync-with-HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.6 -r1.16.2.7 src/sys/kern/files.kern

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/files.kern
diff -u src/sys/kern/files.kern:1.16.2.6 src/sys/kern/files.kern:1.16.2.7
--- src/sys/kern/files.kern:1.16.2.6	Sat Jul 28 04:38:08 2018
+++ src/sys/kern/files.kern	Thu Aug  2 05:34:09 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.kern,v 1.16.2.6 2018/07/28 04:38:08 pgoyette Exp $
+#	$NetBSD: files.kern,v 1.16.2.7 2018/08/02 05:34:09 pgoyette Exp $
 
 #
 # kernel sources
@@ -6,8 +6,6 @@
 define	kern:	machdep, uvm
 defflag	opt_kern.h			KERN
 defflag	opt_script.h			SETUIDSCRIPTS FDSCRIPTS
-file	compat/common/compat_util.c	kern
-file	compat/common/compat_mod.c	compat_netbsd | compat_netbsd32
 file	conf/debugsyms.c		kern
 file	conf/param.c			kern
 file	kern/bufq_disksort.c		bufq_disksort



CVS commit: src/sys/kern

2018-08-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Aug  2 04:28:56 UTC 2018

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

Log Message:
Adjust alignment in m_pulldown().

 IP6_EXTHDR_GET() and M_REGION_GET() do m_pulldown(). When m_pulldown() copies
data into M_TRAILINGSPACE, the alignment might be changed. There are a lot of
IP6_EXTHDR_GET() calls, so I think it's not good to check the alignment after
every IP6_EXTHDR_GET() call. This change fixes this problem in m_pulldown().
In this commit, the next mbuf are 4 byte aligned. For networking, I've never
heard that 64bit alignment is required, so I think it would be OK.

 I don't know this is the best solution, but it's better than nothing.

 OK'd by maxv@.

 After committing this change, the workaround code for PR#50776 can be removed.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/uipc_mbuf2.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/uipc_mbuf2.c
diff -u src/sys/kern/uipc_mbuf2.c:1.32 src/sys/kern/uipc_mbuf2.c:1.33
--- src/sys/kern/uipc_mbuf2.c:1.32	Sun Apr 29 07:13:10 2018
+++ src/sys/kern/uipc_mbuf2.c	Thu Aug  2 04:28:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf2.c,v 1.32 2018/04/29 07:13:10 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf2.c,v 1.33 2018/08/02 04:28:56 msaitoh Exp $	*/
 /*	$KAME: uipc_mbuf2.c,v 1.29 2001/02/14 13:42:10 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf2.c,v 1.32 2018/04/29 07:13:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf2.c,v 1.33 2018/08/02 04:28:56 msaitoh Exp $");
 
 #include 
 #include 
@@ -118,7 +118,12 @@ m_pulldown(struct mbuf *m, int off, int 
 	 * The target data is on . If we got enough data on the mbuf
 	 * "n", we're done.
 	 */
+#ifdef __NO_STRICT_ALIGNMENT
 	if ((off == 0 || offp) && len <= n->m_len - off && !sharedcluster)
+#else
+	if ((off == 0 || offp) && len <= n->m_len - off && !sharedcluster &&
+	ALIGNED_POINTER((mtod(n, char *) + off), uint32_t))
+#endif
 		goto ok;
 
 	/*
@@ -180,6 +185,9 @@ m_pulldown(struct mbuf *m, int off, int 
 		goto ok;
 	}
 	if ((off == 0 || offp) && M_LEADINGSPACE(n->m_next) >= hlen &&
+#ifndef __NO_STRICT_ALIGNMENT
+	ALIGNED_POINTER((n->m_next->m_data - hlen), uint32_t) &&
+#endif
 	!sharedcluster && n->m_next->m_len >= tlen) {
 		n->m_next->m_data -= hlen;
 		n->m_next->m_len += hlen;



CVS commit: src/sbin/umbctl

2018-08-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Aug  2 03:40:51 UTC 2018

Modified Files:
src/sbin/umbctl: umbctl.c

Log Message:
Mark _error() as printflikee


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sbin/umbctl/umbctl.c

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

Modified files:

Index: src/sbin/umbctl/umbctl.c
diff -u src/sbin/umbctl/umbctl.c:1.1 src/sbin/umbctl/umbctl.c:1.2
--- src/sbin/umbctl/umbctl.c:1.1	Tue Jul 31 16:44:29 2018
+++ src/sbin/umbctl/umbctl.c	Thu Aug  2 03:40:51 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: umbctl.c,v 1.1 2018/07/31 16:44:29 khorben Exp $ */
+/* $NetBSD: umbctl.c,v 1.2 2018/08/02 03:40:51 roy Exp $ */
 /*
  * Copyright (c) 2018 Pierre Pronchery 
  *
@@ -122,7 +122,7 @@ static int _char_to_utf16(const char * i
 
 
 /* error */
-static int _error(int ret, char const * format, ...)
+__printflike(2, 3) static int _error(int ret, char const * format, ...)
 {
 	va_list ap;
 



CVS commit: src/share/man/man4

2018-08-01 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Aug  2 00:41:17 UTC 2018

Modified Files:
src/share/man/man4: netintro.4

Log Message:
Drop ISO/Xerox references which are now long gone.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/share/man/man4/netintro.4

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

Modified files:

Index: src/share/man/man4/netintro.4
diff -u src/share/man/man4/netintro.4:1.28 src/share/man/man4/netintro.4:1.29
--- src/share/man/man4/netintro.4:1.28	Sun Jul 13 12:47:13 2014
+++ src/share/man/man4/netintro.4	Thu Aug  2 00:41:17 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: netintro.4,v 1.28 2014/07/13 12:47:13 mbalmer Exp $
+.\"	$NetBSD: netintro.4,v 1.29 2018/08/02 00:41:17 sevan Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)netintro.4	8.2 (Berkeley) 11/30/93
 .\"
-.Dd July 13, 2014
+.Dd August 2, 2018
 .Dt NETINTRO 4
 .Os
 .Sh NAME
@@ -104,17 +104,12 @@ and/or in the system error log,
 .Xr syslogd 8 ) ,
 due to errors in device operation.
 .Sh PROTOCOLS
-The system currently supports the Internet protocols and some of the
-.Tn ISO OSI
-protocols.
+The system currently supports the Internet protocols.
 Raw socket interfaces are provided to the
 .Tn IP
-protocol layer of the Internet, and to the
-.Tn IDP
-protocol of Xerox
-.Tn NS .
+protocol layer of the Internet.
 Consult the appropriate manual pages in this section for more
-information regarding the support for each protocol family.
+information regarding the support a protocol.
 .Sh ADDRESSING
 Associated with each protocol family is an address format.
 All network address adhere to a general structure, called a sockaddr,



CVS commit: src/sys

2018-08-01 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Wed Aug  1 23:35:32 UTC 2018

Modified Files:
src/sys/kern: sys_socket.c uipc_syscalls.c
src/sys/sys: socketvar.h sockio.h

Log Message:
Add ioctl(2) handler for kernel part of sctp_peeloff().


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/sys_socket.c
cvs rdiff -u -r1.195 -r1.196 src/sys/kern/uipc_syscalls.c
cvs rdiff -u -r1.157 -r1.158 src/sys/sys/socketvar.h
cvs rdiff -u -r1.34 -r1.35 src/sys/sys/sockio.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/sys_socket.c
diff -u src/sys/kern/sys_socket.c:1.76 src/sys/kern/sys_socket.c:1.77
--- src/sys/kern/sys_socket.c:1.76	Thu Nov 30 20:25:55 2017
+++ src/sys/kern/sys_socket.c	Wed Aug  1 23:35:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_socket.c,v 1.76 2017/11/30 20:25:55 christos Exp $	*/
+/*	$NetBSD: sys_socket.c,v 1.77 2018/08/01 23:35:32 rjs Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.76 2017/11/30 20:25:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.77 2018/08/01 23:35:32 rjs Exp $");
 
 #include 
 #include 
@@ -192,6 +192,12 @@ soo_ioctl(file_t *fp, u_long cmd, void *
 		*(int *)data = (so->so_state_RCVATMARK) != 0;
 		break;
 
+	case SIOCPEELOFF:
+		solock(so);
+		error = do_sys_peeloff(so, data);
+		sounlock(so);
+		break;
+
 	default:
 		/*
 		 * Interface/routing/protocol specific ioctls:

Index: src/sys/kern/uipc_syscalls.c
diff -u src/sys/kern/uipc_syscalls.c:1.195 src/sys/kern/uipc_syscalls.c:1.196
--- src/sys/kern/uipc_syscalls.c:1.195	Tue Jul 31 13:00:13 2018
+++ src/sys/kern/uipc_syscalls.c	Wed Aug  1 23:35:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.195 2018/07/31 13:00:13 rjs Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.196 2018/08/01 23:35:32 rjs Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,10 +61,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.195 2018/07/31 13:00:13 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.196 2018/08/01 23:35:32 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pipe.h"
+#include "opt_sctp.h"
 #endif
 
 #define MBUFTYPES
@@ -85,6 +86,11 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscall
 #include 
 #include 
 
+#ifdef SCTP
+#include 
+#include 
+#endif
+
 #include 
 #include 
 
@@ -1606,3 +1612,69 @@ sockargs(struct mbuf **mp, const void *b
 		return EINVAL;
 	}
 }
+
+int
+do_sys_peeloff(struct socket *head, void *data)
+{
+#ifdef SCTP
+	/*file_t *lfp = NULL;*/
+	file_t *nfp = NULL;
+	int error;
+	struct socket *so;
+	int fd;
+	uint32_t name;
+	/*short fflag;*/		/* type must match fp->f_flag */
+
+	name = *(uint32_t *) data;
+	error = sctp_can_peel_off(head, name);
+	if (error) {
+		printf("peeloff failed\n");
+		return error;
+	}
+	/*
+	 * At this point we know we do have a assoc to pull
+	 * we proceed to get the fd setup. This may block
+	 * but that is ok.
+	 */
+	error = fd_allocfile(, );
+	if (error) {
+		/*
+		 * Probably ran out of file descriptors. Put the
+		 * unaccepted connection back onto the queue and
+		 * do another wakeup so some other process might
+		 * have a chance at it.
+		 */
+		return error;
+	}
+	*(int *) data = fd;
+
+	so = sctp_get_peeloff(head, name, );
+	if (so == NULL) {
+		/*
+		 * Either someone else peeled it off OR
+		 * we can't get a socket.
+		 * close the new descriptor, assuming someone hasn't ripped it
+		 * out from under us.
+		 */
+		mutex_enter(>f_lock);
+		nfp->f_count++;
+		mutex_exit(>f_lock);
+		fd_abort(curlwp->l_proc, nfp, fd);
+		return error;
+	}
+	so->so_state &= ~SS_NOFDREF;
+	so->so_state &= ~SS_ISCONNECTING;
+	so->so_head = NULL;
+	so->so_cred = kauth_cred_dup(head->so_cred);
+	nfp->f_socket = so;
+	nfp->f_flag = FREAD|FWRITE;
+	nfp->f_ops = 
+	nfp->f_type = DTYPE_SOCKET;
+
+	fd_affix(curlwp->l_proc, nfp, fd);
+
+	return error;
+#else
+	return EOPNOTSUPP;
+#endif
+}

Index: src/sys/sys/socketvar.h
diff -u src/sys/sys/socketvar.h:1.157 src/sys/sys/socketvar.h:1.158
--- src/sys/sys/socketvar.h:1.157	Fri Jul 20 08:26:25 2018
+++ src/sys/sys/socketvar.h	Wed Aug  1 23:35:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: socketvar.h,v 1.157 2018/07/20 08:26:25 msaitoh Exp $	*/
+/*	$NetBSD: socketvar.h,v 1.158 2018/08/01 23:35:32 rjs Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -378,6 +378,7 @@ int	do_sys_connect(struct lwp *, int, st
 int	do_sys_accept(struct lwp *, int, struct sockaddr *, register_t *,
 	const sigset_t *, int, int);
 
+int	do_sys_peeloff(struct socket *, void *);
 /*
  * Inline functions for sockets and socket buffering.
  */

Index: src/sys/sys/sockio.h
diff -u src/sys/sys/sockio.h:1.34 src/sys/sys/sockio.h:1.35
--- src/sys/sys/sockio.h:1.34	Tue Jul 31 16:44:30 2018
+++ src/sys/sys/sockio.h	Wed Aug  1 23:35:32 2018
@@ 

CVS commit: src/sys/sys

2018-08-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Aug  1 20:09:34 UTC 2018

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

Log Message:
Add a comment to explain the purpose of POWER_IOC_GET_TYPE_WITH_LOSSAGE
and also define it only for the kernel, userland should never see that.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/sys/power.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/power.h
diff -u src/sys/sys/power.h:1.20 src/sys/sys/power.h:1.21
--- src/sys/sys/power.h:1.20	Tue Jan  6 15:39:54 2015
+++ src/sys/sys/power.h	Wed Aug  1 20:09:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: power.h,v 1.20 2015/01/06 15:39:54 bouyer Exp $	*/
+/*	$NetBSD: power.h,v 1.21 2018/08/01 20:09:34 kre Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -282,6 +282,13 @@ struct power_type {
 	char	power_type[32];
 };
 #define	POWER_IOC_GET_TYPE	_IOR('P', 0, struct power_type)
+
+#ifdef _KERNEL
+/*
+ * so the kernel can provide binary compat for applications
+ * built when POWER_IOC_GET_TYPE was incorrectly defined as:
+ */
 #define	POWER_IOC_GET_TYPE_WITH_LOSSAGE _IOR('P', 0, sizeof(struct power_type))
+#endif
 
 #endif /* _SYS_POWER_H_ */



CVS commit: src/lib/libc/arch/aarch64/gdtoa

2018-08-01 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Aug  1 19:59:49 UTC 2018

Modified Files:
src/lib/libc/arch/aarch64/gdtoa: gd_qnan.h

Log Message:
fix long double NaN definition.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/gdtoa/gd_qnan.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/arch/aarch64/gdtoa/gd_qnan.h
diff -u src/lib/libc/arch/aarch64/gdtoa/gd_qnan.h:1.1 src/lib/libc/arch/aarch64/gdtoa/gd_qnan.h:1.2
--- src/lib/libc/arch/aarch64/gdtoa/gd_qnan.h:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gdtoa/gd_qnan.h	Wed Aug  1 19:59:49 2018
@@ -1,10 +1,10 @@
-/* $NetBSD: gd_qnan.h,v 1.1 2014/08/10 05:47:36 matt Exp $ */
+/* $NetBSD: gd_qnan.h,v 1.2 2018/08/01 19:59:49 ryo Exp $ */
 
 #define f_QNAN 0x7fc0
 #ifdef __AARCH64EB__
 #define d_QNAN0 0x7ff8
 #define d_QNAN1 0x0
-#define ld_QNAN0 0x7ff8
+#define ld_QNAN0 0x7fff8000
 #define ld_QNAN1 0x0
 #define ld_QNAN2 0x0
 #define ld_QNAN3 0x0
@@ -14,5 +14,5 @@
 #define ld_QNAN0 0x0
 #define ld_QNAN1 0x0
 #define ld_QNAN2 0x0
-#define ld_QNAN3 0x7ff8
+#define ld_QNAN3 0x7fff8000
 #endif



CVS commit: src/sys/arch

2018-08-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Aug  1 18:36:14 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL

Log Message:
Build the umb(4) driver in the ALL kernels (amd64, i386)

As suggested by Robert Swindells; thank you!


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.444 -r1.445 src/sys/arch/i386/conf/ALL

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/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.95 src/sys/arch/amd64/conf/ALL:1.96
--- src/sys/arch/amd64/conf/ALL:1.95	Thu Jul 26 15:46:09 2018
+++ src/sys/arch/amd64/conf/ALL	Wed Aug  1 18:36:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.95 2018/07/26 15:46:09 maxv Exp $
+# $NetBSD: ALL,v 1.96 2018/08/01 18:36:13 khorben Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.95 $"
+#ident		"ALL-$Revision: 1.96 $"
 
 maxusers	64		# estimated number of users
 
@@ -1222,6 +1222,7 @@ cue*	at uhub? port ?		# CATC USB-EL1201A
 kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
 #mos*	at uhub? port ?		# Moschip MCS7730/MCS7830/MCS7832 based adapters
 udav*	at uhub? port ?		# Davicom DM9601 based adapters
+umb*	at uhub? port ?		# Mobile Broadband Interface Model (EXPERIMENTAL)
 url*	at uhub? port ?		# Realtek RTL8150L based adapters
 urndis* at uhub? port ? 	# Microsoft RNDIS specification
 

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.444 src/sys/arch/i386/conf/ALL:1.445
--- src/sys/arch/i386/conf/ALL:1.444	Thu Jul 26 15:46:09 2018
+++ src/sys/arch/i386/conf/ALL	Wed Aug  1 18:36:14 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.444 2018/07/26 15:46:09 maxv Exp $
+# $NetBSD: ALL,v 1.445 2018/08/01 18:36:14 khorben Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.444 $"
+#ident		"ALL-$Revision: 1.445 $"
 
 maxusers	64		# estimated number of users
 
@@ -1334,6 +1334,7 @@ cdce*	at uhub? port ?		# CDC, Ethernet N
 cue*	at uhub? port ?		# CATC USB-EL1201A based adapters
 kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
 udav*	at uhub? port ?		# Davicom DM9601 based adapters
+umb*	at uhub? port ?		# Mobile Broadband Interface Model (EXPERIMENTAL)
 url*	at uhub? port ?		# Realtek RTL8150L based adapters
 urndis* at uhub? port ?		# Microsoft RNDIS specification
 



CVS commit: src/sys/dev/usb

2018-08-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Aug  1 18:27:58 UTC 2018

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

Log Message:
Fix building umb(4) on NetBSD-current

Patch by Robert Swindells; thank you!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/usb/if_umb.c

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.3 src/sys/dev/usb/if_umb.c:1.4
--- src/sys/dev/usb/if_umb.c:1.3	Wed Aug  1 12:36:56 2018
+++ src/sys/dev/usb/if_umb.c	Wed Aug  1 18:27:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.3 2018/08/01 12:36:56 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.4 2018/08/01 18:27:58 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.3 2018/08/01 12:36:56 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.4 2018/08/01 18:27:58 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -923,7 +923,7 @@ umb_start(struct ifnet *ifp)
 	}
 	IFQ_DEQUEUE(>if_snd, m_head);
 
-	bpf_mtap(ifp, m_head);
+	bpf_mtap(ifp, m_head, BPF_D_OUT);
 
 	ifp->if_flags |= IFF_OACTIVE;
 	ifp->if_timer = (2 * umb_xfer_tout) / 1000;



CVS commit: src/share/man/man4

2018-08-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Aug  1 17:28:42 UTC 2018

Modified Files:
src/share/man/man4: umb.4

Log Message:
Move RCS Id to top. Fix date.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/umb.4

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

Modified files:

Index: src/share/man/man4/umb.4
diff -u src/share/man/man4/umb.4:1.1 src/share/man/man4/umb.4:1.2
--- src/share/man/man4/umb.4:1.1	Tue Jul 31 16:44:29 2018
+++ src/share/man/man4/umb.4	Wed Aug  1 17:28:42 2018
@@ -1,3 +1,4 @@
+.\" $NetBSD: umb.4,v 1.2 2018/08/01 17:28:42 wiz Exp $
 .\"
 .\" Copyright (c) 2016 genua mbH
 .\"
@@ -13,9 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.\" $NetBSD: umb.4,v 1.1 2018/07/31 16:44:29 khorben Exp $
-.\"
-.Dd $Mdocdate: November 23 2017 $
+.Dd August 1, 2018
 .Dt UMB 4
 .Os
 .Sh NAME



CVS commit: src/sbin/umbctl

2018-08-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Aug  1 17:26:30 UTC 2018

Modified Files:
src/sbin/umbctl: umbctl.8

Log Message:
Various improvements to the man page.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sbin/umbctl/umbctl.8

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

Modified files:

Index: src/sbin/umbctl/umbctl.8
diff -u src/sbin/umbctl/umbctl.8:1.1 src/sbin/umbctl/umbctl.8:1.2
--- src/sbin/umbctl/umbctl.8:1.1	Tue Jul 31 16:44:29 2018
+++ src/sbin/umbctl/umbctl.8	Wed Aug  1 17:26:30 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: umbctl.8,v 1.1 2018/07/31 16:44:29 khorben Exp $
+.\"	$NetBSD: umbctl.8,v 1.2 2018/08/01 17:26:30 wiz Exp $
 .\"
 .\" Copyright (c) 2018 by Pierre Pronchery 
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" From: pppoectl.8,v 1.30 2016/09/12 05:35:20 sevan Exp $
 .\"
-.\" $Id: umbctl.8,v 1.1 2018/07/31 16:44:29 khorben Exp $
+.\" $Id: umbctl.8,v 1.2 2018/08/01 17:26:30 wiz Exp $
 .\"
 .\" last edit-date: [Thu Aug 31 10:47:33 2000]
 .\"
@@ -35,7 +35,7 @@
 .Os
 .Sh NAME
 .Nm umbctl
-.Nd "display or set parameters for a MBIM interface (4G/LTE)"
+.Nd display or set parameters for a MBIM interface (4G/LTE)
 .Sh SYNOPSIS
 .Nm umbctl
 .Op Fl v
@@ -49,13 +49,12 @@
 .Ar ifname
 .Op Ar parameter Ns Op \&= Ns Ar value
 .Op Ar ...
-.Pp
 .Sh DESCRIPTION
-.Bl -tag -width indent
-.It Fl v
-enables verbose mode.
-.It Fl f
-parse
+.Nm
+supports the following options:
+.Bl -tag -width XfXconfigXfileXXX -offset indent
+.It Fl f Ar config-file
+Parse
 .Ar config-file
 for
 .Ar parameter Ns Op \&= Ns Ar value
@@ -63,6 +62,8 @@ pairs, one per line, as if they had been
 This allows the password or PIN codes to be not passed as command line
 arguments.
 Comments starting with # to the end of the current line are ignored.
+.It Fl v
+Enables verbose mode.
 .El
 .Pp
 The
@@ -104,7 +105,7 @@ is also enabled, which will cause a fina
 described above once all other actions have been taken.
 .Pp
 The parameters currently supported include:
-.Bl -tag -width x
+.Bl -tag -width x -offset indent
 .It Ar apn Ns \&= Ns Em access-point
 Set the APN to
 .Em access-point .
@@ -136,13 +137,11 @@ umb0: state up, mode automatic, registra
 .Ed
 .Pp
 Display the settings for umb0.
-.Ed
 .Bd -literal
 # umbctl umb0 apn operator.internet username mobile password mobile
 .Ed
 .Pp
 Configure the connection parameters for umb0 from the command line.
-.Ed
 .Bd -literal
 # umbctl -f /dev/stdin umb0 << EOF
 pin=1234
@@ -150,16 +149,16 @@ EOF
 .Ed
 .Pp
 Configure the connection parameters for umb0 from a file.
-.Ed
 .Sh SEE ALSO
 .Xr netstat 1 ,
+.Xr umb 4 ,
 .Xr ifconfig 8 ,
-.Xr ifwatchd 8 ,
-.Xr umb 4
+.Xr ifwatchd 8
 .Sh HISTORY
 The
 .Nm
 utility first appeared in
 .Nx 9.0 .
 .Sh AUTHORS
-The program was written by Pierre Pronchery.
+The program was written by
+.An Pierre Pronchery .



CVS commit: src/common/lib/libc/arch/aarch64/string

2018-08-01 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Aug  1 17:09:26 UTC 2018

Modified Files:
src/common/lib/libc/arch/aarch64/string: strlen.S

Log Message:
strnlen(s, (size_t)-1) returned -1. it must return the length of s.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/aarch64/string/strlen.S

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/arch/aarch64/string/strlen.S
diff -u src/common/lib/libc/arch/aarch64/string/strlen.S:1.2 src/common/lib/libc/arch/aarch64/string/strlen.S:1.3
--- src/common/lib/libc/arch/aarch64/string/strlen.S:1.2	Tue Aug 22 06:45:07 2017
+++ src/common/lib/libc/arch/aarch64/string/strlen.S	Wed Aug  1 17:09:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: strlen.S,v 1.2 2017/08/22 06:45:07 ryo Exp $ */
+/* $NetBSD: strlen.S,v 1.3 2018/08/01 17:09:26 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-RCSID("$NetBSD: strlen.S,v 1.2 2017/08/22 06:45:07 ryo Exp $")
+RCSID("$NetBSD: strlen.S,v 1.3 2018/08/01 17:09:26 ryo Exp $")
 
 #ifdef STRNLEN
 #define FUNCNAME	strnlen
@@ -49,7 +49,10 @@ ENTRY(FUNCNAME)
 	add	x9, x0, #8		/* start + dword */
 	bic	x9, x9, #7		/* and aligned */
 #ifdef STRNLEN
-	add	x10, x0, x1		/* don't go past here */
+	adds	x10, x0, x1		/* x10 = s + maxlen */
+	b.cc	1f			/* if go past, */
+	mvn	x10, xzr		/* set limit 0x */
+1:
 #endif
 	mov	x11, #MASK8_0x01	/* test mask */
 
@@ -76,7 +79,7 @@ ENTRY(FUNCNAME)
 .Lstrlen_dword_loop:
 #ifdef STRNLEN
 	cmp	x4, x10
-	b.ge	.Lstrlen_done
+	b.hs	.Lstrlen_done
 #endif
 	ldr	x7, [x4], #8		/* load dword */
 .Lstrlen_dword_loop_noload:
@@ -103,7 +106,7 @@ ENTRY(FUNCNAME)
 	sub	x0, x0, x9		/* subtract start from the length */
 #ifdef STRNLEN
 	cmp	x0, x1			/* did we go too far? */
-	csel	x0, x0, x1, lt		/* yes, return max length */
+	csel	x0, x0, x1, lo		/* yes, return max length */
 #endif
 	ret
 #ifdef STRNLEN



CVS commit: src/sys/arch

2018-08-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  1 16:59:10 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: GENERIC XEN3_DOM0 XEN3_DOMU
src/sys/arch/i386/conf: GENERIC GENERIC_PS2TINY GENERIC_TINY
INSTALL_FLOPPY INSTALL_TINY NET4501 XEN3PAE_DOM0 XEN3PAE_DOMU

Log Message:
Unreference IPF/PF from the x86 config files (amd64, i386, xen), and enable
NPF instead when wanted.


To generate a diff of this commit:
cvs rdiff -u -r1.497 -r1.498 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.1184 -r1.1185 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/conf/GENERIC_PS2TINY
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/i386/conf/GENERIC_TINY
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/conf/INSTALL_FLOPPY
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/i386/conf/INSTALL_TINY
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/i386/conf/NET4501
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/conf/XEN3PAE_DOMU

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/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.497 src/sys/arch/amd64/conf/GENERIC:1.498
--- src/sys/arch/amd64/conf/GENERIC:1.497	Tue Jul 31 16:44:29 2018
+++ src/sys/arch/amd64/conf/GENERIC	Wed Aug  1 16:59:09 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.497 2018/07/31 16:44:29 khorben Exp $
+# $NetBSD: GENERIC,v 1.498 2018/08/01 16:59:09 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.497 $"
+#ident		"GENERIC-$Revision: 1.498 $"
 
 maxusers	64		# estimated number of users
 
@@ -201,10 +201,6 @@ options 	NETATALK	# AppleTalk networking
 options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
 options 	PPP_DEFLATE	# Deflate compression support for PPP
 options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
-options 	IPFILTER_LOG	# ipmon(8) log support
-options 	IPFILTER_LOOKUP	# ippool(8) support
-options 	IPFILTER_COMPAT # Compat for IP-Filter
-#options 	IPFILTER_DEFAULT_BLOCK	# block all packets by default
 #options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
 #options 	TCP_SIGNATURE	# Enable RFC-2385 TCP md5 signatures
 
@@ -1286,7 +1282,6 @@ options 	VND_COMPRESSION		# compressed v
 # network pseudo-devices
 pseudo-device	bpfilter		# Berkeley packet filter
 #pseudo-device	carp			# Common Address Redundancy Protocol
-pseudo-device	ipfilter		# IP filter (firewall) and NAT
 pseudo-device	loop			# network loopback
 #pseudo-device	mpls			# MPLS pseudo-interface
 pseudo-device	ppp			# Point-to-Point Protocol
@@ -1307,10 +1302,7 @@ pseudo-device	bridge			# simple inter-ne
 pseudo-device	agr			# IEEE 802.3ad link aggregation
 pseudo-device	l2tp			# L2TPv3 interface
 #pseudo-device	etherip			# Tunnel Ethernet over IP
-#pseudo-device	pf			# PF packet filter
-#pseudo-device	pflog			# PF log if
-#pseudo-device	pfsync			# PF sync if
-#pseudo-device	npf			# NPF packet filter
+pseudo-device	npf			# NPF packet filter
 
 #pseudo-device	canloop			# CAN loopback interface
 

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.153 src/sys/arch/amd64/conf/XEN3_DOM0:1.154
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.153	Sat Jun 23 14:14:42 2018
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Wed Aug  1 16:59:09 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.153 2018/06/23 14:14:42 jakllsch Exp $
+# $NetBSD: XEN3_DOM0,v 1.154 2018/08/01 16:59:09 maxv Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -10,7 +10,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.153 $"
+#ident		"XEN3_DOM0-$Revision: 1.154 $"
 
 maxusers	32		# estimated number of users
 
@@ -131,9 +131,6 @@ options 	NETATALK	# AppleTalk networking
 options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
 options 	PPP_DEFLATE	# Deflate compression support for PPP
 options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
-options 	IPFILTER_LOG	# ipmon(8) log support
-options 	IPFILTER_LOOKUP	# ippool(8) support
-#options 	IPFILTER_DEFAULT_BLOCK	# block all packets by default
 #options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
 
 #options 	ALTQ		# Manipulate network interfaces' output queues
@@ -861,7 +858,6 @@ pseudo-device	dm			# device-mapper drive
 
 # network pseudo-devices
 pseudo-device	bpfilter		# Berkeley packet filter
-pseudo-device	ipfilter		# IP filter (firewall) and NAT
 pseudo-device	loop			# network loopback
 pseudo-device	ppp			# Point-to-Point Protocol
 pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)
@@ -875,10 +871,7 @@ 

CVS commit: src/share/man/man4

2018-08-01 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Aug  1 16:50:24 UTC 2018

Modified Files:
src/share/man/man4: options.4

Log Message:
Can't see a thing (which see)
Remove CLNP reference which is long gone.


To generate a diff of this commit:
cvs rdiff -u -r1.490 -r1.491 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.490 src/share/man/man4/options.4:1.491
--- src/share/man/man4/options.4:1.490	Fri Jul 13 09:37:32 2018
+++ src/share/man/man4/options.4	Wed Aug  1 16:50:24 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.490 2018/07/13 09:37:32 maxv Exp $
+.\"	$NetBSD: options.4,v 1.491 2018/08/01 16:50:24 sevan Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -30,7 +30,7 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd July 13, 2018
+.Dd August 1, 2018
 .Dt OPTIONS 4
 .Os
 .Sh NAME
@@ -1660,10 +1660,8 @@ Default is 4.
 .It Cd options GATEWAY
 Enables
 .Em IPFORWARDING
-(which see)
 and (on most ports) increases the size of
-.Em NMBCLUSTERS
-(which see).
+.Em NMBCLUSTERS .
 In general,
 .Em GATEWAY
 is used to indicate that a system should act as a router, and
@@ -1671,7 +1669,7 @@ is used to indicate that a system should
 is not invoked directly.
 (Note that
 .Em GATEWAY
-has no impact on protocols other than IP, such as CLNP).
+has no impact on protocols other than IP).
 .Em GATEWAY
 option also compiles IPv4 and IPv6 fast forwarding code into the kernel.
 .It Cd options IPFORWARDING=value



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

2018-08-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug  1 16:44:14 UTC 2018

Modified Files:
src/sys/external/bsd/dwc2/dist: dwc2_hcd.c

Log Message:
Fix the alignment argument to usb_allocmem in dwc2_hc_setup_align_buf


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/dwc2/dist/dwc2_hcd.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/dwc2/dist/dwc2_hcd.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.19 src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.20
--- src/sys/external/bsd/dwc2/dist/dwc2_hcd.c:1.19	Wed Feb 24 22:17:54 2016
+++ src/sys/external/bsd/dwc2/dist/dwc2_hcd.c	Wed Aug  1 16:44:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_hcd.c,v 1.19 2016/02/24 22:17:54 skrll Exp $	*/
+/*	$NetBSD: dwc2_hcd.c,v 1.20 2018/08/01 16:44:14 skrll Exp $	*/
 
 /*
  * hcd.c - DesignWare HS OTG Controller host-mode routines
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.19 2016/02/24 22:17:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.20 2018/08/01 16:44:14 skrll Exp $");
 
 #include 
 #include 
@@ -727,7 +727,7 @@ static int dwc2_hc_setup_align_buf(struc
 
 		qh->dw_align_buf = NULL;
 		qh->dw_align_buf_dma = 0;
-		err = usb_allocmem(>hsotg_sc->sc_bus, buf_size, buf_size,
+		err = usb_allocmem(>hsotg_sc->sc_bus, buf_size, 0,
    >dw_align_buf_usbdma);
 		if (!err) {
 			usb_dma_t *ud = >dw_align_buf_usbdma;



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

2018-08-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug  1 13:48:01 UTC 2018

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

Log Message:
s/_ARM32_BOOT_MACHDEP_H_/_ARM32_MACHDEP_H_/ in multiple inclusion
protection.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/include/arm32/machdep.h

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

Modified files:

Index: src/sys/arch/arm/include/arm32/machdep.h
diff -u src/sys/arch/arm/include/arm32/machdep.h:1.22 src/sys/arch/arm/include/arm32/machdep.h:1.23
--- src/sys/arch/arm/include/arm32/machdep.h:1.22	Sun Jul 15 05:16:41 2018
+++ src/sys/arch/arm/include/arm32/machdep.h	Wed Aug  1 13:48:00 2018
@@ -1,7 +1,7 @@
-/* $NetBSD: machdep.h,v 1.22 2018/07/15 05:16:41 maxv Exp $ */
+/* $NetBSD: machdep.h,v 1.23 2018/08/01 13:48:00 skrll Exp $ */
 
-#ifndef _ARM32_BOOT_MACHDEP_H_
-#define _ARM32_BOOT_MACHDEP_H_
+#ifndef _ARM32_MACHDEP_H_
+#define _ARM32_MACHDEP_H_
 
 /* Define various stack sizes in pages */
 #ifndef IRQ_STACK_SIZE



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386

2018-08-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug  1 13:46:58 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386: modes.inc

Log Message:
remove -DGHASH_ASM_X86; it is already defined.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc

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/openssl/lib/libcrypto/arch/i386/modes.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc:1.2	Wed Aug  1 07:39:53 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc	Wed Aug  1 09:46:58 2018
@@ -1,5 +1,5 @@
 .PATH.S: ${.PARSEDIR}
 MODES_SRCS += ghash-x86.o
-MODESCPPFLAGS = -DGHASH_ASM -DGHASH_ASM_X86 -DOPENSSL_IA32_SSE2
+MODESCPPFLAGS = -DGHASH_ASM -DOPENSSL_IA32_SSE2
 
 .include "../../modes.inc"



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

2018-08-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug  1 13:42:58 UTC 2018

Modified Files:
src/sys/arch/aarch64/include: armreg.h

Log Message:
Some whitespace improvements.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/include/armreg.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/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.12 src/sys/arch/aarch64/include/armreg.h:1.13
--- src/sys/arch/aarch64/include/armreg.h:1.12	Tue Jul 17 00:35:03 2018
+++ src/sys/arch/aarch64/include/armreg.h	Wed Aug  1 13:42:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.12 2018/07/17 00:35:03 christos Exp $ */
+/* $NetBSD: armreg.h,v 1.13 2018/08/01 13:42:58 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -71,64 +71,64 @@ reg_##regname##_write(uint64_t __val)			
  */
 AARCH64REG_READ_INLINE(ctr_el0)		// Cache Type Register
 
-#define	CTR_EL0_CWG_LINE	__BITS(27,24) // Cacheback Writeback Granule
-#define	CTR_EL0_ERG_LINE	__BITS(23,20) // Exclusives Reservation Granule
-#define	CTR_EL0_DMIN_LINE	__BITS(19,16) // Dcache MIN LINE size (log2 - 2)
+#define	CTR_EL0_CWG_LINE	__BITS(27,24)	// Cacheback Writeback Granule
+#define	CTR_EL0_ERG_LINE	__BITS(23,20)	// Exclusives Reservation Granule
+#define	CTR_EL0_DMIN_LINE	__BITS(19,16)	// Dcache MIN LINE size (log2 - 2)
 #define	CTR_EL0_L1IP_MASK	__BITS(15,14)
-#define	CTR_EL0_L1IP_AIVIVT	1 // ASID-tagged Virtual Index, Virtual Tag
-#define	CTR_EL0_L1IP_VIPT	2 // Virtual Index, Physical Tag
-#define	CTR_EL0_L1IP_PIPT	3 // Physical Index, Physical Tag
-#define	CTR_EL0_IMIN_LINE	__BITS(3,0) // Icache MIN LINE size (log2 - 2)
+#define	 CTR_EL0_L1IP_AIVIVT	1		//  ASID-tagged Virtual Index, Virtual Tag
+#define	 CTR_EL0_L1IP_VIPT	2		//  Virtual Index, Physical Tag
+#define	 CTR_EL0_L1IP_PIPT	3		//  Physical Index, Physical Tag
+#define	CTR_EL0_IMIN_LINE	__BITS(3,0)	// Icache MIN LINE size (log2 - 2)
 
-AARCH64REG_READ_INLINE(dczid_el0)	// Data Cache Zero ID Register
+AARCH64REG_READ_INLINE(dczid_el0)		// Data Cache Zero ID Register
 
-#define	DCZID_DZP __BIT(4)	// Data Zero Prohibited
-#define	DCZID_BS  __BITS(3,0)	// Block Size (log2 - 2)
+#define	DCZID_DZP		__BIT(4)	// Data Zero Prohibited
+#define	DCZID_BS		__BITS(3,0)	// Block Size (log2 - 2)
 
-AARCH64REG_READ_INLINE(fpcr)		// Floating Point Control Register
+AARCH64REG_READ_INLINE(fpcr)			// Floating Point Control Register
 AARCH64REG_WRITE_INLINE(fpcr)
 
-#define	FPCR_AHP__BIT(26)	// Alternative Half Precision
-#define	FPCR_DN __BIT(25)	// Default Nan Control
-#define	FPCR_FZ __BIT(24)	// Flush-To-Zero
-#define	FPCR_RMODE  __BITS(23,22)// Rounding Mode
-#define	 FPCR_RN 0		//  Round Nearest
-#define	 FPCR_RP 1		//  Round towards Plus infinity
-#define	 FPCR_RM 2		//  Round towards Minus infinity
-#define	 FPCR_RZ 3		//  Round towards Zero
-#define	FPCR_STRIDE __BITS(21,20)
-#define	FPCR_LEN__BITS(18,16)
-#define	FPCR_IDE__BIT(15)	// Input Denormal Exception enable
-#define	FPCR_IXE__BIT(12)	// IneXact Exception enable
-#define	FPCR_UFE__BIT(11)	// UnderFlow Exception enable
-#define	FPCR_OFE__BIT(10)	// OverFlow Exception enable
-#define	FPCR_DZE__BIT(9)	// Divide by Zero Exception enable
-#define	FPCR_IOE__BIT(8)	// Invalid Operation Exception enable
-#define	FPCR_ESUM   0x1F00
+#define	FPCR_AHP		__BIT(26)	// Alternative Half Precision
+#define	FPCR_DN			__BIT(25)	// Default Nan Control
+#define	FPCR_FZ			__BIT(24)	// Flush-To-Zero
+#define	FPCR_RMODE		__BITS(23,22)	// Rounding Mode
+#define	 FPCR_RN		0		//  Round Nearest
+#define	 FPCR_RP		1		//  Round towards Plus infinity
+#define	 FPCR_RM		2		//  Round towards Minus infinity
+#define	 FPCR_RZ		3		//  Round towards Zero
+#define	FPCR_STRIDE		__BITS(21,20)
+#define	FPCR_LEN		__BITS(18,16)
+#define	FPCR_IDE		__BIT(15)	// Input Denormal Exception enable
+#define	FPCR_IXE		__BIT(12)	// IneXact Exception enable
+#define	FPCR_UFE		__BIT(11)	// UnderFlow Exception enable
+#define	FPCR_OFE		__BIT(10)	// OverFlow Exception enable
+#define	FPCR_DZE		__BIT(9)	// Divide by Zero Exception enable
+#define	FPCR_IOE		__BIT(8)	// Invalid Operation Exception enable
+#define	FPCR_ESUM		0x1F00
 
 AARCH64REG_READ_INLINE(fpsr)		// Floating Point Status Register
 AARCH64REG_WRITE_INLINE(fpsr)
 
-#define	FPSR_N32  __BIT(31) // AARCH32 Negative
-#define	FPSR_Z32  __BIT(30) // AARCH32 Zero
-#define	FPSR_C32  __BIT(29) // AARCH32 Carry
-#define	FPSR_V32  __BIT(28) // AARCH32 Overflow
-#define	FPSR_QC   __BIT(27) // SIMD Saturation
-#define	FPSR_IDC  __BIT(7) // Input Denormal Cumulative status
-#define	FPSR_IXC  __BIT(4) // IneXact Cumulative status
-#define	FPSR_UFC  __BIT(3) // UnderFlow Cumulative status
-#define	FPSR_OFC  __BIT(2) // OverFlow Cumulative status
-#define	FPSR_DZC  __BIT(1) // Divide by Zero Cumulative status

CVS commit: src/doc

2018-08-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  1 13:41:26 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
Note the removal of non-PAE-32bit-PV.


To generate a diff of this commit:
cvs rdiff -u -r1.2415 -r1.2416 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2415 src/doc/CHANGES:1.2416
--- src/doc/CHANGES:1.2415	Fri Jul 27 12:02:25 2018
+++ src/doc/CHANGES	Wed Aug  1 13:41:26 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2415 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2416 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -181,6 +181,9 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	arm: Add support for ARMv7 performance event monitoring with tprof(4).
 		[jmcneill 20180715]
 	dhcpcd: Import 7.0.7. [roy 20180724]
+	i386: Remove the XEN3_DOM0 and XEN3_DOMU configurations, and drop
+		support for non-PAE-32bit-PV, to leave only PAE-32bit-PV.
+		[maxv 20180726]
 	tea5767radio(4): Add Philips/NXP TEA5767 I2C-controlled stereo FM radio
 		driver. [rkujawa 20180727]
 



CVS commit: src/sys/arch/i386/i386

2018-08-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  1 13:35:01 UTC 2018

Modified Files:
src/sys/arch/i386/i386: locore.S

Log Message:
Xen is PAE, so remove ifdefs.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/i386/i386/locore.S

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

Modified files:

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.160 src/sys/arch/i386/i386/locore.S:1.161
--- src/sys/arch/i386/i386/locore.S:1.160	Thu Jul 26 09:29:08 2018
+++ src/sys/arch/i386/i386/locore.S	Wed Aug  1 13:35:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.160 2018/07/26 09:29:08 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.161 2018/08/01 13:35:01 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.160 2018/07/26 09:29:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.161 2018/08/01 13:35:01 maxv Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -253,9 +253,7 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1
 	.ascii	",VIRT_ENTRY=0xc010" /* KERNTEXTOFF */
 	.ascii	",HYPERCALL_PAGE=0x0101"
 		/* (???+HYPERCALL_PAGE_OFFSET)/PAGE_SIZE) */
-#ifdef PAE
 	.ascii	",PAE=yes[extended-cr3]"
-#endif
 	.ascii	",LOADER=generic"
 #if (NKSYMS || defined(DDB) || defined(MODULAR)) && !defined(makeoptions_COPY_SYMTAB)
 	.ascii	",BSD_SYMTAB=yes"
@@ -906,9 +904,7 @@ begin:
 	addl	$(USPACE+PAGE_SIZE),%esi
 	subl	$KERNBASE,%esi		/* init386 wants a physical address */
 
-#ifdef PAE
 	pushl	$0	/* init386() expects a 64 bits paddr_t with PAE */
-#endif
 	pushl	%esi
 	call	_C_LABEL(init_bootspace)
 	call	_C_LABEL(init386)



CVS commit: src/dist/pf/share/man/man4

2018-08-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  1 13:30:14 UTC 2018

Modified Files:
src/dist/pf/share/man/man4: pf.4

Log Message:
Add a bold note to say our PF is obsolete.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/dist/pf/share/man/man4/pf.4

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

Modified files:

Index: src/dist/pf/share/man/man4/pf.4
diff -u src/dist/pf/share/man/man4/pf.4:1.12 src/dist/pf/share/man/man4/pf.4:1.13
--- src/dist/pf/share/man/man4/pf.4:1.12	Sat Dec 19 14:05:53 2009
+++ src/dist/pf/share/man/man4/pf.4	Wed Aug  1 13:30:13 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pf.4,v 1.12 2009/12/19 14:05:53 ahoka Exp $
+.\"	$NetBSD: pf.4,v 1.13 2018/08/01 13:30:13 maxv Exp $
 .\"	$OpenBSD: pf.4,v 1.59 2007/05/31 19:19:51 jmc Exp $
 .\"
 .\" Copyright (C) 2001, Kjell Wooding.  All rights reserved.
@@ -27,7 +27,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 19, 2009
+.Dd August 1, 2018
 .Dt PF 4
 .Os
 .Sh NAME
@@ -36,6 +36,13 @@
 .Sh SYNOPSIS
 .Cd "pseudo-device pf"
 .Sh DESCRIPTION
+.Bf -symbolic
+The NetBSD version of PF is obsolete, and its use is strongly discouraged.
+Use
+.Xr npf 7
+instead.
+.Pp
+.Ef
 Packet filtering takes place in the kernel.
 A pseudo-device,
 .Pa /dev/pf ,



CVS commit: src/sys/dev/usb

2018-08-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Aug  1 12:36:56 UTC 2018

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

Log Message:
Allow kmem_alloc(9) to sleep when attaching

Without this, umb(4) may needlessly fail to attach, like when under memory
pressure.

Thanks skrll@ for the heads-up!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/if_umb.c

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.2 src/sys/dev/usb/if_umb.c:1.3
--- src/sys/dev/usb/if_umb.c:1.2	Wed Aug  1 12:25:50 2018
+++ src/sys/dev/usb/if_umb.c	Wed Aug  1 12:36:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.2 2018/08/01 12:25:50 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.3 2018/08/01 12:36:56 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.2 2018/08/01 12:25:50 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.3 2018/08/01 12:36:56 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -498,16 +498,9 @@ umb_attach(device_t parent, device_t sel
 		aprint_error_dev(self, "failed to open control pipe\n");
 		goto fail;
 	}
-	sc->sc_resp_buf = kmem_alloc(sc->sc_ctrl_len, KM_NOSLEEP);
-	if (sc->sc_resp_buf == NULL) {
-		aprint_error_dev(self, "allocation of resp buffer failed\n");
-		goto fail;
-	}
-	sc->sc_ctrl_msg = kmem_alloc(sc->sc_ctrl_len, KM_NOSLEEP);
-	if (sc->sc_ctrl_msg == NULL) {
-		aprint_error_dev(self, "allocation of ctrl msg buffer failed\n");
-		goto fail;
-	}
+
+	sc->sc_resp_buf = kmem_alloc(sc->sc_ctrl_len, KM_SLEEP);
+	sc->sc_ctrl_msg = kmem_alloc(sc->sc_ctrl_len, KM_SLEEP);
 
 	sc->sc_info.regstate = MBIM_REGSTATE_UNKNOWN;
 	sc->sc_info.pin_attempts_left = UMB_VALUE_UNKNOWN;



CVS commit: src/sys/dev/usb

2018-08-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Aug  1 12:25:50 UTC 2018

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

Log Message:
Avoid parentheses in return statements (KNF)

NFCI.

Thanks skrll@ for the heads-up!


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/usb/if_umb.c

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.1 src/sys/dev/usb/if_umb.c:1.2
--- src/sys/dev/usb/if_umb.c:1.1	Tue Jul 31 16:44:29 2018
+++ src/sys/dev/usb/if_umb.c	Wed Aug  1 12:25:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.1 2018/07/31 16:44:29 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.2 2018/08/01 12:25:50 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.1 2018/07/31 16:44:29 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.2 2018/08/01 12:25:50 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2736,13 +2736,13 @@ inet_ntop(int af, const void *src, char 
 {
 	switch (af) {
 	case AF_INET:
-		return (inet_ntop4(src, dst, (size_t)size));
+		return inet_ntop4(src, dst, (size_t)size);
 #ifdef INET6
 	case AF_INET6:
-		return (inet_ntop6(src, dst, (size_t)size));
+		return inet_ntop6(src, dst, (size_t)size);
 #endif /* INET6 */
 	default:
-		return (NULL);
+		return NULL;
 	}
 	/* NOTREACHED */
 }
@@ -2767,10 +2767,10 @@ inet_ntop4(const u_char *src, char *dst,
 	l = snprintf(tmp, sizeof(tmp), "%u.%u.%u.%u",
 	src[0], src[1], src[2], src[3]);
 	if (l <= 0 || l >= size) {
-		return (NULL);
+		return NULL;
 	}
 	strlcpy(dst, tmp, size);
-	return (dst);
+	return dst;
 }
 
 #ifdef INET6
@@ -2843,7 +2843,7 @@ inet_ntop6(const u_char *src, char *dst,
 		i < (best.base + best.len)) {
 			if (i == best.base) {
 if (tp + 1 >= ep)
-	return (NULL);
+	return NULL;
 *tp++ = ':';
 			}
 			continue;
@@ -2851,39 +2851,39 @@ inet_ntop6(const u_char *src, char *dst,
 		/* Are we following an initial run of 0x00s or any real hex? */
 		if (i != 0) {
 			if (tp + 1 >= ep)
-return (NULL);
+return NULL;
 			*tp++ = ':';
 		}
 		/* Is this address an encapsulated IPv4? */
 		if (i == 6 && best.base == 0 &&
 		(best.len == 6 || (best.len == 5 && words[5] == 0x))) {
 			if (!inet_ntop4(src+12, tp, (size_t)(ep - tp)))
-return (NULL);
+return NULL;
 			tp += strlen(tp);
 			break;
 		}
 		advance = snprintf(tp, ep - tp, "%x", words[i]);
 		if (advance <= 0 || advance >= ep - tp)
-			return (NULL);
+			return NULL;
 		tp += advance;
 	}
 	/* Was it a trailing run of 0x00's? */
 	if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) {
 		if (tp + 1 >= ep)
-			return (NULL);
+			return NULL;
 		*tp++ = ':';
 	}
 	if (tp + 1 >= ep)
-		return (NULL);
+		return NULL;
 	*tp++ = '\0';
 
 	/*
 	 * Check for overflow, copy, and we're done.
 	 */
 	if ((size_t)(tp - tmp) > size) {
-		return (NULL);
+		return NULL;
 	}
 	strlcpy(dst, tmp, size);
-	return (dst);
+	return dst;
 }
 #endif /* INET6 */



CVS commit: src/sys/arch/usermode

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 12:09:02 UTC 2018

Modified Files:
src/sys/arch/usermode/include: vmparam.h
src/sys/arch/usermode/usermode: pmap.c

Log Message:
Revert to working state


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/usermode/include/vmparam.h
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/usermode/usermode/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/usermode/include/vmparam.h
diff -u src/sys/arch/usermode/include/vmparam.h:1.18 src/sys/arch/usermode/include/vmparam.h:1.19
--- src/sys/arch/usermode/include/vmparam.h:1.18	Wed Aug  1 09:46:16 2018
+++ src/sys/arch/usermode/include/vmparam.h	Wed Aug  1 12:09:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.18 2018/08/01 09:46:16 reinoud Exp $ */
+/* $NetBSD: vmparam.h,v 1.19 2018/08/01 12:09:02 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -43,7 +43,7 @@ extern paddr_t kmem_user_start, kmem_use
 #define VM_MAX_ADDRESS		kmem_user_end
 #define VM_MAXUSER_ADDRESS	kmem_user_end
 #define VM_MIN_KERNEL_ADDRESS	kmem_kvm_start
-#define VM_MAX_KERNEL_ADDRESS 	kmem_k_end
+#define VM_MAX_KERNEL_ADDRESS 	kmem_kvm_end
 
 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
 #define VM_PHYSSEG_MAX		1

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.109 src/sys/arch/usermode/usermode/pmap.c:1.110
--- src/sys/arch/usermode/usermode/pmap.c:1.109	Wed Aug  1 09:44:31 2018
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug  1 12:09:01 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.109 2018/08/01 09:44:31 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.110 2018/08/01 12:09:01 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2018/08/01 09:44:31 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2018/08/01 12:09:01 reinoud Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -285,7 +285,7 @@ pmap_bootstrap(void)
 		(uint64_t) pv_table_size/1024, (uintptr_t) phys_npages);
 
 	/* calculate number of pmap entries needed for a complete map */
-	pm_nentries = (kmem_k_end - VM_MIN_ADDRESS) / PAGE_SIZE;
+	pm_nentries = (kmem_k_start - VM_MIN_ADDRESS) / PAGE_SIZE;
 	pm_entries_size = round_page(pm_nentries * sizeof(struct pv_entry *));
 	thunk_printf_debug("tlb va->pa lookup table is %"PRIu64" KB for "
 		"%d logical pages\n", pm_entries_size/1024, pm_nentries);
@@ -660,7 +660,8 @@ pmap_fault(pmap_t pmap, vaddr_t va, vm_p
 
 	/* not known! then it must be UVM's work */
 	if (pv == NULL) {
-		thunk_printf_debug("%s: no mapping yet\n", __func__);
+		//thunk_printf("%s: no mapping yet for %p\n",
+		//	__func__, (void *) va);
 		*atype = VM_PROT_READ;		/* assume it was a read */
 		return false;
 	}
@@ -1090,7 +1091,7 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
 	thunk_printf_debug("pmap_extract: extracting va %p\n", (void *) va);
 #ifdef DIAGNOSTIC
 	if ((va < VM_MIN_ADDRESS) || (va > VM_MAX_KERNEL_ADDRESS)) {
-		thunk_printf_debug("pmap_extract: invalid va issued\n");
+		thunk_printf_debug("pmap_extract: invalid va isued\n");
 		thunk_printf("%p not in [%p, %p]\n", (void *) va,
 		(void *) VM_MIN_ADDRESS, (void *) VM_MAX_KERNEL_ADDRESS);
 		return false;



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386

2018-08-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug  1 11:39:53 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386: modes.inc

Log Message:
Add missing defines:
https://github.com/openssl/openssl/pull/6828
When ghash-x86.S is generated with -DOPENSSL_IA32_SSE2 we need to compile
gcm128.c with the same flags.
Reported by manu@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc

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/openssl/lib/libcrypto/arch/i386/modes.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc:1.1 src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc:1.2
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc:1.1	Sat May 16 13:32:54 2015
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/modes.inc	Wed Aug  1 07:39:53 2018
@@ -1,4 +1,5 @@
 .PATH.S: ${.PARSEDIR}
 MODES_SRCS += ghash-x86.o
-MODESCPPFLAGS = -DGHASH_ASM
+MODESCPPFLAGS = -DGHASH_ASM -DGHASH_ASM_X86 -DOPENSSL_IA32_SSE2
+
 .include "../../modes.inc"



CVS commit: src/sys/arch/usermode/usermode

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 10:27:28 UTC 2018

Modified Files:
src/sys/arch/usermode/usermode: db_memrw.c

Log Message:
Remove yet another debug printf()


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/usermode/db_memrw.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/usermode/usermode/db_memrw.c
diff -u src/sys/arch/usermode/usermode/db_memrw.c:1.1 src/sys/arch/usermode/usermode/db_memrw.c:1.2
--- src/sys/arch/usermode/usermode/db_memrw.c:1.1	Wed Aug  1 10:22:20 2018
+++ src/sys/arch/usermode/usermode/db_memrw.c	Wed Aug  1 10:27:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_memrw.c,v 1.1 2018/08/01 10:22:20 reinoud Exp $	*/
+/*	$NetBSD: db_memrw.c,v 1.2 2018/08/01 10:27:28 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.1 2018/08/01 10:22:20 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.2 2018/08/01 10:27:28 reinoud Exp $");
 
 #include 
 #include 
@@ -216,7 +216,7 @@ db_write_bytes(vaddr_t addr, size_t size
 //	size_t i;
 
 	dst = (char *)addr;
-thunk_printf("\n%s : %p + %d\n", __func__, dst, (int) size);
+	thunk_printf_debug("\n%s : %p + %d\n", __func__, dst, (int) size);
 #if 0
 	// TODO: check if we in kernel range and if so, do the mmap dance
 	// ourselves?



CVS commit: src/sys/arch/usermode/usermode

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 10:24:41 UTC 2018

Modified Files:
src/sys/arch/usermode/usermode: kgdb_machdep.c

Log Message:
Fix too long line


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

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

Modified files:

Index: src/sys/arch/usermode/usermode/kgdb_machdep.c
diff -u src/sys/arch/usermode/usermode/kgdb_machdep.c:1.2 src/sys/arch/usermode/usermode/kgdb_machdep.c:1.3
--- src/sys/arch/usermode/usermode/kgdb_machdep.c:1.2	Wed Aug  1 10:23:55 2018
+++ src/sys/arch/usermode/usermode/kgdb_machdep.c	Wed Aug  1 10:24:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb_machdep.c,v 1.2 2018/08/01 10:23:55 reinoud Exp $	*/
+/*	$NetBSD: kgdb_machdep.c,v 1.3 2018/08/01 10:24:41 reinoud Exp $	*/
 
 /*
  * Copyright (c) 1996 Matthias Pfaller.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.2 2018/08/01 10:23:55 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.3 2018/08/01 10:24:41 reinoud Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -58,7 +58,8 @@ kgdb_acc(vaddr_t va, size_t len)
 	va  &= ~PGOFSET;
 	last_va &= ~PGOFSET;
 
-	thunk_printf_debug("%s: [%p .. %p]\n", __func__, (void *) va, (void *) last_va);
+	thunk_printf_debug("%s: [%p .. %p]\n", __func__,
+		(void *) va, (void *) last_va);
 	do {
 		if (db_validate_address(va))
 			return (0);



CVS commit: src/sys/arch/usermode/usermode

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 10:23:55 UTC 2018

Modified Files:
src/sys/arch/usermode/usermode: kgdb_machdep.c

Log Message:
Remove debugging printf()


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/usermode/kgdb_machdep.c

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

Modified files:

Index: src/sys/arch/usermode/usermode/kgdb_machdep.c
diff -u src/sys/arch/usermode/usermode/kgdb_machdep.c:1.1 src/sys/arch/usermode/usermode/kgdb_machdep.c:1.2
--- src/sys/arch/usermode/usermode/kgdb_machdep.c:1.1	Wed Aug  1 10:22:20 2018
+++ src/sys/arch/usermode/usermode/kgdb_machdep.c	Wed Aug  1 10:23:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb_machdep.c,v 1.1 2018/08/01 10:22:20 reinoud Exp $	*/
+/*	$NetBSD: kgdb_machdep.c,v 1.2 2018/08/01 10:23:55 reinoud Exp $	*/
 
 /*
  * Copyright (c) 1996 Matthias Pfaller.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.1 2018/08/01 10:22:20 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.2 2018/08/01 10:23:55 reinoud Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -58,7 +58,7 @@ kgdb_acc(vaddr_t va, size_t len)
 	va  &= ~PGOFSET;
 	last_va &= ~PGOFSET;
 
-thunk_printf("%s: [%p .. %p]\n", __func__, (void *) va, (void *) last_va);
+	thunk_printf_debug("%s: [%p .. %p]\n", __func__, (void *) va, (void *) last_va);
 	do {
 		if (db_validate_address(va))
 			return (0);



CVS commit: src/sys/arch/usermode/usermode

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 10:22:20 UTC 2018

Added Files:
src/sys/arch/usermode/usermode: cpufunc.S db_memrw.c kgdb_machdep.c

Log Message:
Add the kgdb meat


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/usermode/cpufunc.S \
src/sys/arch/usermode/usermode/db_memrw.c \
src/sys/arch/usermode/usermode/kgdb_machdep.c

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

Added files:

Index: src/sys/arch/usermode/usermode/cpufunc.S
diff -u /dev/null src/sys/arch/usermode/usermode/cpufunc.S:1.1
--- /dev/null	Wed Aug  1 10:22:20 2018
+++ src/sys/arch/usermode/usermode/cpufunc.S	Wed Aug  1 10:22:20 2018
@@ -0,0 +1,75 @@
+
+#include 
+#include "assym.h"
+
+#if defined(__i386__)
+
+ENTRY(breakpoint)
+	.byte 0xcc	// BKPT_INST
+	ret
+
+#error implement setjmp/longjmp for i386
+
+#elif defined(__amd64__)
+ENTRY(breakpoint)
+	.byte 0xcc	// BKPT_INST, int3
+	ret
+
+/*
+ * int setjmp(label_t *)
+ *
+ * Used primarily by DDB.
+ */
+ENTRY(setjmp)
+	/*
+	 * Only save registers that must be preserved across function
+	 * calls according to the ABI (%rbx, %rsp, %rbp, %r12-%r15)
+	 * and %rip.
+	 */
+	movq	%rdi,%rax
+	movq	%rbx,(%rax)
+	movq	%rsp,8(%rax)
+	movq	%rbp,16(%rax)
+	movq	%r12,24(%rax)
+	movq	%r13,32(%rax)
+	movq	%r14,40(%rax)
+	movq	%r15,48(%rax)
+	movq	(%rsp),%rdx
+	movq	%rdx,56(%rax)
+	xorl	%eax,%eax
+	ret
+END(setjmp)
+
+/*
+ * int longjmp(label_t *)
+ *
+ * Used primarily by DDB.
+ */
+ENTRY(longjmp)
+	movq	%rdi,%rax
+	movq	(%rax),%rbx
+	movq	8(%rax),%rsp
+	movq	16(%rax),%rbp
+	movq	24(%rax),%r12
+	movq	32(%rax),%r13
+	movq	40(%rax),%r14
+	movq	48(%rax),%r15
+	movq	56(%rax),%rdx
+	movq	%rdx,(%rsp)
+	movl	$1,%eax
+	ret
+END(longjmp)
+#elif defined(__arm__)
+
+ENTRY(breakpoint)
+	BKPT_ASM
+	mov pc, lr
+
+#error implement setjmp/longjmp for arm32
+
+#else
+
+#error port me 
+
+#endif
+
Index: src/sys/arch/usermode/usermode/db_memrw.c
diff -u /dev/null src/sys/arch/usermode/usermode/db_memrw.c:1.1
--- /dev/null	Wed Aug  1 10:22:20 2018
+++ src/sys/arch/usermode/usermode/db_memrw.c	Wed Aug  1 10:22:20 2018
@@ -0,0 +1,257 @@
+/*	$NetBSD: db_memrw.c,v 1.1 2018/08/01 10:22:20 reinoud Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gordon W. Ross and Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Interface to the debugger for virtual memory read/write.
+ * This file is shared by DDB and KGDB, and must work even
+ * when only KGDB is included (thus no db_printf calls).
+ *
+ * To write in the text segment, we have to first make
+ * the page writable, do the write, then restore the PTE.
+ * For writes outside the text segment, and all reads,
+ * just do the access -- if it causes a fault, the debugger
+ * will recover with a longjmp to an appropriate place.
+ *
+ * ALERT!  If you want to access device registers with a
+ * specific size, then the read/write functions have to
+ * make sure to do the correct sized pointer access.
+ *
+ * Modified for i386 from hp300 version by
+ * Jason R. Thorpe .
+ *
+ * Basic copy to amd64 by fvdl.
+ * 
+ * i386 and amd64 merge by jym.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.1 2018/08/01 10:22:20 reinoud Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+int
+db_validate_address(vaddr_t addr)
+{
+	struct proc *p = curproc;
+	struct pmap *pmap;
+
+	if (!p || !p->p_vmspace || !p->p_vmspace->vm_map.pmap ||
+	addr >= 

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

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 09:52:15 UTC 2018

Added Files:
src/sys/arch/usermode/include: cpufunc.h ucontext.h

Log Message:
Forgot the two header files


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/include/cpufunc.h \
src/sys/arch/usermode/include/ucontext.h

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

Added files:

Index: src/sys/arch/usermode/include/cpufunc.h
diff -u /dev/null src/sys/arch/usermode/include/cpufunc.h:1.1
--- /dev/null	Wed Aug  1 09:52:15 2018
+++ src/sys/arch/usermode/include/cpufunc.h	Wed Aug  1 09:52:15 2018
@@ -0,0 +1,20 @@
+/* $NetBSD: cpufunc.h,v 1.1 2018/08/01 09:52:15 reinoud Exp $ */
+
+/*
+ * Automatically generated by ./genheaders.sh on Wed May 16 14:39:02 CEST 2018
+ * Do not modify directly!
+ */
+#ifndef _USERMODE_INT_LIMITS_H
+#define _USERMODE_INT_LIMITS_H
+
+#if defined(__i386__)
+#include "../../i386/include/cpufunc.h"
+#elif defined(__x86_64__)
+#include "../../amd64/include/cpufunc.h"
+#elif defined(__arm__)
+#include "../../arm/include/cpufunc.h"
+#else
+#error port me
+#endif
+
+#endif
Index: src/sys/arch/usermode/include/ucontext.h
diff -u /dev/null src/sys/arch/usermode/include/ucontext.h:1.1
--- /dev/null	Wed Aug  1 09:52:15 2018
+++ src/sys/arch/usermode/include/ucontext.h	Wed Aug  1 09:52:15 2018
@@ -0,0 +1,23 @@
+/* $NetBSD: ucontext.h,v 1.1 2018/08/01 09:52:15 reinoud Exp $ */
+
+#ifndef _USERMODE_UCONTEXT_H
+#define _USERMODE_UCONTEXT_H
+
+#include 
+#include 
+#include 
+
+#if defined(__i386__)
+
+#elif defined(__x86_64__)
+
+#define _UC_MACHINE_RFLAGS(uc) ((uc)->uc_mcontext.__gregs[26])
+
+#elif defined(__arm__)
+#error port me
+#else
+#error port me
+#endif
+
+#endif /* _USERMODE_UCONTEXT_H */
+



CVS commit: src/sys/arch/usermode

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 09:50:57 UTC 2018

Modified Files:
src/sys/arch/usermode/conf: files.usermode
src/sys/arch/usermode/include: cpu.h db_machdep.h genheaders.sh pmap.h

Log Message:
Add preliminary KGDB support for NetBSD/usermode, currently only under amd64


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/usermode/conf/files.usermode
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/include/cpu.h \
src/sys/arch/usermode/include/genheaders.sh
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/include/db_machdep.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/pmap.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/usermode/conf/files.usermode
diff -u src/sys/arch/usermode/conf/files.usermode:1.17 src/sys/arch/usermode/conf/files.usermode:1.18
--- src/sys/arch/usermode/conf/files.usermode:1.17	Tue Jun  5 20:02:42 2018
+++ src/sys/arch/usermode/conf/files.usermode	Wed Aug  1 09:50:57 2018
@@ -1,4 +1,4 @@
-# $NetBSD: files.usermode,v 1.17 2018/06/05 20:02:42 reinoud Exp $
+# $NetBSD: files.usermode,v 1.18 2018/08/01 09:50:57 reinoud Exp $
 
 maxpartitions 8
 maxusers 8 16 64
@@ -62,6 +62,9 @@ file	arch/usermode/usermode/sys_machdep.
 file	arch/usermode/usermode/syscall.c
 file	arch/usermode/usermode/trap.c
 file	arch/usermode/usermode/vm_machdep.c
+file	arch/usermode/usermode/db_memrw.c	ddb | kgdb
+file	arch/usermode/usermode/kgdb_machdep.c	ddb | kgdb
+file	arch/usermode/usermode/cpufunc.S	ddb | kgdb
 file	dev/cons.c
 file	dev/md_root.cmemory_disk_hooks
 file	kern/subr_disk_mbr.c			disk

Index: src/sys/arch/usermode/include/cpu.h
diff -u src/sys/arch/usermode/include/cpu.h:1.10 src/sys/arch/usermode/include/cpu.h:1.11
--- src/sys/arch/usermode/include/cpu.h:1.10	Wed Feb  8 17:55:21 2012
+++ src/sys/arch/usermode/include/cpu.h	Wed Aug  1 09:50:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.10 2012/02/08 17:55:21 reinoud Exp $ */
+/* $NetBSD: cpu.h,v 1.11 2018/08/01 09:50:57 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -47,7 +47,7 @@ struct cpu_info;
 extern int	astpending;
 #define aston(ci) (astpending++)
 extern void cpu_need_resched(struct cpu_info *ci, int flags);
-
+extern void kgdb_port_init(void);
 
 struct cpu_info {
 	struct cpu_data	ci_data;		/* MI per-cpu data */
Index: src/sys/arch/usermode/include/genheaders.sh
diff -u src/sys/arch/usermode/include/genheaders.sh:1.10 src/sys/arch/usermode/include/genheaders.sh:1.11
--- src/sys/arch/usermode/include/genheaders.sh:1.10	Wed May 16 12:40:26 2018
+++ src/sys/arch/usermode/include/genheaders.sh	Wed Aug  1 09:50:57 2018
@@ -23,6 +23,7 @@ HDRS="$HDRS wchar_limits.h"
 HDRS="$HDRS cdefs.h"
 HDRS="$HDRS mcontext.h"
 HDRS="$HDRS frame_regs.h"
+HDRS="$HDRS cpufunc.h"
 
 for hdr in ${HDRS}; do
 	G="_USERMODE_$(echo ${hdr} | sed 's/\./_/g' | tr [a-z] [A-Z])"

Index: src/sys/arch/usermode/include/db_machdep.h
diff -u src/sys/arch/usermode/include/db_machdep.h:1.2 src/sys/arch/usermode/include/db_machdep.h:1.3
--- src/sys/arch/usermode/include/db_machdep.h:1.2	Wed Oct 21 16:06:59 2009
+++ src/sys/arch/usermode/include/db_machdep.h	Wed Aug  1 09:50:57 2018
@@ -1,32 +1,80 @@
-/* $NetBSD: db_machdep.h,v 1.2 2009/10/21 16:06:59 snj Exp $ */
+/* $NetBSD: db_machdep.h,v 1.3 2018/08/01 09:50:57 reinoud Exp $ */
 
-/*-
- * Copyright (c) 2007 Jared D. McNeill 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+#ifndef _USERMODE_DB_MACHDEP_H
+#define _USERMODE_DB_MACHDEP_H
 
-#ifndef _ARCH_USERMODE_INCLUDE_DB_MACHDEP_H
-#define _ARCH_USERMODE_INCLUDE_DB_MACHDEP_H

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

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 09:46:46 UTC 2018

Modified Files:
src/sys/arch/usermode/include: thunk.h

Log Message:
Add headers for support functions for  kgdb


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/usermode/include/thunk.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/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.65 src/sys/arch/usermode/include/thunk.h:1.66
--- src/sys/arch/usermode/include/thunk.h:1.65	Mon Jun  4 19:53:01 2018
+++ src/sys/arch/usermode/include/thunk.h	Wed Aug  1 09:46:46 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.65 2018/06/04 19:53:01 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.66 2018/08/01 09:46:46 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -127,6 +127,11 @@ int	thunk_mkstemp(char *);
 int	thunk_unlink(const char *);
 pid_t	thunk_getpid(void);
 
+int	thunk_gdb_open(void);
+int	thunk_gdb_accept(int sockfd);
+int	thunk_kgdb_getc(int fd, char *ch);
+int	thunk_kgdb_putc(int fd, char ch);
+
 int	thunk_sigaction(int, const struct sigaction *, struct sigaction *);
 int	thunk_sigaltstack(const stack_t *, stack_t *);
 void	thunk_signal(int, void (*)(int));



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

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 09:46:16 UTC 2018

Modified Files:
src/sys/arch/usermode/include: vmparam.h

Log Message:
Max kernel address is end of kernel


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/usermode/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/usermode/include/vmparam.h
diff -u src/sys/arch/usermode/include/vmparam.h:1.17 src/sys/arch/usermode/include/vmparam.h:1.18
--- src/sys/arch/usermode/include/vmparam.h:1.17	Sun Nov 10 19:52:01 2013
+++ src/sys/arch/usermode/include/vmparam.h	Wed Aug  1 09:46:16 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.17 2013/11/10 19:52:01 jmcneill Exp $ */
+/* $NetBSD: vmparam.h,v 1.18 2018/08/01 09:46:16 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -43,7 +43,7 @@ extern paddr_t kmem_user_start, kmem_use
 #define VM_MAX_ADDRESS		kmem_user_end
 #define VM_MAXUSER_ADDRESS	kmem_user_end
 #define VM_MIN_KERNEL_ADDRESS	kmem_kvm_start
-#define VM_MAX_KERNEL_ADDRESS 	kmem_kvm_end
+#define VM_MAX_KERNEL_ADDRESS 	kmem_k_end
 
 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
 #define VM_PHYSSEG_MAX		1



CVS commit: src/sys/arch/usermode/usermode

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 09:44:32 UTC 2018

Modified Files:
src/sys/arch/usermode/usermode: machdep.c pmap.c thunk.c trap.c

Log Message:
Oops, forgot a debug printf


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/usermode/usermode/pmap.c
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/usermode/usermode/thunk.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/usermode/usermode/trap.c

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

Modified files:

Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.56 src/sys/arch/usermode/usermode/machdep.c:1.57
--- src/sys/arch/usermode/usermode/machdep.c:1.56	Mon Jun 11 19:35:56 2018
+++ src/sys/arch/usermode/usermode/machdep.c	Wed Aug  1 09:44:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.56 2018/06/11 19:35:56 reinoud Exp $ */
+/* $NetBSD: machdep.c,v 1.57 2018/08/01 09:44:31 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk 
@@ -37,7 +37,7 @@
 #include "opt_memsize.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.56 2018/06/11 19:35:56 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.57 2018/08/01 09:44:31 reinoud Exp $");
 
 #include 
 #include 
@@ -59,6 +59,11 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#include "opt_ddb.h"
+#include "opt_kgdb.h"
 
 #ifndef MAX_DISK_IMAGES
 #define MAX_DISK_IMAGES	4
@@ -272,6 +277,18 @@ main(int argc, char *argv[])
 	splinit();
 	splraise(IPL_HIGH);
 
+#ifdef DDB
+	if (boothowto & RB_KDB)
+		Debugger();
+#endif
+#ifdef KGDB
+	if (boothowto & RB_KDB) {
+		kgdb_port_init();
+		kgdb_debug_init = 1;
+		kgdb_connect(1);
+	}
+#endif
+
 	kernmain();
 }
 
@@ -297,6 +314,7 @@ setstatclockrate(int arg)
 void
 consinit(void)
 {
+//	kgdb_connect(0);
 	printf("NetBSD/usermode startup\n");
 }
 

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.108 src/sys/arch/usermode/usermode/pmap.c:1.109
--- src/sys/arch/usermode/usermode/pmap.c:1.108	Wed Aug  1 09:43:17 2018
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug  1 09:44:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.108 2018/08/01 09:43:17 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.109 2018/08/01 09:44:31 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2018/08/01 09:43:17 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2018/08/01 09:44:31 reinoud Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -660,7 +660,6 @@ pmap_fault(pmap_t pmap, vaddr_t va, vm_p
 
 	/* not known! then it must be UVM's work */
 	if (pv == NULL) {
-thunk_printf("%s: no mapping yet for %p\n", __func__, (void *) va);
 		thunk_printf_debug("%s: no mapping yet\n", __func__);
 		*atype = VM_PROT_READ;		/* assume it was a read */
 		return false;

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.90 src/sys/arch/usermode/usermode/thunk.c:1.91
--- src/sys/arch/usermode/usermode/thunk.c:1.90	Mon Jun  4 19:53:01 2018
+++ src/sys/arch/usermode/usermode/thunk.c	Wed Aug  1 09:44:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.90 2018/06/04 19:53:01 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.91 2018/08/01 09:44:31 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.90 2018/06/04 19:53:01 reinoud Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.91 2018/08/01 09:44:31 reinoud Exp $");
 #endif
 
 #define _KMEMUSER
@@ -92,6 +92,9 @@ __RCSID("$NetBSD: thunk.c,v 1.90 2018/06
 
 //#define RFB_DEBUG
 
+static ssize_t safe_recv(int s, void *buf, int len);
+static ssize_t safe_send(int s, const void *msg, int len);
+
 extern int boothowto;
 
 void
@@ -1017,6 +1020,78 @@ thunk_rfb_open(thunk_rfb_t *rfb, uint16_
 	return 0;
 }
 
+int
+thunk_gdb_open(void)
+{
+	struct sockaddr_in sin;
+	int sockfd;
+	int portnr = 5001;	/* XXX configurable or random */
+
+	/* create socket */
+	sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+	if (sockfd < 0) {
+		warn("kgdb stub: couldn't create socket");
+		return 0;
+	}
+
+	/* bind to requested port */
+	memset(, 0, sizeof(sin));
+	sin.sin_family  = AF_INET;
+	sin.sin_addr.s_addr = htonl(INADDR_ANY);
+	sin.sin_port= htons(portnr);
+
+	if (bind(sockfd, (struct sockaddr *), sizeof(sin)) < 0) {
+		warn("kgdb stub: couldn't bind port %d", portnr);
+		close(sockfd);
+		return 0;
+	}
+
+	/* listen for connections */
+	if (listen(sockfd, 1) < 0) {
+		warn("kgdb stub: couldn't listen on socket");
+		close(sockfd);
+		return 0;
+	}
+	printf("kgdb stub: accepting connections on port %d\n", portnr);
+
+	return sockfd;
+}
+
+int
+thunk_gdb_accept(int sockfd)
+{
+	struct 

CVS commit: src/sys/arch/usermode/usermode

2018-08-01 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug  1 09:43:17 UTC 2018

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

Log Message:
Allow the usermode pmaps to also contain the kernel itself. This is needed for
the kernel pmap.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.107 src/sys/arch/usermode/usermode/pmap.c:1.108
--- src/sys/arch/usermode/usermode/pmap.c:1.107	Thu May 17 19:06:02 2018
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug  1 09:43:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.107 2018/05/17 19:06:02 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.108 2018/08/01 09:43:17 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.107 2018/05/17 19:06:02 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2018/08/01 09:43:17 reinoud Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -285,7 +285,7 @@ pmap_bootstrap(void)
 		(uint64_t) pv_table_size/1024, (uintptr_t) phys_npages);
 
 	/* calculate number of pmap entries needed for a complete map */
-	pm_nentries = (kmem_k_start - VM_MIN_ADDRESS) / PAGE_SIZE;
+	pm_nentries = (kmem_k_end - VM_MIN_ADDRESS) / PAGE_SIZE;
 	pm_entries_size = round_page(pm_nentries * sizeof(struct pv_entry *));
 	thunk_printf_debug("tlb va->pa lookup table is %"PRIu64" KB for "
 		"%d logical pages\n", pm_entries_size/1024, pm_nentries);
@@ -660,6 +660,7 @@ pmap_fault(pmap_t pmap, vaddr_t va, vm_p
 
 	/* not known! then it must be UVM's work */
 	if (pv == NULL) {
+thunk_printf("%s: no mapping yet for %p\n", __func__, (void *) va);
 		thunk_printf_debug("%s: no mapping yet\n", __func__);
 		*atype = VM_PROT_READ;		/* assume it was a read */
 		return false;
@@ -1089,8 +1090,12 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
 
 	thunk_printf_debug("pmap_extract: extracting va %p\n", (void *) va);
 #ifdef DIAGNOSTIC
-	if ((va < VM_MIN_ADDRESS) || (va > VM_MAX_KERNEL_ADDRESS))
-		panic("pmap_extract: invalid va isued\n");
+	if ((va < VM_MIN_ADDRESS) || (va > VM_MAX_KERNEL_ADDRESS)) {
+		thunk_printf_debug("pmap_extract: invalid va issued\n");
+		thunk_printf("%p not in [%p, %p]\n", (void *) va,
+		(void *) VM_MIN_ADDRESS, (void *) VM_MAX_KERNEL_ADDRESS);
+		return false;
+	}
 #endif
 	lpn = atop(va - VM_MIN_ADDRESS);	/* V->L */
 	pv = pmap_lookup_pv(pmap, lpn);



CVS commit: src/doc

2018-08-01 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Aug  1 08:54:49 UTC 2018

Modified Files:
src/doc: TODO.npf

Log Message:
Note that mss clamping should be improved


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/doc/TODO.npf

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

Modified files:

Index: src/doc/TODO.npf
diff -u src/doc/TODO.npf:1.4 src/doc/TODO.npf:1.5
--- src/doc/TODO.npf:1.4	Tue Jul 31 20:33:06 2018
+++ src/doc/TODO.npf	Wed Aug  1 08:54:48 2018
@@ -55,3 +55,6 @@ Another TODO list is available here:
But it's not a big problem - perhaps we don't care at all.
 
 -- add command line variables.  See -D option in pf.
+
+-- improve mss clamping, as explained here:
+   http://mail-index.netbsd.org/tech-net/2017/01/15/msg006224.html