CVS commit: src

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 07:59:42 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/lib/libarch/i386: Makefile.inc
Removed Files:
src/lib/libarch/i386: i386_vm86.2 i386_vm86.c

Log Message:
Remove the i386_vm86 API (instead of just deprecating it). This API is not
available anymore, and any binary using it won't function correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.2143 -r1.2144 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.15 -r1.16 src/lib/libarch/i386/Makefile.inc
cvs rdiff -u -r1.14 -r0 src/lib/libarch/i386/i386_vm86.2
cvs rdiff -u -r1.10 -r0 src/lib/libarch/i386/i386_vm86.c

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2143 src/distrib/sets/lists/comp/mi:1.2144
--- src/distrib/sets/lists/comp/mi:1.2143	Thu Aug 10 13:40:04 2017
+++ src/distrib/sets/lists/comp/mi	Sat Aug 12 07:59:42 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2143 2017/08/10 13:40:04 nat Exp $
+#	$NetBSD: mi,v 1.2144 2017/08/12 07:59:42 maxv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -4167,7 +4167,7 @@
 ./usr/share/man/cat2/i386_set_ioperm.0		comp-obsolete		obsolete
 ./usr/share/man/cat2/i386_set_ldt.0		comp-c-catman		.cat
 ./usr/share/man/cat2/i386_set_mtrr.0		comp-c-catman		.cat
-./usr/share/man/cat2/i386_vm86.0		comp-c-catman		.cat
+./usr/share/man/cat2/i386_vm86.0		comp-obsolete		obsolete
 ./usr/share/man/cat2/intro.0			comp-c-catman		.cat
 ./usr/share/man/cat2/ioctl.0			comp-c-catman		.cat
 ./usr/share/man/cat2/issetugid.0		comp-c-catman		.cat
@@ -11819,7 +11819,7 @@
 ./usr/share/man/html2/i386_pmc_startstop.html	comp-c-htmlman		html
 ./usr/share/man/html2/i386_set_ldt.html		comp-c-htmlman		html
 ./usr/share/man/html2/i386_set_mtrr.html	comp-c-htmlman		html
-./usr/share/man/html2/i386_vm86.html		comp-c-htmlman		html
+./usr/share/man/html2/i386_vm86.html		comp-obsolete		obsolete
 ./usr/share/man/html2/intro.html		comp-c-htmlman		html
 ./usr/share/man/html2/ioctl.html		comp-c-htmlman		html
 ./usr/share/man/html2/issetugid.html		comp-c-htmlman		html
@@ -19251,7 +19251,7 @@
 ./usr/share/man/man2/i386_set_ioperm.2		comp-obsolete		obsolete
 ./usr/share/man/man2/i386_set_ldt.2		comp-c-man		.man
 ./usr/share/man/man2/i386_set_mtrr.2		comp-c-man		.man
-./usr/share/man/man2/i386_vm86.2		comp-c-man		.man
+./usr/share/man/man2/i386_vm86.2		comp-obsolete		obsolete
 ./usr/share/man/man2/intro.2			comp-c-man		.man
 ./usr/share/man/man2/ioctl.2			comp-c-man		.man
 ./usr/share/man/man2/issetugid.2		comp-c-man		.man

Index: src/lib/libarch/i386/Makefile.inc
diff -u src/lib/libarch/i386/Makefile.inc:1.15 src/lib/libarch/i386/Makefile.inc:1.16
--- src/lib/libarch/i386/Makefile.inc:1.15	Mon Jun  8 04:08:30 2015
+++ src/lib/libarch/i386/Makefile.inc	Sat Aug 12 07:59:42 2017
@@ -1,16 +1,15 @@
-#	$NetBSD: Makefile.inc,v 1.15 2015/06/08 04:08:30 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.16 2017/08/12 07:59:42 maxv Exp $
 
 .if (${MACHINE_ARCH} == "i386" || ${MLIBDIR:Unone} == "i386")
 SRCS+=	i386_get_ldt.c i386_set_ldt.c \
 	i386_iopl.c i386_get_ioperm.c i386_set_ioperm.c \
-	i386_vm86.c i386_pmc.c i386_mtrr.c
+	i386_pmc.c i386_mtrr.c
 .endif
 
 MAN+=	i386_get_ldt.2 \
 	i386_get_mtrr.2 \
 	i386_iopl.2 \
-	i386_pmc_info.2 \
-	i386_vm86.2
+	i386_pmc_info.2
 
 MLINKS+=i386_get_ldt.2 i386_set_ldt.2 \
 	i386_get_mtrr.2 i386_set_mtrr.2 \



CVS commit: [jdolecek-ncq] src/sys/dev

2017-08-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Aug 12 09:52:29 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq ata.c ata_wdc.c atavar.h
src/sys/dev/ic [jdolecek-ncq]: mvsata.c wdc.c wdcvar.h
src/sys/dev/pci [jdolecek-ncq]: pciide_common.c
src/sys/dev/scsipi [jdolecek-ncq]: atapi_wdc.c

Log Message:
remove all logic around ATACH_IRQ_WAIT and channel-global ch_error/ch_status,
so that there is less hidden state shared by commands; primary intent is
to make the NCQ and non-NCQ paths more similar, and remove possibility
of incorrect handling for the NCQ commands

tested both disk and ATAPI - piixide(4) on QEMU, and siisata(4),
ahcisata(4), mvsata(4) on real hw


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/sys/dev/ata/TODO.ncq
cvs rdiff -u -r1.132.8.24 -r1.132.8.25 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.105.6.6 -r1.105.6.7 src/sys/dev/ata/ata_wdc.c
cvs rdiff -u -r1.92.8.21 -r1.92.8.22 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.35.6.19 -r1.35.6.20 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.283.2.10 -r1.283.2.11 src/sys/dev/ic/wdc.c
cvs rdiff -u -r1.97.26.1 -r1.97.26.2 src/sys/dev/ic/wdcvar.h
cvs rdiff -u -r1.62.4.1 -r1.62.4.2 src/sys/dev/pci/pciide_common.c
cvs rdiff -u -r1.123.4.10 -r1.123.4.11 src/sys/dev/scsipi/atapi_wdc.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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.32 src/sys/dev/ata/TODO.ncq:1.1.2.33
--- src/sys/dev/ata/TODO.ncq:1.1.2.32	Tue Aug  1 22:04:48 2017
+++ src/sys/dev/ata/TODO.ncq	Sat Aug 12 09:52:28 2017
@@ -7,9 +7,6 @@ test wd* at umass?, confirm the ata_chan
 
 do proper NCQ error recovery
 - update mvsata to do same as ahcisata/siisata (read log ext, timeouts, et.al)
-- update also ic/wdc.c, scsipi/atapi_wdc.c, ata/ata_wdc.c to not use
-  ch_status/ch_error/ATACH_IRQ_WAIT
-- retest ATAPI
 
 do biodone() in wddone() starting the dump to not leak bufs when dumping from
 active system? make sure to not trigger atastart()
@@ -18,6 +15,8 @@ active system? make sure to not trigger 
 kill active transfers after software drive reset - race timeout vs.
 error recovery
 
+atabus_thread() protect run by mutex/condvar
+
 Other random notes (do outside the NCQ branch):
 -
 implement support for PM FIS-based switching, remove restriction in atastart()

Index: src/sys/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.24 src/sys/dev/ata/ata.c:1.132.8.25
--- src/sys/dev/ata/ata.c:1.132.8.24	Tue Aug  1 21:41:25 2017
+++ src/sys/dev/ata/ata.c	Sat Aug 12 09:52:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.132.8.24 2017/08/01 21:41:25 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.132.8.25 2017/08/12 09:52:28 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.24 2017/08/01 21:41:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.25 2017/08/12 09:52:28 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -622,15 +622,16 @@ atabus_thread(void *arg)
 			ata_reset_channel(chp, AT_WAIT | chp->ch_reset_flags);
 		} else if (chq->queue_active > 0 && chq->queue_freeze == 1) {
 			/*
-			 * Caller has bumped queue_freeze, decrease it.
+			 * Caller has bumped queue_freeze, decrease it. This
+			 * flow shalt never be executed for NCQ commands.
 			 */
+			KASSERT((chp->ch_flags & ATACH_NCQ) == 0);
+			KASSERT(chq->queue_active == 1);
+
 			ata_channel_thaw(chp);
-			u_int active __diagused = 0;
-			TAILQ_FOREACH(xfer, >active_xfers, c_activechain) {
-(*xfer->c_start)(xfer->c_chp, xfer);
-active++;
-			}
-			KASSERT(active == chq->queue_active);
+			xfer = ata_queue_get_active_xfer(chp);
+			KASSERT(xfer != NULL);
+			(*xfer->c_start)(xfer->c_chp, xfer);
 		} else if (chq->queue_freeze > 1)
 			panic("ata_thread: queue_freeze");
 	}
@@ -1430,7 +1431,7 @@ ata_free_xfer(struct ata_channel *chp, s
 		/* finish the busmastering PIO */
 		(*wdc->piobm_done)(wdc->dma_arg,
 		chp->ch_channel, xfer->c_drive);
-		chp->ch_flags &= ~(ATACH_DMA_WAIT | ATACH_PIOBM_WAIT | ATACH_IRQ_WAIT);
+		chp->ch_flags &= ~(ATACH_DMA_WAIT | ATACH_PIOBM_WAIT);
 	}
 #endif
 
@@ -1521,7 +1522,7 @@ ata_waitdrain_xfer_check(struct ata_chan
 /*
  * Check for race of normal transfer handling vs. timeout.
  */
-static bool
+bool
 ata_timo_xfer_check(struct ata_xfer *xfer)
 {
 	struct ata_channel *chp = xfer->c_chp;

Index: src/sys/dev/ata/ata_wdc.c
diff -u src/sys/dev/ata/ata_wdc.c:1.105.6.6 src/sys/dev/ata/ata_wdc.c:1.105.6.7
--- src/sys/dev/ata/ata_wdc.c:1.105.6.6	Tue Jun 27 18:36:03 2017
+++ src/sys/dev/ata/ata_wdc.c	Sat Aug 12 09:52:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_wdc.c,v 1.105.6.6 2017/06/27 18:36:03 jdolecek Exp $	*/
+/*	$NetBSD: ata_wdc.c,v 1.105.6.7 2017/08/12 09:52:28 jdolecek Exp $	*/
 
 /*
  * Copyright 

CVS commit: src/regress/sys/arch/i386

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 07:40:43 UTC 2017

Modified Files:
src/regress/sys/arch/i386: Makefile
Removed Files:
src/regress/sys/arch/i386/vm86: Makefile vm86test.c vm86test.exp

Log Message:
Remove the vm86 tests.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/regress/sys/arch/i386/Makefile
cvs rdiff -u -r1.1 -r0 src/regress/sys/arch/i386/vm86/Makefile \
src/regress/sys/arch/i386/vm86/vm86test.exp
cvs rdiff -u -r1.3 -r0 src/regress/sys/arch/i386/vm86/vm86test.c

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

Modified files:

Index: src/regress/sys/arch/i386/Makefile
diff -u src/regress/sys/arch/i386/Makefile:1.7 src/regress/sys/arch/i386/Makefile:1.8
--- src/regress/sys/arch/i386/Makefile:1.7	Fri Jan  4 15:39:25 2008
+++ src/regress/sys/arch/i386/Makefile	Sat Aug 12 07:40:43 2017
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.7 2008/01/04 15:39:25 yamt Exp $
+#	$NetBSD: Makefile,v 1.8 2017/08/12 07:40:43 maxv Exp $
 
-SUBDIR+= ldt vm86
+SUBDIR+= ldt
 #SUBDIR+= ioperm iopl
 
 .include 



CVS commit: src/share/man/man4

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 08:03:57 UTC 2017

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

Log Message:
Remove reference to vm86.


To generate a diff of this commit:
cvs rdiff -u -r1.469 -r1.470 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.469 src/share/man/man4/options.4:1.470
--- src/share/man/man4/options.4:1.469	Sat Jul 29 12:15:12 2017
+++ src/share/man/man4/options.4	Sat Aug 12 08:03:57 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.469 2017/07/29 12:15:12 maxv Exp $
+.\"	$NetBSD: options.4,v 1.470 2017/08/12 08:03:57 maxv Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -30,7 +30,7 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd July 29, 2017
+.Dd August 12, 2017
 .Dt OPTIONS 4
 .Os
 .Sh NAME
@@ -2500,10 +2500,6 @@ This gives the user a chance to see erro
 operations (like NFS unmounts, buffer cache flush, etc ...).
 Setting this to 0 will disable the delay.
 Default is 2 seconds.
-.It Cd options VM86
-Include support for virtual 8086 mode, used by
-.Tn DOS
-emulators and X servers to run BIOS code, e.g., for some VESA routines.
 .It Cd options USER_LDT
 Include i386-specific system calls for modifying the local descriptor table,
 used by Windows emulators.



CVS commit: [jdolecek-ncq] src/sys/dev/ic

2017-08-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Aug 12 09:38:58 UTC 2017

Modified Files:
src/sys/dev/ic [jdolecek-ncq]: mvsata.c

Log Message:
fix condition for switching to kernel thread for ATAPI and bio reset recovery
to match atapi_wdc.c, __wdcwait() postpones to the thread whenever neither
AT_POLL nor AT_WAIT flags are present

fixes spurious 'timeout' for the command on mvsata, followed by 'unexpected'
interrupt


To generate a diff of this commit:
cvs rdiff -u -r1.35.6.18 -r1.35.6.19 src/sys/dev/ic/mvsata.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/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.35.6.18 src/sys/dev/ic/mvsata.c:1.35.6.19
--- src/sys/dev/ic/mvsata.c:1.35.6.18	Wed Jun 28 19:59:36 2017
+++ src/sys/dev/ic/mvsata.c	Sat Aug 12 09:38:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.35.6.18 2017/06/28 19:59:36 jdolecek Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.35.6.19 2017/08/12 09:38:58 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.18 2017/06/28 19:59:36 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.19 2017/08/12 09:38:58 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -1222,7 +1222,8 @@ do_pio:
 			 * If it's not a polled command, we need the kernel
 			 * thread
 			 */
-			if ((xfer->c_flags & C_POLL) == 0 && cpu_intr_p()) {
+			if ((xfer->c_flags & C_POLL) == 0 &&
+			(chp->ch_flags & ATACH_TH_RUN) == 0) {
 ata_channel_freeze(chp);
 wakeup(>ch_thread);
 return;
@@ -1910,7 +1911,8 @@ mvsata_atapi_start(struct ata_channel *c
 	/* Do control operations specially. */
 	if (__predict_false(drvp->state < READY)) {
 		/* If it's not a polled command, we need the kernel thread */
-		if ((sc_xfer->xs_control & XS_CTL_POLL) == 0 && cpu_intr_p()) {
+		if ((sc_xfer->xs_control & XS_CTL_POLL) == 0 &&
+		(chp->ch_flags & ATACH_TH_RUN) == 0) {
 			ata_channel_freeze(chp);
 			wakeup(>ch_thread);
 			return;



CVS commit: src/sys/dev/mii

2017-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 12 11:21:15 UTC 2017

Modified Files:
src/sys/dev/mii: nsphy.c

Log Message:
Do not deref a NULL pointer if no current media has been selected.
This error condition does not happen with properly working hardware, but it is
no good reason for a kernel panic either.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/mii/nsphy.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/mii/nsphy.c
diff -u src/sys/dev/mii/nsphy.c:1.60 src/sys/dev/mii/nsphy.c:1.61
--- src/sys/dev/mii/nsphy.c:1.60	Thu Jul  7 06:55:41 2016
+++ src/sys/dev/mii/nsphy.c	Sat Aug 12 11:21:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nsphy.c,v 1.60 2016/07/07 06:55:41 msaitoh Exp $	*/
+/*	$NetBSD: nsphy.c,v 1.61 2017/08/12 11:21:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.60 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.61 2017/08/12 11:21:15 martin Exp $");
 
 #include 
 #include 
@@ -153,7 +153,7 @@ nsphy_service(struct mii_softc *sc, stru
 		/*
 		 * If we're not polling our PHY instance, just return.
 		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
+		if (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst)
 			return (0);
 		break;
 
@@ -162,7 +162,7 @@ nsphy_service(struct mii_softc *sc, stru
 		 * If the media indicates a different PHY instance,
 		 * isolate ourselves.
 		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
+		if (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst) {
 			reg = PHY_READ(sc, MII_BMCR);
 			PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
 			return (0);
@@ -216,7 +216,7 @@ nsphy_service(struct mii_softc *sc, stru
 		/*
 		 * If we're not currently selected, just return.
 		 */
-		if (IFM_INST(ife->ifm_media) != sc->mii_inst)
+		if (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst)
 			return (0);
 
 		if (mii_phy_tick(sc) == EJUSTRETURN)



CVS commit: src/sys

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 07:07:53 UTC 2017

Modified Files:
src/sys/arch/i386/i386: compat_13_machdep.c compat_16_machdep.c
i386_trap.S machdep.c process_machdep.c spl.S trap.c
src/sys/compat/freebsd: freebsd_machdep.c
src/sys/compat/linux/arch/i386: linux_machdep.c

Log Message:
Remove vm86. Simplifies a number of critical places.

Pass 2.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/i386/compat_13_machdep.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/i386/compat_16_machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.788 -r1.789 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/i386/i386/process_machdep.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.288 -r1.289 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/freebsd/freebsd_machdep.c
cvs rdiff -u -r1.163 -r1.164 src/sys/compat/linux/arch/i386/linux_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/i386/i386/compat_13_machdep.c
diff -u src/sys/arch/i386/i386/compat_13_machdep.c:1.25 src/sys/arch/i386/i386/compat_13_machdep.c:1.26
--- src/sys/arch/i386/i386/compat_13_machdep.c:1.25	Sat Nov 21 03:11:00 2009
+++ src/sys/arch/i386/i386/compat_13_machdep.c	Sat Aug 12 07:07:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_13_machdep.c,v 1.25 2009/11/21 03:11:00 rmind Exp $	*/
+/*	$NetBSD: compat_13_machdep.c,v 1.26 2017/08/12 07:07:53 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,11 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.25 2009/11/21 03:11:00 rmind Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_vm86.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.26 2017/08/12 07:07:53 maxv Exp $");
 
 #include 
 #include 
@@ -47,10 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: compat_13_ma
 #include 
 #include 
 
-#ifdef VM86
-#include 
-#endif
-
 int
 compat_13_sys_sigreturn(struct lwp *l, const struct compat_13_sys_sigreturn_args *uap, register_t *retval)
 {
@@ -73,36 +65,24 @@ compat_13_sys_sigreturn(struct lwp *l, c
 
 	/* Restore register context. */
 	tf = l->l_md.md_regs;
-#ifdef VM86
-	if (context.sc_eflags & PSL_VM) {
-		void syscall_vm86(struct trapframe *);
-
-		tf->tf_vm86_gs = context.sc_gs;
-		tf->tf_vm86_fs = context.sc_fs;
-		tf->tf_vm86_es = context.sc_es;
-		tf->tf_vm86_ds = context.sc_ds;
-		set_vflags(l, context.sc_eflags);
-		p->p_md.md_syscall = syscall_vm86;
-	} else
-#endif
-	{
-		/*
-		 * Check for security violations.  If we're returning to
-		 * protected mode, the CPU will validate the segment registers
-		 * automatically and generate a trap on violations.  We handle
-		 * the trap, rather than doing all of the checking here.
-		 */
-		if (((context.sc_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 ||
-		!USERMODE(context.sc_cs, context.sc_eflags))
-			return (EINVAL);
-
-		tf->tf_gs = context.sc_gs;
-		tf->tf_fs = context.sc_fs;		
-		tf->tf_es = context.sc_es;
-		tf->tf_ds = context.sc_ds;
-		tf->tf_eflags &= ~PSL_USER;
-		tf->tf_eflags |= context.sc_eflags & PSL_USER;
-	}
+
+	/*
+	 * Check for security violations.  If we're returning to
+	 * protected mode, the CPU will validate the segment registers
+	 * automatically and generate a trap on violations.  We handle
+	 * the trap, rather than doing all of the checking here.
+	 */
+	if (((context.sc_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 ||
+	!USERMODE(context.sc_cs, context.sc_eflags))
+		return (EINVAL);
+
+	tf->tf_gs = context.sc_gs;
+	tf->tf_fs = context.sc_fs;		
+	tf->tf_es = context.sc_es;
+	tf->tf_ds = context.sc_ds;
+	tf->tf_eflags &= ~PSL_USER;
+	tf->tf_eflags |= context.sc_eflags & PSL_USER;
+
 	tf->tf_edi = context.sc_edi;
 	tf->tf_esi = context.sc_esi;
 	tf->tf_ebp = context.sc_ebp;

Index: src/sys/arch/i386/i386/compat_16_machdep.c
diff -u src/sys/arch/i386/i386/compat_16_machdep.c:1.28 src/sys/arch/i386/i386/compat_16_machdep.c:1.29
--- src/sys/arch/i386/i386/compat_16_machdep.c:1.28	Thu Aug 10 12:49:11 2017
+++ src/sys/arch/i386/i386/compat_16_machdep.c	Sat Aug 12 07:07:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_16_machdep.c,v 1.28 2017/08/10 12:49:11 maxv Exp $	*/
+/*	$NetBSD: compat_16_machdep.c,v 1.29 2017/08/12 07:07:53 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,10 +30,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.28 2017/08/10 12:49:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.29 2017/08/12 07:07:53 maxv Exp $");
 
 #ifdef _KERNEL_OPT
-#include "opt_vm86.h"
 #include "opt_compat_netbsd.h"
 #endif
 
@@ -46,10 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: compat_16_ma
 #include 
 #include 
 
-#ifdef VM86
-#include 
-#include 
-#endif
 #include 
 

CVS commit: src

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 08:21:30 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/lib/libarch/i386: Makefile.inc
Removed Files:
src/lib/libarch/i386: i386_pmc.c i386_pmc_info.2

Log Message:
All things considered, remove the i386_pmc API. I deprecated it some
months ago, and clearly no one should be using it.

(reminder: our new PMCs use the same sysarch, but the arguments are
opaque and not compatible with the previous versions)


To generate a diff of this commit:
cvs rdiff -u -r1.2144 -r1.2145 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.16 -r1.17 src/lib/libarch/i386/Makefile.inc
cvs rdiff -u -r1.4 -r0 src/lib/libarch/i386/i386_pmc.c
cvs rdiff -u -r1.12 -r0 src/lib/libarch/i386/i386_pmc_info.2

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2144 src/distrib/sets/lists/comp/mi:1.2145
--- src/distrib/sets/lists/comp/mi:1.2144	Sat Aug 12 07:59:42 2017
+++ src/distrib/sets/lists/comp/mi	Sat Aug 12 08:21:30 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2144 2017/08/12 07:59:42 maxv Exp $
+#	$NetBSD: mi,v 1.2145 2017/08/12 08:21:30 maxv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -4161,9 +4161,9 @@
 ./usr/share/man/cat2/i386_get_ldt.0		comp-c-catman		.cat
 ./usr/share/man/cat2/i386_get_mtrr.0		comp-c-catman		.cat
 ./usr/share/man/cat2/i386_iopl.0		comp-c-catman		.cat
-./usr/share/man/cat2/i386_pmc_info.0		comp-c-catman		.cat
-./usr/share/man/cat2/i386_pmc_read.0		comp-c-catman		.cat
-./usr/share/man/cat2/i386_pmc_startstop.0	comp-c-catman		.cat
+./usr/share/man/cat2/i386_pmc_info.0		comp-obsolete		obsolete
+./usr/share/man/cat2/i386_pmc_read.0		comp-obsolete		obsolete
+./usr/share/man/cat2/i386_pmc_startstop.0	comp-obsolete		obsolete
 ./usr/share/man/cat2/i386_set_ioperm.0		comp-obsolete		obsolete
 ./usr/share/man/cat2/i386_set_ldt.0		comp-c-catman		.cat
 ./usr/share/man/cat2/i386_set_mtrr.0		comp-c-catman		.cat
@@ -11814,9 +11814,9 @@
 ./usr/share/man/html2/i386_get_ldt.html		comp-c-htmlman		html
 ./usr/share/man/html2/i386_get_mtrr.html	comp-c-htmlman		html
 ./usr/share/man/html2/i386_iopl.html		comp-c-htmlman		html
-./usr/share/man/html2/i386_pmc_info.html	comp-c-htmlman		html
-./usr/share/man/html2/i386_pmc_read.html	comp-c-htmlman		html
-./usr/share/man/html2/i386_pmc_startstop.html	comp-c-htmlman		html
+./usr/share/man/html2/i386_pmc_info.html	comp-obsolete		obsolete
+./usr/share/man/html2/i386_pmc_read.html	comp-obsolete		obsolete
+./usr/share/man/html2/i386_pmc_startstop.html	comp-obsolete		obsolete
 ./usr/share/man/html2/i386_set_ldt.html		comp-c-htmlman		html
 ./usr/share/man/html2/i386_set_mtrr.html	comp-c-htmlman		html
 ./usr/share/man/html2/i386_vm86.html		comp-obsolete		obsolete
@@ -19245,9 +19245,9 @@
 ./usr/share/man/man2/i386_get_ldt.2		comp-c-man		.man
 ./usr/share/man/man2/i386_get_mtrr.2		comp-c-man		.man
 ./usr/share/man/man2/i386_iopl.2		comp-c-man		.man
-./usr/share/man/man2/i386_pmc_info.2		comp-c-man		.man
-./usr/share/man/man2/i386_pmc_read.2		comp-c-man		.man
-./usr/share/man/man2/i386_pmc_startstop.2	comp-c-man		.man
+./usr/share/man/man2/i386_pmc_info.2		comp-obsolete		obsolete
+./usr/share/man/man2/i386_pmc_read.2		comp-obsolete		obsolete
+./usr/share/man/man2/i386_pmc_startstop.2	comp-obsolete		obsolete
 ./usr/share/man/man2/i386_set_ioperm.2		comp-obsolete		obsolete
 ./usr/share/man/man2/i386_set_ldt.2		comp-c-man		.man
 ./usr/share/man/man2/i386_set_mtrr.2		comp-c-man		.man

Index: src/lib/libarch/i386/Makefile.inc
diff -u src/lib/libarch/i386/Makefile.inc:1.16 src/lib/libarch/i386/Makefile.inc:1.17
--- src/lib/libarch/i386/Makefile.inc:1.16	Sat Aug 12 07:59:42 2017
+++ src/lib/libarch/i386/Makefile.inc	Sat Aug 12 08:21:30 2017
@@ -1,17 +1,14 @@
-#	$NetBSD: Makefile.inc,v 1.16 2017/08/12 07:59:42 maxv Exp $
+#	$NetBSD: Makefile.inc,v 1.17 2017/08/12 08:21:30 maxv Exp $
 
 .if (${MACHINE_ARCH} == "i386" || ${MLIBDIR:Unone} == "i386")
 SRCS+=	i386_get_ldt.c i386_set_ldt.c \
 	i386_iopl.c i386_get_ioperm.c i386_set_ioperm.c \
-	i386_pmc.c i386_mtrr.c
+	i386_mtrr.c
 .endif
 
 MAN+=	i386_get_ldt.2 \
 	i386_get_mtrr.2 \
-	i386_iopl.2 \
-	i386_pmc_info.2
+	i386_iopl.2
 
 MLINKS+=i386_get_ldt.2 i386_set_ldt.2 \
-	i386_get_mtrr.2 i386_set_mtrr.2 \
-	i386_pmc_info.2 i386_pmc_startstop.2 \
-	i386_pmc_info.2 i386_pmc_read.2
+	i386_get_mtrr.2 i386_set_mtrr.2



CVS commit: [netbsd-7] src/doc

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 06:05:16 UTC 2017

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

Log Message:
1489, 1490


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

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.36 src/doc/CHANGES-7.2:1.1.2.37
--- src/doc/CHANGES-7.2:1.1.2.36	Sat Aug 12 05:07:30 2017
+++ src/doc/CHANGES-7.2	Sat Aug 12 06:05:16 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.36 2017/08/12 05:07:30 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.37 2017/08/12 06:05:16 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -2838,3 +2838,625 @@ sys/compat/linux/common/linux_time.c		1.
 	missing cred check in linux_sys_settimeofday()
 	[mrg, ticket #1486]
 
+doc/3RDPARTY	patch
+external/bsd/bind/Makefile.inc  up to 1.26 via patch
+external/bsd/bind/dist/CHANGES  up to 1.28
+external/bsd/bind/dist/README   up to 1.16
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch01.html up to 1.1.1.26
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch02.html up to 1.1.1.23
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch03.html up to 1.1.1.28
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch04.html up to 1.16
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch05.html up to 1.1.1.29
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch06.html up to 1.16
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch07.html up to 1.16
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch08.html up to 1.16
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch09.html up to 1.16
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch10.html up to 1.1.1.25
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch11.html up to 1.1.1.14
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch12.html up to 1.1.1.14
+external/bsd/bind/dist/doc/arm/Bv9ARM.ch13.html up to 1.1.1.14
+external/bsd/bind/dist/doc/arm/Bv9ARM.html  up to 1.16
+external/bsd/bind/dist/doc/arm/Bv9ARM.pdf   up to 1.21
+external/bsd/bind/dist/doc/arm/man.arpaname.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.ddns-confgen.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.delv.htmlup to 1.16
+external/bsd/bind/dist/doc/arm/man.dig.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-checkds.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-coverage.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-dsfromkey.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-importkey.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-keyfromlabel.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-keygen.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-revoke.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-settime.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-signzone.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.dnssec-verify.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.genrandom.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.host.htmlup to 1.16
+external/bsd/bind/dist/doc/arm/man.isc-hmac-fixup.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.lwresd.html  up to 1.1.1.8
+external/bsd/bind/dist/doc/arm/man.named-checkconf.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.named-checkzone.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.named-journalprint.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.named-rrchecker.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.named.conf.html up to 1.1.1.8
+external/bsd/bind/dist/doc/arm/man.named.html   up to 1.16
+external/bsd/bind/dist/doc/arm/man.nsec3hash.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.nsupdate.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.rndc-confgen.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.rndc.conf.html up to 1.16
+external/bsd/bind/dist/doc/arm/man.rndc.htmlup to 1.16
+external/bsd/bind/dist/doc/arm/notes.html   up to 1.1.1.14
+external/bsd/bind/dist/doc/arm/notes.pdfup to 1.1.1.14
+external/bsd/bind/dist/doc/arm/notes.xmlup to 1.1.1.14
+external/bsd/bind/dist/lib/dns/api  up to 1.16
+external/bsd/bind/dist/lib/dns/dnssec.c up to 1.14
+external/bsd/bind/dist/lib/dns/message.cup to 1.24
+external/bsd/bind/dist/lib/dns/rootns.c up to 1.13
+external/bsd/bind/dist/lib/dns/tsig.c   up to 1.11
+external/bsd/bind/dist/srcidup to 1.22
+external/bsd/bind/dist/version  up to 1.26
+external/bsd/bind/include/isc/platform.hup to 1.23
+
+	Update BIND to 9.10.5-P2.
+	[mrg, ticket #1489]
+
+doc/3RDPARTY	patch
+external/bsd/wpa/bin/Makefile.inc   up to 1.6
+external/bsd/wpa/bin/hostapd/Makefile   up to 1.10
+external/bsd/wpa/bin/hostapd/aes-xinternal.cup to 1.2
+external/bsd/wpa/bin/hostapd_cli/Makefile   up to 1.3

CVS commit: src/sys/arch

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 06:46:13 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL GENERIC GENERIC_PS2TINY GENERIC_TINY
INSTALL_FLOPPY INSTALL_TINY NET4501 XEN3_DOM0 XEN3_DOMU files.i386
Removed Files:
src/sys/arch/i386/i386: vm86.c

Log Message:
Remove support for vm86 on i386. It is bug-friendly, and there is no point
in having kernel support for this: the instruction set of the CPU is small,
and it can easily be emulated in userland entirely. There are also several
assumptions in the code that are not respected, and the slightest confusion
in the trap frame can lead to ring0 exploits.

vm86 has received zero maintenance. As far as I can tell, it was added
20 years ago in order to make doscmd work. But doscmd has not been
maintained either, and was removed from pkgsrc in 2011. dosbox can be used
instead: it does not require kernel support, and will produce better
results than our flimsy implementation.

Pass 1. (many pieces still in the tree)


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.425 -r1.426 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1164 -r1.1165 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/i386/conf/GENERIC_PS2TINY
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/i386/conf/GENERIC_TINY
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/i386/conf/INSTALL_FLOPPY
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/i386/conf/INSTALL_TINY
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/i386/conf/NET4501
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/i386/conf/XEN3_DOMU
cvs rdiff -u -r1.384 -r1.385 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.51 -r0 src/sys/arch/i386/i386/vm86.c

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.65 src/sys/arch/amd64/conf/ALL:1.66
--- src/sys/arch/amd64/conf/ALL:1.65	Wed Aug  9 18:48:53 2017
+++ src/sys/arch/amd64/conf/ALL	Sat Aug 12 06:46:13 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.65 2017/08/09 18:48:53 maxv Exp $
+# $NetBSD: ALL,v 1.66 2017/08/12 06:46:13 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,14 +17,13 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.65 $"
+#ident		"ALL-$Revision: 1.66 $"
 
 maxusers	64		# estimated number of users
 
 makeoptions	USE_SSP=yes
 
 # CPU-related options.
-#options 	VM86		# virtual 8086 emulation
 #options 	USER_LDT	# user-settable LDT; used by WINE
 options 	X86EMU		# 386 Real Mode emulator
 #options 	PAE		# PAE mode (36 bits physical addressing)

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.425 src/sys/arch/i386/conf/ALL:1.426
--- src/sys/arch/i386/conf/ALL:1.425	Wed Aug  9 18:45:30 2017
+++ src/sys/arch/i386/conf/ALL	Sat Aug 12 06:46:13 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.425 2017/08/09 18:45:30 maxv Exp $
+# $NetBSD: ALL,v 1.426 2017/08/12 06:46:13 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,14 +17,13 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.425 $"
+#ident		"ALL-$Revision: 1.426 $"
 
 maxusers	64		# estimated number of users
 
 makeoptions	USE_SSP=yes
 
 # CPU-related options.
-options 	VM86		# virtual 8086 emulation
 options 	USER_LDT	# user-settable LDT; used by WINE
 options 	X86EMU		# 386 Real Mode emulator
 options 	PAE		# PAE mode (36 bits physical addressing)

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1164 src/sys/arch/i386/conf/GENERIC:1.1165
--- src/sys/arch/i386/conf/GENERIC:1.1164	Wed Aug  9 18:45:30 2017
+++ src/sys/arch/i386/conf/GENERIC	Sat Aug 12 06:46:13 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1164 2017/08/09 18:45:30 maxv Exp $
+# $NetBSD: GENERIC,v 1.1165 2017/08/12 06:46:13 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,12 +22,11 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1164 $"
+#ident		"GENERIC-$Revision: 1.1165 $"
 
 maxusers	64		# estimated number of users
 
 # CPU-related options.
-#options 	VM86		# virtual 8086 emulation
 options 	USER_LDT	# user-settable LDT; used by WINE
 #options 	PAE		# PAE mode (36 bits physical addressing)
 

Index: src/sys/arch/i386/conf/GENERIC_PS2TINY
diff -u src/sys/arch/i386/conf/GENERIC_PS2TINY:1.77 src/sys/arch/i386/conf/GENERIC_PS2TINY:1.78
--- src/sys/arch/i386/conf/GENERIC_PS2TINY:1.77	Sun Feb 26 12:21:15 2017
+++ src/sys/arch/i386/conf/GENERIC_PS2TINY	Sat Aug 12 06:46:13 2017
@@ -1,4 +1,4 @@

CVS commit: src/sys

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 07:21:57 UTC 2017

Modified Files:
src/sys/arch/i386/i386: linux_sigcode.S linux_syscall.c locore.S
vector.S
src/sys/arch/x86/include: cpu.h psl.h
src/sys/arch/x86/x86: sys_machdep.c syscall.c
src/sys/arch/xen/conf: files.compat files.xen
src/sys/arch/xen/x86: xen_ipi.c
src/sys/compat/linux/arch/i386: linux_exec_machdep.c

Log Message:
Remove vm86.

Pass 3.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/i386/linux_sigcode.S
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/i386/i386/linux_syscall.c
cvs rdiff -u -r1.150 -r1.151 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/include/psl.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/x86/sys_machdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/syscall.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/xen/conf/files.compat
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.17 -r1.18 \
src/sys/compat/linux/arch/i386/linux_exec_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/i386/i386/linux_sigcode.S
diff -u src/sys/arch/i386/i386/linux_sigcode.S:1.8 src/sys/arch/i386/i386/linux_sigcode.S:1.9
--- src/sys/arch/i386/i386/linux_sigcode.S:1.8	Mon Apr 28 20:23:24 2008
+++ src/sys/arch/i386/i386/linux_sigcode.S	Sat Aug 12 07:21:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_sigcode.S,v 1.8 2008/04/28 20:23:24 martin Exp $	*/
+/*	$NetBSD: linux_sigcode.S,v 1.9 2017/08/12 07:21:57 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,11 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_sigcode.S,v 1.8 2008/04/28 20:23:24 martin Exp $");
-
-#if defined(_KERNEL_OPT)
-#include "opt_vm86.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: linux_sigcode.S,v 1.9 2017/08/12 07:21:57 maxv Exp $");
 
 #include "assym.h"
 

Index: src/sys/arch/i386/i386/linux_syscall.c
diff -u src/sys/arch/i386/i386/linux_syscall.c:1.52 src/sys/arch/i386/i386/linux_syscall.c:1.53
--- src/sys/arch/i386/i386/linux_syscall.c:1.52	Sat Mar  7 18:50:01 2015
+++ src/sys/arch/i386/i386/linux_syscall.c	Sat Aug 12 07:21:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_syscall.c,v 1.52 2015/03/07 18:50:01 christos Exp $	*/
+/*	$NetBSD: linux_syscall.c,v 1.53 2017/08/12 07:21:57 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,11 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.52 2015/03/07 18:50:01 christos Exp $");
-
-#if defined(_KERNEL_OPT)
-#include "opt_vm86.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.53 2017/08/12 07:21:57 maxv Exp $");
 
 #include 
 #include 

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.150 src/sys/arch/i386/i386/locore.S:1.151
--- src/sys/arch/i386/i386/locore.S:1.150	Thu Aug 10 14:13:45 2017
+++ src/sys/arch/i386/i386/locore.S	Sat Aug 12 07:21:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.150 2017/08/10 14:13:45 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.151 2017/08/12 07:21:57 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,14 +128,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.150 2017/08/10 14:13:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.151 2017/08/12 07:21:57 maxv Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
 #include "opt_modular.h"
 #include "opt_multiboot.h"
 #include "opt_realmem.h"
-#include "opt_vm86.h"
 #include "opt_xen.h"
 
 #include "assym.h"

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.70 src/sys/arch/i386/i386/vector.S:1.71
--- src/sys/arch/i386/i386/vector.S:1.70	Sun Jul 16 14:02:48 2017
+++ src/sys/arch/i386/i386/vector.S	Sat Aug 12 07:21:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.70 2017/07/16 14:02:48 cherry Exp $	*/
+/*	$NetBSD: vector.S,v 1.71 2017/08/12 07:21:57 maxv Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,12 +65,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.70 2017/07/16 14:02:48 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.71 2017/08/12 07:21:57 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
 #include "opt_ipkdb.h"
-#include "opt_vm86.h"
 #include "opt_xen.h"
 #include "opt_dtrace.h"
 

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.75 src/sys/arch/x86/include/cpu.h:1.76
--- src/sys/arch/x86/include/cpu.h:1.75	Sat Jul 22 09:01:46 2017
+++ src/sys/arch/x86/include/cpu.h	Sat Aug 12 07:21:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.75 2017/07/22 09:01:46 maxv Exp $	*/
+/*	$NetBSD: cpu.h,v 1.76 2017/08/12 07:21:57 maxv Exp $	*/
 
 

CVS commit: src

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 07:35:08 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: md.amd64 md.i386
src/sys/arch/i386/include: Makefile mcontext.h segments.h
Removed Files:
src/sys/arch/i386/include: vm86.h

Log Message:
Remove vm86.

Pass 4.


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.173 -r1.174 src/distrib/sets/lists/comp/md.i386
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/i386/include/Makefile
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/include/mcontext.h
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/i386/include/segments.h
cvs rdiff -u -r1.19 -r0 src/sys/arch/i386/include/vm86.h

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

Modified files:

Index: src/distrib/sets/lists/comp/md.amd64
diff -u src/distrib/sets/lists/comp/md.amd64:1.250 src/distrib/sets/lists/comp/md.amd64:1.251
--- src/distrib/sets/lists/comp/md.amd64:1.250	Thu Aug 10 13:39:08 2017
+++ src/distrib/sets/lists/comp/md.amd64	Sat Aug 12 07:35:08 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.250 2017/08/10 13:39:08 maxv Exp $
+# $NetBSD: md.amd64,v 1.251 2017/08/12 07:35:08 maxv Exp $
 
 ./usr/include/amd64comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
@@ -533,7 +533,7 @@
 ./usr/include/i386/tss.h			comp-c-include
 ./usr/include/i386/types.h			comp-c-include
 ./usr/include/i386/varargs.h			comp-obsolete		obsolete
-./usr/include/i386/vm86.h			comp-c-include
+./usr/include/i386/vm86.h			comp-obsolete		obsolete
 ./usr/include/i386/vmparam.h			comp-c-include
 ./usr/include/i386/wchar_limits.h		comp-c-include
 ./usr/include/ieeefp.hcomp-c-include

Index: src/distrib/sets/lists/comp/md.i386
diff -u src/distrib/sets/lists/comp/md.i386:1.173 src/distrib/sets/lists/comp/md.i386:1.174
--- src/distrib/sets/lists/comp/md.i386:1.173	Wed Aug  9 18:58:51 2017
+++ src/distrib/sets/lists/comp/md.i386	Sat Aug 12 07:35:08 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.173 2017/08/09 18:58:51 maxv Exp $
+# $NetBSD: md.i386,v 1.174 2017/08/12 07:35:08 maxv Exp $
 ./usr/include/clang-3.4/__wmmintrin_aes.h	comp-obsolete		obsolete
 ./usr/include/clang-3.4/__wmmintrin_pclmul.h	comp-obsolete		obsolete
 ./usr/include/clang-3.4/ammintrin.h		comp-obsolete		obsolete
@@ -465,7 +465,7 @@
 ./usr/include/i386/tss.h			comp-c-include
 ./usr/include/i386/types.h			comp-c-include
 ./usr/include/i386/varargs.h			comp-obsolete		obsolete
-./usr/include/i386/vm86.h			comp-c-include
+./usr/include/i386/vm86.h			comp-obsolete		obsolete
 ./usr/include/i386/vmparam.h			comp-c-include
 ./usr/include/i386/wchar_limits.h		comp-c-include
 ./usr/include/ieeefp.hcomp-c-include

Index: src/sys/arch/i386/include/Makefile
diff -u src/sys/arch/i386/include/Makefile:1.47 src/sys/arch/i386/include/Makefile:1.48
--- src/sys/arch/i386/include/Makefile:1.47	Wed Aug  9 18:58:51 2017
+++ src/sys/arch/i386/include/Makefile	Sat Aug 12 07:35:08 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.47 2017/08/09 18:58:51 maxv Exp $
+#	$NetBSD: Makefile,v 1.48 2017/08/12 07:35:08 maxv Exp $
 
 INCSDIR= /usr/include/i386
 
@@ -22,7 +22,7 @@ INCS=	ansi.h aout_machdep.h apmvar.h asm
 	segments.h setjmp.h signal.h sljit_machdep.h specialreg.h spkr.h \
 	sysarch.h \
 	trap.h tss.h types.h \
-	vm86.h vmparam.h \
+	vmparam.h \
 	wchar_limits.h
 
 .include 

Index: src/sys/arch/i386/include/mcontext.h
diff -u src/sys/arch/i386/include/mcontext.h:1.12 src/sys/arch/i386/include/mcontext.h:1.13
--- src/sys/arch/i386/include/mcontext.h:1.12	Sat Feb 15 22:20:42 2014
+++ src/sys/arch/i386/include/mcontext.h	Sat Aug 12 07:35:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.12 2014/02/15 22:20:42 dsl Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.13 2017/08/12 07:35:08 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -102,17 +102,6 @@ typedef struct {
 
 #define _UC_UCONTEXT_ALIGN	(~0xf)
 
-#ifdef _KERNEL_OPT
-#include "opt_vm86.h"
-#ifdef VM86
-/*#include */
-#define PSL_VM 0x0002
-#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_UESP] + \
-	((uc)->uc_mcontext.__gregs[_REG_EFL] & PSL_VM ? \
-	 ((uc)->uc_mcontext.__gregs[_REG_SS] << 4) : 0))
-#endif /* VM86 */
-#endif /* _KERNEL_OPT */
-
 #ifndef _UC_MACHINE_SP
 #define _UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_UESP])
 #endif

Index: src/sys/arch/i386/include/segments.h
diff -u src/sys/arch/i386/include/segments.h:1.60 src/sys/arch/i386/include/segments.h:1.61
--- src/sys/arch/i386/include/segments.h:1.60	Sun Jul  2 11:16:50 2017
+++ src/sys/arch/i386/include/segments.h	Sat Aug 12 07:35:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.60 2017/07/02 11:16:50 maxv Exp $	*/
+/*	$NetBSD: segments.h,v 1.61 2017/08/12 07:35:08 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -118,17 +118,8 @@
 
 #define LSEL(s,r)	(((s) << 3) | r | SEL_LDT)	/* a local selector */
 
-#if 

CVS commit: src/share/man/man8

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 08:45:58 UTC 2017

Modified Files:
src/share/man/man8: compat_ibcs2.8

Log Message:
State that this is SVR3, not iBCS2.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man8/compat_ibcs2.8

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/man8/compat_ibcs2.8
diff -u src/share/man/man8/compat_ibcs2.8:1.9 src/share/man/man8/compat_ibcs2.8:1.10
--- src/share/man/man8/compat_ibcs2.8:1.9	Thu Jun  1 02:03:07 2017
+++ src/share/man/man8/compat_ibcs2.8	Sat Aug 12 08:45:58 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: compat_ibcs2.8,v 1.9 2017/06/01 02:03:07 maya Exp $
+.\"	$NetBSD: compat_ibcs2.8,v 1.10 2017/08/12 08:45:58 maxv Exp $
 .\"
 .\" Copyright (c) 1998 Scott Bartram
 .\" Copyright (c) 1995 Frank van der Linden
@@ -32,16 +32,17 @@
 .\"
 .\" Based on compat_linux.8
 .\"
-.Dd June 1, 2017
+.Dd August 12, 2017
 .Dt COMPAT_IBCS2 8
 .Os
 .Sh NAME
 .Nm compat_ibcs2
 .Nd setup procedure for running iBCS2 binaries
 .Sh DESCRIPTION
-.Nx
-supports running Intel Binary Compatibility Standard 2 (iBCS2) binaries.
-This only applies to i386 systems for now.
+Contrary to what its name indicates, compat_ibcs2 is not a compatibility
+for Intel Binary Compatibility Standard 2 (iBCS2) binaries, but rather
+a compatibility for SVR3 binaries.
+This only applies to vax systems.
 Binaries are supported from SCO
 .Ux
 and other systems derived from



CVS commit: src

2017-08-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Aug 12 09:03:28 UTC 2017

Modified Files:
src/libexec/ld.elf_so: rtld.c rtld.h
src/libexec/ld.elf_so/arch/sparc: mdreloc.c
src/libexec/ld.elf_so/arch/sparc64: mdreloc.c
src/sys/arch/sparc/include: elf_machdep.h
src/sys/arch/sparc64/include: elf_machdep.h
src/tests/libexec/ld.elf_so: t_ifunc.c
src/tests/libexec/ld.elf_so/helper_ifunc_dso: h_helper_ifunc.c

Log Message:
Add sparc/sparc64 support for irelative relocations.


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/libexec/ld.elf_so/rtld.c
cvs rdiff -u -r1.130 -r1.131 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.51 -r1.52 src/libexec/ld.elf_so/arch/sparc/mdreloc.c
cvs rdiff -u -r1.64 -r1.65 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sparc/include/elf_machdep.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc64/include/elf_machdep.h
cvs rdiff -u -r1.3 -r1.4 src/tests/libexec/ld.elf_so/t_ifunc.c
cvs rdiff -u -r1.5 -r1.6 \
src/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.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/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.186 src/libexec/ld.elf_so/rtld.c:1.187
--- src/libexec/ld.elf_so/rtld.c:1.186	Thu Aug 10 19:03:25 2017
+++ src/libexec/ld.elf_so/rtld.c	Sat Aug 12 09:03:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.186 2017/08/10 19:03:25 joerg Exp $	 */
+/*	$NetBSD: rtld.c,v 1.187 2017/08/12 09:03:27 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.186 2017/08/10 19:03:25 joerg Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.187 2017/08/12 09:03:27 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -276,7 +276,11 @@ restart:
 	/* First pass: objects with IRELATIVE relocations. */
 	SIMPLEQ_FOREACH(elm, , link) {
 		Obj_Entry * const obj = elm->obj;
-		if (obj->ifunc_remaining) {
+		if (obj->ifunc_remaining
+#ifdef __sparc__
+		|| obj->ifunc_remaining_nonplt
+#endif
+		) {
 			_rtld_call_ifunc(obj, mask, cur_objgen);
 			if (_rtld_objgen != cur_objgen) {
 dbg(("restarting init iteration"));

Index: src/libexec/ld.elf_so/rtld.h
diff -u src/libexec/ld.elf_so/rtld.h:1.130 src/libexec/ld.elf_so/rtld.h:1.131
--- src/libexec/ld.elf_so/rtld.h:1.130	Thu Aug 10 19:03:25 2017
+++ src/libexec/ld.elf_so/rtld.h	Sat Aug 12 09:03:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.h,v 1.130 2017/08/10 19:03:25 joerg Exp $	 */
+/*	$NetBSD: rtld.h,v 1.131 2017/08/12 09:03:27 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -300,6 +300,10 @@ typedef struct Struct_Obj_Entry {
 	size_t		fini_arraysz;	/* # of entries in it */
 	/* IRELATIVE relocations */
 	size_t		ifunc_remaining;
+#ifdef __sparc__
+	/* On SPARC, the PLT variant is called JMP_IREL and counted above. */
+	size_t		ifunc_remaining_nonplt;
+#endif
 	size_t		cxa_refcount;	/* For TLS destructors. */
 #ifdef __ARM_EABI__
 	void		*exidx_start;

Index: src/libexec/ld.elf_so/arch/sparc/mdreloc.c
diff -u src/libexec/ld.elf_so/arch/sparc/mdreloc.c:1.51 src/libexec/ld.elf_so/arch/sparc/mdreloc.c:1.52
--- src/libexec/ld.elf_so/arch/sparc/mdreloc.c:1.51	Thu Aug 10 19:03:26 2017
+++ src/libexec/ld.elf_so/arch/sparc/mdreloc.c	Sat Aug 12 09:03:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdreloc.c,v 1.51 2017/08/10 19:03:26 joerg Exp $	*/
+/*	$NetBSD: mdreloc.c,v 1.52 2017/08/12 09:03:27 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.51 2017/08/10 19:03:26 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.52 2017/08/12 09:03:27 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -220,6 +220,13 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 		if (type == R_TYPE(JMP_SLOT))
 			continue;
 
+		/* IFUNC relocations are handled in _rtld_call_ifunc */
+		if (type == R_TYPE(IRELATIVE)) {
+			if (obj->ifunc_remaining_nonplt == 0)
+obj->ifunc_remaining_nonplt = rela - obj->rela + 1;
+			continue;
+		}
+
 		/* COPY relocs are also handled elsewhere */
 		if (type == R_TYPE(COPY))
 			continue;
@@ -387,7 +394,74 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 int
 _rtld_relocate_plt_lazy(Obj_Entry *obj)
 {
-	return (0);
+	const Elf_Rela *rela;
+
+	if (!obj->relocbase)
+		return 0;
+
+	for (rela = obj->pltrelalim; rela-- > obj->pltrela; ) {
+		if (ELF_R_TYPE(rela->r_info) == R_TYPE(JMP_IREL))
+			obj->ifunc_remaining = obj->pltrelalim - rela + 1;
+	}
+
+	return 0;
+}
+
+static inline void
+_rtld_write_plt(Elf_Word *where, Elf_Addr value)
+{
+	/*
+	 * At the PLT entry pointed at by `where', we now construct
+	 * a direct transfer to the now fully resolved function
+	 * address.  The resulting code in the jump slot is:
+	 *
+	 *	sethi	%hi(roffset), %g1
+	 *	sethi	%hi(addr), %g1
+	 *	jmp	%g1+%lo(addr)
+	 *
+	 * 

CVS commit: src/sys/dev/pci

2017-08-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 12 11:03:47 UTC 2017

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

Log Message:
tag arcmsr scsipi adapter and pci interrupt as MPSAFE. I/O is now done
without taking kernel lock.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pci/arcmsr.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/arcmsr.c
diff -u src/sys/dev/pci/arcmsr.c:1.36 src/sys/dev/pci/arcmsr.c:1.37
--- src/sys/dev/pci/arcmsr.c:1.36	Sun Jun 19 21:12:44 2016
+++ src/sys/dev/pci/arcmsr.c	Sat Aug 12 11:03:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: arcmsr.c,v 1.36 2016/06/19 21:12:44 dholland Exp $ */
+/*	$NetBSD: arcmsr.c,v 1.37 2017/08/12 11:03:47 mlelstv Exp $ */
 /*	$OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */
 
 /*
@@ -21,7 +21,7 @@
 #include "bio.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.36 2016/06/19 21:12:44 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.37 2017/08/12 11:03:47 mlelstv Exp $");
 
 #include 
 #include 
@@ -241,6 +241,7 @@ arc_attach(device_t parent, device_t sel
 	adapt->adapt_max_periph = adapt->adapt_openings;
 	adapt->adapt_minphys = arc_minphys;		
 	adapt->adapt_request = arc_scsi_cmd;
+	adapt->adapt_flags = SCSIPI_ADAPT_MPSAFE;
 
 	memset(chan, 0, sizeof(*chan));
 	chan->chan_adapter = adapt;
@@ -625,6 +626,8 @@ arc_map_pci_resources(device_t self, str
 		goto unmap;
 	}
 
+	pci_intr_setattr(pa->pa_pc, , PCI_INTR_MPSAFE, true);
+
 	sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO,
 	arc_intr, sc);
 	if (sc->sc_ih == NULL) {



CVS commit: src/etc

2017-08-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 12 11:41:21 UTC 2017

Modified Files:
src/etc: MAKEDEV.tmpl

Log Message:
add dial-out device node for plcom


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/etc/MAKEDEV.tmpl

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.184 src/etc/MAKEDEV.tmpl:1.185
--- src/etc/MAKEDEV.tmpl:1.184	Thu Jun  8 03:42:37 2017
+++ src/etc/MAKEDEV.tmpl	Sat Aug 12 11:41:21 2017
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.184 2017/06/08 03:42:37 kre Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.185 2017/08/12 11:41:21 jmcneill Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1985,6 +1985,7 @@ epcom[0-9]*)
 plcom[0-9]*)
 	unit=${i#plcom}
 	mkdev plcom$unit c %plcom_chr% $unit "" "" $u_uucp
+	mkdev dplcom$unit c %plcom_chr% $(($unit + $dialout)) "" "" $u_uucp
 	;;
 
 wmcom[0-9]*)



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

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 12:33:31 UTC 2017

Modified Files:
src/sys/arch/x86/include: psl.h

Log Message:
Don't include opt_vm86.h.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/psl.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/psl.h
diff -u src/sys/arch/x86/include/psl.h:1.9 src/sys/arch/x86/include/psl.h:1.10
--- src/sys/arch/x86/include/psl.h:1.9	Sat Aug 12 07:21:57 2017
+++ src/sys/arch/x86/include/psl.h	Sat Aug 12 12:33:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.9 2017/08/12 07:21:57 maxv Exp $	*/
+/*	$NetBSD: psl.h,v 1.10 2017/08/12 12:33:31 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -62,11 +62,6 @@
 #define	PSL_MBZ		0xffc08028	/* must be zero bits */
 
 #define	PSL_USERSET	(PSL_MBO | PSL_I)
-#ifdef i386
-#if defined(_KERNEL_OPT)
-#include "opt_vm86.h"
-#endif
-#endif
 #define	PSL_USERSTATIC	(PSL_MBO | PSL_MBZ | PSL_I | PSL_IOPL | PSL_NT | PSL_VM | PSL_VIF | PSL_VIP)
 #define PSL_USER	(PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | \
 PSL_T | PSL_V | PSL_D | PSL_AC)



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

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 13:11:23 UTC 2017

Modified Files:
src/sys/arch/i386/include: frame.h

Log Message:
Remove the vm86 fields from the trap frame. It seems to me that we could
now remove the '-16' when initializing pcb_esp0.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/i386/include/frame.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/i386/include/frame.h
diff -u src/sys/arch/i386/include/frame.h:1.36 src/sys/arch/i386/include/frame.h:1.37
--- src/sys/arch/i386/include/frame.h:1.36	Wed Jun 14 00:40:05 2017
+++ src/sys/arch/i386/include/frame.h	Sat Aug 12 13:11:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.36 2017/06/14 00:40:05 chs Exp $	*/
+/*	$NetBSD: frame.h,v 1.37 2017/08/12 13:11:23 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -100,11 +100,6 @@ struct trapframe {
 	/* below used when transitting rings (e.g. user to kernel) */
 	int	tf_esp;
 	int	tf_ss;
-	/* below used when switching out of VM86 mode */
-	int	tf_vm86_es;
-	int	tf_vm86_ds;
-	int	tf_vm86_fs;
-	int	tf_vm86_gs;
 };
 
 /*



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

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 13:16:14 UTC 2017

Modified Files:
src/sys/arch/i386/i386: genassym.cf machdep.c

Log Message:
Remove references to PSL_VM (implicitly vm86).


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.789 -r1.790 src/sys/arch/i386/i386/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/i386/i386/genassym.cf
diff -u src/sys/arch/i386/i386/genassym.cf:1.102 src/sys/arch/i386/i386/genassym.cf:1.103
--- src/sys/arch/i386/i386/genassym.cf:1.102	Tue Aug  8 08:04:05 2017
+++ src/sys/arch/i386/i386/genassym.cf	Sat Aug 12 13:16:14 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.102 2017/08/08 08:04:05 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.103 2017/08/12 13:16:14 maxv Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -355,7 +355,6 @@ define	IREENT_MAGIC		IREENT_MAGIC
 define	PSL_AC			PSL_AC
 define	PSL_MBO			PSL_MBO
 define	PSL_ID			PSL_ID
-define	PSL_VM			PSL_VM
 define	PSL_I			PSL_I
 
 define	MTX_IPL			offsetof(struct kmutex, u.s.mtxs_ipl)

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.789 src/sys/arch/i386/i386/machdep.c:1.790
--- src/sys/arch/i386/i386/machdep.c:1.789	Sat Aug 12 07:07:53 2017
+++ src/sys/arch/i386/i386/machdep.c	Sat Aug 12 13:16:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.789 2017/08/12 07:07:53 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.790 2017/08/12 13:16:14 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.789 2017/08/12 07:07:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.790 2017/08/12 13:16:14 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -647,8 +647,6 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	? _UC_SETSTACK : _UC_CLRSTACK;
 	memset(_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
 
-	if (tf->tf_eflags & PSL_VM)
-		(*p->p_emul->e_syscall_intern)(p);
 	sendsig_reset(l, sig);
 
 	mutex_exit(p->p_lock);



CVS commit: [jdolecek-ncq] src/sys/dev/ic

2017-08-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Aug 12 13:41:46 UTC 2017

Modified Files:
src/sys/dev/ic [jdolecek-ncq]: wdc.c

Log Message:
remove debug printf


To generate a diff of this commit:
cvs rdiff -u -r1.283.2.11 -r1.283.2.12 src/sys/dev/ic/wdc.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/ic/wdc.c
diff -u src/sys/dev/ic/wdc.c:1.283.2.11 src/sys/dev/ic/wdc.c:1.283.2.12
--- src/sys/dev/ic/wdc.c:1.283.2.11	Sat Aug 12 09:52:28 2017
+++ src/sys/dev/ic/wdc.c	Sat Aug 12 13:41:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc.c,v 1.283.2.11 2017/08/12 09:52:28 jdolecek Exp $ */
+/*	$NetBSD: wdc.c,v 1.283.2.12 2017/08/12 13:41:46 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.283.2.11 2017/08/12 09:52:28 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.283.2.12 2017/08/12 13:41:46 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -1254,7 +1254,6 @@ wdcwait(struct ata_channel *chp, int mas
  */
 ata_channel_freeze(chp);
 wakeup(>ch_thread);
-printf("wdcwait_thr");
 return(WDCWAIT_THR);
 			}
 		}



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

2017-08-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 12 23:42:52 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_gpio.c

Log Message:
Add support for deprecated pin configuration and multiplex bindings.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_gpio.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/sunxi/sunxi_gpio.c
diff -u src/sys/arch/arm/sunxi/sunxi_gpio.c:1.9 src/sys/arch/arm/sunxi/sunxi_gpio.c:1.10
--- src/sys/arch/arm/sunxi/sunxi_gpio.c:1.9	Sun Jul 23 10:16:08 2017
+++ src/sys/arch/arm/sunxi/sunxi_gpio.c	Sat Aug 12 23:42:52 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gpio.c,v 1.9 2017/07/23 10:16:08 jmcneill Exp $ */
+/* $NetBSD: sunxi_gpio.c,v 1.10 2017/08/12 23:42:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.9 2017/07/23 10:16:08 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.10 2017/08/12 23:42:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -350,12 +350,87 @@ static struct fdtbus_gpio_controller_fun
 	.write = sunxi_gpio_write,
 };
 
+static const char *
+sunxi_pinctrl_parse_function(int phandle)
+{
+	const char *function;
+
+	function = fdtbus_get_string(phandle, "function");
+	if (function != NULL)
+		return function;
+
+	return fdtbus_get_string(phandle, "allwinner,function");
+}
+
+static const char *
+sunxi_pinctrl_parse_pins(int phandle, int *pins_len)
+{
+	int len;
+
+	len = OF_getproplen(phandle, "pins");
+	if (len > 0) {
+		*pins_len = len;
+		return fdtbus_get_string(phandle, "pins");
+	}
+
+	len = OF_getproplen(phandle, "allwinner,pins");
+	if (len > 0) {
+		*pins_len = len;
+		return fdtbus_get_string(phandle, "allwinner,pins");
+	}
+
+	return NULL;
+}
+
+static int
+sunxi_pinctrl_parse_bias(int phandle)
+{
+	u_int pull;
+	int bias = -1;
+
+	if (of_hasprop(phandle, "bias-disable"))
+		bias = 0;
+	else if (of_hasprop(phandle, "bias-pull-up"))
+		bias = GPIO_PIN_PULLUP;
+	else if (of_hasprop(phandle, "bias-pull-down"))
+		bias = GPIO_PIN_PULLDOWN;
+	else if (of_getprop_uint32(phandle, "allwinner,pull", ) == 0) {
+		switch (pull) {
+		case 0:
+			bias = 0;
+			break;
+		case 1:
+			bias = GPIO_PIN_PULLUP;
+			break;
+		case 2:
+			bias = GPIO_PIN_PULLDOWN;
+			break;
+		}
+	}
+
+	return bias;
+}
+
+static int
+sunxi_pinctrl_parse_drive_strength(int phandle)
+{
+	int val;
+
+	if (of_getprop_uint32(phandle, "drive-strength", ) == 0)
+		return val;
+
+	if (of_getprop_uint32(phandle, "allwinner,drive", ) == 0)
+		return (val + 1) * 10;
+
+	return -1;
+}
+
 static int
 sunxi_pinctrl_set_config(device_t dev, const void *data, size_t len)
 {
 	struct sunxi_gpio_softc * const sc = device_private(dev);
 	const struct sunxi_gpio_pins *pin_def;
-	u_int drive_strength;
+	int pins_len;
 
 	if (len != 4)
 		return -1;
@@ -364,22 +439,23 @@ sunxi_pinctrl_set_config(device_t dev, c
 
 	/*
 	 * Required: pins, function
-	 * Optional: bias-disable, bias-pull-up, bias-pull-down, drive-strength
+	 * Optional: bias, drive strength
 	 */
 
-	const char *function = fdtbus_get_string(phandle, "function");
+	const char *function = sunxi_pinctrl_parse_function(phandle);
 	if (function == NULL)
 		return -1;
-	int pins_len = OF_getproplen(phandle, "pins");
-	if (pins_len <= 0)
+	const char *pins = sunxi_pinctrl_parse_pins(phandle, _len);
+	if (pins == NULL)
 		return -1;
-	const char *pins = fdtbus_get_string(phandle, "pins");
+
+	const int bias = sunxi_pinctrl_parse_bias(phandle);
+	const int drive_strength = sunxi_pinctrl_parse_drive_strength(phandle);
 
 	mutex_enter(>sc_lock);
 
-	for (pins = fdtbus_get_string(phandle, "pins");
-	 pins_len > 0;
-	 pins_len -= strlen(pins) + 1, pins += strlen(pins) + 1) {
+	for (; pins_len > 0;
+	pins_len -= strlen(pins) + 1, pins += strlen(pins) + 1) {
 		pin_def = sunxi_gpio_lookup_byname(sc, pins);
 		if (pin_def == NULL) {
 			aprint_error_dev(dev, "unknown pin name '%s'\n", pins);
@@ -388,14 +464,10 @@ sunxi_pinctrl_set_config(device_t dev, c
 		if (sunxi_gpio_setfunc(sc, pin_def, function) != 0)
 			continue;
 
-		if (of_hasprop(phandle, "bias-disable"))
-			sunxi_gpio_setpull(sc, pin_def, 0);
-		else if (of_hasprop(phandle, "bias-pull-up"))
-			sunxi_gpio_setpull(sc, pin_def, GPIO_PIN_PULLUP);
-		else if (of_hasprop(phandle, "bias-pull-down"))
-			sunxi_gpio_setpull(sc, pin_def, GPIO_PIN_PULLDOWN);
+		if (bias != -1)
+			sunxi_gpio_setpull(sc, pin_def, bias);
 
-		if (of_getprop_uint32(phandle, "drive-strength", _strength) == 0)
+		if (drive_strength != -1)
 			sunxi_gpio_setdrv(sc, pin_def, drive_strength);
 	}
 



CVS commit: src/lib/libc/rpc

2017-08-12 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sun Aug 13 01:08:41 UTC 2017

Modified Files:
src/lib/libc/rpc: rpcb_st_xdr.c

Log Message:
PR lib/15802: Shuuichirou Murata: Add missing xdr_rpcbs_rmtcalllist_ptr

There was a missing call to xdr_rpcbs_rmtcalllist_ptr in xdr_rpcb_stat.
This fixes issues with RPCBPROC_GETSTAT not working correctly with
systems that correctly implement the XDR encode/decode routine.

XXX: pullup-8
XXX: pullup-7
XXX: pullup-6


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/rpc/rpcb_st_xdr.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/rpc/rpcb_st_xdr.c
diff -u src/lib/libc/rpc/rpcb_st_xdr.c:1.11 src/lib/libc/rpc/rpcb_st_xdr.c:1.12
--- src/lib/libc/rpc/rpcb_st_xdr.c:1.11	Wed May  3 21:39:27 2017
+++ src/lib/libc/rpc/rpcb_st_xdr.c	Sun Aug 13 01:08:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcb_st_xdr.c,v 1.11 2017/05/03 21:39:27 christos Exp $	*/
+/*	$NetBSD: rpcb_st_xdr.c,v 1.12 2017/08/13 01:08:41 ginsbach Exp $	*/
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -42,7 +42,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: rpcb_st_xdr.c,v 1.11 2017/05/03 21:39:27 christos Exp $");
+__RCSID("$NetBSD: rpcb_st_xdr.c,v 1.12 2017/08/13 01:08:41 ginsbach Exp $");
 #endif
 
 #include "namespace.h"
@@ -258,6 +258,9 @@ xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp
 	if (!xdr_rpcbs_addrlist_ptr(xdrs, >addrinfo)) {
 		return (FALSE);
 	}
+	if (!xdr_rpcbs_rmtcalllist_ptr(xdrs, >rmtinfo)) {
+		return (FALSE);
+	}
 	return (TRUE);
 }
 



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

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 12:48:47 UTC 2017

Modified Files:
src/sys/arch/i386/include: pcb.h

Log Message:
Remove the vm86 fields from the pcb.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/i386/include/pcb.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/i386/include/pcb.h
diff -u src/sys/arch/i386/include/pcb.h:1.55 src/sys/arch/i386/include/pcb.h:1.56
--- src/sys/arch/i386/include/pcb.h:1.55	Thu Feb 23 03:34:22 2017
+++ src/sys/arch/i386/include/pcb.h	Sat Aug 12 12:48:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.55 2017/02/23 03:34:22 kamil Exp $	*/
+/*	$NetBSD: pcb.h,v 1.56 2017/08/12 12:48:47 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2009 The NetBSD Foundation, Inc.
@@ -89,13 +89,10 @@ struct pcb {
 	struct segment_descriptor pcb_fsd;	/* %fs descriptor */
 	struct segment_descriptor pcb_gsd; 	/* %gs descriptor */
 	void 	*pcb_onfault;		/* copyin/out fault recovery */
-	int	vm86_eflags;		/* virtual eflags for vm86 mode */
-	int	vm86_flagmask;		/* flag mask for vm86 mode */
-	void	*vm86_userp;		/* XXX performance hack */
 	char	*pcb_iomap;		/* I/O permission bitmap */
 	struct dbreg	*pcb_dbregs;	/* CPU Debug Registers */
 
-	int	not_used[14];
+	int	not_used[17];
 
 	/* floating point state */
 	struct cpu_info	*pcb_fpcpu;	/* cpu holding our fp state. */



CVS commit: src/sys/arch/evbarm/rpi

2017-08-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 12 11:44:26 UTC 2017

Modified Files:
src/sys/arch/evbarm/rpi: rpi_machdep.c

Log Message:
For boards with bluetooth, use AUX UART for console and PLCOM for bt.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/evbarm/rpi/rpi_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/evbarm/rpi/rpi_machdep.c
diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.78 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.79
--- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.78	Tue Aug  1 00:01:56 2017
+++ src/sys/arch/evbarm/rpi/rpi_machdep.c	Sat Aug 12 11:44:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_machdep.c,v 1.78 2017/08/01 00:01:56 jmcneill Exp $	*/
+/*	$NetBSD: rpi_machdep.c,v 1.79 2017/08/12 11:44:26 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.78 2017/08/01 00:01:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.79 2017/08/12 11:44:26 jmcneill Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep.
 #include "bcmspi.h"
 #include "bsciic.h"
 #include "plcom.h"
+#include "com.h"
 #include "genfb.h"
 #include "ukbd.h"
 
@@ -97,6 +98,10 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep.
 #include 
 #endif
 
+#if NCOM > 0
+#include 
+#endif
+
 #if NGENFB > 0
 #include 
 #include 
@@ -182,6 +187,7 @@ static struct plcom_instance rpi_pi = {
 static struct __aligned(16) {
 	struct vcprop_buffer_hdr	vb_hdr;
 	struct vcprop_tag_clockrate	vbt_uartclockrate;
+	struct vcprop_tag_clockrate	vbt_coreclockrate;
 	struct vcprop_tag_boardrev	vbt_boardrev;
 	struct vcprop_tag end;
 } vb_uart = {
@@ -197,6 +203,14 @@ static struct __aligned(16) {
 		},
 		.id = VCPROP_CLK_UART
 	},
+	.vbt_coreclockrate = {
+		.tag = {
+			.vpt_tag = VCPROPTAG_GET_CLOCKRATE,
+			.vpt_len = VCPROPTAG_LEN(vb_uart.vbt_coreclockrate),
+			.vpt_rcode = VCPROPTAG_REQUEST
+		},
+		.id = VCPROP_CLK_CORE
+	},
 	.vbt_boardrev = {
 		.tag = {
 			.vpt_tag = VCPROPTAG_GET_BOARDREVISION,
@@ -466,9 +480,15 @@ rpi_uartinit(void)
 
 	if (vcprop_tag_success_p(_uart.vbt_boardrev.tag)) {
 		if (rpi_rev_has_btwifi(vb_uart.vbt_boardrev.rev)) {
+#if NCOM > 0
+			/* Enable AUX UART on GPIO header */
+			bcm2835gpio_function_select(14, BCM2835_GPIO_ALT5);
+			bcm2835gpio_function_select(15, BCM2835_GPIO_ALT5);
+#else
 			/* Enable UART0 (PL011) on GPIO header */
 			bcm2835gpio_function_select(14, BCM2835_GPIO_ALT0);
 			bcm2835gpio_function_select(15, BCM2835_GPIO_ALT0);
+#endif
 		}
 	}
 
@@ -501,9 +521,15 @@ rpi_pinctrl(void)
 #endif
 
 	if (rpi_rev_has_btwifi(vb.vbt_boardrev.rev)) {
+#if NCOM > 0
+		/* Enable UART0 (PL011) on BT */
+		bcm2835gpio_function_select(32, BCM2835_GPIO_ALT3);
+		bcm2835gpio_function_select(33, BCM2835_GPIO_ALT3);
+#else
 		/* Enable AUX UART on BT */
 		bcm2835gpio_function_select(32, BCM2835_GPIO_ALT5);
 		bcm2835gpio_function_select(33, BCM2835_GPIO_ALT5);
+#endif
 		bcm2835gpio_function_setpull(32, BCM2835_GPIO_GPPUD_PULLOFF);
 		bcm2835gpio_function_setpull(33, BCM2835_GPIO_GPPUD_PULLUP);
 		bcm2835gpio_function_select(43, BCM2835_GPIO_ALT0);
@@ -814,16 +840,9 @@ initarm(void *arg)
 	return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0);
 }
 
-void
-consinit(void)
+static void
+consinit_plcom(void)
 {
-	static int consinit_called = 0;
-
-	if (consinit_called != 0)
-		return;
-
-	consinit_called = 1;
-
 #if (NPLCOM > 0 && defined(PLCONSOLE))
 	/*
 	 * Initialise the diagnostic serial console
@@ -833,8 +852,48 @@ consinit(void)
 
 	plcomcnattach(_pi, plcomcnspeed, uart_clk,
 	plcomcnmode, PLCOMCNUNIT);
+#endif
+}
+
+static void
+consinit_com(void)
+{
+#if NCOM > 0
+	bus_space_tag_t iot = _a4x_bs_tag;
+	const bus_addr_t addr = BCM2835_AUX_UART_BASE;
+	const int speed = B115200;
+	u_int freq = 0;
+	const u_int flags = TTYDEF_CFLAG;
+
+	if (vcprop_tag_success_p(_uart.vbt_coreclockrate.tag))
+		freq = vb.vbt_coreclockrate.rate * 2;
+
+	comcnattach(iot, addr, speed, freq, COM_TYPE_BCMAUXUART, flags);
+#endif
+}
+
+void
+consinit(void)
+{
+	static int consinit_called = 0;
+	bool use_auxuart = false;
 
+	if (consinit_called != 0)
+		return;
+
+	consinit_called = 1;
+
+#if NCOM > 0
+	if (vcprop_tag_success_p(_uart.vbt_boardrev.tag) &&
+	rpi_rev_has_btwifi(vb_uart.vbt_boardrev.rev)) {
+		use_auxuart = true;
+	}
 #endif
+
+	if (use_auxuart)
+		consinit_com();
+	else
+		consinit_plcom();
 }
 
 #ifdef KGDB



CVS commit: src/etc/bluetooth

2017-08-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 12 11:45:20 UTC 2017

Modified Files:
src/etc/bluetooth: btattach.conf

Log Message:
Update Raspberry Pi 3 example to use dplcom0 instead of dty00


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/bluetooth/btattach.conf

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

Modified files:

Index: src/etc/bluetooth/btattach.conf
diff -u src/etc/bluetooth/btattach.conf:1.2 src/etc/bluetooth/btattach.conf:1.3
--- src/etc/bluetooth/btattach.conf:1.2	Fri Aug 11 11:57:05 2017
+++ src/etc/bluetooth/btattach.conf	Sat Aug 12 11:45:20 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: btattach.conf,v 1.2 2017/08/11 11:57:05 jmcneill Exp $
+#	$NetBSD: btattach.conf,v 1.3 2017/08/12 11:45:20 jmcneill Exp $
 #
 # Bluetooth serial devices configuration.
 #
@@ -12,4 +12,4 @@
 #digi		/dev/tty01	57600
 
 # Raspberry Pi 3 Bluetooth UART
-#bcm43xx-3wire	/dev/dty00	921600		-FPi 115200
+#bcm43xx-3wire	/dev/dplcom0	921600		-FPi 115200



CVS commit: [jdolecek-ncq] src/sys/dev

2017-08-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Aug 12 14:41:54 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq ata.c ata_wdc.c atavar.h
src/sys/dev/ic [jdolecek-ncq]: mvsata.c wdc.c
src/sys/dev/scsipi [jdolecek-ncq]: atapi_wdc.c

Log Message:
convert the atabus thread to use the channel lock and a condvar, adjust
code which sets the relevant channel flags to take the lock while doing so


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.33 -r1.1.2.34 src/sys/dev/ata/TODO.ncq
cvs rdiff -u -r1.132.8.25 -r1.132.8.26 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.105.6.7 -r1.105.6.8 src/sys/dev/ata/ata_wdc.c
cvs rdiff -u -r1.92.8.22 -r1.92.8.23 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.35.6.20 -r1.35.6.21 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.283.2.12 -r1.283.2.13 src/sys/dev/ic/wdc.c
cvs rdiff -u -r1.123.4.11 -r1.123.4.12 src/sys/dev/scsipi/atapi_wdc.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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.33 src/sys/dev/ata/TODO.ncq:1.1.2.34
--- src/sys/dev/ata/TODO.ncq:1.1.2.33	Sat Aug 12 09:52:28 2017
+++ src/sys/dev/ata/TODO.ncq	Sat Aug 12 14:41:54 2017
@@ -15,8 +15,6 @@ active system? make sure to not trigger 
 kill active transfers after software drive reset - race timeout vs.
 error recovery
 
-atabus_thread() protect run by mutex/condvar
-
 Other random notes (do outside the NCQ branch):
 -
 implement support for PM FIS-based switching, remove restriction in atastart()

Index: src/sys/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.25 src/sys/dev/ata/ata.c:1.132.8.26
--- src/sys/dev/ata/ata.c:1.132.8.25	Sat Aug 12 09:52:28 2017
+++ src/sys/dev/ata/ata.c	Sat Aug 12 14:41:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.132.8.25 2017/08/12 09:52:28 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.132.8.26 2017/08/12 14:41:54 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.25 2017/08/12 09:52:28 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.26 2017/08/12 14:41:54 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -131,7 +131,7 @@ static void atabusconfig_thread(void *);
 
 static void ata_channel_idle(struct ata_channel *);
 static void ata_activate_xfer_locked(struct ata_channel *, struct ata_xfer *);
-
+static void ata_channel_freeze_locked(struct ata_channel *);
 /*
  * atabus_init:
  *
@@ -322,6 +322,7 @@ void
 ata_channel_init(struct ata_channel *chp)
 {
 	mutex_init(>ch_lock, MUTEX_DEFAULT, IPL_BIO);
+	cv_init(>ch_thr_idle, "atath");
 }
 
 /*
@@ -347,6 +348,7 @@ void
 ata_channel_destroy(struct ata_channel *chp)
 {
 	mutex_destroy(>ch_lock);
+	cv_destroy(>ch_thr_idle);
 }
 
 /*
@@ -369,12 +371,12 @@ atabusconfig(struct atabus_softc *atabus
 	struct ata_channel *chp = atabus_sc->sc_chan;
 	struct atac_softc *atac = chp->ch_atac;
 	struct atabus_initq *atabus_initq = NULL;
-	int i, s, error;
+	int i, error;
 
 	/* we are in the atabus's thread context */
-	s = splbio();
+	mutex_enter(>ch_lock);
 	chp->ch_flags |= ATACH_TH_RUN;
-	splx(s);
+	mutex_exit(>ch_lock);
 
 	/*
 	 * Probe for the drives attached to controller, unless a PMP
@@ -391,9 +393,9 @@ atabusconfig(struct atabus_softc *atabus
 	}
 
 	/* next operations will occurs in a separate thread */
-	s = splbio();
+	mutex_enter(>ch_lock);
 	chp->ch_flags &= ~ATACH_TH_RUN;
-	splx(s);
+	mutex_exit(>ch_lock);
 
 	/* Make sure the devices probe in atabus order to avoid jitter. */
 	mutex_enter(_qlock);
@@ -405,6 +407,8 @@ atabusconfig(struct atabus_softc *atabus
 	}
 	mutex_exit(_qlock);
 
+	mutex_enter(>ch_lock);
+
 	/* If no drives, abort here */
 	if (chp->ch_drive == NULL)
 		goto out;
@@ -419,6 +423,8 @@ atabusconfig(struct atabus_softc *atabus
 	if (chp->ch_flags & ATACH_SHUTDOWN)
 		goto out;
 
+	mutex_exit(>ch_lock);
+
 	if ((error = kthread_create(PRI_NONE, 0, NULL, atabusconfig_thread,
 	atabus_sc, _cfg_lwp,
 	"%scnf", device_xname(atac->atac_dev))) != 0)
@@ -427,6 +433,8 @@ atabusconfig(struct atabus_softc *atabus
 	return;
 
  out:
+	mutex_exit(>ch_lock);
+
 	mutex_enter(_qlock);
 	TAILQ_REMOVE(_initq_head, atabus_initq, atabus_initq);
 	cv_broadcast(_qcv);
@@ -578,9 +586,9 @@ atabus_thread(void *arg)
 	struct ata_channel *chp = sc->sc_chan;
 	struct ata_queue *chq = chp->ch_queue;
 	struct ata_xfer *xfer;
-	int i, s;
+	int i;
 
-	s = splbio();
+	mutex_enter(>ch_lock);
 	chp->ch_flags |= ATACH_TH_RUN;
 
 	/*
@@ -594,32 +602,36 @@ atabus_thread(void *arg)
 		chp->ch_drive[i].drive_flags = 0;
 		chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
 	}
-	splx(s);
+	mutex_exit(>ch_lock);
 
 	atabusconfig(sc);
 
-	s = splbio();
+	mutex_enter(>ch_lock);
 	for (;;) {
 		if ((chp->ch_flags & (ATACH_TH_RESET | ATACH_SHUTDOWN)) == 0 &&
 		(chq->queue_active 

CVS commit: [jdolecek-ncq] src/sys/dev/ata

2017-08-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Aug 12 15:08:38 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: ata.c

Log Message:
take atabus_qlock while inserting into atabus_initq_head to avoid race
in attach and rescan; just cleanup, noticed this while doing the thread
locking, don't think there is realistic way to trigger this


To generate a diff of this commit:
cvs rdiff -u -r1.132.8.26 -r1.132.8.27 src/sys/dev/ata/ata.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.26 src/sys/dev/ata/ata.c:1.132.8.27
--- src/sys/dev/ata/ata.c:1.132.8.26	Sat Aug 12 14:41:54 2017
+++ src/sys/dev/ata/ata.c	Sat Aug 12 15:08:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.132.8.26 2017/08/12 14:41:54 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.132.8.27 2017/08/12 15:08:38 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.26 2017/08/12 14:41:54 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.27 2017/08/12 15:08:38 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -711,7 +711,9 @@ atabus_attach(device_t parent, device_t 
 
 	initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
 	initq->atabus_sc = sc;
+	mutex_enter(_qlock);
 	TAILQ_INSERT_TAIL(_initq_head, initq, atabus_initq);
+	mutex_exit(_qlock);
 	config_pending_incr(sc->sc_dev);
 
 	if ((error = kthread_create(PRI_NONE, 0, NULL, atabus_thread, sc,
@@ -2390,7 +2392,9 @@ atabus_rescan(device_t self, const char 
 
 	initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
 	initq->atabus_sc = sc;
+	mutex_enter(_qlock);
 	TAILQ_INSERT_TAIL(_initq_head, initq, atabus_initq);
+	mutex_exit(_qlock);
 	config_pending_incr(sc->sc_dev);
 
 	mutex_enter(>ch_lock);



CVS commit: [netbsd-7] src/doc

2017-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 12 19:08:20 UTC 2017

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

Log Message:
Ammend ticket #1475


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

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.37 src/doc/CHANGES-7.2:1.1.2.38
--- src/doc/CHANGES-7.2:1.1.2.37	Sat Aug 12 06:05:16 2017
+++ src/doc/CHANGES-7.2	Sat Aug 12 19:08:20 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.37 2017/08/12 06:05:16 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.38 2017/08/12 19:08:20 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -2758,7 +2758,7 @@ sys/dev/ic/bwi.c1.32
 sys/compat/svr4/svr4_lwp.c			1.20
 sys/compat/svr4/svr4_signal.c			1.67
 sys/compat/svr4/svr4_stream.c			1.89-1.91 via patch
-sys/compat/svr4_32/svr4_32_signal.c		1.29
+sys/compat/svr4_32/svr4_32_signal.c		1.29-1.30
 
 	Fix some of the multitudinous holes in svr4 streams.
 	Zero stack data before copyout.



CVS commit: [netbsd-7] src/sys/compat/svr4_32

2017-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 12 19:07:51 UTC 2017

Modified Files:
src/sys/compat/svr4_32 [netbsd-7]: svr4_32_signal.c

Log Message:
Also pull up rev1.30 (accidently missing in ticket #1475)


To generate a diff of this commit:
cvs rdiff -u -r1.26.62.1 -r1.26.62.2 src/sys/compat/svr4_32/svr4_32_signal.c

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

Modified files:

Index: src/sys/compat/svr4_32/svr4_32_signal.c
diff -u src/sys/compat/svr4_32/svr4_32_signal.c:1.26.62.1 src/sys/compat/svr4_32/svr4_32_signal.c:1.26.62.2
--- src/sys/compat/svr4_32/svr4_32_signal.c:1.26.62.1	Sat Aug 12 04:00:50 2017
+++ src/sys/compat/svr4_32/svr4_32_signal.c	Sat Aug 12 19:07:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_signal.c,v 1.26.62.1 2017/08/12 04:00:50 snj Exp $	 */
+/*	$NetBSD: svr4_32_signal.c,v 1.26.62.2 2017/08/12 19:07:51 martin Exp $	 */
 
 /*-
  * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.62.1 2017/08/12 04:00:50 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.62.2 2017/08/12 19:07:51 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_svr4.h"
@@ -397,16 +397,16 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = (sig_t)SCARG(uap, handler);
 		sigemptyset(_mask);
 		nbsa.sa_flags = 0;
-		error = sigaction1(l, signum, , , NULL, 0);
+		error = sigaction1(l, native_signo, , , NULL, 0);
 		if (error)
-			return (error);
+			return error;
 		*retval = (u_int)(u_long)obsa.sa_handler;
-		return (0);
+		return 0;
 
 	case SVR4_SIGHOLD_MASK:
 	sighold:
 		sigemptyset();
-		sigaddset(, signum);
+		sigaddset(, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_BLOCK, , 0);
 		mutex_exit(p->p_lock);
@@ -414,7 +414,7 @@ svr4_32_sys_signal(struct lwp *l, const 
 
 	case SVR4_SIGRELSE_MASK:
 		sigemptyset();
-		sigaddset(, signum);
+		sigaddset(, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_UNBLOCK, , 0);
 		mutex_exit(p->p_lock);
@@ -424,17 +424,17 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = SIG_IGN;
 		sigemptyset(_mask);
 		nbsa.sa_flags = 0;
-		return (sigaction1(l, signum, , 0, NULL, 0));
+		return sigaction1(l, native_signo, , 0, NULL, 0);
 
 	case SVR4_SIGPAUSE_MASK:
 		mutex_enter(p->p_lock);
 		ss = l->l_sigmask;
 		mutex_exit(p->p_lock);
-		sigdelset(, signum);
-		return (sigsuspend1(l, ));
+		sigdelset(, native_signo);
+		return sigsuspend1(l, );
 
 	default:
-		return (ENOSYS);
+		return ENOSYS;
 	}
 }
 



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

2017-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 12 19:12:04 UTC 2017

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

Log Message:
Ammend ticket #1475


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

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.54 src/doc/CHANGES-7.0.3:1.1.2.55
--- src/doc/CHANGES-7.0.3:1.1.2.54	Sat Aug 12 05:42:12 2017
+++ src/doc/CHANGES-7.0.3	Sat Aug 12 19:12:04 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.54 2017/08/12 05:42:12 snj Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.55 2017/08/12 19:12:04 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -3093,7 +3093,7 @@ sys/dev/ic/bwi.c1.32
 sys/compat/svr4/svr4_lwp.c			1.20
 sys/compat/svr4/svr4_signal.c			1.67
 sys/compat/svr4/svr4_stream.c			1.89-1.91 via patch
-sys/compat/svr4_32/svr4_32_signal.c		1.29
+sys/compat/svr4_32/svr4_32_signal.c		1.29-1.30
 
 	Fix some of the multitudinous holes in svr4 streams.
 	Zero stack data before copyout.



CVS commit: [netbsd-7-0] src/sys/compat/svr4_32

2017-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 12 19:11:24 UTC 2017

Modified Files:
src/sys/compat/svr4_32 [netbsd-7-0]: svr4_32_signal.c

Log Message:
Addionaly pull up rev1.30 (missed in ticket #1475)


To generate a diff of this commit:
cvs rdiff -u -r1.26.66.1 -r1.26.66.2 src/sys/compat/svr4_32/svr4_32_signal.c

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

Modified files:

Index: src/sys/compat/svr4_32/svr4_32_signal.c
diff -u src/sys/compat/svr4_32/svr4_32_signal.c:1.26.66.1 src/sys/compat/svr4_32/svr4_32_signal.c:1.26.66.2
--- src/sys/compat/svr4_32/svr4_32_signal.c:1.26.66.1	Sat Aug 12 03:59:24 2017
+++ src/sys/compat/svr4_32/svr4_32_signal.c	Sat Aug 12 19:11:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_signal.c,v 1.26.66.1 2017/08/12 03:59:24 snj Exp $	 */
+/*	$NetBSD: svr4_32_signal.c,v 1.26.66.2 2017/08/12 19:11:24 martin Exp $	 */
 
 /*-
  * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.66.1 2017/08/12 03:59:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.66.2 2017/08/12 19:11:24 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_svr4.h"
@@ -397,16 +397,16 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = (sig_t)SCARG(uap, handler);
 		sigemptyset(_mask);
 		nbsa.sa_flags = 0;
-		error = sigaction1(l, signum, , , NULL, 0);
+		error = sigaction1(l, native_signo, , , NULL, 0);
 		if (error)
-			return (error);
+			return error;
 		*retval = (u_int)(u_long)obsa.sa_handler;
-		return (0);
+		return 0;
 
 	case SVR4_SIGHOLD_MASK:
 	sighold:
 		sigemptyset();
-		sigaddset(, signum);
+		sigaddset(, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_BLOCK, , 0);
 		mutex_exit(p->p_lock);
@@ -414,7 +414,7 @@ svr4_32_sys_signal(struct lwp *l, const 
 
 	case SVR4_SIGRELSE_MASK:
 		sigemptyset();
-		sigaddset(, signum);
+		sigaddset(, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_UNBLOCK, , 0);
 		mutex_exit(p->p_lock);
@@ -424,17 +424,17 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = SIG_IGN;
 		sigemptyset(_mask);
 		nbsa.sa_flags = 0;
-		return (sigaction1(l, signum, , 0, NULL, 0));
+		return sigaction1(l, native_signo, , 0, NULL, 0);
 
 	case SVR4_SIGPAUSE_MASK:
 		mutex_enter(p->p_lock);
 		ss = l->l_sigmask;
 		mutex_exit(p->p_lock);
-		sigdelset(, signum);
-		return (sigsuspend1(l, ));
+		sigdelset(, native_signo);
+		return sigsuspend1(l, );
 
 	default:
-		return (ENOSYS);
+		return ENOSYS;
 	}
 }
 



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

2017-08-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Aug 12 19:06:23 UTC 2017

Modified Files:
src/sys/arch/i386/i386: machdep.c

Log Message:
Remove what is now an unused variable.   One less build issue...


To generate a diff of this commit:
cvs rdiff -u -r1.790 -r1.791 src/sys/arch/i386/i386/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/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.790 src/sys/arch/i386/i386/machdep.c:1.791
--- src/sys/arch/i386/i386/machdep.c:1.790	Sat Aug 12 13:16:14 2017
+++ src/sys/arch/i386/i386/machdep.c	Sat Aug 12 19:06:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.790 2017/08/12 13:16:14 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.791 2017/08/12 19:06:23 kre Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.790 2017/08/12 13:16:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.791 2017/08/12 19:06:23 kre Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -629,7 +629,6 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	int sig = ksi->ksi_signo;
 	struct sigframe_siginfo *fp = getframe(l, sig, ), frame;
 	sig_t catcher = SIGACTION(p, sig).sa_handler;
-	struct trapframe *tf = l->l_md.md_regs;
 
 	KASSERT(mutex_owned(p->p_lock));
 



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

2017-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 12 19:09:46 UTC 2017

Modified Files:
src/sys/compat/svr4_32 [netbsd-7-1]: svr4_32_signal.c

Log Message:
Also pull up rev1.30 (accidently missed in ticket #1475)


To generate a diff of this commit:
cvs rdiff -u -r1.26.70.1 -r1.26.70.2 src/sys/compat/svr4_32/svr4_32_signal.c

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

Modified files:

Index: src/sys/compat/svr4_32/svr4_32_signal.c
diff -u src/sys/compat/svr4_32/svr4_32_signal.c:1.26.70.1 src/sys/compat/svr4_32/svr4_32_signal.c:1.26.70.2
--- src/sys/compat/svr4_32/svr4_32_signal.c:1.26.70.1	Sat Aug 12 03:59:55 2017
+++ src/sys/compat/svr4_32/svr4_32_signal.c	Sat Aug 12 19:09:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_signal.c,v 1.26.70.1 2017/08/12 03:59:55 snj Exp $	 */
+/*	$NetBSD: svr4_32_signal.c,v 1.26.70.2 2017/08/12 19:09:46 martin Exp $	 */
 
 /*-
  * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.70.1 2017/08/12 03:59:55 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.26.70.2 2017/08/12 19:09:46 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_svr4.h"
@@ -397,16 +397,16 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = (sig_t)SCARG(uap, handler);
 		sigemptyset(_mask);
 		nbsa.sa_flags = 0;
-		error = sigaction1(l, signum, , , NULL, 0);
+		error = sigaction1(l, native_signo, , , NULL, 0);
 		if (error)
-			return (error);
+			return error;
 		*retval = (u_int)(u_long)obsa.sa_handler;
-		return (0);
+		return 0;
 
 	case SVR4_SIGHOLD_MASK:
 	sighold:
 		sigemptyset();
-		sigaddset(, signum);
+		sigaddset(, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_BLOCK, , 0);
 		mutex_exit(p->p_lock);
@@ -414,7 +414,7 @@ svr4_32_sys_signal(struct lwp *l, const 
 
 	case SVR4_SIGRELSE_MASK:
 		sigemptyset();
-		sigaddset(, signum);
+		sigaddset(, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_UNBLOCK, , 0);
 		mutex_exit(p->p_lock);
@@ -424,17 +424,17 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = SIG_IGN;
 		sigemptyset(_mask);
 		nbsa.sa_flags = 0;
-		return (sigaction1(l, signum, , 0, NULL, 0));
+		return sigaction1(l, native_signo, , 0, NULL, 0);
 
 	case SVR4_SIGPAUSE_MASK:
 		mutex_enter(p->p_lock);
 		ss = l->l_sigmask;
 		mutex_exit(p->p_lock);
-		sigdelset(, signum);
-		return (sigsuspend1(l, ));
+		sigdelset(, native_signo);
+		return sigsuspend1(l, );
 
 	default:
-		return (ENOSYS);
+		return ENOSYS;
 	}
 }
 



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

2017-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 12 19:10:23 UTC 2017

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

Log Message:
Ammend ticket #1475


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

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

Modified files:

Index: src/doc/CHANGES-7.1.1
diff -u src/doc/CHANGES-7.1.1:1.1.2.23 src/doc/CHANGES-7.1.1:1.1.2.24
--- src/doc/CHANGES-7.1.1:1.1.2.23	Sat Aug 12 05:53:31 2017
+++ src/doc/CHANGES-7.1.1	Sat Aug 12 19:10:23 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.1,v 1.1.2.23 2017/08/12 05:53:31 snj Exp $
+# $NetBSD: CHANGES-7.1.1,v 1.1.2.24 2017/08/12 19:10:23 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.1.1
 release:
@@ -1803,7 +1803,7 @@ sys/dev/ic/bwi.c1.32
 sys/compat/svr4/svr4_lwp.c			1.20
 sys/compat/svr4/svr4_signal.c			1.67
 sys/compat/svr4/svr4_stream.c			1.89-1.91 via patch
-sys/compat/svr4_32/svr4_32_signal.c		1.29
+sys/compat/svr4_32/svr4_32_signal.c		1.29-1.30
 
 	Fix some of the multitudinous holes in svr4 streams.
 	Zero stack data before copyout.



CVS commit: src/lib/libarch/i386

2017-08-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Aug 12 19:48:28 UTC 2017

Modified Files:
src/lib/libarch/i386: shlib_version

Log Message:
Bump - removal of i386_vm86 and i386_pmc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libarch/i386/shlib_version

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

Modified files:

Index: src/lib/libarch/i386/shlib_version
diff -u src/lib/libarch/i386/shlib_version:1.6 src/lib/libarch/i386/shlib_version:1.7
--- src/lib/libarch/i386/shlib_version:1.6	Thu Sep 11 19:19:31 2003
+++ src/lib/libarch/i386/shlib_version	Sat Aug 12 19:48:28 2017
@@ -1,5 +1,5 @@
-#	$NetBSD: shlib_version,v 1.6 2003/09/11 19:19:31 christos Exp $
+#	$NetBSD: shlib_version,v 1.7 2017/08/12 19:48:28 maxv Exp $
 #	Remember to update distrib/sets/lists/base/md.i386 when changing
 #
-major=1
+major=2
 minor=0



CVS commit: [netbsd-6] src/sys/dev/usb

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:26:31 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-6]: if_ural.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1470):
sys/dev/usb/if_ural.c: revision 1.52
Free the RX list if ural_alloc_rx_list fails part way through.
Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/dev/usb/if_ural.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/usb/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.39 src/sys/dev/usb/if_ural.c:1.39.2.1
--- src/sys/dev/usb/if_ural.c:1.39	Fri Dec 23 00:51:44 2011
+++ src/sys/dev/usb/if_ural.c	Sat Aug 12 16:26:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ural.c,v 1.39 2011/12/23 00:51:44 jakllsch Exp $ */
+/*	$NetBSD: if_ural.c,v 1.39.2.1 2017/08/12 16:26:31 snj Exp $ */
 /*	$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $	*/
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.39 2011/12/23 00:51:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.39.2.1 2017/08/12 16:26:31 snj Exp $");
 
 
 #include 
@@ -678,7 +678,7 @@ ural_alloc_rx_list(struct ural_softc *sc
 
 	return 0;
 
-fail:	ural_free_tx_list(sc);
+fail:	ural_free_rx_list(sc);
 	return error;
 }
 



CVS commit: [netbsd-6-0] src/sys/arch/newsmips/apbus

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:28:58 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus [netbsd-6-0]: if_sn.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1471):
sys/arch/newsmips/apbus/if_sn.c: revision 1.39
Avoid memory leak in sonic_get.
If this is the first time around, top is null and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.20.1 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.33 src/sys/arch/newsmips/apbus/if_sn.c:1.33.20.1
--- src/sys/arch/newsmips/apbus/if_sn.c:1.33	Mon Apr  5 07:19:31 2010
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Aug 12 16:28:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.33.20.1 2017/08/12 16:28:58 snj Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33.20.1 2017/08/12 16:28:58 snj Exp $");
 
 #include "opt_inet.h"
 
@@ -1093,7 +1093,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 		if (datalen >= MINCLSIZE) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
-if (top) m_freem(top);
+if (top)
+	m_freem(top);
+else
+	m_freem(m);
 return 0;
 			}
 			len = MCLBYTES;



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

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:36:36 UTC 2017

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

Log Message:
1469-1472


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.101 -r1.1.2.102 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.101 src/doc/CHANGES-6.1.6:1.1.2.102
--- src/doc/CHANGES-6.1.6:1.1.2.101	Thu Aug 10 06:48:23 2017
+++ src/doc/CHANGES-6.1.6	Sat Aug 12 16:36:36 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.101 2017/08/10 06:48:23 snj Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.102 2017/08/12 16:36:36 snj Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -12034,3 +12034,28 @@ share/zoneinfo/solar89 delete
 	Update tzdata to 2017b.
 	[mrg, ticket #1467]
 
+sys/compat/common/vfs_syscalls_12.c		1.30
+sys/compat/common/vfs_syscalls_43.c		1.56
+sys/compat/sys/dirent.h1.3
+
+	It is wishful thinking that vn_readdir will return
+	dirent12 structures.
+	Fix the compat-4.3 getdirentries call (pre d_type).
+	Add a struct for the 4.3BSD struct dirent.
+	[mrg, ticket #1469]
+
+sys/dev/usb/if_ural.c1.52
+
+	ural_alloc_rx_list() calls wrong destructor in case of failure
+	[mrg, ticket #1470]
+
+sys/arch/newsmips/apbus/if_sn.c			1.39
+
+	memory leak in sonic_get()
+	[mrg, ticket #1471]
+
+sys/arch/mac68k/nubus/if_netdock_nubus.c	1.26
+
+	memory leak in netdock_get()
+	[mrg, ticket #1472]
+



CVS commit: [netbsd-6-1] src/sys/arch/mac68k/nubus

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:36:20 UTC 2017

Modified Files:
src/sys/arch/mac68k/nubus [netbsd-6-1]: if_netdock_nubus.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.22.1 src/sys/arch/mac68k/nubus/if_netdock_nubus.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/mac68k/nubus/if_netdock_nubus.c
diff -u src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21 src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21.22.1
--- src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21	Mon Apr  5 07:19:30 2010
+++ src/sys/arch/mac68k/nubus/if_netdock_nubus.c	Sat Aug 12 16:36:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_netdock_nubus.c,v 1.21 2010/04/05 07:19:30 joerg Exp $	*/
+/*	$NetBSD: if_netdock_nubus.c,v 1.21.22.1 2017/08/12 16:36:20 snj Exp $	*/
 
 /*
  * Copyright (C) 2000,2002 Daishi Kato 
@@ -43,7 +43,7 @@
 /***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.21 2010/04/05 07:19:30 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.21.22.1 2017/08/12 16:36:20 snj Exp $");
 
 #include 
 #include 
@@ -803,6 +803,8 @@ netdock_get(struct netdock_softc *sc, in
 			if ((m->m_flags & M_EXT) == 0) {
 if (top)
 	m_freem(top);
+else
+	m_freem(m);
 return (NULL);
 			}
 			len = MCLBYTES;



CVS commit: [netbsd-6] src/sys/compat

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:23:29 UTC 2017

Modified Files:
src/sys/compat/common [netbsd-6]: vfs_syscalls_12.c vfs_syscalls_43.c
src/sys/compat/sys [netbsd-6]: dirent.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.12.1 src/sys/compat/common/vfs_syscalls_12.c
cvs rdiff -u -r1.54.14.2 -r1.54.14.3 src/sys/compat/common/vfs_syscalls_43.c
cvs rdiff -u -r1.2 -r1.2.118.1 src/sys/compat/sys/dirent.h

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

Modified files:

Index: src/sys/compat/common/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.29 src/sys/compat/common/vfs_syscalls_12.c:1.29.12.1
--- src/sys/compat/common/vfs_syscalls_12.c:1.29	Wed Jan 19 10:21:16 2011
+++ src/sys/compat/common/vfs_syscalls_12.c	Sat Aug 12 16:23:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.29 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.29.12.1 2017/08/12 16:23:28 snj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.29 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.29.12.1 2017/08/12 16:23:28 snj Exp $");
 
 #include 
 #include 
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 
 #include 
+#include 
 
 /*
  * Convert from a new to an old stat structure.
@@ -96,28 +97,140 @@ compat_12_sys_getdirentries(struct lwp *
 		syscallarg(u_int) count;
 		syscallarg(long *) basep;
 	} */
+	struct dirent *bdp;
+	struct vnode *vp;
+	char *inp, *tbuf;		/* Current-format */
+	int len, reclen;		/* Current-format */
+	char *outp;			/* Dirent12-format */
+	int resid, old_reclen = 0;	/* Dirent12-format */
 	struct file *fp;
-	int error, done;
+	struct uio auio;
+	struct iovec aiov;
+	struct dirent12 idb;
+	off_t off;		/* true file offset */
+	int buflen, error, eofflag, nbytes;
+	struct vattr va;
+	off_t *cookiebuf = NULL, *cookie;
+	int ncookies;
 	long loff;
-
+		 
 	/* fd_getvnode() will use the descriptor for us */
 	if ((error = fd_getvnode(SCARG(uap, fd), )) != 0)
-		return error;
+		return (error);
+
 	if ((fp->f_flag & FREAD) == 0) {
 		error = EBADF;
-		goto out;
+		goto out1;
+	}
+
+	vp = (struct vnode *)fp->f_data;
+	if (vp->v_type != VDIR) {
+		error = ENOTDIR;
+		goto out1;
 	}
 
+	vn_lock(vp, LK_SHARED | LK_RETRY);
+	error = VOP_GETATTR(vp, , l->l_cred);
+	VOP_UNLOCK(vp);
+	if (error)
+		goto out1;
+
 	loff = fp->f_offset;
+	nbytes = SCARG(uap, count);
+	buflen = min(MAXBSIZE, nbytes);
+	if (buflen < va.va_blocksize)
+		buflen = va.va_blocksize;
+	tbuf = malloc(buflen, M_TEMP, M_WAITOK);
+
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	off = fp->f_offset;
+again:
+	aiov.iov_base = tbuf;
+	aiov.iov_len = buflen;
+	auio.uio_iov = 
+	auio.uio_iovcnt = 1;
+	auio.uio_rw = UIO_READ;
+	auio.uio_resid = buflen;
+	auio.uio_offset = off;
+	UIO_SETUP_SYSSPACE();
+	/*
+ * First we read into the malloc'ed buffer, then
+ * we massage it into user space, one record at a time.
+ */
+	error = VOP_READDIR(vp, , fp->f_cred, , ,
+	);
+	if (error)
+		goto out;
+
+	inp = tbuf;
+	outp = SCARG(uap, buf);
+	resid = nbytes;
+	if ((len = buflen - auio.uio_resid) == 0)
+		goto eof;
+
+	for (cookie = cookiebuf; len > 0; len -= reclen) {
+		bdp = (struct dirent *)inp;
+		reclen = bdp->d_reclen;
+		if (reclen & 3)
+			panic(__func__);
+		if (bdp->d_fileno == 0) {
+			inp += reclen;	/* it is a hole; squish it out */
+			if (cookie)
+off = *cookie++;
+			else
+off += reclen;
+			continue;
+		}
+		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
+		if (reclen > len || resid < old_reclen) {
+			/* entry too big for buffer, so just stop */
+			outp++;
+			break;
+		}
+		/*
+		 * Massage in place to make a Dirent12-shaped dirent (otherwise
+		 * we have to worry about touching user memory outside of
+		 * the copyout() call).
+		 */
+		idb.d_fileno = (uint32_t)bdp->d_fileno;
+		idb.d_reclen = (uint16_t)old_reclen;
+		idb.d_type = (uint8_t)bdp->d_type;
+		idb.d_namlen = (uint8_t)bdp->d_namlen;
+		strcpy(idb.d_name, bdp->d_name);
+		if ((error = copyout(, outp, old_reclen)))
+			goto out;
+		/* advance past this real entry */
+		inp += reclen;
+		if (cookie)
+			off = *cookie++; /* each entry points to itself */
+		else
+			off += reclen;
+		/* advance output past Dirent12-shaped entry */
+		outp += old_reclen;
+		resid -= old_reclen;
+	}
 
-	error = vn_readdir(fp, 

CVS commit: [netbsd-6-1] src/sys/dev/usb

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:27:22 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-6-1]: if_ural.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1470):
sys/dev/usb/if_ural.c: revision 1.52
Free the RX list if ural_alloc_rx_list fails part way through.
Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.8.1 src/sys/dev/usb/if_ural.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/usb/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.39 src/sys/dev/usb/if_ural.c:1.39.8.1
--- src/sys/dev/usb/if_ural.c:1.39	Fri Dec 23 00:51:44 2011
+++ src/sys/dev/usb/if_ural.c	Sat Aug 12 16:27:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ural.c,v 1.39 2011/12/23 00:51:44 jakllsch Exp $ */
+/*	$NetBSD: if_ural.c,v 1.39.8.1 2017/08/12 16:27:22 snj Exp $ */
 /*	$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $	*/
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.39 2011/12/23 00:51:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.39.8.1 2017/08/12 16:27:22 snj Exp $");
 
 
 #include 
@@ -678,7 +678,7 @@ ural_alloc_rx_list(struct ural_softc *sc
 
 	return 0;
 
-fail:	ural_free_tx_list(sc);
+fail:	ural_free_rx_list(sc);
 	return error;
 }
 



CVS commit: [netbsd-6-0] src/sys/dev/usb

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:27:45 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-6-0]: if_ural.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1470):
sys/dev/usb/if_ural.c: revision 1.52
Free the RX list if ural_alloc_rx_list fails part way through.
Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.6.1 src/sys/dev/usb/if_ural.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/usb/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.39 src/sys/dev/usb/if_ural.c:1.39.6.1
--- src/sys/dev/usb/if_ural.c:1.39	Fri Dec 23 00:51:44 2011
+++ src/sys/dev/usb/if_ural.c	Sat Aug 12 16:27:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ural.c,v 1.39 2011/12/23 00:51:44 jakllsch Exp $ */
+/*	$NetBSD: if_ural.c,v 1.39.6.1 2017/08/12 16:27:44 snj Exp $ */
 /*	$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $	*/
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.39 2011/12/23 00:51:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.39.6.1 2017/08/12 16:27:44 snj Exp $");
 
 
 #include 
@@ -678,7 +678,7 @@ ural_alloc_rx_list(struct ural_softc *sc
 
 	return 0;
 
-fail:	ural_free_tx_list(sc);
+fail:	ural_free_rx_list(sc);
 	return error;
 }
 



CVS commit: [netbsd-6] src/sys/arch/newsmips/apbus

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:30:05 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus [netbsd-6]: if_sn.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1471):
sys/arch/newsmips/apbus/if_sn.c: revision 1.39
Avoid memory leak in sonic_get.
If this is the first time around, top is null and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.14.1 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.33 src/sys/arch/newsmips/apbus/if_sn.c:1.33.14.1
--- src/sys/arch/newsmips/apbus/if_sn.c:1.33	Mon Apr  5 07:19:31 2010
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Aug 12 16:30:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.33.14.1 2017/08/12 16:30:05 snj Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33.14.1 2017/08/12 16:30:05 snj Exp $");
 
 #include "opt_inet.h"
 
@@ -1093,7 +1093,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 		if (datalen >= MINCLSIZE) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
-if (top) m_freem(top);
+if (top)
+	m_freem(top);
+else
+	m_freem(m);
 return 0;
 			}
 			len = MCLBYTES;



CVS commit: [netbsd-6-1] src/sys/arch/newsmips/apbus

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:29:24 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus [netbsd-6-1]: if_sn.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1471):
sys/arch/newsmips/apbus/if_sn.c: revision 1.39
Avoid memory leak in sonic_get.
If this is the first time around, top is null and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.22.1 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.33 src/sys/arch/newsmips/apbus/if_sn.c:1.33.22.1
--- src/sys/arch/newsmips/apbus/if_sn.c:1.33	Mon Apr  5 07:19:31 2010
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Aug 12 16:29:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.33.22.1 2017/08/12 16:29:24 snj Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33.22.1 2017/08/12 16:29:24 snj Exp $");
 
 #include "opt_inet.h"
 
@@ -1093,7 +1093,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 		if (datalen >= MINCLSIZE) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
-if (top) m_freem(top);
+if (top)
+	m_freem(top);
+else
+	m_freem(m);
 return 0;
 			}
 			len = MCLBYTES;



CVS commit: [netbsd-6] src/sys/arch/mac68k/nubus

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:35:11 UTC 2017

Modified Files:
src/sys/arch/mac68k/nubus [netbsd-6]: if_netdock_nubus.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.14.1 src/sys/arch/mac68k/nubus/if_netdock_nubus.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/mac68k/nubus/if_netdock_nubus.c
diff -u src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21 src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21.14.1
--- src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21	Mon Apr  5 07:19:30 2010
+++ src/sys/arch/mac68k/nubus/if_netdock_nubus.c	Sat Aug 12 16:35:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_netdock_nubus.c,v 1.21 2010/04/05 07:19:30 joerg Exp $	*/
+/*	$NetBSD: if_netdock_nubus.c,v 1.21.14.1 2017/08/12 16:35:11 snj Exp $	*/
 
 /*
  * Copyright (C) 2000,2002 Daishi Kato 
@@ -43,7 +43,7 @@
 /***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.21 2010/04/05 07:19:30 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.21.14.1 2017/08/12 16:35:11 snj Exp $");
 
 #include 
 #include 
@@ -803,6 +803,8 @@ netdock_get(struct netdock_softc *sc, in
 			if ((m->m_flags & M_EXT) == 0) {
 if (top)
 	m_freem(top);
+else
+	m_freem(m);
 return (NULL);
 			}
 			len = MCLBYTES;



CVS commit: [netbsd-6] src/doc

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:36:04 UTC 2017

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

Log Message:
1469-1472


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.295 -r1.1.2.296 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.295 src/doc/CHANGES-6.2:1.1.2.296
--- src/doc/CHANGES-6.2:1.1.2.295	Thu Aug 10 06:05:00 2017
+++ src/doc/CHANGES-6.2	Sat Aug 12 16:36:04 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.295 2017/08/10 06:05:00 snj Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.296 2017/08/12 16:36:04 snj Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -18082,3 +18082,28 @@ share/zoneinfo/zone1970.tab		patch
 	Update tzdata to 2017b.
 	[mrg, ticket #1467]
 
+sys/compat/common/vfs_syscalls_12.c		1.30
+sys/compat/common/vfs_syscalls_43.c		1.56
+sys/compat/sys/dirent.h1.3
+
+	It is wishful thinking that vn_readdir will return
+	dirent12 structures.
+   	Fix the compat-4.3 getdirentries call (pre d_type).
+	Add a struct for the 4.3BSD struct dirent.
+	[mrg, ticket #1469]
+
+sys/dev/usb/if_ural.c1.52
+
+	ural_alloc_rx_list() calls wrong destructor in case of failure
+	[mrg, ticket #1470]
+
+sys/arch/newsmips/apbus/if_sn.c			1.39
+
+	memory leak in sonic_get()
+	[mrg, ticket #1471]
+
+sys/arch/mac68k/nubus/if_netdock_nubus.c	1.26
+
+	memory leak in netdock_get()
+	[mrg, ticket #1472]
+



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

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:20:59 UTC 2017

Modified Files:
src/sys/compat/common [netbsd-6-0]: vfs_syscalls_12.c vfs_syscalls_43.c
src/sys/compat/sys [netbsd-6-0]: dirent.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.18.1 src/sys/compat/common/vfs_syscalls_12.c
cvs rdiff -u -r1.54.20.1 -r1.54.20.2 src/sys/compat/common/vfs_syscalls_43.c
cvs rdiff -u -r1.2 -r1.2.124.1 src/sys/compat/sys/dirent.h

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

Modified files:

Index: src/sys/compat/common/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.29 src/sys/compat/common/vfs_syscalls_12.c:1.29.18.1
--- src/sys/compat/common/vfs_syscalls_12.c:1.29	Wed Jan 19 10:21:16 2011
+++ src/sys/compat/common/vfs_syscalls_12.c	Sat Aug 12 16:20:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.29 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.29.18.1 2017/08/12 16:20:59 snj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.29 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.29.18.1 2017/08/12 16:20:59 snj Exp $");
 
 #include 
 #include 
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 
 #include 
+#include 
 
 /*
  * Convert from a new to an old stat structure.
@@ -96,28 +97,140 @@ compat_12_sys_getdirentries(struct lwp *
 		syscallarg(u_int) count;
 		syscallarg(long *) basep;
 	} */
+	struct dirent *bdp;
+	struct vnode *vp;
+	char *inp, *tbuf;		/* Current-format */
+	int len, reclen;		/* Current-format */
+	char *outp;			/* Dirent12-format */
+	int resid, old_reclen = 0;	/* Dirent12-format */
 	struct file *fp;
-	int error, done;
+	struct uio auio;
+	struct iovec aiov;
+	struct dirent12 idb;
+	off_t off;		/* true file offset */
+	int buflen, error, eofflag, nbytes;
+	struct vattr va;
+	off_t *cookiebuf = NULL, *cookie;
+	int ncookies;
 	long loff;
-
+		 
 	/* fd_getvnode() will use the descriptor for us */
 	if ((error = fd_getvnode(SCARG(uap, fd), )) != 0)
-		return error;
+		return (error);
+
 	if ((fp->f_flag & FREAD) == 0) {
 		error = EBADF;
-		goto out;
+		goto out1;
+	}
+
+	vp = (struct vnode *)fp->f_data;
+	if (vp->v_type != VDIR) {
+		error = ENOTDIR;
+		goto out1;
 	}
 
+	vn_lock(vp, LK_SHARED | LK_RETRY);
+	error = VOP_GETATTR(vp, , l->l_cred);
+	VOP_UNLOCK(vp);
+	if (error)
+		goto out1;
+
 	loff = fp->f_offset;
+	nbytes = SCARG(uap, count);
+	buflen = min(MAXBSIZE, nbytes);
+	if (buflen < va.va_blocksize)
+		buflen = va.va_blocksize;
+	tbuf = malloc(buflen, M_TEMP, M_WAITOK);
+
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	off = fp->f_offset;
+again:
+	aiov.iov_base = tbuf;
+	aiov.iov_len = buflen;
+	auio.uio_iov = 
+	auio.uio_iovcnt = 1;
+	auio.uio_rw = UIO_READ;
+	auio.uio_resid = buflen;
+	auio.uio_offset = off;
+	UIO_SETUP_SYSSPACE();
+	/*
+ * First we read into the malloc'ed buffer, then
+ * we massage it into user space, one record at a time.
+ */
+	error = VOP_READDIR(vp, , fp->f_cred, , ,
+	);
+	if (error)
+		goto out;
+
+	inp = tbuf;
+	outp = SCARG(uap, buf);
+	resid = nbytes;
+	if ((len = buflen - auio.uio_resid) == 0)
+		goto eof;
+
+	for (cookie = cookiebuf; len > 0; len -= reclen) {
+		bdp = (struct dirent *)inp;
+		reclen = bdp->d_reclen;
+		if (reclen & 3)
+			panic(__func__);
+		if (bdp->d_fileno == 0) {
+			inp += reclen;	/* it is a hole; squish it out */
+			if (cookie)
+off = *cookie++;
+			else
+off += reclen;
+			continue;
+		}
+		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
+		if (reclen > len || resid < old_reclen) {
+			/* entry too big for buffer, so just stop */
+			outp++;
+			break;
+		}
+		/*
+		 * Massage in place to make a Dirent12-shaped dirent (otherwise
+		 * we have to worry about touching user memory outside of
+		 * the copyout() call).
+		 */
+		idb.d_fileno = (uint32_t)bdp->d_fileno;
+		idb.d_reclen = (uint16_t)old_reclen;
+		idb.d_type = (uint8_t)bdp->d_type;
+		idb.d_namlen = (uint8_t)bdp->d_namlen;
+		strcpy(idb.d_name, bdp->d_name);
+		if ((error = copyout(, outp, old_reclen)))
+			goto out;
+		/* advance past this real entry */
+		inp += reclen;
+		if (cookie)
+			off = *cookie++; /* each entry points to itself */
+		else
+			off += reclen;
+		/* advance output past Dirent12-shaped entry */
+		outp += old_reclen;
+		resid -= old_reclen;
+	}
 
-	error = vn_readdir(fp, 

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

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:22:31 UTC 2017

Modified Files:
src/sys/compat/common [netbsd-6-1]: vfs_syscalls_12.c vfs_syscalls_43.c
src/sys/compat/sys [netbsd-6-1]: dirent.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.26.1 src/sys/compat/common/vfs_syscalls_12.c
cvs rdiff -u -r1.54.14.1.2.1 -r1.54.14.1.2.2 \
src/sys/compat/common/vfs_syscalls_43.c
cvs rdiff -u -r1.2 -r1.2.134.1 src/sys/compat/sys/dirent.h

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

Modified files:

Index: src/sys/compat/common/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.29 src/sys/compat/common/vfs_syscalls_12.c:1.29.26.1
--- src/sys/compat/common/vfs_syscalls_12.c:1.29	Wed Jan 19 10:21:16 2011
+++ src/sys/compat/common/vfs_syscalls_12.c	Sat Aug 12 16:22:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.29 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.29.26.1 2017/08/12 16:22:30 snj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.29 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.29.26.1 2017/08/12 16:22:30 snj Exp $");
 
 #include 
 #include 
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 
 #include 
+#include 
 
 /*
  * Convert from a new to an old stat structure.
@@ -96,28 +97,140 @@ compat_12_sys_getdirentries(struct lwp *
 		syscallarg(u_int) count;
 		syscallarg(long *) basep;
 	} */
+	struct dirent *bdp;
+	struct vnode *vp;
+	char *inp, *tbuf;		/* Current-format */
+	int len, reclen;		/* Current-format */
+	char *outp;			/* Dirent12-format */
+	int resid, old_reclen = 0;	/* Dirent12-format */
 	struct file *fp;
-	int error, done;
+	struct uio auio;
+	struct iovec aiov;
+	struct dirent12 idb;
+	off_t off;		/* true file offset */
+	int buflen, error, eofflag, nbytes;
+	struct vattr va;
+	off_t *cookiebuf = NULL, *cookie;
+	int ncookies;
 	long loff;
-
+		 
 	/* fd_getvnode() will use the descriptor for us */
 	if ((error = fd_getvnode(SCARG(uap, fd), )) != 0)
-		return error;
+		return (error);
+
 	if ((fp->f_flag & FREAD) == 0) {
 		error = EBADF;
-		goto out;
+		goto out1;
+	}
+
+	vp = (struct vnode *)fp->f_data;
+	if (vp->v_type != VDIR) {
+		error = ENOTDIR;
+		goto out1;
 	}
 
+	vn_lock(vp, LK_SHARED | LK_RETRY);
+	error = VOP_GETATTR(vp, , l->l_cred);
+	VOP_UNLOCK(vp);
+	if (error)
+		goto out1;
+
 	loff = fp->f_offset;
+	nbytes = SCARG(uap, count);
+	buflen = min(MAXBSIZE, nbytes);
+	if (buflen < va.va_blocksize)
+		buflen = va.va_blocksize;
+	tbuf = malloc(buflen, M_TEMP, M_WAITOK);
+
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	off = fp->f_offset;
+again:
+	aiov.iov_base = tbuf;
+	aiov.iov_len = buflen;
+	auio.uio_iov = 
+	auio.uio_iovcnt = 1;
+	auio.uio_rw = UIO_READ;
+	auio.uio_resid = buflen;
+	auio.uio_offset = off;
+	UIO_SETUP_SYSSPACE();
+	/*
+ * First we read into the malloc'ed buffer, then
+ * we massage it into user space, one record at a time.
+ */
+	error = VOP_READDIR(vp, , fp->f_cred, , ,
+	);
+	if (error)
+		goto out;
+
+	inp = tbuf;
+	outp = SCARG(uap, buf);
+	resid = nbytes;
+	if ((len = buflen - auio.uio_resid) == 0)
+		goto eof;
+
+	for (cookie = cookiebuf; len > 0; len -= reclen) {
+		bdp = (struct dirent *)inp;
+		reclen = bdp->d_reclen;
+		if (reclen & 3)
+			panic(__func__);
+		if (bdp->d_fileno == 0) {
+			inp += reclen;	/* it is a hole; squish it out */
+			if (cookie)
+off = *cookie++;
+			else
+off += reclen;
+			continue;
+		}
+		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
+		if (reclen > len || resid < old_reclen) {
+			/* entry too big for buffer, so just stop */
+			outp++;
+			break;
+		}
+		/*
+		 * Massage in place to make a Dirent12-shaped dirent (otherwise
+		 * we have to worry about touching user memory outside of
+		 * the copyout() call).
+		 */
+		idb.d_fileno = (uint32_t)bdp->d_fileno;
+		idb.d_reclen = (uint16_t)old_reclen;
+		idb.d_type = (uint8_t)bdp->d_type;
+		idb.d_namlen = (uint8_t)bdp->d_namlen;
+		strcpy(idb.d_name, bdp->d_name);
+		if ((error = copyout(, outp, old_reclen)))
+			goto out;
+		/* advance past this real entry */
+		inp += reclen;
+		if (cookie)
+			off = *cookie++; /* each entry points to itself */
+		else
+			off += reclen;
+		/* advance output past Dirent12-shaped entry */
+		outp += old_reclen;
+		resid -= old_reclen;
+	}
 
-	error = 

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

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:38:08 UTC 2017

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

Log Message:
1469-1472


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.103 -r1.1.2.104 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.103 src/doc/CHANGES-6.0.7:1.1.2.104
--- src/doc/CHANGES-6.0.7:1.1.2.103	Thu Aug 10 07:04:19 2017
+++ src/doc/CHANGES-6.0.7	Sat Aug 12 16:38:08 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.103 2017/08/10 07:04:19 snj Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.104 2017/08/12 16:38:08 snj Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -12354,4 +12354,29 @@ share/zoneinfo/zoneinfo2tdf.pl			patch
 
 	Update tzdata to 2017b.
 	[mrg, ticket #1467]
-j
+
+sys/compat/common/vfs_syscalls_12.c		1.30
+sys/compat/common/vfs_syscalls_43.c		1.56
+sys/compat/sys/dirent.h1.3
+
+	It is wishful thinking that vn_readdir will return
+	dirent12 structures.
+	Fix the compat-4.3 getdirentries call (pre d_type).
+	Add a struct for the 4.3BSD struct dirent.
+	[mrg, ticket #1469]
+
+sys/dev/usb/if_ural.c1.52
+
+	ural_alloc_rx_list() calls wrong destructor in case of failure
+	[mrg, ticket #1470]
+
+sys/arch/newsmips/apbus/if_sn.c			1.39
+
+	memory leak in sonic_get()
+	[mrg, ticket #1471]
+
+sys/arch/mac68k/nubus/if_netdock_nubus.c	1.26
+
+	memory leak in netdock_get()
+	[mrg, ticket #1472]
+



CVS commit: [netbsd-6-0] src/sys/arch/mac68k/nubus

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:37:30 UTC 2017

Modified Files:
src/sys/arch/mac68k/nubus [netbsd-6-0]: if_netdock_nubus.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.20.1 src/sys/arch/mac68k/nubus/if_netdock_nubus.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/mac68k/nubus/if_netdock_nubus.c
diff -u src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21 src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21.20.1
--- src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21	Mon Apr  5 07:19:30 2010
+++ src/sys/arch/mac68k/nubus/if_netdock_nubus.c	Sat Aug 12 16:37:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_netdock_nubus.c,v 1.21 2010/04/05 07:19:30 joerg Exp $	*/
+/*	$NetBSD: if_netdock_nubus.c,v 1.21.20.1 2017/08/12 16:37:29 snj Exp $	*/
 
 /*
  * Copyright (C) 2000,2002 Daishi Kato 
@@ -43,7 +43,7 @@
 /***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.21 2010/04/05 07:19:30 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.21.20.1 2017/08/12 16:37:29 snj Exp $");
 
 #include 
 #include 
@@ -803,6 +803,8 @@ netdock_get(struct netdock_softc *sc, in
 			if ((m->m_flags & M_EXT) == 0) {
 if (top)
 	m_freem(top);
+else
+	m_freem(m);
 return (NULL);
 			}
 			len = MCLBYTES;



CVS commit: src/sys/dev

2017-08-12 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Aug 13 04:09:27 UTC 2017

Modified Files:
src/sys/dev: audiovar.h

Log Message:
Move defines to the appropriate place.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/audiovar.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/audiovar.h
diff -u src/sys/dev/audiovar.h:1.60 src/sys/dev/audiovar.h:1.61
--- src/sys/dev/audiovar.h:1.60	Sun Jul 30 00:47:48 2017
+++ src/sys/dev/audiovar.h	Sun Aug 13 04:09:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiovar.h,v 1.60 2017/07/30 00:47:48 nat Exp $	*/
+/*	$NetBSD: audiovar.h,v 1.61 2017/08/13 04:09:27 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -113,15 +113,17 @@ struct audio_ringbuffer {
 
 struct audio_chan {
 	dev_t	dev;
-#define MIXER_INUSE	-2
 	struct virtual_channel	*vc;
 	int	chan;			/* virtual channel */
 	int	deschan;		/* desired channel for ioctls*/
+#define MIXER_INUSE	-2
 	SIMPLEQ_ENTRY(audio_chan) entries;
 };
 
 struct virtual_channel {
 	u_char			sc_open;	/* multiple use device */
+#define AUOPEN_READ	0x01
+#define AUOPEN_WRITE	0x02
 	u_char			sc_mode;	/* bitmask for RECORD/PLAY */
 
 	bool			sc_blkset;	/* Blocksize has been set */
@@ -182,8 +184,6 @@ struct audio_softc {
 	const struct audio_hw_if *hw_if; /* Hardware interface */
 	device_t	sc_dev;		/* Hardware device struct */
 	struct chan_queue sc_audiochan; /* queue of open chans */
-#define AUOPEN_READ	0x01
-#define AUOPEN_WRITE	0x02
 
 	struct audio_encoding_set *sc_encodings;
 	struct	selinfo sc_wsel; /* write selector */



CVS commit: src/sys/dev

2017-08-12 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Aug 13 05:04:08 UTC 2017

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

Log Message:
Remove mixer chan from sc_audiochan.
Now sc_audiochan contains opened audio chan (and first special
element) only.

First I splitted sc_audiochan into sc_audiochan which has
audio chan (and first special element) and sc_mixerchan
which has mixer chan only.  However nobody else refers this
sc_mixerchan except additions to list and deletions from
list.  So mixer chan's list is not necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.392 -r1.393 src/sys/dev/audio.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/audiovar.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/audio.c
diff -u src/sys/dev/audio.c:1.392 src/sys/dev/audio.c:1.393
--- src/sys/dev/audio.c:1.392	Tue Aug  8 22:21:35 2017
+++ src/sys/dev/audio.c	Sun Aug 13 05:04:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.392 2017/08/08 22:21:35 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.393 2017/08/13 05:04:08 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.392 2017/08/08 22:21:35 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.393 2017/08/13 05:04:08 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -927,16 +927,12 @@ audiodetach(device_t self, int flags)
 
 	/* free resources */
 	SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) {
-		if (chan->chan == MIXER_INUSE)
-			continue;
 		audio_free_ring(sc, >vc->sc_mpr);
 		audio_free_ring(sc, >vc->sc_mrr);
 	}
 	audio_free_ring(sc, >sc_pr);
 	audio_free_ring(sc, >sc_rr);
 	SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) {
-		if (chan->chan == MIXER_INUSE)
-			continue;
 		audio_destroy_pfilters(chan->vc);
 		audio_destroy_rfilters(chan->vc);
 	}
@@ -2140,8 +2136,6 @@ audio_open(dev_t dev, struct audio_softc
 	SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) {
 		if (chan == SIMPLEQ_FIRST(>sc_audiochan))
 			continue;
-		if (chan->chan == MIXER_INUSE)
-			continue;
 		n = chan->chan + 1;
 	}
 	if (n < 0)
@@ -3707,9 +3701,6 @@ audio_mix(void *v)
 		if (chan == SIMPLEQ_FIRST(>sc_audiochan))
 			continue;
 
-		if (chan->chan == MIXER_INUSE)
-			continue;
-
 		vc = chan->vc;
 
 		if (!vc->sc_open)
@@ -3921,9 +3912,6 @@ audio_upmix(void *v)
 		if (chan == SIMPLEQ_FIRST(>sc_audiochan))
 			continue;
 
-		if (chan->chan == MIXER_INUSE)
-			continue;
-
 		vc = chan->vc;
 
 		if (!(vc->sc_open & AUOPEN_READ))
@@ -4964,9 +4952,6 @@ mixer_open(dev_t dev, struct audio_softc
 
 	chan = kmem_zalloc(sizeof(struct audio_chan), KM_SLEEP);
 	chan->dev = dev;
-	chan->chan = MIXER_INUSE;
-
-	SIMPLEQ_INSERT_TAIL(>sc_audiochan, chan, entries);
 
 	error = fd_clone(fp, fd, flags, _fileops, chan);
 	KASSERT(error == EMOVEFD);
@@ -5028,7 +5013,6 @@ mixer_close(struct audio_softc *sc, int 
 
 	DPRINTF(("mixer_close: sc %p\n", sc));
 	mixer_remove(sc);
-	SIMPLEQ_REMOVE(>sc_audiochan, chan, audio_chan, entries);
 
 	return 0;
 }
@@ -5268,8 +5252,7 @@ audio_suspend(device_t dv, const pmf_qua
 	mutex_enter(sc->sc_lock);
 	audio_mixer_capture(sc);
 	SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) {
-		if (chan == SIMPLEQ_FIRST(>sc_audiochan) ||
-			chan->chan == MIXER_INUSE)
+		if (chan == SIMPLEQ_FIRST(>sc_audiochan))
 			continue;
 
 		vc = chan->vc;
@@ -5308,8 +5291,7 @@ audio_resume(device_t dv, const pmf_qual
 
 	audio_mixer_restore(sc);
 	SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) {
-		if (chan == SIMPLEQ_FIRST(>sc_audiochan) ||
-chan->chan == MIXER_INUSE)
+		if (chan == SIMPLEQ_FIRST(>sc_audiochan))
 			continue;
 		vc = chan->vc;
 
@@ -5707,8 +5689,7 @@ find_vchan_vol(struct audio_softc *sc, i
 	
 	j = 0;
 	SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) {
-		if (chan == SIMPLEQ_FIRST(>sc_audiochan) ||
-		chan->chan == MIXER_INUSE)
+		if (chan == SIMPLEQ_FIRST(>sc_audiochan))
 			continue;
 		if (j == n)
 			break;

Index: src/sys/dev/audiovar.h
diff -u src/sys/dev/audiovar.h:1.61 src/sys/dev/audiovar.h:1.62
--- src/sys/dev/audiovar.h:1.61	Sun Aug 13 04:09:27 2017
+++ src/sys/dev/audiovar.h	Sun Aug 13 05:04:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiovar.h,v 1.61 2017/08/13 04:09:27 isaki Exp $	*/
+/*	$NetBSD: audiovar.h,v 1.62 2017/08/13 05:04:08 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -116,7 +116,6 @@ struct audio_chan {
 	struct virtual_channel	*vc;
 	int	chan;			/* virtual channel */
 	int	deschan;		/* desired channel for ioctls*/
-#define MIXER_INUSE	-2
 	SIMPLEQ_ENTRY(audio_chan) entries;
 };
 
@@ -183,7 +182,7 @@ struct audio_softc {
 	void		*hw_hdl;	/* Hardware driver handle */
 	const struct audio_hw_if *hw_if; /* Hardware interface */
 	device_t	sc_dev;		/* Hardware device struct */
-	struct chan_queue sc_audiochan; /* queue of open chans */
+	struct chan_queue sc_audiochan; /* queue of open audio 

CVS commit: [jdolecek-ncq] src/sys/dev/ata

2017-08-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Aug 12 22:31:50 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: ata.c

Log Message:
use AT_LBA48 flag for the READ LOG EXT - it's required so that e.g. mvsata()
executes the command using wdccommandext(), it fails when executed using
wdccommand()


To generate a diff of this commit:
cvs rdiff -u -r1.132.8.27 -r1.132.8.28 src/sys/dev/ata/ata.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.27 src/sys/dev/ata/ata.c:1.132.8.28
--- src/sys/dev/ata/ata.c:1.132.8.27	Sat Aug 12 15:08:38 2017
+++ src/sys/dev/ata/ata.c	Sat Aug 12 22:31:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.132.8.27 2017/08/12 15:08:38 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.132.8.28 2017/08/12 22:31:50 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.27 2017/08/12 15:08:38 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.28 2017/08/12 22:31:50 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -1091,7 +1091,7 @@ ata_read_log_ext_ncq(struct ata_drive_da
 	xfer->c_ata_c.r_st_pmask = WDCS_DRDY;
 	xfer->c_ata_c.r_count = 1;
 	xfer->c_ata_c.r_device = WDSD_LBA;
-	xfer->c_ata_c.flags = AT_READ | AT_LBA | flags;
+	xfer->c_ata_c.flags = AT_READ | AT_LBA | AT_LBA48 | flags;
 	xfer->c_ata_c.timeout = 1000; /* 1s */
 	xfer->c_ata_c.data = tb;
 	xfer->c_ata_c.bcount = DEV_BSIZE;



CVS commit: src/distrib/sets/lists

2017-08-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Aug 12 21:46:01 UTC 2017

Modified Files:
src/distrib/sets/lists/base: md.amd64 md.i386
src/distrib/sets/lists/debug: md.amd64 md.i386

Log Message:
For libi386 major bump.


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.145 -r1.146 src/distrib/sets/lists/base/md.i386
cvs rdiff -u -r1.97 -r1.98 src/distrib/sets/lists/debug/md.amd64
cvs rdiff -u -r1.13 -r1.14 src/distrib/sets/lists/debug/md.i386

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

Modified files:

Index: src/distrib/sets/lists/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.269 src/distrib/sets/lists/base/md.amd64:1.270
--- src/distrib/sets/lists/base/md.amd64:1.269	Wed Jul 12 17:10:09 2017
+++ src/distrib/sets/lists/base/md.amd64	Sat Aug 12 21:46:01 2017
@@ -1,12 +1,12 @@
-# $NetBSD: md.amd64,v 1.269 2017/07/12 17:10:09 maxv Exp $
+# $NetBSD: md.amd64,v 1.270 2017/08/12 21:46:01 kre Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib		compat,pic
 ./usr/bin/fdformatbase-util-bin
 ./usr/bin/iasl	base-util-bin
 ./usr/bin/pmc	base-util-bin
-./usr/lib/i386/libi386.so.1			base-compat-shlib	compat,pic
-./usr/lib/i386/libi386.so.1.0			base-compat-shlib	compat,pic
+./usr/lib/i386/libi386.so.2			base-compat-shlib	compat,pic
+./usr/lib/i386/libi386.so.2.0			base-compat-shlib	compat,pic
 ./usr/lib/i386/libproc.so.0			base-compat-shlib	compat,pic,dtrace
 ./usr/lib/i386/libproc.so.0.0			base-compat-shlib	compat,pic,dtrace
 ./usr/lib/i386/librtld_db.so.0			base-compat-shlib	compat,pic,dtrace

Index: src/distrib/sets/lists/base/md.i386
diff -u src/distrib/sets/lists/base/md.i386:1.145 src/distrib/sets/lists/base/md.i386:1.146
--- src/distrib/sets/lists/base/md.i386:1.145	Wed Mar  8 16:52:17 2017
+++ src/distrib/sets/lists/base/md.i386	Sat Aug 12 21:46:01 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.145 2017/03/08 16:52:17 maxv Exp $
+# $NetBSD: md.i386,v 1.146 2017/08/12 21:46:01 kre Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./dev/pms0	base-obsolete		obsolete
@@ -20,8 +20,8 @@
 ./usr/bin/pmc	base-util-bin
 ./usr/bin/vttestbase-obsolete		obsolete
 ./usr/lib/libi386.sobase-sys-shlib		pic
-./usr/lib/libi386.so.1base-sys-shlib		pic
-./usr/lib/libi386.so.1.0			base-sys-shlib		pic
+./usr/lib/libi386.so.2base-sys-shlib		pic
+./usr/lib/libi386.so.2.0			base-sys-shlib		pic
 ./usr/lib/libm387.sobase-sys-shlib		pic
 ./usr/lib/libm387.so.0base-sys-shlib		pic
 ./usr/lib/libm387.so.0.1			base-sys-shlib		pic

Index: src/distrib/sets/lists/debug/md.amd64
diff -u src/distrib/sets/lists/debug/md.amd64:1.97 src/distrib/sets/lists/debug/md.amd64:1.98
--- src/distrib/sets/lists/debug/md.amd64:1.97	Wed Jul 12 17:10:09 2017
+++ src/distrib/sets/lists/debug/md.amd64	Sat Aug 12 21:46:01 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.97 2017/07/12 17:10:09 maxv Exp $
+# $NetBSD: md.amd64,v 1.98 2017/08/12 21:46:01 kre Exp $
 ./usr/lib/i386/12.202++_g.a			comp-c-debuglib		debuglib,compat,12.202xx
 ./usr/lib/i386/libi386_g.a			comp-c-debuglib		debuglib,compat
 ./usr/lib/i386/libiberty_g.a			comp-obsolete		obsolete
@@ -7,7 +7,7 @@
 ./usr/libdata/debug/usr/bin/fdformat.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/iasl.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/pmc.debug		comp-util-debug		debug
-./usr/libdata/debug/usr/lib/i386/libi386.so.1.0.debug	comp-compat-shlib	compat,pic,debug
+./usr/libdata/debug/usr/lib/i386/libi386.so.2.0.debug	comp-compat-shlib	compat,pic,debug
 ./usr/libdata/debug/usr/lib/i386/libpam.so.4.1.debug	comp-compat-shlib	compat,pic,debug,pam
 ./usr/libdata/debug/usr/lib/i386/libproc.so.0.0.debug	comp-compat-shlib	compat,pic,debug,dtrace
 ./usr/libdata/debug/usr/lib/i386/librtld_db.so.0.0.debug	comp-compat-shlib	compat,pic,debug,dtrace

Index: src/distrib/sets/lists/debug/md.i386
diff -u src/distrib/sets/lists/debug/md.i386:1.13 src/distrib/sets/lists/debug/md.i386:1.14
--- src/distrib/sets/lists/debug/md.i386:1.13	Sun Apr  2 01:49:51 2017
+++ src/distrib/sets/lists/debug/md.i386	Sat Aug 12 21:46:01 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.13 2017/04/02 01:49:51 kamil Exp $
+# $NetBSD: md.i386,v 1.14 2017/08/12 21:46:01 kre Exp $
 ./usr/lib/libi386_g.acomp-c-debuglib		debuglib
 ./usr/lib/libm387_g.acomp-c-debuglib		debuglib
 ./usr/lib/libpmc_g.acomp-obsolete		obsolete
@@ -7,7 +7,7 @@
 ./usr/libdata/debug/usr/bin/fdformat.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/iasl.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/pmc.debug		comp-util-debug		debug
-./usr/libdata/debug/usr/lib/libi386.so.1.0.debug	comp-sys-debug	pic,debug
+./usr/libdata/debug/usr/lib/libi386.so.2.0.debug	comp-sys-debug	pic,debug
 

CVS commit: [jdolecek-ncq] src/sys/dev

2017-08-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Aug 12 22:12:04 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: atavar.h wd.c
src/sys/dev/ic [jdolecek-ncq]: ahcisata_core.c siisata.c

Log Message:
do not reset drive after successful NCQ error recovery


To generate a diff of this commit:
cvs rdiff -u -r1.92.8.23 -r1.92.8.24 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.428.2.31 -r1.428.2.32 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.57.6.25 -r1.57.6.26 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.30.4.34 -r1.30.4.35 src/sys/dev/ic/siisata.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/ata/atavar.h
diff -u src/sys/dev/ata/atavar.h:1.92.8.23 src/sys/dev/ata/atavar.h:1.92.8.24
--- src/sys/dev/ata/atavar.h:1.92.8.23	Sat Aug 12 14:41:54 2017
+++ src/sys/dev/ata/atavar.h	Sat Aug 12 22:12:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: atavar.h,v 1.92.8.23 2017/08/12 14:41:54 jdolecek Exp $	*/
+/*	$NetBSD: atavar.h,v 1.92.8.24 2017/08/12 22:12:04 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -184,6 +184,7 @@ struct ata_xfer {
 #define C_RECOVERY	0x0200		/* executed as part of recovery */
 #define C_WAITTIMO	0x0400		/* race vs. timeout */
 #define C_CHAOS		0x0800		/* forced error xfer */
+#define C_RECOVERED	0x1000		/* error recovered, no need for reset */
 
 /* reasons for c_kill_xfer() */
 #define KILL_GONE 1		/* device is gone while xfer was active */

Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.428.2.31 src/sys/dev/ata/wd.c:1.428.2.32
--- src/sys/dev/ata/wd.c:1.428.2.31	Sun Jul 30 20:16:29 2017
+++ src/sys/dev/ata/wd.c	Sat Aug 12 22:12:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.428.2.31 2017/07/30 20:16:29 jdolecek Exp $ */
+/*	$NetBSD: wd.c,v 1.428.2.32 2017/08/12 22:12:04 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.31 2017/07/30 20:16:29 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.32 2017/08/12 22:12:04 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -819,7 +819,8 @@ wddone(device_t self, struct ata_xfer *x
 		errmsg = "error";
 		do_perror = 1;
 retry:		/* Just reset and retry. Can we do more ? */
-		(*wd->atabus->ata_reset_drive)(wd->drvp, AT_POLL, NULL);
+		if ((xfer->c_flags & C_RECOVERED) == 0)
+			(*wd->atabus->ata_reset_drive)(wd->drvp, AT_POLL, NULL);
 retry2:
 		mutex_enter(>sc_lock);
 

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.57.6.25 src/sys/dev/ic/ahcisata_core.c:1.57.6.26
--- src/sys/dev/ic/ahcisata_core.c:1.57.6.25	Tue Aug  1 22:02:32 2017
+++ src/sys/dev/ic/ahcisata_core.c	Sat Aug 12 22:12:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.57.6.25 2017/08/01 22:02:32 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.57.6.26 2017/08/12 22:12:04 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.57.6.25 2017/08/01 22:02:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.57.6.26 2017/08/12 22:12:04 jdolecek Exp $");
 
 #include 
 #include 
@@ -1592,6 +1592,7 @@ ahci_channel_recover(struct ahci_softc *
 		/* Error out the particular NCQ xfer, then requeue the others */
 		if ((achp->ahcic_cmds_active & (1 << eslot)) != 0) {
 			xfer = ata_queue_hwslot_to_xfer(chp, eslot);
+			xfer->c_flags |= C_RECOVERED;
 			xfer->c_intr(chp, xfer,
 			(err << AHCI_P_TFD_ERR_SHIFT) | st);
 		}

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.30.4.34 src/sys/dev/ic/siisata.c:1.30.4.35
--- src/sys/dev/ic/siisata.c:1.30.4.34	Fri Aug 11 18:20:13 2017
+++ src/sys/dev/ic/siisata.c	Sat Aug 12 22:12:04 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.30.4.34 2017/08/11 18:20:13 jdolecek Exp $ */
+/* $NetBSD: siisata.c,v 1.30.4.35 2017/08/12 22:12:04 jdolecek Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.34 2017/08/11 18:20:13 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.35 2017/08/12 22:12:04 jdolecek Exp $");
 
 #include 
 #include 
@@ -653,6 +653,7 @@ siisata_channel_recover(struct ata_chann
 		/* Error out the particular NCQ xfer, then requeue the others */
 		if ((schp->sch_active_slots & (1 << eslot)) != 0) {
 			xfer = ata_queue_hwslot_to_xfer(chp, eslot);
+			xfer->c_flags |= C_RECOVERED;
 			xfer->c_intr(chp, xfer, ATACH_ERR_ST(err, st));
 		}
 		break;



CVS commit: [jdolecek-ncq] src/sys/dev

2017-08-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Aug 12 22:43:22 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq
src/sys/dev/ic [jdolecek-ncq]: mvsata.c mvsatavar.h

Log Message:
add NCQ error recovery for mvsata(4)

fix wait flags for mvsata_bio_start(), AT_* constants are only valid for cmd

change the debug logging to similar form as ahcisata/siisata, so it's
easier to selectively show


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.34 -r1.1.2.35 src/sys/dev/ata/TODO.ncq
cvs rdiff -u -r1.35.6.21 -r1.35.6.22 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.2.48.3 -r1.2.48.4 src/sys/dev/ic/mvsatavar.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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.34 src/sys/dev/ata/TODO.ncq:1.1.2.35
--- src/sys/dev/ata/TODO.ncq:1.1.2.34	Sat Aug 12 14:41:54 2017
+++ src/sys/dev/ata/TODO.ncq	Sat Aug 12 22:43:22 2017
@@ -5,9 +5,6 @@ siisata - fix all new XXX and unmergable
 
 test wd* at umass?, confirm the ata_channel kludge works
 
-do proper NCQ error recovery
-- update mvsata to do same as ahcisata/siisata (read log ext, timeouts, et.al)
-
 do biodone() in wddone() starting the dump to not leak bufs when dumping from
 active system? make sure to not trigger atastart()
 - call ata_kill_active() + ata_kill_pending() when dumping

Index: src/sys/dev/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.35.6.21 src/sys/dev/ic/mvsata.c:1.35.6.22
--- src/sys/dev/ic/mvsata.c:1.35.6.21	Sat Aug 12 14:41:54 2017
+++ src/sys/dev/ic/mvsata.c	Sat Aug 12 22:43:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.35.6.21 2017/08/12 14:41:54 jdolecek Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.35.6.22 2017/08/12 22:43:22 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.21 2017/08/12 14:41:54 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.22 2017/08/12 22:43:22 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -86,12 +86,16 @@ __KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1
 	SHADOW_REG_BLOCK_OFFSET + (reg), (val))
 
 #ifdef MVSATA_DEBUG
-#define DPRINTF(x)	if (mvsata_debug) printf x
-#define	DPRINTFN(n,x)	if (mvsata_debug >= (n)) printf x
-int	mvsata_debug = 2;
+
+#define DEBUG_INTR   0x01
+#define DEBUG_XFERS  0x02
+#define DEBUG_FUNCS  0x08
+#define DEBUG_PROBE  0x10
+
+#define	DPRINTF(n,x)	if (mvsata_debug & (n)) printf x
+int	mvsata_debug = 0;
 #else
-#define DPRINTF(x)
-#define DPRINTFN(n,x)
+#define DPRINTF(n,x)
 #endif
 
 #define ATA_DELAY		1	/* 10s for a drive I/O */
@@ -160,6 +164,7 @@ static void mvsata_bdma_start(struct mvs
 #endif
 
 static int mvsata_nondma_handle(struct mvsata_port *);
+static void mvsata_channel_recover(struct mvsata_port *);
 
 static int mvsata_port_init(struct mvsata_hc *, int);
 static int mvsata_wdc_reg_init(struct mvsata_port *, struct wdc_regs *);
@@ -398,7 +403,7 @@ mvsata_intr(struct mvsata_hc *mvhc)
 
 	cause = MVSATA_HC_READ_4(mvhc, SATAHC_IC);
 
-	DPRINTFN(3, ("%s:%d: mvsata_intr: cause=0x%08x\n",
+	DPRINTF(DEBUG_INTR, ("%s:%d: mvsata_intr: cause=0x%08x\n",
 	device_xname(MVSATA_DEV(sc)), mvhc->hc, cause));
 
 	if (cause & SATAHC_IC_SAINTCOAL)
@@ -432,22 +437,23 @@ mvsata_nondma_handle(struct mvsata_port 
 {
 	struct ata_channel *chp = >port_ata_channel;
 	struct ata_xfer *xfer;
-	int ret, quetag;
+	int ret;
 
 	/*
 	 * The chip doesn't support several pending non-DMA commands,
 	 * and the ata middle layer never issues several non-NCQ commands,
 	 * so there must be exactly one active command at this moment.
 	 */
-	for (quetag = 0; quetag < MVSATA_EDMAQ_LEN; quetag++) {
-		if ((mvport->port_quetagidx & __BIT(quetag)) == 0)
-			continue;
-
-		break;
+	xfer = ata_queue_get_active_xfer(chp);
+	if (xfer == NULL) {
+		/* Can happen after error recovery, ignore */
+		DPRINTF(DEBUG_FUNCS|DEBUG_XFERS,
+		("%s:%d: %s: intr without xfer\n",
+		device_xname(MVSATA_DEV2(mvport)), chp->ch_channel,
+		__func__));
+		return 0;
 	}
-	KASSERT(quetag < MVSATA_EDMAQ_LEN);
 
-	xfer = ata_queue_hwslot_to_xfer(chp, quetag);
 	ret = xfer->c_intr(chp, xfer, 1);
 	return (ret);
 }
@@ -473,7 +479,7 @@ mvsata_error(struct mvsata_port *mvport)
 	}
 	MVSATA_EDMA_WRITE_4(mvport, EDMA_IEC, ~cause);
 
-	DPRINTFN(3, ("%s:%d:%d:"
+	DPRINTF(DEBUG_INTR, ("%s:%d:%d:"
 	" mvsata_error: cause=0x%08x, mask=0x%08x, status=0x%08x\n",
 	device_xname(MVSATA_DEV2(mvport)), mvport->port_hc->hc,
 	mvport->port, cause, MVSATA_EDMA_READ_4(mvport, EDMA_IEM),
@@ -492,8 +498,9 @@ mvsata_error(struct mvsata_port *mvport)
 		if (sc->sc_gen == gen1)
 			mvsata_devconn_gen1(mvport);
 
-		DPRINTFN(3, ("device connected\n"));
+		DPRINTF(DEBUG_INTR, ("device connected\n"));
 	}
+
 #ifndef MVSATA_WITHOUTDMA
 	if ((sc->sc_gen == gen1 && cause & EDMA_IE_ETRANSINT) ||
 	(sc->sc_gen != gen1 &&