CVS commit: [pgoyette-compat] src/sys

2018-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Mar 21 04:48:32 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: Makefile.sysio compat_50_mod.c
files.common
src/sys/compat/sys [pgoyette-compat]: clockctl.h
src/sys/dev [pgoyette-compat]: clockctl.c
src/sys/kern [pgoyette-compat]: compat_stub.c
src/sys/modules/clockctl [pgoyette-compat]: Makefile
src/sys/modules/compat_50 [pgoyette-compat]: Makefile
src/sys/sys [pgoyette-compat]: compat_stub.h
Added Files:
src/sys/compat/common [pgoyette-compat]: clockctl_50.c

Log Message:
Split the compat_50 code out from the dev/clockctl driver and include
it in the compat_50 and compat modules.


To generate a diff of this commit:
cvs rdiff -u -r1.7.18.5 -r1.7.18.6 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/clockctl_50.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/compat/common/compat_50_mod.c
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/compat/common/files.common
cvs rdiff -u -r1.4 -r1.4.16.1 src/sys/compat/sys/clockctl.h
cvs rdiff -u -r1.35 -r1.35.14.1 src/sys/dev/clockctl.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.1 -r1.1.20.1 src/sys/modules/clockctl/Makefile
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/modules/compat_50/Makefile
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/sys/compat_stub.h

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

Modified files:

Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.7.18.5 src/sys/compat/common/Makefile.sysio:1.7.18.6
--- src/sys/compat/common/Makefile.sysio:1.7.18.5	Sun Mar 18 21:41:31 2018
+++ src/sys/compat/common/Makefile.sysio	Wed Mar 21 04:48:31 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sysio,v 1.7.18.5 2018/03/18 21:41:31 pgoyette Exp $
+#	$NetBSD: Makefile.sysio,v 1.7.18.6 2018/03/21 04:48:31 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -35,7 +35,7 @@ SRCS+=	vfs_syscalls_40.c uipc_syscalls_4
 
 # Compatibility code for NetBSD 5.0
 SRCS+=	kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
-	vfs_syscalls_50.c  uipc_syscalls_50.c uvm_50.c
+	vfs_syscalls_50.c  uipc_syscalls_50.c uvm_50.c clockctl_50.c
 
 # Compatibility code for NetBSD 6.0
 SRCS+=	kern_sa_60.c tty_60.c kern_time_60.c kern_cpu_60.c ccd_60.c

Index: src/sys/compat/common/compat_50_mod.c
diff -u src/sys/compat/common/compat_50_mod.c:1.1.2.1 src/sys/compat/common/compat_50_mod.c:1.1.2.2
--- src/sys/compat/common/compat_50_mod.c:1.1.2.1	Mon Mar 19 21:54:43 2018
+++ src/sys/compat/common/compat_50_mod.c	Wed Mar 21 04:48:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_50_mod.c,v 1.1.2.1 2018/03/19 21:54:43 pgoyette Exp $	*/
+/*	$NetBSD: compat_50_mod.c,v 1.1.2.2 2018/03/21 04:48:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.1 2018/03/19 21:54:43 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.2 2018/03/21 04:48:31 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -48,6 +48,8 @@ __KERNEL_RCSID(0, "$NetBSD: compat_50_mo
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -74,6 +76,7 @@ compat_50_init(void)
 
 	uvm_50_init();
 	if_50_init();
+	clockctl_50_init();
 
 	return error;
 
@@ -94,6 +97,7 @@ compat_50_fini(void)
 {
 	int error = 0;
 
+	clockctl_50_fini();
 	if_50_fini();
 	uvm_50_fini();
 
@@ -125,6 +129,7 @@ compat_50_fini(void)
  err1:
 	uvm_50_init();
 	if_50_init();
+	clockctl_50_init();
 
 	return error;
 }

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.14 src/sys/compat/common/files.common:1.1.2.15
--- src/sys/compat/common/files.common:1.1.2.14	Mon Mar 19 21:54:43 2018
+++ src/sys/compat/common/files.common	Wed Mar 21 04:48:31 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.1.2.14 2018/03/19 21:54:43 pgoyette Exp $
+#	$NetBSD: files.common,v 1.1.2.15 2018/03/21 04:48:31 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -64,6 +64,7 @@ file	compat/common/rndpseudo_50.c		compa
 file	compat/common/rtsock_50.c		compat_50
 file	compat/common/vfs_syscalls_50.c		compat_50
 file	compat/common/uipc_syscalls_50.c	compat_50
+file	compat/common/clockctl_50.c		compat_50 & clockctl
 file	compat/common/uvm_50.c			compat_50
 
 # Compatibility code for NetBSD 6.0
@@ -72,7 +73,7 @@ file	compat/common/kern_sa_60.c		compat_
 file	compat/common/tty_60.c			compat_60
 file	compat/common/kern_time_60.c		compat_60
 file	compat/common/kern_cpu_60.c		compat_60
-file	compat/common/ccd_60.c			compat_60
+file	compat/common/ccd_60.c			compat_60 & ccd
 
 # Compatibility code for NetBSD 7.0
 file	compat/common/compat_70_mod.c		compat_70

Index: src/sys/compat/sys/clockctl.h
diff -u 

CVS commit: [pgoyette-compat] src/sys

2018-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Mar 21 02:01:34 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: rndpseudo_50.c
src/sys/compat/netbsd32 [pgoyette-compat]: files.netbsd32
netbsd32_mod.c
src/sys/compat/sys [pgoyette-compat]: rnd.h
src/sys/kern [pgoyette-compat]: kern_rndq.c
src/sys/modules/compat_netbsd32 [pgoyette-compat]: Makefile
src/sys/sys [pgoyette-compat]: rnd.h
Added Files:
src/sys/compat/netbsd32 [pgoyette-compat]: netbsd32_rndpseudo_50.c

Log Message:
Split compat/rndpseudo_50.c into two pieces, one for native compat and
a second piece for compat32.  Update both modules accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.38.1 src/sys/compat/common/rndpseudo_50.c
cvs rdiff -u -r1.39 -r1.39.14.1 src/sys/compat/netbsd32/files.netbsd32
cvs rdiff -u -r1.13.16.1 -r1.13.16.2 src/sys/compat/netbsd32/netbsd32_mod.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c
cvs rdiff -u -r1.4 -r1.4.16.1 src/sys/compat/sys/rnd.h
cvs rdiff -u -r1.89 -r1.89.16.1 src/sys/kern/kern_rndq.c
cvs rdiff -u -r1.20 -r1.20.12.1 src/sys/modules/compat_netbsd32/Makefile
cvs rdiff -u -r1.49 -r1.49.16.1 src/sys/sys/rnd.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/compat/common/rndpseudo_50.c
diff -u src/sys/compat/common/rndpseudo_50.c:1.2 src/sys/compat/common/rndpseudo_50.c:1.2.38.1
--- src/sys/compat/common/rndpseudo_50.c:1.2	Fri Aug  3 07:51:21 2012
+++ src/sys/compat/common/rndpseudo_50.c	Wed Mar 21 02:01:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rndpseudo_50.c,v 1.2 2012/08/03 07:51:21 matt Exp $	*/
+/*	$NetBSD: rndpseudo_50.c,v 1.2.38.1 2018/03/21 02:01:34 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -30,11 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rndpseudo_50.c,v 1.2 2012/08/03 07:51:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rndpseudo_50.c,v 1.2.38.1 2018/03/21 02:01:34 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
-#include "opt_compat_netbsd32.h"
 #endif
 
 #include 
@@ -57,22 +56,6 @@ rndsource_to_rndsource50(rndsource_t *r,
 	r50->flags = r->flags;
 }
 
-#if defined(COMPAT_NETBSD32) && defined(_LP64)
-/*
- * Convert from rndsource_t to rndsource50_32_t, for the results from
- * RNDGETNUM50_32 and RNDGETNAME50_32.
- */
-static void
-rndsource_to_rndsource50_32(rndsource_t *r, rndsource50_32_t *r50_32)
-{
-	memset(r50_32, 0, sizeof(*r50_32));
-	strlcpy(r50_32->name, r->name, sizeof(r50_32->name));
-	r50_32->total = r->total;
-	r50_32->type = r->type;
-	r50_32->flags = r->flags;
-}
-#endif /* COMPAT_NETBSD32 */
-
 /*
  * COMPAT_50 handling for rnd_ioctl.  This is called from rnd_ioctl.
  *
@@ -110,33 +93,6 @@ compat_50_rnd_ioctl(struct file *fp, u_l
 		break;
 	}
 
-#if defined(COMPAT_NETBSD32) && defined(_LP64)
-	case RNDGETSRCNUM50_32:
-	{
-		rndstat_t rstbuf = {.start = 0};
-		rndstat50_32_t *rst50_32 = (rndstat50_32_t *)addr;
-		int count;
-
-		if (rst50_32->count > RND_MAXSTATCOUNT50)
-			return (EINVAL);
-
-		rstbuf.start = rst50_32->start;
-		rstbuf.count = rst50_32->count;
-
-		ret = (fp->f_ops->fo_ioctl)(fp, RNDGETSRCNUM, );
-		if (ret != 0)
-			return ret;
-
-		for (count = 0; count < rst50_32->count; count++) {
-			rndsource_to_rndsource50_32([count],
-			_32->source[count]);
-		}
-		rst50_32->count = rstbuf.count;
-
-		break;
-	}
-#endif /* COMPAT_NETBSD32 */
-
 	case RNDGETSRCNAME50:
 	{
 		rndstat_name_t rstnmbuf = {.name[0] = 0};
@@ -154,26 +110,6 @@ compat_50_rnd_ioctl(struct file *fp, u_l
 		break;
 	}
 
-#if defined(COMPAT_NETBSD32) && defined(_LP64)
-	case RNDGETSRCNAME50_32:
-	{
-		rndstat_name_t rstnmbuf = {.name[0] = 0};
-		rndstat_name50_32_t *rstnm50_32;
-		rstnm50_32 = (rndstat_name50_32_t *)addr;
-
-		strlcpy(rstnmbuf.name, rstnm50_32->name, sizeof(rstnmbuf.name));
-
-		ret = (fp->f_ops->fo_ioctl)(fp, RNDGETSRCNAME, );
-		if (ret != 0)
-			return ret;
-
-		rndsource_to_rndsource50_32(,
-		_32->source);
-
-		break;
-	}
-#endif
-
 	default:
 		return ENOTTY;
 	}

Index: src/sys/compat/netbsd32/files.netbsd32
diff -u src/sys/compat/netbsd32/files.netbsd32:1.39 src/sys/compat/netbsd32/files.netbsd32:1.39.14.1
--- src/sys/compat/netbsd32/files.netbsd32:1.39	Wed Oct 19 09:44:01 2016
+++ src/sys/compat/netbsd32/files.netbsd32	Wed Mar 21 02:01:34 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.netbsd32,v 1.39 2016/10/19 09:44:01 skrll Exp $
+#	$NetBSD: files.netbsd32,v 1.39.14.1 2018/03/21 02:01:34 pgoyette Exp $
 #
 # config file description for machine-independent netbsd32 compat code.
 # included by ports that need it.
@@ -41,6 +41,7 @@ file	compat/netbsd32/netbsd32_compat_20.
 file	compat/netbsd32/netbsd32_compat_30.c	compat_netbsd32 & compat_30
 file	compat/netbsd32/netbsd32_compat_43.c	compat_netbsd32 & (compat_43 | compat_sunos | compat_linux32)
 file	

CVS commit: src/share/man/man4

2018-03-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Mar 20 20:13:33 UTC 2018

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

Log Message:
Add a CAVEATS section to give a heads up about not using pf LKM with ALTQ.
Found via https://www.netbsd.org/docs/network/pf.html#altq


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/altq.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/altq.4
diff -u src/share/man/man4/altq.4:1.5 src/share/man/man4/altq.4:1.6
--- src/share/man/man4/altq.4:1.5	Tue Mar 20 17:13:54 2018
+++ src/share/man/man4/altq.4	Tue Mar 20 20:13:33 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: altq.4,v 1.5 2018/03/20 17:13:54 sevan Exp $
+.\" $NetBSD: altq.4,v 1.6 2018/03/20 20:13:33 sevan Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen 
 .\"
@@ -87,3 +87,11 @@ system first appeared in March 1997 and 
 (http://www.kame.net). It was imported to
 .Nx
 in 1.6 .
+.Sh CAVEATS
+Please note that you must compile
+.Xr pf 4
+in the kernel, using the PF
+.Xr module 7
+alongside
+.Nm
+built in the kernel will not work.



CVS commit: src/sys/arch/amd64/amd64

2018-03-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 20 18:27:58 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S locore.S

Log Message:
(Re)Fix handling of segment register faults. My previous attempt did fix
faults occuring when reloading %es/%ds/%fs/%gs, but it did not fix faults
occuring when executing 'iretq', because before iretq we needed to do +16
in %rsp, and the resulting stack layout was not the one kernuser_reenter()
expected (tf_trapno and tf_err were not there).

So now: pop tf_trapno and tf_err right away in intrfastexit(), and update
the layout in kernuser_reenter() accordingly. The resulting code is
actually simpler.

Tested by "hardcoding" an iretq fault; the process correctly receives a
SIGSEGV.

(Note that segment register faults do not happen in the wild, you really
need to try hard to trigger one.)


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/amd64/amd64/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/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.38 src/sys/arch/amd64/amd64/amd64_trap.S:1.39
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.38	Tue Mar 20 14:26:49 2018
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Tue Mar 20 18:27:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.38 2018/03/20 14:26:49 maxv Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.39 2018/03/20 18:27:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -388,8 +388,8 @@ IDTVEC_END(intrspurious)
  * When this happens, the kernel is re-entered in kernel mode, but the
  * previous context is in kernel mode too.
  *
- * We have two iret frames in the stack. In the first one, the 'rsp' field
- * points to the outer iret frame:
+ * We have two iret frames in the stack. In the first one, we also pushed
+ * 'trapno' and 'err'. The 'rsp' field points to the outer iret frame:
  *
  * +---+
  * | trapno | err | rip | cs=ring0 | rflags | rsp | ss |
@@ -397,19 +397,19 @@ IDTVEC_END(intrspurious)
  * |
  *   +-+
  *   |
- *   |+---+
- *   +--> | trapno | err | rip | cs=ring3 | rflags | rsp | ss |
- *+---+
+ *   |++
+ *   +--> | rip | cs=ring3 | rflags | rsp | ss |
+ *++
  *
  * We perform a three-step procedure:
  *
- *  o We copy the 'trapno' field of the current frame into the 'trapno'
- *field of the outer frame.
- *
  *  o We update RSP to point to the outer frame. This outer frame is in the
  *same stack as the current frame, and likely just after the current
  *frame.
  *
+ *  o We push, in this outer frame, the 'err' and 'trapno' fields of the
+ *CURRENT frame.
+ *
  *  o We do a normal INTRENTRY. Now that RSP points to the outer frame,
  *everything behaves as if we had received a trap from the outer frame,
  *that is to say, from userland directly.
@@ -429,7 +429,7 @@ IDTVEC_END(intrspurious)
  *stack (nested), and would double-fault because it touches the redzone
  *below the stack (see the documentation in x86/x86/svs.c). By popping
  *the GPR part of the stack, we leave enough stack for the CPU to push
- *an iret frame, and for us to push two 8-byte registers too.
+ *an iret frame, and for us to push one 8-byte register (%rdi) too.
  */
 	_ALIGN_TEXT
 LABEL(kernuser_reenter)
@@ -480,14 +480,19 @@ LABEL(kernuser_reenter)
 	jmp	.Lnormal_entry
 
 .Lkernelmode_but_user:
-	movq	TF_SMALL_REGPUSHED(TF_RSP, %rsp),%rdi
+	/*
+	 * Here we have %rdi pushed on the stack, hence 8+.
+	 */
+	movq	%rsp,%rdi
+	movq	TF_SMALL_REGPUSHED(TF_RSP, %rsp),%rsp
+
+	/* Push tf_err and tf_trapno */
+	pushq	8+8(%rdi)	/* 8+8(%rdi) = current TF_ERR */
+	pushq	8+0(%rdi)	/* 8+0(%rdi) = current TF_TRAPNO */
 
-	pushq	%rax
-	movq	16(%rsp),%rax	/* 16(%rsp) = current TF_TRAPNO */
-	movq	%rax,(%rdi)	/* (%rdi) = outer TF_TRAPNO */
-	popq	%rax
+	/* Restore %rdi */
+	movq	(%rdi),%rdi
 
-	movq	%rdi,%rsp
 	jmp	.Lnormal_entry
 END(kernuser_reenter)
 #endif

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.158 src/sys/arch/amd64/amd64/locore.S:1.159
--- src/sys/arch/amd64/amd64/locore.S:1.158	Tue Mar 20 14:26:49 2018
+++ src/sys/arch/amd64/amd64/locore.S	Tue Mar 20 18:27:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.158 2018/03/20 14:26:49 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.159 2018/03/20 18:27:58 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1548,14 +1548,14 @@ END(pagezero)
  * documentation in 

CVS commit: [netbsd-7-1] src

2018-03-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 20 17:49:24 UTC 2018

Modified Files:
src/doc [netbsd-7-1]: README.files
src/gnu/usr.bin/groff/tmac [netbsd-7-1]: mdoc.local
Added Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Welcome to 7.1.2_PATCH.
Note ticket #1579.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/doc/CHANGES-7.1.3
cvs rdiff -u -r1.5.12.3.2.3 -r1.5.12.3.2.4 src/doc/README.files
cvs rdiff -u -r1.75.4.5.2.4 -r1.75.4.5.2.5 \
src/gnu/usr.bin/groff/tmac/mdoc.local

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

Modified files:

Index: src/doc/README.files
diff -u src/doc/README.files:1.5.12.3.2.3 src/doc/README.files:1.5.12.3.2.4
--- src/doc/README.files:1.5.12.3.2.3	Wed Jan  3 19:27:04 2018
+++ src/doc/README.files	Tue Mar 20 17:49:24 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: README.files,v 1.5.12.3.2.3 2018/01/03 19:27:04 snj Exp $
+#	$NetBSD: README.files,v 1.5.12.3.2.4 2018/03/20 17:49:24 martin Exp $
 
 What's in this directory:
 
@@ -13,6 +13,8 @@ CHANGES-7.1.1	Changes between the 7.1 an
 
 CHANGES-7.1.2	Changes between the 7.1.1 and 7.1.2 releases.
 
+CHANGES-7.1.3	Changes between the 7.1.2 and 7.1.3 releases.
+
 CHANGES.prev	Changes in previous NetBSD releases.
 
 LAST_MINUTE	Last minute changes and notes about the release.

Index: src/gnu/usr.bin/groff/tmac/mdoc.local
diff -u src/gnu/usr.bin/groff/tmac/mdoc.local:1.75.4.5.2.4 src/gnu/usr.bin/groff/tmac/mdoc.local:1.75.4.5.2.5
--- src/gnu/usr.bin/groff/tmac/mdoc.local:1.75.4.5.2.4	Thu Mar 15 05:14:39 2018
+++ src/gnu/usr.bin/groff/tmac/mdoc.local	Tue Mar 20 17:49:24 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: mdoc.local,v 1.75.4.5.2.4 2018/03/15 05:14:39 snj Exp $
+.\" $NetBSD: mdoc.local,v 1.75.4.5.2.5 2018/03/20 17:49:24 martin Exp $
 .\"
 .\" Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -44,9 +44,9 @@
 .as doc-str-St--ieee1275-94 " (\*[Lq]\*[doc-Tn-font-size]Open Firmware\*[doc-str-St]\*[Rq])
 .
 .\" Default .Os value
-.ds doc-operating-system NetBSD\~7.1.2
+.ds doc-operating-system NetBSD\~7.1.2_PATCH
 .\" Default footer operating system value
-.ds doc-default-operating-system NetBSD\~7.1.2
+.ds doc-default-operating-system NetBSD\~7.1.2_PATCH
 .\" Other known versions, not yet in groff distribution
 .ds doc-operating-system-NetBSD-1.3.3  1.3.3
 .ds doc-operating-system-NetBSD-1.6.3  1.6.3

Added files:

Index: src/doc/CHANGES-7.1.3
diff -u /dev/null src/doc/CHANGES-7.1.3:1.1.2.1
--- /dev/null	Tue Mar 20 17:49:24 2018
+++ src/doc/CHANGES-7.1.3	Tue Mar 20 17:49:24 2018
@@ -0,0 +1,17 @@
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.1 2018/03/20 17:49:24 martin Exp $
+
+A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
+release:
+
+doc/README.filespatched by hand
+gnu/usr.bin/groff/tmac/mdoc.local		patched by hand
+sys/sys/param.h	patched by hand
+
+	Welcome to 7.1.2_PATCH.
+	[snj]
+
+sys/dev/ppbus/if_plip.c1.28
+
+	Fix an spl(9) leak.
+	[msaitoh, ticket #1579]
+



CVS commit: [netbsd-7-1] src/sys/sys

2018-03-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 20 17:42:13 UTC 2018

Modified Files:
src/sys/sys [netbsd-7-1]: param.h

Log Message:
Welcome to 7.1.2_PATCH


To generate a diff of this commit:
cvs rdiff -u -r1.459.2.10.2.4 -r1.459.2.10.2.5 src/sys/sys/param.h

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.459.2.10.2.4 src/sys/sys/param.h:1.459.2.10.2.5
--- src/sys/sys/param.h:1.459.2.10.2.4	Thu Mar 15 05:14:39 2018
+++ src/sys/sys/param.h	Tue Mar 20 17:42:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.459.2.10.2.4 2018/03/15 05:14:39 snj Exp $	*/
+/*	$NetBSD: param.h,v 1.459.2.10.2.5 2018/03/20 17:42:13 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	701000200	/* NetBSD 7.1.2 */
+#define	__NetBSD_Version__	701000200	/* NetBSD 7.1.2_PATCH */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



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

2018-03-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 20 17:34:05 UTC 2018

Modified Files:
src/sys/dev/ppbus [netbsd-7-1]: if_plip.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1579):
sys/dev/ppbus/if_plip.c: revision 1.28
spl leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.10.1 src/sys/dev/ppbus/if_plip.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/ppbus/if_plip.c
diff -u src/sys/dev/ppbus/if_plip.c:1.25 src/sys/dev/ppbus/if_plip.c:1.25.10.1
--- src/sys/dev/ppbus/if_plip.c:1.25	Thu Jun  5 23:48:16 2014
+++ src/sys/dev/ppbus/if_plip.c	Tue Mar 20 17:34:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_plip.c,v 1.25 2014/06/05 23:48:16 rmind Exp $ */
+/* $NetBSD: if_plip.c,v 1.25.10.1 2018/03/20 17:34:05 martin Exp $ */
 
 /*-
  * Copyright (c) 1997 Poul-Henning Kamp
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.25 2014/06/05 23:48:16 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.25.10.1 2018/03/20 17:34:05 martin Exp $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -445,6 +445,7 @@ lpioctl(struct ifnet *ifp, u_long cmd, v
 		case AF_INET:
 			break;
 		default:
+			splx(s);
 			return EAFNOSUPPORT;
 		}
 		break;



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

2018-03-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 20 17:32:08 UTC 2018

Modified Files:
src/sys/dev/ppbus [netbsd-7]: if_plip.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1579):
sys/dev/ppbus/if_plip.c: revision 1.28
spl leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/dev/ppbus/if_plip.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/ppbus/if_plip.c
diff -u src/sys/dev/ppbus/if_plip.c:1.25 src/sys/dev/ppbus/if_plip.c:1.25.2.1
--- src/sys/dev/ppbus/if_plip.c:1.25	Thu Jun  5 23:48:16 2014
+++ src/sys/dev/ppbus/if_plip.c	Tue Mar 20 17:32:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_plip.c,v 1.25 2014/06/05 23:48:16 rmind Exp $ */
+/* $NetBSD: if_plip.c,v 1.25.2.1 2018/03/20 17:32:08 martin Exp $ */
 
 /*-
  * Copyright (c) 1997 Poul-Henning Kamp
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.25 2014/06/05 23:48:16 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.25.2.1 2018/03/20 17:32:08 martin Exp $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -445,6 +445,7 @@ lpioctl(struct ifnet *ifp, u_long cmd, v
 		case AF_INET:
 			break;
 		default:
+			splx(s);
 			return EAFNOSUPPORT;
 		}
 		break;



CVS commit: [netbsd-7-0] src/doc

2018-03-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 20 17:18:56 UTC 2018

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

Log Message:
Ammend ticket #1118 for additional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.92 -r1.1.2.93 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.92 src/doc/CHANGES-7.0.3:1.1.2.93
--- src/doc/CHANGES-7.0.3:1.1.2.92	Mon Mar 19 16:55:50 2018
+++ src/doc/CHANGES-7.0.3	Tue Mar 20 17:18:56 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.92 2018/03/19 16:55:50 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.93 2018/03/20 17:18:56 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5313,7 +5313,9 @@ sys/arch/x86/include/cpu.h			1.67
 sys/arch/x86/include/cpuvar.h			1.47
 sys/arch/x86/x86/cpu.c1.117
 sys/arch/x86/x86/identcpu.c			1.49
+sys/arch/xen/x86/cpu.c1.102-1.103
 
 	Retrieve cpuid7 (Structured Extended Features) into ci_feat_val.
 	[msaitoh, ticket #1118]
 
+



CVS commit: [netbsd-7-0] src/sys/arch/xen/x86

2018-03-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 20 17:18:28 UTC 2018

Modified Files:
src/sys/arch/xen/x86 [netbsd-7-0]: cpu.c

Log Message:
Additionally pull up the following for ticket #1118:

sys/arch/xen/x86/cpu.c  1.102-1.103

to unbreak the build (adjust cpu_feature declaration to changes in generic
x86 code).


To generate a diff of this commit:
cvs rdiff -u -r1.98.4.1 -r1.98.4.1.2.1 src/sys/arch/xen/x86/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/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.98.4.1 src/sys/arch/xen/x86/cpu.c:1.98.4.1.2.1
--- src/sys/arch/xen/x86/cpu.c:1.98.4.1	Tue Aug  4 18:12:28 2015
+++ src/sys/arch/xen/x86/cpu.c	Tue Mar 20 17:18:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.98.4.1 2015/08/04 18:12:28 snj Exp $	*/
+/*	$NetBSD: cpu.c,v 1.98.4.1.2.1 2018/03/20 17:18:28 martin Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.98.4.1 2015/08/04 18:12:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.98.4.1.2.1 2018/03/20 17:18:28 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -172,12 +172,14 @@ struct cpu_info phycpu_info_primary __al
 struct cpu_info *cpu_info_list = _info_primary;
 struct cpu_info *phycpu_info_list = _info_primary;
 
-uint32_t cpu_feature[5]; /* X86 CPUID feature bits
+uint32_t cpu_feature[7]; /* X86 CPUID feature bits
 			  *	[0] basic features %edx
 			  *	[1] basic features %ecx
 			  *	[2] extended features %edx
 			  *	[3] extended features %ecx
 			  *	[4] VIA padlock features
+			  *	[5] structured extended features cpuid.7:%ebx
+			  *	[6] structured extended features cpuid.7:%ecx
 			  */
 
 bool x86_mp_online;



CVS commit: src/share/man/man9

2018-03-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Mar 20 17:15:20 UTC 2018

Modified Files:
src/share/man/man9: altq.9

Log Message:
Extend HISTORY section to match altq(4)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/share/man/man9/altq.9

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/man9/altq.9
diff -u src/share/man/man9/altq.9:1.15 src/share/man/man9/altq.9:1.16
--- src/share/man/man9/altq.9:1.15	Mon Jul  3 21:28:48 2017
+++ src/share/man/man9/altq.9	Tue Mar 20 17:15:20 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: altq.9,v 1.15 2017/07/03 21:28:48 wiz Exp $
+.\"	$NetBSD: altq.9,v 1.16 2018/03/20 17:15:20 sevan Exp $
 .\"	$OpenBSD: altq.9,v 1.4 2001/07/12 12:41:42 itojun Exp $
 .\"
 .\" Copyright (C) 2001
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 12, 2006
+.Dd March 20, 2018
 .Dt ALTQ 9
 .Os
 .\"
@@ -595,4 +595,7 @@ is called immediately after
 .Sh HISTORY
 The
 .Nm
-system first appeared in March 1997.
+system first appeared in March 1997 and found home in the KAME project
+(http://www.kame.net). It was imported to
+.Nx
+in 1.6 .



CVS commit: src/share/man/man4

2018-03-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Mar 20 17:13:54 UTC 2018

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

Log Message:
As per ALTQ(9), refer to ALTQ as a system which is a framework.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/altq.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/altq.4
diff -u src/share/man/man4/altq.4:1.4 src/share/man/man4/altq.4:1.5
--- src/share/man/man4/altq.4:1.4	Tue Mar 20 16:17:56 2018
+++ src/share/man/man4/altq.4	Tue Mar 20 17:13:54 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: altq.4,v 1.4 2018/03/20 16:17:56 sevan Exp $
+.\" $NetBSD: altq.4,v 1.5 2018/03/20 17:13:54 sevan Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen 
 .\"
@@ -46,7 +46,8 @@
 .Sh DESCRIPTION
 The
 .Nm
-framework provides several disciplines for queuing outgoing network packets.
+system is a framework which provides several disciplines for queuing outgoing
+network packets.
 While traffic shaping is perhaps the most prominent example,
 .Nm
 provides also other measures related to QoS.
@@ -82,7 +83,7 @@ are required in order to use a certain n
 .Sh HISTORY
 The
 .Nm
-framework first appeared in March 1997 and found home in the KAME project
+system first appeared in March 1997 and found home in the KAME project
 (http://www.kame.net). It was imported to
 .Nx
 in 1.6 .



CVS commit: src/share/man/man4

2018-03-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Mar 20 16:17:56 UTC 2018

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

Log Message:
Add HISTORY section.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/altq.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/altq.4
diff -u src/share/man/man4/altq.4:1.3 src/share/man/man4/altq.4:1.4
--- src/share/man/man4/altq.4:1.3	Thu Mar  8 17:57:15 2018
+++ src/share/man/man4/altq.4	Tue Mar 20 16:17:56 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: altq.4,v 1.3 2018/03/08 17:57:15 sevan Exp $
+.\" $NetBSD: altq.4,v 1.4 2018/03/20 16:17:56 sevan Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen 
 .\"
@@ -24,7 +24,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 08, 2018
+.Dd March 20, 2018
 .Dt ALTQ 4
 .Os
 .Sh NAME
@@ -79,6 +79,10 @@ are required in order to use a certain n
 .%O Asia BSD conference
 .%U http://www.sonycsl.co.jp/person/kjc/papers/fittingtheory.pdf
 .Re
-.\" .Sh HISTORY
-.\"
-.\" XXX: Write this.
+.Sh HISTORY
+The
+.Nm
+framework first appeared in March 1997 and found home in the KAME project
+(http://www.kame.net). It was imported to
+.Nx
+in 1.6 .



CVS commit: src/sys/arch/amd64/amd64

2018-03-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 20 14:26:49 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S locore.S

Log Message:
Remove the sysretq fault handler. It is broken with SVS, and not really
needed anyway. Initially I had added it so that if such a fault was
received the kernel would panic "cleanly" instead of crashing in a
potentially undefined way.

I'll re-add this handler later.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/amd64/amd64/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/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.37 src/sys/arch/amd64/amd64/amd64_trap.S:1.38
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.37	Sun Feb 25 12:37:16 2018
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Tue Mar 20 14:26:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.37 2018/02/25 12:37:16 maxv Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.38 2018/03/20 14:26:49 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -377,9 +377,8 @@ IDTVEC_END(intrspurious)
 
 /*
  * It is possible that we received a trap in kernel mode, but with the user
- * context loaded. There are six cases where this can happen:
+ * context loaded. There are five cases where this can happen:
  *
- *  o Execution of SYSRETQ.
  *  o Execution of IRETQ.
  *  o Reload of ES.
  *  o Reload of DS.
@@ -446,12 +445,7 @@ LABEL(kernuser_reenter)
 	/* We will clobber %rdi */
 	pushq	%rdi
 
-	/* Case 1: fault on sysretq? */
-	leaq	do_sysret(%rip),%rdi
-	cmpq	%rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
-	je	.Lkernelmode_but_user
-
-	/* Case 2: fault on iretq? */
+	/* Case 1: fault on iretq? */
 	leaq	do_iret(%rip),%rdi
 	cmpq	%rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
 	jne	5f
@@ -461,22 +455,22 @@ LABEL(kernuser_reenter)
 	jmp	.Lkernelmode_but_user	/* to user - must restore %gs */
 5:
 
-	/* Case 3: move to %es? */
+	/* Case 2: move to %es? */
 	leaq	do_mov_es(%rip),%rdi
 	cmpq	%rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
 	je	.Lkernelmode_but_user
 
-	/* Case 4: move to %ds? */
+	/* Case 3: move to %ds? */
 	leaq	do_mov_ds(%rip),%rdi
 	cmpq	%rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
 	je	.Lkernelmode_but_user
 
-	/* Case 5: move to %fs? */
+	/* Case 4: move to %fs? */
 	leaq	do_mov_fs(%rip),%rdi
 	cmpq	%rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
 	je	.Lkernelmode_but_user
 
-	/* Case 6: move to %gs? */
+	/* Case 5: move to %gs? */
 	leaq	do_mov_gs(%rip),%rdi
 	cmpq	%rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
 	je	.Lkernelmode_but_user

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.157 src/sys/arch/amd64/amd64/locore.S:1.158
--- src/sys/arch/amd64/amd64/locore.S:1.157	Sun Feb 25 12:37:16 2018
+++ src/sys/arch/amd64/amd64/locore.S	Tue Mar 20 14:26:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.157 2018/02/25 12:37:16 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.158 2018/03/20 14:26:49 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -330,7 +330,6 @@
 	.globl	_C_LABEL(biosbasemem)
 	.globl	_C_LABEL(biosextmem)
 	.globl	_C_LABEL(lwp0uarea)
-	.globl	do_sysret
 	.globl	do_mov_es
 	.globl	do_mov_ds
 	.globl	do_mov_fs
@@ -1471,7 +1470,6 @@ LABEL(syscall_sysret)
 	movq	TF_RIP(%rsp),%rcx	/* %rip for sysret */
 	movq	TF_RFLAGS(%rsp),%r11	/* %flags for sysret */
 	movq	TF_RSP(%rsp),%rsp
-do_sysret:
 	sysretq
 #else
 	addq	$TF_RIP,%rsp



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

2018-03-20 Thread Anders Magnusson
Module Name:src
Committed By:   ragge
Date:   Tue Mar 20 13:30:40 UTC 2018

Modified Files:
src/sys/arch/vax/boot/boot: if_qe.c

Log Message:
Change the driver to map the data structures onto the qbus.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/vax/boot/boot/if_qe.c

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

Modified files:

Index: src/sys/arch/vax/boot/boot/if_qe.c
diff -u src/sys/arch/vax/boot/boot/if_qe.c:1.9 src/sys/arch/vax/boot/boot/if_qe.c:1.10
--- src/sys/arch/vax/boot/boot/if_qe.c:1.9	Mon Oct 26 19:16:58 2009
+++ src/sys/arch/vax/boot/boot/if_qe.c	Tue Mar 20 13:30:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qe.c,v 1.9 2009/10/26 19:16:58 cegger Exp $ */
+/*	$NetBSD: if_qe.c,v 1.10 2018/03/20 13:30:40 ragge Exp $ */
 
 /*
  * Copyright (c) 1998 Roar Thronæs.  All rights reserved.
@@ -69,8 +69,8 @@ static struct  qe_softc {
 	char	qein[2048], qeout[2048];/* Packet buffers		*/
 } qe_softc;
 
-static	struct qe_softc *sc = _softc;
-static	int addr;
+static	struct qe_softc *sc = _softc, *psc;
+static	int addr, ubaddr;
 
 #define QE_WCSR(csr, val) \
 	(*((volatile u_short *)(addr + (csr))) = (val))
@@ -111,6 +111,9 @@ qe_init(u_char *eaddr)
 	QE_WCSR(QE_CSR_CSR, QE_RESET);
 	QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~QE_RESET);
 
+	ubaddr = ubmap(0, (int)sc, sizeof(struct qe_softc));
+	psc = (struct qe_softc *)ubaddr;
+
 	for (i = 0; i < 6; i++) {
 		sc->setup_pkt[i][1] = QE_RCSR(i * 2);
 		sc->setup_pkt[i+8][1] = QE_RCSR(i * 2);
@@ -125,13 +128,13 @@ qe_init(u_char *eaddr)
 
 	memset((void *)sc->rring, 0, sizeof(struct qe_ring));
 	sc->rring->qe_buf_len = -64;
-	sc->rring->qe_addr_lo = (short)((int)sc->setup_pkt);
-	sc->rring->qe_addr_hi = (short)((int)sc->setup_pkt >> 16);
+	sc->rring->qe_addr_lo = LOWORD(psc->setup_pkt);
+	sc->rring->qe_addr_hi = HIWORD(psc->setup_pkt);
 
 	memset((void *)sc->tring, 0, sizeof(struct qe_ring));
 	sc->tring->qe_buf_len = -64;
-	sc->tring->qe_addr_lo = (short)((int)sc->setup_pkt);
-	sc->tring->qe_addr_hi = (short)((int)sc->setup_pkt >> 16);
+	sc->tring->qe_addr_lo = LOWORD(psc->setup_pkt);
+	sc->tring->qe_addr_hi = HIWORD(psc->setup_pkt);
 
 	sc->rring[0].qe_flag = sc->rring[0].qe_status1 = QE_NOTYET;
 	sc->rring->qe_addr_hi |= QE_VALID;
@@ -141,10 +144,10 @@ qe_init(u_char *eaddr)
 
 	QE_WCSR(QE_CSR_CSR, QE_XMIT_INT | QE_RCV_INT);
 
-	QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring));
-	QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring));
-	QE_WCSR(QE_CSR_XMTL, LOWORD(sc->tring));
-	QE_WCSR(QE_CSR_XMTH, HIWORD(sc->tring));
+	QE_WCSR(QE_CSR_RCLL, LOWORD(psc->rring));
+	QE_WCSR(QE_CSR_RCLH, HIWORD(psc->rring));
+	QE_WCSR(QE_CSR_XMTL, LOWORD(psc->tring));
+	QE_WCSR(QE_CSR_XMTH, HIWORD(psc->tring));
 
 	while ((QE_RCSR(QE_CSR_CSR) & QE_INTS) != QE_INTS)
 		;
@@ -152,31 +155,31 @@ qe_init(u_char *eaddr)
 	QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) & ~(QE_INT_ENABLE|QE_ELOOP));
 	QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_ILOOP);
 
-	sc->rring[0].qe_addr_lo = (short)((int)sc->qein & 0x);
-	sc->rring[0].qe_addr_hi = (short)((int)sc->qein >> 16);
-	sc->rring[0].qe_buf_len=-MAXPACKETSIZE/2;
+	sc->rring[0].qe_addr_lo = LOWORD(psc->qein);
+	sc->rring[0].qe_addr_hi = HIWORD(psc->qein);
+	sc->rring[0].qe_buf_len = -MAXPACKETSIZE/2;
 	sc->rring[0].qe_addr_hi |= QE_VALID;
-	sc->rring[0].qe_flag=sc->rring[0].qe_status1=QE_NOTYET;
-	sc->rring[0].qe_status2=1;
+	sc->rring[0].qe_flag = sc->rring[0].qe_status1 = QE_NOTYET;
+	sc->rring[0].qe_status2 = 1;
 
 	sc->rring[1].qe_addr_lo = 0;
 	sc->rring[1].qe_addr_hi = 0;
 	sc->rring[1].qe_flag=sc->rring[1].qe_status1=QE_NOTYET;
 	sc->rring[1].qe_status2=1;
 
-	sc->tring[0].qe_addr_lo = (short)((int)sc->qeout & 0x);
-	sc->tring[0].qe_addr_hi = (short)((int)sc->qeout >> 16);
-	sc->tring[0].qe_buf_len=0;
-	sc->tring[0].qe_flag=sc->tring[0].qe_status1=QE_NOTYET;
+	sc->tring[0].qe_addr_lo = LOWORD(psc->qeout);
+	sc->tring[0].qe_addr_hi = HIWORD(psc->qeout);
+	sc->tring[0].qe_buf_len = 0;
+	sc->tring[0].qe_flag = sc->tring[0].qe_status1 = QE_NOTYET;
 	sc->tring[0].qe_addr_hi |= QE_EOMSG|QE_VALID;
 
-	sc->tring[1].qe_flag=sc->tring[1].qe_status1=QE_NOTYET;
+	sc->tring[1].qe_flag = sc->tring[1].qe_status1 = QE_NOTYET;
 	sc->tring[1].qe_addr_lo = 0;
 	sc->tring[1].qe_addr_hi = 0;
 
 	QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_RCV_ENABLE);
-	QE_WCSR(QE_CSR_RCLL, LOWORD(sc->rring));
-	QE_WCSR(QE_CSR_RCLH, HIWORD(sc->rring));
+	QE_WCSR(QE_CSR_RCLL, LOWORD(psc->rring));
+	QE_WCSR(QE_CSR_RCLH, HIWORD(psc->rring));
 }
 
 int
@@ -206,12 +209,12 @@ retry:
 
 end:
 	sc->rring[0].qe_status2 = sc->rring[1].qe_status2 = 1;
-	sc->rring[0].qe_flag=sc->rring[0].qe_status1=QE_NOTYET;
-	sc->rring[1].qe_flag=sc->rring[1].qe_status1=QE_NOTYET;
+	sc->rring[0].qe_flag = sc->rring[0].qe_status1 = QE_NOTYET;
+	sc->rring[1].qe_flag = sc->rring[1].qe_status1 = QE_NOTYET;
 	QE_WCSR(QE_CSR_CSR, QE_RCSR(QE_CSR_CSR) | QE_RCV_ENABLE);
 
-	QE_WCSR(QE_CSR_RCLL, 

CVS commit: src/sys

2018-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Mar 20 12:14:52 UTC 2018

Modified Files:
src/sys/arch/ia64/acpi: acpi_machdep.c
src/sys/arch/ia64/include: acpi_machdep.h
src/sys/arch/x86/acpi: acpi_machdep.c
src/sys/arch/x86/include: acpi_machdep.h
src/sys/dev/acpi: acpi_intr.h acpi_util.c acpica.h
src/sys/dev/acpi/acpica: OsdInterrupt.c
src/sys/dev/i2c: ihidev.c

Log Message:
Allow registering ACPI interrupt handlers with a xname.
AcpiOsInstallInterruptHandler(), part of ACPICA API, doesn't allow passing
the xname. I extend the API with AcpiOsInstallInterruptHandler_xname()
for this purpose, and change acpi_md_OsInstallInterruptHandler() to
accept and use the xname (ia64 doens't use it).
The xname was hardcoded to "acpi SCI" in the
x86 acpi_md_OsInstallInterruptHandler(), so I make
AcpiOsInstallInterruptHandler() call
AcpiOsInstallInterruptHandler_xname with xname = "acpi SCI".

Now 'vmstat -i' shows the device's name instead of "acpi SCI" for for i2c HID
interrupts.

Proposed on tech-kern@ on Dec 29.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/acpi/acpi_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/include/acpi_machdep.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/acpi/acpi_machdep.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/include/acpi_machdep.h
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_intr.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpi_util.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpica.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/acpica/OsdInterrupt.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/ihidev.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/ia64/acpi/acpi_machdep.c
diff -u src/sys/arch/ia64/acpi/acpi_machdep.c:1.6 src/sys/arch/ia64/acpi/acpi_machdep.c:1.7
--- src/sys/arch/ia64/acpi/acpi_machdep.c:1.6	Sun Sep 23 00:31:05 2012
+++ src/sys/arch/ia64/acpi/acpi_machdep.c	Tue Mar 20 12:14:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_machdep.c,v 1.6 2012/09/23 00:31:05 chs Exp $	*/
+/*	$NetBSD: acpi_machdep.c,v 1.7 2018/03/20 12:14:52 bouyer Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -28,7 +28,7 @@
  * Machine-dependent routines for ACPICA.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.6 2012/09/23 00:31:05 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.7 2018/03/20 12:14:52 bouyer Exp $");
 
 #include 
 
@@ -77,7 +77,8 @@ acpi_md_OsGetRootPointer(void)
 ACPI_STATUS
 acpi_md_OsInstallInterruptHandler(UINT32 InterruptNumber,
   ACPI_OSD_HANDLER ServiceRoutine,
-  void *Context, void **cookiep)
+  void *Context, void **cookiep,
+  const char *xname)
 {
 	static int isa_irq_to_vector_map[16] = {
 	/* i8259 IRQ translation, first 16 entries */

Index: src/sys/arch/ia64/include/acpi_machdep.h
diff -u src/sys/arch/ia64/include/acpi_machdep.h:1.6 src/sys/arch/ia64/include/acpi_machdep.h:1.7
--- src/sys/arch/ia64/include/acpi_machdep.h:1.6	Sun Sep 23 00:31:05 2012
+++ src/sys/arch/ia64/include/acpi_machdep.h	Tue Mar 20 12:14:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_machdep.h,v 1.6 2012/09/23 00:31:05 chs Exp $	*/
+/*	$NetBSD: acpi_machdep.h,v 1.7 2018/03/20 12:14:52 bouyer Exp $	*/
 
 ACPI_STATUS		acpi_md_OsInitialize(void);
 ACPI_PHYSICAL_ADDRESS	acpi_md_OsGetRootPointer(void);
@@ -12,7 +12,7 @@ ACPI_PHYSICAL_ADDRESS	acpi_md_OsGetRootP
 #define acpi_md_OsOut32(x, v)	outl((x), (v))
 
 ACPI_STATUS acpi_md_OsInstallInterruptHandler(UINT32, ACPI_OSD_HANDLER,
-	  void *, void **);
+	  void *, void **, const char *);
 void acpi_md_OsRemoveInterruptHandler(void *);
 
 ACPI_STATUS acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS, UINT32, void **);

Index: src/sys/arch/x86/acpi/acpi_machdep.c
diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.18 src/sys/arch/x86/acpi/acpi_machdep.c:1.19
--- src/sys/arch/x86/acpi/acpi_machdep.c:1.18	Tue Feb 14 13:29:09 2017
+++ src/sys/arch/x86/acpi/acpi_machdep.c	Tue Mar 20 12:14:52 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.18 2017/02/14 13:29:09 nonaka Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.19 2018/03/20 12:14:52 bouyer Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.18 2017/02/14 13:29:09 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.19 2018/03/20 12:14:52 bouyer Exp $");
 
 #include 
 #include 
@@ -147,7 +147,8 @@ acpi_md_findoverride(ACPI_SUBTABLE_HEADE
 
 ACPI_STATUS
 acpi_md_OsInstallInterruptHandler(uint32_t InterruptNumber,
-ACPI_OSD_HANDLER ServiceRoutine, void *Context, void **cookiep)
+ACPI_OSD_HANDLER ServiceRoutine, void *Context, void **cookiep,
+const char *xname)
 {
 	void *ih;
 	struct pic *pic;
@@ -242,7 +243,7 @@ acpi_md_OsInstallInterruptHandler(uint32
 	 * XXX probably, IPL_BIO is enough.
 	 */
 	ih = 

CVS commit: src/sys/dev/pci

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 11:23:06 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Intel Wireless AC 9260.


To generate a diff of this commit:
cvs rdiff -u -r1.1320 -r1.1321 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1320 src/sys/dev/pci/pcidevs:1.1321
--- src/sys/dev/pci/pcidevs:1.1320	Fri Mar 16 08:40:06 2018
+++ src/sys/dev/pci/pcidevs	Tue Mar 20 11:23:06 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1320 2018/03/16 08:40:06 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1321 2018/03/20 11:23:06 nonaka Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3738,6 +3738,7 @@ product INTEL WIFI_LINK_3168	0x24fb	Dual
 product INTEL WIFI_LINK_8265	0x24fd	Dual Band Wireless AC 8265
 product INTEL 82820_MCH		0x2501	82820 MCH (Camino)
 product INTEL 82820_AGP		0x250f	82820 AGP
+product INTEL WIFI_LINK_9260	0x2526	Wireless AC 9260
 product INTEL 82850_HB		0x2530	82850 Host
 product INTEL 82860_HB		0x2531	82860 Host
 product INTEL 82850_AGP		0x2532	82850/82860 AGP



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

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 10:21:01 UTC 2018

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
efiboot: fix to find boot partition process.

NetBSD related partitions with no bootme flag set are also candidates
for boot partition.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.47 src/sys/arch/i386/stand/lib/biosdisk.c:1.48
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.47	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Mar 20 10:21:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.47 2018/03/08 10:34:33 nonaka Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.48 2018/03/20 10:21:01 nonaka Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -802,20 +802,21 @@ biosdisk_findpartition(int biosdev, dadd
 			if (d->part[partition].fstype == FS_UNUSED)
 continue;
 #ifdef EFIBOOT
-			if (d->part[partition].attr & GPT_ENT_ATTR_BOOTME) {
-switch (d->part[partition].fstype) {
-case FS_BSDFFS:
-case FS_BSDLFS:
-case FS_RAID:
-case FS_CCD:
-case FS_CGD:
-case FS_ISO9660:
-	break;
+			switch (d->part[partition].fstype) {
+			case FS_BSDFFS:
+			case FS_BSDLFS:
+			case FS_RAID:
+			case FS_CCD:
+			case FS_CGD:
+			case FS_ISO9660:
+if (d->part[partition].attr & GPT_ENT_ATTR_BOOTME)
+	goto found;
+candidate = partition;
+break;
 
-default:
+			default:
+if (d->part[partition].attr & GPT_ENT_ATTR_BOOTME)
 	candidate = partition;
-	continue;
-}
 break;
 			}
 #else
@@ -824,6 +825,7 @@ biosdisk_findpartition(int biosdev, dadd
 #endif
 		}
 #ifdef EFIBOOT
+found:
 		if (partition == 0 && candidate != 0)
 			partition = candidate;
 #endif



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

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 10:19:33 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot: efidisk.c

Log Message:
efiboot: boot device is always efi_distlist first element.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/efidisk.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/i386/stand/efiboot/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.2 src/sys/arch/i386/stand/efiboot/efidisk.c:1.3
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.2	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Tue Mar 20 10:19:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.2 2018/03/08 10:34:33 nonaka Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.3 2018/03/20 10:19:33 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -106,14 +106,11 @@ next:
 	FreePool(handles);
 
 	if (efi_bootdp_type == BIOSDISK_TYPE_CD) {
-		TAILQ_FOREACH(edi, _disklist, list) {
-			if (edi->bootdev) {
-edi = TAILQ_FIRST(_disklist);
-edi->type = BIOSDISK_TYPE_CD;
-TAILQ_REMOVE(_disklist, edi, list);
-TAILQ_INSERT_TAIL(_disklist, edi, list);
-break;
-			}
+		edi = TAILQ_FIRST(_disklist);
+		if (edi != NULL && edi->bootdev) {
+			edi->type = BIOSDISK_TYPE_CD;
+			TAILQ_REMOVE(_disklist, edi, list);
+			TAILQ_INSERT_TAIL(_disklist, edi, list);
 		}
 	}
 



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

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 10:18:10 UTC 2018

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

Log Message:
efiboot: more pager.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/boot.c

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.6 src/sys/arch/i386/stand/efiboot/boot.c:1.7
--- src/sys/arch/i386/stand/efiboot/boot.c:1.6	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/efiboot/boot.c	Tue Mar 20 10:18:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.6 2018/03/08 10:34:33 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.7 2018/03/20 10:18:10 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -627,6 +627,12 @@ command_devpath(char *arg)
 			break;
 
 		Print(L"DevicePathType %d\n", DevicePathType(dp0));
+		if (++row >= rows) {
+			row = 0;
+			Print(L"Press Any Key to continue :");
+			(void) awaitkey(-1, 0);
+			Print(L"\n");
+		}
 		for (dp = dp0;
 		 !IsDevicePathEnd(dp);
 		 dp = NextDevicePathNode(dp)) {



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

2018-03-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Mar 20 10:16:18 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot: devopen.c

Log Message:
efiboot: fix it can't boot from HDD.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/devopen.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/i386/stand/efiboot/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.2 src/sys/arch/i386/stand/efiboot/devopen.c:1.3
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.2	Thu Mar  8 10:34:33 2018
+++ src/sys/arch/i386/stand/efiboot/devopen.c	Tue Mar 20 10:16:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.2 2018/03/08 10:34:33 nonaka Exp $	 */
+/*	$NetBSD: devopen.c,v 1.3 2018/03/20 10:16:17 nonaka Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ dev2bios(char *devname, int unit, int *b
 
 	if (strcmp(devname, "hd") == 0)
 		*biosdev = 0x80 + unit;
-	if (strcmp(devname, "cd") == 0)
+	else if (strcmp(devname, "cd") == 0)
 		*biosdev = 0x80 + get_harddrives() + unit;
 	else
 		return ENXIO;



CVS commit: src

2018-03-20 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Mar 20 10:14:29 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: ad.aarch64 ad.arm
src/sys/arch/aarch64/include: armreg.h
src/sys/arch/arm/include: Makefile armreg.h
Added Files:
src/sys/arch/arm/include: cputypes.h

Log Message:
separate cputypes.h for CPU_ID_* from armreg.h,
and add some implementor IDs, CortexA55,73,75 IDs.

(preliminary changes for merging aarch64)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/sets/lists/comp/ad.aarch64
cvs rdiff -u -r1.83 -r1.84 src/distrib/sets/lists/comp/ad.arm
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/include/armreg.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/arm/include/Makefile
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/arm/include/armreg.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/include/cputypes.h

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

Modified files:

Index: src/distrib/sets/lists/comp/ad.aarch64
diff -u src/distrib/sets/lists/comp/ad.aarch64:1.16 src/distrib/sets/lists/comp/ad.aarch64:1.17
--- src/distrib/sets/lists/comp/ad.aarch64:1.16	Wed Jan 24 09:51:26 2018
+++ src/distrib/sets/lists/comp/ad.aarch64	Tue Mar 20 10:14:29 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64,v 1.16 2018/01/24 09:51:26 wiz Exp $
+# $NetBSD: ad.aarch64,v 1.17 2018/03/20 10:14:29 ryo Exp $
 ./usr/include/aarch64comp-c-include
 ./usr/include/aarch64/ansi.h			comp-c-include
 ./usr/include/aarch64/aout_machdep.h		comp-c-include
@@ -72,6 +72,7 @@
 ./usr/include/arm/cdefs.h			comp-c-include
 ./usr/include/arm/cpu.hcomp-c-include
 ./usr/include/arm/cpuconf.h			comp-c-include
+./usr/include/arm/cputypes.h			comp-c-include
 ./usr/include/arm/disklabel.h			comp-c-include
 ./usr/include/arm/elf_machdep.h			comp-c-include
 ./usr/include/arm/endian.h			comp-c-include

Index: src/distrib/sets/lists/comp/ad.arm
diff -u src/distrib/sets/lists/comp/ad.arm:1.83 src/distrib/sets/lists/comp/ad.arm:1.84
--- src/distrib/sets/lists/comp/ad.arm:1.83	Sat Feb  3 21:27:45 2018
+++ src/distrib/sets/lists/comp/ad.arm	Tue Mar 20 10:14:29 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.83 2018/02/03 21:27:45 mrg Exp $
+# $NetBSD: ad.arm,v 1.84 2018/03/20 10:14:29 ryo Exp $
 ./usr/include/acorn26comp-obsolete		obsolete
 ./usr/include/acorn26/ansi.h			comp-obsolete		obsolete
 ./usr/include/acorn26/aout_machdep.h		comp-obsolete		obsolete
@@ -133,6 +133,7 @@
 ./usr/include/arm/cdefs.h			comp-c-include
 ./usr/include/arm/cpu.hcomp-c-include
 ./usr/include/arm/cpuconf.h			comp-c-include
+./usr/include/arm/cputypes.h			comp-c-include
 ./usr/include/arm/db_machdep.h			comp-obsolete		obsolete
 ./usr/include/arm/disklabel.h			comp-c-include
 ./usr/include/arm/disklabel_acorn.h		comp-obsolete		obsolete

Index: src/sys/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.7 src/sys/arch/aarch64/include/armreg.h:1.8
--- src/sys/arch/aarch64/include/armreg.h:1.7	Tue Mar  6 08:20:22 2018
+++ src/sys/arch/aarch64/include/armreg.h	Tue Mar 20 10:14:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.7 2018/03/06 08:20:22 skrll Exp $ */
+/* $NetBSD: armreg.h,v 1.8 2018/03/20 10:14:29 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,6 +34,7 @@
 
 #ifdef __aarch64__
 
+#include 
 #include 
 
 #define AARCH64REG_READ_INLINE2(regname, regdesc)		\

Index: src/sys/arch/arm/include/Makefile
diff -u src/sys/arch/arm/include/Makefile:1.49 src/sys/arch/arm/include/Makefile:1.50
--- src/sys/arch/arm/include/Makefile:1.49	Wed Jul 23 18:19:43 2014
+++ src/sys/arch/arm/include/Makefile	Tue Mar 20 10:14:29 2018
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.49 2014/07/23 18:19:43 alnsn Exp $
+#	$NetBSD: Makefile,v 1.50 2018/03/20 10:14:29 ryo Exp $
 
 INCSDIR= /usr/include/arm
 
 INCS=	aeabi.h ansi.h aout_machdep.h apmvar.h armreg.h asm.h atomic.h \
 	bswap.h byte_swap.h \
-	cdefs.h cpu.h cpuconf.h \
+	cdefs.h cpu.h cpuconf.h cputypes.h \
 	disklabel.h \
 	elf_machdep.h endian.h endian_machdep.h \
 	fenv.h float.h frame.h \

Index: src/sys/arch/arm/include/armreg.h
diff -u src/sys/arch/arm/include/armreg.h:1.118 src/sys/arch/arm/include/armreg.h:1.119
--- src/sys/arch/arm/include/armreg.h:1.118	Fri Mar  2 22:23:17 2018
+++ src/sys/arch/arm/include/armreg.h	Tue Mar 20 10:14:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: armreg.h,v 1.118 2018/03/02 22:23:17 christos Exp $	*/
+/*	$NetBSD: armreg.h,v 1.119 2018/03/20 10:14:29 ryo Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Ben Harris
@@ -39,6 +39,8 @@
 #ifndef _ARM_ARMREG_H
 #define _ARM_ARMREG_H
 
+#include 
+
 /*
  * ARM Process Status Register
  *
@@ -101,165 +103,6 @@
 
 #define ARM_CP15_CPU_ID		0
 
-/*
- * The CPU ID register is theoretically structured, but the definitions of
- * the fields keep changing.
- */
-
-/* The high-order byte is always the implementor */
-#define CPU_ID_IMPLEMENTOR_MASK	0xff00
-#define CPU_ID_ARM_LTD		0x4100 /* 'A' 

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

2018-03-20 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Mar 20 09:50:33 UTC 2018

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

Log Message:
Fix race about writing adapter->link_active for ixv(4).

adapter->link_active is updated by ixv_update_link_status() only.
The function is called from the following two functions.
- ixv_media_status()
- ixv_handle_link()

ixv_media_status() calls ixv_update_link_status() with holding
IXGBE_CORE_LOCK, however ixv_handle_link() calls it without
holding IXGBE_CORE_LOCK, the same as ixg(4).

ok by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.88 src/sys/dev/pci/ixgbe/ixv.c:1.89
--- src/sys/dev/pci/ixgbe/ixv.c:1.88	Thu Mar 15 06:48:51 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue Mar 20 09:50:33 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.88 2018/03/15 06:48:51 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.89 2018/03/20 09:50:33 knakahara Exp $*/
 
 /**
 
@@ -1293,6 +1293,8 @@ ixv_update_link_status(struct adapter *a
 	struct ifnet *ifp = adapter->ifp;
 	device_t dev = adapter->dev;
 
+	KASSERT(mutex_owned(>core_mtx));
+
 	if (adapter->link_up) {
 		if (adapter->link_active == FALSE) {
 			if (bootverbose) {
@@ -3080,9 +3082,13 @@ ixv_handle_link(void *context)
 {
 	struct adapter *adapter = context;
 
+	IXGBE_CORE_LOCK(adapter);
+
 	adapter->hw.mac.ops.check_link(>hw, >link_speed,
 	>link_up, FALSE);
 	ixv_update_link_status(adapter);
+
+	IXGBE_CORE_UNLOCK(adapter);
 } /* ixv_handle_link */
 
 /
@@ -3091,6 +3097,9 @@ ixv_handle_link(void *context)
 static void
 ixv_check_link(struct adapter *adapter)
 {
+
+	KASSERT(mutex_owned(>core_mtx));
+
 	adapter->hw.mac.get_link_status = TRUE;
 
 	adapter->hw.mac.ops.check_link(>hw, >link_speed,



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

2018-03-20 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Mar 20 09:46:25 UTC 2018

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

Log Message:
Fix race about writing adapter->link_active for ixg(4).

adapter->link_active is updated by ixgbe_update_link_status() only.
The function is called from the following four functions.
- ixgbe_media_status()
- ixgbe_local_timer1()
- ixgbe_stop()
- ixgbe_handle_link()

The functions other than ixgbe_handle_link() call ixgbe_update_link_status()
with holding IXGBE_CORE_LOCK, however ixgbe_handle_link() calls it without
holding IXGBE_CORE_LOCK. That can cause race. So, add IXGBE_CORE_LOCK to
ixgbe_handle_link().

Tested by msaitoh@n.o and me.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/pci/ixgbe/ixgbe.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.135 src/sys/dev/pci/ixgbe/ixgbe.c:1.136
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.135	Thu Mar 15 06:48:51 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Mar 20 09:46:25 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.135 2018/03/15 06:48:51 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.136 2018/03/20 09:46:25 knakahara Exp $ */
 
 /**
 
@@ -4486,6 +4486,8 @@ ixgbe_update_link_status(struct adapter 
 	device_tdev = adapter->dev;
 	struct ixgbe_hw *hw = >hw;
 
+	KASSERT(mutex_owned(>core_mtx));
+
 	if (adapter->link_up) {
 		if (adapter->link_active == FALSE) {
 			if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL){
@@ -6338,11 +6340,15 @@ ixgbe_handle_link(void *context)
 	struct adapter  *adapter = context;
 	struct ixgbe_hw *hw = >hw;
 
+	IXGBE_CORE_LOCK(adapter);
+
 	ixgbe_check_link(hw, >link_speed, >link_up, 0);
 	ixgbe_update_link_status(adapter);
 
 	/* Re-enable link interrupts */
 	IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_LSC);
+
+	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_link */
 
 /



CVS commit: [netbsd-8] src/doc

2018-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Mar 20 09:18:50 UTC 2018

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

Log Message:
tickets 644-647


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.148 -r1.1.2.149 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.148 src/doc/CHANGES-8.0:1.1.2.149
--- src/doc/CHANGES-8.0:1.1.2.148	Sun Mar 18 11:22:59 2018
+++ src/doc/CHANGES-8.0	Tue Mar 20 09:18:49 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.148 2018/03/18 11:22:59 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.149 2018/03/20 09:18:49 bouyer Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -10436,3 +10436,28 @@ usr.sbin/sysinst/arch/sgimips/md.c		1.4
 	to deal with this.
 	[jmcneill, ticket #643]
 
+sys/kern/exec_elf.c1.95, 1.96
+
+	Turn KASSERTS that check alignment which are user triggerable
+	into errors.
+	[alnsn, ticket #644]
+
+sys/netinet6/nd6_nbr.c  1.153
+  
+	fix a constraint violation of pserialize.
+	[ozaki-r, ticket #645]
+
+sys/arch/alpha/alpha/vm_machdep.c		1.114
+
+	Nowadays we can create new kernel threads late after boot, so if we are
+	unable to find physically continous pages for their uarea, just
+	allocate them via uvm_km_alloc(), that is: make cpu_uarea_alloc() fail
+	instead of panic. cpu_uarea_free() already deals with this.
+	Should fix PR port-alpha/53077.
+	[martin, ticket #646]
+
+share/mk/bsd.own.mk1.1051
+
+	Don't barf if the ctf tools are not installed.
+	[martin, ticket #647]
+



CVS commit: [netbsd-8] src/share/mk

2018-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Mar 20 09:17:43 UTC 2018

Modified Files:
src/share/mk [netbsd-8]: bsd.own.mk

Log Message:
Pull up following revision(s) (requested by martin in ticket #647):
share/mk/bsd.own.mk: revision 1.1051
Don't barf if the ctf tools are not installed.
[perhaps warn?]


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

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1009.2.3 src/share/mk/bsd.own.mk:1.1009.2.4
--- src/share/mk/bsd.own.mk:1.1009.2.3	Mon Nov 27 11:36:29 2017
+++ src/share/mk/bsd.own.mk	Tue Mar 20 09:17:42 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1009.2.3 2017/11/27 11:36:29 martin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1009.2.4 2018/03/20 09:17:42 bouyer Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1554,7 +1554,8 @@ TARGETS+=	lintmanpages
 TESTSBASE=	/usr/tests${MLIBDIR:D/${MLIBDIR}}
 
 # Override with tools versions if needed
-.if ${MKCTF:Uno} != "no" && !defined(NOCTF)
+.if ${MKCTF:Uno} != "no" && !defined(NOCTF) && \
+(exists(${TOOL_CTFCONVERT}) || exists(/usr/bin/${TOOL_CTFCONVERT}))
 CTFCONVERT=	${TOOL_CTFCONVERT}
 CTFMERGE=	${TOOL_CTFMERGE}
 .endif



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

2018-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Mar 20 09:15:34 UTC 2018

Modified Files:
src/sys/arch/alpha/alpha [netbsd-8]: vm_machdep.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #646):
sys/arch/alpha/alpha/vm_machdep.c: revision 1.114
Nowadays we can create new kernel threads late after boot, so if we are
unable to find physically continous pages for their uarea, just allocate
them via uvm_km_alloc(), that is: make cpu_uarea_alloc() fail instead
of panic. cpu_uarea_free() already deals with this.
Should fix PR port-alpha/53077.
Discussed with maxv and mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.113.20.1 src/sys/arch/alpha/alpha/vm_machdep.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/vm_machdep.c
diff -u src/sys/arch/alpha/alpha/vm_machdep.c:1.113 src/sys/arch/alpha/alpha/vm_machdep.c:1.113.20.1
--- src/sys/arch/alpha/alpha/vm_machdep.c:1.113	Fri May 16 19:18:21 2014
+++ src/sys/arch/alpha/alpha/vm_machdep.c	Tue Mar 20 09:15:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.113 2014/05/16 19:18:21 matt Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.113.20.1 2018/03/20 09:15:33 bouyer Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.113 2014/05/16 19:18:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.113.20.1 2018/03/20 09:15:33 bouyer Exp $");
 
 #include 
 #include 
@@ -227,11 +227,8 @@ cpu_uarea_alloc(bool system)
 	 * direct-mapped.
 	 */
 	error = uvm_pglistalloc(USPACE, 0, ptoa(physmem), 0, 0, , 1, 1);
-	if (error) {
-		if (!system)
-			return NULL;
-		panic("%s: uvm_pglistalloc failed: %d", __func__, error);
-	}
+	if (error)
+		return NULL;
 
 	/*
 	 * Get the physical address from the first page.



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

2018-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Mar 20 09:13:15 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-8]: nd6_nbr.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #645):
sys/netinet6/nd6_nbr.c: revision 1.153
Pull out a sleepable function (in6_selectsrc) from a pserialize read section


To generate a diff of this commit:
cvs rdiff -u -r1.138.6.4 -r1.138.6.5 src/sys/netinet6/nd6_nbr.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/netinet6/nd6_nbr.c
diff -u src/sys/netinet6/nd6_nbr.c:1.138.6.4 src/sys/netinet6/nd6_nbr.c:1.138.6.5
--- src/sys/netinet6/nd6_nbr.c:1.138.6.4	Mon Feb 26 13:36:01 2018
+++ src/sys/netinet6/nd6_nbr.c	Tue Mar 20 09:13:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_nbr.c,v 1.138.6.4 2018/02/26 13:36:01 martin Exp $	*/
+/*	$NetBSD: nd6_nbr.c,v 1.138.6.5 2018/03/20 09:13:15 bouyer Exp $	*/
 /*	$KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.138.6.4 2018/02/26 13:36:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.138.6.5 2018/03/20 09:13:15 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -459,12 +459,15 @@ nd6_ns_output(struct ifnet *ifp, const s
 		 * Otherwise, we perform the source address selection as usual.
 		 */
 		s = pserialize_read_enter();
-		if (hsrc && in6ifa_ifpwithaddr(ifp, hsrc))
+		if (hsrc && in6ifa_ifpwithaddr(ifp, hsrc)) {
+			pserialize_read_exit(s);
 			src = hsrc;
-		else {
+		} else {
 			int error;
 			struct sockaddr_in6 dst_sa;
 
+			pserialize_read_exit(s);
+
 			sockaddr_in6_init(_sa, >ip6_dst, 0, 0, 0);
 
 			error = in6_selectsrc(_sa, NULL,
@@ -480,7 +483,6 @@ nd6_ns_output(struct ifnet *ifp, const s
 			}
 			src = _in;
 		}
-		pserialize_read_exit(s);
 	} else {
 		/*
 		 * Source address for DAD packet must always be IPv6



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

2018-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Mar 20 09:10:57 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by alnsn in ticket #644):
sys/kern/exec_elf.c: revision 1.95
sys/kern/exec_elf.c: revision 1.96
Turn KASSERTS that check alignment which are user triggerable into errors.
=46rom alnsn
stsrt with an alignment of 1 (which means no alignment). From alnsn


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.90.4.1 src/sys/kern/exec_elf.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.90 src/sys/kern/exec_elf.c:1.90.4.1
--- src/sys/kern/exec_elf.c:1.90	Fri Apr 21 13:17:42 2017
+++ src/sys/kern/exec_elf.c	Tue Mar 20 09:10:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.90 2017/04/21 13:17:42 kamil Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.90.4.1 2018/03/20 09:10:57 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005, 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.90 2017/04/21 13:17:42 kamil Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.90.4.1 2018/03/20 09:10:57 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -101,7 +101,7 @@ extern struct emul emul_netbsd;
 static int
 elf_load_interp(struct lwp *, struct exec_package *, char *,
 struct exec_vmcmd_set *, u_long *, Elf_Addr *);
-static void
+static int
 elf_load_psection(struct exec_vmcmd_set *, struct vnode *, const Elf_Phdr *,
 Elf_Addr *, u_long *, int);
 
@@ -123,25 +123,30 @@ static void	elf_free_emul_arg(void *);
 #define	ELF_ROUND(a, b)		(((a) + (b) - 1) & ~((b) - 1))
 #define	ELF_TRUNC(a, b)		((a) & ~((b) - 1))
 
-static void
+static int
 elf_placedynexec(struct exec_package *epp, Elf_Ehdr *eh, Elf_Phdr *ph)
 {
 	Elf_Addr align, offset;
 	int i;
 
-	for (align = i = 0; i < eh->e_phnum; i++)
+	for (align = 1, i = 0; i < eh->e_phnum; i++)
 		if (ph[i].p_type == PT_LOAD && ph[i].p_align > align)
 			align = ph[i].p_align;
 
 	offset = (Elf_Addr)pax_aslr_exec_offset(epp, align);
 	if (offset < epp->ep_vm_minaddr)
 		offset = roundup(epp->ep_vm_minaddr, align);
-	KASSERT((offset & (align - 1)) == 0);
+	if ((offset & (align - 1)) != 0) {
+		DPRINTF("bad offset=%#jx align=%#jx",
+		(uintmax_t)offset, (uintmax_t)align);
+		return EINVAL;
+	}
 
 	for (i = 0; i < eh->e_phnum; i++)
 		ph[i].p_vaddr += offset;
 	epp->ep_entryoffset = offset;
 	eh->e_entry += offset;
+	return 0;
 }
 
 /*
@@ -305,7 +310,7 @@ elf_check_header(Elf_Ehdr *eh)
  *
  * Load a psection at the appropriate address
  */
-static void
+static int
 elf_load_psection(struct exec_vmcmd_set *vcset, struct vnode *vp,
 const Elf_Phdr *ph, Elf_Addr *addr, u_long *size, int flags)
 {
@@ -324,7 +329,12 @@ elf_load_psection(struct exec_vmcmd_set 
 		 * Make sure we are virtually aligned as we are supposed to be.
 		 */
 		diff = ph->p_vaddr - ELF_TRUNC(ph->p_vaddr, ph->p_align);
-		KASSERT(*addr - diff == ELF_TRUNC(*addr, ph->p_align));
+		if (*addr - diff != ELF_TRUNC(*addr, ph->p_align)) {
+			DPRINTF("bad alignment %#jx != %#jx\n",
+			(uintptr_t)(*addr - diff),
+			(uintptr_t)ELF_TRUNC(*addr, ph->p_align));
+			return EINVAL;
+		}
 		/*
 		 * But make sure to not map any pages before the start of the
 		 * psection by limiting the difference to within a page.
@@ -383,6 +393,7 @@ elf_load_psection(struct exec_vmcmd_set 
 		0, vmprot, flags & VMCMD_RELATIVE);
 		*size = msize;
 	}
+	return 0;
 }
 
 /*
@@ -580,8 +591,9 @@ elf_load_interp(struct lwp *l, struct ex
 flags = VMCMD_RELATIVE;
 			}
 			last_ph = [i];
-			elf_load_psection(vcset, vp, [i], ,
-			, flags);
+			if ((error = elf_load_psection(vcset, vp, [i], ,
+			, flags)) != 0)
+goto bad;
 			/*
 			 * If entry is within this psection then this
 			 * must contain the .text section.  *entryoff is
@@ -719,8 +731,8 @@ exec_elf_makecmds(struct lwp *l, struct 
 		pos = (Elf_Addr)startp;
 	}
 
-	if (is_dyn)
-		elf_placedynexec(epp, eh, ph);
+	if (is_dyn && (error = elf_placedynexec(epp, eh, ph)) != 0)
+		goto bad;
 
 	/*
 	 * Load all the necessary sections
@@ -731,8 +743,10 @@ exec_elf_makecmds(struct lwp *l, struct 
 
 		switch (ph[i].p_type) {
 		case PT_LOAD:
-			elf_load_psection(>ep_vmcmds, epp->ep_vp,
-			[i], , , VMCMD_FIXED);
+			if ((error = elf_load_psection(>ep_vmcmds,
+			epp->ep_vp, [i], , , VMCMD_FIXED))
+			!= 0)
+goto bad;
 
 			/*
 			 * Consider this as text segment, if it is executable.



CVS commit: [pgoyette-compat] src/sys

2018-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 20 08:11:26 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: ccd_60.c kern_time_50.c
src/sys/dev [pgoyette-compat]: ccd.c
src/sys/kern [pgoyette-compat]: files.kern
src/sys/rump/librump/rumpkern [pgoyette-compat]: Makefile.rumpkern
Added Files:
src/sys/kern [pgoyette-compat]: compat_stub.c
src/sys/sys [pgoyette-compat]: compat_stub.h

Log Message:
Initial implementation of sys/kern/kern_stup.c as discussed on tech-kern

For now, we only handle the dev/ccd and NTP needs;  more to follow.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/compat/common/ccd_60.c
cvs rdiff -u -r1.31.16.1 -r1.31.16.2 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.175.2.1 -r1.175.2.2 src/sys/dev/ccd.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.16.2.4 -r1.16.2.5 src/sys/kern/files.kern
cvs rdiff -u -r1.170 -r1.170.2.1 \
src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r0 -r1.1.2.1 src/sys/sys/compat_stub.h

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

Modified files:

Index: src/sys/compat/common/ccd_60.c
diff -u src/sys/compat/common/ccd_60.c:1.1.2.5 src/sys/compat/common/ccd_60.c:1.1.2.6
--- src/sys/compat/common/ccd_60.c:1.1.2.5	Mon Mar 19 21:53:04 2018
+++ src/sys/compat/common/ccd_60.c	Tue Mar 20 08:11:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd_60.c,v 1.1.2.5 2018/03/19 21:53:04 pgoyette Exp $	*/
+/*	$NetBSD: ccd_60.c,v 1.1.2.6 2018/03/20 08:11:25 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.1.2.5 2018/03/19 21:53:04 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.1.2.6 2018/03/20 08:11:25 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -45,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1
  * sizeof (size_t) == sizeof (uint64_t) as CCDIOCSET will
  * be the same as CCDIOCSET_60
  */
-#if 0
 static int
 compat_60_ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l,
 int (*f)(dev_t, u_long, void *, int, struct lwp *))
@@ -90,18 +90,17 @@ compat_60_ccdioctl(dev_t dev, u_long cmd
 		return ENOSYS;
 	}
 }
-#endif /* 0 */
 
 void
 ccd_60_init(void)
 {
 
-//	compat_ccd_ioctl_60 = compat_60_ccdioctl;
+	compat_ccd_ioctl_60 = compat_60_ccdioctl;
 }
 
 void
 ccd_60_fini(void)
 {
 
-//	compat_ccd_ioctl_60 = (void *)enosys;
+	compat_ccd_ioctl_60 = (void *)enosys;
 }

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.31.16.1 src/sys/compat/common/kern_time_50.c:1.31.16.2
--- src/sys/compat/common/kern_time_50.c:1.31.16.1	Mon Mar 19 21:54:43 2018
+++ src/sys/compat/common/kern_time_50.c	Tue Mar 20 08:11:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.31.16.1 2018/03/19 21:54:43 pgoyette Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.31.16.2 2018/03/20 08:11:25 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.31.16.1 2018/03/19 21:54:43 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.31.16.2 2018/03/20 08:11:25 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time_50
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -101,12 +102,9 @@ static const struct syscall_package kern
 	(sy_call_t *)compat_50_sys_timer_gettime },
 	{ SYS_compat_50___ntp_gettime30, 0,
 	(sy_call_t *)compat_50_sys___ntp_gettime30 },
+	{ SYS_compat_50___ntp_gettime30, 0,
+	(sy_call_t *)compat_50_sys___ntp_gettime30 },
 	{ 0, 0, NULL }
-	
-	   
-	   
-	   
-	   
 }; 
 
 int
@@ -556,10 +554,9 @@ int
 compat_50_sys___ntp_gettime30(struct lwp *l,
 const struct compat_50_sys___ntp_gettime30_args *uap, register_t *retval)
 {
-/* XXX
- * XXX need to detect if kernel has NTP at run-time!
- * XXX */
-#ifdef NTP
+	if (vec_ntp_gettime == NULL)
+		return ENOSYS;		/* No NTP available in kernel */
+
 	/* {
 		syscallarg(struct ntptimeval *) ntvp;
 	} */
@@ -568,7 +565,7 @@ compat_50_sys___ntp_gettime30(struct lwp
 	int error;
 
 	if (SCARG(uap, ntvp)) {
-		ntp_gettime();
+		(*vec_ntp_gettime)();
 		timespec_to_timespec50(, );
 		ntv50.maxerror = ntv.maxerror;
 		ntv50.esterror = ntv.esterror;
@@ -579,11 +576,8 @@ compat_50_sys___ntp_gettime30(struct lwp
 		if (error)
 			return error;
 	}
-	*retval = ntp_timestatus();
+	*retval = (*vec_ntp_timestatus)();
 	return 0;
-#else
-	return ENOSYS;
-#endif
 }
 
 static void

Index: src/sys/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.175.2.1 

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

2018-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 20 06:23:36 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_mod.c

Log Message:
Prep for additional version-specific compat modules; commented out for now.


To generate a diff of this commit:
cvs rdiff -u -r1.24.14.17 -r1.24.14.18 src/sys/compat/common/compat_mod.c

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

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.17 src/sys/compat/common/compat_mod.c:1.24.14.18
--- src/sys/compat/common/compat_mod.c:1.24.14.17	Mon Mar 19 21:54:43 2018
+++ src/sys/compat/common/compat_mod.c	Tue Mar 20 06:23:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.17 2018/03/19 21:54:43 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.18 2018/03/20 06:23:36 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.17 2018/03/19 21:54:43 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.18 2018/03/20 06:23:36 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -209,6 +209,38 @@ struct compat_init_fini {
 #ifdef COMPAT_50
 	{ compat_50_init, compat_50_fini },
 #endif
+#if 0	/* NOT YET */
+#ifdef COMPAT_40
+	{ compat_40_init, compat_40_fini },
+#endif
+#ifdef COMPAT_30
+	{ compat_30_init, compat_30_fini },
+#endif
+#ifdef COMPAT_20
+	{ compat_20_init, compat_20_fini },
+#endif
+#ifdef COMPAT_16
+	{ compat_16_init, compat_16_fini },
+#endif
+#ifdef COMPAT_14
+	{ compat_14_init, compat_14_fini },
+#endif
+#ifdef COMPAT_13
+	{ compat_13_init, compat_13_fini },
+#endif
+#ifdef COMPAT_12
+	{ compat_12_init, compat_12_fini },
+#endif
+#ifdef COMPAT_10
+	{ compat_10_init, compat_10_fini },
+#endif
+#ifdef COMPAT_09
+	{ compat_09_init, compat_09_fini },
+#endif
+#ifdef COMPAT_43
+	{ compat_43_init, compat_43_fini },
+#endif
+#endif /* 0 NOT YET */
 };
 
 static int