CVS commit: src/sys/dev

2017-02-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 24 07:52:39 UTC 2017

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

Log Message:
Fix a locking botch in previous


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 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.308 src/sys/dev/audio.c:1.309
--- src/sys/dev/audio.c:1.308	Thu Feb 23 23:19:04 2017
+++ src/sys/dev/audio.c	Fri Feb 24 07:52:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.308 2017/02/23 23:19:04 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.309 2017/02/24 07:52:39 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.308 2017/02/23 23:19:04 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.309 2017/02/24 07:52:39 skrll Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -911,6 +911,7 @@ audioactivate(device_t self, enum devact
 		mutex_enter(sc->sc_intr_lock);
 		cv_broadcast(>sc_condvar);
 		mutex_exit(sc->sc_intr_lock);
+		mutex_exit(sc->sc_lock);
 		return 0;
 	default:
 		return EOPNOTSUPP;



CVS commit: src/sys/dev/pci

2017-02-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Feb 24 06:39:54 UTC 2017

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

Log Message:
 Use macro. KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 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.158 src/sys/dev/pci/pci_subr.c:1.159
--- src/sys/dev/pci/pci_subr.c:1.158	Fri Feb 24 05:04:46 2017
+++ src/sys/dev/pci/pci_subr.c	Fri Feb 24 06:39:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.158 2017/02/24 05:04:46 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.159 2017/02/24 06:39:54 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.158 2017/02/24 05:04:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.159 2017/02/24 06:39:54 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -789,7 +789,7 @@ pci_conf_print_common(
 		printf("unknown/reserved");	/* XXX */
 		break;
 	}
-	printf(" (0x%x)\n", (rval & PCI_STATUS_DEVSEL_MASK) >> 25);
+	printf(" (0x%x)\n", __SHIFTOUT(rval, PCI_STATUS_DEVSEL_MASK));
 
 	onoff("Slave signaled Target Abort", rval,
 	PCI_STATUS_TARGET_TARGET_ABORT);
@@ -1544,38 +1544,38 @@ pci_conf_print_pcie_cap(const pcireg_t *
 	printf("  Capability version: %u\n", pciever);
 	printf("  Device type: ");
 	switch ((reg & 0x00f0) >> 20) {
-	case 0x0:
+	case PCIE_XCAP_TYPE_PCIE_DEV:	/* 0x0 */
 		printf("PCI Express Endpoint device\n");
 		check_link = true;
 		break;
-	case 0x1:
+	case PCIE_XCAP_TYPE_PCI_DEV:	/* 0x1 */
 		printf("Legacy PCI Express Endpoint device\n");
 		check_link = true;
 		break;
-	case 0x4:
+	case PCIE_XCAP_TYPE_ROOT:	/* 0x4 */
 		printf("Root Port of PCI Express Root Complex\n");
 		check_link = true;
 		check_slot = true;
 		check_rootport = true;
 		break;
-	case 0x5:
+	case PCIE_XCAP_TYPE_UP:		/* 0x5 */
 		printf("Upstream Port of PCI Express Switch\n");
 		break;
-	case 0x6:
+	case PCIE_XCAP_TYPE_DOWN:	/* 0x6 */
 		printf("Downstream Port of PCI Express Switch\n");
 		check_slot = true;
 		check_rootport = true;
 		break;
-	case 0x7:
+	case PCIE_XCAP_TYPE_PCIE2PCI:	/* 0x7 */
 		printf("PCI Express to PCI/PCI-X Bridge\n");
 		break;
-	case 0x8:
+	case PCIE_XCAP_TYPE_PCI2PCIE:	/* 0x8 */
 		printf("PCI/PCI-X to PCI Express Bridge\n");
 		break;
-	case 0x9:
+	case PCIE_XCAP_TYPE_ROOT_INTEP:	/* 0x9 */
 		printf("Root Complex Integrated Endpoint\n");
 		break;
-	case 0xa:
+	case PCIE_XCAP_TYPE_ROOT_EVNTC:	/* 0xa */
 		check_rootport = true;
 		printf("Root Complex Event Collector\n");
 		break;
@@ -1585,7 +1585,7 @@ pci_conf_print_pcie_cap(const pcireg_t *
 	}
 	onoff("Slot implemented", reg, PCIE_XCAP_SI);
 	printf("  Interrupt Message Number: 0x%02x\n",
-	(unsigned int)((reg & PCIE_XCAP_IRQ) >> 27));
+	(unsigned int)__SHIFTOUT(reg, PCIE_XCAP_IRQ));
 
 	/* Device Capability Register */
 	reg = regs[o2i(capoff + PCIE_DCAP)];
@@ -1593,7 +1593,7 @@ pci_conf_print_pcie_cap(const pcireg_t *
 	printf("  Max Payload Size Supported: %u bytes max\n",
 	128 << (unsigned int)(reg & PCIE_DCAP_MAX_PAYLOAD));
 	printf("  Phantom Functions Supported: ");
-	switch ((reg & PCIE_DCAP_PHANTOM_FUNCS) >> 3) {
+	switch (__SHIFTOUT(reg, PCIE_DCAP_PHANTOM_FUNCS)) {
 	case 0x0:
 		printf("not available\n");
 		break;
@@ -1610,17 +1610,17 @@ pci_conf_print_pcie_cap(const pcireg_t *
 	printf("  Extended Tag Field Supported: %dbit\n",
 	(reg & PCIE_DCAP_EXT_TAG_FIELD) == 0 ? 5 : 8);
 	printf("  Endpoint L0 Acceptable Latency: ");
-	pci_print_pcie_L0s_latency((reg & PCIE_DCAP_L0S_LATENCY) >> 6);
+	pci_print_pcie_L0s_latency(__SHIFTOUT(reg, PCIE_DCAP_L0S_LATENCY));
 	printf("  Endpoint L1 Acceptable Latency: ");
-	pci_print_pcie_L1_latency((reg & PCIE_DCAP_L1_LATENCY) >> 9);
+	pci_print_pcie_L1_latency(__SHIFTOUT(reg, PCIE_DCAP_L1_LATENCY));
 	onoff("Attention Button Present", reg, PCIE_DCAP_ATTN_BUTTON);
 	onoff("Attention Indicator Present", reg, PCIE_DCAP_ATTN_IND);
 	onoff("Power Indicator Present", reg, PCIE_DCAP_PWR_IND);
 	onoff("Role-Based Error Report", reg, PCIE_DCAP_ROLE_ERR_RPT);
-	printf("  Captured Slot Power Limit Value: %d\n",
-	(unsigned int)(reg & PCIE_DCAP_SLOT_PWR_LIM_VAL) >> 18);
-	printf("  Captured Slot Power Limit Scale: %d\n",
-	(unsigned int)(reg & PCIE_DCAP_SLOT_PWR_LIM_SCALE) >> 26);
+	printf("  Captured Slot Power Limit Value: %u\n",
+	(unsigned int)__SHIFTOUT(reg, PCIE_DCAP_SLOT_PWR_LIM_VAL));
+	printf("  Captured Slot Power Limit Scale: %u\n",
+	(unsigned int)__SHIFTOUT(reg, PCIE_DCAP_SLOT_PWR_LIM_SCALE));
 	onoff("Function-Level Reset Capability", reg, PCIE_DCAP_FLR);
 
 	/* Device Control Register */
@@ -1633,13 +1633,13 @@ pci_conf_print_pcie_cap(const 

CVS commit: src/tests/kernel

2017-02-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 24 06:17:48 UTC 2017

Modified Files:
src/tests/kernel: t_ptrace_wait.c

Log Message:
Add new test syscall1 in t_ptrace_wait*

syscall1:
Verify that getpid(2) can be traced with PT_SYSCALL

Enforce usage of syscall(2), it should prevent failing on any possible
optimizations in future as a libc can ship this information not through
syscall (shared struct with kernel or similar).

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/tests/kernel/t_ptrace_wait.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/kernel/t_ptrace_wait.c
diff -u src/tests/kernel/t_ptrace_wait.c:1.72 src/tests/kernel/t_ptrace_wait.c:1.73
--- src/tests/kernel/t_ptrace_wait.c:1.72	Thu Feb 23 00:50:09 2017
+++ src/tests/kernel/t_ptrace_wait.c	Fri Feb 24 06:17:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.72 2017/02/23 00:50:09 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.73 2017/02/24 06:17:48 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,13 +27,14 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.72 2017/02/23 00:50:09 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.73 2017/02/24 06:17:48 kamil Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -7401,6 +7402,74 @@ ATF_TC_BODY(resume1, tc)
 	msg_close();
 }
 
+ATF_TC(syscall1);
+ATF_TC_HEAD(syscall1, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Verify that getpid(2) can be traced with PT_SYSCALL");
+}
+
+ATF_TC_BODY(syscall1, tc)
+{
+	const int exitval = 5;
+	const int sigval = SIGSTOP;
+	pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+
+	printf("Before forking process PID=%d\n", getpid());
+	ATF_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+		printf("Before raising %s from child\n", strsignal(sigval));
+		FORKEE_ASSERT(raise(sigval) == 0);
+
+		syscall(SYS_getpid);
+
+		printf("Before exiting of the child process\n");
+		_exit(exitval);
+	}
+	printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+	printf("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sigval);
+
+	printf("Before resuming the child process where it left off and "
+	"without signal to be sent\n");
+	ATF_REQUIRE(ptrace(PT_SYSCALL, child, (void *)1, 0) != -1);
+
+	printf("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, SIGTRAP);
+
+	printf("Before resuming the child process where it left off and "
+	"without signal to be sent\n");
+	ATF_REQUIRE(ptrace(PT_SYSCALL, child, (void *)1, 0) != -1);
+
+	printf("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, SIGTRAP);
+
+	printf("Before resuming the child process where it left off and "
+	"without signal to be sent\n");
+	ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+	printf("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_exited(status, exitval);
+
+	printf("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 	setvbuf(stdout, NULL, _IONBF, 0);
@@ -7529,5 +7598,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, setsigmask5);
 	ATF_TP_ADD_TC(tp, setsigmask6);
 
+	ATF_TP_ADD_TC(tp, syscall1);
+
 	return atf_no_error();
 }



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

2017-02-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Feb 24 05:38:30 UTC 2017

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

Log Message:
 Print mac.type and the TrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/ixgbe/ixgbe_type.h

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.78 src/sys/dev/pci/ixgbe/ixgbe.c:1.79
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.78	Thu Feb 16 08:01:11 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Feb 24 05:38:30 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/
-/*$NetBSD: ixgbe.c,v 1.78 2017/02/16 08:01:11 msaitoh Exp $*/
+/*$NetBSD: ixgbe.c,v 1.79 2017/02/24 05:38:30 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -453,10 +453,11 @@ ixgbe_attach(device_t parent, device_t d
 	struct adapter *adapter;
 	struct ixgbe_hw *hw;
 	int error = -1;
-	u16		csum;
+	u16		csum, high, low;
 	u32		ctrl_ext;
 	ixgbe_vendor_info_t *ent;
 	struct pci_attach_args *pa = aux;
+	const char *str;
 
 	INIT_DEBUGOUT("ixgbe_attach: begin");
 
@@ -493,6 +494,40 @@ ixgbe_attach(device_t parent, device_t d
 	/* Determine hardware revision */
 	ixgbe_identify_hardware(adapter);
 
+	switch (hw->mac.type) {
+	case ixgbe_mac_82598EB:
+		str = "82598EB";
+		break;
+	case ixgbe_mac_82599EB:
+		str = "82599EB";
+		break;
+	case ixgbe_mac_82599_vf:
+		str = "82599 VF";
+		break;
+	case ixgbe_mac_X540:
+		str = "X540";
+		break;
+	case ixgbe_mac_X540_vf:
+		str = "X540 VF";
+		break;
+	case ixgbe_mac_X550:
+		str = "X550";
+		break;
+	case ixgbe_mac_X550EM_x:
+		str = "X550EM";
+		break;
+	case ixgbe_mac_X550_vf:
+		str = "X550 VF";
+		break;
+	case ixgbe_mac_X550EM_x_vf:
+		str = "X550EM X VF";
+		break;
+	default:
+		str = "Unknown";
+		break;
+	}
+	aprint_normal_dev(dev, "device %s\n", str);
+
 	/* Do base PCI setup - map BAR0 */
 	if (ixgbe_allocate_pci_resources(adapter, pa)) {
 		aprint_error_dev(dev, "Allocation of PCI resources failed\n");
@@ -582,6 +617,11 @@ ixgbe_attach(device_t parent, device_t d
 		goto err_late;
 	}
 
+	/* Print the TrackID */
+	hw->eeprom.ops.read(hw, IXGBE_TRACKID_H, );
+	hw->eeprom.ops.read(hw, IXGBE_TRACKID_L, );
+	aprint_normal_dev(dev, "TrackID %08x\n", ((uint32_t)high << 16) | low);
+
 	error = ixgbe_init_hw(hw);
 	switch (error) {
 	case IXGBE_ERR_EEPROM_VERSION:

Index: src/sys/dev/pci/ixgbe/ixgbe_type.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.18 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.19
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.18	Thu Jan 19 06:56:33 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h	Fri Feb 24 05:38:30 2017
@@ -31,7 +31,7 @@
 
 **/
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_type.h 299200 2016-05-06 22:54:56Z pfg $*/
-/*$NetBSD: ixgbe_type.h,v 1.18 2017/01/19 06:56:33 msaitoh Exp $*/
+/*$NetBSD: ixgbe_type.h,v 1.19 2017/02/24 05:38:30 msaitoh Exp $*/
 
 #ifndef _IXGBE_TYPE_H_
 #define _IXGBE_TYPE_H_
@@ -2225,6 +2225,8 @@ enum {
 
 #define IXGBE_SAN_MAC_ADDR_PTR		0x28
 #define IXGBE_DEVICE_CAPS		0x2C
+#define IXGBE_TRACKID_L			0x2d
+#define IXGBE_TRACKID_H			0x2e
 #define IXGBE_SERIAL_NUMBER_MAC_ADDR	0x11
 #define IXGBE_PCIE_MSIX_82599_CAPS	0x72
 #define IXGBE_MAX_MSIX_VECTORS_82599	0x40



CVS commit: src/sys/dev/pci

2017-02-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Feb 24 05:04:46 UTC 2017

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

Log Message:
Fix 0x%u...


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 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.157 src/sys/dev/pci/pci_subr.c:1.158
--- src/sys/dev/pci/pci_subr.c:1.157	Wed Feb 15 06:53:55 2017
+++ src/sys/dev/pci/pci_subr.c	Fri Feb 24 05:04:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.157 2017/02/15 06:53:55 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.158 2017/02/24 05:04:46 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.157 2017/02/15 06:53:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.158 2017/02/24 05:04:46 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -2370,7 +2370,7 @@ pci_conf_print_aer_cap_rooterr_status(pc
 	onoff("First Uncorrectable Fatal", reg, PCI_AER_ROOTERR_FIRST_UC_FATAL);
 	onoff("Non-Fatal Error Messages Received", reg, PCI_AER_ROOTERR_NF_ERR);
 	onoff("Fatal Error Messages Received", reg, PCI_AER_ROOTERR_F_ERR);
-	printf("  Advanced Error Interrupt Message Number: 0x%u\n",
+	printf("  Advanced Error Interrupt Message Number: 0x%02x\n",
 	(pcireg_t)__SHIFTOUT(reg, PCI_AER_ROOTERR_INT_MESSAGE));
 }
 
@@ -2930,7 +2930,7 @@ pci_conf_print_sriov_cap(const pcireg_t 
 	onoff("ARI Capable Hierarchy Preserved", reg,
 	PCI_SRIOV_CAP_ARI_CAP_HIER_PRESERVED);
 	if (reg & PCI_SRIOV_CAP_VF_MIGRATION) {
-		printf("  VF Migration Interrupt Message Number: 0x%u\n",
+		printf("  VF Migration Interrupt Message Number: 0x%03x\n",
 		(pcireg_t)__SHIFTOUT(reg,
 		  PCI_SRIOV_CAP_VF_MIGRATION_INTMSG_N));
 	}



CVS commit: src/tools/mips-elf2ecoff/machine

2017-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 24 03:44:54 UTC 2017

Modified Files:
src/tools/mips-elf2ecoff/machine: ecoff_machdep.h

Log Message:
refresh


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tools/mips-elf2ecoff/machine/ecoff_machdep.h

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

Modified files:

Index: src/tools/mips-elf2ecoff/machine/ecoff_machdep.h
diff -u src/tools/mips-elf2ecoff/machine/ecoff_machdep.h:1.2 src/tools/mips-elf2ecoff/machine/ecoff_machdep.h:1.3
--- src/tools/mips-elf2ecoff/machine/ecoff_machdep.h:1.2	Sat Mar 23 12:13:45 2002
+++ src/tools/mips-elf2ecoff/machine/ecoff_machdep.h	Thu Feb 23 22:44:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ecoff_machdep.h,v 1.2 2002/03/23 17:13:45 bouyer Exp $	*/
+/*	$NetBSD: ecoff_machdep.h,v 1.3 2017/02/24 03:44:54 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone
@@ -34,23 +34,25 @@
  * SUCH DAMAGE.
  */
 
-typedef u_int16_t	ECOFF_USHORT;
-typedef u_int32_t	ECOFF_UINT;
-typedef u_int32_t	ECOFF_ULONG;
-
 #define ECOFF_LDPGSZ 4096
 
 #define ECOFF_PAD
+#define ECOFF32_PAD
+
+#define ECOFF32_MACHDEP \
+ecoff32_ulong gprmask; \
+ecoff32_ulong cprmask[4]; \
+ecoff32_ulong gp_value
 
 #define ECOFF_MACHDEP \
-ECOFF_ULONG gprmask; \
-ECOFF_ULONG cprmask[4]; \
-ECOFF_ULONG gp_value
+u_long gprmask; \
+u_long cprmask[4]; \
+u_long gp_value
 #ifdef _KERNEL
-#include 		/* mips CPU architecture levels */
+#include 		/* mips CPU architecture levels */
 #define _MIPS3_OK() CPUISMIPS3
 #else
-#define _MIPS3_OK() 1
+#define _MIPS3_OK() /*CONSTCOND*/1
 #endif
 
 
@@ -71,15 +73,43 @@ typedef u_int32_t	ECOFF_ULONG;
 
 
 #define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
+#define ECOFF32_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
 
 #ifdef _KERNEL
 struct proc;
 struct exec_package;
-void	cpu_exec_ecoff_setregs __P((
-struct proc *, struct exec_package *, u_long));
+void	cpu_exec_ecoff_setregs(struct lwp *, struct exec_package *, vaddr_t);
 #endif	/* _KERNEL */
 
 
+struct ecoff32_symhdr {
+	int16_t		magic;
+	int16_t		vstamp;
+	int32_t		ilineMax;
+	int32_t		cbLine;
+	int32_t		cbLineOffset;
+	int32_t		idnMax;
+	int32_t		cbDnOffset;
+	int32_t		ipdMax;
+	int32_t		cbPdOffset;
+	int32_t		isymMax;
+	int32_t		cbSymOffset;
+	int32_t		ioptMax;
+	int32_t		cbOptOffset;
+	int32_t		iauxMax;
+	int32_t		cbAuxOffset;
+	int32_t		issMax;
+	int32_t		cbSsOffset;
+	int32_t		issExtMax;
+	int32_t		cbSsExtOffset;
+	int32_t		ifdMax;
+	int32_t		cbFdOffset;
+	int32_t		crfd;
+	int32_t		cbRfdOffset;
+	int32_t		iextMax;
+	int32_t		cbExtOffset;
+};
+
 /*
  * ECOFF symbol definitions for 32-bit mips.
  * XXX 64-bit (mips3?) may be different.
@@ -126,3 +156,14 @@ struct ecoff_extsym {
 	unsigned	:1;
 	unsigned	es_symauxindex:20;
 };
+
+struct ecoff32_extsym {
+	uint16_t	es_flags;
+	uint16_t	es_ifd;
+	int32_t		es_strindex;
+	int32_t		es_value;
+	unsigned	es_type:6;
+	unsigned	es_class:5;
+	unsigned	:1;
+	unsigned	es_symauxindex:20;
+};



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-02-23 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Feb 24 01:27:14 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: reader.c

Log Message:
Revert "Remove a useless loop around getpass()"

getpass(3) may return NULL upon failures on Linux, and netpgp should remain
portable to other systems.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 \
src/crypto/external/bsd/netpgp/dist/src/lib/reader.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.50 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.51
--- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.50	Mon Feb 20 01:33:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c	Fri Feb 24 01:27:14 2017
@@ -54,7 +54,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: reader.c,v 1.50 2017/02/20 01:33:28 khorben Exp $");
+__RCSID("$NetBSD: reader.c,v 1.51 2017/02/24 01:27:14 khorben Exp $");
 #endif
 
 #include 
@@ -162,7 +162,8 @@ pgp_getpassphrase(void *in, char *phrase
 	char	*p;
 
 	if (in == NULL) {
-		p = getpass("netpgp passphrase: ");
+		while ((p = getpass("netpgp passphrase: ")) == NULL) {
+		}
 		(void) snprintf(phrase, size, "%s", p);
 	} else {
 		if (fgets(phrase, (int)size, in) == NULL) {



CVS commit: src/crypto/external/bsd/netpgp/dist/src

2017-02-23 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Feb 24 01:26:17 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c
src/crypto/external/bsd/netpgp/dist/src/librsa: rsastubs.c

Log Message:
Revert "Remove a useless loop around getpass()"

getpass(3) may return NULL upon failures on Linux, and netpgp should remain
portable to other systems.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.99 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.100
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.99	Mon Feb 20 01:38:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Fri Feb 24 01:26:17 2017
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.99 2017/02/20 01:38:28 khorben Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.100 2017/02/24 01:26:17 khorben Exp $");
 #endif
 
 #include 
@@ -740,10 +740,14 @@ find_passphrase(FILE *passfp, const char
 	}
 	for (i = 0 ; i < attempts ; i++) {
 		(void) snprintf(prompt, sizeof(prompt), "Enter passphrase for %.16s: ", id);
-		cp = getpass(prompt);
+		if ((cp = getpass(prompt)) == NULL) {
+			break;
+		}
 		cc = snprintf(buf, sizeof(buf), "%s", cp);
 		(void) snprintf(prompt, sizeof(prompt), "Repeat passphrase for %.16s: ", id);
-		cp = getpass(prompt);
+		if ((cp = getpass(prompt)) == NULL) {
+			break;
+		}
 		cc = snprintf(passphrase, size, "%s", cp);
 		if (strcmp(buf, passphrase) == 0) {
 			(void) memset(buf, 0x0, sizeof(buf));

Index: src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c
diff -u src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.3 src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.4
--- src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.3	Mon Feb 20 01:38:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c	Fri Feb 24 01:26:17 2017
@@ -43,7 +43,9 @@ pass_cb(char *buf, int size, int rwflag,
 
 	USE_ARG(rwflag);
 	snprintf(prompt, sizeof(prompt), "\"%s\" passphrase: ", (char *)u);
-	passphrase = getpass(prompt);
+	if ((passphrase = getpass(prompt)) == NULL) {
+		return -1;
+	}
 	(void) memcpy(buf, passphrase, (size_t)size);
 	return (int)strlen(passphrase);
 }



CVS commit: src/sys/dev

2017-02-23 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Feb 23 23:19:04 UTC 2017

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

Log Message:
Hold the intr_lock when broadcasting/waiting on sc_[rec]condvar.


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 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.307 src/sys/dev/audio.c:1.308
--- src/sys/dev/audio.c:1.307	Tue Feb 21 20:23:37 2017
+++ src/sys/dev/audio.c	Thu Feb 23 23:19:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.307 2017/02/21 20:23:37 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.308 2017/02/23 23:19:04 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.307 2017/02/21 20:23:37 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.308 2017/02/23 23:19:04 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -908,8 +908,9 @@ audioactivate(device_t self, enum devact
 	case DVACT_DEACTIVATE:
 		mutex_enter(sc->sc_lock);
 		sc->sc_dying = true;
+		mutex_enter(sc->sc_intr_lock);
 		cv_broadcast(>sc_condvar);
-		mutex_exit(sc->sc_lock);
+		mutex_exit(sc->sc_intr_lock);
 		return 0;
 	default:
 		return EOPNOTSUPP;
@@ -933,8 +934,10 @@ audiodetach(device_t self, int flags)
 	sc->sc_dying = true;
 	cv_broadcast(>sc_wchan);
 	cv_broadcast(>sc_rchan);
+	mutex_enter(sc->sc_intr_lock);
 	cv_broadcast(>sc_condvar);
 	cv_broadcast(>sc_rcondvar);
+	mutex_exit(sc->sc_intr_lock);
 	mutex_exit(sc->sc_lock);
 	kthread_join(sc->sc_playthread);
 	kthread_join(sc->sc_recthread);
@@ -6007,15 +6010,18 @@ audio_play_thread(void *v)
 	
 	sc = (struct audio_softc *)v;
 
-	mutex_enter(sc->sc_lock);
 	for (;;) {
-		cv_wait_sig(>sc_condvar, sc->sc_lock);
+		mutex_enter(sc->sc_intr_lock);
+		cv_wait_sig(>sc_condvar, sc->sc_intr_lock);
 		if (sc->sc_dying) {
-			mutex_exit(sc->sc_lock);
+			mutex_exit(sc->sc_intr_lock);
 			kthread_exit(0);
 		}
+		mutex_exit(sc->sc_intr_lock);
 
+		mutex_enter(sc->sc_lock);
 		audio_mix(sc);
+		mutex_exit(sc->sc_lock);
 	}
 }
 
@@ -6026,15 +6032,18 @@ audio_rec_thread(void *v)
 	
 	sc = (struct audio_softc *)v;
 
-	mutex_enter(sc->sc_lock);
 	for (;;) {
-		cv_wait_sig(>sc_rcondvar, sc->sc_lock);
+		mutex_enter(sc->sc_intr_lock);
+		cv_wait_sig(>sc_rcondvar, sc->sc_intr_lock);
 		if (sc->sc_dying) {
-			mutex_exit(sc->sc_lock);
+			mutex_exit(sc->sc_intr_lock);
 			kthread_exit(0);
 		}
+		mutex_exit(sc->sc_intr_lock);
 
+		mutex_enter(sc->sc_lock);
 		audio_upmix(sc);
+		mutex_exit(sc->sc_lock);
 	}
 
 }



CVS commit: src/sys/dev/pad

2017-02-23 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Feb 23 23:13:27 UTC 2017

Modified Files:
src/sys/dev/pad: pad.c padvar.h

Log Message:
Update pad due to changes in audio.  sc_bytes_count and BYTESTOSLEEP are
no longer required.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pad/padvar.h

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

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.27 src/sys/dev/pad/pad.c:1.28
--- src/sys/dev/pad/pad.c:1.27	Thu Jan 26 04:10:27 2017
+++ src/sys/dev/pad/pad.c	Thu Feb 23 23:13:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.27 2017/01/26 04:10:27 nat Exp $ */
+/* $NetBSD: pad.c,v 1.28 2017/02/23 23:13:27 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.27 2017/01/26 04:10:27 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.28 2017/02/23 23:13:27 nat Exp $");
 
 #include 
 #include 
@@ -321,7 +321,6 @@ pad_open(dev_t dev, int flags, int fmt, 
 	}
 	
 	getmicrotime(>sc_last);
-	sc->sc_bytes_count = 0;
 
 	return 0;
 }
@@ -342,8 +341,7 @@ pad_close(dev_t dev, int flags, int fmt,
 }
 
 #define PAD_BYTES_PER_SEC (44100 * sizeof(int16_t) * 2)
-#define TIMENEXTREAD	(20 * 1000)
-#define BYTESTOSLEEP ((PAD_BYTES_PER_SEC / (100 / TIMENEXTREAD)) + PAD_BLKSIZE)
+#define TIMENEXTREAD	(PAD_BLKSIZE * 1000 / PAD_BYTES_PER_SEC)
 
 int
 pad_read(dev_t dev, struct uio *uio, int flags)
@@ -371,27 +369,20 @@ pad_read(dev_t dev, struct uio *uio, int
 		nowusec = (now.tv_sec * 100) + now.tv_usec;
 		lastusec = (sc->sc_last.tv_sec * 100) +
 		 sc->sc_last.tv_usec;
-		if (lastusec + TIMENEXTREAD > nowusec &&
-		 sc->sc_bytes_count >= BYTESTOSLEEP) {
+		if (lastusec + TIMENEXTREAD > nowusec) {
 			wait_ticks = (hz * ((lastusec + TIMENEXTREAD) -
 			 nowusec)) / 100;
 			if (wait_ticks > 0) {
 kpause("padwait", TRUE, wait_ticks,
- >sc_lock);
+>sc_lock);
 			}
-
-			sc->sc_bytes_count -= BYTESTOSLEEP;
-			getmicrotime(>sc_last);
-		} else if (sc->sc_bytes_count >= BYTESTOSLEEP) {
-			sc->sc_bytes_count -= BYTESTOSLEEP;
-			getmicrotime(>sc_last);
-		} else if (lastusec + TIMENEXTREAD <= nowusec)
-			getmicrotime(>sc_last);
-
+		}
+		sc->sc_last.tv_sec =
+			(lastusec + TIMENEXTREAD) / 100;
+		sc->sc_last.tv_usec =
+			(lastusec + TIMENEXTREAD) % 100;
 		err = pad_get_block(sc, , min(uio->uio_resid, PAD_BLKSIZE));
 		if (!err) {
-			sc->sc_bytes_count += pb.pb_len;
-
 			mutex_exit(>sc_lock);
 			err = uiomove(pb.pb_ptr, pb.pb_len, uio);
 			continue;

Index: src/sys/dev/pad/padvar.h
diff -u src/sys/dev/pad/padvar.h:1.6 src/sys/dev/pad/padvar.h:1.7
--- src/sys/dev/pad/padvar.h:1.6	Fri Feb 26 13:17:04 2016
+++ src/sys/dev/pad/padvar.h	Thu Feb 23 23:13:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: padvar.h,v 1.6 2016/02/26 13:17:04 nat Exp $ */
+/* $NetBSD: padvar.h,v 1.7 2017/02/23 23:13:27 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -52,7 +52,6 @@ typedef struct pad_softc {
 
 	uint8_t		sc_swvol;
 	struct timeval	sc_last;
-	int		sc_bytes_count;
 } pad_softc_t;
 
 #endif /* !_SYS_DEV_PAD_PADVAR_H */



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

2017-02-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 23 22:33:31 UTC 2017

Modified Files:
src/sys/arch/arm/marvell: armadaxp.c

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/marvell/armadaxp.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/marvell/armadaxp.c
diff -u src/sys/arch/arm/marvell/armadaxp.c:1.18 src/sys/arch/arm/marvell/armadaxp.c:1.19
--- src/sys/arch/arm/marvell/armadaxp.c:1.18	Wed Jan 11 19:42:02 2017
+++ src/sys/arch/arm/marvell/armadaxp.c	Thu Feb 23 22:33:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: armadaxp.c,v 1.18 2017/01/11 19:42:02 maya Exp $	*/
+/*	$NetBSD: armadaxp.c,v 1.19 2017/02/23 22:33:31 skrll Exp $	*/
 /***
 Copyright (C) Marvell International Ltd. and its affiliates
 
@@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: armadaxp.c,v 1.18 2017/01/11 19:42:02 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: armadaxp.c,v 1.19 2017/02/23 22:33:31 skrll Exp $");
 
 #define _INTR_PRIVATE
 
@@ -312,7 +312,7 @@ static struct mbus_description {
 };
 
 /*
- * Default Mbus addrss decoding table for ARMADA XP
+ * Default Mbus address decoding table for ARMADA XP
  * this table may changed by device drivers.
  *
  * NOTE: some version of u-boot is broken. it writes old decoding table.



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

2017-02-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 23 19:51:47 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: ad.mips

Log Message:
add MIPS-specific clang header file


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/distrib/sets/lists/comp/ad.mips

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

Modified files:

Index: src/distrib/sets/lists/comp/ad.mips
diff -u src/distrib/sets/lists/comp/ad.mips:1.68 src/distrib/sets/lists/comp/ad.mips:1.69
--- src/distrib/sets/lists/comp/ad.mips:1.68	Wed Dec 28 08:57:20 2016
+++ src/distrib/sets/lists/comp/ad.mips	Thu Feb 23 19:51:46 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips,v 1.68 2016/12/28 08:57:20 rin Exp $
+# $NetBSD: ad.mips,v 1.69 2017/02/23 19:51:46 macallan Exp $
 -./usr/lib/64/libgomp.a
 -./usr/lib/64/libgomp.so
 -./usr/lib/64/libgomp.so.1
@@ -7,6 +7,7 @@
 -./usr/lib/64/libgomp_pic.a
 ./usr/bin/elf2aoutcomp-obsolete		obsolete
 ./usr/bin/elf2ecoffcomp-sysutil-bin
+./usr/include/clang-4.0/msa.h			comp-c-include		llvm
 ./usr/include/g++/bits/mips32			comp-c-include		compat,arch64
 ./usr/include/g++/bits/mips32/c++config.h	comp-c-include		compat,arch64,gcc
 ./usr/include/g++/bits/mips64			comp-c-include		compat,arch64



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

2017-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 23 18:56:12 UTC 2017

Modified Files:
src/sys/arch/mips/include: ecoff_machdep.h

Log Message:
provide ecoff 32 defines.


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

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

Modified files:

Index: src/sys/arch/mips/include/ecoff_machdep.h
diff -u src/sys/arch/mips/include/ecoff_machdep.h:1.22 src/sys/arch/mips/include/ecoff_machdep.h:1.23
--- src/sys/arch/mips/include/ecoff_machdep.h:1.22	Mon Jul 11 12:15:35 2016
+++ src/sys/arch/mips/include/ecoff_machdep.h	Thu Feb 23 13:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ecoff_machdep.h,v 1.22 2016/07/11 16:15:35 matt Exp $	*/
+/*	$NetBSD: ecoff_machdep.h,v 1.23 2017/02/23 18:56:12 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone
@@ -37,6 +37,12 @@
 #define ECOFF_LDPGSZ 4096
 
 #define ECOFF_PAD
+#define ECOFF32_PAD
+
+#define ECOFF32_MACHDEP \
+ecoff32_ulong gprmask; \
+ecoff32_ulong cprmask[4]; \
+ecoff32_ulong gp_value
 
 #define ECOFF_MACHDEP \
 u_long gprmask; \
@@ -67,6 +73,7 @@
 
 
 #define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
+#define ECOFF32_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
 
 #ifdef _KERNEL
 struct proc;
@@ -75,6 +82,34 @@ void	cpu_exec_ecoff_setregs(struct lwp *
 #endif	/* _KERNEL */
 
 
+struct ecoff32_symhdr {
+	int16_t		magic;
+	int16_t		vstamp;
+	int32_t		ilineMax;
+	int32_t		cbLine;
+	int32_t		cbLineOffset;
+	int32_t		idnMax;
+	int32_t		cbDnOffset;
+	int32_t		ipdMax;
+	int32_t		cbPdOffset;
+	int32_t		isymMax;
+	int32_t		cbSymOffset;
+	int32_t		ioptMax;
+	int32_t		cbOptOffset;
+	int32_t		iauxMax;
+	int32_t		cbAuxOffset;
+	int32_t		issMax;
+	int32_t		cbSsOffset;
+	int32_t		issExtMax;
+	int32_t		cbSsExtOffset;
+	int32_t		ifdMax;
+	int32_t		cbFdOffset;
+	int32_t		crfd;
+	int32_t		cbRfdOffset;
+	int32_t		iextMax;
+	int32_t		cbExtOffset;
+};
+
 /*
  * ECOFF symbol definitions for 32-bit mips.
  * XXX 64-bit (mips3?) may be different.
@@ -121,3 +156,14 @@ struct ecoff_extsym {
 	unsigned	:1;
 	unsigned	es_symauxindex:20;
 };
+
+struct ecoff32_extsym {
+	uint16_t	es_flags;
+	uint16_t	es_ifd;
+	int32_t		es_strindex;
+	int32_t		es_value;
+	unsigned	es_type:6;
+	unsigned	es_class:5;
+	unsigned	:1;
+	unsigned	es_symauxindex:20;
+};



CVS commit: src/sys/sys

2017-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 23 18:54:30 UTC 2017

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

Log Message:
Provided sized definitions for ecoff 32 bit headers.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/sys/exec_ecoff.h

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

Modified files:

Index: src/sys/sys/exec_ecoff.h
diff -u src/sys/sys/exec_ecoff.h:1.20 src/sys/sys/exec_ecoff.h:1.21
--- src/sys/sys/exec_ecoff.h:1.20	Thu Dec 10 09:13:54 2009
+++ src/sys/sys/exec_ecoff.h	Thu Feb 23 13:54:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_ecoff.h,v 1.20 2009/12/10 14:13:54 matt Exp $	*/
+/*	$NetBSD: exec_ecoff.h,v 1.21 2017/02/23 18:54:30 christos Exp $	*/
 
 /*
  * Copyright (c) 1994 Adam Glass
@@ -35,6 +35,76 @@
 
 #include 
 
+#ifdef ECOFF32_PAD
+
+typedef uint32_t ecoff32_addr;
+typedef uint32_t ecoff32_off;
+typedef uint32_t ecoff32_ulong;
+typedef int32_t ecoff32_long;
+typedef uint32_t ecoff32_uint;
+typedef int32_t ecoff32_int;
+typedef uint16_t ecoff32_ushort;
+typedef int16_t ecoff32_short;
+typedef uint8_t ecoff32_ubyte;
+typedef int8_t ecoff32_byte;
+
+struct ecoff32_filehdr {
+	ecoff32_ushort  f_magic;	/* magic number */
+	ecoff32_ushort  f_nscns;	/* # of sections */
+	ecoff32_uint	f_timdat;	/* time and date stamp */
+	ecoff32_ulong	f_symptr;	/* file offset of symbol table */
+	ecoff32_uint	f_nsyms;	/* # of symbol table entries */
+	ecoff32_ushort	f_opthdr;	/* sizeof the optional header */
+	ecoff32_ushort	f_flags;	/* flags??? */
+};
+
+struct ecoff32_aouthdr {
+	ecoff32_ushort	magic;
+	ecoff32_ushort	vstamp;
+	ECOFF32_PAD
+	ecoff32_ulong	tsize;
+	ecoff32_ulong	dsize;
+	ecoff32_ulong	bsize;
+	ecoff32_ulong	entry;
+	ecoff32_ulong	text_start;
+	ecoff32_ulong	data_start;
+	ecoff32_ulong	bss_start;
+	ECOFF32_MACHDEP;
+};
+
+struct ecoff32_scnhdr {			/* needed for size info */
+	char		s_name[8];	/* name */
+	ecoff32_ulong	s_paddr;	/* physical addr? for ROMing?*/
+	ecoff32_ulong	s_vaddr;	/* virtual addr? */
+	ecoff32_ulong	s_size;		/* size */
+	ecoff32_ulong	s_scnptr;	/* file offset of raw data */
+	ecoff32_ulong	s_relptr;	/* file offset of reloc data */
+	ecoff32_ulong	s_lnnoptr;	/* file offset of line data */
+	ecoff32_ushort	s_nreloc;	/* # of relocation entries */
+	ecoff32_ushort	s_nlnno;	/* # of line entries */
+	ecoff32_uint	s_flags;	/* flags */
+};
+
+struct ecoff32_exechdr {
+	struct ecoff32_filehdr f;
+	struct ecoff32_aouthdr a;
+};
+
+#define ECOFF32_HDR_SIZE (sizeof(struct ecoff32_exechdr))
+
+#define ECOFF32_TXTOFF(ep) \
+((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \
+	 ECOFF_ROUND(ECOFF32_HDR_SIZE + (ep)->f.f_nscns * \
+		 sizeof(struct ecoff32_scnhdr), ECOFF32_SEGMENT_ALIGNMENT(ep)))
+
+#define ECOFF32_DATOFF(ep) \
+(ECOFF_BLOCK_ALIGN((ep), ECOFF32_TXTOFF(ep) + (ep)->a.tsize))
+
+#define ECOFF32_SEGMENT_ALIGN(ep, value) \
+(ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \
+ ECOFF32_SEGMENT_ALIGNMENT(ep
+#endif
+
 struct ecoff_filehdr {
 	u_short f_magic;	/* magic number */
 	u_short f_nscns;	/* # of sections */



CVS commit: src/usr.bin/elf2ecoff

2017-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 23 18:49:00 UTC 2017

Modified Files:
src/usr.bin/elf2ecoff: elf2ecoff.c

Log Message:
This only works with 32 bit Elf and COFF files, make it specific this way
and use sized types so that it works on 64 bit systems (so it can become
a tool).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/elf2ecoff/elf2ecoff.c

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

Modified files:

Index: src/usr.bin/elf2ecoff/elf2ecoff.c
diff -u src/usr.bin/elf2ecoff/elf2ecoff.c:1.30 src/usr.bin/elf2ecoff/elf2ecoff.c:1.31
--- src/usr.bin/elf2ecoff/elf2ecoff.c:1.30	Sat Sep  3 07:35:24 2016
+++ src/usr.bin/elf2ecoff/elf2ecoff.c	Thu Feb 23 13:49:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2ecoff.c,v 1.30 2016/09/03 11:35:24 christos Exp $	*/
+/*	$NetBSD: elf2ecoff.c,v 1.31 2017/02/23 18:49:00 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone
@@ -56,8 +56,8 @@
 #define	ISLAST(p)	(p->n_un.n_name == 0 || p->n_un.n_name[0] == 0)
 
 struct sect {
-	unsigned long vaddr;
-	unsigned long len;
+	uint32_t vaddr;
+	uint32_t len;
 };
 
 struct elf_syms {
@@ -83,12 +83,12 @@ static voidsafewrite(int, const void
 static voidcopy(int, int, off_t, off_t);
 static voidcombine(struct sect *, struct sect *, int);
 static voidtranslate_syms(struct elf_syms *, struct ecoff_syms *);
-static voidelf_symbol_table_to_ecoff(int, int, struct ecoff_exechdr *,
+static voidelf_symbol_table_to_ecoff(int, int, struct ecoff32_exechdr *,
 off_t, off_t, off_t, off_t);
-static int make_ecoff_section_hdrs(struct ecoff_exechdr *,
-struct ecoff_scnhdr *);
-static voidwrite_ecoff_symhdr(int, struct ecoff_exechdr *,
-struct ecoff_symhdr *, long, long, long, long);
+static int make_ecoff_section_hdrs(struct ecoff32_exechdr *,
+struct ecoff32_scnhdr *);
+static voidwrite_ecoff_symhdr(int, struct ecoff32_exechdr *,
+struct ecoff32_symhdr *, int32_t, int32_t, int32_t, int32_t);
 static voidpad16(int, int, const char *);
 static voidbswap32_region(int32_t* , int);
 static voidelf_read_syms(struct elf_syms *, int, off_t, off_t, off_t,
@@ -107,12 +107,12 @@ main(int argc, char **argv)
 	int pad;
 	struct sect text, data, bss;	/* a.out-compatible sections */
 
-	struct ecoff_exechdr ep;
-	struct ecoff_scnhdr esecs[6];
-	struct ecoff_symhdr symhdr;
+	struct ecoff32_exechdr ep;
+	struct ecoff32_scnhdr esecs[6];
+	struct ecoff32_symhdr symhdr;
 
 	int infile, outfile;
-	unsigned long cur_vma = ULONG_MAX;
+	uint32_t cur_vma = UINT32_MAX;
 	int nsecs = 0;
 	int	mipsel;
 
@@ -247,8 +247,8 @@ usage:
 
 			if (debug) {
 fprintf(stderr, "  combinining PH %zu type %d "
-"flags 0x%x with data, ndata = %ld, "
-"nbss =%ld\n", i, ph[i].p_type,
+"flags 0x%x with data, ndata = %d, "
+"nbss =%d\n", i, ph[i].p_type,
 ph[i].p_flags, ndata.len, nbss.len);
 			}
 			combine(, , 0);
@@ -260,7 +260,7 @@ usage:
 			ntxt.len = ph[i].p_filesz;
 			if (debug) {
 fprintf(stderr, "  combinining PH %zu type %d "
-"flags 0x%x with text, len = %ld\n",
+"flags 0x%x with text, len = %d\n",
 i, ph[i].p_type, ph[i].p_flags, ntxt.len);
 			}
 			combine(, , 0);
@@ -312,7 +312,7 @@ usage:
 	ep.f.f_nscns = 6;
 	ep.f.f_timdat = 0;	/* bogus */
 	ep.f.f_symptr = 0;
-	ep.f.f_nsyms = sizeof(struct ecoff_symhdr);
+	ep.f.f_nsyms = sizeof(struct ecoff32_symhdr);
 	ep.f.f_opthdr = sizeof ep.a;
 	ep.f.f_flags = 0x100f;	/* Stripped, not sharable. */
 
@@ -395,13 +395,13 @@ usage:
 		 * that the section can be loaded before copying. */
 		if (ph[i].p_type == PT_LOAD && ph[i].p_filesz) {
 			if (cur_vma != ph[i].p_vaddr) {
-unsigned long gap = ph[i].p_vaddr - cur_vma;
+uint32_t gap = ph[i].p_vaddr - cur_vma;
 charobuf[1024];
 if (gap > 65536)
-	errx(1, "Intersegment gap (%ld bytes) "
+	errx(1, "Intersegment gap (%d bytes) "
 	"too large", gap);
 if (debug)
-	fprintf(stderr, "Warning: %ld byte "
+	fprintf(stderr, "Warning: %d byte "
 	"intersegment gap.\n", gap);
 memset(obuf, 0, sizeof obuf);
 while (gap) {
@@ -424,7 +424,7 @@ usage:
 
 	if (debug)
 		fprintf(stderr, "writing syms at offset 0x%lx\n",
-		(u_long) ep.f.f_symptr + sizeof(symhdr));
+		(uint32_t) ep.f.f_symptr + sizeof(symhdr));
 
 	/* Copy and translate the symbol table... */
 	elf_symbol_table_to_ecoff(outfile, infile, ,
@@ -512,7 +512,7 @@ saveRead(int file, off_t offset, off_t l
 	if ((off = lseek(file, offset, SEEK_SET)) < 0)
 		err(1, "%s: fseek", name);
 	if ((tmp = malloc(len)) == NULL)
-		err(1, "%s: Can't allocate %ld bytes", name, (long) len);
+		err(1, "%s: Can't allocate %td bytes", name, len);
 	count = read(file, tmp, len);
 	if (count != len)
 		err(1, "%s: short read", name);
@@ -535,7 +535,7 @@ safewrite(int outfile, const void *buf, 
  * for text, 

CVS commit: src/external/gpl3/gcc/dist/gcc/config/m68k

2017-02-23 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Feb 23 18:43:02 UTC 2017

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/m68k: m68k.c

Log Message:
revert rev 1.2 (disabling split wide types) because it's no longer necessary
after rev 1.6 of m68k.md (which itself reverted a local patch that hadn't
been necessary for over a decade... see gcc bugzilla 12792).
discussed with christos and confirmed no regressions with the atf tests.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.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/gpl3/gcc/dist/gcc/config/m68k/m68k.c
diff -u src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.c:1.2 src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.c:1.3
--- src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.c:1.2	Fri Sep 16 20:31:00 2016
+++ src/external/gpl3/gcc/dist/gcc/config/m68k/m68k.c	Thu Feb 23 18:43:01 2017
@@ -684,8 +684,6 @@ m68k_option_override (void)
   else
 	m68k_sched_mac = MAC_NO;
 }
-// XXX: Avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71695
-flag_split_wide_types = 0;
 }
 
 /* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE.  */



CVS commit: src/lib/libc/sys

2017-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 23 15:17:17 UTC 2017

Modified Files:
src/lib/libc/sys: Makefile.inc

Log Message:
add link for accept4.


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/lib/libc/sys/Makefile.inc

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

Modified files:

Index: src/lib/libc/sys/Makefile.inc
diff -u src/lib/libc/sys/Makefile.inc:1.234 src/lib/libc/sys/Makefile.inc:1.235
--- src/lib/libc/sys/Makefile.inc:1.234	Wed Feb  8 12:58:41 2017
+++ src/lib/libc/sys/Makefile.inc	Thu Feb 23 10:17:17 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.234 2017/02/08 17:58:41 maya Exp $
+#	$NetBSD: Makefile.inc,v 1.235 2017/02/23 15:17:17 christos Exp $
 #	@(#)Makefile.inc	8.3 (Berkeley) 10/24/94
 
 # sys sources
@@ -379,6 +379,6 @@ MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wa
 MLINKS+=wait.2 wait6.2 wait.2 waitid.2
 MLINKS+=write.2 writev.2 write.2 pwrite.2 write.2 pwritev.2
 MLINKS+=pipe.2 pipe2.2
-MLINKS+=accept.2 paccept.2
+MLINKS+=accept.2 paccept.2 accept.2 accept4.2
 MLINKS+=nanosleep.2 clock_nanosleep.2
 MLINKS+=clock_getcpuclockid2.2 clock_getcpuclockid.2



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

2017-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 23 15:18:37 UTC 2017

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

Log Message:
add accept4


To generate a diff of this commit:
cvs rdiff -u -r1.2111 -r1.2112 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2111 src/distrib/sets/lists/comp/mi:1.2112
--- src/distrib/sets/lists/comp/mi:1.2111	Wed Feb 22 04:20:39 2017
+++ src/distrib/sets/lists/comp/mi	Thu Feb 23 10:18:36 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2111 2017/02/22 09:20:39 msaitoh Exp $
+#	$NetBSD: mi,v 1.2112 2017/02/23 15:18:36 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -4047,6 +4047,7 @@
 ./usr/share/man/cat2/_lwp_wait.0		comp-c-catman		.cat
 ./usr/share/man/cat2/_lwp_wakeup.0		comp-c-catman		.cat
 ./usr/share/man/cat2/accept.0			comp-c-catman		.cat
+./usr/share/man/cat2/accept4.0			comp-c-catman		.cat
 ./usr/share/man/cat2/access.0			comp-c-catman		.cat
 ./usr/share/man/cat2/acct.0			comp-c-catman		.cat
 ./usr/share/man/cat2/adjtime.0			comp-c-catman		.cat
@@ -11538,6 +11539,7 @@
 ./usr/share/man/html2/_lwp_wait.html		comp-c-htmlman		html
 ./usr/share/man/html2/_lwp_wakeup.html		comp-c-htmlman		html
 ./usr/share/man/html2/accept.html		comp-c-htmlman		html
+./usr/share/man/html2/accept4.html		comp-c-htmlman		html
 ./usr/share/man/html2/access.html		comp-c-htmlman		html
 ./usr/share/man/html2/acct.html			comp-c-htmlman		html
 ./usr/share/man/html2/adjtime.html		comp-c-htmlman		html
@@ -18794,6 +18796,7 @@
 ./usr/share/man/man2/_lwp_wait.2		comp-c-man		.man
 ./usr/share/man/man2/_lwp_wakeup.2		comp-c-man		.man
 ./usr/share/man/man2/accept.2			comp-c-man		.man
+./usr/share/man/man2/accept4.2			comp-c-man		.man
 ./usr/share/man/man2/access.2			comp-c-man		.man
 ./usr/share/man/man2/acct.2			comp-c-man		.man
 ./usr/share/man/man2/adjtime.2			comp-c-man		.man



CVS commit: src/usr.bin/mixerctl

2017-02-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb 23 14:09:11 UTC 2017

Modified Files:
src/usr.bin/mixerctl: mixerctl.c

Log Message:
Generate usage error for bad usage, before attempting any other operations.
This means that "mixerctl" (no args) will generate a usage msg, even when
/dev/mixer cannot be opened (or any other device given via -d or $MIXERDEVICE)

While here, get rid of "goto usage" replacing the usage: with a
static inline void __dead function...  The compiler ought to optimise
the calls into essentially the same code as existed with the goto version,
but this is much cleaner.

Also, mixerctl falls back on /dev/mixer0 if /dev/mixer cannot be opened.
(that is old code - probably from when /dev/mixer was first added)

It used to do that when called as mixerctl -d /dev/mixer or with
"MIXERDEVICE=/dev/mixer mixerctl...".   No longer.  Now the fallback (which
is probably obsolete now anyway) only happens when the user doesn't specify
any mixer device (by either method) and the default of /dev/mixer is used.
In other cases, only the device specified is tried.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/mixerctl/mixerctl.c

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

Modified files:

Index: src/usr.bin/mixerctl/mixerctl.c
diff -u src/usr.bin/mixerctl/mixerctl.c:1.26 src/usr.bin/mixerctl/mixerctl.c:1.27
--- src/usr.bin/mixerctl/mixerctl.c:1.26	Sun Oct 28 02:01:15 2012
+++ src/usr.bin/mixerctl/mixerctl.c	Thu Feb 23 14:09:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mixerctl.c,v 1.26 2012/10/28 02:01:15 isaki Exp $	*/
+/*	$NetBSD: mixerctl.c,v 1.27 2017/02/23 14:09:11 kre Exp $	*/
 
 /*
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: mixerctl.c,v 1.26 2012/10/28 02:01:15 isaki Exp $");
+__RCSID("$NetBSD: mixerctl.c,v 1.27 2017/02/23 14:09:11 kre Exp $");
 #endif
 
 #include 
@@ -61,6 +61,8 @@ struct field {
 mixer_ctrl_t *values;
 mixer_devinfo_t *infos;
 
+static const char mixer_path[] = _PATH_MIXER;
+
 static char *
 catstr(char *p, char *q)
 {
@@ -316,6 +318,15 @@ prarg(int fd, char *arg, const char *sep
 		prfield(p, sep, vflag), fprintf(out, "\n");
 }
 
+static inline void __dead
+usage(void)
+{
+	fprintf(out, "%s [-d file] [-v] [-n] name ...\n", prog);
+	fprintf(out, "%s [-d file] [-v] [-n] -w name=value ...\n",prog);
+	fprintf(out, "%s [-d file] [-v] [-n] -a\n", prog);
+	exit(0);
+}
+
 int
 main(int argc, char **argv)
 {
@@ -328,7 +339,7 @@ main(int argc, char **argv)
 
 	file = getenv("MIXERDEVICE");
 	if (file == NULL)
-		file = _PATH_MIXER;
+		file = mixer_path;
 
 	prog = *argv;
 
@@ -352,19 +363,18 @@ main(int argc, char **argv)
 			break;
 		case '?':
 		default:
-		usage:
-			fprintf(out, "%s [-d file] [-v] [-n] name ...\n", prog);
-			fprintf(out, "%s [-d file] [-v] [-n] -w name=value ...\n",prog);
-			fprintf(out, "%s [-d file] [-v] [-n] -a\n", prog);
-			exit(0);
+			usage();
 		}
 	}
 	argc -= optind;
 	argv += optind;
 
+	if (aflag ? (argc != 0 || wflag) : argc == 0)
+		usage();
+
 	fd = open(file, O_RDWR);
-	/* Try with mixer0. */
-	if (fd < 0 && strcmp(file, _PATH_MIXER) == 0) {
+	/* Try with mixer0 but only if using the default device. */
+	if (fd < 0 && file == mixer_path) {
 		file = _PATH_MIXER0;
 		fd = open(file, O_RDWR);
 	}
@@ -442,6 +452,6 @@ main(int argc, char **argv)
 			argv++;
 		}
 	} else
-		goto usage;
+		usage();
 	exit(0);
 }



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

2017-02-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Feb 23 14:01:37 UTC 2017

Modified Files:
src/tests/usr.bin/mixerctl: t_mixerctl.sh

Log Message:
Drop the test for QEMU and instead skip relevant tests when /dev/mixer
can't be opened (which more accurately reflects when mixerctl is going
to fail...)

Based upon an idea from Andreas Gustafsson (gson@) - except that using
/dev/audio0 for this purpose doesn't work, if the only audio device
configured is pad0 an open of audio fails with EIO (???)

While here, perpare for the updated mixerctl coming soon to a repository
near you...
Use correct usage in the test of a bogus -d arg (otherwise the
new mixerctl will complain about usage, and never even
attempt to open the bogus device)
Don't require /dev/mixer for the noargs -> generate usage msg
test ... this will now generate a failing test with the
old mixerctl if there is no working /dev/mixer, but
that mixerctl won't be around much longer.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/mixerctl/t_mixerctl.sh

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

Modified files:

Index: src/tests/usr.bin/mixerctl/t_mixerctl.sh
diff -u src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.3 src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.4
--- src/tests/usr.bin/mixerctl/t_mixerctl.sh:1.3	Thu Feb 23 02:28:10 2017
+++ src/tests/usr.bin/mixerctl/t_mixerctl.sh	Thu Feb 23 14:01:37 2017
@@ -1,17 +1,10 @@
-# $NetBSD: t_mixerctl.sh,v 1.3 2017/02/23 02:28:10 kre Exp $
+# $NetBSD: t_mixerctl.sh,v 1.4 2017/02/23 14:01:37 kre Exp $
 
 atf_test_case noargs_usage
 noargs_usage_head() {
 	atf_set "descr" "Ensure mixerctl(1) with no args prints a usage message"
 }
 noargs_usage_body() {
-if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 &&
-	test $(uname -m) = i386
-	then
-	# better would be for mixerctl to not open the device...
-	# but for now, it does.
-	atf_skip "i386 ATF qemu kernel has no audio"
-	fi
 	atf_check -s exit:0 -o not-empty -e ignore \
 		mixerctl
 }
@@ -21,11 +14,9 @@ showvalue_head() {
 	atf_set "descr" "Ensure mixerctl(1) can print the value for all variables"
 }
 showvalue_body() {
-if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 &&
-	test $(uname -m) = i386
-	then
-	atf_skip "i386 ATF qemu kernel has no audio"
-	fi
+	(/dev/null 2>&1 ||
+	atf_skip "no audio mixer available in kernel"
+
 	for var in $(mixerctl -a | awk -F= '{print $1}'); do
 		atf_check -s exit:0 -e ignore -o match:"^${var}=" \
 			mixerctl ${var}
@@ -37,11 +28,9 @@ nflag_head() {
 	atf_set "descr" "Ensure 'mixerctl -n' actually suppresses some output"
 }
 nflag_body() {
-if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 &&
-	test $(uname -m) = i386
-	then
-	atf_skip "i386 ATF qemu kernel has no audio"
-	fi
+	(/dev/null 2>&1 ||
+	atf_skip "no audio mixer available in kernel"
+
 	varname="$(mixerctl -a | sed -e 's/=.*//' -e q)"
 
 	atf_check -s exit:0 -o match:"${varname}" -e ignore \
@@ -57,7 +46,7 @@ nonexistant_device_head() {
 }
 nonexistant_device_body() {
 	atf_check -s not-exit:0  -o ignore -e match:"No such file" \
-		mixerctl -d /a/b/c/d/e
+		mixerctl -a -d /a/b/c/d/e
 }
 
 atf_init_test_cases() {



CVS commit: src/share/terminfo

2017-02-23 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Feb 23 13:22:53 UTC 2017

Modified Files:
src/share/terminfo: terminfo

Log Message:
Remove kLFT and kRIT from putty.
This allows left and right cursor key movement inside tmux on putty.
See https://github.com/tmux/tmux/issues/708.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/share/terminfo/terminfo

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

Modified files:

Index: src/share/terminfo/terminfo
diff -u src/share/terminfo/terminfo:1.10 src/share/terminfo/terminfo:1.11
--- src/share/terminfo/terminfo:1.10	Sat Feb 11 09:15:38 2017
+++ src/share/terminfo/terminfo	Thu Feb 23 13:22:53 2017
@@ -6,8 +6,8 @@
 # Report bugs and new terminal descriptions to
 #	bug-ncur...@gnu.org
 #
-#	$Revision: 1.10 $
-#	$Date: 2017/02/11 09:15:38 $
+#	$Revision: 1.11 $
+#	$Date: 2017/02/23 13:22:53 $
 #
 # The original header is preserved below for reference.  It is noted that there
 # is a "newer" version which differs in some cosmetic details (but actually
@@ -3698,7 +3698,7 @@ putty|PuTTY terminal emulator,
 	initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/
 	  %02x%p4%{255}%*%{1000}%/%02x,
 	is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R,
-	kLFT=\E[D, kRIT=\E[C, kb2=\E[G, kbs=\177, kcbt=\E[Z,
+	kb2=\E[G, kbs=\177, kcbt=\E[Z,
 	kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
 	kdch1=\E[3~, kend=\E[4~, khome=\E[1~, kich1=\E[2~,
 	kind=\E[B, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kri=\E[A,



CVS commit: src/sys/arch/x86

2017-02-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Feb 23 12:17:36 UTC 2017

Modified Files:
src/sys/arch/x86/include: efi.h
src/sys/arch/x86/x86: efi.c

Log Message:
Avoid panic when amd64 kernel is booted from 32bit UEFI.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/include/efi.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/x86/efi.c

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

Modified files:

Index: src/sys/arch/x86/include/efi.h
diff -u src/sys/arch/x86/include/efi.h:1.5 src/sys/arch/x86/include/efi.h:1.6
--- src/sys/arch/x86/include/efi.h:1.5	Tue Feb 14 13:29:09 2017
+++ src/sys/arch/x86/include/efi.h	Thu Feb 23 12:17:36 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: efi.h,v 1.5 2017/02/14 13:29:09 nonaka Exp $   */
+/* $NetBSD: efi.h,v 1.6 2017/02/23 12:17:36 nonaka Exp $   */
 
 /*-
  * Copyright (c) 2004 Marcel Moolenaar
@@ -42,9 +42,6 @@
 extern const struct uuid EFI_UUID_ACPI20;
 extern const struct uuid EFI_UUID_ACPI10;
 
-#defineEFI_TABLE_SAL   \
-   {0xeb9d2d32,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}}
-
 enum efi_reset {
EFI_RESET_COLD,
EFI_RESET_WARM
@@ -53,11 +50,11 @@ enum efi_reset {
 typedef uint16_t   efi_char;
 typedef unsigned long efi_status;
 
-
 struct efi_cfgtbl {
struct uuid ct_uuid;
void   *ct_data;
 };
+
 struct efi_md {
uint32_tmd_type;
 #defineEFI_MD_TYPE_NULL0
@@ -159,6 +156,53 @@ struct efi_systbl {
struct efi_cfgtbl *st_cfgtbl;
 };
 
+#if defined(__amd64__)
+struct efi_cfgtbl32 {
+	struct uuid		ct_uuid;
+	uint32_t		ct_data;	/* void * */
+};
+
+struct efi_systbl32 {
+	struct efi_tblhdr	st_hdr;
+
+	uint32_t		st_fwvendor;
+	uint32_t		st_fwrev;
+	uint32_t		st_cin;		/* = 0 */
+	uint32_t		st_cinif;	/* = 0 */
+	uint32_t		st_cout;	/* = 0 */
+	uint32_t		st_coutif;	/* = 0 */
+	uint32_t		st_cerr;	/* = 0 */
+	uint32_t		st_cerrif;	/* = 0 */
+	uint32_t		st_rt;		/* struct efi_rt32 * */
+	uint32_t		st_bs;		/* = 0 */
+	uint32_t		st_entries;
+	uint32_t		st_cfgtbl;	/* struct efi_cfgtbl32 * */
+};
+#elif defined(__i386__)
+struct efi_cfgtbl64 {
+	struct uuid		ct_uuid;
+	uint64_t		ct_data;	/* void * */
+};
+
+struct efi_systbl64 {
+	struct efi_tblhdr	st_hdr;
+
+	uint64_t		st_fwvendor;
+	uint32_t		st_fwrev;
+	uint32_t		__pad;
+	uint64_t		st_cin;		/* = 0 */
+	uint64_t		st_cinif;	/* = 0 */
+	uint64_t		st_cout;	/* = 0 */
+	uint64_t		st_coutif;	/* = 0 */
+	uint64_t		st_cerr;	/* = 0 */
+	uint64_t		st_cerrif;	/* = 0 */
+	uint64_t		st_rt;		/* struct efi_rt64 * */
+	uint64_t		st_bs;		/* = 0 */
+	uint64_t		st_entries;
+	uint64_t		st_cfgtbl;	/* struct efi_cfgtbl64 * */
+};
+#endif
+
 bool   efi_probe(void);
 paddr_tefi_getsystblpa(void);
 struct efi_systbl *efi_getsystbl(void);

Index: src/sys/arch/x86/x86/efi.c
diff -u src/sys/arch/x86/x86/efi.c:1.9 src/sys/arch/x86/x86/efi.c:1.10
--- src/sys/arch/x86/x86/efi.c:1.9	Thu Feb 16 03:53:20 2017
+++ src/sys/arch/x86/x86/efi.c	Thu Feb 23 12:17:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efi.c,v 1.9 2017/02/16 03:53:20 nonaka Exp $	*/
+/*	$NetBSD: efi.c,v 1.10 2017/02/23 12:17:36 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.9 2017/02/16 03:53:20 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.10 2017/02/23 12:17:36 nonaka Exp $");
 
 #include 
 #include 
@@ -65,7 +65,7 @@ void 		efi_aprintcfgtbl(void);
 void 		efi_aprintuuid(const struct uuid *);
 bool 		efi_uuideq(const struct uuid *, const struct uuid *);
 
-static bool efi_is32bit = false;
+static bool efi_is32x64 = false;
 static struct efi_systbl *efi_systbl_va = NULL;
 static struct efi_cfgtbl *efi_cfgtblhead_va = NULL;
 static struct efi_e820memmap {
@@ -158,7 +158,18 @@ efi_getcfgtblhead(void)
 	if (efi_cfgtblhead_va != NULL)
 		return efi_cfgtblhead_va;
 
-	pa = (paddr_t)(u_long) efi_systbl_va->st_cfgtbl;
+	if (efi_is32x64) {
+#if defined(__amd64__)
+		struct efi_systbl32 *systbl32 = (void *) efi_systbl_va;
+		pa = systbl32->st_cfgtbl;
+#elif defined(__i386__)
+		struct efi_systbl64 *systbl64 = (void *) efi_systbl_va;
+		if (systbl64->st_cfgtbl & 0xULL)
+			return NULL;
+		pa = (paddr_t) systbl64->st_cfgtbl;
+#endif
+	} else
+		pa = (paddr_t)(u_long) efi_systbl_va->st_cfgtbl;
 	aprint_debug("efi: cfgtbl at pa %" PRIxPADDR "\n", pa);
 	va = efi_getva(pa);
 	aprint_debug("efi: cfgtbl mapped at va %" PRIxVADDR "\n", va);
@@ -175,7 +186,34 @@ void
 efi_aprintcfgtbl(void)
 {
 	struct efi_cfgtbl *ct;
-	unsigned long 	count;
+	unsigned long count;
+
+	if (efi_is32x64) {
+#if defined(__amd64__)
+		struct efi_systbl32 *systbl32 = (void *) efi_systbl_va;
+		struct efi_cfgtbl32 *ct32 = (void *) efi_cfgtblhead_va;
+
+		count = systbl32->st_entries;
+		aprint_debug("efi: %lu cfgtbl entries:\n", count);
+		for (; 

CVS commit: src/sys/dev/rasops

2017-02-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Feb 23 12:16:30 UTC 2017

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

Log Message:
reset ri->ri_hwbits too if RI_CFGDONE is set.

prevent ri->ri_hwbits from moving to center every time rasops_reconfig() is
called when RI_CENTER is set.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/rasops/rasops.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.73 src/sys/dev/rasops/rasops.c:1.74
--- src/sys/dev/rasops/rasops.c:1.73	Sat Apr 18 11:23:58 2015
+++ src/sys/dev/rasops/rasops.c	Thu Feb 23 12:16:30 2017
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.73 2015/04/18 11:23:58 mlelstv Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.74 2017/02/23 12:16:30 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.73 2015/04/18 11:23:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.74 2017/02/23 12:16:30 nonaka Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -325,8 +325,10 @@ rasops_reconfig(struct rasops_info *ri, 
 	/* Need this to frob the setup below */
 	bpp = (ri->ri_depth == 15 ? 16 : ri->ri_depth);
 
-	if ((ri->ri_flg & RI_CFGDONE) != 0)
+	if ((ri->ri_flg & RI_CFGDONE) != 0) {
 		ri->ri_bits = ri->ri_origbits;
+		ri->ri_hwbits = ri->ri_hworigbits;
+	}
 
 	/* Don't care if the caller wants a hideously small console */
 	if (wantrows < 10)



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

2017-02-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Feb 23 12:14:53 UTC 2017

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

Log Message:
no need COUNT_KERNEL hack.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/i386/stand/lib/exec.c

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

Modified files:

Index: src/sys/arch/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.65 src/sys/arch/i386/stand/lib/exec.c:1.66
--- src/sys/arch/i386/stand/lib/exec.c:1.65	Sat Feb 11 10:23:39 2017
+++ src/sys/arch/i386/stand/lib/exec.c	Thu Feb 23 12:14:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.65 2017/02/11 10:23:39 nonaka Exp $	 */
+/*	$NetBSD: exec.c,v 1.66 2017/02/23 12:14:53 nonaka Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -313,7 +313,6 @@ common_load_kernel(const char *file, u_l
 		/* Allocate temporary arena. */
 		addr = EFI_ALLOCATE_MAX_ADDRESS;
 		kernsize = marks[MARK_END] - loadaddr;
-		kernsize += 1 * 1024 * 1024;	/* XXX: kernel size COUNT_KERNEL vs LOAD_KERNL (lacked some SYMTAB?) */
 		kernsize = EFI_SIZE_TO_PAGES(kernsize);
 		status = uefi_call_wrapper(BS->AllocatePages, 4,
 		AllocateMaxAddress, EfiLoaderData, kernsize, );



CVS commit: src/sys/lib/libsa

2017-02-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Feb 23 12:13:59 UTC 2017

Modified Files:
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
update marks[MARK_DATA] with COUNT_DATA.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/lib/libsa/loadfile_elf32.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/lib/libsa/loadfile_elf32.c
diff -u src/sys/lib/libsa/loadfile_elf32.c:1.35 src/sys/lib/libsa/loadfile_elf32.c:1.36
--- src/sys/lib/libsa/loadfile_elf32.c:1.35	Thu Feb 23 12:13:05 2017
+++ src/sys/lib/libsa/loadfile_elf32.c	Thu Feb 23 12:13:59 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.35 2017/02/23 12:13:05 nonaka Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.36 2017/02/23 12:13:59 nonaka Exp $ */
 
 /*
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -363,6 +363,10 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *e
 		}
 		if ((IS_TEXT(phdr[i]) && (flags & (LOAD_TEXT|COUNT_TEXT))) ||
 		(IS_DATA(phdr[i]) && (flags & (LOAD_DATA|COUNT_DATA {
+			/* XXX: Assume first address is lowest */
+			if (marks[MARK_DATA] == 0 && IS_DATA(phdr[i]))
+marks[MARK_DATA] = LOADADDR(phdr[i].p_vaddr);
+
 			pos = phdr[i].p_vaddr;
 			if (minp > pos)
 minp = pos;



CVS commit: src/sys/lib/libsa

2017-02-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Feb 23 12:13:05 UTC 2017

Modified Files:
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
fix CTF section symbol size was not counted with COUNT_KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/lib/libsa/loadfile_elf32.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/lib/libsa/loadfile_elf32.c
diff -u src/sys/lib/libsa/loadfile_elf32.c:1.34 src/sys/lib/libsa/loadfile_elf32.c:1.35
--- src/sys/lib/libsa/loadfile_elf32.c:1.34	Fri Jan  6 09:14:36 2017
+++ src/sys/lib/libsa/loadfile_elf32.c	Thu Feb 23 12:13:05 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.34 2017/01/06 09:14:36 maxv Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.35 2017/02/23 12:13:05 nonaka Exp $ */
 
 /*
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -428,41 +428,37 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *e
 		 * First load the section names section.
 		 */
 		if (boot_load_ctf && (elf->e_shstrndx != 0)) {
+			Elf_Off shstroff = shp[elf->e_shstrndx].sh_offset;
+			shstrsz = shp[elf->e_shstrndx].sh_size;
 			if (flags & LOAD_SYM) {
-if (lseek(fd, shp[elf->e_shstrndx].sh_offset,
-SEEK_SET) == -1) {
+if (lseek(fd, shstroff, SEEK_SET) == -1) {
 	WARN(("lseek symbols"));
 	goto freeshp;
 }
-nr = READ(fd, maxp,
-shp[elf->e_shstrndx].sh_size);
+nr = READ(fd, maxp, shstrsz);
 if (nr == -1) {
 	WARN(("read symbols"));
 	goto freeshp;
 }
-if (nr !=
-(ssize_t)shp[elf->e_shstrndx].sh_size) {
+if (nr != (ssize_t)shstrsz) {
 	errno = EIO;
 	WARN(("read symbols"));
 	goto freeshp;
 }
+			}
 
-shstr = ALLOC(shp[elf->e_shstrndx].sh_size);
-shstrsz = shp[elf->e_shstrndx].sh_size;
-if (lseek(fd, shp[elf->e_shstrndx].sh_offset,
-SEEK_SET) == -1) {
-	WARN(("lseek symbols"));
-	goto freeshp;
-}
-nr = read(fd, shstr,
-shp[elf->e_shstrndx].sh_size);
-if (nr == -1) {
-	WARN(("read symbols"));
-	goto freeshp;
-}
+			shstr = ALLOC(shstrsz);
+			if (lseek(fd, shstroff, SEEK_SET) == -1) {
+WARN(("lseek symbols"));
+goto freeshp;
+			}
+			nr = read(fd, shstr, shstrsz);
+			if (nr == -1) {
+WARN(("read symbols"));
+goto freeshp;
 			}
 			shp[elf->e_shstrndx].sh_offset = maxp - elfp;
-			maxp += roundup(shp[elf->e_shstrndx].sh_size, ELFROUND);
+			maxp += roundup(shstrsz, ELFROUND);
 		}
 
 		/*



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

2017-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 23 12:01:12 UTC 2017

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

Log Message:
Make it compilable in non-diagnostic kernels


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

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

Modified files:

Index: src/sys/arch/x86/x86/dbregs.c
diff -u src/sys/arch/x86/x86/dbregs.c:1.5 src/sys/arch/x86/x86/dbregs.c:1.6
--- src/sys/arch/x86/x86/dbregs.c:1.5	Thu Feb 23 03:34:22 2017
+++ src/sys/arch/x86/x86/dbregs.c	Thu Feb 23 12:01:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbregs.c,v 1.5 2017/02/23 03:34:22 kamil Exp $	*/
+/*	$NetBSD: dbregs.c,v 1.6 2017/02/23 12:01:12 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@ x86_dbregs_setup_initdbstate(void)
 void
 x86_dbregs_clear(struct lwp *l)
 {
-	struct pcb *pcb = lwp_getpcb(l);
+	struct pcb *pcb __diagused = lwp_getpcb(l);
 
 	KASSERT(pcb->pcb_dbregs == NULL);
 



CVS commit: src/sys/kern

2017-02-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Feb 23 11:23:22 UTC 2017

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

Log Message:
Test for fstrans support before trying to allocate per-thread info.

PR kern/51996 (kmem_alloc called from intr context in fstrans_get_lwp_info)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/kern/vfs_trans.c

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

Modified files:

Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.36 src/sys/kern/vfs_trans.c:1.37
--- src/sys/kern/vfs_trans.c:1.36	Fri Feb 17 08:25:15 2017
+++ src/sys/kern/vfs_trans.c	Thu Feb 23 11:23:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_trans.c,v 1.36 2017/02/17 08:25:15 hannken Exp $	*/
+/*	$NetBSD: vfs_trans.c,v 1.37 2017/02/23 11:23:22 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.36 2017/02/17 08:25:15 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.37 2017/02/23 11:23:22 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -235,6 +235,16 @@ fstrans_get_lwp_info(struct mount *mp, b
 		return NULL;
 
 	/*
+	 * Does this file system support fstrans?
+	 */
+	mutex_enter(_mount_lock);
+	if ((mp->mnt_iflag & IMNT_HAS_TRANS) == 0) {
+		mutex_exit(_mount_lock);
+		return NULL;
+	}
+	mutex_exit(_mount_lock);
+
+	/*
 	 * Try to reuse a cleared entry or allocate a new one.
 	 */
 	for (fli = lwp_getspecific(lwp_data_key); fli; fli = fli->fli_succ) {
@@ -274,14 +284,10 @@ fstrans_get_lwp_info(struct mount *mp, b
 	 * Attach the entry to the mount.
 	 */
 	mutex_enter(_mount_lock);
-	if (mp == NULL || (mp->mnt_iflag & IMNT_HAS_TRANS) == 0) {
-		fli = NULL;
-	} else {
-		fmi = mp->mnt_transinfo;
-		KASSERT(fmi != NULL);
-		fli->fli_mount = mp;
-		fmi->fmi_ref_cnt += 1;
-	}
+	fmi = mp->mnt_transinfo;
+	KASSERT(fmi != NULL);
+	fli->fli_mount = mp;
+	fmi->fmi_ref_cnt += 1;
 	mutex_exit(_mount_lock);
 
 	return fli;



CVS commit: src/sys/arch/arm

2017-02-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 23 08:22:20 UTC 2017

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

Log Message:
Fixup the compile time decisions around PMAP_{INCLUDE,NEEDS}_PTE_SYNC and
fix the options for xscale boards which require the code in
pmap_l2ptp_ctor marked as #ifndef PMAP_INCLUDE_PTE_SYNC.

Fix the typo (pte -> opte) in this code block and consistently use opte
elsewhere.

PR/51990: Regression data_abort_handler: data_aborts fsr=0x406 far=0xbfffeff5  
on copyout in init


To generate a diff of this commit:
cvs rdiff -u -r1.342 -r1.343 src/sys/arch/arm/arm32/pmap.c
cvs rdiff -u -r1.144 -r1.145 src/sys/arch/arm/include/arm32/pmap.h

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.342 src/sys/arch/arm/arm32/pmap.c:1.343
--- src/sys/arch/arm/arm32/pmap.c:1.342	Fri Dec 23 07:15:27 2016
+++ src/sys/arch/arm/arm32/pmap.c	Thu Feb 23 08:22:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.342 2016/12/23 07:15:27 cherry Exp $	*/
+/*	$NetBSD: pmap.c,v 1.343 2017/02/23 08:22:20 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -217,7 +217,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.342 2016/12/23 07:15:27 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.343 2017/02/23 08:22:20 skrll Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -1694,7 +1694,7 @@ pmap_l2ptp_ctor(void *arg, void *v, int 
 			/*
 			 * Page tables must have the cache-mode set correctly.
 			 */
-			const pt_entry_t npte = (pte & ~L2_S_CACHE_MASK)
+			const pt_entry_t npte = (opte & ~L2_S_CACHE_MASK)
 			| pte_l2_s_cache_mode_pt;
 			l2pte_set(ptep, npte, opte);
 			PTE_SYNC(ptep);
@@ -1973,7 +1973,7 @@ pmap_vac_me_user(struct vm_page_md *md, 
 			pt_entry_t npte = opte & ~L2_S_CACHE_MASK;
 
 			if ((va != pv->pv_va || pm != pv->pv_pmap)
-			&& l2pte_valid_p(npte)) {
+			&& l2pte_valid_p(opte)) {
 #ifdef PMAP_CACHE_VIVT
 pmap_cache_wbinv_page(pv->pv_pmap, pv->pv_va,
 true, pv->pv_flags);
@@ -2301,7 +2301,7 @@ pmap_vac_me_harder(struct vm_page_md *md
 		if (opte == npte)	/* only update is there's a change */
 			continue;
 
-		if (l2pte_valid_p(npte)) {
+		if (l2pte_valid_p(opte)) {
 			pmap_tlb_flush_SE(pv->pv_pmap, pv->pv_va, pv->pv_flags);
 		}
 
@@ -4275,7 +4275,7 @@ pmap_prefetchabt_fixup(void *v)
 	if ((opte & L2_S_PROT_U) == 0 || (opte & L2_XS_XN) == 0)
 		goto out;
 
-	paddr_t pa = l2pte_pa(pte);
+	paddr_t pa = l2pte_pa(opte);
 	struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
 	KASSERT(pg != NULL);
 

Index: src/sys/arch/arm/include/arm32/pmap.h
diff -u src/sys/arch/arm/include/arm32/pmap.h:1.144 src/sys/arch/arm/include/arm32/pmap.h:1.145
--- src/sys/arch/arm/include/arm32/pmap.h:1.144	Thu Jul 14 05:00:51 2016
+++ src/sys/arch/arm/include/arm32/pmap.h	Thu Feb 23 08:22:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.144 2016/07/14 05:00:51 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.145 2017/02/23 08:22:20 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -480,15 +480,21 @@ vtophys(vaddr_t va)
 extern int pmap_needs_pte_sync;
 #if defined(_KERNEL_OPT)
 /*
+ * Perform compile time evaluation of PMAP_NEEDS_PTE_SYNC when only a
+ * single MMU type is selected.
+ *
  * StrongARM SA-1 caches do not have a write-through mode.  So, on these,
- * we need to do PTE syncs.  If only SA-1 is configured, then evaluate
- * this at compile time.
+ * we need to do PTE syncs. Additionally, V6 MMUs also need PTE syncs.
+ * Finally, MEMC, GENERIC and XSCALE MMUs do not need PTE syncs.
+ *
+ * Use run time evaluation for all other cases.
+ * 
  */
-#if (ARM_MMU_SA1 + ARM_MMU_V6 != 0) && (ARM_NMMUS == 1)
+#if (ARM_NMMUS == 1)
+#if (ARM_MMU_SA1 + ARM_MMU_V6 != 0)
 #define	PMAP_INCLUDE_PTE_SYNC
-#if (ARM_MMU_V6 > 0)
 #define	PMAP_NEEDS_PTE_SYNC	1
-#elif (ARM_MMU_SA1 == 0)
+#elif (ARM_MMU_MEMC + ARM_MMU_GENERIC + ARM_MMU_XSCALE != 0)
 #define	PMAP_NEEDS_PTE_SYNC	0
 #endif
 #endif



CVS commit: src/lib/libc/sys

2017-02-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 23 08:11:09 UTC 2017

Modified Files:
src/lib/libc/sys: ptrace.2

Log Message:
Formatting fix.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/lib/libc/sys/ptrace.2

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/sys/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.61 src/lib/libc/sys/ptrace.2:1.62
--- src/lib/libc/sys/ptrace.2:1.61	Thu Feb 23 05:48:14 2017
+++ src/lib/libc/sys/ptrace.2	Thu Feb 23 08:11:09 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ptrace.2,v 1.61 2017/02/23 05:48:14 kamil Exp $
+.\"	$NetBSD: ptrace.2,v 1.62 2017/02/23 08:11:09 wiz Exp $
 .\"
 .\" This file is in the public domain.
 .Dd February 23, 2017
@@ -109,10 +109,9 @@ the details of the process state associa
 Design choices for Debug Register accessors
 .Bl -dash
 .It
-.Dv exec()
-(
-.Dv TRAP_EXEC
-event ) must remove debug registers from LWP
+.Fn exec
+.Dv ( TRAP_EXEC
+event) must remove debug registers from LWP
 .It
 debug registers are only per-LWP, not per-process globally
 .It