CVS commit: src/external/bsd/atf/dist/atf-sh

2017-05-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon May 15 04:54:09 UTC 2017

Modified Files:
src/external/bsd/atf/dist/atf-sh: atf-sh-api.3

Log Message:
Add some information learned from experience with using (and abusing)
this API...

While here do some markup improvements (it is amazing what one can
learn from observing a wizard at work!) (which still probably need more work.)
In particular, sh functions are not functions in the mdoc .Fn sense!
(Many places where explicit double quotes were not doing what was intended.)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.7 -r1.2 src/external/bsd/atf/dist/atf-sh/atf-sh-api.3

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

Modified files:

Index: src/external/bsd/atf/dist/atf-sh/atf-sh-api.3
diff -u src/external/bsd/atf/dist/atf-sh/atf-sh-api.3:1.1.1.7 src/external/bsd/atf/dist/atf-sh/atf-sh-api.3:1.2
--- src/external/bsd/atf/dist/atf-sh/atf-sh-api.3:1.1.1.7	Sat Feb  8 19:11:32 2014
+++ src/external/bsd/atf/dist/atf-sh/atf-sh-api.3	Mon May 15 04:54:09 2017
@@ -26,7 +26,7 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 13, 2013
+.Dd May 15, 2017
 .Dt ATF-SH-API 3
 .Os
 .Sh NAME
@@ -51,25 +51,44 @@
 .Nm atf_test_case
 .Nd POSIX shell API to write ATF-based test programs
 .Sh SYNOPSIS
-.Fn atf_add_test_case "name"
-.Fn atf_check "command"
-.Fn atf_check_equal "expr1" "expr2"
-.Fn atf_config_get "var_name"
-.Fn atf_config_has "var_name"
-.Fn atf_expect_death "reason" "..."
-.Fn atf_expect_exit "exitcode" "reason" "..."
-.Fn atf_expect_fail "reason" "..."
-.Fn atf_expect_pass
-.Fn atf_expect_signal "signo" "reason" "..."
-.Fn atf_expect_timeout "reason" "..."
-.Fn atf_fail "reason"
-.Fn atf_get "var_name"
-.Fn atf_get_srcdir
-.Fn atf_pass
-.Fn atf_require_prog "prog_name"
-.Fn atf_set "var_name" "value"
-.Fn atf_skip "reason"
-.Fn atf_test_case "name" "cleanup"
+.Ic atf_add_test_case Dq name
+.br
+.Ic atf_check Dq command
+.br
+.Ic atf_check_equal Do expr1 Dc Dq expr2
+.br
+.Ic atf_config_get Dq var_name
+.br
+.Ic atf_config_has Dq var_name
+.br
+.Ic atf_expect_death Do reason Dc Dq \&...
+.br
+.Ic atf_expect_exit Do exitcode Dc Do reason Dc Dq \&...
+.br
+.Ic atf_expect_fail Do reason Dc Dq \&...
+.br
+.Ic atf_expect_pass
+.br
+.Ic atf_expect_signal Do signo Dc Do reason Dc Dq \&...
+.br
+.Ic atf_expect_timeout Do reason Dc Dq \&...
+.br
+.Ic atf_fail Dq reason
+.br
+.Ic atf_get Dq var_name
+.br
+.Ic atf_get_srcdir
+.br
+.Ic atf_pass
+.br
+.Ic atf_require_prog Dq prog_name
+.br
+.Ic atf_set Do var_name Dc Dq value
+.br
+.Ic atf_skip Dq reason
+.br
+.Ic atf_test_case Do name Dc Dq cleanup
+.br
 .Sh DESCRIPTION
 ATF
 provides a simple but powerful interface to easily write test programs in
@@ -114,13 +133,43 @@ atf_init_test_cases() {
 ... add additional test cases ...
 }
 .Ed
+.Pp
+All of these functions are required to return with an exit-status of
+zero, or ATF will determine that the test is faulty.
+In particular, this means that none may end with a conditional like:
+.Bd -literal -offset indent
+atf_sh_function() {
+... appropriate code here ...
+condition-test && {
+	... more code here ...
+}
+}
+.Ed
+.Pp
+as if condition-test fails
+the return code from atf_sh_function will not be 0.
+This can be corrected by adding
+.Bd -literal -offset indent
+return 0
+.Ed
+.Pp
+before the end of the function, or by writing it as
+.Bd -literal -offset indent
+atf_sh_function() {
+... appropriate code here ...
+if condition-test
+then
+	... more code here ...
+fi
+}
+.Ed
 .Ss Definition of test cases
 Test cases have an identifier and are composed of three different parts:
 the header, the body and an optional cleanup routine, all of which are
 described in
 .Xr atf-test-case 4 .
 To define test cases, one can use the
-.Fn atf_test_case
+.Ic atf_test_case
 function, which takes a first parameter specifiying the test case's
 name and instructs the library to set things up to accept it as a valid
 test case.
@@ -132,33 +181,34 @@ It is important to note that this functi
 .Em does not
 set the test case up for execution when the program is run.
 In order to do so, a later registration is needed through the
-.Fn atf_add_test_case
+.Ic atf_add_test_case
 function detailed in
 .Sx Program initialization .
 .Pp
 Later on, one must define the three parts of the body by providing two
 or three functions (remember that the cleanup routine is optional).
 These functions are named after the test case's identifier, and are
-.Fn _head ,
-.Fn _body
+.Ic _head ,
+.Ic _body
 and
-.Fn _cleanup.
+.Ic _cleanup.
 None of these take parameters when executed.
 .Ss Program initialization
 The test program must define an
-.Fn atf_init_test_cases
+.Ic atf_init_test_cases
 function, which is in charge of registering the test cases that will be
 executed at run time by using 

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

2017-05-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 15 04:21:14 UTC 2017

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

Log Message:
- Print 0x0007:0 ecx leaf bits.
- Don't print fdiv_bug on amd64.
- Print APIC ID, Initial APIC ID and clflush size.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/procfs_machdep.c

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.14 src/sys/arch/x86/x86/procfs_machdep.c:1.15
--- src/sys/arch/x86/x86/procfs_machdep.c:1.14	Thu Dec  8 06:28:21 2016
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon May 15 04:21:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.14 2016/12/08 06:28:21 msaitoh Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15 2017/05/15 04:21:14 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.14 2016/12/08 06:28:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15 2017/05/15 04:21:14 msaitoh Exp $");
 
 #include 
 #include 
@@ -131,7 +131,7 @@ static const char * const x86_features[]
 	"clwb", NULL, "avx512pf", "avx512er",
 	"avx512cd", "sha_ni", "avx512bw", "avx512vl"},
 
-	{ /* (10) 000d eax */
+	{ /* (10) 0x000d eax */
 	"xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -148,6 +148,38 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (13) 0x8008 ebx */
+	"clzero", "irperf", NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (14) 0x0006 eax */
+	"dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp",
+	"hwp_notify", "hwp_act_window", "hwp_epp","hwp_pkg_req",
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (15) 0x800a edx */
+	"npt", "lbrv", "svm_lock", "nrip_save",
+	"tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists",
+	NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (16) 0x0007:0 ecx */
+	NULL, "avx512vbmi", NULL, "pku", "ospke", NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, "avx512_vpopcntdq", NULL,
+	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (17) 0x8007 ebx */
+	"overflow_recov", "succor", "smca", NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 };
 
 static int	procfs_getonecpu(int, struct cpu_info *, char *, size_t *);
@@ -246,9 +278,18 @@ procfs_getonecpufeatures(struct cpu_info
 	left);
 	diff = last - *left;
 
-	/* (10) 000d eax */
+	/* (10) 0x000d eax */
 	/* (11) 0x000f(ecx=0) edx */
 	/* (12) 0x000f(ecx=1) edx */
+	/* (13) 0x8008 ebx */
+	/* (14) 0x0006 eax */
+	/* (15) 0x800a edx */
+
+	procfs_getonefeatreg(ci->ci_feat_val[6], x86_features[16], p + diff,
+	left);
+	diff = last - *left;
+
+	/* (17) 0x8007 ebx */
 
 	return 0; /* XXX */
 }
@@ -318,17 +359,36 @@ procfs_getonecpu(int xcpu, struct cpu_in
 		left = 0;
 
 	l = snprintf(p, left,
+	"apicid\t\t: %d\n"
+	"initial apicid\t: %d\n",
+	ci->ci_acpiid,
+	ci->ci_initapicid
+	);
+	size += l;
+	if (l < left) {
+		left -= l;
+		p += l;
+	} else
+		left = 0;
+
+	l = snprintf(p, left,
+#ifdef __i386__
 	"fdiv_bug\t: %s\n"
+#endif
 	"fpu\t\t: %s\n"
 	"fpu_exception\t: yes\n"
 	"cpuid level\t: %d\n"
 	"wp\t\t: %s\n"
-	"flags\t\t: %s\n",
+	"flags\t\t: %s\n"
+	"clflush size\t: %d\n",
+#ifdef __i386__
 	i386_fpu_fdivbug ? "yes" : "no",	/* an old pentium */
+#endif
 	i386_fpu_present ? "yes" : "no",	/* not a 486SX */
 	cpuid_level,
 	(rcr0() & CR0_WP) ? "yes" : "no",
-	featurebuf
+	featurebuf,
+	ci->ci_cflush_lsize
 	);
 	size += l;
 



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

2017-05-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 15 04:02:52 UTC 2017

Modified Files:
src/sys/arch/x86/include: cpu.h specialreg.h

Log Message:
 CPUID_CFLUSH bit is not for CFLUSH insn but CLFLUSH insn, so modify comments
and snprintb() sring.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/x86/include/specialreg.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/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.69 src/sys/arch/x86/include/cpu.h:1.70
--- src/sys/arch/x86/include/cpu.h:1.69	Fri Apr 14 04:43:47 2017
+++ src/sys/arch/x86/include/cpu.h	Mon May 15 04:02:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.69 2017/04/14 04:43:47 kamil Exp $	*/
+/*	$NetBSD: cpu.h,v 1.70 2017/05/15 04:02:52 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -180,7 +180,7 @@ struct cpu_info {
 	const struct cpu_functions *ci_func;  /* start/stop functions */
 	struct trapframe *ci_ddb_regs;
 
-	u_int ci_cflush_lsize;	/* CFLUSH insn line size */
+	u_int ci_cflush_lsize;	/* CLFLUSH insn line size */
 	struct x86_cache_info ci_cinfo[CAI_COUNT];
 
 	union descriptor *ci_gdt;

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.97 src/sys/arch/x86/include/specialreg.h:1.98
--- src/sys/arch/x86/include/specialreg.h:1.97	Sat Apr 22 04:24:25 2017
+++ src/sys/arch/x86/include/specialreg.h	Mon May 15 04:02:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.97 2017/04/22 04:24:25 nonaka Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98 2017/05/15 04:02:52 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -144,7 +144,7 @@
 #define CPUID_PAT	0x0001	/* Page Attribute Table */
 #define CPUID_PSE36	0x0002	/* 36-bit PSE */
 #define CPUID_PN	0x0004	/* processor serial number */
-#define CPUID_CFLUSH	0x0008	/* CFLUSH insn supported */
+#define CPUID_CFLUSH	0x0008	/* CLFLUSH insn supported */
 #define CPUID_B20	0x0010	/* reserved */
 #define CPUID_DS	0x0020	/* Debug Store */
 #define CPUID_ACPI	0x0040	/* ACPI performance modulation regs */
@@ -163,7 +163,7 @@
 	"\5" "TSC"	"\6" "MSR"	"\7" "PAE"	"\10" "MCE" \
 	"\11" "CX8"	"\12" "APIC"	"\13" "B10"	"\14" "SEP" \
 	"\15" "MTRR"	"\16" "PGE"	"\17" "MCA"	"\20" "CMOV" \
-	"\21" "PAT"	"\22" "PSE36"	"\23" "PN"	"\24" "CFLUSH" \
+	"\21" "PAT"	"\22" "PSE36"	"\23" "PN"	"\24" "CLFLUSH" \
 	"\25" "B20"	"\26" "DS"	"\27" "ACPI"	"\30" "MMX" \
 	"\31" "FXSR"	"\32" "SSE"	"\33" "SSE2"	"\34" "SS" \
 	"\35" "HTT"	"\36" "TM"	"\37" "IA64"	"\40" "SBF"



CVS commit: src/sys/dev

2017-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon May 15 01:03:47 UTC 2017

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

Log Message:
Don't hold sc_lock whilst calling mix_write/read.  This makes uaudio work
again.

With regard to uaudio however tyr-quake's audio does not work well.


To generate a diff of this commit:
cvs rdiff -u -r1.346 -r1.347 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.346 src/sys/dev/audio.c:1.347
--- src/sys/dev/audio.c:1.346	Sun May 14 10:57:32 2017
+++ src/sys/dev/audio.c	Mon May 15 01:03:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.346 2017/05/14 10:57:32 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.347 2017/05/15 01:03:47 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.346 2017/05/14 10:57:32 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.347 2017/05/15 01:03:47 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -3485,10 +3485,12 @@ audiostartr(struct audio_softc *sc, stru
 		return EINVAL;
 
 	if (sc->sc_rec_started == false) {
+		mutex_exit(sc->sc_lock);
 		mutex_enter(sc->sc_intr_lock);
 		mix_read(sc);
 		cv_broadcast(>sc_rcondvar);
 		mutex_exit(sc->sc_intr_lock);
+		mutex_enter(sc->sc_lock);
 	}
 	vc->sc_rbus = true;
 
@@ -3523,6 +3525,7 @@ audiostartp(struct audio_softc *sc, stru
 	if (sc->sc_trigger_started == false) {
 		audio_mix(sc);
 		audio_mix(sc);
+		mutex_exit(sc->sc_lock);
 		mutex_enter(sc->sc_intr_lock);
 		mix_write(sc);
 		vc = chan->vc;
@@ -3532,6 +3535,7 @@ audiostartp(struct audio_softc *sc, stru
 		mix_write(sc);
 		cv_broadcast(>sc_condvar);
 		mutex_exit(sc->sc_intr_lock);
+		mutex_enter(sc->sc_lock);
 	}
 
 	return error;



CVS commit: src/usr.sbin/npf/npfctl

2017-05-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 14 21:38:23 UTC 2017

Modified Files:
src/usr.sbin/npf/npfctl: npf_show.c

Log Message:
don't print decimal and parse hex!


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/npf/npfctl/npf_show.c

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf_show.c
diff -u src/usr.sbin/npf/npfctl/npf_show.c:1.23 src/usr.sbin/npf/npfctl/npf_show.c:1.24
--- src/usr.sbin/npf/npfctl/npf_show.c:1.23	Sat Jan 28 19:18:15 2017
+++ src/usr.sbin/npf/npfctl/npf_show.c	Sun May 14 17:38:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_show.c,v 1.23 2017/01/29 00:18:15 christos Exp $	*/
+/*	$NetBSD: npf_show.c,v 1.24 2017/05/14 21:38:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npf_show.c,v 1.23 2017/01/29 00:18:15 christos Exp $");
+__RCSID("$NetBSD: npf_show.c,v 1.24 2017/05/14 21:38:23 christos Exp $");
 
 #include 
 #define	__FAVOR_BSD
@@ -341,7 +341,7 @@ static void
 npfctl_print_id(npf_conf_info_t *ctx, nl_rule_t *rl)
 {
 	uint64_t id = id = npf_rule_getid(rl);
-	fprintf(ctx->fp, "# id=\"%" PRIu64 "\" ", id);
+	fprintf(ctx->fp, "# id=\"%" PRIx64 "\" ", id);
 }
 
 static void



CVS commit: src/tests/bin/sh

2017-05-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 14 17:28:46 UTC 2017

Modified Files:
src/tests/bin/sh: t_redircloexec.sh

Log Message:
Add a test for opening files with exec "when" in posix mode (close-on-exec
should not get set.)  While here, remove the (unused) runhelper() function.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/sh/t_redircloexec.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/bin/sh/t_redircloexec.sh
diff -u src/tests/bin/sh/t_redircloexec.sh:1.3 src/tests/bin/sh/t_redircloexec.sh:1.4
--- src/tests/bin/sh/t_redircloexec.sh:1.3	Sun May 15 15:44:43 2016
+++ src/tests/bin/sh/t_redircloexec.sh	Sun May 14 17:28:46 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_redircloexec.sh,v 1.3 2016/05/15 15:44:43 kre Exp $
+# $NetBSD: t_redircloexec.sh,v 1.4 2017/05/14 17:28:46 kre Exp $
 #
 # Copyright (c) 2016 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -39,10 +39,6 @@ mkhelper() {
 	echo "echo ${name}2" ">&${fd}" > ./"${name}2"
 }
 
-runhelper() {
-	${TEST_SH} "./${1}1"
-}
-
 cleanhelper() {
 	# not really needed, atf cleans up...
 	rm -f ./"${1}1" ./"${1}2" out
@@ -168,6 +164,77 @@ subshell_redir_open_body() {
 	cleanhelper comp
 }
 
+atf_test_case posix_exec_redir
+posix_exec_redir_head() {
+	atf_set "descr" "Tests that redirections created by exec" \
+		" in posix mode  are not closed on exec"
+}
+posix_exec_redir_body() {
+
+	# This test mostly just expects the opposite results than
+	# exec_redir_closed ...
+
+	# First work out how to get shell into posix mode
+	POSIX=
+
+	# This should succeed only if "set -o posix" succeeds.
+	# If it fails, whether it fails and exits the shell, or
+	# just returns a "false" from set (exit != 0), with or
+	# without errs on stderr, should not matter
+
+	if ${TEST_SH} -c "set -o posix && exit 0 || exit 1" 2>/dev/null
+	then
+		# If we have this method, use it, as we can expect
+		# this really should mean the shell is in posix mode.
+
+		POSIX='set -o posix;'
+
+	else
+		# This one is just a guess, and there is no assurance
+		# that it will do anything at all.  What's more, since
+		# we do not know what the shell being tested does
+		# differently in posix and non-posix modes, if it
+		# even has that concept, there's nothing we can test
+		# to find out.
+
+		# A shell that always operates in posix mode (at least
+		# with regard to redirects on exec and close-on-exec
+		# should pass this test, in any case.
+
+		POSIXLY_CORRECT=true ; export POSIXLY_CORRECT
+
+	fi
+
+	mkhelper exec 6 \
+	"${POSIX} exec 6> out; echo exec1 >&6; ${TEST_SH} exec2; exec 6>&-"
+
+	atf_check -s exit:0 -o empty -e empty ${TEST_SH} ./exec1
+	atf_check -s exit:0 -o empty -e empty ${TEST_SH} -e ./exec1
+
+	mkhelper exec 9 \
+		"${POSIX} exec 9> out; echo exec1 >&9; ${TEST_SH} exec2"
+
+	atf_check -s exit:0 -o empty -e empty ${TEST_SH} ./exec1
+
+	mkhelper exec 8 \
+		"${POSIX}"\
+		"exec 8> out; printf OK; echo exec1 >&8;" \
+		"printf OK; ${TEST_SH} exec2; printf GOOD"
+
+	atf_check -s exit:0 -o match:OKOKGOOD -e empty \
+		${TEST_SH} -e ./exec1
+
+	mkhelper exec 7 \
+		"${POSIX}"\
+		"exec 7> out; printf OK; echo exec1 >&7;" \
+		"printf OK; ${TEST_SH} exec2 || printf ERR"
+
+	atf_check -s exit:0 -o match:OKOK -o not-match:ERR -e empty \
+		${TEST_SH} ./exec1
+
+	cleanhelper exec
+}
+
 atf_init_test_cases() {
 	atf_add_test_case exec_redir_closed
 	atf_add_test_case exec_redir_open
@@ -175,4 +242,5 @@ atf_init_test_cases() {
 	atf_add_test_case compound_redir_open
 	atf_add_test_case simple_redir_open
 	atf_add_test_case subshell_redir_open
+	atf_add_test_case posix_exec_redir
 }



CVS commit: src/bin/sh

2017-05-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 14 17:27:05 UTC 2017

Modified Files:
src/bin/sh: redir.c sh.1

Log Message:
When opening a file descritor with "exec n>/file" (and similar) only
set the close-on-exec bit when not in posix mode (to comply with posix...)
OK: christos@


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/bin/sh/redir.c
cvs rdiff -u -r1.140 -r1.141 src/bin/sh/sh.1

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/redir.c
diff -u src/bin/sh/redir.c:1.54 src/bin/sh/redir.c:1.55
--- src/bin/sh/redir.c:1.54	Sat Apr 29 15:14:28 2017
+++ src/bin/sh/redir.c	Sun May 14 17:27:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: redir.c,v 1.54 2017/04/29 15:14:28 kre Exp $	*/
+/*	$NetBSD: redir.c,v 1.55 2017/05/14 17:27:05 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)redir.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: redir.c,v 1.54 2017/04/29 15:14:28 kre Exp $");
+__RCSID("$NetBSD: redir.c,v 1.55 2017/05/14 17:27:05 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -338,7 +338,7 @@ openredirect(union node *redir, char mem
 		abort();
 	}
 
-	cloexec = fd > 2 && (flags & REDIR_KEEP) == 0;
+	cloexec = fd > 2 && (flags & REDIR_KEEP) == 0 && !posix;
 	if (f != fd) {
 		if (copyfd(f, fd, cloexec) < 0) {
 			int e = errno;

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.140 src/bin/sh/sh.1:1.141
--- src/bin/sh/sh.1:1.140	Sun May 14 14:14:39 2017
+++ src/bin/sh/sh.1	Sun May 14 17:27:05 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.140 2017/05/14 14:14:39 kre Exp $
+.\"	$NetBSD: sh.1,v 1.141 2017/05/14 17:27:05 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -382,7 +382,11 @@ Currently this option controls whether (
 the file given by the
 .Ev ENV
 variable is read at startup by a non-interactive shell.
-It also controls whether the shell treats
+It also controls whether file descriptors greater than 2
+opened using the
+.Ic exec
+built-in command are passed on to utilities executed,
+and whether the shell treats
 an empty compound statement as a syntax error (required
 by posix) or permits it.
 Empty compound statements
@@ -1769,7 +1773,10 @@ Any redirections on the
 command are marked as permanent, so that they are not undone when the
 .Ic exec
 command finishes.
-File descriptors created via such redirections are marked close-on-exec
+When the
+.Ic posix
+option is not set,
+file descriptors created via such redirections are marked close-on-exec
 (see
 .Xr open 2
 .Dv O_CLOEXEC
@@ -1783,7 +1790,12 @@ Traditionally Bourne-like shells
 (except
 .Xr ksh 1 ) ,
 made those file descriptors available to exec'ed processes.
-To turn off the close-on-exec mark,
+This behavior is required by the
+.Tn POSIX
+standard, so when the
+.Ic posix
+option is set, this shell also acts that way.
+To be assured the close-on-exec setting is off,
 redirect the descriptor to (or from) itself,
 either when invoking a command for which the descriptor is wanted open,
 or by using
@@ -1795,7 +1807,8 @@ to leave the descriptor open in the shel
 and pass it to all commands invoked subsequently.
 Alternatively, see the
 .Ic fdflags
-command below.
+command below, which can set, or clear, this, and other,
+file descriptor flags.
 .It exit Op Ar exitstatus
 Terminate the shell process.
 If



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

2017-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May 14 15:36:46 UTC 2017

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c

Log Message:
Remove #if 0'ed old style cache handling in pmap_md_unmap_poolpage


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/mips/pmap_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/pmap_machdep.c
diff -u src/sys/arch/mips/mips/pmap_machdep.c:1.17 src/sys/arch/mips/mips/pmap_machdep.c:1.18
--- src/sys/arch/mips/mips/pmap_machdep.c:1.17	Sun May 14 11:46:22 2017
+++ src/sys/arch/mips/mips/pmap_machdep.c	Sun May 14 15:36:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_machdep.c,v 1.17 2017/05/14 11:46:22 skrll Exp $	*/
+/*	$NetBSD: pmap_machdep.c,v 1.18 2017/05/14 15:36:45 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.17 2017/05/14 11:46:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.18 2017/05/14 15:36:45 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -762,16 +762,7 @@ pmap_md_unmap_poolpage(vaddr_t va, size_
 
 	/* Note last mapped address for future color check */
 	pv->pv_va = va;
-#if 0
-	if (MIPS_CACHE_VIRTUAL_ALIAS) {
-		/*
-		 * We've unmapped a poolpage.  Its contents are irrelevant.
-		 */
-		KASSERT((va & PAGE_MASK) == 0);
-		mips_dcache_inv_range(va, PAGE_SIZE);
-		pv->pv_va = va;
-	}
-#endif
+
 	KASSERT(pv->pv_pmap == NULL);
 	KASSERT(pv->pv_next == NULL);
 



CVS commit: src/bin/sh

2017-05-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 14 14:14:39 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Add mention of ;& in the list of control operators (forgotten before).
Document the (slightly) enhanced NETBSD_SHELL.
Fix a typo (one of my typos...)
Move a commented out section to align with current planned changes
(and fix its commented out markup.)


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/bin/sh/sh.1

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/sh.1
diff -u src/bin/sh/sh.1:1.139 src/bin/sh/sh.1:1.140
--- src/bin/sh/sh.1:1.139	Sun May 14 10:53:26 2017
+++ src/bin/sh/sh.1	Sun May 14 14:14:39 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.139 2017/05/14 10:53:26 wiz Exp $
+.\"	$NetBSD: sh.1,v 1.140 2017/05/14 14:14:39 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -294,6 +294,19 @@ the file system is searched for commands
 Force the shell to behave interactively.
 .It Fl I Em ignoreeof
 Ignore EOFs from input when interactive.
+.\" .It Fl L Em lineno_fn_relative
+.\" When set, before a function is defined,
+.\" causes the variable
+.\" .Ev LINENO
+.\" when used within the function,
+.\" to refer to the line number defined such that
+.\" first line of the function is line 1.
+.\" When reset,
+.\" .Ev LINENO
+.\" in a function refers to the line number within the file
+.\" in which the definition of the function occurs
+.\" (which can be the number of lines of shell input from standard input
+.\" when a function is defined interactively from the command prompt.)
 .It Fl m Em monitor
 Turn on job control (set automatically when interactive).
 .It Fl n Em noexec
@@ -349,19 +362,6 @@ Make an interactive shell always print t
 changed by the
 .Ic cd
 command.
-.\" .It "\ \ " Em lineno_fn_relative
-.\" When set, before a function is defined,
-.\" causes the variable
-.\" .Cm LINENO
-.\" when used within the function,
-.\" to refer to the line number defined such that
-.\" first line of the function is line 1.
-.\" When reset,
-.\" .Cm LINENO
-.\" in a function refers to the line number within the file
-.\" in which the definition of the function occurs
-.\" (which can be the number of lines of shell input from standard input
-.\" when a function is defined interactively from the command prompt.)
 .It "\ \ " Em nolog
 Prevent the entry of function definitions into the command history (see
 .Ic fc
@@ -410,7 +410,7 @@ operators (their meaning is discussed la
 The following is a list of operators:
 .Bl -ohang -offset indent
 .It "Control operators:"
-.Dl \*[Am]  \*[Am]\*[Am]  \&(  \&)  \&;  ;; | || \*[Lt]newline\*[Gt]
+.Dl \*[Am]  \*[Am]\*[Am]  \&(  \&)  \&;  ;; ;\*[Am] | || \*[Lt]newline\*[Gt]
 .It "Redirection operators:"
 .Dl \*[Lt]  \*[Gt]  \*[Gt]|  \*[Lt]\*[Lt]  \*[Gt]\*[Gt]  \*[Lt]\*[Am]  \*[Gt]\*[Am]  \*[Lt]\*[Lt]-  \*[Lt]\*[Gt]
 .El
@@ -820,7 +820,7 @@ for the command to terminate before proc
 A newline is equivalent to a
 .Sq \&;
 when no other operator is present, and the command being input
-could syntatically correctly be terminated at the point where
+could syntactically correctly be terminated at the point where
 the newline is encountered, otherwise it is just whitespace.
 .Ss Short-Circuit List Operators
 .Dq \*[Am]\*[Am]
@@ -2683,7 +2683,15 @@ modified, or exported from the shell.
 If set, by the shell, it indicates that the shell is the
 .Ic sh
 defined by this manual page, and gives its version information.
-It behaves like any other variable that has the read-only
+It can also give information in additional space separated words,
+after the version string.
+If the shell was built as part of a reproducible build,
+the relevant date that was used for that build will be included.
+Finally, any non-standard compilation options,
+which may affect features available,
+that were used when building the shell will be listed.
+.Ev NETBSD_SHELL
+behaves like any other variable that has the read-only
 and un-exportable attributes set.
 .El
 .Sh FILES



CVS commit: src/sys/rump/librump/rumpkern

2017-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 14 13:49:55 UTC 2017

Modified Files:
src/sys/rump/librump/rumpkern: vm.c

Log Message:
Add uvm_map_pageable dummy function.  This means that the audio tests
should run again.

Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/rump/librump/rumpkern/vm.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/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.172 src/sys/rump/librump/rumpkern/vm.c:1.173
--- src/sys/rump/librump/rumpkern/vm.c:1.172	Sun May  7 14:20:50 2017
+++ src/sys/rump/librump/rumpkern/vm.c	Sun May 14 13:49:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.172 2017/05/07 14:20:50 martin Exp $	*/
+/*	$NetBSD: vm.c,v 1.173 2017/05/14 13:49:55 nat Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.172 2017/05/07 14:20:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.173 2017/05/14 13:49:55 nat Exp $");
 
 #include 
 #include 
@@ -409,6 +409,13 @@ uvmspace_init(struct vmspace *vm, struct
 	vm->vm_refcnt = 1;
 }
 
+int
+uvm_map_pageable(struct vm_map *map, vaddr_t start, vaddr_t end,
+bool new_pageable, int lockflags)
+{
+	return 0;
+}
+
 void
 uvm_pagewire(struct vm_page *pg)
 {



CVS commit: [prg-localcount2] src/sys/dev/mscp

2017-05-14 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun May 14 13:02:35 UTC 2017

Modified Files:
src/sys/dev/mscp [prg-localcount2]: mscp_disk.c

Log Message:
Rearrange the else clauses to make it work.


To generate a diff of this commit:
cvs rdiff -u -r1.89.8.1 -r1.89.8.2 src/sys/dev/mscp/mscp_disk.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/mscp/mscp_disk.c
diff -u src/sys/dev/mscp/mscp_disk.c:1.89.8.1 src/sys/dev/mscp/mscp_disk.c:1.89.8.2
--- src/sys/dev/mscp/mscp_disk.c:1.89.8.1	Thu Apr 27 05:36:35 2017
+++ src/sys/dev/mscp/mscp_disk.c	Sun May 14 13:02:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mscp_disk.c,v 1.89.8.1 2017/04/27 05:36:35 pgoyette Exp $	*/
+/*	$NetBSD: mscp_disk.c,v 1.89.8.2 2017/05/14 13:02:35 pgoyette Exp $	*/
 /*
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.89.8.1 2017/04/27 05:36:35 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.89.8.2 2017/05/14 13:02:35 pgoyette Exp $");
 
 #include 
 #include 
@@ -1145,21 +1145,20 @@ ra_putonline(dev_t dev, struct ra_softc 
 	rastrategy, dl, NULL)) == NULL) {
 		ra->ra_havelabel = 1;
 		ra->ra_state = DK_OPEN;
-	}
+	} else {
 #if NRACD
-	else {
 		cdev = cdevsw_lookup_acquire(dev);
 		if (cdev == _cdevsw) {
 			dl->d_partitions[0].p_offset = 0;
 			dl->d_partitions[0].p_size = dl->d_secperunit;
 			dl->d_partitions[0].p_fstype = FS_ISO9660;
-		}
+		} else
+			printf(": %s", msg);
 		if (cdev != NULL)
 			cdevsw_release(cdev);
-	}
-#endif /* NRACD */
-	else {
+#else
 		printf(": %s", msg);
+#endif /* NRACD */
 	}
 
 	printf(": size %d sectors\n", dl->d_secperunit);



CVS commit: src/lib/libc/gen

2017-05-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun May 14 12:35:47 UTC 2017

Modified Files:
src/lib/libc/gen: signalname.3

Log Message:
Formatting and punctuation improvements.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/signalname.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/gen/signalname.3
diff -u src/lib/libc/gen/signalname.3:1.1 src/lib/libc/gen/signalname.3:1.2
--- src/lib/libc/gen/signalname.3:1.1	Tue May  9 11:14:16 2017
+++ src/lib/libc/gen/signalname.3	Sun May 14 12:35:46 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: signalname.3,v 1.1 2017/05/09 11:14:16 kre Exp $
+.\" $NetBSD: signalname.3,v 1.2 2017/05/14 12:35:46 wiz Exp $
 .\"
 .\" Available to all and sundry, without restriction on use, or other
 .\" limitations, and without fee.   Also without any warranty of fitness
@@ -20,8 +20,8 @@
 .Dt SIGNALNAME 3
 .Os
 .Sh NAME
-.Nm signalname
-.Nm signalnumber
+.Nm signalname ,
+.Nm signalnumber ,
 .Nm signalnext
 .Nd convert between signal numbers and names
 .Sh LIBRARY
@@ -43,16 +43,21 @@ and returns the name of that signal.
 The name returned is locale independent,
 and can be the string representation of one of the
 signal names from
-.In signal.h 
-such as SIGHUP, SIGSTOP, SIGKILL,
+.In signal.h
+such as
+.Dv SIGHUP ,
+.Dv SIGSTOP ,
+.Dv SIGKILL ,
 or some similar name,
 but does not contain the leading
-.Dq SIG
+.Dq Dv SIG
 prefix.
 .Pp
 The return value of
 .Fn signalname
-is NULL if
+is
+.Dv NULL
+if
 .Fa sig
 does not represent a valid signal number,
 or if the signal number given has no name.
@@ -66,7 +71,7 @@ The
 .Fa name
 is handled in a case-insensitive manner.
 Any leading
-.Dq SIG
+.Dq Dv SIG
 prefix in
 .Fa name
 is ignored.
@@ -90,7 +95,7 @@ The
 .Fn signalnext
 function returns minus one (\-1) on error, if the given signal
 .Fa sig
-is neither a valid signal number, nor zero.
+is neither a valid signal number nor zero.
 It returns zero when the input signal number,
 .Fa sig ,
 is the biggest available signal number.
@@ -126,7 +131,7 @@ is invalid.
 .Sh HISTORY
 The
 .Fn signalname ,
-.Fn signalnext
+.Fn signalnext ,
 and
 .Fn signalnumber
 functions first appeared in



CVS commit: src/share/man/man9

2017-05-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun May 14 12:31:13 UTC 2017

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

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/uvm_map.9

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

Modified files:

Index: src/share/man/man9/uvm_map.9
diff -u src/share/man/man9/uvm_map.9:1.7 src/share/man/man9/uvm_map.9:1.8
--- src/share/man/man9/uvm_map.9:1.7	Sat May  6 21:34:51 2017
+++ src/share/man/man9/uvm_map.9	Sun May 14 12:31:13 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: uvm_map.9,v 1.7 2017/05/06 21:34:51 joerg Exp $
+.\"	$NetBSD: uvm_map.9,v 1.8 2017/05/14 12:31:13 wiz Exp $
 .\"
 .\" Copyright (c) 1998 Matthew R. Green
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 20, 2014
+.Dd May 6, 2017
 .Dt UVM_MAP 9
 .Os
 .Sh NAME



CVS commit: src/lib/libc/sys

2017-05-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun May 14 12:30:37 UTC 2017

Modified Files:
src/lib/libc/sys: execve.2 getdents.2 intro.2 lfs_markv.2
lfs_segclean.2 lfs_segwait.2 mount.2 mprotect.2 open.2 statvfs.2
sync.2 truncate.2 undelete.2

Log Message:
file system police.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/sys/execve.2
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/sys/getdents.2
cvs rdiff -u -r1.58 -r1.59 src/lib/libc/sys/intro.2
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/sys/lfs_markv.2
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/sys/lfs_segclean.2 \
src/lib/libc/sys/lfs_segwait.2
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/sys/mount.2
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/sys/mprotect.2
cvs rdiff -u -r1.56 -r1.57 src/lib/libc/sys/open.2
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/sys/statvfs.2
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/sys/sync.2
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/sys/truncate.2
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/sys/undelete.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/execve.2
diff -u src/lib/libc/sys/execve.2:1.40 src/lib/libc/sys/execve.2:1.41
--- src/lib/libc/sys/execve.2:1.40	Mon May 31 12:16:20 2010
+++ src/lib/libc/sys/execve.2	Sun May 14 12:30:37 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: execve.2,v 1.40 2010/05/31 12:16:20 njoly Exp $
+.\"	$NetBSD: execve.2,v 1.41 2017/05/14 12:30:37 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -220,7 +220,7 @@ in
 Search permission is denied for a component of the path prefix,
 the new process file is not an ordinary file,
 its file mode denies execute permission, or
-it is on a filesystem mounted with execution
+it is on a file system mounted with execution
 disabled
 .Dv ( MNT_NOEXEC
 in

Index: src/lib/libc/sys/getdents.2
diff -u src/lib/libc/sys/getdents.2:1.24 src/lib/libc/sys/getdents.2:1.25
--- src/lib/libc/sys/getdents.2:1.24	Sat Jan 23 08:17:18 2016
+++ src/lib/libc/sys/getdents.2	Sun May 14 12:30:37 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: getdents.2,v 1.24 2016/01/23 08:17:18 dholland Exp $
+.\"	$NetBSD: getdents.2,v 1.25 2017/05/14 12:30:37 wiz Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -34,7 +34,7 @@
 .Os
 .Sh NAME
 .Nm getdents
-.Nd "get directory entries in a filesystem independent format"
+.Nd "get directory entries in a file system independent format"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -48,7 +48,7 @@ referenced by the file descriptor
 .Fa fd
 into the buffer pointed to by
 .Fa buf ,
-in a filesystem independent format.
+in a file system independent format.
 Up to
 .Fa nbytes
 of data will be transferred.
@@ -57,7 +57,7 @@ must be greater than or equal to the
 block size associated with the file,
 see
 .Xr stat 2 .
-Some filesystems may not support
+Some file systems may not support
 .Fn getdents
 with buffers smaller than this size.
 .Pp

Index: src/lib/libc/sys/intro.2
diff -u src/lib/libc/sys/intro.2:1.58 src/lib/libc/sys/intro.2:1.59
--- src/lib/libc/sys/intro.2:1.58	Wed Nov  2 03:21:38 2016
+++ src/lib/libc/sys/intro.2	Sun May 14 12:30:37 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: intro.2,v 1.58 2016/11/02 03:21:38 pgoyette Exp $
+.\"	$NetBSD: intro.2,v 1.59 2017/05/14 12:30:37 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1983, 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -419,7 +419,7 @@ was exhausted.
 .It Er 70 ESTALE Em "Stale NFS file handle" .
 An attempt was made to access an open file (on an
 .Tn NFS
-filesystem)
+file system)
 which is now unavailable as referenced by the file descriptor.
 This may indicate the file was deleted on the
 .Tn NFS
@@ -458,11 +458,11 @@ Attempted a file operation on a file of 
 .It Er 80 EAUTH Em "Authentication error" .
 Attempted to use an invalid authentication ticket to mount an
 .Tn NFS
-filesystem.
+file system.
 .It Er 81 ENEEDAUTH Em "Need authenticator" .
 An authentication ticket must be obtained before the given
 .Tn NFS
-filesystem may be mounted.
+file system may be mounted.
 .It Er 82 EIDRM Em "Identifier removed" .
 An IPC identifier was removed while the current process was waiting on it.
 .It Er 83 ENOMSG Em "No message of the desired type" .
@@ -659,7 +659,7 @@ program.
 .It Sy nfsio , nfskqpoll
 NFS handing daemons.
 .It Sy lfs_writer
-Log filesystem writer.
+Log file system writer.
 .It Sy pagedaemon
 The page daemon.
 .It Sy raidX , raidioX , raid_parity , raid_recon , raid_reconip , raid_copyback

Index: src/lib/libc/sys/lfs_markv.2
diff -u src/lib/libc/sys/lfs_markv.2:1.11 src/lib/libc/sys/lfs_markv.2:1.12
--- src/lib/libc/sys/lfs_markv.2:1.11	Wed Apr 30 13:10:51 2008
+++ src/lib/libc/sys/lfs_markv.2	Sun May 14 12:30:37 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lfs_markv.2,v 1.11 2008/04/30 13:10:51 

CVS commit: src/lib/libc/sys

2017-05-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun May 14 12:29:10 UTC 2017

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

Log Message:
Use Nx.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/sys/mmap.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/mmap.2
diff -u src/lib/libc/sys/mmap.2:1.49 src/lib/libc/sys/mmap.2:1.50
--- src/lib/libc/sys/mmap.2:1.49	Sat May  6 21:34:51 2017
+++ src/lib/libc/sys/mmap.2	Sun May 14 12:29:10 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mmap.2,v 1.49 2017/05/06 21:34:51 joerg Exp $
+.\"	$NetBSD: mmap.2,v 1.50 2017/05/14 12:29:10 wiz Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -87,7 +87,9 @@ Pages may be written.
 .It Dv PROT_NONE
 Placeholder when requesting no access permission.
 .El
-As a NetBSD extension,
+As a
+.Nx
+extension,
 .Dv PROT_MPROTECT
 can be used to request additional permissions for later use with
 .Fn mprotect 2 .



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

2017-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May 14 11:46:22 UTC 2017

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c

Log Message:
Handle the maximum number of colors across [di]caches


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/mips/pmap_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/pmap_machdep.c
diff -u src/sys/arch/mips/mips/pmap_machdep.c:1.16 src/sys/arch/mips/mips/pmap_machdep.c:1.17
--- src/sys/arch/mips/mips/pmap_machdep.c:1.16	Fri May 12 06:49:31 2017
+++ src/sys/arch/mips/mips/pmap_machdep.c	Sun May 14 11:46:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_machdep.c,v 1.16 2017/05/12 06:49:31 skrll Exp $	*/
+/*	$NetBSD: pmap_machdep.c,v 1.17 2017/05/14 11:46:22 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.16 2017/05/12 06:49:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.17 2017/05/14 11:46:22 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -165,6 +165,10 @@ PMAP_COUNTER(zeroed_pages, "pages zeroed
 PMAP_COUNTER(copied_pages, "pages copied");
 extern struct evcnt pmap_evcnt_page_cache_evictions;
 
+u_int pmap_page_cache_alias_mask;
+
+#define pmap_md_cache_indexof(x)	(((vaddr_t)(x)) & pmap_page_cache_alias_mask)
+
 static register_t
 pmap_md_map_ephemeral_page(struct vm_page *pg, bool locked_p, int prot,
 pt_entry_t *old_pte_p)
@@ -196,12 +200,20 @@ pmap_md_map_ephemeral_page(struct vm_pag
 		 */
 		kpreempt_disable(); // paired with the one in unmap
 		struct cpu_info * const ci = curcpu();
-		KASSERT(ci->ci_pmap_dstbase != 0);
-
+		if (MIPS_CACHE_VIRTUAL_ALIAS) {
+			KASSERT(ci->ci_pmap_dstbase != 0);
+			KASSERT(ci->ci_pmap_srcbase != 0);
+
+			const u_int __diagused mask = pmap_page_cache_alias_mask;
+			KASSERTMSG((ci->ci_pmap_dstbase & mask) == 0,
+			"%#"PRIxVADDR, ci->ci_pmap_dstbase);
+			KASSERTMSG((ci->ci_pmap_srcbase & mask) == 0,
+			"%#"PRIxVADDR, ci->ci_pmap_srcbase);
+		}
 		vaddr_t nva = (prot & VM_PROT_WRITE
 			? ci->ci_pmap_dstbase
 			: ci->ci_pmap_srcbase)
-		+ mips_cache_indexof(MIPS_CACHE_VIRTUAL_ALIAS
+		+ pmap_md_cache_indexof(MIPS_CACHE_VIRTUAL_ALIAS
 			? pv->pv_va
 			: pa);
 
@@ -330,8 +342,12 @@ pmap_bootstrap(void)
 	size_t sysmap_size;
 	pt_entry_t *sysmap;
 
-	if (MIPS_CACHE_VIRTUAL_ALIAS && uvmexp.ncolors)
+	if (MIPS_CACHE_VIRTUAL_ALIAS && uvmexp.ncolors) {
 		pmap_page_colormask = (uvmexp.ncolors - 1) << PAGE_SHIFT;
+		pmap_page_cache_alias_mask = max(
+		mips_cache_info.mci_cache_alias_mask,
+		mips_cache_info.mci_icache_alias_mask);
+	}
 
 #ifdef MULTIPROCESSOR
 	pmap_t pm = pmap_kernel();
@@ -509,16 +525,23 @@ pmap_md_alloc_ephemeral_address_space(st
 #endif
 	|| MIPS_CACHE_VIRTUAL_ALIAS
 	|| MIPS_ICACHE_VIRTUAL_ALIAS) {
-		vsize_t size = uvmexp.ncolors * PAGE_SIZE;
-		if (MIPS_ICACHE_VIRTUAL_ALIAS
-		&& mci->mci_picache_way_size > size)
-			size = mci->mci_picache_way_size;
-		ci->ci_pmap_dstbase = uvm_km_alloc(kernel_map, size, 0,
-		UVM_KMF_COLORMATCH | UVM_KMF_VAONLY);
+		vsize_t size = max(mci->mci_pdcache_way_size, mci->mci_picache_way_size);;
+		const u_int __diagused mask = pmap_page_cache_alias_mask;
+
+		ci->ci_pmap_dstbase = uvm_km_alloc(kernel_map, size, size,
+		UVM_KMF_VAONLY);
+
 		KASSERT(ci->ci_pmap_dstbase);
-		ci->ci_pmap_srcbase = uvm_km_alloc(kernel_map, size, 0,
-		UVM_KMF_COLORMATCH | UVM_KMF_VAONLY);
+		KASSERT(!pmap_md_direct_mapped_vaddr_p(ci->ci_pmap_dstbase));
+		KASSERTMSG((ci->ci_pmap_dstbase & mask) == 0, "%#"PRIxVADDR,
+		ci->ci_pmap_dstbase);
+
+		ci->ci_pmap_srcbase = uvm_km_alloc(kernel_map, size, size,
+		UVM_KMF_VAONLY);
 		KASSERT(ci->ci_pmap_srcbase);
+		KASSERT(!pmap_md_direct_mapped_vaddr_p(ci->ci_pmap_srcbase));
+		KASSERTMSG((ci->ci_pmap_srcbase & mask) == 0, "%#"PRIxVADDR,
+		ci->ci_pmap_srcbase);
 	}
 }
 



CVS commit: src/sys/dev/i2c

2017-05-14 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun May 14 11:39:17 UTC 2017

Modified Files:
src/sys/dev/i2c: axp20x.c

Log Message:
define control register and associated bits for RTC supercap charger


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/axp20x.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/i2c/axp20x.c
diff -u src/sys/dev/i2c/axp20x.c:1.4 src/sys/dev/i2c/axp20x.c:1.5
--- src/sys/dev/i2c/axp20x.c:1.4	Thu Oct 15 13:48:57 2015
+++ src/sys/dev/i2c/axp20x.c	Sun May 14 11:39:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: axp20x.c,v 1.4 2015/10/15 13:48:57 bouyer Exp $ */
+/* $NetBSD: axp20x.c,v 1.5 2017/05/14 11:39:17 tnn Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.4 2015/10/15 13:48:57 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.5 2017/05/14 11:39:17 tnn Exp $");
 
 #include 
 #include 
@@ -99,6 +99,33 @@ static int ldo4_mvV[] = {
 #define AXP_LDO3_VOLT_MASK		__BITS(0,6)
 #define AXP_LDO3_VOLT_SHIFT		0
 
+#define AXP_BKUP_CTRL			0x35
+#define AXP_BKUP_CTRL_ENABLE		__BIT(7)
+#define AXP_BKUP_CTRL_VOLT_MASK		__BITS(5,6)
+#define AXP_BKUP_CTRL_VOLT_SHIFT	5
+#define AXP_BKUP_CTRL_VOLT_3V1		0
+#define AXP_BKUP_CTRL_VOLT_3V0		1
+#define AXP_BKUP_CTRL_VOLT_3V6		2
+#define AXP_BKUP_CTRL_VOLT_2V5		3
+static int bkup_volt[] = {
+	3100,
+	3000,
+	3600,
+	2500
+};
+#define AXP_BKUP_CTRL_CURR_MASK		__BITS(0,1)
+#define AXP_BKUP_CTRL_CURR_SHIFT	0
+#define AXP_BKUP_CTRL_CURR_50U		0
+#define AXP_BKUP_CTRL_CURR_100U		1
+#define AXP_BKUP_CTRL_CURR_200U		2
+#define AXP_BKUP_CTRL_CURR_400U		3
+static int bkup_curr[] = {
+	50,
+	100,
+	200,
+	400
+};
+
 #define AXP_ACV_MON_REG		0x56	/* 2 bytes */
 #define AXP_ACI_MON_REG		0x58	/* 2 bytes */
 #define AXP_VBUSV_MON_REG	0x5a	/* 2 bytes */
@@ -347,6 +374,18 @@ axp20x_attach(device_t parent, device_t 
 			(int)(700 + (value & AXP_LDO3_VOLT_MASK) * 25));
 		}
 	}
+
+	if (axp20x_read(sc, AXP_BKUP_CTRL, , 1, I2C_F_POLL) == 0) {
+		if (value & AXP_BKUP_CTRL_ENABLE) {
+			aprint_verbose_dev(sc->sc_dev,
+			"RTC supercap charger enabled: %dmV at %duA\n",
+			bkup_volt[(value & AXP_BKUP_CTRL_VOLT_MASK) >>
+			AXP_BKUP_CTRL_VOLT_SHIFT],
+			bkup_curr[(value & AXP_BKUP_CTRL_CURR_MASK) >>
+			AXP_BKUP_CTRL_CURR_SHIFT]
+			);
+		}
+	}
 }
 
 static void



CVS commit: src/tests/bin/sh

2017-05-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 14 11:28:49 UTC 2017

Modified Files:
src/tests/bin/sh: t_expand.sh

Log Message:
Add a test case for the various ways that ${xxx} expansions, which
contain a # character, can get parsed (which amounts to 86 extra checks,
any Australian can tell you why I decided to stop there and not add one
more...)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/bin/sh/t_expand.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/bin/sh/t_expand.sh
diff -u src/tests/bin/sh/t_expand.sh:1.11 src/tests/bin/sh/t_expand.sh:1.12
--- src/tests/bin/sh/t_expand.sh:1.11	Mon Mar 20 11:48:41 2017
+++ src/tests/bin/sh/t_expand.sh	Sun May 14 11:28:49 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_expand.sh,v 1.11 2017/03/20 11:48:41 kre Exp $
+# $NetBSD: t_expand.sh,v 1.12 2017/05/14 11:28:49 kre Exp $
 #
 # Copyright (c) 2007, 2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -430,13 +430,170 @@ var_with_embedded_cmdsub_body() {
 	results
 }
 
+atf_test_case dollar_hash
+dollar_hash_head() {
+	atf_set "descr" 'Test expansion of various aspects of $#'
+}
+dollar_hash_body() {
+
+#
+#	$# looks like it should be so simple that it doesn't really
+#	need a test of its own, and used in that way, it really doesn't.
+#	But when we add braces ${#} we need to deal with the three
+#	(almost 4) different meanings of a # inside a ${} expansion...
+#	
+#		1.   ${#} is just $# (number of params)
+#		1.a	${\#} is nothing at all (error: invalid expansion)
+#		1.b	${\#...} (anything after) is the same (invalid)
+#		2.   ${#VAR} is the length of the value VAR
+#		2.a	Including ${##} - the length of ${#}
+#		3${VAR#pat} is the value of VAR with leading pat removed
+#		3.a	Including ${VAR#} which just removes leading nothing
+#			This is relevant in case of ${VAR#${X}} with X=''
+#		3.b	${##} is not a case of 3.a but rather 2.a 
+#		3.c	Yet ${##pat} is a case of 3.a
+#			Including ${##${X}} where X='' or X='#'
+#		3.d	And ${#\#} is invalid (error)
+#		3.e	But ${##\#} removes a leading # from the value of $#
+#			(so is just $# as there is no leading # there)
+#		4${VAR##pat} is the value of VAR with longest pat removed
+#		4.a	Including ${VAR##} which removes the longest nothing
+#		4.b	Which in this case includes ${###} (so is == $#)
+#		4.c	But not ${##\#} which is $# with a leading '#' removed
+#			(and so is also == $#), i.e.: like ${###} but different.
+#		4.d	As is ${###\#} or just ${} - remove  # (so just $#)
+#
+
+	reset dollar_hash
+
+	check 'set -- ; echo $#'			'0'		0  # 1
+	check 'set -- a b c; echo $#'			'3'		0  # 2
+	check 'set -- a b c d e f g h i j; echo $#'	'10'		0  # 3
+# rule 1
+	check 'set -- ; echo ${#}'			'0'		0  # 4
+	check 'set -- a b c; echo ${#}'			'3'		0  # 5
+	check 'set -- a b c d e f g h i j; echo ${#}'	'10'		0  # 6
+# rule 1.a
+	check 'set -- a b c; echo ${\#}'		''		2  # 7
+# rule 1.b
+	check 'set -- a b c; echo ${\#:-foo}'		''		2  # 8
+# rule 2
+	check 'VAR=12345; echo ${#VAR}'			'5'		0  # 9
+	check 'VAR=123456789012; echo ${#VAR}'		'12'		0  #10
+# rule 2.a
+	check 'set -- ; echo ${##}'			'1'		0  #11
+	check 'set -- a b c; echo ${##}'		'1'		0  #12
+	check 'set -- a b c d e f g h i j; echo ${##}'	'2'		0  #13
+# rule 3
+	check 'VAR=12345; echo ${VAR#1}'		'2345'		0  #14
+	check 'VAR=12345; echo ${VAR#2}'		'12345'		0  #15
+	check 'VAR=#2345; echo ${VAR#\#}'		'2345'		0  #16
+	check 'X=1; VAR=12345; echo ${VAR#${X}}'	'2345'		0  #17
+	check 'X=1; VAR=#2345; echo ${VAR#${X}}'	'#2345'		0  #18
+# rule 3.a
+	check 'VAR=12345; echo ${VAR#}'			'12345'		0  #19
+	check 'X=; VAR=12345; echo ${VAR#${X}}'		'12345'		0  #20
+# rule 3.b (tested above, rule 2.a)
+# rule 3.c
+	check 'set -- ; echo ${##0}'			''		0  #21
+	check 'set -- a b c; echo ${##1}'		'3'		0  #22
+	check 'set -- a b c d e f g h i j; echo ${##1}'	'0'		0  #23
+	check 'X=0; set -- ; echo ${##${X}}'		''		0  #24
+	check 'X=; set -- ; echo ${##${X}}'		'0'		0  #25
+	check 'X=1; set -- a b c; echo ${##${X}}'	'3'		0  #26
+	check 'X=1; set -- a b c d e f g h i j; echo ${##${X}}'	'0'	0  #27
+	check 'X=; set -- a b c d e f g h i j; echo ${##${X}}'	'10'	0  #28
+	check 'X=#; VAR=#2345; echo ${VAR#${X}}'	'2345'		0  #29
+	check 'X=#; VAR=12345; echo ${VAR#${X}}'	'12345'		0  #30
+# rule 3.d
+	check 'set -- a b c; echo ${#\#}'		''		2  #31
+# rule 3.e
+	check 'set -- ; echo ${##\#}'			'0'		0  #32
+	check 'set -- a b c d e f g h i j; echo ${##\#}' '10'		0  #33
+
+# rule 4
+	check 'VAR=12345; echo ${VAR##1}'		'2345'		0  #34
+	check 'VAR=12345; echo ${VAR##\1}'		'2345'		0  #35
+# rule 4.a
+	check 'VAR=12345; echo ${VAR##}'		'12345'		0  #36
+# rule 4.b
+	check 'set -- ; echo ${###}'			'0'		0  #37
+	check 'set -- a b c d e f g h i j; echo ${###}'	'10'		0  #38
+# rule 4.c
+	check 'VAR=12345; echo ${VAR#\#}'		'12345'		0  #39
+	check 'VAR=12345; echo ${VAR#\#1}'		'12345'		0  #40
+	check 'VAR=#2345; 

CVS commit: src/bin/sh

2017-05-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 14 11:25:09 UTC 2017

Modified Files:
src/bin/sh: Makefile

Log Message:
Fix a minor omission in last...


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/bin/sh/Makefile

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/Makefile
diff -u src/bin/sh/Makefile:1.105 src/bin/sh/Makefile:1.106
--- src/bin/sh/Makefile:1.105	Sun May 14 11:23:33 2017
+++ src/bin/sh/Makefile	Sun May 14 11:25:09 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.105 2017/05/14 11:23:33 kre Exp $
+#	$NetBSD: Makefile,v 1.106 2017/05/14 11:25:09 kre Exp $
 #	@(#)Makefile	8.4 (Berkeley) 5/5/95
 
 .include 
@@ -34,7 +34,7 @@ CPPFLAGS+=-DSHELL -I. -I${.CURDIR}
 BUILD_DATE!=	date -u -r "${MKREPRO_TIMESTAMP}" "+%Y%m%d%H%M%S"
 # These are (should be) equivalent, but the 2nd is easier to understand
 #CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:C/([^0]0?)(00)*$/\1/}Z"'
-CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:S/00$//:S/00$//:S/00//}Z"'
+CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:S/00$//:S/00$//:S/00$//}Z"'
 .endif
 
 .ifdef SMALLPROG



CVS commit: src/bin/sh

2017-05-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 14 11:23:33 UTC 2017

Modified Files:
src/bin/sh: Makefile var.c

Log Message:
Make ${NETBSD_SHELL}  value include (a human recognisable form of)
MKREPRO_TIMESTAMP (as an additional word in the value, with a "BUILD:" prefix)
if it is set during the build.   (Trailing 00 pairs in the time are removed).

While here, throw in some extra words that list the compilation
options used which alter sh behaviour (mostly by removing stuff.)
Usually that will only be noticed in a SMALL shell compiled for
install media, or similar - none of the others (not that there
are many) are ever changed from the default in a normal build
(default settings are just omitted.)   This also allows scripts
to tell if they are running in a DEBUG shell, which can sometimes
make debugging easier.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/bin/sh/Makefile
cvs rdiff -u -r1.52 -r1.53 src/bin/sh/var.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/Makefile
diff -u src/bin/sh/Makefile:1.104 src/bin/sh/Makefile:1.105
--- src/bin/sh/Makefile:1.104	Mon Mar 20 11:26:07 2017
+++ src/bin/sh/Makefile	Sun May 14 11:23:33 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.104 2017/03/20 11:26:07 kre Exp $
+#	$NetBSD: Makefile,v 1.105 2017/05/14 11:23:33 kre Exp $
 #	@(#)Makefile	8.4 (Berkeley) 5/5/95
 
 .include 
@@ -29,6 +29,14 @@ CPPFLAGS+=-DSHELL -I. -I${.CURDIR}
 #CFLAGS+=-funsigned-char
 #TARGET_CHARFLAG?= -DTARGET_CHAR="unsigned char" -funsigned-char
 
+# Reproducible build parameters ... export into sh for NETBSD_SHELL setting
+.if ${MKREPRO_TIMESTAMP:Uno} != "no"
+BUILD_DATE!=	date -u -r "${MKREPRO_TIMESTAMP}" "+%Y%m%d%H%M%S"
+# These are (should be) equivalent, but the 2nd is easier to understand
+#CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:C/([^0]0?)(00)*$/\1/}Z"'
+CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:S/00$//:S/00$//:S/00//}Z"'
+.endif
+
 .ifdef SMALLPROG
 CPPFLAGS+=-DSMALL
 .endif

Index: src/bin/sh/var.c
diff -u src/bin/sh/var.c:1.52 src/bin/sh/var.c:1.53
--- src/bin/sh/var.c:1.52	Wed May 10 06:18:43 2017
+++ src/bin/sh/var.c	Sun May 14 11:23:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.52 2017/05/10 06:18:43 kre Exp $	*/
+/*	$NetBSD: var.c,v 1.53 2017/05/14 11:23:33 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: var.c,v 1.52 2017/05/10 06:18:43 kre Exp $");
+__RCSID("$NetBSD: var.c,v 1.53 2017/05/14 11:23:33 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -162,14 +162,45 @@ INIT {
 	}
 
 	/*
+	 * Set variables which override anything read from environment.
+	 *
 	 * PPID is readonly
-	 *	set after processing environ to override anything there
-	 * Always default IFS, ignore any value from environment.
+	 * Always default IFS
+	 * NETBSD_SHELL is a constant (readonly), and is never exported
 	 */
 	snprintf(buf, sizeof(buf), "%d", (int)getppid());
 	setvar("PPID", buf, VREADONLY);
 	setvar("IFS", ifs_default, VTEXTFIXED);
-	setvar("NETBSD_SHELL", NETBSD_SHELL, VTEXTFIXED|VREADONLY|VNOEXPORT);
+
+	setvar("NETBSD_SHELL", NETBSD_SHELL
+#ifdef BUILD_DATE
+		" BUILD:" BUILD_DATE
+#endif
+#ifdef DEBUG
+		" DEBUG"
+#endif
+#if !defined(JOBS) || JOBS == 0
+		" -JOBS"
+#endif
+#ifndef DO_SHAREDVFORK
+		" -VFORK"
+#endif
+#ifdef SMALL
+		" SMALL"
+#endif
+#ifdef TINY
+		" TINY"
+#endif
+#ifdef OLD_TTY_DRIVER
+		" OLD_TTY"
+#endif
+#ifdef SYSV
+		" SYSV"
+#endif
+#ifndef BSD
+		" -BSD"
+#endif
+		, VTEXTFIXED|VREADONLY|VNOEXPORT);
 }
 #endif
 



CVS commit: src/bin/sh

2017-05-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun May 14 11:17:05 UTC 2017

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

Log Message:
NFC: changes to comments only - expand/add comments relating to ${#...}
parsing, and all its peculiarities.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/bin/sh/parser.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/parser.c
diff -u src/bin/sh/parser.c:1.127 src/bin/sh/parser.c:1.128
--- src/bin/sh/parser.c:1.127	Thu May 11 15:07:37 2017
+++ src/bin/sh/parser.c	Sun May 14 11:17:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.127 2017/05/11 15:07:37 kre Exp $	*/
+/*	$NetBSD: parser.c,v 1.128 2017/05/14 11:17:04 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.127 2017/05/11 15:07:37 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.128 2017/05/14 11:17:04 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -1754,8 +1754,12 @@ parsesub: {
 	subtype = VSLENGTH;
 else if (is_special(c)) {
 	/*
+	 * ${#} is $# - the number of sh params
 	 * ${##} is the length of ${#}
+	 * ${###} is ${#} with as much nothing
+	 *as possible removed from start
 	 * ${##1} is ${#} with leading 1 gone
+	 * ${##\#} is ${#} with leading # gone
 	 *
 	 * this stuff is UGLY!
 	 */
@@ -1764,12 +1768,13 @@ parsesub: {
 		subtype = VSLENGTH;
 	} else {
 		static char cbuf[2];
-		pungetc();
-		cbuf[0] = c;
+
+		pungetc();   /* would like 2 */
+		cbuf[0] = c; /* so ... */
 		cbuf[1] = '\0';
 		pushstring(cbuf, 1, NULL);
-		c = '#';
-		subtype = 0;
+		c = '#'; /* ${#:...} */
+		subtype = 0; /* .. or similar */
 	}
 } else {
 	pungetc();



CVS commit: src/sys/dev

2017-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 14 10:57:32 UTC 2017

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

Log Message:
Increase the priority of the mixing/record threads as high as possibile.

Suggested by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.346 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.345 src/sys/dev/audio.c:1.346
--- src/sys/dev/audio.c:1.345	Sun May 14 10:08:49 2017
+++ src/sys/dev/audio.c	Sun May 14 10:57:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.345 2017/05/14 10:08:49 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.346 2017/05/14 10:57:32 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.345 2017/05/14 10:08:49 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.346 2017/05/14 10:57:32 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -872,9 +872,9 @@ bad_rec:
 #ifdef AUDIO_PM_IDLE
 	callout_schedule(>sc_idle_counter, audio_idle_timeout * hz);
 #endif
-	kthread_create(PRI_SOFTBIO, KTHREAD_MPSAFE | KTHREAD_MUSTJOIN, NULL,
+	kthread_create(PRI_SOFTSERIAL, KTHREAD_MPSAFE | KTHREAD_MUSTJOIN, NULL,
 	audio_rec_thread, sc, >sc_recthread, "audiorec");
-	kthread_create(PRI_SOFTBIO, KTHREAD_MPSAFE | KTHREAD_MUSTJOIN, NULL,
+	kthread_create(PRI_SOFTSERIAL, KTHREAD_MPSAFE | KTHREAD_MUSTJOIN, NULL,
 	audio_play_thread, sc, >sc_playthread, "audiomix");
 	audiorescan(self, "audio", NULL);
 }



CVS commit: src/bin/sh

2017-05-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun May 14 10:53:26 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Use more, or more appropriate, markup.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/bin/sh/sh.1

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/sh.1
diff -u src/bin/sh/sh.1:1.138 src/bin/sh/sh.1:1.139
--- src/bin/sh/sh.1:1.138	Fri May 12 08:55:38 2017
+++ src/bin/sh/sh.1	Sun May 14 10:53:26 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.138 2017/05/12 08:55:38 kre Exp $
+.\"	$NetBSD: sh.1,v 1.139 2017/05/14 10:53:26 wiz Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -170,9 +170,9 @@ restricting commands in the
 .Ev ENV
 file to interactive invocations.
 Place commands within the
-.Dq case
+.Dq Ic case
 and
-.Dq esac
+.Dq Ic esac
 below (these commands are described later):
 .Pp
 .Bl -item -compact -offset indent
@@ -449,10 +449,10 @@ shell and are recognized at the beginnin
 after a control operator.
 The following are reserved words:
 .Bl -column while while while while -offset indent
-.It ! Ta { Ta } Ta case
-.It do Ta done Ta elif Ta else
-.It esac Ta fi Ta for Ta if
-.It in Ta then Ta until Ta while
+.It Ic \&! Ta Ic \&{ Ta Ic \&} Ta Ic case
+.It Ic do Ta Ic done Ta Ic elif Ta Ic else
+.It Ic esac Ta Ic fi Ta Ic for Ta Ic if
+.It Ic in Ta Ic then Ta Ic until Ta Ic while
 .El
 .Pp
 Their meanings are discussed later.
@@ -540,33 +540,43 @@ If present it must occur immediately bef
 operator, with no intervening white space, and becomes a
 part of that operator.
 .Bl -tag -width aaabsfiles -offset indent
-.It [n] Ns \*[Gt] file
+.It Oo Ar n Oc Ns \*[Gt] Ar file
 Redirect standard output (or n) to
-.Cm file .
-.It [n] Ns \*[Gt]| file
+.Ar file .
+.It Oo Ar n Oc Ns \*[Gt]| file
 The same, but override the
 .Fl C
 option.
-.It [n] Ns \*[Gt]\*[Gt] file
+.It Oo Ar n Oc Ns \*[Gt]\*[Gt] Ar file
 Append standard output (or n) to
-.Cm file .
-.It [n] Ns \*[Lt] file
-Redirect standard input (or n) from
-.Cm file .
-.It [n1] Ns \*[Lt]\*[Am] Ns n2
-Duplicate standard input (or n1) from file descriptor n2.
-.Cm n2
+.Ar file .
+.It Oo Ar n Oc Ns \*[Lt] Ar file
+Redirect standard input (or
+.Ar n )
+from
+.Ar file .
+.It Oo Ar n1 Oc Ns \*[Lt]\*[Am] Ns Ar n2
+Duplicate standard input (or
+.Ar n1 )
+from file descriptor
+.Ar n2 .
+.Ar n2
 is expanded if not a digit string, the result must be a number.
-.It [n] Ns \*[Lt]\*[Am]-
-Close standard input (or n).
-.It [n1] Ns \*[Gt]\*[Am] Ns n2
-Duplicate standard output (or n1) to n2.
-.It [n] Ns \*[Gt]\*[Am]-
+.It Oo Ar n Oc Ns \*[Lt]\*[Am]-
+Close standard input (or
+.Ar n ) .
+.It Oo Ar n1 Oc Ns \*[Gt]\*[Am] Ns Ar n2
+Duplicate standard output (or
+.Ar n1 )
+to
+.Ar n2 .
+.It Oo Ar n Oc Ns \*[Gt]\*[Am]-
 Close standard output (or n).
-.It [n] Ns \*[Lt]\*[Gt] file
+.It Oo Ar n Oc Ns \*[Lt]\*[Gt] Ar file
 Open
-.Cm file
-for reading and writing on standard input (or n).
+.Ar file
+for reading and writing on standard input (or
+.Ar n ) .
 .El
 .Pp
 The following redirection is often called a
@@ -775,7 +785,7 @@ The exit status of an asynchronous AND-O
 The actual status of the commands,
 after they have completed,
 can be obtained using the
-.Cm wait
+.Ic wait
 built-in command described later.
 .Pp
 Note that unlike some other shells, each process in the pipeline is a
@@ -834,7 +844,9 @@ writes
 and nothing else.
 This is not the way it works in C.
 .Ss Flow-Control Constructs -- if, while, for, case
-The syntax of the if command is
+The syntax of the
+.Ic if
+command is
 .Bd -literal -offset indent
 if list
 then list
@@ -845,19 +857,21 @@ fi
 .Ed
 The first list is executed, and if the exit status of that list is zero,
 the list following the
-.Cm then
+.Ic then
 is executed.
 Otherwise the list after an
-.Cm elif
+.Ic elif
 (if any) is executed and the process repeats.
 When no more
-.Cm elif
+.Ic elif
 reserved words, and accompanying lists, appear,
 the list after the
-.Cm else
+.Ic else
 reserved word, if any, is executed.
 .Pp
-The syntax of the while command is
+The syntax of the
+.Ic while
+command is
 .Bd -literal -offset indent
 while list
 do   list
@@ -866,11 +880,17 @@ done
 .Pp
 The two lists are executed repeatedly while the exit status of the
 first list is zero.
-The until command is similar, but has the word
-until in place of while, which causes it to
-repeat until the exit status of the first list is zero.
+The
+.Ic until
+command is similar, but has the word
+.Ic until
+in place of
+.Ic while ,
+which causes it to repeat until the exit status of the first list is zero.
 .Pp
-The syntax of the for command is
+The syntax of the
+.Ic for
+command is
 .Bd -literal -offset indent
 for variable [ in word ... ]
 do   list
@@ -880,28 +900,50 @@ done
 The words are expanded, or "$@" if no words are given,
 and then the list is executed 

CVS commit: src/sys/dev

2017-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 14 10:08:49 UTC 2017

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

Log Message:
Restore the use of sc_intr_lock as it was in rev 1.334.
The ring buffer pages are now wired so the use of the interrupt lock won't
cause panics.

Ok riastradh@.


To generate a diff of this commit:
cvs rdiff -u -r1.344 -r1.345 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.344 src/sys/dev/audio.c:1.345
--- src/sys/dev/audio.c:1.344	Sun May 14 10:01:34 2017
+++ src/sys/dev/audio.c	Sun May 14 10:08:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.344 2017/05/14 10:01:34 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.345 2017/05/14 10:08:49 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.344 2017/05/14 10:01:34 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.345 2017/05/14 10:08:49 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -3858,22 +3858,20 @@ audio_mix(void *v)
 	cc = blksize - (inp - cb->s.start) % blksize;
 	if (sc->sc_writeme == false) {
 		DPRINTFN(3, ("MIX RING EMPTY - INSERT SILENCE\n"));
-		mutex_exit(sc->sc_intr_lock);
 		audio_fill_silence(>sc_mpr.s.param, inp, cc);
-		mutex_enter(sc->sc_intr_lock);
 		sc->sc_pr.drops += cc;
 	} else
 		cc = blksize;
 	cb->s.inp = audio_stream_add_inp(>s, cb->s.inp, cc);
 	cc = blksize;
 	cc1 = sc->sc_pr.s.end - sc->sc_pr.s.inp;
-	mutex_exit(sc->sc_intr_lock);
 	if (cc1 < cc) {
 		audio_fill_silence(>sc_mpr.s.param, sc->sc_pr.s.inp, cc1);
 		cc -= cc1;
 		audio_fill_silence(>sc_mpr.s.param, sc->sc_pr.s.start, cc);
 	} else
 		audio_fill_silence(>sc_mpr.s.param, sc->sc_pr.s.inp, cc);
+	mutex_exit(sc->sc_intr_lock);
 
 	kpreempt_disable();
 	if (sc->schedule_wih == true)
@@ -3957,12 +3955,14 @@ audio_upmix(void *v)
 		cc = blksize;
 		if (cb->s.inp + blksize > cb->s.end)
 			cc = cb->s.end - cb->s.inp;
+		mutex_enter(sc->sc_intr_lock);
 		memcpy(cb->s.inp, sc->sc_rr.s.start, cc);
 		if (cc < blksize && cc != 0) {
 			cc1 = cc;
 			cc = blksize - cc;
 			memcpy(cb->s.start, sc->sc_rr.s.start + cc1, cc);
 		}
+		mutex_exit(sc->sc_intr_lock);
 
 		cc = blksize;
 		recswvol_func(sc, cb, blksize, vc);



CVS commit: src/sys/dev

2017-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 14 10:01:34 UTC 2017

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

Log Message:
Use uvm_map_pageable to wire audio ringbuffer pages an virtual addresses.

Ok riastradh@.


To generate a diff of this commit:
cvs rdiff -u -r1.343 -r1.344 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.343 src/sys/dev/audio.c:1.344
--- src/sys/dev/audio.c:1.343	Fri May 12 07:12:37 2017
+++ src/sys/dev/audio.c	Sun May 14 10:01:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.343 2017/05/12 07:12:37 martin Exp $	*/
+/*	$NetBSD: audio.c,v 1.344 2017/05/14 10:01:34 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.343 2017/05/12 07:12:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.344 2017/05/14 10:01:34 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -188,6 +188,8 @@ __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.
 
 #include 
 
+#include 
+
 /* #define AUDIO_DEBUG	1 */
 #ifdef AUDIO_DEBUG
 #define DPRINTF(x)	if (audiodebug) printf x
@@ -1213,7 +1215,15 @@ audio_alloc_ring(struct audio_softc *sc,
 		error = uvm_map(kernel_map, , vsize, r->uobj, 0, 0,
 		UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW, UVM_INH_NONE,
 			UVM_ADV_RANDOM, 0));
+		if (error)
+			goto bad_map;
+
+		error = uvm_map_pageable(kernel_map, vstart, vstart + vsize,
+		false, 0);
+
 		if (error) {
+			uvm_unmap(kernel_map, vstart, vsize);
+bad_map:
 			uao_detach(r->uobj);	/* release reference */
 			r->uobj = NULL;		/* paranoia */
 			return error;
@@ -1248,13 +1258,10 @@ audio_free_ring(struct audio_softc *sc, 
 		vstart = (vaddr_t)r->s.start;
 		vsize = roundup2(MAX(r->s.bufsize, PAGE_SIZE), PAGE_SIZE);
 
-		/*
-		 * Unmap the kernel mapping.  uvm_unmap releases the
-		 * reference to the uvm object, and this should be the
-		 * last virtual mapping of the uvm object, so no need
-		 * to explicitly release (`detach') the object.
-		 */
+		uvm_map_pageable(kernel_map, vstart, vstart + vsize,
+		true, 0);
 		uvm_unmap(kernel_map, vstart, vsize);
+		uao_detach(r->uobj);	/* release reference */
 		r->uobj = NULL;		/* paranoia */
 	}
 



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

2017-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May 14 09:37:13 UTC 2017

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Set mci_{,i}cache_alias_mask for all variants that can have virtual cache
aliases

Set ncolors appropriately

These align to dcache and expect icache aliases to be dealt with by the
pmap directly.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.57 src/sys/arch/mips/mips/cache.c:1.58
--- src/sys/arch/mips/mips/cache.c:1.57	Sun May 14 09:33:17 2017
+++ src/sys/arch/mips/mips/cache.c	Sun May 14 09:37:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.57 2017/05/14 09:33:17 skrll Exp $	*/
+/*	$NetBSD: cache.c,v 1.58 2017/05/14 09:37:13 skrll Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.57 2017/05/14 09:33:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.58 2017/05/14 09:37:13 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -662,7 +662,7 @@ primary_cache_is_2way:
 		KASSERT(mci->mci_picache_ways != 0);
 		mci->mci_picache_way_size = mci->mci_picache_size / mci->mci_picache_ways;
 		mci->mci_picache_way_mask = mci->mci_picache_way_size - 1;
-#if (MIPS2 + MIPS3) > 0
+#if (MIPS2 + MIPS3 + MIPS4) > 0
 		if (mci->mci_icache_virtual_alias)
 			mci->mci_icache_alias_mask =
 			mci->mci_picache_way_mask & -PAGE_SIZE;
@@ -672,13 +672,21 @@ primary_cache_is_2way:
 		KASSERT(mci->mci_pdcache_ways != 0);
 		mci->mci_pdcache_way_size = mci->mci_pdcache_size / mci->mci_pdcache_ways;
 		mci->mci_pdcache_way_mask = mci->mci_pdcache_way_size - 1;
-#if (MIPS2 + MIPS3) > 0
+#if (MIPS2 + MIPS3 + MIPS4) > 0
 		if (mci->mci_cache_virtual_alias)
 			mci->mci_cache_alias_mask =
 			mci->mci_pdcache_way_mask & -PAGE_SIZE;
 #endif
 	}
 
+#if (MIPS2 + MIPS3 + MIPS4) > 0
+	if (mci->mci_cache_virtual_alias) {
+		mci->mci_cache_prefer_mask = mci->mci_pdcache_way_mask;
+
+		uvmexp.ncolors = (mci->mci_cache_prefer_mask >> PAGE_SHIFT) + 1;
+	}
+#endif
+
 	mips_dcache_compute_align();
 
 	if (mci->mci_sdcache_line_size == 0)
@@ -987,14 +995,6 @@ mips3_get_cache_config(int csizebase)
 	mci->mci_pdcache_line_size = MIPS3_CONFIG_CACHE_L1_LSIZE(config,
 	MIPS3_CONFIG_DB);
 
-	mci->mci_icache_alias_mask =
-	(mci->mci_picache_size / mci->mci_picache_ways - 1) & -PAGE_SIZE;
-	mci->mci_cache_alias_mask =
-	(mci->mci_pdcache_size / mci->mci_pdcache_ways - 1) & -PAGE_SIZE;
-	mci->mci_cache_prefer_mask =
-	max(mci->mci_pdcache_size, mci->mci_picache_size) - 1;
-	uvmexp.ncolors = (mci->mci_cache_alias_mask >> PAGE_SHIFT) + 1;
-
 	switch(MIPS_PRID_IMPL(cpu_id)) {
 #ifndef ENABLE_MIPS_R3NKK
 	case MIPS_R5000:



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

2017-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May 14 09:33:17 UTC 2017

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Really fix typo that got dcache alias mask set from icache way_mask


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.56 src/sys/arch/mips/mips/cache.c:1.57
--- src/sys/arch/mips/mips/cache.c:1.56	Sun May 14 09:32:01 2017
+++ src/sys/arch/mips/mips/cache.c	Sun May 14 09:33:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.56 2017/05/14 09:32:01 skrll Exp $	*/
+/*	$NetBSD: cache.c,v 1.57 2017/05/14 09:33:17 skrll Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.56 2017/05/14 09:32:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.57 2017/05/14 09:33:17 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -675,7 +675,7 @@ primary_cache_is_2way:
 #if (MIPS2 + MIPS3) > 0
 		if (mci->mci_cache_virtual_alias)
 			mci->mci_cache_alias_mask =
-			mci->mci_pcache_way_mask & -PAGE_SIZE;
+			mci->mci_pdcache_way_mask & -PAGE_SIZE;
 #endif
 	}
 



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

2017-05-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May 14 09:32:01 UTC 2017

Modified Files:
src/sys/arch/mips/mips: cache.c

Log Message:
Fix typo that got dcache alias mask set from icache way_mask


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/mips/mips/cache.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/mips/mips/cache.c
diff -u src/sys/arch/mips/mips/cache.c:1.55 src/sys/arch/mips/mips/cache.c:1.56
--- src/sys/arch/mips/mips/cache.c:1.55	Sat Apr 22 20:32:35 2017
+++ src/sys/arch/mips/mips/cache.c	Sun May 14 09:32:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.55 2017/04/22 20:32:35 skrll Exp $	*/
+/*	$NetBSD: cache.c,v 1.56 2017/05/14 09:32:01 skrll Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.55 2017/04/22 20:32:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.56 2017/05/14 09:32:01 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"
@@ -675,7 +675,7 @@ primary_cache_is_2way:
 #if (MIPS2 + MIPS3) > 0
 		if (mci->mci_cache_virtual_alias)
 			mci->mci_cache_alias_mask =
-			mci->mci_picache_way_mask & -PAGE_SIZE;
+			mci->mci_pcache_way_mask & -PAGE_SIZE;
 #endif
 	}