CVS commit: src/sys/dev/pci

2017-04-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 27 04:44:02 UTC 2017

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

Log Message:
Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
  storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
  enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
  required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/ppb.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/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.60 src/sys/dev/pci/ppb.c:1.61
--- src/sys/dev/pci/ppb.c:1.60	Wed Apr 26 08:00:03 2017
+++ src/sys/dev/pci/ppb.c	Thu Apr 27 04:44:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.60 2017/04/26 08:00:03 msaitoh Exp $	*/
+/*	$NetBSD: ppb.c,v 1.61 2017/04/27 04:44:02 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.60 2017/04/26 08:00:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.61 2017/04/27 04:44:02 msaitoh Exp $");
 
 #include 
 #include 
@@ -45,11 +45,15 @@ __KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.60
 #include 
 #include 
 
-#define	PCIE_SLCSR_NOTIFY_MASK	\
+#define	PCIE_SLCSR_ENABLE_MASK	\
 	(PCIE_SLCSR_ABE | PCIE_SLCSR_PFE | PCIE_SLCSR_MSE |	\
 	 PCIE_SLCSR_PDE | PCIE_SLCSR_CCE | PCIE_SLCSR_HPE |	\
 	 PCIE_SLCSR_DLLSCE)
 
+#define	PCIE_SLCSR_STATCHG_MASK	\
+	(PCIE_SLCSR_ABP | PCIE_SLCSR_PFD | PCIE_SLCSR_MSC |	\
+	 PCIE_SLCSR_PDC | PCIE_SLCSR_CC | PCIE_SLCSR_LACS)
+
 static const char pcie_linkspeed_strings[4][5] = {
 	"1.25", "2.5", "5.0", "8.0",
 };
@@ -241,14 +245,24 @@ ppbattach(device_t parent, device_t self
 	/* Check for PCI Express capabilities and setup hotplug support. */
 	if (pci_get_capability(pc, pa->pa_tag, PCI_CAP_PCIEXPRESS,
 	>sc_pciecapoff, ) && (reg & PCIE_XCAP_SI)) {
+		/*
+		 * First, disable all interrupts because BIOS might
+		 * enable them.
+		 */
+		reg = pci_conf_read(sc->sc_pc, sc->sc_tag,
+		sc->sc_pciecapoff + PCIE_SLCSR);
+		if (reg & PCIE_SLCSR_ENABLE_MASK) {
+			reg &= ~PCIE_SLCSR_ENABLE_MASK;
+			pci_conf_write(sc->sc_pc, sc->sc_tag,
+			sc->sc_pciecapoff + PCIE_SLCSR, reg);
+		}
 #ifdef PPB_USEINTR
 #if 0
 		/*
 		 * XXX Initialize workqueue or something else for
 		 * HotPlug support.
 		 */
-#endif
-
+#endif	
 		if (pci_intr_alloc(pa, >sc_pihp, NULL, 0) == 0)
 			sc->sc_intrhand = pci_intr_establish_xname(pc,
 			sc->sc_pihp[0], IPL_BIO, ppb_intr, sc,
@@ -268,17 +282,24 @@ ppbattach(device_t parent, device_t self
 			sc->sc_pciecapoff + PCIE_SLCSR, slcsr);
 
 			/* Enable interrupt. */
+			val = 0;
 			slcap = pci_conf_read(pc, pa->pa_tag,
 			sc->sc_pciecapoff + PCIE_SLCAP);
-			val = 0;
 			if (slcap & PCIE_SLCAP_ABP)
 val |= PCIE_SLCSR_ABE;
 			if (slcap & PCIE_SLCAP_PCP)
 val |= PCIE_SLCSR_PFE;
 			if (slcap & PCIE_SLCAP_MSP)
 val |= PCIE_SLCSR_MSE;
+#if 0
+			/*
+			 * XXX Disable for a while because setting
+			 * PCIE_SLCSR_CCE makes break device access on
+			 * some environment.
+			 */
 			if ((slcap & PCIE_SLCAP_NCCS) == 0)
 val |= PCIE_SLCSR_CCE;
+#endif
 			/* Attention indicator off by default */
 			if (slcap & PCIE_SLCAP_AIP) {
 val |= __SHIFTIN(PCIE_SLCSR_IND_OFF,
@@ -309,16 +330,6 @@ ppbattach(device_t parent, device_t self
 			pci_conf_write(pc, pa->pa_tag,
 			sc->sc_pciecapoff + PCIE_SLCSR, slcsr);
 		}
-#else
-		reg = pci_conf_read(sc->sc_pc, sc->sc_tag,
-		sc->sc_pciecapoff + PCIE_SLCSR);
-		if (reg & PCIE_SLCSR_NOTIFY_MASK) {
-			aprint_debug_dev(self,
-			"disabling notification events\n");
-			reg &= ~PCIE_SLCSR_NOTIFY_MASK;
-			pci_conf_write(sc->sc_pc, sc->sc_tag,
-			sc->sc_pciecapoff + PCIE_SLCSR, reg);
-		}
 #endif /* PPB_USEINTR */
 	}
 
@@ -389,7 +400,7 @@ ppbdetach(device_t self, int flags)
 	/* Clear any pending events and disable interrupt */
 	slcsr = pci_conf_read(sc->sc_pc, sc->sc_tag,
 	  sc->sc_pciecapoff + PCIE_SLCSR);
-	slcsr &= ~PCIE_SLCSR_NOTIFY_MASK;
+	slcsr &= ~PCIE_SLCSR_ENABLE_MASK;
 	pci_conf_write(sc->sc_pc, sc->sc_tag,
 		sc->sc_pciecapoff + PCIE_SLCSR, slcsr);
 
@@ -448,14 +459,22 @@ ppb_intr(void *arg)
 	device_t dev = sc->sc_dev;
 	pcireg_t reg;
 
-	sc->sc_ev_intr.ev_count++;
 	reg = pci_conf_read(sc->sc_pc, sc->sc_tag,
 	sc->sc_pciecapoff + PCIE_SLCSR);
 
+	/*
+	 * Not me. This check is only required for INTx.
+	 * ppb_intr() would be spilted int ppb_intr_legacy() and ppb_intr_msi()
+	 */
+	if ((reg & PCIE_SLCSR_STATCHG_MASK) == 0)
+		return 0;
+		
 	/* Clear interrupts. */
 	

CVS commit: src/sys/dev/pci

2017-04-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 27 04:26:12 UTC 2017

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

Log Message:
 Check slot registers if a device is PCI/PCI-X to PCI Express Bridge. Tested
with Pericom Semiconductors(Diodes) PI7C9X111SL PCIe to PCI Reverse Bridge.


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/dev/pci/pci_subr.c

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.178 src/sys/dev/pci/pci_subr.c:1.179
--- src/sys/dev/pci/pci_subr.c:1.178	Fri Apr 21 11:49:31 2017
+++ src/sys/dev/pci/pci_subr.c	Thu Apr 27 04:26:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.178 2017/04/21 11:49:31 kre Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.179 2017/04/27 04:26:12 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.178 2017/04/21 11:49:31 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.179 2017/04/27 04:26:12 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -1689,6 +1689,7 @@ pci_conf_print_pcie_cap(const pcireg_t *
 		break;
 	case PCIE_XCAP_TYPE_PCI2PCIE:	/* 0x8 */
 		printf("PCI/PCI-X to PCI Express Bridge\n");
+		check_slot = true;
 		break;
 	case PCIE_XCAP_TYPE_ROOT_INTEP:	/* 0x9 */
 		printf("Root Complex Integrated Endpoint\n");



CVS commit: src/sys/dev/pci

2017-04-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 27 03:57:18 UTC 2017

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

Log Message:
- Add some Pericom (Diodes) devices.
- s/P17C9/PI7C9/


To generate a diff of this commit:
cvs rdiff -u -r1.1286 -r1.1287 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.1286 src/sys/dev/pci/pcidevs:1.1287
--- src/sys/dev/pci/pcidevs:1.1286	Wed Apr 19 06:53:52 2017
+++ src/sys/dev/pci/pcidevs	Thu Apr 27 03:57:17 2017
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1286 2017/04/19 06:53:52 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1287 2017/04/27 03:57:17 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5632,8 +5632,20 @@ product PCTECH RZ1000	0x1000	RZ1000
 product PEAK PCAN	0x0001	PCAN CAN Controller
 
 /* Pericom Semiconductor products */
-product PERICOM P17C9X110	0xe110	P17C9X110 PCIe to PCI Bridge
-product PERICOM P17C9X	0xe111	P17C9X PCIe to PCI Bridge
+product PERICOM PI7C21P100	0x01a7	PI7C21P100 PCIX-PCIX
+product PERICOM PI7C9X20303UL	0x0303	PI7C9X20303UL 3port 3lane PCIe switch
+product PERICOM PI7C9X20505GP	0x0505	PI7C9X20505GP 5port 5lane PCIe switch
+product PERICOM PI7C9X20508GP	0x0508	PI7C9X20508GP 5port 8lane PCIe switch
+product PERICOM PI7C9X2G404SL	0x2404	PI7C9X2G404SL 4port 4lane PCIe Gen2 switch
+product PERICOM PI7C8140A	0x8140	PI7C8140A 2 port PCI-PCI Bridge
+product PERICOM PI7C8148	0x8148	PI7C8148 Asynchronous 2 port PCI-PCI Bridge
+product PERICOM PI7C8152	0x8152	PI7C8152 2 port PCI-PCI Bridge
+product PERICOM PI7C8154	0x8154	PI7C8154 Asynchronous 2 port PCI-PCI Bridge
+product PERICOM PI7C9X20303SL	0xa303	PI7C9X20303SL 3port 3lane PCIe switch
+product PERICOM PI7C9X20404SL	0xa404	PI7C9X20303SL 4port 4lane PCIe switch
+product PERICOM PI7C9X110	0xe110	PI7C9X110 PCIe to PCI Bridge
+product PERICOM PI7C9X111SL	0xe111	PI7C9X111SL PCIe to PCI Reverse Bridge
+product PERICOM PI7C9X130	0xe130	PI7C9X130 PCIE-PCIX Reverse Bridge
 
 /* Phobos products */
 product PHOBOS P1000	0x1000	P1000 Gigabit Ethernet



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

2017-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 26 22:41:59 UTC 2017

Modified Files:
src/sys/compat/linux32/arch/amd64: linux32_exec.h

Log Message:
catch up with unit fixes for es_arglen; consistently use bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/linux32/arch/amd64/linux32_exec.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/linux32/arch/amd64/linux32_exec.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.6 src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.7
--- src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.6	Fri Feb 21 02:53:53 2014
+++ src/sys/compat/linux32/arch/amd64/linux32_exec.h	Wed Apr 26 18:41:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_exec.h,v 1.6 2014/02/21 07:53:53 maxv Exp $ */
+/*	$NetBSD: linux32_exec.h,v 1.7 2017/04/26 22:41:59 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -75,10 +75,12 @@ struct linux32_extra_stack_data {
 };  
 #define LINUX32_ELF_AUX_ARGSIZ sizeof(struct linux32_extra_stack_data)
 
-#endif
+#else
 
 #define LINUX32_ELF_AUX_ARGSIZ \
-	(howmany(LINUX32_ELF_AUX_ENTRIES * sizeof(Aux32Info), sizeof(Elf32_Addr)) + LINUX32_RANDOM_BYTES)
+(LINUX32_ELF_AUX_ENTRIES * sizeof(Aux32Info) + LINUX32_RANDOM_BYTES)
+
+#endif
 
 #ifdef _KERNEL
 int linux32_exec_setup_stack(struct lwp *, struct exec_package *);



CVS commit: src/bin/sh

2017-04-26 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr 26 22:41:53 UTC 2017

Modified Files:
src/bin/sh: trap.c

Log Message:
Deal with traps that reset the (same) trap in the trap handler
(avoid referrencing memory that might have been freed).
>From FreeBSD (ages ago, just not committed until now...)


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/sh/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/bin/sh/trap.c
diff -u src/bin/sh/trap.c:1.37 src/bin/sh/trap.c:1.38
--- src/bin/sh/trap.c:1.37	Sat Aug 22 12:12:47 2015
+++ src/bin/sh/trap.c	Wed Apr 26 22:41:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.37 2015/08/22 12:12:47 christos Exp $	*/
+/*	$NetBSD: trap.c,v 1.38 2017/04/26 22:41:53 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)trap.c	8.5 (Berkeley) 6/5/95";
 #else
-__RCSID("$NetBSD: trap.c,v 1.37 2015/08/22 12:12:47 christos Exp $");
+__RCSID("$NetBSD: trap.c,v 1.38 2017/04/26 22:41:53 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -404,6 +404,7 @@ dotrap(void)
 {
 	int i;
 	int savestatus;
+	char *tr;
 
 	for (;;) {
 		for (i = 1 ; ; i++) {
@@ -414,7 +415,9 @@ dotrap(void)
 		}
 		gotsig[i - 1] = 0;
 		savestatus=exitstatus;
-		evalstring(trap[i], 0);
+		tr = savestr(trap[i]);		/* trap code may free trap[i] */
+		evalstring(tr, 0);
+		ckfree(tr);
 		exitstatus=savestatus;
 	}
 done:



CVS commit: src/sys/dev/wscons

2017-04-26 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 26 21:03:52 UTC 2017

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
properly optimize drawing stretches of blanks that are interrupted only by
a change in background colour or flags


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.35 src/sys/dev/wscons/wsdisplay_vcons.c:1.36
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.35	Sun Nov  8 16:49:20 2015
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Wed Apr 26 21:03:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.35 2015/11/08 16:49:20 christos Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.36 2017/04/26 21:03:52 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.35 2015/11/08 16:49:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.36 2017/04/26 21:03:52 macallan Exp $");
 
 #include 
 #include 
@@ -421,7 +421,7 @@ vcons_redraw_screen(struct vcons_screen 
 	int i, j, offset, boffset = 0, start = -1;
 
 	mask = 0x00ff00ff;	/* background and flags */
-	cmp = -1;		/* never match anything */
+	cmp = 0x;	/* never match anything */
 	vcons_lock(scr);
 	if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
 
@@ -474,11 +474,12 @@ vcons_redraw_screen(struct vcons_screen 
 	} else if (acmp != last_a) {
 		/*
 		 * different attr, need to
-		 * flush 
+		 * flush & restart 
 		 */
 		vd->erasecols(ri, i, start,
 		j - start, last_a);
-		start = -1;
+		start = j;
+		last_a = acmp;
 	}
 } else {
 	if (start != -1) {



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

2017-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 26 18:20:01 UTC 2017

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

Log Message:
Catch up with GENERIC changes.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/amd64/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.56 src/sys/arch/amd64/conf/ALL:1.57
--- src/sys/arch/amd64/conf/ALL:1.56	Tue Apr 18 15:09:12 2017
+++ src/sys/arch/amd64/conf/ALL	Wed Apr 26 14:20:01 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.56 2017/04/18 19:09:12 riastradh Exp $
+# $NetBSD: ALL,v 1.57 2017/04/26 18:20:01 christos 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.56 $"
+#ident		"ALL-$Revision: 1.57 $"
 
 maxusers	64		# estimated number of users
 
@@ -41,6 +41,13 @@ vmt0		at cpu0		# VMware Tools
 
 options 	PMC	# performance-monitoring counters support
 
+# Beep when it is safe to power down the system (requires sysbeep)
+options 	BEEP_ONHALT
+# Some tunable details of the above feature (default values used below)
+options 	BEEP_ONHALT_COUNT=3	# Times to beep
+options 	BEEP_ONHALT_PITCH=1500	# Default frequency (in Hz)
+options 	BEEP_ONHALT_PERIOD=250	# Default duration (in msecs)
+
 options 	MULTIBOOT	# Multiboot support (see multiboot(8))
 
 # delay between "rebooting ..." message and hardware reset, in milliseconds
@@ -95,13 +102,6 @@ options 	USERCONF	# userconf(4) support
 options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 
-# Beep when it is safe to power down the system (requires sysbeep)
-options 	BEEP_ONHALT
-# Some tunable details of the above feature (default values used below)
-options 	BEEP_ONHALT_COUNT=3	# Times to beep
-options 	BEEP_ONHALT_PITCH=1500	# Default frequency (in Hz)
-options 	BEEP_ONHALT_PERIOD=250	# Default duration (in msecs)
-
 # Alternate buffer queue strategies for better responsiveness under high
 # disk I/O load.
 options 	BUFQ_READPRIO
@@ -109,9 +109,11 @@ options 	BUFQ_PRIOCSCAN
 
 # Diagnostic/debugging support options
 options 	DIAGNOSTIC	# inexpensive kernel consistency checks
+# XXX to be commented out on release branch
 options 	DEBUG		# expensive debugging checks/support
 options 	LOCKDEBUG	# expensive locking checks/support
 options 	DDB		# in-kernel debugger
+options 	DDB_COMMANDONENTER="bt"	# execute command when ddb is entered
 options 	DDB_ONPANIC=1	# see also sysctl(7): `ddb.onpanic'
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 options 	DDB_VERBOSE_HELP
@@ -119,6 +121,7 @@ options 	KGDB		# remote debugger
 options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
 #options 	IPKDB		# IP Kernel Debugger
 #options 	IPKDBKEY="\"Pass_phrase_to_debug_over_network\""
+makeoptions	COPTS="-O2 -fno-omit-frame-pointer"
 makeoptions	DEBUG="-g"	# compile full symbol table
 options 	SYSCALL_STATS	# per syscall counts
 options 	SYSCALL_TIMES	# per syscall times
@@ -128,14 +131,15 @@ options 	UVMHIST		# kernhist for uvm sub
 options 	BIOHIST		# kernhist for buff I/O
 
 # Compatibility options
-#options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI
-#options 	COMPAT_09	# NetBSD 0.9,
-#options 	COMPAT_10	# NetBSD 1.0,
-#options 	COMPAT_11	# NetBSD 1.1,
-#options 	COMPAT_12	# NetBSD 1.2 (and 386BSD and BSDI),
-#options 	COMPAT_13	# NetBSD 1.3 (and 386BSD and BSDI),
-#options 	COMPAT_14	# NetBSD 1.4,
-#options 	COMPAT_15	# NetBSD 1.5,
+options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI
+options 	EXEC_AOUT	# required by binaries from before 1.5
+options 	COMPAT_09	# NetBSD 0.9,
+options 	COMPAT_10	# NetBSD 1.0,
+options 	COMPAT_11	# NetBSD 1.1,
+options 	COMPAT_12	# NetBSD 1.2 (and 386BSD and BSDI),
+options 	COMPAT_13	# NetBSD 1.3 (and 386BSD and BSDI),
+options 	COMPAT_14	# NetBSD 1.4,
+options 	COMPAT_15	# NetBSD 1.5,
 options 	COMPAT_16	# NetBSD 1.6,
 options 	COMPAT_20	# NetBSD 2.0,
 options 	COMPAT_30	# NetBSD 3.0,
@@ -148,11 +152,11 @@ options 	COMPAT_44	# 4.4BSD
 options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
 
-options 	COMPAT_NETBSD32 # NetBSD 32-bit
 options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
-options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
+options 	COMPAT_NETBSD32 # NetBSD 32-bit
 options 	COMPAT_LINUX	# binary compatibility with Linux
 options 	COMPAT_LINUX32	# binary compatibility with Linux 32-bit
+options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
 options 	COMPAT_FREEBSD	# binary compatibility with FreeBSD
 options 	COMPAT_NDIS	# NDIS network driver
 options 	COMPAT_BSDPTY	# 

CVS commit: src/bin/sh

2017-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 26 17:43:33 UTC 2017

Modified Files:
src/bin/sh: expand.c expand.h

Log Message:
Convert the pattern matcher from recursive to backtracking (from FreeBSD).


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/bin/sh/expand.c
cvs rdiff -u -r1.20 -r1.21 src/bin/sh/expand.h

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

Modified files:

Index: src/bin/sh/expand.c
diff -u src/bin/sh/expand.c:1.104 src/bin/sh/expand.c:1.105
--- src/bin/sh/expand.c:1.104	Mon Mar 20 07:48:01 2017
+++ src/bin/sh/expand.c	Wed Apr 26 13:43:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.104 2017/03/20 11:48:01 kre Exp $	*/
+/*	$NetBSD: expand.c,v 1.105 2017/04/26 17:43:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c	8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.104 2017/03/20 11:48:01 kre Exp $");
+__RCSID("$NetBSD: expand.c,v 1.105 2017/04/26 17:43:33 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -52,6 +52,7 @@ __RCSID("$NetBSD: expand.c,v 1.104 2017/
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Routines to expand arguments to commands.  We have to deal with
@@ -112,8 +113,9 @@ STATIC void expmeta(char *, char *);
 STATIC void addfname(char *);
 STATIC struct strlist *expsort(struct strlist *);
 STATIC struct strlist *msort(struct strlist *, int);
-STATIC int pmatch(char *, char *, int);
+STATIC int patmatch(const char *, const char *, int);
 STATIC char *cvtnum(int, char *);
+static int collate_range_cmp(wchar_t, wchar_t);
 
 /*
  * Expand shell variables and backquotes inside a here document.
@@ -129,6 +131,18 @@ expandhere(union node *arg, int fd)
 }
 
 
+static int
+collate_range_cmp(wchar_t c1, wchar_t c2)
+{
+	wchar_t s1[2], s2[2];
+
+	s1[0] = c1;
+	s1[1] = L'\0';
+	s2[0] = c2;
+	s2[1] = L'\0';
+	return (wcscoll(s1, s2));
+}
+
 /*
  * Perform variable substitution and command substitution on an argument,
  * placing the resulting list of arguments in arglist.  If EXP_FULL is true,
@@ -1399,7 +1413,7 @@ msort(struct strlist *list, int len)
  * pointer is stored into *end.
  */
 static int
-match_charclass(char *p, wchar_t chr, char **end)
+match_charclass(const char *p, wchar_t chr, const char **end)
 {
 	char name[20];
 	char *nameend;
@@ -1427,35 +1441,29 @@ match_charclass(char *p, wchar_t chr, ch
  * Returns true if the pattern matches the string.
  */
 
-int
-patmatch(char *pattern, char *string, int squoted)
-{
-#ifdef notdef
-	if (pattern[0] == '!' && pattern[1] == '!')
-		return 1 - pmatch(pattern + 2, string);
-	else
-#endif
-		return pmatch(pattern, string, squoted);
-}
-
-
 STATIC int
-pmatch(char *pattern, char *string, int squoted)
+patmatch(const char *pattern, const char *string, int squoted)
 {
-	char *p, *q, *end;
+	const char *p, *q, *end;
+	const char *bt_p, *bt_q;
 	char c;
+	wchar_t wc, wc2;
 
 	p = pattern;
 	q = string;
+	bt_p = NULL;
+	bt_q = NULL;
 	for (;;) {
 		switch (c = *p++) {
 		case '\0':
-			goto breakloop;
+			if (*q != '\0')
+goto backtrack;
+			return 1;
 		case CTLESC:
 			if (squoted && *q == CTLESC)
 q++;
 			if (*q++ != *p++)
-return 0;
+goto backtrack;
 			break;
 		case CTLQUOTEMARK:
 			continue;
@@ -1482,17 +1490,19 @@ pmatch(char *pattern, char *string, int 
 	q++;
 }
 			}
-			do {
-if (pmatch(p, q, squoted))
-	return 1;
-if (squoted && *q == CTLESC)
-	q++;
-			} while (*q++ != '\0');
-			return 0;
+			/*
+			 * First try the shortest match for the '*' that
+			 * could work. We can forget any earlier '*' since
+			 * there is no way having it match more characters
+			 * can help us, given that we are already here.
+			 */
+			bt_p = p;
+			bt_q = q;
+			break;
 		case '[': {
-			char *endp;
+			const char *savep, *saveq, *endp;
 			int invert, found;
-			char chr;
+			unsigned char chr;
 
 			endp = p;
 			if (*endp == '!')
@@ -1508,20 +1518,25 @@ pmatch(char *pattern, char *string, int 
 	break;
 			}
 			invert = 0;
-			if (*p == '!') {
+			savep = p, saveq = q;
+			invert = 0;
+			if (*p == '!' || *p == '^') {
 invert++;
 p++;
 			}
 			found = 0;
-			chr = *q++;
-			if (squoted && chr == CTLESC)
-chr = *q++;
-			if (chr == '\0')
+			if (*q == '\0')
 return 0;
+			chr = (unsigned char)*q++;
 			c = *p++;
 			do {
 if (c == CTLQUOTEMARK)
 	continue;
+if (c == '\0') {
+	p = savep, q = saveq;
+	c = '[';
+	goto dft;
+}
 if (c == '[' && *p == ':') {
 	found |= match_charclass(p, chr, );
 	if (end != NULL)
@@ -1529,36 +1544,46 @@ pmatch(char *pattern, char *string, int 
 }
 if (c == CTLESC)
 	c = *p++;
+wc = (unsigned char)c;
 if (*p == '-' && p[1] != ']') {
 	p++;
-	while (*p == CTLQUOTEMARK)
-		p++;
 	if (*p == CTLESC)
 		p++;
-	if (chr >= c && chr <= *p)
+	wc2 = 

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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:58:53 UTC 2017

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

Log Message:
Tickets #1397 and #1410


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.39 -r1.1.2.40 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.39 src/doc/CHANGES-7.0.3:1.1.2.40
--- src/doc/CHANGES-7.0.3:1.1.2.39	Fri Apr 21 05:18:07 2017
+++ src/doc/CHANGES-7.0.3	Wed Apr 26 14:58:53 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.39 2017/04/21 05:18:07 snj Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.40 2017/04/26 14:58:53 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -1864,3 +1864,17 @@ external/bsd/bind/dist/version  
 	Update BIND to 9.10.4-P8.
 	[spz, ticket #1404]
 
+sys/arch/amd64/amd64/locore.S			1.122 (via patch)
+sys/arch/amd64/amd64/machdep.c			1.254 (via patch)
+sys/arch/amd64/amd64/trap.c			1.95 (via patch)
+
+	Remove the call gate on amd64, it is useless and vulnerable.
+	[bsiegert, ticket #1397]
+
+sys/arch/amd64/amd64/trap.c			1.96
+
+	Restore the ability to run netbsd 1.0 32-bit executables
+	by checking for the relevant lcall instruction in the trap handler
+	and treating it as a syscall.
+	[chs, ticket #1410]
+



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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:57:44 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7-0]: trap.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #1410):
sys/arch/amd64/amd64/trap.c: revision 1.96
restore the ability to run netbsd 1.0 32-bit executables
by checking for the relevant lcall instruction in the trap handler
and treating it as a syscall.


To generate a diff of this commit:
cvs rdiff -u -r1.78.6.2 -r1.78.6.3 src/sys/arch/amd64/amd64/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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78.6.2 src/sys/arch/amd64/amd64/trap.c:1.78.6.3
--- src/sys/arch/amd64/amd64/trap.c:1.78.6.2	Wed Apr 26 14:50:51 2017
+++ src/sys/arch/amd64/amd64/trap.c	Wed Apr 26 14:57:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78.6.2 2017/04/26 14:50:51 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.6.3 2017/04/26 14:57:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,12 +68,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.6.2 2017/04/26 14:50:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.6.3 2017/04/26 14:57:44 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
 #include "opt_xen.h"
 #include "opt_dtrace.h"
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
 
 #include 
 #include 
@@ -90,6 +92,11 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.7
 
 #include 
 
+#ifdef COMPAT_NETBSD32
+#include 
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -389,6 +396,27 @@ kernelfault:
 #endif
 
 	case T_PROTFLT|T_USER:		/* protection fault */
+#if defined(COMPAT_NETBSD32) && defined(COMPAT_10)
+	{
+		static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
+		const size_t sz = sizeof(lcall);
+		char tmp[sz];
+
+		/* Check for the oosyscall lcall instruction. */
+		if (p->p_emul == _netbsd32 &&
+		frame->tf_rip < VM_MAXUSER_ADDRESS32 - sz &&
+		copyin((void *)frame->tf_rip, tmp, sz) == 0 &&
+		memcmp(tmp, lcall, sz) == 0) {
+
+			/* Advance past the lcall. */
+			frame->tf_rip += sz;
+
+			/* Do the syscall. */
+			p->p_md.md_syscall(frame);
+			goto out;
+		}
+	}
+#endif
 	case T_TSSFLT|T_USER:
 	case T_SEGNPFLT|T_USER:
 	case T_STKFLT|T_USER:



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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:57:19 UTC 2017

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

Log Message:
Tickets #1397 and #1410


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/doc/CHANGES-7.1.1

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

Modified files:

Index: src/doc/CHANGES-7.1.1
diff -u src/doc/CHANGES-7.1.1:1.1.2.6 src/doc/CHANGES-7.1.1:1.1.2.7
--- src/doc/CHANGES-7.1.1:1.1.2.6	Fri Apr 21 05:22:23 2017
+++ src/doc/CHANGES-7.1.1	Wed Apr 26 14:57:19 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.1,v 1.1.2.6 2017/04/21 05:22:23 snj Exp $
+# $NetBSD: CHANGES-7.1.1,v 1.1.2.7 2017/04/26 14:57:19 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.1.1
 release:
@@ -557,3 +557,17 @@ external/bsd/bind/dist/version  
 	Update BIND to 9.10.4-P8.
 	[spz, ticket #1404]
 
+sys/arch/amd64/amd64/locore.S			1.122 (via patch)
+sys/arch/amd64/amd64/machdep.c			1.254 (via patch)
+sys/arch/amd64/amd64/trap.c			1.95 (via patch)
+
+	Remove the call gate on amd64, it is useless and vulnerable.
+	[bsiegert, ticket #1397]
+
+sys/arch/amd64/amd64/trap.c			1.96
+
+	Restore the ability to run netbsd 1.0 32-bit executables
+	by checking for the relevant lcall instruction in the trap handler
+	and treating it as a syscall.
+	[chs, ticket #1410]
+



CVS commit: src/lib/libc/gen

2017-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 26 14:56:54 UTC 2017

Modified Files:
src/lib/libc/gen: glob.c

Log Message:
Switch from a recursive pattern matching algorithm to handle '*'
to a backtracking one. Avoids DoS attacks with patterns "a*a*a*a*a*...b"
matching against "..." https://research.swtch.com/glob


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/gen/glob.c

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

Modified files:

Index: src/lib/libc/gen/glob.c
diff -u src/lib/libc/gen/glob.c:1.36 src/lib/libc/gen/glob.c:1.37
--- src/lib/libc/gen/glob.c:1.36	Sun Sep  4 14:27:08 2016
+++ src/lib/libc/gen/glob.c	Wed Apr 26 10:56:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: glob.c,v 1.36 2016/09/04 18:27:08 joerg Exp $	*/
+/*	$NetBSD: glob.c,v 1.37 2017/04/26 14:56:54 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)glob.c	8.3 (Berkeley) 10/13/93";
 #else
-__RCSID("$NetBSD: glob.c,v 1.36 2016/09/04 18:27:08 joerg Exp $");
+__RCSID("$NetBSD: glob.c,v 1.37 2017/04/26 14:56:54 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -936,39 +936,45 @@ nospace:
 
 
 /*
- * pattern matching function for filenames.  Each occurrence of the *
- * pattern causes a recursion level.
+ * pattern matching function for filenames.
  */
 static int
 match(const Char *name, const Char *pat, const Char *patend)
 {
 	int ok, negate_range;
 	Char c, k;
+	const Char *patNext, *nameNext, *nameStart, *nameEnd;
 
 	_DIAGASSERT(name != NULL);
 	_DIAGASSERT(pat != NULL);
 	_DIAGASSERT(patend != NULL);
-
-	while (pat < patend) {
-		c = *pat++;
+	patNext = pat;
+	nameStart = nameNext = name;
+	nameEnd = NULL;
+
+	while (pat < patend || *name) {
+		c = *pat;
+		if (*name == EOS)
+			nameEnd = name;
 		switch (c & M_MASK) {
 		case M_ALL:
-			while (pat < patend && (*pat & M_MASK) == M_ALL)
-pat++;	/* eat consecutive '*' */
-			if (pat == patend)
-return 1;
-			for (; !match(name, pat, patend); name++)
-if (*name == EOS)
-	return 0;
-			return 1;
+			while (pat[1] == '*') pat++;
+			patNext = pat;
+			nameNext = name + 1;
+			pat++;
+			continue;
 		case M_ONE:
-			if (*name++ == EOS)
-return 0;
-			break;
+			if (*name == EOS)
+break;
+			pat++;
+			name++;
+			continue;
 		case M_SET:
 			ok = 0;
-			if ((k = *name++) == EOS)
-return 0;
+			if ((k = *name) == EOS)
+break;
+			pat++;
+			name++;
 			if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
 ++pat;
 			while (((c = *pat++) & M_MASK) != M_END)
@@ -979,15 +985,24 @@ match(const Char *name, const Char *pat,
 } else if (c == k)
 	ok = 1;
 			if (ok == negate_range)
-return 0;
-			break;
+break;
+			continue;
 		default:
-			if (*name++ != c)
-return 0;
-			break;
+			if (*name != c)
+break;
+			pat++;
+			name++;
+			continue;
 		}
+		if (nameNext != nameStart
+		&& (nameEnd == NULL || nameNext <= nameEnd)) {
+			pat = patNext;
+			name = nameNext;
+			continue;
+		}
+		return 0;
 	}
-	return *name == EOS;
+	return 1;
 }
 
 /* Free allocated data belonging to a glob_t structure. */



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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:56:30 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7-1]: trap.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #1410):
sys/arch/amd64/amd64/trap.c: revision 1.96
restore the ability to run netbsd 1.0 32-bit executables
by checking for the relevant lcall instruction in the trap handler
and treating it as a syscall.


To generate a diff of this commit:
cvs rdiff -u -r1.78.10.2 -r1.78.10.3 src/sys/arch/amd64/amd64/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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78.10.2 src/sys/arch/amd64/amd64/trap.c:1.78.10.3
--- src/sys/arch/amd64/amd64/trap.c:1.78.10.2	Wed Apr 26 14:51:58 2017
+++ src/sys/arch/amd64/amd64/trap.c	Wed Apr 26 14:56:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78.10.2 2017/04/26 14:51:58 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.10.3 2017/04/26 14:56:30 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,12 +68,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.10.2 2017/04/26 14:51:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.10.3 2017/04/26 14:56:30 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
 #include "opt_xen.h"
 #include "opt_dtrace.h"
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
 
 #include 
 #include 
@@ -90,6 +92,11 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.7
 
 #include 
 
+#ifdef COMPAT_NETBSD32
+#include 
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -389,6 +396,27 @@ kernelfault:
 #endif
 
 	case T_PROTFLT|T_USER:		/* protection fault */
+#if defined(COMPAT_NETBSD32) && defined(COMPAT_10)
+	{
+		static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
+		const size_t sz = sizeof(lcall);
+		char tmp[sz];
+
+		/* Check for the oosyscall lcall instruction. */
+		if (p->p_emul == _netbsd32 &&
+		frame->tf_rip < VM_MAXUSER_ADDRESS32 - sz &&
+		copyin((void *)frame->tf_rip, tmp, sz) == 0 &&
+		memcmp(tmp, lcall, sz) == 0) {
+
+			/* Advance past the lcall. */
+			frame->tf_rip += sz;
+
+			/* Do the syscall. */
+			p->p_md.md_syscall(frame);
+			goto out;
+		}
+	}
+#endif
 	case T_TSSFLT|T_USER:
 	case T_SEGNPFLT|T_USER:
 	case T_STKFLT|T_USER:



CVS commit: [netbsd-7] src/doc

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:55:52 UTC 2017

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

Log Message:
Tickets #1397 and #1410


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/doc/CHANGES-7.2

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.13 src/doc/CHANGES-7.2:1.1.2.14
--- src/doc/CHANGES-7.2:1.1.2.13	Fri Apr 21 05:24:01 2017
+++ src/doc/CHANGES-7.2	Wed Apr 26 14:55:52 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.13 2017/04/21 05:24:01 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.14 2017/04/26 14:55:52 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -997,3 +997,17 @@ external/bsd/bind/dist/version  
 	Update BIND to 9.10.4-P8.
 	[spz, ticket #1404]
 
+sys/arch/amd64/amd64/locore.S			1.122 (via patch)
+sys/arch/amd64/amd64/machdep.c			1.254 (via patch)
+sys/arch/amd64/amd64/trap.c			1.95 (via patch)
+
+	Remove the call gate on amd64, it is useless and vulnerable.
+	[bsiegert, ticket #1397]
+
+sys/arch/amd64/amd64/trap.c			1.96
+
+	Restore the ability to run netbsd 1.0 32-bit executables
+	by checking for the relevant lcall instruction in the trap handler
+	and treating it as a syscall.
+	[chs, ticket #1410]
+



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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:54:57 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7]: trap.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #1410):
sys/arch/amd64/amd64/trap.c: revision 1.96
restore the ability to run netbsd 1.0 32-bit executables
by checking for the relevant lcall instruction in the trap handler
and treating it as a syscall.


To generate a diff of this commit:
cvs rdiff -u -r1.78.4.2 -r1.78.4.3 src/sys/arch/amd64/amd64/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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78.4.2 src/sys/arch/amd64/amd64/trap.c:1.78.4.3
--- src/sys/arch/amd64/amd64/trap.c:1.78.4.2	Wed Apr 26 14:52:50 2017
+++ src/sys/arch/amd64/amd64/trap.c	Wed Apr 26 14:54:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.4.3 2017/04/26 14:54:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,12 +68,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.3 2017/04/26 14:54:57 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
 #include "opt_xen.h"
 #include "opt_dtrace.h"
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
 
 #include 
 #include 
@@ -90,6 +92,11 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.7
 
 #include 
 
+#ifdef COMPAT_NETBSD32
+#include 
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -389,6 +396,27 @@ kernelfault:
 #endif
 
 	case T_PROTFLT|T_USER:		/* protection fault */
+#if defined(COMPAT_NETBSD32) && defined(COMPAT_10)
+	{
+		static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
+		const size_t sz = sizeof(lcall);
+		char tmp[sz];
+
+		/* Check for the oosyscall lcall instruction. */
+		if (p->p_emul == _netbsd32 &&
+		frame->tf_rip < VM_MAXUSER_ADDRESS32 - sz &&
+		copyin((void *)frame->tf_rip, tmp, sz) == 0 &&
+		memcmp(tmp, lcall, sz) == 0) {
+
+			/* Advance past the lcall. */
+			frame->tf_rip += sz;
+
+			/* Do the syscall. */
+			p->p_md.md_syscall(frame);
+			goto out;
+		}
+	}
+#endif
 	case T_TSSFLT|T_USER:
 	case T_SEGNPFLT|T_USER:
 	case T_STKFLT|T_USER:



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

2017-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 26 14:52:57 UTC 2017

Modified Files:
src/tests/lib/libc/gen: t_glob.c

Log Message:
- add range tests
- be more descriptive about errors


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/gen/t_glob.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_glob.c
diff -u src/tests/lib/libc/gen/t_glob.c:1.5 src/tests/lib/libc/gen/t_glob.c:1.6
--- src/tests/lib/libc/gen/t_glob.c:1.5	Sat Jan 14 15:47:41 2017
+++ src/tests/lib/libc/gen/t_glob.c	Wed Apr 26 10:52:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $	*/
+/*	$NetBSD: t_glob.c,v 1.6 2017/04/26 14:52:57 christos Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $");
+__RCSID("$NetBSD: t_glob.c,v 1.6 2017/04/26 14:52:57 christos Exp $");
 
 #include 
 
@@ -85,8 +85,16 @@ static struct gl_dir d[] = {
 	{ "a/b", b, __arraycount(b), 0 },
 };
 
+static const char *glob_range[] = {
+	"a/b/x", "a/b/y", "a/b/z",
+};
+
+static const char *glob_range_not[] = {
+	"a/b/w",
+};
+
 static const char *glob_star[] = {
-"a/1", "a/3", "a/4", "a/b", "a/b/w", "a/b/x", "a/b/y", "a/b/z",
+	"a/1", "a/3", "a/4", "a/b", "a/b/w", "a/b/x", "a/b/y", "a/b/z",
 };
 
 static const char *glob_star_not[] = {
@@ -192,7 +200,9 @@ run(const char *p, int flags, const char
 {
 	glob_t gl;
 	size_t i;
+	int e;
 
+	DPRINTF(("pattern %s\n", p));
 	memset(, 0, sizeof(gl));
 	gl.gl_opendir = gl_opendir;
 	gl.gl_readdir = gl_readdir;
@@ -200,18 +210,63 @@ run(const char *p, int flags, const char
 	gl.gl_stat = gl_stat;
 	gl.gl_lstat = gl_lstat;
 
-	RZ(glob(p, GLOB_ALTDIRFUNC | flags, NULL, ));
+	switch ((e = glob(p, GLOB_ALTDIRFUNC | flags, NULL, ))) {
+	case 0:
+		break;
+	case GLOB_NOSPACE:
+		fprintf(stderr, "Malloc call failed.\n");
+		goto bad;
+	case GLOB_ABORTED:
+		fprintf(stderr, "Unignored error.\n");
+		goto bad;
+	case GLOB_NOMATCH:
+		fprintf(stderr, "No match, and GLOB_NOCHECK was not set.\n");
+		goto bad;
+	case GLOB_NOSYS:
+		fprintf(stderr, "Implementation does not support function.\n");
+		goto bad;
+	default:
+		fprintf(stderr, "Unknown error %d.\n", e);
+		goto bad;
+	}
 
 	for (i = 0; i < gl.gl_pathc; i++)
 		DPRINTF(("%s\n", gl.gl_pathv[i]));
 
 	ATF_CHECK(len == gl.gl_pathc);
-	for (i = 0; i < gl.gl_pathc; i++)
+	for (i = 0; i < gl.gl_pathc && i < len; i++)
 		ATF_CHECK_STREQ(gl.gl_pathv[i], res[i]);
 
 	globfree();
+	return;
+bad:
+	ATF_REQUIRE_MSG(e == 0, "No match for `%s'", p);
+}
+
+
+ATF_TC(glob_range);
+ATF_TC_HEAD(glob_range, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Test glob(3) range");
+}
+
+ATF_TC_BODY(glob_range, tc)
+{
+	run("a/b/[x-z]", 0, glob_range, __arraycount(glob_range));
+}
+
+ATF_TC(glob_range_not);
+ATF_TC_HEAD(glob_range_not, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Test glob(3) ! range");
 }
 
+ATF_TC_BODY(glob_range_not, tc)
+{
+	run("a/b/[!x-z]", 0, glob_range_not, __arraycount(glob_range_not));
+}
 
 ATF_TC(glob_star);
 ATF_TC_HEAD(glob_star, tc)
@@ -262,6 +317,8 @@ ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, glob_star);
 	ATF_TP_ADD_TC(tp, glob_star_not);
+	ATF_TP_ADD_TC(tp, glob_range);
+	ATF_TP_ADD_TC(tp, glob_range_not);
 /*
  * Remove this test for now - the GLOB_NOCHECK return value has been
  * re-defined to return a modified pattern in revision 1.33 of glob.c



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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:51:58 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7-1]: locore.S machdep.c trap.c

Log Message:
Pull up following revision(s) (requested by bsiegert in ticket #1397):

sys/arch/amd64/amd64/locore.S   1.122 (via patch)
sys/arch/amd64/amd64/machdep.c  1.254 (via patch)
sys/arch/amd64/amd64/trap.c 1.95 (via patch)

Remove the call gate on amd64, it is useless and vulnerable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.76.8.1 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.211 -r1.211.10.1 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.78.10.1 -r1.78.10.2 src/sys/arch/amd64/amd64/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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.76 src/sys/arch/amd64/amd64/locore.S:1.76.8.1
--- src/sys/arch/amd64/amd64/locore.S:1.76	Fri May 16 00:48:41 2014
+++ src/sys/arch/amd64/amd64/locore.S	Wed Apr 26 14:51:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.76 2014/05/16 00:48:41 rmind Exp $	*/
+/*	$NetBSD: locore.S,v 1.76.8.1 2017/04/26 14:51:58 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1287,27 +1287,6 @@ NENTRY(lwp_trampoline)
 END(lwp_trampoline)
 
 /*
- * oosyscall()
- *
- * Old call gate entry for syscall. only needed if we're
- * going to support running old i386 NetBSD 1.0 or ibcs2 binaries, etc,
- * on NetBSD/amd64.
- * The 64bit call gate can't request that arguments be copied from the
- * user stack (which the i386 code uses to get a gap for the flags).
- * push/pop are :: cycles.
- */
-IDTVEC(oosyscall)
-	/* Set rflags in trap frame. */
-	pushq	(%rsp)		# move user's %eip
-	pushq	16(%rsp)	# and %cs
-	popq	8(%rsp)
-	pushfq
-	popq	16(%rsp)
-	pushq	$7		# size of instruction for restart
-	jmp	osyscall1
-IDTVEC_END(oosyscall)
-
-/*
  * osyscall()
  *
  * Trap gate entry for int $80 syscall, also used by sigreturn.

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.211 src/sys/arch/amd64/amd64/machdep.c:1.211.10.1
--- src/sys/arch/amd64/amd64/machdep.c:1.211	Mon May 12 22:50:03 2014
+++ src/sys/arch/amd64/amd64/machdep.c	Wed Apr 26 14:51:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $	*/
+/*	$NetBSD: machdep.c,v 1.211.10.1 2017/04/26 14:51:58 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211.10.1 2017/04/26 14:51:58 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1696,10 +1696,7 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(GDT_ADDR_MEM(gdtstore, GUDATA_SEL), 0,
 	x86_btop(VM_MAXUSER_ADDRESS) - 1, SDT_MEMRWA, SEL_UPL, 1, 0, 1);
 
-	/* make ldt gates and memory segments */
-	setgate((struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	(oosyscall), 0, SDT_SYS386CGT, SEL_UPL,
-	GSEL(GCODE_SEL, SEL_KPL));
+	/* make ldt memory segments */
 	*(struct mem_segment_descriptor *)(ldtstore + LUCODE_SEL) =
 	*GDT_ADDR_MEM(gdtstore, GUCODE_SEL);
 	*(struct mem_segment_descriptor *)(ldtstore + LUDATA_SEL) =
@@ -1731,16 +1728,6 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(ldt_segp, 0, x86_btop(VM_MAXUSER_ADDRESS32) - 1,
 	SDT_MEMRWA, SEL_UPL, 1, 1, 0);
 
-	/*
-	 * Other entries.
-	 */
-	memcpy((struct gate_descriptor *)(ldtstore + LSOL26CALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-	memcpy((struct gate_descriptor *)(ldtstore + LBSDICALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-
 	/* exceptions */
 	for (x = 0; x < 32; x++) {
 #ifndef XEN

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78.10.1 src/sys/arch/amd64/amd64/trap.c:1.78.10.2
--- src/sys/arch/amd64/amd64/trap.c:1.78.10.1	Sat Mar 25 16:58:24 2017
+++ src/sys/arch/amd64/amd64/trap.c	Wed Apr 26 14:51:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78.10.1 2017/03/25 16:58:24 snj Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.10.2 2017/04/26 14:51:58 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.10.1 2017/03/25 16:58:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.10.2 2017/04/26 14:51:58 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -222,7 +222,6 @@ trap(struct trapframe *frame)
 	struct proc *p;
 	struct pcb *pcb;
 	extern char fusuintrfailure[], kcopy_fault[];
-	extern char IDTVEC(oosyscall)[];
 	extern char IDTVEC(osyscall)[];
 	extern char IDTVEC(syscall32)[];
 #ifndef XEN
@@ -647,8 

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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:52:50 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7]: locore.S machdep.c trap.c

Log Message:
Pull up following revision(s) (requested by bsiegert in ticket #1397):

sys/arch/amd64/amd64/locore.S   1.122 (via patch)
sys/arch/amd64/amd64/machdep.c  1.254 (via patch)
sys/arch/amd64/amd64/trap.c 1.95 (via patch)

Remove the call gate on amd64, it is useless and vulnerable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.76.2.1 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.211 -r1.211.2.1 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.78.4.1 -r1.78.4.2 src/sys/arch/amd64/amd64/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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.76 src/sys/arch/amd64/amd64/locore.S:1.76.2.1
--- src/sys/arch/amd64/amd64/locore.S:1.76	Fri May 16 00:48:41 2014
+++ src/sys/arch/amd64/amd64/locore.S	Wed Apr 26 14:52:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.76 2014/05/16 00:48:41 rmind Exp $	*/
+/*	$NetBSD: locore.S,v 1.76.2.1 2017/04/26 14:52:50 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1287,27 +1287,6 @@ NENTRY(lwp_trampoline)
 END(lwp_trampoline)
 
 /*
- * oosyscall()
- *
- * Old call gate entry for syscall. only needed if we're
- * going to support running old i386 NetBSD 1.0 or ibcs2 binaries, etc,
- * on NetBSD/amd64.
- * The 64bit call gate can't request that arguments be copied from the
- * user stack (which the i386 code uses to get a gap for the flags).
- * push/pop are :: cycles.
- */
-IDTVEC(oosyscall)
-	/* Set rflags in trap frame. */
-	pushq	(%rsp)		# move user's %eip
-	pushq	16(%rsp)	# and %cs
-	popq	8(%rsp)
-	pushfq
-	popq	16(%rsp)
-	pushq	$7		# size of instruction for restart
-	jmp	osyscall1
-IDTVEC_END(oosyscall)
-
-/*
  * osyscall()
  *
  * Trap gate entry for int $80 syscall, also used by sigreturn.

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.211 src/sys/arch/amd64/amd64/machdep.c:1.211.2.1
--- src/sys/arch/amd64/amd64/machdep.c:1.211	Mon May 12 22:50:03 2014
+++ src/sys/arch/amd64/amd64/machdep.c	Wed Apr 26 14:52:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $	*/
+/*	$NetBSD: machdep.c,v 1.211.2.1 2017/04/26 14:52:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211.2.1 2017/04/26 14:52:50 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1696,10 +1696,7 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(GDT_ADDR_MEM(gdtstore, GUDATA_SEL), 0,
 	x86_btop(VM_MAXUSER_ADDRESS) - 1, SDT_MEMRWA, SEL_UPL, 1, 0, 1);
 
-	/* make ldt gates and memory segments */
-	setgate((struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	(oosyscall), 0, SDT_SYS386CGT, SEL_UPL,
-	GSEL(GCODE_SEL, SEL_KPL));
+	/* make ldt memory segments */
 	*(struct mem_segment_descriptor *)(ldtstore + LUCODE_SEL) =
 	*GDT_ADDR_MEM(gdtstore, GUCODE_SEL);
 	*(struct mem_segment_descriptor *)(ldtstore + LUDATA_SEL) =
@@ -1731,16 +1728,6 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(ldt_segp, 0, x86_btop(VM_MAXUSER_ADDRESS32) - 1,
 	SDT_MEMRWA, SEL_UPL, 1, 1, 0);
 
-	/*
-	 * Other entries.
-	 */
-	memcpy((struct gate_descriptor *)(ldtstore + LSOL26CALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-	memcpy((struct gate_descriptor *)(ldtstore + LBSDICALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-
 	/* exceptions */
 	for (x = 0; x < 32; x++) {
 #ifndef XEN

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78.4.1 src/sys/arch/amd64/amd64/trap.c:1.78.4.2
--- src/sys/arch/amd64/amd64/trap.c:1.78.4.1	Sat Mar 25 16:57:39 2017
+++ src/sys/arch/amd64/amd64/trap.c	Wed Apr 26 14:52:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78.4.1 2017/03/25 16:57:39 snj Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.1 2017/03/25 16:57:39 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -222,7 +222,6 @@ trap(struct trapframe *frame)
 	struct proc *p;
 	struct pcb *pcb;
 	extern char fusuintrfailure[], kcopy_fault[];
-	extern char IDTVEC(oosyscall)[];
 	extern char IDTVEC(osyscall)[];
 	extern char IDTVEC(syscall32)[];
 #ifndef XEN
@@ -647,8 +646,7 @@ 

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

2017-04-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 26 14:50:51 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-7-0]: locore.S machdep.c trap.c

Log Message:
Pull up following revision(s) (requested by bsiegert in ticket #1397):

sys/arch/amd64/amd64/locore.S   1.122 (via patch)
sys/arch/amd64/amd64/machdep.c  1.254 (via patch)
sys/arch/amd64/amd64/trap.c 1.95 (via patch)

Remove the call gate on amd64, it is useless and vulnerable.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.76.4.1 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.211 -r1.211.6.1 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.78.6.1 -r1.78.6.2 src/sys/arch/amd64/amd64/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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.76 src/sys/arch/amd64/amd64/locore.S:1.76.4.1
--- src/sys/arch/amd64/amd64/locore.S:1.76	Fri May 16 00:48:41 2014
+++ src/sys/arch/amd64/amd64/locore.S	Wed Apr 26 14:50:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.76 2014/05/16 00:48:41 rmind Exp $	*/
+/*	$NetBSD: locore.S,v 1.76.4.1 2017/04/26 14:50:51 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1287,27 +1287,6 @@ NENTRY(lwp_trampoline)
 END(lwp_trampoline)
 
 /*
- * oosyscall()
- *
- * Old call gate entry for syscall. only needed if we're
- * going to support running old i386 NetBSD 1.0 or ibcs2 binaries, etc,
- * on NetBSD/amd64.
- * The 64bit call gate can't request that arguments be copied from the
- * user stack (which the i386 code uses to get a gap for the flags).
- * push/pop are :: cycles.
- */
-IDTVEC(oosyscall)
-	/* Set rflags in trap frame. */
-	pushq	(%rsp)		# move user's %eip
-	pushq	16(%rsp)	# and %cs
-	popq	8(%rsp)
-	pushfq
-	popq	16(%rsp)
-	pushq	$7		# size of instruction for restart
-	jmp	osyscall1
-IDTVEC_END(oosyscall)
-
-/*
  * osyscall()
  *
  * Trap gate entry for int $80 syscall, also used by sigreturn.

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.211 src/sys/arch/amd64/amd64/machdep.c:1.211.6.1
--- src/sys/arch/amd64/amd64/machdep.c:1.211	Mon May 12 22:50:03 2014
+++ src/sys/arch/amd64/amd64/machdep.c	Wed Apr 26 14:50:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $	*/
+/*	$NetBSD: machdep.c,v 1.211.6.1 2017/04/26 14:50:51 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211.6.1 2017/04/26 14:50:51 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1696,10 +1696,7 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(GDT_ADDR_MEM(gdtstore, GUDATA_SEL), 0,
 	x86_btop(VM_MAXUSER_ADDRESS) - 1, SDT_MEMRWA, SEL_UPL, 1, 0, 1);
 
-	/* make ldt gates and memory segments */
-	setgate((struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	(oosyscall), 0, SDT_SYS386CGT, SEL_UPL,
-	GSEL(GCODE_SEL, SEL_KPL));
+	/* make ldt memory segments */
 	*(struct mem_segment_descriptor *)(ldtstore + LUCODE_SEL) =
 	*GDT_ADDR_MEM(gdtstore, GUCODE_SEL);
 	*(struct mem_segment_descriptor *)(ldtstore + LUDATA_SEL) =
@@ -1731,16 +1728,6 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(ldt_segp, 0, x86_btop(VM_MAXUSER_ADDRESS32) - 1,
 	SDT_MEMRWA, SEL_UPL, 1, 1, 0);
 
-	/*
-	 * Other entries.
-	 */
-	memcpy((struct gate_descriptor *)(ldtstore + LSOL26CALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-	memcpy((struct gate_descriptor *)(ldtstore + LBSDICALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-
 	/* exceptions */
 	for (x = 0; x < 32; x++) {
 #ifndef XEN

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.78.6.1 src/sys/arch/amd64/amd64/trap.c:1.78.6.2
--- src/sys/arch/amd64/amd64/trap.c:1.78.6.1	Sat Mar 25 16:59:01 2017
+++ src/sys/arch/amd64/amd64/trap.c	Wed Apr 26 14:50:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78.6.1 2017/03/25 16:59:01 snj Exp $	*/
+/*	$NetBSD: trap.c,v 1.78.6.2 2017/04/26 14:50:51 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.6.1 2017/03/25 16:59:01 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.6.2 2017/04/26 14:50:51 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -222,7 +222,6 @@ trap(struct trapframe *frame)
 	struct proc *p;
 	struct pcb *pcb;
 	extern char fusuintrfailure[], kcopy_fault[];
-	extern char IDTVEC(oosyscall)[];
 	extern char IDTVEC(osyscall)[];
 	extern char IDTVEC(syscall32)[];
 #ifndef XEN
@@ -647,8 +646,7 @@ 

CVS commit: src/doc

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:59:56 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Lua updated to versionb 5.3.4


To generate a diff of this commit:
cvs rdiff -u -r1.2277 -r1.2278 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.2277 src/doc/CHANGES:1.2278
--- src/doc/CHANGES:1.2277	Tue Apr 25 13:20:41 2017
+++ src/doc/CHANGES	Wed Apr 26 13:59:56 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2277 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2278 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -503,3 +503,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	OpenSSH: Imported 7.5. [christos 20170418]
 	tmux(1): Import of tmux 2.4 [christos 20170423]
 	libc: Update to tzcode2017b. [christos 20170425]
+	lua: Updated to Lua 5.3.4. [mbalmer 20170426]



CVS commit: src/doc

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:58:01 UTC 2017

Modified Files:
src/doc: 3RDPARTY

Log Message:
Lua is at version 5.3.4 now


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

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1438 src/doc/3RDPARTY:1.1439
--- src/doc/3RDPARTY:1.1438	Tue Apr 25 13:20:41 2017
+++ src/doc/3RDPARTY	Wed Apr 26 13:58:01 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1438 2017/04/25 13:20:41 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1439 2017/04/26 13:58:01 mbalmer Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -807,7 +807,7 @@ under src/usr.sbin). We don't use tcpd; 
 into inetd. The provided libwrap2netbsd script handles just libwrap.
 
 Package:	Lua
-Version:	Lua 5.3.3
+Version:	Lua 5.3.4
 Current Vers:	Lua 5.3.4
 Maintainer:	PUC Rio
 Home Page:	http://www.lua.org/



CVS commit: src/external/mit/lua/dist/src

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:53:18 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lauxlib.c

Log Message:
kernel mode lua has no floating point available


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lauxlib.c

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

Modified files:

Index: src/external/mit/lua/dist/src/lauxlib.c
diff -u src/external/mit/lua/dist/src/lauxlib.c:1.9 src/external/mit/lua/dist/src/lauxlib.c:1.10
--- src/external/mit/lua/dist/src/lauxlib.c:1.9	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/lauxlib.c	Wed Apr 26 13:53:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lauxlib.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: lauxlib.c,v 1.10 2017/04/26 13:53:18 mbalmer Exp $	*/
 
 /*
 ** Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp 
@@ -829,10 +829,14 @@ LUALIB_API const char *luaL_tolstring (l
   else {
 switch (lua_type(L, idx)) {
   case LUA_TNUMBER: {
+#ifndef _KERNEL
 if (lua_isinteger(L, idx))
+#endif
   lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx));
+#ifndef _KERNEL
 else
   lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx));
+#endif
 break;
   }
   case LUA_TSTRING:
@@ -1052,8 +1056,10 @@ LUALIB_API void luaL_checkversion_ (lua_
 luaL_error(L, "core and library have incompatible numeric types");
   if (v != lua_version(NULL))
 luaL_error(L, "multiple Lua VMs detected");
+#ifndef _KERNEL
   else if (*v != ver)
 luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f",
   (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v);
+#endif
 }
 



CVS commit: src/external/mit/lua/dist/src

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:17:33 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lapi.c lapi.h lauxlib.c lbaselib.c
lbitlib.c lcode.c lcode.h lcorolib.c lctype.c lctype.h ldblib.c
ldebug.c ldebug.h ldo.c ldo.h ldump.c lfunc.c lfunc.h lgc.c lgc.h
linit.c liolib.c llex.c llex.h llimits.h lmathlib.c lmem.c lmem.h
loadlib.c lobject.c lobject.h lopcodes.c lopcodes.h loslib.c
lparser.c lparser.h lprefix.h lstate.c lstate.h lstring.c lstring.h
lstrlib.c ltable.c ltable.h ltablib.c ltm.c ltm.h lua.c lua.h
luac.c luaconf.h lualib.h lundump.c lundump.h lutf8lib.c lvm.c
lvm.h lzio.c lzio.h

Log Message:
import conflict resolution


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/lua/dist/src/lapi.c \
src/external/mit/lua/dist/src/lauxlib.c \
src/external/mit/lua/dist/src/lbaselib.c \
src/external/mit/lua/dist/src/ldebug.c \
src/external/mit/lua/dist/src/llimits.h \
src/external/mit/lua/dist/src/lobject.h \
src/external/mit/lua/dist/src/lparser.c \
src/external/mit/lua/dist/src/ltable.c \
src/external/mit/lua/dist/src/lua.h src/external/mit/lua/dist/src/luac.c \
src/external/mit/lua/dist/src/lvm.h
cvs rdiff -u -r1.7 -r1.8 src/external/mit/lua/dist/src/lapi.h \
src/external/mit/lua/dist/src/ldebug.h \
src/external/mit/lua/dist/src/ldo.c src/external/mit/lua/dist/src/ldo.h \
src/external/mit/lua/dist/src/ldump.c src/external/mit/lua/dist/src/lgc.c \
src/external/mit/lua/dist/src/linit.c \
src/external/mit/lua/dist/src/liolib.c \
src/external/mit/lua/dist/src/lmathlib.c \
src/external/mit/lua/dist/src/lmem.c \
src/external/mit/lua/dist/src/loadlib.c \
src/external/mit/lua/dist/src/lstate.c \
src/external/mit/lua/dist/src/lstate.h \
src/external/mit/lua/dist/src/lstring.c \
src/external/mit/lua/dist/src/lstring.h \
src/external/mit/lua/dist/src/ltablib.c \
src/external/mit/lua/dist/src/ltm.c src/external/mit/lua/dist/src/lua.c
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/src/lbitlib.c \
src/external/mit/lua/dist/src/lcorolib.c \
src/external/mit/lua/dist/src/lctype.c \
src/external/mit/lua/dist/src/lctype.h \
src/external/mit/lua/dist/src/lprefix.h \
src/external/mit/lua/dist/src/lualib.h \
src/external/mit/lua/dist/src/lundump.h
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lcode.c \
src/external/mit/lua/dist/src/ldblib.c \
src/external/mit/lua/dist/src/loslib.c
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lcode.h \
src/external/mit/lua/dist/src/lfunc.c \
src/external/mit/lua/dist/src/lfunc.h src/external/mit/lua/dist/src/lgc.h \
src/external/mit/lua/dist/src/llex.h src/external/mit/lua/dist/src/lmem.h \
src/external/mit/lua/dist/src/lopcodes.c \
src/external/mit/lua/dist/src/lopcodes.h \
src/external/mit/lua/dist/src/lparser.h \
src/external/mit/lua/dist/src/ltable.h \
src/external/mit/lua/dist/src/ltm.h \
src/external/mit/lua/dist/src/lundump.c \
src/external/mit/lua/dist/src/lutf8lib.c \
src/external/mit/lua/dist/src/lzio.c src/external/mit/lua/dist/src/lzio.h
cvs rdiff -u -r1.10 -r1.11 src/external/mit/lua/dist/src/llex.c \
src/external/mit/lua/dist/src/lobject.c
cvs rdiff -u -r1.16 -r1.17 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.20 -r1.21 src/external/mit/lua/dist/src/luaconf.h
cvs rdiff -u -r1.12 -r1.13 src/external/mit/lua/dist/src/lvm.c

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

Modified files:

Index: src/external/mit/lua/dist/src/lapi.c
diff -u src/external/mit/lua/dist/src/lapi.c:1.8 src/external/mit/lua/dist/src/lapi.c:1.9
--- src/external/mit/lua/dist/src/lapi.c:1.8	Wed Apr 26 12:49:34 2017
+++ src/external/mit/lua/dist/src/lapi.c	Wed Apr 26 13:17:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapi.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $	*/
+/*	$NetBSD: lapi.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
 
 /*
 ** Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp 
Index: src/external/mit/lua/dist/src/lauxlib.c
diff -u src/external/mit/lua/dist/src/lauxlib.c:1.8 src/external/mit/lua/dist/src/lauxlib.c:1.9
--- src/external/mit/lua/dist/src/lauxlib.c:1.8	Wed Apr 26 12:49:34 2017
+++ src/external/mit/lua/dist/src/lauxlib.c	Wed Apr 26 13:17:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lauxlib.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $	*/
+/*	$NetBSD: lauxlib.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
 
 /*
 ** Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp 
Index: src/external/mit/lua/dist/src/lbaselib.c
diff -u src/external/mit/lua/dist/src/lbaselib.c:1.8 src/external/mit/lua/dist/src/lbaselib.c:1.9
--- src/external/mit/lua/dist/src/lbaselib.c:1.8	Wed Apr 26 12:49:34 2017
+++ src/external/mit/lua/dist/src/lbaselib.c	Wed Apr 26 13:17:33 2017
@@ -1,4 +1,4 @@

CVS commit: src/external/mit/lua/dist/src

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:09:12 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lauxlib.h

Log Message:
import conflict resolution


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lauxlib.h

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

Modified files:

Index: src/external/mit/lua/dist/src/lauxlib.h
diff -u src/external/mit/lua/dist/src/lauxlib.h:1.6 src/external/mit/lua/dist/src/lauxlib.h:1.7
--- src/external/mit/lua/dist/src/lauxlib.h:1.6	Wed Apr 26 12:49:34 2017
+++ src/external/mit/lua/dist/src/lauxlib.h	Wed Apr 26 13:09:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lauxlib.h,v 1.6 2017/04/26 12:49:34 mbalmer Exp $	*/
+/*	$NetBSD: lauxlib.h,v 1.7 2017/04/26 13:09:12 mbalmer Exp $	*/
 
 /*
 ** Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp 



CVS commit: src/external/mit/lua/dist

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:06:22 UTC 2017

Modified Files:
src/external/mit/lua/dist: Makefile README

Log Message:
fix import conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/Makefile \
src/external/mit/lua/dist/README

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

Modified files:

Index: src/external/mit/lua/dist/Makefile
diff -u src/external/mit/lua/dist/Makefile:1.6 src/external/mit/lua/dist/Makefile:1.7
--- src/external/mit/lua/dist/Makefile:1.6	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/Makefile	Wed Apr 26 13:06:22 2017
@@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1
 
 # Lua version and release.
 V= 5.3
-R= $V.3
+R= $V.4
 
 # Targets start here.
 all:	$(PLAT)
Index: src/external/mit/lua/dist/README
diff -u src/external/mit/lua/dist/README:1.6 src/external/mit/lua/dist/README:1.7
--- src/external/mit/lua/dist/README:1.6	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/README	Wed Apr 26 13:06:22 2017
@@ -1,5 +1,5 @@
 
-This is Lua 5.3.3, released on 30 May 2016.
+This is Lua 5.3.4, released on 12 Jan 2017.
 
 For installation instructions, license details, and
 further information about Lua, see doc/readme.html.



CVS commit: src/external/mit/lua/dist/doc

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:00:46 UTC 2017

Modified Files:
src/external/mit/lua/dist/doc: lua.1 luac.1

Log Message:
fix import conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/doc/lua.1
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/doc/luac.1

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

Modified files:

Index: src/external/mit/lua/dist/doc/lua.1
diff -u src/external/mit/lua/dist/doc/lua.1:1.6 src/external/mit/lua/dist/doc/lua.1:1.7
--- src/external/mit/lua/dist/doc/lua.1:1.6	Wed Apr 26 12:36:53 2017
+++ src/external/mit/lua/dist/doc/lua.1	Wed Apr 26 13:00:46 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lua.1,v 1.6 2017/04/26 12:36:53 mbalmer Exp $
+.\"	$NetBSD: lua.1,v 1.7 2017/04/26 13:00:46 mbalmer Exp $
 .\"
 .\" Id: lua.man,v 1.14 2016/10/17 15:43:50 lhf Exp 
 .TH LUA 1 "Date: 2016/10/17 15:43:50 "

Index: src/external/mit/lua/dist/doc/luac.1
diff -u src/external/mit/lua/dist/doc/luac.1:1.5 src/external/mit/lua/dist/doc/luac.1:1.6
--- src/external/mit/lua/dist/doc/luac.1:1.5	Wed Apr 26 12:36:53 2017
+++ src/external/mit/lua/dist/doc/luac.1	Wed Apr 26 13:00:46 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: luac.1,v 1.5 2017/04/26 12:36:53 mbalmer Exp $
+.\"	$NetBSD: luac.1,v 1.6 2017/04/26 13:00:46 mbalmer Exp $
 .\"
 .\" Id: luac.man,v 1.29 2011/11/16 13:53:40 lhf Exp 
 .TH LUAC 1 "Date: 2011/11/16 13:53:40 "



CVS commit: src/external/mit/lua/dist/src

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 12:49:35 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lapi.c lapi.h lauxlib.c lauxlib.h
lbaselib.c lbitlib.c lcode.c lcode.h lcorolib.c lctype.c lctype.h
ldblib.c ldebug.c ldebug.h ldo.c ldo.h ldump.c lfunc.c lfunc.h
lgc.c lgc.h linit.c liolib.c llex.c llex.h llimits.h lmathlib.c
lmem.c lmem.h loadlib.c lobject.c lobject.h lopcodes.c lopcodes.h
loslib.c lparser.c lparser.h lprefix.h lstate.c lstate.h lstring.c
lstring.h lstrlib.c ltable.c ltable.h ltablib.c ltm.c ltm.h lua.c
lua.h luac.c luaconf.h lualib.h lundump.c lundump.h lutf8lib.c
lvm.c lvm.h lzio.c lzio.h

Log Message:
resolve import conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/lua/dist/src/lapi.c \
src/external/mit/lua/dist/src/lauxlib.c \
src/external/mit/lua/dist/src/lbaselib.c \
src/external/mit/lua/dist/src/ldebug.c \
src/external/mit/lua/dist/src/llimits.h \
src/external/mit/lua/dist/src/lobject.h \
src/external/mit/lua/dist/src/lparser.c \
src/external/mit/lua/dist/src/ltable.c \
src/external/mit/lua/dist/src/lua.h src/external/mit/lua/dist/src/luac.c \
src/external/mit/lua/dist/src/lvm.h
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lapi.h \
src/external/mit/lua/dist/src/ldebug.h \
src/external/mit/lua/dist/src/ldo.c src/external/mit/lua/dist/src/ldo.h \
src/external/mit/lua/dist/src/ldump.c src/external/mit/lua/dist/src/lgc.c \
src/external/mit/lua/dist/src/linit.c \
src/external/mit/lua/dist/src/liolib.c \
src/external/mit/lua/dist/src/lmathlib.c \
src/external/mit/lua/dist/src/lmem.c \
src/external/mit/lua/dist/src/loadlib.c \
src/external/mit/lua/dist/src/lstate.c \
src/external/mit/lua/dist/src/lstate.h \
src/external/mit/lua/dist/src/lstring.c \
src/external/mit/lua/dist/src/lstring.h \
src/external/mit/lua/dist/src/ltablib.c \
src/external/mit/lua/dist/src/ltm.c src/external/mit/lua/dist/src/lua.c
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/src/lauxlib.h \
src/external/mit/lua/dist/src/lcode.h \
src/external/mit/lua/dist/src/lfunc.c \
src/external/mit/lua/dist/src/lfunc.h src/external/mit/lua/dist/src/lgc.h \
src/external/mit/lua/dist/src/llex.h src/external/mit/lua/dist/src/lmem.h \
src/external/mit/lua/dist/src/lopcodes.c \
src/external/mit/lua/dist/src/lopcodes.h \
src/external/mit/lua/dist/src/lparser.h \
src/external/mit/lua/dist/src/ltable.h \
src/external/mit/lua/dist/src/ltm.h \
src/external/mit/lua/dist/src/lundump.c \
src/external/mit/lua/dist/src/lutf8lib.c \
src/external/mit/lua/dist/src/lzio.c src/external/mit/lua/dist/src/lzio.h
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/src/lbitlib.c \
src/external/mit/lua/dist/src/lcorolib.c \
src/external/mit/lua/dist/src/lctype.c \
src/external/mit/lua/dist/src/lctype.h \
src/external/mit/lua/dist/src/lprefix.h \
src/external/mit/lua/dist/src/lualib.h \
src/external/mit/lua/dist/src/lundump.h
cvs rdiff -u -r1.8 -r1.9 src/external/mit/lua/dist/src/lcode.c \
src/external/mit/lua/dist/src/ldblib.c \
src/external/mit/lua/dist/src/loslib.c
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/llex.c \
src/external/mit/lua/dist/src/lobject.c
cvs rdiff -u -r1.15 -r1.16 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.19 -r1.20 src/external/mit/lua/dist/src/luaconf.h
cvs rdiff -u -r1.11 -r1.12 src/external/mit/lua/dist/src/lvm.c

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

Modified files:

Index: src/external/mit/lua/dist/src/lapi.c
diff -u src/external/mit/lua/dist/src/lapi.c:1.7 src/external/mit/lua/dist/src/lapi.c:1.8
--- src/external/mit/lua/dist/src/lapi.c:1.7	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/lapi.c	Wed Apr 26 12:49:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapi.c,v 1.7 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: lapi.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $	*/
 
 /*
 ** Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp 
Index: src/external/mit/lua/dist/src/lauxlib.c
diff -u src/external/mit/lua/dist/src/lauxlib.c:1.7 src/external/mit/lua/dist/src/lauxlib.c:1.8
--- src/external/mit/lua/dist/src/lauxlib.c:1.7	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/lauxlib.c	Wed Apr 26 12:49:34 2017
@@ -1,7 +1,7 @@
-/*	$NetBSD: lauxlib.c,v 1.7 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: lauxlib.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $	*/
 
 /*
-** Id: lauxlib.c,v 1.286 2016/01/08 15:33:09 roberto Exp 
+** Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp 
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 */
@@ -75,12 +75,11 @@ static int findfield (lua_State *L, int 
 
 /*
 ** Search for a name for a function 

CVS commit: src/external/mit/lua/dist/doc

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 12:36:53 UTC 2017

Modified Files:
src/external/mit/lua/dist/doc: contents.html lua.1 luac.1 manual.html
readme.html

Log Message:
after-import fixes, conflict resolution


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/doc/contents.html \
src/external/mit/lua/dist/doc/lua.1 \
src/external/mit/lua/dist/doc/readme.html
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/doc/luac.1
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/doc/manual.html

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

Modified files:

Index: src/external/mit/lua/dist/doc/contents.html
diff -u src/external/mit/lua/dist/doc/contents.html:1.5 src/external/mit/lua/dist/doc/contents.html:1.6
--- src/external/mit/lua/dist/doc/contents.html:1.5	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/doc/contents.html	Wed Apr 26 12:36:53 2017
@@ -32,7 +32,7 @@ For a complete introduction to Lua progr
 
 
 
-Copyright  20152016 Lua.org, PUC-Rio.
+Copyright  20152017 Lua.org, PUC-Rio.
 Freely available under the terms of the
 http://www.lua.org/license.html;>Lua license.
 
@@ -512,6 +512,7 @@ Freely available under the terms of the
 luaL_newmetatable
 luaL_newstate
 luaL_openlibs
+luaL_opt
 luaL_optinteger
 luaL_optlstring
 luaL_optnumber
@@ -608,10 +609,10 @@ Freely available under the terms of the
 
 
 Last update:
-Thu Jan 14 10:14:28 BRST 2016
+Thu Dec 22 18:29:39 BRST 2016
 
 
 
 
Index: src/external/mit/lua/dist/doc/lua.1
diff -u src/external/mit/lua/dist/doc/lua.1:1.5 src/external/mit/lua/dist/doc/lua.1:1.6
--- src/external/mit/lua/dist/doc/lua.1:1.5	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/doc/lua.1	Wed Apr 26 12:36:53 2017
@@ -1,6 +1,7 @@
-.\"	$NetBSD: lua.1,v 1.5 2016/09/08 02:21:31 salazar Exp $
+.\"	$NetBSD: lua.1,v 1.6 2017/04/26 12:36:53 mbalmer Exp $
 .\"
-.TH LUA 1 "Date: 2014/12/10 15:55:45 "
+.\" Id: lua.man,v 1.14 2016/10/17 15:43:50 lhf Exp 
+.TH LUA 1 "Date: 2016/10/17 15:43:50 "
 .SH NAME
 lua \- Lua interpreter
 .SH SYNOPSIS
Index: src/external/mit/lua/dist/doc/readme.html
diff -u src/external/mit/lua/dist/doc/readme.html:1.5 src/external/mit/lua/dist/doc/readme.html:1.6
--- src/external/mit/lua/dist/doc/readme.html:1.5	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/doc/readme.html	Wed Apr 26 12:36:53 2017
@@ -328,7 +328,7 @@ For details, see
 http://www.lua.org/license.html;>this.
 
 
-Copyright  19942016 Lua.org, PUC-Rio.
+Copyright  19942017 Lua.org, PUC-Rio.
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -355,10 +355,10 @@ THE SOFTWARE.
 
 
 Last update:
-Tue Feb  2 22:25:27 BRST 2016
+Thu Dec 22 18:22:57 BRST 2016
 
 
 
 

Index: src/external/mit/lua/dist/doc/luac.1
diff -u src/external/mit/lua/dist/doc/luac.1:1.4 src/external/mit/lua/dist/doc/luac.1:1.5
--- src/external/mit/lua/dist/doc/luac.1:1.4	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/doc/luac.1	Wed Apr 26 12:36:53 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: luac.1,v 1.4 2016/09/08 02:21:31 salazar Exp $
+.\"	$NetBSD: luac.1,v 1.5 2017/04/26 12:36:53 mbalmer Exp $
 .\"
 .\" Id: luac.man,v 1.29 2011/11/16 13:53:40 lhf Exp 
 .TH LUAC 1 "Date: 2011/11/16 13:53:40 "

Index: src/external/mit/lua/dist/doc/manual.html
diff -u src/external/mit/lua/dist/doc/manual.html:1.6 src/external/mit/lua/dist/doc/manual.html:1.7
--- src/external/mit/lua/dist/doc/manual.html:1.6	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/doc/manual.html	Wed Apr 26 12:36:53 2017
@@ -19,7 +19,7 @@ by Roberto Ierusalimschy, Luiz Henrique 
 
 
 
-Copyright  20152016 Lua.org, PUC-Rio.
+Copyright  20152017 Lua.org, PUC-Rio.
 Freely available under the terms of the
 http://www.lua.org/license.html;>Lua license.
 
@@ -35,7 +35,7 @@ Freely available under the terms of the
 
 
 
-
+
 
 
 
@@ -216,7 +216,7 @@ an associated value nil.
 
 
 Tables are the sole data-structuring mechanism in Lua;
-they can be used to represent ordinary arrays, sequences,
+they can be used to represent ordinary arrays, lists,
 symbol tables, sets, records, graphs, trees, etc.
 To represent records, Lua uses the field name as an index.
 The language supports this representation by
@@ -226,13 +226,6 @@ There are several convenient ways to cre
 
 
 
-We use the term sequence to denote a table where
-the set of all positive numeric keys is equal to {1..n}
-for some non-negative integer n,
-which is called the length of the sequence (see 3.4.7).
-
-
-
 Like indices,
 the values of table fields can be of any type.
 In particular,
@@ -378,6 +371,9 @@ so, an error inside the message handler
 will call the message handler again.
 If this loop goes on for too long,
 Lua breaks it and returns an appropriate message.
+(The message handler is called only for regular runtime errors.
+It is not called for memory-allocation errors
+nor for errors while running 

CVS import: src/external/mit/lua/dist

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 12:30:34 UTC 2017

Update of /cvsroot/src/external/mit/lua/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv27105

Log Message:
Lua 5.3.4

Status:

Vendor Tag: LUA
Release Tags:   LUA_5_3_4

U src/external/mit/lua/dist/Makefile
U src/external/mit/lua/dist/README
C src/external/mit/lua/dist/doc/manual.html
C src/external/mit/lua/dist/doc/luac.1
U src/external/mit/lua/dist/doc/contents.html
U src/external/mit/lua/dist/doc/manual.css
U src/external/mit/lua/dist/doc/index.css
U src/external/mit/lua/dist/doc/lua.css
U src/external/mit/lua/dist/doc/logo.gif
C src/external/mit/lua/dist/doc/lua.1
U src/external/mit/lua/dist/doc/osi-certified-72x60.png
U src/external/mit/lua/dist/doc/readme.html
C src/external/mit/lua/dist/src/lmathlib.c
C src/external/mit/lua/dist/src/ldblib.c
C src/external/mit/lua/dist/src/loadlib.c
C src/external/mit/lua/dist/src/loslib.c
C src/external/mit/lua/dist/src/lvm.c
C src/external/mit/lua/dist/src/ldo.h
C src/external/mit/lua/dist/src/lua.h
C src/external/mit/lua/dist/src/lgc.h
C src/external/mit/lua/dist/src/ltm.h
C src/external/mit/lua/dist/src/luaconf.h
C src/external/mit/lua/dist/src/lmem.c
C src/external/mit/lua/dist/src/lstate.h
U src/external/mit/lua/dist/src/Makefile
C src/external/mit/lua/dist/src/lzio.h
C src/external/mit/lua/dist/src/lstring.c
C src/external/mit/lua/dist/src/lzio.c
C src/external/mit/lua/dist/src/lopcodes.c
C src/external/mit/lua/dist/src/lua.c
C src/external/mit/lua/dist/src/lundump.h
C src/external/mit/lua/dist/src/lbaselib.c
C src/external/mit/lua/dist/src/ltable.c
C src/external/mit/lua/dist/src/ldump.c
C src/external/mit/lua/dist/src/liolib.c
C src/external/mit/lua/dist/src/llimits.h
C src/external/mit/lua/dist/src/lfunc.h
C src/external/mit/lua/dist/src/lualib.h
C src/external/mit/lua/dist/src/lctype.c
C src/external/mit/lua/dist/src/lmem.h
C src/external/mit/lua/dist/src/llex.h
C src/external/mit/lua/dist/src/ltable.h
C src/external/mit/lua/dist/src/lbitlib.c
C src/external/mit/lua/dist/src/ldebug.h
C src/external/mit/lua/dist/src/lprefix.h
C src/external/mit/lua/dist/src/llex.c
C src/external/mit/lua/dist/src/linit.c
C src/external/mit/lua/dist/src/lobject.h
C src/external/mit/lua/dist/src/lapi.h
C src/external/mit/lua/dist/src/ldebug.c
C src/external/mit/lua/dist/src/ldo.c
C src/external/mit/lua/dist/src/lvm.h
C src/external/mit/lua/dist/src/lauxlib.c
C src/external/mit/lua/dist/src/luac.c
C src/external/mit/lua/dist/src/lctype.h
C src/external/mit/lua/dist/src/lstring.h
C src/external/mit/lua/dist/src/lcorolib.c
C src/external/mit/lua/dist/src/lutf8lib.c
C src/external/mit/lua/dist/src/lgc.c
C src/external/mit/lua/dist/src/lstate.c
C src/external/mit/lua/dist/src/lundump.c
C src/external/mit/lua/dist/src/ltablib.c
C src/external/mit/lua/dist/src/lauxlib.h
C src/external/mit/lua/dist/src/ltm.c
C src/external/mit/lua/dist/src/lparser.c
C src/external/mit/lua/dist/src/lcode.h
C src/external/mit/lua/dist/src/lobject.c
C src/external/mit/lua/dist/src/lcode.c
C src/external/mit/lua/dist/src/lopcodes.h
C src/external/mit/lua/dist/src/lfunc.c
C src/external/mit/lua/dist/src/lapi.c
C src/external/mit/lua/dist/src/lparser.h
C src/external/mit/lua/dist/src/lstrlib.c
U src/external/mit/lua/dist/src/lua.hpp

63 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jLUA:yesterday -jLUA src/external/mit/lua/dist



CVS commit: [bouyer-socketcan] src/sys/dev

2017-04-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Apr 26 11:45:23 UTC 2017

Modified Files:
src/sys/dev [bouyer-socketcan]: audio.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.2 -r1.291.2.3 src/sys/dev/audio.c

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.291.2.2 src/sys/dev/audio.c:1.291.2.3
--- src/sys/dev/audio.c:1.291.2.2	Wed Apr 26 10:10:04 2017
+++ src/sys/dev/audio.c	Wed Apr 26 11:45:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.291.2.2 2017/04/26 10:10:04 bouyer Exp $	*/
+/*	$NetBSD: audio.c,v 1.291.2.3 2017/04/26 11:45:23 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.291.2.2 2017/04/26 10:10:04 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.291.2.3 2017/04/26 11:45:23 bouyer Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -649,8 +649,6 @@ bad_rec:
 		"failed\n", __func__);
 	}
 
-	sc->sc_pr.blksize = vc->sc_mpr.blksize;
-	sc->sc_rr.blksize = vc->sc_mrr.blksize;
 	sc->sc_sih_rd = softint_establish(SOFTINT_SERIAL | SOFTINT_MPSAFE,
 	audio_softintr_rd, sc);
 	sc->sc_sih_wr = softint_establish(SOFTINT_SERIAL | SOFTINT_MPSAFE,
@@ -1972,6 +1970,8 @@ audio_initbufs(struct audio_softc *sc, s
 	if (vc == NULL) {
 		chan = SIMPLEQ_FIRST(>sc_audiochan);
 		vc = chan->vc;
+		sc->sc_pr.blksize = vc->sc_mrr.blksize;
+		sc->sc_rr.blksize = vc->sc_mrr.blksize;
 	}
 
 	DPRINTF(("audio_initbufs: mode=0x%x\n", vc->sc_mode));
@@ -1987,6 +1987,8 @@ audio_initbufs(struct audio_softc *sc, s
 return error;
 		}
 	}
+	if (vc == SIMPLEQ_FIRST(>sc_audiochan)->vc)
+		sc->sc_rr.blksize = vc->sc_mrr.blksize;
 
 	if (audio_can_playback(sc) || (vc->sc_open & AUOPEN_WRITE)) {
 		audio_init_ringbuffer(sc, >sc_mpr,
@@ -2000,6 +2002,8 @@ audio_initbufs(struct audio_softc *sc, s
 return error;
 		}
 	}
+	if (vc == SIMPLEQ_FIRST(>sc_audiochan)->vc)
+		sc->sc_pr.blksize = vc->sc_mpr.blksize;
 
 #ifdef AUDIO_INTR_TIME
 #define double u_long
@@ -2142,9 +2146,9 @@ audio_open(dev_t dev, struct audio_softc
 return error;
 			}
 		}
+		audio_initbufs(sc, NULL);
 		audio_init_ringbuffer(sc, >sc_pr, AUMODE_PLAY);
 		audio_init_ringbuffer(sc, >sc_rr, AUMODE_RECORD);
-		audio_initbufs(sc, NULL);
 		sc->schedule_wih = false;
 		sc->schedule_rih = false;
 		sc->sc_eof = 0;
@@ -2177,8 +2181,8 @@ audio_open(dev_t dev, struct audio_softc
 		mode |= AUMODE_PLAY | AUMODE_PLAY_ALL;
 	}
 
-	vc->sc_mrr.blksize = sc->sc_rr.blksize;
 	vc->sc_mpr.blksize = sc->sc_pr.blksize;
+	vc->sc_mrr.blksize = sc->sc_rr.blksize;
 
 	/*
 	 * Multiplex device: /dev/audio (MU-Law) and /dev/sound (linear)
@@ -3583,7 +3587,7 @@ audio_pint(void *v)
 	struct audio_softc *sc;
 	struct audio_chan *chan;
 	struct virtual_channel *vc;
-	int blksize;
+	int blksize, cc, used;
 
 	sc = v;
 	chan = SIMPLEQ_FIRST(>sc_audiochan);
@@ -3602,10 +3606,16 @@ audio_pint(void *v)
 	vc->sc_mpr.s.outp, blksize);
 
 	if (audio_stream_get_used(>sc_pr.s) < blksize) {
-		audio_fill_silence(>sc_pparams, vc->sc_mpr.s.inp,
-		vc->sc_mpr.blksize);
-		vc->sc_mpr.s.inp = audio_stream_add_inp(>sc_mpr.s,
-		vc->sc_mpr.s.inp, blksize);
+		used = blksize;
+		while (used > 0) {
+			cc = sc->sc_pr.s.end - sc->sc_pr.s.inp;
+			if (cc > used)
+cc = used;
+			audio_fill_silence(>sc_pparams, vc->sc_mpr.s.inp, cc);
+			vc->sc_mpr.s.inp = audio_stream_add_inp(>sc_mpr.s,
+			vc->sc_mpr.s.inp, cc);
+			used -= cc;
+		}
 		goto wake_mix;
 	}
 
@@ -3786,8 +3796,10 @@ audio_mix(void *v)
 	inp = cb->s.inp;
 	cc = blksize - (inp - cb->s.start) % blksize;
 	if (sc->sc_writeme == false)
-		audio_pint_silence(sc, cb, inp, cc, vc);
-	cb->s.inp = audio_stream_add_inp(>s, cb->s.inp, blksize);
+		audio_fill_silence(>sc_mpr.s.param, inp, cc);
+	else
+		cc = blksize;
+	cb->s.inp = audio_stream_add_inp(>s, cb->s.inp, cc);
 	mutex_exit(sc->sc_intr_lock);
 
 	kpreempt_disable();
@@ -4090,9 +4102,6 @@ audio_set_vchan_defaults(struct audio_so
 	if (error == 0)
 		error = audiosetinfo(sc, , true, vc);
 
-	sc->sc_pr.blksize = vc->sc_mpr.blksize;
-	sc->sc_rr.blksize = vc->sc_mrr.blksize;
-
 	return error;
 }
 
@@ -4432,7 +4441,6 @@ audiosetinfo(struct audio_softc *sc, str
 	int error;
 	int np, nr;
 	unsigned int blks;
-	int oldpblksize, oldrblksize;
 	u_int gain;
 	bool rbus, pbus;
 	bool cleared, modechange, pausechange;
@@ -4511,9 +4519,6 @@ audiosetinfo(struct audio_softc *sc, str
 	if (np > 0 && (error = audio_check_params()))
 		return error;
 
-	oldpblksize = vc->sc_mpr.blksize;
-	oldrblksize = vc->sc_mrr.blksize;
-
 	setmode = 0;
 	if (nr > 0) {
 		if (!cleared) {
@@ -4698,50 +4703,6 @@ audiosetinfo(struct audio_softc *sc, str
 		pausechange = true;
 	}
 
-	if (SPECIFIED(ai->blocksize)) {
-		int pblksize, rblksize;
-
-		/* Block size specified 

CVS import: src/external/mit/lua/dist

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 11:38:38 UTC 2017

Update of /cvsroot/src/external/mit/lua/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv19640

Log Message:
Lua 5.3.4

Status:

Vendor Tag: LUA
Release Tags:   LUA_5_3_4

C src/external/mit/lua/dist/Makefile
C src/external/mit/lua/dist/README
C src/external/mit/lua/dist/doc/manual.html
C src/external/mit/lua/dist/doc/luac.1
C src/external/mit/lua/dist/doc/contents.html
U src/external/mit/lua/dist/doc/manual.css
U src/external/mit/lua/dist/doc/index.css
U src/external/mit/lua/dist/doc/lua.css
U src/external/mit/lua/dist/doc/logo.gif
C src/external/mit/lua/dist/doc/lua.1
U src/external/mit/lua/dist/doc/osi-certified-72x60.png
C src/external/mit/lua/dist/doc/readme.html
C src/external/mit/lua/dist/src/lmathlib.c
C src/external/mit/lua/dist/src/ldblib.c
C src/external/mit/lua/dist/src/loadlib.c
C src/external/mit/lua/dist/src/loslib.c
C src/external/mit/lua/dist/src/lvm.c
C src/external/mit/lua/dist/src/ldo.h
C src/external/mit/lua/dist/src/lua.h
C src/external/mit/lua/dist/src/lgc.h
C src/external/mit/lua/dist/src/ltm.h
C src/external/mit/lua/dist/src/luaconf.h
C src/external/mit/lua/dist/src/lmem.c
C src/external/mit/lua/dist/src/lstate.h
U src/external/mit/lua/dist/src/Makefile
C src/external/mit/lua/dist/src/lzio.h
C src/external/mit/lua/dist/src/lstring.c
C src/external/mit/lua/dist/src/lzio.c
C src/external/mit/lua/dist/src/lopcodes.c
C src/external/mit/lua/dist/src/lua.c
C src/external/mit/lua/dist/src/lundump.h
C src/external/mit/lua/dist/src/lbaselib.c
C src/external/mit/lua/dist/src/ltable.c
C src/external/mit/lua/dist/src/ldump.c
C src/external/mit/lua/dist/src/liolib.c
C src/external/mit/lua/dist/src/llimits.h
C src/external/mit/lua/dist/src/lfunc.h
C src/external/mit/lua/dist/src/lualib.h
C src/external/mit/lua/dist/src/lctype.c
C src/external/mit/lua/dist/src/lmem.h
C src/external/mit/lua/dist/src/llex.h
C src/external/mit/lua/dist/src/ltable.h
C src/external/mit/lua/dist/src/lbitlib.c
C src/external/mit/lua/dist/src/ldebug.h
C src/external/mit/lua/dist/src/lprefix.h
C src/external/mit/lua/dist/src/llex.c
C src/external/mit/lua/dist/src/linit.c
C src/external/mit/lua/dist/src/lobject.h
C src/external/mit/lua/dist/src/lapi.h
C src/external/mit/lua/dist/src/ldebug.c
C src/external/mit/lua/dist/src/ldo.c
C src/external/mit/lua/dist/src/lvm.h
C src/external/mit/lua/dist/src/lauxlib.c
C src/external/mit/lua/dist/src/luac.c
C src/external/mit/lua/dist/src/lctype.h
C src/external/mit/lua/dist/src/lstring.h
C src/external/mit/lua/dist/src/lcorolib.c
C src/external/mit/lua/dist/src/lutf8lib.c
C src/external/mit/lua/dist/src/lgc.c
C src/external/mit/lua/dist/src/lstate.c
C src/external/mit/lua/dist/src/lundump.c
C src/external/mit/lua/dist/src/ltablib.c
C src/external/mit/lua/dist/src/lauxlib.h
C src/external/mit/lua/dist/src/ltm.c
C src/external/mit/lua/dist/src/lparser.c
C src/external/mit/lua/dist/src/lcode.h
C src/external/mit/lua/dist/src/lobject.c
C src/external/mit/lua/dist/src/lcode.c
C src/external/mit/lua/dist/src/lopcodes.h
C src/external/mit/lua/dist/src/lfunc.c
C src/external/mit/lua/dist/src/lapi.c
C src/external/mit/lua/dist/src/lparser.h
U src/external/mit/lua/dist/src/lua.hpp
C src/external/mit/lua/dist/src/lstrlib.c

67 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jLUA:yesterday -jLUA src/external/mit/lua/dist



CVS commit: src/sys/dev

2017-04-26 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Apr 26 11:32:04 UTC 2017

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

Log Message:
Improved blksize calculation.
audio_fill_silence instead of audio_pint_silence for the mix ring.

Addresses PR kern/52195.


To generate a diff of this commit:
cvs rdiff -u -r1.327 -r1.328 src/sys/dev/audio.c

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.327 src/sys/dev/audio.c:1.328
--- src/sys/dev/audio.c:1.327	Sat Apr 22 10:37:51 2017
+++ src/sys/dev/audio.c	Wed Apr 26 11:32:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.327 2017/04/22 10:37:51 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.328 2017/04/26 11:32:04 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.327 2017/04/22 10:37:51 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.328 2017/04/26 11:32:04 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -649,8 +649,6 @@ bad_rec:
 		"failed\n", __func__);
 	}
 
-	sc->sc_pr.blksize = vc->sc_mpr.blksize;
-	sc->sc_rr.blksize = vc->sc_mrr.blksize;
 	sc->sc_sih_rd = softint_establish(SOFTINT_SERIAL | SOFTINT_MPSAFE,
 	audio_softintr_rd, sc);
 	sc->sc_sih_wr = softint_establish(SOFTINT_SERIAL | SOFTINT_MPSAFE,
@@ -1972,6 +1970,8 @@ audio_initbufs(struct audio_softc *sc, s
 	if (vc == NULL) {
 		chan = SIMPLEQ_FIRST(>sc_audiochan);
 		vc = chan->vc;
+		sc->sc_pr.blksize = vc->sc_mrr.blksize;
+		sc->sc_rr.blksize = vc->sc_mrr.blksize;
 	}
 
 	DPRINTF(("audio_initbufs: mode=0x%x\n", vc->sc_mode));
@@ -1987,6 +1987,8 @@ audio_initbufs(struct audio_softc *sc, s
 return error;
 		}
 	}
+	if (vc == SIMPLEQ_FIRST(>sc_audiochan)->vc)
+		sc->sc_rr.blksize = vc->sc_mrr.blksize;
 
 	if (audio_can_playback(sc) || (vc->sc_open & AUOPEN_WRITE)) {
 		audio_init_ringbuffer(sc, >sc_mpr,
@@ -2000,6 +2002,8 @@ audio_initbufs(struct audio_softc *sc, s
 return error;
 		}
 	}
+	if (vc == SIMPLEQ_FIRST(>sc_audiochan)->vc)
+		sc->sc_pr.blksize = vc->sc_mpr.blksize;
 
 #ifdef AUDIO_INTR_TIME
 #define double u_long
@@ -2142,9 +2146,9 @@ audio_open(dev_t dev, struct audio_softc
 return error;
 			}
 		}
+		audio_initbufs(sc, NULL);
 		audio_init_ringbuffer(sc, >sc_pr, AUMODE_PLAY);
 		audio_init_ringbuffer(sc, >sc_rr, AUMODE_RECORD);
-		audio_initbufs(sc, NULL);
 		sc->schedule_wih = false;
 		sc->schedule_rih = false;
 		sc->sc_eof = 0;
@@ -2177,8 +2181,8 @@ audio_open(dev_t dev, struct audio_softc
 		mode |= AUMODE_PLAY | AUMODE_PLAY_ALL;
 	}
 
-	vc->sc_mrr.blksize = sc->sc_rr.blksize;
 	vc->sc_mpr.blksize = sc->sc_pr.blksize;
+	vc->sc_mrr.blksize = sc->sc_rr.blksize;
 
 	/*
 	 * Multiplex device: /dev/audio (MU-Law) and /dev/sound (linear)
@@ -3583,7 +3587,7 @@ audio_pint(void *v)
 	struct audio_softc *sc;
 	struct audio_chan *chan;
 	struct virtual_channel *vc;
-	int blksize;
+	int blksize, cc, used;
 
 	sc = v;
 	chan = SIMPLEQ_FIRST(>sc_audiochan);
@@ -3602,10 +3606,16 @@ audio_pint(void *v)
 	vc->sc_mpr.s.outp, blksize);
 
 	if (audio_stream_get_used(>sc_pr.s) < blksize) {
-		audio_fill_silence(>sc_pparams, vc->sc_mpr.s.inp,
-		vc->sc_mpr.blksize);
-		vc->sc_mpr.s.inp = audio_stream_add_inp(>sc_mpr.s,
-		vc->sc_mpr.s.inp, blksize);
+		used = blksize;
+		while (used > 0) {
+			cc = sc->sc_pr.s.end - sc->sc_pr.s.inp;
+			if (cc > used)
+cc = used;
+			audio_fill_silence(>sc_pparams, vc->sc_mpr.s.inp, cc);
+			vc->sc_mpr.s.inp = audio_stream_add_inp(>sc_mpr.s,
+			vc->sc_mpr.s.inp, cc);
+			used -= cc;
+		}
 		goto wake_mix;
 	}
 
@@ -3786,8 +3796,10 @@ audio_mix(void *v)
 	inp = cb->s.inp;
 	cc = blksize - (inp - cb->s.start) % blksize;
 	if (sc->sc_writeme == false)
-		audio_pint_silence(sc, cb, inp, cc, vc);
-	cb->s.inp = audio_stream_add_inp(>s, cb->s.inp, blksize);
+		audio_fill_silence(>sc_mpr.s.param, inp, cc);
+	else
+		cc = blksize;
+	cb->s.inp = audio_stream_add_inp(>s, cb->s.inp, cc);
 	mutex_exit(sc->sc_intr_lock);
 
 	kpreempt_disable();
@@ -4090,9 +4102,6 @@ audio_set_vchan_defaults(struct audio_so
 	if (error == 0)
 		error = audiosetinfo(sc, , true, vc);
 
-	sc->sc_pr.blksize = vc->sc_mpr.blksize;
-	sc->sc_rr.blksize = vc->sc_mrr.blksize;
-
 	return error;
 }
 
@@ -4432,7 +4441,6 @@ audiosetinfo(struct audio_softc *sc, str
 	int error;
 	int np, nr;
 	unsigned int blks;
-	int oldpblksize, oldrblksize;
 	u_int gain;
 	bool rbus, pbus;
 	bool cleared, modechange, pausechange;
@@ -4511,9 +4519,6 @@ audiosetinfo(struct audio_softc *sc, str
 	if (np > 0 && (error = audio_check_params()))
 		return error;
 
-	oldpblksize = vc->sc_mpr.blksize;
-	oldrblksize = vc->sc_mrr.blksize;
-
 	setmode = 0;
 	if (nr > 0) {
 		if (!cleared) {
@@ -4698,50 +4703,6 @@ audiosetinfo(struct audio_softc *sc, str
 		pausechange = true;
 	}
 
-	if (SPECIFIED(ai->blocksize)) {
-		int pblksize, rblksize;

CVS commit: [bouyer-socketcan] src/sys/dev

2017-04-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Apr 26 10:10:05 UTC 2017

Modified Files:
src/sys/dev [bouyer-socketcan]: audio.c

Log Message:
SYnc with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.1 -r1.291.2.2 src/sys/dev/audio.c

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.291.2.1 src/sys/dev/audio.c:1.291.2.2
--- src/sys/dev/audio.c:1.291.2.1	Fri Apr 21 16:53:44 2017
+++ src/sys/dev/audio.c	Wed Apr 26 10:10:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.291.2.1 2017/04/21 16:53:44 bouyer Exp $	*/
+/*	$NetBSD: audio.c,v 1.291.2.2 2017/04/26 10:10:04 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.291.2.1 2017/04/21 16:53:44 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.291.2.2 2017/04/26 10:10:04 bouyer Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -3598,12 +3598,17 @@ audio_pint(void *v)
 		cv_broadcast(>sc_wchan);
 	}
 
-	if (audio_stream_get_used(>sc_pr.s) < blksize)
-		goto wake_mix;
-
 	vc->sc_mpr.s.outp = audio_stream_add_outp(>sc_mpr.s,
 	vc->sc_mpr.s.outp, blksize);
 
+	if (audio_stream_get_used(>sc_pr.s) < blksize) {
+		audio_fill_silence(>sc_pparams, vc->sc_mpr.s.inp,
+		vc->sc_mpr.blksize);
+		vc->sc_mpr.s.inp = audio_stream_add_inp(>sc_mpr.s,
+		vc->sc_mpr.s.inp, blksize);
+		goto wake_mix;
+	}
+
 	mix_write(sc);
 
 wake_mix:



CVS commit: src/doc

2017-04-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 26 10:07:45 UTC 2017

Modified Files:
src/doc: BRANCHES

Log Message:
Add my new prg-localcount2 branch, to take over from the previous one
which I messed up somehow.


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 src/doc/BRANCHES

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

Modified files:

Index: src/doc/BRANCHES
diff -u src/doc/BRANCHES:1.339 src/doc/BRANCHES:1.340
--- src/doc/BRANCHES:1.339	Wed Apr 26 07:51:23 2017
+++ src/doc/BRANCHES	Wed Apr 26 10:07:45 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: BRANCHES,v 1.339 2017/04/26 07:51:23 pgoyette Exp $
+#	$NetBSD: BRANCHES,v 1.340 2017/04/26 10:07:45 pgoyette Exp $
 #
 # This file contains a list of branches that exist in the NetBSD CVS
 # tree and their current state.
@@ -876,6 +876,22 @@ Scope:		src/sys and src/common
 Notes:		Used as experiment sandbox and if successful hopefully one day
 		to be integrated.
 
+Branch:		prg-localcount2
+Description:	Implement localcount reference counting as proposed by
+		riastradh@ - supersedes abandonded pgoyette-localcount
+Status:		Active
+Start Date:	Wed Apr 26 2017
+End Date:	
+Base Tag:	prg-localcount2-base
+Maintainer:	pgoyette
+Scope:		src/sys/
+Notes:		
+
+
+
+# Individual developers' branches (Terminated):
+
+
 Branch:		pgoyette-localcount
 Description:	Implement localcount reference counting as proposed by
 		riastradh@
@@ -892,11 +908,6 @@ Notes:		Abandoned - there seems to have 
 		The work will be salvaged as much as possible, and
 		applied to a new clean branch.
 
-
-
-# Individual developers' branches (Terminated):
-
-
 Branch:		bouyer-scsipi
 Description:	Integration of atapi support
 Status:		Terminated



CVS commit: src/sys/netipsec

2017-04-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 26 08:36:32 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Replace leading whitespaces with tabs and tweak some indentations


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.117 src/sys/netipsec/key.c:1.118
--- src/sys/netipsec/key.c:1.117	Wed Apr 26 07:17:38 2017
+++ src/sys/netipsec/key.c	Wed Apr 26 08:36:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.117 2017/04/26 07:17:38 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.118 2017/04/26 08:36:32 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.117 2017/04/26 07:17:38 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.118 2017/04/26 08:36:32 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -1878,9 +1878,9 @@ key_spdadd(struct socket *so, struct mbu
 	}
 
 	/* policy requests are mandatory when action is ipsec. */
-if (mhp->msg->sadb_msg_type != SADB_X_SPDSETIDX
-	 && xpl0->sadb_x_policy_type == IPSEC_POLICY_IPSEC
-	 && mhp->extlen[SADB_X_EXT_POLICY] <= sizeof(*xpl0)) {
+	if (mhp->msg->sadb_msg_type != SADB_X_SPDSETIDX &&
+	xpl0->sadb_x_policy_type == IPSEC_POLICY_IPSEC &&
+	mhp->extlen[SADB_X_EXT_POLICY] <= sizeof(*xpl0)) {
 		ipseclog((LOG_DEBUG, "key_spdadd: some policy requests part required.\n"));
 		return key_senderror(so, m, EINVAL);
 	}
@@ -2287,8 +2287,8 @@ key_spdget(struct socket *so, struct mbu
 	}
 
 	n = key_setdumpsp(sp, SADB_X_SPDGET, mhp->msg->sadb_msg_seq,
- mhp->msg->sadb_msg_pid);
-KEY_FREESP(); /* ref gained by key_getspbyid */
+	mhp->msg->sadb_msg_pid);
+	KEY_FREESP(); /* ref gained by key_getspbyid */
 	if (n != NULL) {
 		m_freem(m);
 		return key_sendup_mbuf(so, n, KEY_SENDUP_ONE);
@@ -3815,23 +3815,23 @@ key_porttosaddr(union sockaddr_union *sa
 static int
 key_checksalen(const union sockaddr_union *saddr)
 {
-switch (saddr->sa.sa_family) {
-case AF_INET:
-if (saddr->sa.sa_len != sizeof(struct sockaddr_in))
-return -1;
-break;
+	switch (saddr->sa.sa_family) {
+	case AF_INET:
+		if (saddr->sa.sa_len != sizeof(struct sockaddr_in))
+			return -1;
+		break;
 #ifdef INET6
-case AF_INET6:
-if (saddr->sa.sa_len != sizeof(struct sockaddr_in6))
-return -1;
-break;
-#endif
-default:
-printf("%s: unexpected sa_family %d\n", __func__,
-saddr->sa.sa_family);
-return -1;
-break;
-}
+	case AF_INET6:
+		if (saddr->sa.sa_len != sizeof(struct sockaddr_in6))
+			return -1;
+		break;
+#endif
+	default:
+		printf("%s: unexpected sa_family %d\n", __func__,
+		saddr->sa.sa_family);
+			return -1;
+		break;
+	}
 	return 0;
 }
 
@@ -4977,7 +4977,7 @@ key_getspi(struct socket *so, struct mbu
 			acq->created = time_uptime;
 			acq->count = 0;
 		}
-	}
+	}
 #endif
 
 {



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

2017-04-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Apr 26 08:20:47 UTC 2017

Modified Files:
src/sys/arch/arm/arm: disassem.c

Log Message:
Move mcrr/mrrc earlier so they match before stc/ldc


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

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

Modified files:

Index: src/sys/arch/arm/arm/disassem.c
diff -u src/sys/arch/arm/arm/disassem.c:1.35 src/sys/arch/arm/arm/disassem.c:1.36
--- src/sys/arch/arm/arm/disassem.c:1.35	Sat Mar 11 12:19:30 2017
+++ src/sys/arch/arm/arm/disassem.c	Wed Apr 26 08:20:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: disassem.c,v 1.35 2017/03/11 12:19:30 skrll Exp $	*/
+/*	$NetBSD: disassem.c,v 1.36 2017/04/26 08:20:47 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe.
@@ -49,7 +49,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: disassem.c,v 1.35 2017/03/11 12:19:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disassem.c,v 1.36 2017/04/26 08:20:47 skrll Exp $");
 
 #include 
 
@@ -149,10 +149,10 @@ static const struct arm32_insn arm32_i[]
 { 0xfe5fffe0, 0xf84d0500, "srs",	"XnW!m" },
 { 0xfe50, 0xf8100a00, "rfe",	"XnW" },
 { 0xfe00, 0xfa00, "blx",	"t" },		/* Before b and bl */
-{ 0xfe100090, 0xfc00, "stc2",	"L#v" },
-{ 0x0e100090, 0x0c00, "stc",	"L#v" },
 { 0x0ff0, 0x0c40, "mcrr",	"#&" },
 { 0x0ff0, 0x0c50, "mrrc",	"#&" },
+{ 0xfe100090, 0xfc00, "stc2",	"L#v" },
+{ 0x0e100090, 0x0c00, "stc",	"L#v" },
 { 0xfe100090, 0xfc10, "ldc2",	"L#v" },
 { 0x0e100090, 0x0c10, "ldc",	"L#v" },
 { 0xff10, 0xfe00, "cdp2",	"#y" },



CVS commit: src/sys/dev/pci

2017-04-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 26 08:00:03 UTC 2017

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

Log Message:
 Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/pci/ppb.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/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.59 src/sys/dev/pci/ppb.c:1.60
--- src/sys/dev/pci/ppb.c:1.59	Wed Apr 26 03:54:37 2017
+++ src/sys/dev/pci/ppb.c	Wed Apr 26 08:00:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.59 2017/04/26 03:54:37 msaitoh Exp $	*/
+/*	$NetBSD: ppb.c,v 1.60 2017/04/26 08:00:03 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.59 2017/04/26 03:54:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.60 2017/04/26 08:00:03 msaitoh Exp $");
 
 #include 
 #include 
@@ -60,7 +60,9 @@ static int	ppbmatch(device_t, cfdata_t, 
 static void	ppbattach(device_t, device_t, void *);
 static int	ppbdetach(device_t, int);
 static void	ppbchilddet(device_t, device_t);
+#ifdef PPB_USEINTR
 static int	ppb_intr(void *);
+#endif
 static bool	ppb_resume(device_t, const pmf_qual_t *);
 static bool	ppb_suspend(device_t, const pmf_qual_t *);
 
@@ -203,8 +205,10 @@ ppbattach(device_t parent, device_t self
 	struct pci_attach_args *pa = aux;
 	pci_chipset_tag_t pc = pa->pa_pc;
 	struct pcibus_attach_args pba;
+#ifdef PPB_USEINTR
 	char const *intrstr;
 	char intrbuf[PCI_INTRSTR_LEN];
+#endif
 	pcireg_t busdata, reg;
 
 	pci_aprint_devinfo(pa, NULL);
@@ -237,6 +241,7 @@ ppbattach(device_t parent, device_t self
 	/* Check for PCI Express capabilities and setup hotplug support. */
 	if (pci_get_capability(pc, pa->pa_tag, PCI_CAP_PCIEXPRESS,
 	>sc_pciecapoff, ) && (reg & PCIE_XCAP_SI)) {
+#ifdef PPB_USEINTR
 #if 0
 		/*
 		 * XXX Initialize workqueue or something else for
@@ -304,6 +309,17 @@ ppbattach(device_t parent, device_t self
 			pci_conf_write(pc, pa->pa_tag,
 			sc->sc_pciecapoff + PCIE_SLCSR, slcsr);
 		}
+#else
+		reg = pci_conf_read(sc->sc_pc, sc->sc_tag,
+		sc->sc_pciecapoff + PCIE_SLCSR);
+		if (reg & PCIE_SLCSR_NOTIFY_MASK) {
+			aprint_debug_dev(self,
+			"disabling notification events\n");
+			reg &= ~PCIE_SLCSR_NOTIFY_MASK;
+			pci_conf_write(sc->sc_pc, sc->sc_tag,
+			sc->sc_pciecapoff + PCIE_SLCSR, reg);
+		}
+#endif /* PPB_USEINTR */
 	}
 
 	if (!pmf_device_register(self, ppb_suspend, ppb_resume))
@@ -327,6 +343,7 @@ ppbattach(device_t parent, device_t self
 	pba.pba_intrswiz = pa->pa_intrswiz;
 	pba.pba_intrtag = pa->pa_intrtag;
 
+#ifdef PPB_USEINTR
 	/* Attach event counters */
 	evcnt_attach_dynamic(>sc_ev_intr, EVCNT_TYPE_INTR, NULL,
 	device_xname(sc->sc_dev), "Interrupt");
@@ -342,6 +359,7 @@ ppbattach(device_t parent, device_t self
 	device_xname(sc->sc_dev), "Command Completed");
 	evcnt_attach_dynamic(>sc_ev_lacs, EVCNT_TYPE_MISC, NULL,
 	device_xname(sc->sc_dev), "Data Link Layer State Changed");
+#endif
 
 	config_found_ia(self, "pcibus", , pcibusprint);
 }
@@ -349,13 +367,16 @@ ppbattach(device_t parent, device_t self
 static int
 ppbdetach(device_t self, int flags)
 {
+#ifdef PPB_USEINTR
 	struct ppb_softc *sc = device_private(self);
 	pcireg_t slcsr;
+#endif
 	int rc;
 
 	if ((rc = config_detach_children(self, flags)) != 0)
 		return rc;
 
+#ifdef PPB_USEINTR
 	/* Detach event counters */
 	evcnt_detach(>sc_ev_intr);
 	evcnt_detach(>sc_ev_abp);
@@ -377,6 +398,7 @@ ppbdetach(device_t self, int flags)
 		pci_intr_disestablish(sc->sc_pc, sc->sc_intrhand);
 		pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
 	}
+#endif
 
 	pmf_device_deregister(self);
 	return 0;
@@ -418,6 +440,7 @@ ppbchilddet(device_t self, device_t chil
 	/* we keep no references to child devices, so do nothing */
 }
 
+#ifdef PPB_USEINTR
 static int
 ppb_intr(void *arg)
 {
@@ -482,3 +505,4 @@ ppb_intr(void *arg)
 
 	return 0;
 }
+#endif /* PPB_USEINTR */



CVS commit: src/doc

2017-04-26 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 26 07:51:23 UTC 2017

Modified Files:
src/doc: BRANCHES

Log Message:
Abandon pgoyette-localcount branch due to unrecoverable CVS "pilot
errors".  Work will be salvaged and reappear on a new branch, soon.


To generate a diff of this commit:
cvs rdiff -u -r1.338 -r1.339 src/doc/BRANCHES

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

Modified files:

Index: src/doc/BRANCHES
diff -u src/doc/BRANCHES:1.338 src/doc/BRANCHES:1.339
--- src/doc/BRANCHES:1.338	Wed Mar 15 06:17:39 2017
+++ src/doc/BRANCHES	Wed Apr 26 07:51:23 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: BRANCHES,v 1.338 2017/03/15 06:17:39 snj Exp $
+#	$NetBSD: BRANCHES,v 1.339 2017/04/26 07:51:23 pgoyette Exp $
 #
 # This file contains a list of branches that exist in the NetBSD CVS
 # tree and their current state.
@@ -879,13 +879,18 @@ Notes:		Used as experiment sandbox and i
 Branch:		pgoyette-localcount
 Description:	Implement localcount reference counting as proposed by
 		riastradh@
-Status:		Active
+Status:		Terminated
 Start Date:	Fri Jul 15 2016
-End Date:
+End Date:	Wed Apr 26 2017
 Base Tag:	pgoyette-localcount-base
 Maintainer:	pgoyette
 Scope:		src/sys/
-Notes:
+Notes:		Abandoned - there seems to have been some CVS "pilot
+		error during one of the sync-with-head and now there
+		are an unknown number of commits missing from an
+		unknown number of files from an unknown time period.
+		The work will be salvaged as much as possible, and
+		applied to a new clean branch.
 
 
 



CVS commit: src/lib/libc

2017-04-26 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Wed Apr 26 07:40:09 UTC 2017

Modified Files:
src/lib/libc/stdlib: memory.3
src/lib/libc/string: string.3

Log Message:
Clean up the NAME section.

The entries in the NAME section of these man pages have man pages of their
own, so it doesn't make sense to have their names here, instead they
should be just described in the body (similar to what we do in math(3) man 
page).

This also helps whatis(1) and apropos(1), as otherwise you would see multiple
results with the same name in the output, while there is actually only one page
with that name.

Good example is:

$ apropos -n 2 -M realloc
realloc (3)   general memory allocation operations
realloc (3)   general purpose memory allocation functions

The first line is there because memory(3) man page had realloc in its
NAME section. This commit will fix this issue.

ok wiz@


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/stdlib/memory.3
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/string/string.3

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/stdlib/memory.3
diff -u src/lib/libc/stdlib/memory.3:1.11 src/lib/libc/stdlib/memory.3:1.12
--- src/lib/libc/stdlib/memory.3:1.11	Sun Sep 11 10:05:23 2011
+++ src/lib/libc/stdlib/memory.3	Wed Apr 26 07:40:09 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: memory.3,v 1.11 2011/09/11 10:05:23 jruoho Exp $
+.\"	$NetBSD: memory.3,v 1.12 2017/04/26 07:40:09 abhinav Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,15 +29,11 @@
 .\"
 .\" from: @(#)memory.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd September 11, 2011
+.Dd April 26, 2017
 .Dt MEMORY 3
 .Os
 .Sh NAME
-.Nm malloc ,
-.Nm free ,
-.Nm realloc ,
-.Nm calloc ,
-.Nm alloca
+.Nm memory
 .Nd general memory allocation operations
 .Sh LIBRARY
 .Lb libc

Index: src/lib/libc/string/string.3
diff -u src/lib/libc/string/string.3:1.17 src/lib/libc/string/string.3:1.18
--- src/lib/libc/string/string.3:1.17	Thu Jul 14 18:36:57 2016
+++ src/lib/libc/string/string.3	Wed Apr 26 07:40:09 2017
@@ -28,43 +28,13 @@
 .\" SUCH DAMAGE.
 .\"
 .\" from: @(#)string.3	8.2 (Berkeley) 12/11/93
-.\"	$NetBSD: string.3,v 1.17 2016/07/14 18:36:57 abhinav Exp $
+.\"	$NetBSD: string.3,v 1.18 2017/04/26 07:40:09 abhinav Exp $
 .\"
-.Dd May 1, 2009
+.Dd April 26, 2017
 .Dt STRING 3
 .Os
 .Sh NAME
-.Nm stpcpy ,
-.Nm stpncpy ,
-.Nm strcat ,
-.Nm strlcat ,
-.Nm strncat ,
-.Nm strchr ,
-.Nm strrchr ,
-.Nm strcmp ,
-.Nm strncmp ,
-.Nm strcasecmp ,
-.Nm strncasecmp ,
-.Nm strcoll ,
-.Nm strcpy ,
-.Nm strlcpy ,
-.Nm strncpy ,
-.Nm strerror ,
-.Nm strerror_r ,
-.Nm strlen ,
-.Nm strnlen ,
-.Nm strpbrk ,
-.Nm strsep ,
-.Nm stresep ,
-.Nm strspn ,
-.Nm strcspn ,
-.Nm strdup ,
-.Nm strndup ,
-.Nm strstr ,
-.Nm strcasestr ,
-.Nm strtok ,
-.Nm strtok_r ,
-.Nm strxfrm
+.Nm string
 .Nd string specific functions
 .Sh LIBRARY
 .Lb libc



CVS commit: src/sys/netipsec

2017-04-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 26 07:17:38 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Remove unnecessary LIST_FOREACH definition


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.116 src/sys/netipsec/key.c:1.117
--- src/sys/netipsec/key.c:1.116	Thu Apr 20 06:27:08 2017
+++ src/sys/netipsec/key.c	Wed Apr 26 07:17:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.116 2017/04/20 06:27:08 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.117 2017/04/26 07:17:38 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.116 2017/04/20 06:27:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.117 2017/04/26 07:17:38 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -285,10 +285,6 @@ SYSCTL_INT(_net_key, KEYCTL_PREFERED_OLD
 	_prefered_oldsa,	0,	"");
 #endif /* SYSCTL_INT */
 
-#ifndef LIST_FOREACH
-#define LIST_FOREACH(elm, head, field) \
-	for (elm = LIST_FIRST(head); elm; elm = LIST_NEXT(elm, field))
-#endif
 #define __LIST_CHAINED(elm) \
 	(!((elm)->chain.le_next == NULL && (elm)->chain.le_prev == NULL))
 #define LIST_INSERT_TAIL(head, elm, type, field) \