CVS commit: src/usr.bin/sys_info

2017-08-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Aug 24 01:43:42 UTC 2017

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

Log Message:
Get rid of the arg sorting - it doesn't work properly, and makes it
impossible to support component names containing embedded \n's (the
similar embedded space problem would have been trivial to fix.)
Deleting the sorting makes those issues moot, the args are no longer
processed, hence can be anything.

An alternative would be to sort the results - but that would separate
the -v output from the real output (-v stuff is not rationally sortable)
and also makes it much more difficult to get the error code for an
unknown component (like one containing an embedded \n !) as the pipe
to strt that would be used would cause the while loop to run in a sub-shell
(effectively.)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/sys_info/sys_info.1
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/sys_info/sys_info.sh

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/sys_info/sys_info.1
diff -u src/usr.bin/sys_info/sys_info.1:1.3 src/usr.bin/sys_info/sys_info.1:1.4
--- src/usr.bin/sys_info/sys_info.1:1.3	Wed Aug 23 01:17:46 2017
+++ src/usr.bin/sys_info/sys_info.1	Thu Aug 24 01:43:42 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: sys_info.1,v 1.3 2017/08/23 01:17:46 kre Exp $
+.\" $NetBSD: sys_info.1,v 1.4 2017/08/24 01:43:42 kre Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks <a...@netbsd.org>
 .\" All rights reserved.
@@ -79,9 +79,6 @@ If no arguments are provided, then all o
 items that are known to
 .Nm
 are reported.
-.Pp
-If arguments are provided, the output is displayed in
-alphabetical order, and duplicates are removed.
 .Sh EXIT STATUS
 .Nm
 exits with status 2 if an unknown option is given,
@@ -103,5 +100,3 @@ The
 .Nm
 script was written by
 .An Alistair Crooks Aq Mt a...@netbsd.org .
-.Sh BUGS
-Component names containing spaces given as arguments do not work.

Index: src/usr.bin/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.11 src/usr.bin/sys_info/sys_info.sh:1.12
--- src/usr.bin/sys_info/sys_info.sh:1.11	Wed Aug 23 21:18:57 2017
+++ src/usr.bin/sys_info/sys_info.sh	Thu Aug 24 01:43:42 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.11 2017/08/23 21:18:57 agc Exp $
+# $NetBSD: sys_info.sh,v 1.12 2017/08/24 01:43:42 kre Exp $
 
 # Copyright (c) 2016 Alistair Crooks <a...@netbsd.org>
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=20170823
+SYS_INFO_VERSION=20170824
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -102,8 +102,7 @@ run() {
 getversion() {
 	case "$1" in
 	'')
-		# arriving here implies all==true, not possible otherwise
-		;&
+		$all || return 0 ;&
 	awk)
 		run "awk --version | awk '{ print \$1 \"-\" \$3 }'"
 		$all || return 0 ;&
@@ -255,8 +254,6 @@ if [ $# -eq 0 ]; then
 	set -- ''
 	all=true
 else
-	# note this deletes any attempt to use '' as an arg.
-	set -- $( printf '%s\n' "$@" | sort -u )
 	all=false
 fi
 



CVS commit: src

2017-08-23 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Thu Aug 24 01:01:09 UTC 2017

Modified Files:
src/lib/libc/time: strptime.c
src/tests/lib/libc/time: t_strptime.c

Log Message:
The military/nautical time zones were added following RFC 822 and RFC
2822 specifications.  Unfortunately they are specified incorrectly in
RFC-822 and not very clearly in RFC 2822. RFC 1123 clearly states they
are specified incorrectly - counting the wrong way from UTC - in RFC
822.  RFC 2822 just states they were implemented in a non-standard way.
Mea culpa for not noticing when originally implemented.  Fix them so
the correct calculations are made.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/lib/libc/time/strptime.c
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libc/time/t_strptime.c

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

Modified files:

Index: src/lib/libc/time/strptime.c
diff -u src/lib/libc/time/strptime.c:1.61 src/lib/libc/time/strptime.c:1.62
--- src/lib/libc/time/strptime.c:1.61	Sat Aug 12 03:29:23 2017
+++ src/lib/libc/time/strptime.c	Thu Aug 24 01:01:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.61 2017/08/12 03:29:23 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.62 2017/08/24 01:01:09 ginsbach Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.61 2017/08/12 03:29:23 ginsbach Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.62 2017/08/24 01:01:09 ginsbach Exp $");
 #endif
 
 #include "namespace.h"
@@ -521,11 +521,11 @@ namedzone:
 	/* Argh! No 'J'! */
 	if (*bp >= 'A' && *bp <= 'I')
 		tm->TM_GMTOFF =
-		('A' - 1) - (int)*bp;
+		(int)*bp - ('A' - 1);
 	else if (*bp >= 'L' && *bp <= 'M')
-		tm->TM_GMTOFF = 'A' - (int)*bp;
+		tm->TM_GMTOFF = (int)*bp - 'A';
 	else if (*bp >= 'N' && *bp <= 'Y')
-		tm->TM_GMTOFF = (int)*bp - 'M';
+		tm->TM_GMTOFF = 'M' - (int)*bp;
 	tm->TM_GMTOFF *= SECSPERHOUR;
 #endif
 #ifdef TM_ZONE

Index: src/tests/lib/libc/time/t_strptime.c
diff -u src/tests/lib/libc/time/t_strptime.c:1.12 src/tests/lib/libc/time/t_strptime.c:1.13
--- src/tests/lib/libc/time/t_strptime.c:1.12	Sat Oct 31 02:25:11 2015
+++ src/tests/lib/libc/time/t_strptime.c	Thu Aug 24 01:01:09 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strptime.c,v 1.12 2015/10/31 02:25:11 christos Exp $ */
+/* $NetBSD: t_strptime.c,v 1.13 2017/08/24 01:01:09 ginsbach Exp $ */
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_strptime.c,v 1.12 2015/10/31 02:25:11 christos Exp $");
+__RCSID("$NetBSD: t_strptime.c,v 1.13 2017/08/24 01:01:09 ginsbach Exp $");
 
 #include 
 #include 
@@ -126,28 +126,28 @@ static struct {
 	{ "+1060",			-1 },
 	{ "-1060",			-1 },
 
-	{ "A",-3600 },
-	{ "B",-7200 },
-	{ "C",-10800 },
-	{ "D",-14400 },
-	{ "E",-18000 },
-	{ "F",-21600 },
-	{ "G",-25200 },
-	{ "H",-28800 },
-	{ "I",-32400 },
-	{ "L",-39600 },
-	{ "M",-43200 },
-	{ "N",3600 },
-	{ "O",7200 },
-	{ "P",10800 },
-	{ "Q",14400 },
-	{ "R",18000 },
-	{ "T",25200 },
-	{ "U",28800 },
-	{ "V",32400 },
-	{ "W",36000 },
-	{ "X",39600 },
-	{ "Y",43200 },
+	{ "A",3600 },
+	{ "B",7200 },
+	{ "C",10800 },
+	{ "D",14400 },
+	{ "E",18000 },
+	{ "F",21600 },
+	{ "G",25200 },
+	{ "H",28800 },
+	{ "I",32400 },
+	{ "L",39600 },
+	{ "M",43200 },
+	{ "N",-3600 },
+	{ "O",-7200 },
+	{ "P",-10800 },
+	{ "Q",-14400 },
+	{ "R",-18000 },
+	{ "T",-25200 },
+	{ "U",-28800 },
+	{ "V",-32400 },
+	{ "W",-36000 },
+	{ "X",-39600 },
+	{ "Y",-43200 },
 
 	{ "J",-2 },
 



CVS commit: src/share/man/man9

2017-08-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Aug 23 22:27:55 UTC 2017

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

Log Message:
Add locking(9) and psref(9) summaries to locking(9).

PR misc/52504

XXX Pull-up to -8 ?


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/locking.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/locking.9
diff -u src/share/man/man9/locking.9:1.5 src/share/man/man9/locking.9:1.6
--- src/share/man/man9/locking.9:1.5	Sun Apr 16 07:05:24 2017
+++ src/share/man/man9/locking.9	Wed Aug 23 22:27:55 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: locking.9,v 1.5 2017/04/16 07:05:24 wiz Exp $
+.\"	$NetBSD: locking.9,v 1.6 2017/08/23 22:27:55 pgoyette Exp $
 .\"
 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -212,6 +212,36 @@ The read operations may happen from soft
 .Pp
 See
 .Xr pserialize 9 .
+.Ss Passive reference mechanism
+Passive references allow CPUs to cheaply acquire and release passive
+references to a resource, which guarantee the resource will not be
+destroyed until the reference is released.  Acquiring and releasing
+passive references requires no interprocessor synchronization, except
+when the resource is pending destruction.
+.Pp
+See
+.Xr psref 9 .
+.Ss Localcount mechanism
+Localcounts are used in the kernel to implement a medium-weight reference
+counting mechanism.  During normal operations, localcounts do not need
+the interprocessor synchronization associated with
+.Xr atomic_ops 3
+atomic memory operations, and (unlike
+.Xr psref 9 )
+localcount references can be held across sleeps and can migrate between
+CPUs.  Draining a localcount requires more expensive interprocessor
+synchronization than
+.Xr atomic_ops 3
+(similar to
+.Xr psref 9 ) .
+And localcount references require eight bytes of memory per object per-CPU,
+significantly more than
+.Xr atomic_ops 3
+and almost always more than
+.Xr psref 9 .
+.Pp
+See
+.Xr localcount 9 .
 .Ss Simple do-it-in-thread-context framework
 The workqueue utility routines are provided to defer work which is needed to be
 processed in a thread context.
@@ -236,6 +266,8 @@ can be used to protect shared resources 
 .It Xr spl 9 Ta yes Ta no Ta no
 .It Xr splraiseipl 9 Ta yes Ta no Ta no
 .It Xr pserialize 9 Ta yes Ta yes Ta no
+.It Xr psref 9 Ta yes Ta yes Ta no
+.It Xr localcount 9 Ta yes Ta yes Ta no
 .It Xr workqueue 9 Ta yes Ta yes Ta yes
 .El
 .Sh SEE ALSO



CVS commit: src/usr.bin/sys_info

2017-08-23 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Aug 23 21:18:57 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Move back to a simple version string for sys_info.  The way of using
CVS's $ Date $ expansion to calculate the date, whilst being more
accurate, runs into issues with reproducible builds, and alternate
repository software. Simplicity wins here.

Add yacc to the list of utilities to report on


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/sys_info/sys_info.sh

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/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.10 src/usr.bin/sys_info/sys_info.sh:1.11
--- src/usr.bin/sys_info/sys_info.sh:1.10	Wed Aug 23 19:18:38 2017
+++ src/usr.bin/sys_info/sys_info.sh	Wed Aug 23 21:18:57 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.10 2017/08/23 19:18:38 kre Exp $
+# $NetBSD: sys_info.sh,v 1.11 2017/08/23 21:18:57 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks <a...@netbsd.org>
 # All rights reserved.
@@ -26,8 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 19:18:38 $"; set -f;
-			IFS=" /"; set -- $D; printf %s "$2$3$4" )
+SYS_INFO_VERSION=20170823
 
 PATH=$(sysctl -n user.cs_path)
 export PATH
@@ -225,6 +224,9 @@ getversion() {
 	xz)
 		run "xz --version | awk '{ print \$1 \"-\" \$4; exit }'"
 		$all || return 0 ;&
+	yacc)
+		run "yacc -V | sed -e 's| ||g'"
+		$all || return 0 ;&
 
 	'')			# never matches
 		;;		# but terminates ;& sequence



CVS commit: src/sys/dev/pci

2017-08-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 23 19:47:39 UTC 2017

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

Log Message:
Mac Mini WIP:
- plug the external TMDS into the right CRTC when in use
- use the right output types for Mini configs
now VGA works properly ( and not just by accident ) on my Mini 2. DVI is still
garbled but at least produces output.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/pci/radeonfb.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/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.90 src/sys/dev/pci/radeonfb.c:1.91
--- src/sys/dev/pci/radeonfb.c:1.90	Fri Aug 11 22:59:05 2017
+++ src/sys/dev/pci/radeonfb.c	Wed Aug 23 19:47:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.90 2017/08/11 22:59:05 macallan Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.91 2017/08/23 19:47:39 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.90 2017/08/11 22:59:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.91 2017/08/23 19:47:39 macallan Exp $");
 
 #include 
 #include 
@@ -416,7 +416,7 @@ static const struct {
 	{ RADEON_R200,	{{15000, 0xa1b}, {-1, 0xa3f}}},
 	{ RADEON_RV250,	{{15500, 0x81b}, {-1, 0x83f}}},
 	{ RADEON_RS300, {{0, 0}}},
-	{ RADEON_RV280,	{{13000, 0x400f4}, {15000, 0x400f7}}},
+	{ RADEON_RV280,	{{13000, 0x400f4}, {15000, 0x400f7}, {-1, 0x40111}}},
 	{ RADEON_R300,	{{-1, 0xb01cb}}},
 	{ RADEON_R350,	{{-1, 0xb01cb}}},
 	{ RADEON_RV350,	{{15000, 0xb0155}, {-1, 0xb01cb}}},
@@ -572,9 +572,6 @@ radeonfb_attach(device_t parent, device_
 	PRINTREG(RADEON_CRTC2_GEN_CNTL);
 	PRINTREG(RADEON_DISP_OUTPUT_CNTL);
 	PRINTREG(RADEON_DAC_CNTL2);
-	PRINTREG(RADEON_FP_GEN_CNTL);
-	PRINTREG(RADEON_FP2_GEN_CNTL);
-
 	PRINTREG(RADEON_BIOS_4_SCRATCH);
 	PRINTREG(RADEON_FP_GEN_CNTL);
 	sc->sc_fp_gen_cntl = GET32(sc, RADEON_FP_GEN_CNTL);
@@ -585,7 +582,7 @@ radeonfb_attach(device_t parent, device_
 	PRINTREG(RADEON_LVDS_GEN_CNTL);
 	PRINTREG(RADEON_FP_HORZ_STRETCH);
 	PRINTREG(RADEON_FP_VERT_STRETCH);
-
+	PRINTREG(RADEON_DISP_HW_DEBUG);
 	if (IS_RV100(sc))
 		PUT32(sc, RADEON_TMDS_PLL_CNTL, 0xa27);
 
@@ -707,11 +704,29 @@ radeonfb_attach(device_t parent, device_
   RADEON_FP_SEL_CRTC1,
 ~RADEON_FP_SEL_MASK);
 			}
+		case RADEON_TMDS_EXT:
+			/* point FP2 at the CRTC this port uses */
+			DPRINTF(("%s: plugging external TMDS into CRTC %d\n",
+			__func__, sc->sc_ports[i].rp_number));
+			if (IS_R300(sc)) {
+PATCH32(sc, RADEON_FP2_GEN_CNTL,
+sc->sc_ports[i].rp_number ?
+  R200_FP2_SOURCE_SEL_CRTC2 :
+  R200_FP2_SOURCE_SEL_CRTC1,
+~R200_FP2_SOURCE_SEL_CRTC2);
+			} else {
+PATCH32(sc, RADEON_FP2_GEN_CNTL,
+sc->sc_ports[i].rp_number ?
+  RADEON_FP2_SRC_SEL_CRTC2 :
+  RADEON_FP2_SRC_SEL_CRTC1,
+~RADEON_FP2_SRC_SEL_CRTC2);
+			}
 		}
 	}
 	PRINTREG(RADEON_DAC_CNTL2);
 	PRINTREG(RADEON_DISP_HW_DEBUG);
 
+	PRINTREG(RADEON_DAC_CNTL);
 	/* other DAC programming */
 	v = GET32(sc, RADEON_DAC_CNTL);
 	v &= (RADEON_DAC_RANGE_CNTL_MASK | RADEON_DAC_BLANKING);
@@ -1023,6 +1038,9 @@ radeonfb_attach(device_t parent, device_
 	PRINTREG(RADEON_DAC_CNTL2);
 	PRINTREG(RADEON_FP_GEN_CNTL);
 	PRINTREG(RADEON_FP2_GEN_CNTL);
+	PRINTREG(RADEON_TMDS_CNTL);
+	PRINTREG(RADEON_TMDS_TRANSMITTER_CNTL);
+	PRINTREG(RADEON_TMDS_PLL_CNTL);
 
 	return;
 
@@ -1739,6 +1757,13 @@ radeonfb_getconnectors(struct radeonfb_s
 			if (conn == RADEON_CONN_NONE)
 continue;	/* no connector */
 
+
+
+			/* 
+			 * XXX
+			 * both Mac Mini variants have both outputs wired to 
+			 * the same connector and share the DDC lines
+			 */ 
 			if ((found > 0) &&
 			(sc->sc_ports[port].rp_ddc_type == ddc)) {
 /* duplicate entry for same connector */
@@ -1780,18 +1805,24 @@ nobios:
 		"dvi-external", _ext);
 		if (dvi_ext) {
 			sc->sc_ports[0].rp_mon_type = RADEON_MT_UNKNOWN;
-			sc->sc_ports[0].rp_ddc_type = RADEON_DDC_DVI;
-			sc->sc_ports[0].rp_dac_type = RADEON_DAC_TVDAC;
+			sc->sc_ports[0].rp_ddc_type = RADEON_DDC_CRT2;
+			sc->sc_ports[0].rp_dac_type = RADEON_DAC_PRIMARY;
 			sc->sc_ports[0].rp_conn_type = RADEON_CONN_DVI_I;
-			sc->sc_ports[0].rp_tmds_type = RADEON_TMDS_EXT;
-			sc->sc_ports[0].rp_number = 1;
+			sc->sc_ports[0].rp_tmds_type = RADEON_TMDS_EXT;	/* output to fp2 */
+			sc->sc_ports[0].rp_number = 0;
+			sc->sc_ports[1].rp_mon_type = RADEON_MT_UNKNOWN;
+			sc->sc_ports[1].rp_ddc_type = RADEON_DDC_NONE;
+			sc->sc_ports[1].rp_dac_type = RADEON_DAC_UNKNOWN;
+			sc->sc_ports[1].rp_conn_type = RADEON_CONN_NONE;
+			sc->sc_ports[1].rp_tmds_type = RADEON_TMDS_UNKNOWN;
+			sc->sc_ports[1].rp_number = 1;
 		} else	if (dvi_int) {
 			sc->sc_ports[0].rp_mon_type = RADEON_MT_UNKNOWN;
-			sc->sc_ports[0].rp_ddc_type = RADEON_DDC_DVI;
-			sc->sc_ports[0].rp_dac_type = 

CVS commit: [netbsd-6] src/doc

2017-08-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug 23 19:38:32 UTC 2017

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
add to 1481


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.302 -r1.1.2.303 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.302 src/doc/CHANGES-6.2:1.1.2.303
--- src/doc/CHANGES-6.2:1.1.2.302	Mon Aug 21 23:31:29 2017
+++ src/doc/CHANGES-6.2	Wed Aug 23 19:38:31 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.302 2017/08/21 23:31:29 snj Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.303 2017/08/23 19:38:31 snj Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -18511,6 +18511,7 @@ sys/dev/vnd.c	1.260, 1.262
 sys/compat/ibcs2/ibcs2_exec_coff.c		1.27-1.29
 sys/compat/ibcs2/ibcs2_ioctl.c			1.46
 sys/compat/ibcs2/ibcs2_stat.c			1.49-1.50
+sys/lib/libkern/Makefile.libkern		1.19
 
 	Out of bound read and endless loop in exec_ibcs2_coff_prep_zmagic().
 	Infoleak in ibcs2_sys_ioctl.



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

2017-08-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug 23 19:37:48 UTC 2017

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
add to 1481


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.107 -r1.1.2.108 src/doc/CHANGES-6.1.6

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.107 src/doc/CHANGES-6.1.6:1.1.2.108
--- src/doc/CHANGES-6.1.6:1.1.2.107	Mon Aug 21 23:31:21 2017
+++ src/doc/CHANGES-6.1.6	Wed Aug 23 19:37:48 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.107 2017/08/21 23:31:21 snj Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.108 2017/08/23 19:37:48 snj Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -12463,6 +12463,7 @@ sys/dev/vnd.c	1.260, 1.262
 sys/compat/ibcs2/ibcs2_exec_coff.c		1.27-1.29
 sys/compat/ibcs2/ibcs2_ioctl.c			1.46
 sys/compat/ibcs2/ibcs2_stat.c			1.49-1.50
+sys/lib/libkern/Makefile.libkern		1.19
 
 	Out of bound read and endless loop in exec_ibcs2_coff_prep_zmagic().
 	Infoleak in ibcs2_sys_ioctl.



CVS commit: [netbsd-6] src/sys/lib/libkern

2017-08-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug 23 19:38:02 UTC 2017

Modified Files:
src/sys/lib/libkern [netbsd-6]: Makefile.libkern

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1481):
sys/lib/libkern/Makefile.libkern: revision 1.19
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/lib/libkern/Makefile.libkern

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/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.17 src/sys/lib/libkern/Makefile.libkern:1.17.2.1
--- src/sys/lib/libkern/Makefile.libkern:1.17	Sun Feb  5 14:19:03 2012
+++ src/sys/lib/libkern/Makefile.libkern	Wed Aug 23 19:38:02 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.17 2012/02/05 14:19:03 dholland Exp $
+#	$NetBSD: Makefile.libkern,v 1.17.2.1 2017/08/23 19:38:02 snj Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -84,7 +84,7 @@ SRCS+=	random.c
 SRCS+=	rngtest.c
 
 SRCS+=	memchr.c
-SRCS+=	strcat.c strcmp.c strcpy.c strlen.c
+SRCS+=	strcat.c strcmp.c strcpy.c strlen.c strnlen.c
 SRCS+=	strncmp.c strncpy.c
 SRCS+=	strcasecmp.c strncasecmp.c
 



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

2017-08-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug 23 19:37:05 UTC 2017

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
add to 1481


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.110 -r1.1.2.111 src/doc/CHANGES-6.0.7

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.110 src/doc/CHANGES-6.0.7:1.1.2.111
--- src/doc/CHANGES-6.0.7:1.1.2.110	Mon Aug 21 23:31:09 2017
+++ src/doc/CHANGES-6.0.7	Wed Aug 23 19:37:05 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.110 2017/08/21 23:31:09 snj Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.111 2017/08/23 19:37:05 snj Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -12790,6 +12790,7 @@ sys/dev/vnd.c	1.260, 1.262
 sys/compat/ibcs2/ibcs2_exec_coff.c		1.27-1.29
 sys/compat/ibcs2/ibcs2_ioctl.c			1.46
 sys/compat/ibcs2/ibcs2_stat.c			1.49-1.50
+sys/lib/libkern/Makefile.libkern		1.19
 
 	Out of bound read and endless loop in exec_ibcs2_coff_prep_zmagic().
 	Infoleak in ibcs2_sys_ioctl.



CVS commit: [netbsd-6-1] src/sys/lib/libkern

2017-08-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug 23 19:37:20 UTC 2017

Modified Files:
src/sys/lib/libkern [netbsd-6-1]: Makefile.libkern

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1481):
sys/lib/libkern/Makefile.libkern: revision 1.19
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.8.1 src/sys/lib/libkern/Makefile.libkern

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/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.17 src/sys/lib/libkern/Makefile.libkern:1.17.8.1
--- src/sys/lib/libkern/Makefile.libkern:1.17	Sun Feb  5 14:19:03 2012
+++ src/sys/lib/libkern/Makefile.libkern	Wed Aug 23 19:37:20 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.17 2012/02/05 14:19:03 dholland Exp $
+#	$NetBSD: Makefile.libkern,v 1.17.8.1 2017/08/23 19:37:20 snj Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -84,7 +84,7 @@ SRCS+=	random.c
 SRCS+=	rngtest.c
 
 SRCS+=	memchr.c
-SRCS+=	strcat.c strcmp.c strcpy.c strlen.c
+SRCS+=	strcat.c strcmp.c strcpy.c strlen.c strnlen.c
 SRCS+=	strncmp.c strncpy.c
 SRCS+=	strcasecmp.c strncasecmp.c
 



CVS commit: [netbsd-6-0] src/sys/lib/libkern

2017-08-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug 23 19:36:28 UTC 2017

Modified Files:
src/sys/lib/libkern [netbsd-6-0]: Makefile.libkern

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1481):
sys/lib/libkern/Makefile.libkern: revision 1.19
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.6.1 src/sys/lib/libkern/Makefile.libkern

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/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.17 src/sys/lib/libkern/Makefile.libkern:1.17.6.1
--- src/sys/lib/libkern/Makefile.libkern:1.17	Sun Feb  5 14:19:03 2012
+++ src/sys/lib/libkern/Makefile.libkern	Wed Aug 23 19:36:28 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.17 2012/02/05 14:19:03 dholland Exp $
+#	$NetBSD: Makefile.libkern,v 1.17.6.1 2017/08/23 19:36:28 snj Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -84,7 +84,7 @@ SRCS+=	random.c
 SRCS+=	rngtest.c
 
 SRCS+=	memchr.c
-SRCS+=	strcat.c strcmp.c strcpy.c strlen.c
+SRCS+=	strcat.c strcmp.c strcpy.c strlen.c strnlen.c
 SRCS+=	strncmp.c strncpy.c
 SRCS+=	strcasecmp.c strncasecmp.c
 



CVS commit: src/sys/dev/pci

2017-08-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 23 19:21:14 UTC 2017

Modified Files:
src/sys/dev/pci: radeonfbreg.h

Log Message:
consistency...


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/radeonfbreg.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/radeonfbreg.h
diff -u src/sys/dev/pci/radeonfbreg.h:1.5 src/sys/dev/pci/radeonfbreg.h:1.6
--- src/sys/dev/pci/radeonfbreg.h:1.5	Sun Dec 30 09:45:05 2012
+++ src/sys/dev/pci/radeonfbreg.h	Wed Aug 23 19:21:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfbreg.h,v 1.5 2012/12/30 09:45:05 macallan Exp $	*/
+/*	$NetBSD: radeonfbreg.h,v 1.6 2017/08/23 19:21:14 macallan Exp $	*/
 
 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.31 2003/11/10 18:41:23 tsi Exp $ */
 /*
@@ -704,6 +704,7 @@
 #   define R200_FP2_SOURCE_SEL_CRTC2   (1 << 10)
 #   define R200_FP2_SOURCE_SEL_RMX (2 << 10)
 #   define RADEON_FP2_SRC_SEL_MASK (3 << 13)
+#   define RADEON_FP2_SRC_SEL_CRTC1(0 << 13)
 #   define RADEON_FP2_SRC_SEL_CRTC2(1 << 13)
 #   define RADEON_FP2_FP_POL   (1 << 16)
 #   define RADEON_FP2_LP_POL   (1 << 17)



CVS commit: src/usr.bin/sys_info

2017-08-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Aug 23 19:18:38 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
Add a \ -- allows sys_info -v pkg_install to tell us who the version info
is obtained, rather than just how we go about printing the result.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/sys_info/sys_info.sh

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/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.9 src/usr.bin/sys_info/sys_info.sh:1.10
--- src/usr.bin/sys_info/sys_info.sh:1.9	Wed Aug 23 18:15:53 2017
+++ src/usr.bin/sys_info/sys_info.sh	Wed Aug 23 19:18:38 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.9 2017/08/23 18:15:53 agc Exp $
+# $NetBSD: sys_info.sh,v 1.10 2017/08/23 19:18:38 kre Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 18:15:53 $"; set -f;
+SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 19:18:38 $"; set -f;
 			IFS=" /"; set -- $D; printf %s "$2$3$4" )
 
 PATH=$(sysctl -n user.cs_path)
@@ -188,7 +188,7 @@ getversion() {
 		$all || return 0 ;&
 	pkg_info|pkg_install)
 		if which_prog infopath pkg_info; then
-			run "printf 'pkg_install-%s\n' $(${infopath} -V)"
+			run "printf 'pkg_install-%s\n' \$(${infopath} -V)"
 		fi
 		$all || return 0 ;&
 	sh)



CVS commit: src/usr.bin/sys_info

2017-08-23 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Aug 23 18:15:53 UTC 2017

Modified Files:
src/usr.bin/sys_info: sys_info.sh

Log Message:
add pkg_install to the list of programs reported

don't throw a warning if tcsh is not found in the path


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/sys_info/sys_info.sh

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/sys_info/sys_info.sh
diff -u src/usr.bin/sys_info/sys_info.sh:1.8 src/usr.bin/sys_info/sys_info.sh:1.9
--- src/usr.bin/sys_info/sys_info.sh:1.8	Wed Aug 23 01:17:46 2017
+++ src/usr.bin/sys_info/sys_info.sh	Wed Aug 23 18:15:53 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: sys_info.sh,v 1.8 2017/08/23 01:17:46 kre Exp $
+# $NetBSD: sys_info.sh,v 1.9 2017/08/23 18:15:53 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks 
 # All rights reserved.
@@ -26,7 +26,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 01:17:46 $"; set -f;
+SYS_INFO_VERSION=$( D="\$Date: 2017/08/23 18:15:53 $"; set -f;
 			IFS=" /"; set -- $D; printf %s "$2$3$4" )
 
 PATH=$(sysctl -n user.cs_path)
@@ -186,6 +186,11 @@ getversion() {
 	openssl)
 		run "openssl version 2>/dev/null | awk '{ print tolower(\$1) \"-\" \$2 }'"
 		$all || return 0 ;&
+	pkg_info|pkg_install)
+		if which_prog infopath pkg_info; then
+			run "printf 'pkg_install-%s\n' $(${infopath} -V)"
+		fi
+		$all || return 0 ;&
 	sh)
 		run "set -- \$NETBSD_SHELL; case \"\$1+\$2\" in *+BUILD*) ;; +) set -- ancient;; *) set -- \"\$1\";;esac; printf 'sh-%s\\n' \$1\${2:+-\${2#BUILD:}}"
 		$all || return 0 ;&
@@ -198,8 +203,6 @@ getversion() {
 	tcsh)
 		if which_prog tcshpath tcsh; then
 			run "${tcshpath} --version | awk '{ print \$1 \"-\" \$2 }'"
-		else
-			$all || printf >&2 '%s\n' "tcsh: not found"
 		fi
 		$all || return 0 ;&
 	tzdata)



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

2017-08-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 23 14:14:59 UTC 2017

Modified Files:
src/sys/arch/arm/omap: am335x_prcm.c

Log Message:
Always perform code previously code under #ifdef DIAGNOSTIC - it appears
that the read is needed to help make the chip work.  Someone with time and
a datasheet can hopefully work out why.

Fixes John D. Baker's boot problem reported on port-arm here:

http://mail-index.netbsd.org/port-arm/2017/07/27/msg004323.html


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/omap/am335x_prcm.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/omap/am335x_prcm.c
diff -u src/sys/arch/arm/omap/am335x_prcm.c:1.9 src/sys/arch/arm/omap/am335x_prcm.c:1.10
--- src/sys/arch/arm/omap/am335x_prcm.c:1.9	Tue Oct 18 15:10:35 2016
+++ src/sys/arch/arm/omap/am335x_prcm.c	Wed Aug 23 14:14:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: am335x_prcm.c,v 1.9 2016/10/18 15:10:35 kiyohara Exp $	*/
+/*	$NetBSD: am335x_prcm.c,v 1.10 2017/08/23 14:14:59 skrll Exp $	*/
 
 /*
  * TI OMAP Power, Reset, and Clock Management on the AM335x
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.9 2016/10/18 15:10:35 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am335x_prcm.c,v 1.10 2017/08/23 14:14:59 skrll Exp $");
 
 #include "tps65217pmic.h"
 
@@ -61,18 +61,12 @@ static void
 am335x_prcm_check_clkctrl(bus_size_t cm_module,
 bus_size_t clkctrl_reg, uint32_t v)
 {
-#ifdef DIAGNOSTIC
 	uint32_t u = prcm_read_4(cm_module, clkctrl_reg);
 
 	if (__SHIFTOUT(u, AM335X_CLKCTRL_MODULEMODE_MASK) !=
 	__SHIFTOUT(v, AM335X_CLKCTRL_MODULEMODE_MASK))
 		aprint_error("clkctrl didn't take: %"PRIx32" -/-> %"PRIx32"\n",
 		u, v);
-#else
-	(void)cm_module;
-	(void)clkctrl_reg;
-	(void)v;
-#endif
 }
 
 void



CVS commit: src/usr.bin/gzip

2017-08-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 23 13:04:17 UTC 2017

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

Log Message:
now that we are processing SIGINFO write can be interrupted and return
partial results (well, it could before too but it was harder to trigger);
provide write_fully like we have read_fully already.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/usr.bin/gzip/gzip.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/gzip/gzip.c
diff -u src/usr.bin/gzip/gzip.c:1.111 src/usr.bin/gzip/gzip.c:1.112
--- src/usr.bin/gzip/gzip.c:1.111	Fri Aug  4 03:27:08 2017
+++ src/usr.bin/gzip/gzip.c	Wed Aug 23 09:04:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gzip.c,v 1.111 2017/08/04 07:27:08 mrg Exp $	*/
+/*	$NetBSD: gzip.c,v 1.112 2017/08/23 13:04:17 christos Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\
  2009, 2010, 2011, 2015, 2017 Matthew R. Green.  All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.111 2017/08/04 07:27:08 mrg Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.112 2017/08/23 13:04:17 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -212,6 +212,7 @@ __dead static	void	usage(void);
 __dead static	void	display_version(void);
 static	const suffixes_t *check_suffix(char *, int);
 static	ssize_t	read_retry(int, void *, size_t);
+static	ssize_t	write_retry(int, const void *, size_t);
 
 #ifdef SMALL
 #define infile_set(f,t) infile_set(f)
@@ -605,7 +606,7 @@ gz_compress(int in, int out, off_t *gsiz
 	crc = crc32(0L, Z_NULL, 0);
 	for (;;) {
 		if (z.avail_out == 0) {
-			if (write(out, outbufp, BUFLEN) != BUFLEN) {
+			if (write_retry(out, outbufp, BUFLEN) != BUFLEN) {
 maybe_warn("write");
 out_tot = -1;
 goto out;
@@ -655,7 +656,7 @@ gz_compress(int in, int out, off_t *gsiz
 
 		len = (char *)z.next_out - outbufp;
 
-		w = write(out, outbufp, len);
+		w = write_retry(out, outbufp, len);
 		if (w == -1 || (size_t)w != len) {
 			maybe_warn("write");
 			out_tot = -1;
@@ -690,7 +691,7 @@ gz_compress(int in, int out, off_t *gsiz
 	if (in_tot > 0x)
 		maybe_warn("input file size >= 4GB cannot be saved");
 #endif
-	if (write(out, outbufp, i) != i) {
+	if (write_retry(out, outbufp, i) != i) {
 		maybe_warn("write");
 		in_tot = -1;
 	} else
@@ -957,7 +958,7 @@ gz_uncompress(int in, int out, char *pre
 /* don't write anything with -t */
 tflag == 0 &&
 #endif
-write(out, outbufp, wr) != wr) {
+write_retry(out, outbufp, wr) != wr) {
 	maybe_warn("error writing to output");
 	goto stop_and_fail;
 }
@@ -1699,7 +1700,7 @@ cat_fd(unsigned char * prepend, size_t c
 	ssize_t w;
 
 	in_tot = count;
-	w = write(STDOUT_FILENO, prepend, count);
+	w = write_retry(STDOUT_FILENO, prepend, count);
 	if (w == -1 || (size_t)w != count) {
 		maybe_warn("write to stdout");
 		return -1;
@@ -1716,7 +1717,7 @@ cat_fd(unsigned char * prepend, size_t c
 		}
 		infile_newdata(rv);
 
-		if (write(STDOUT_FILENO, buf, rv) != rv) {
+		if (write_retry(STDOUT_FILENO, buf, rv) != rv) {
 			maybe_warn("write to stdout");
 			break;
 		}
@@ -2226,3 +2227,25 @@ read_retry(int fd, void *buf, size_t sz)
 
 	return sz - left;
 }
+
+static ssize_t
+write_retry(int fd, const void *buf, size_t sz)
+{
+	const char *cp = buf;
+	size_t left = MIN(sz, (size_t) SSIZE_MAX);
+
+	while (left > 0) {
+		ssize_t ret;
+
+		ret = write(fd, cp, left);
+		if (ret == -1) {
+			return ret;
+		} else if (ret == 0) {
+			abort();	/* Can't happen */
+		}
+		cp += ret;
+		left -= ret;
+	}
+
+	return sz - left;
+}



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

2017-08-23 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Aug 23 13:02:14 UTC 2017

Modified Files:
src/sys/arch/aarch64/aarch64: vectors.S

Log Message:
- don't use ENTRY() for exception entries.
- correct section definition.
- designate long pointer ldr.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/vectors.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/vectors.S
diff -u src/sys/arch/aarch64/aarch64/vectors.S:1.3 src/sys/arch/aarch64/aarch64/vectors.S:1.4
--- src/sys/arch/aarch64/aarch64/vectors.S:1.3	Tue Aug 22 18:35:09 2017
+++ src/sys/arch/aarch64/aarch64/vectors.S	Wed Aug 23 13:02:14 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: vectors.S,v 1.3 2017/08/22 18:35:09 nisimura Exp $ */
+/* $NetBSD: vectors.S,v 1.4 2017/08/23 13:02:14 nisimura Exp $ */
 
 #include 
 #include "assym.h"
@@ -18,6 +18,9 @@ lr	.req	x30	/* link register */
 	.macro	VECT_INVAL, el, cause, regsize = 64
 	.align	7
 	/* small enough to fit 32 instrunction slot */
+	.if \el == 1
+	sub	sp, sp, #TF_SIZE
+	.endif
 	stp	x0, x1, [sp, #TF_X0]
 	stp	x2, x3, [sp, #TF_X2]
 	stp	x4, x5, [sp, #TF_X4]
@@ -37,7 +40,7 @@ lr	.req	x30	/* link register */
 	.if \el == 0
 	mrs	x20, sp_el0
 	.else
-	mrs	x20, sp_el1
+	mov	x20, sp
 	.endif
 	mrs	x21, elr_el1
 	mrs	x22, spsr_el1
@@ -48,10 +51,11 @@ lr	.req	x30	/* link register */
 	mrs	x24, far_el1
 	str	x23, [sp, #TF_ESR]
 	str	x24, [sp, #TF_FAR]
-	adr	lr, exception_trap_exit
+	ldr	lr, =exception_trap_exit
 	mov	x0, sp
 	mov	x1, #\cause
 	b	trap
+	/* !!! beware about remaining slot !!! */
 	.endm
 
 	.macro	exception_entry, el, regsize = 64
@@ -79,7 +83,7 @@ lr	.req	x30	/* link register */
 	mov	x29, xzr		/* fp pointed to user-space */
 	mrs	x20, sp_el0
 	.else
-	mrs	x20, sp_el1
+	mov	x20, sp
 	.endif
 	mrs	x21, elr_el1
 	mrs	x22, spsr_el1
@@ -92,11 +96,12 @@ lr	.req	x30	/* link register */
 	str	x24, [sp, #TF_FAR]
 	.endm
 
-	.pushsection ".entry.text", "ax"
+	.pushsection ".vectors", "ax"
+	.global _C_LABEL(el1_vectors)
 	.p2align 11
-ENTRY(el1_vectors)
+_C_LABEL(el1_vectors):
 /*
- * A64 exception taken from current Exception Level with SP_EL1.
+ * Exception taken from current Exception Level with SP_EL1.
  * (These shouldn't happen)
  */
 	VECT_INVAL	1, BAD_SYNC		/* Synchronous EL1t */
@@ -104,71 +109,73 @@ ENTRY(el1_vectors)
 	VECT_INVAL	1, BAD_FIQ		/* FIQ EL1t */
 	VECT_INVAL	1, BAD_ERROR		/* Error EL1t */
 /*
- * A64 exception taken from current Exception Level with SP.
- * EL1 (kernel exceptions)
+ * Exception taken from current Exception Level with SP.
+ * There are entries for exceptions caused in EL1 (kernel exceptions).
  */
 	VECT_ENTRY	el1_sync		/* Synchronous EL1h */
 	VECT_ENTRY	el1_irq			/* IRQ EL1h */
 	VECT_INVAL	1, BAD_FIQ		/* FIQ EL1h */
 	VECT_INVAL	1, BAD_ERROR		/* Error EL1h */
 /*
- * A64 exception taken from lower Exception Level.
- * EL0 (native user exceptions)
+ * Exception taken from lower Exception Level which is using AArch64
+ * There are entries for exceptions caused in EL0 (native user exceptions).
  */
 	VECT_ENTRY	el0_sync		/* Synchronous 64bit EL0 */
 	VECT_ENTRY	el0_irq			/* IRQ 64bit EL0 */
 	VECT_INVAL	0, BAD_FIQ		/* FIQ 64bit EL0 */
 	VECT_INVAL	0, BAD_ERROR		/* Error 64bit EL0 */
 /*
- * A32 exception taken from lower Exception Level.
- * EL0 (compat user exceptions)
+ * Exception taken from lower Exception Level which is using AArch32
+ * There are entries for exceptions caused in EL0 (compat user exceptions).
  */
 	VECT_ENTRY	el0_32sync		/* Synchronous 32bit EL0 */
 	VECT_ENTRY	el0_32irq		/* IRQ 32bit EL0 */
 	VECT_INVAL	0, BAD_FIQ, 32		/* FIQ 32bit EL0 */
 	VECT_INVAL	0, BAD_ERROR, 32	/* Error 32bit EL0 */
 
-ENTRY(el1_sync)
+_C_LABEL(el1_sync):
+	sub	sp, sp, #TF_SIZE
 	exception_entry 1
-	adr	lr, exception_trap_exit
+	ldr	lr, =exception_trap_exit
 	mov	x0, sp
 	mov	x1, xzr
 	b	trap
 END(el1_sync)
 
-ENTRY(el1_irq)
+_C_LABEL(el1_irq):
+	sub	sp, sp, #TF_SIZE
 	exception_entry 1
-	adr	lr, exception_trap_exit
+	ldr	lr, =exception_trap_exit
 	mov	x0, sp
 	b	interrupt
 END(el1_irq)
 
-ENTRY(el0_sync)
+_C_LABEL(el0_sync):
 	exception_entry 0
-	adr	lr, exception_trap_exit
+	ldr	lr, =exception_trap_exit
 	mov	x0, sp
 	mov	x1, xzr
 	b	trap
 END(el0_sync)
 
-ENTRY(el0_irq)
+_C_LABEL(el0_irq):
 	exception_entry 0
-	adr	lr, exception_trap_exit
+	ldr	lr, =exception_trap_exit
 	mov	x0, sp
 	b	interrupt
 END(el0_irq)
 
-ENTRY(el0_32sync)
+_C_LABEL(el0_32sync):
 	exception_entry 0, 32
-	adr	lr, exception_trap_exit
+	ldr	lr, =exception_trap_exit
 	mov	x0, sp
 	mov	x1, xzr
 	b	trap
 END(el0_32sync)
 
-ENTRY(el0_32irq)
+_C_LABEL(el0_32irq):
 	exception_entry 0, 32
-	adr	lr, exception_trap_exit
+	ldr	lr, =exception_trap_exit
 	mov	x0, sp
 	b	interrupt
 END(el0_32irq)



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

2017-08-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 23 10:29:51 UTC 2017

Modified Files:
src/tests/lib/libc/string: t_stresep.c

Log Message:
Add test from PR/52499


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/string/t_stresep.c

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

Modified files:

Index: src/tests/lib/libc/string/t_stresep.c
diff -u src/tests/lib/libc/string/t_stresep.c:1.3 src/tests/lib/libc/string/t_stresep.c:1.4
--- src/tests/lib/libc/string/t_stresep.c:1.3	Fri Feb 15 18:56:32 2013
+++ src/tests/lib/libc/string/t_stresep.c	Wed Aug 23 06:29:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_stresep.c,v 1.3 2013/02/15 23:56:32 christos Exp $ */
+/*	$NetBSD: t_stresep.c,v 1.4 2017/08/23 10:29:51 christos Exp $ */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -61,6 +61,12 @@ ATF_TC_BODY(stresep_basic, tc)
 	expect("bar  foo");
 	expect("   baz");
 	expect("bar  ");
+
+	char brkstr2[] = "aa bb cc\\ \\ \\ \\ dd-";
+	q = brkstr2;
+	expect("aa");
+	expect("bb");
+	expect("ccdd-");
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/lib/libc/string

2017-08-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 23 10:27:41 UTC 2017

Modified Files:
src/lib/libc/string: stresep.c

Log Message:
PR/52499: Justin: stresep uses memmove with of-by-one length


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/string/stresep.c

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

Modified files:

Index: src/lib/libc/string/stresep.c
diff -u src/lib/libc/string/stresep.c:1.3 src/lib/libc/string/stresep.c:1.4
--- src/lib/libc/string/stresep.c:1.3	Sun Feb 12 12:19:00 2017
+++ src/lib/libc/string/stresep.c	Wed Aug 23 06:27:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $	*/
+/*	$NetBSD: stresep.c,v 1.4 2017/08/23 10:27:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strsep.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $");
+__RCSID("$NetBSD: stresep.c,v 1.4 2017/08/23 10:27:41 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -66,6 +66,7 @@ stresep(char **stringp, const char *deli
 	char *s;
 	const char *spanp;
 	int c, sc;
+	size_t l;
 	char *tok;
 
 	_DIAGASSERT(stringp != NULL);
@@ -73,22 +74,25 @@ stresep(char **stringp, const char *deli
 
 	if ((s = *stringp) == NULL)
 		return NULL;
+	l = strlen(s) + 1;
 	for (tok = s;;) {
 		c = *s++;
+		l--;
 		while (esc != '\0' && c == esc) {
-			memmove(s - 1, s, strlen(s));
+			memmove(s - 1, s, l);
 			c = *s++;
+			l--;
 		}
 		spanp = delim;
 		do {
 			if ((sc = *spanp++) == c) {
-if (c == 0)
+if (c == '\0')
 	s = NULL;
 else
-	s[-1] = 0;
+	s[-1] = '\0';
 *stringp = s;
 return tok;
 			}
-		} while (sc != 0);
+		} while (sc != '\0');
 	}
 }



CVS commit: src/libexec/ld.elf_so/arch/aarch64

2017-08-23 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Aug 23 09:17:48 UTC 2017

Modified Files:
src/libexec/ld.elf_so/arch/aarch64: mdreloc.c

Log Message:
- avoid caddr_t. use Elf_Addr instead.
- iron out rdbg() errors.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/libexec/ld.elf_so/arch/aarch64/mdreloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/aarch64/mdreloc.c
diff -u src/libexec/ld.elf_so/arch/aarch64/mdreloc.c:1.4 src/libexec/ld.elf_so/arch/aarch64/mdreloc.c:1.5
--- src/libexec/ld.elf_so/arch/aarch64/mdreloc.c:1.4	Thu Aug 10 19:03:25 2017
+++ src/libexec/ld.elf_so/arch/aarch64/mdreloc.c	Wed Aug 23 09:17:48 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mdreloc.c,v 1.4 2017/08/10 19:03:25 joerg Exp $ */
+/* $NetBSD: mdreloc.c,v 1.5 2017/08/23 09:17:48 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.4 2017/08/10 19:03:25 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.5 2017/08/23 09:17:48 nisimura Exp $");
 #endif /* not lint */
 
 #include 
@@ -42,7 +42,7 @@ __RCSID("$NetBSD: mdreloc.c,v 1.4 2017/0
 
 void _rtld_bind_start(void);
 void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr);
-caddr_t _rtld_bind(const Obj_Entry *, Elf_Word);
+Elf_Addr _rtld_bind(const Obj_Entry *, Elf_Word);
 
 void
 _rtld_setup_pltgot(const Obj_Entry *obj)
@@ -84,11 +84,10 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 
 	for (const Elf_Rela *rela = obj->rela; rela < obj->relalim; rela++) {
 		Elf_Addr*where;
-		unsigned long	 symnum;
-		Elf_Addr	 addend;
+		Elf_Addr	tmp;
+		unsigned long	symnum;
 
 		where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
-		addend = rela->r_addend;
 
 		switch (ELF_R_TYPE(rela->r_info)) {
 		case R_TYPE(ABS64):	/* word B + S + A */
@@ -115,17 +114,19 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 
 		case R_TYPE(ABS64):	/* word B + S + A */
 		case R_TYPE(GLOB_DAT):	/* word B + S */
-			*where = addend + (Elf_Addr)defobj->relocbase +
-			def->st_value;
+			tmp = (Elf_Addr)defobj->relocbase + def->st_value +
+			rela->r_addend;
+			if (*where != tmp)
+*where = tmp;
 			rdbg(("ABS64/GLOB_DAT %s in %s --> %p @ %p in %s",
 			obj->strtab + obj->symtab[symnum].st_name,
 			obj->path, (void *)tmp, where, defobj->path));
 			break;
 
 		case R_TYPE(RELATIVE):	/* word B + A */
-			*where = addend + (Elf_Addr)obj->relocbase;
+			*where = (Elf_Addr)(obj->relocbase + rela->r_addend);
 			rdbg(("RELATIVE in %s --> %p", obj->path,
-			(void *)tmp));
+			(void *)*where));
 			break;
 
 		case R_TYPE(COPY):
@@ -145,11 +146,11 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			break;
 
 		case R_TLS_TYPE(TLS_DTPREL):
-			*where = addend + (Elf_Addr)(def->st_value);
+			*where = (Elf_Addr)(def->st_value + rela->r_addend);
 
-			rdbg(("TLS_DTPOFF32 %s in %s --> %p",
+			rdbg(("TLS_DTPREL %s in %s --> %p",
 			obj->strtab + obj->symtab[symnum].st_name,
-			obj->path, (void *)tmp));
+			obj->path, (void *)*where));
 
 			break;
 		case R_TLS_TYPE(TLS_DTPMOD):
@@ -157,7 +158,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 
 			rdbg(("TLS_DTPMOD %s in %s --> %p",
 			obj->strtab + obj->symtab[symnum].st_name,
-			obj->path, (void *)tmp));
+			obj->path, (void *)*where));
 
 			break;
 
@@ -168,17 +169,18 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 
 			*where = (Elf_Addr)def->st_value + defobj->tlsoffset +
 			sizeof(struct tls_tcb);
-			rdbg(("TLS_TPOFF32 %s in %s --> %p",
+			rdbg(("TLS_TPREL %s in %s --> %p in %s",
 			obj->strtab + obj->symtab[symnum].st_name,
-			obj->path, (void *)tmp));
+			obj->path, (void *)*where, defobj->path));
 			break;
 
 		default:
 			rdbg(("sym = %lu, type = %lu, offset = %p, "
-			"contents = %p, symbol = %s",
+			"addend = %p, contents = %p, symbol = %s",
 			(u_long)ELF_R_SYM(rela->r_info),
 			(u_long)ELF_R_TYPE(rela->r_info),
-			(void *)rela->r_offset, *where,
+			(void *)rela->r_offset, (void *)rela->r_addend,
+			(void *)*where,
 			obj->strtab + obj->symtab[symnum].st_name));
 			_rtld_error("%s: Unsupported relocation type %ld "
 			"in non-PLT relocations",
@@ -244,7 +246,7 @@ _rtld_relocate_plt_object(const Obj_Entr
 	return 0;
 }
 
-caddr_t
+Elf_Addr
 _rtld_bind(const Obj_Entry *obj, Elf_Word reloff)
 {
 	const Elf_Rel *rel = obj->pltrel + reloff;
@@ -256,7 +258,7 @@ _rtld_bind(const Obj_Entry *obj, Elf_Wor
 		_rtld_die();
 	_rtld_shared_exit();
 
-	return (caddr_t)new_value;
+	return new_value;
 }
 int
 _rtld_relocate_plt_objects(const Obj_Entry *obj)



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

2017-08-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug 23 08:14:18 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: copy.S

Log Message:
style, reduces an incoming diff


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/amd64/copy.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/copy.S
diff -u src/sys/arch/amd64/amd64/copy.S:1.21 src/sys/arch/amd64/amd64/copy.S:1.22
--- src/sys/arch/amd64/amd64/copy.S:1.21	Wed Aug 23 08:04:22 2017
+++ src/sys/arch/amd64/amd64/copy.S	Wed Aug 23 08:14:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.21 2017/08/23 08:04:22 maxv Exp $	*/
+/*	$NetBSD: copy.S,v 1.22 2017/08/23 08:14:18 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -44,8 +44,8 @@
 #include 
 
 #define GET_CURPCB(reg)	\
-	movq	CPUVAR(CURLWP), reg; \
-	movq	L_PCB(reg), reg
+	movq	CPUVAR(CURLWP),reg; \
+	movq	L_PCB(reg),reg
 
 /*
  * These are arranged so that the abnormal case is a forwards
@@ -55,10 +55,10 @@
 #define DEFERRED_SWITCH_CHECK \
 	CHECK_DEFERRED_SWITCH			; \
 	jnz	99f; \
-98:
+98:
 
 #define DEFERRED_SWITCH_CALL \
-99:		; \
+99:		; \
 	call	_C_LABEL(do_pmap_load)		; \
 	jmp	98b
 
@@ -85,18 +85,18 @@ ENTRY(do_pmap_load)
 	pushq	%rdx
 	pushq	%rcx
 	pushq	%rbx
-	movq	CPUVAR(CURLWP), %rbx
+	movq	CPUVAR(CURLWP),%rbx
 1:
 	incl	L_NOPREEMPT(%rbx)
 	call	_C_LABEL(pmap_load)
 	decl	L_NOPREEMPT(%rbx)
 	jnz	2f
-	cmpl	$0, L_DOPREEMPT(%rbx)
+	cmpl	$0,L_DOPREEMPT(%rbx)
 	jz	2f
-	xorq	%rdi, %rdi
+	xorq	%rdi,%rdi
 	call	_C_LABEL(kpreempt)
 2:
-	cmpl	$0, CPUVAR(WANT_PMAPLOAD)
+	cmpl	$0,CPUVAR(WANT_PMAPLOAD)
 	jnz	1b
 	popq	%rbx
 	popq	%rcx
@@ -194,6 +194,7 @@ ENTRY(copyout)
 	rep
 	movsb/* copy remaining bytes */
 .Lcopyout_end:
+
 	xorl	%eax,%eax
 	ret
 	DEFERRED_SWITCH_CALL
@@ -221,6 +222,7 @@ ENTRY(copyin)
 	rep
 	movsb
 .Lcopyin_end:
+
 	xorl	%eax,%eax
 	ret
 	DEFERRED_SWITCH_CALL
@@ -256,6 +258,7 @@ ENTRY(copyoutstr)
 	jae	1f
 	movq	%rax,%rdx
 	movq	%rax,%r8
+
 .Lcopyoutstr_start:
 1:	incq	%rdx
 
@@ -266,6 +269,7 @@ ENTRY(copyoutstr)
 	testb	%al,%al
 	jnz	1b
 .Lcopyoutstr_end:
+
 	/* Success -- 0 byte reached. */
 	decq	%rdx
 	xorq	%rax,%rax
@@ -295,6 +299,7 @@ ENTRY(copyinstr)
 	jae	1f
 	movq	%rax,%rdx
 	movq	%rax,%r8
+
 .Lcopyinstr_start:
 1:	incq	%rdx
 
@@ -363,7 +368,7 @@ ENTRY(copystr)
 
 
 ENTRY(fuswintr)
-	cmpl	$TLBSTATE_VALID, CPUVAR(TLBSTATE)
+	cmpl	$TLBSTATE_VALID,CPUVAR(TLBSTATE)
 	jnz	_C_LABEL(fusuaddrfault)
 	movq	$VM_MAXUSER_ADDRESS-2,%r11
 	cmpq	%r11,%rdi
@@ -371,7 +376,9 @@ ENTRY(fuswintr)
 	GET_CURPCB(%rcx)
 	leaq	_C_LABEL(fusuintrfailure)(%rip),%r11
 	movq	%r11,PCB_ONFAULT(%rcx)
+
 	movzwl	(%rdi),%eax
+
 	movq	$0,PCB_ONFAULT(%rcx)
 	ret
 
@@ -383,13 +390,15 @@ ENTRY(fubyte)
 	GET_CURPCB(%rcx)
 	leaq	_C_LABEL(fusufailure)(%rip),%r11
 	movq	%r11,PCB_ONFAULT(%rcx)
+
 	movzbl	(%rdi),%eax
+
 	movq	$0,PCB_ONFAULT(%rcx)
 	ret
 	DEFERRED_SWITCH_CALL
 
 ENTRY(suswintr)
-	cmpl	$TLBSTATE_VALID, CPUVAR(TLBSTATE)
+	cmpl	$TLBSTATE_VALID,CPUVAR(TLBSTATE)
 	jnz	_C_LABEL(fusuaddrfault)
 	movq	$VM_MAXUSER_ADDRESS-2,%r11
 	cmpq	%r11,%rdi
@@ -397,7 +406,9 @@ ENTRY(suswintr)
 	GET_CURPCB(%rcx)
 	leaq	_C_LABEL(fusuintrfailure)(%rip),%r11
 	movq	%r11,PCB_ONFAULT(%rcx)
+
 	movw	%si,(%rdi)
+
 	xorq	%rax,%rax
 	movq	%rax,PCB_ONFAULT(%rcx)
 	ret
@@ -413,6 +424,7 @@ ENTRY(subyte)
 	movq	%r11,PCB_ONFAULT(%rcx)
 
 	movb	%sil,(%rdi)
+
 	xorq	%rax,%rax
 	movq	%rax,PCB_ONFAULT(%rcx)
 	ret
@@ -444,21 +456,23 @@ ENTRY(fusuaddrfault)
 ENTRY(ucas_64)
 	DEFERRED_SWITCH_CHECK
 	/* Fail if kernel-space */
-	movq	$VM_MAXUSER_ADDRESS-8, %r8
-	cmpq	%r8, %rdi
+	movq	$VM_MAXUSER_ADDRESS-8,%r8
+	cmpq	%r8,%rdi
 	ja	_C_LABEL(ucas_efault)
-	movq	%rsi, %rax
+	movq	%rsi,%rax
+
 .Lucas64_start:
 	/* Perform the CAS */
 	lock
-	cmpxchgq %rdx, (%rdi)
+	cmpxchgq %rdx,(%rdi)
 .Lucas64_end:
+
 	/*
 	 * Note: %rax is "old" value.
 	 * Set the return values.
 	 */
-	movq	%rax, (%rcx)
-	xorq	%rax, %rax
+	movq	%rax,(%rcx)
+	xorq	%rax,%rax
 	ret
 	DEFERRED_SWITCH_CALL
 
@@ -468,21 +482,23 @@ ENTRY(ucas_64)
 ENTRY(ucas_32)
 	DEFERRED_SWITCH_CHECK
 	/* Fail if kernel-space */
-	movq	$VM_MAXUSER_ADDRESS-4, %r8
-	cmpq	%r8, %rdi
+	movq	$VM_MAXUSER_ADDRESS-4,%r8
+	cmpq	%r8,%rdi
 	ja	_C_LABEL(ucas_efault)
-	movl	%esi, %eax
+	movl	%esi,%eax
+
 .Lucas32_start:
 	/* Perform the CAS */
 	lock
-	cmpxchgl %edx, (%rdi)
+	cmpxchgl %edx,(%rdi)
 .Lucas32_end:
+
 	/*
 	 * Note: %eax is "old" value.
 	 * Set the return values.
 	 */
-	movl	%eax, (%rcx)
-	xorq	%rax, %rax
+	movl	%eax,(%rcx)
+	xorq	%rax,%rax
 	ret
 	DEFERRED_SWITCH_CALL
 



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

2017-08-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug 23 08:04:22 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: copy.S

Log Message:
Fix a bug in ucas_32 and ucas_64. There is a branch where they don't
initialize %rax.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/amd64/copy.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/copy.S
diff -u src/sys/arch/amd64/amd64/copy.S:1.20 src/sys/arch/amd64/amd64/copy.S:1.21
--- src/sys/arch/amd64/amd64/copy.S:1.20	Wed Dec  9 16:55:18 2015
+++ src/sys/arch/amd64/amd64/copy.S	Wed Aug 23 08:04:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.20 2015/12/09 16:55:18 maxv Exp $	*/
+/*	$NetBSD: copy.S,v 1.21 2017/08/23 08:04:22 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -446,7 +446,7 @@ ENTRY(ucas_64)
 	/* Fail if kernel-space */
 	movq	$VM_MAXUSER_ADDRESS-8, %r8
 	cmpq	%r8, %rdi
-	ja	_C_LABEL(ucas_fault)
+	ja	_C_LABEL(ucas_efault)
 	movq	%rsi, %rax
 .Lucas64_start:
 	/* Perform the CAS */
@@ -470,7 +470,7 @@ ENTRY(ucas_32)
 	/* Fail if kernel-space */
 	movq	$VM_MAXUSER_ADDRESS-4, %r8
 	cmpq	%r8, %rdi
-	ja	_C_LABEL(ucas_fault)
+	ja	_C_LABEL(ucas_efault)
 	movl	%esi, %eax
 .Lucas32_start:
 	/* Perform the CAS */
@@ -486,10 +486,9 @@ ENTRY(ucas_32)
 	ret
 	DEFERRED_SWITCH_CALL
 
-/*
- * Fault handler for ucas_*().
- * Just return the error set by trap().
- */
+ENTRY(ucas_efault)
+	movq	$EFAULT,%rax
+
 NENTRY(ucas_fault)
 	ret