CVS commit: src

2016-02-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Feb  2 12:22:23 UTC 2016

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/rump/include/rump: Makefile
src/sys/rump/librump/rumpvfs: rumpfs.c
Added Files:
src/sys/rump/include/rump: rumpfs.h

Log Message:
Add capability to attach external memory to files on rumpfs.  This
feature is useful e.g. for tight-memory systems where you don't need
block storage, but still need to provide some data via files.


To generate a diff of this commit:
cvs rdiff -u -r1.2016 -r1.2017 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/include/rump/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/rump/include/rump/rumpfs.h
cvs rdiff -u -r1.136 -r1.137 src/sys/rump/librump/rumpvfs/rumpfs.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.2016 src/distrib/sets/lists/comp/mi:1.2017
--- src/distrib/sets/lists/comp/mi:1.2016	Sun Jan 31 23:14:34 2016
+++ src/distrib/sets/lists/comp/mi	Tue Feb  2 12:22:23 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2016 2016/01/31 23:14:34 pooka Exp $
+#	$NetBSD: mi,v 1.2017 2016/02/02 12:22:23 pooka Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2666,6 +2666,7 @@
 ./usr/include/rump/rumpdefs.h			comp-c-include	rump
 ./usr/include/rump/rumperr.h			comp-c-include	rump
 ./usr/include/rump/rumperrno2host.h			comp-c-include	rump
+./usr/include/rump/rumpfs.h			comp-c-include	rump
 ./usr/include/rump/rumpkern_if_pub.h		comp-c-include	rump
 ./usr/include/rump/rumpnet_if_pub.h		comp-c-include	rump
 ./usr/include/rump/rumpuser.h			comp-c-include	rump

Index: src/sys/rump/include/rump/Makefile
diff -u src/sys/rump/include/rump/Makefile:1.9 src/sys/rump/include/rump/Makefile:1.10
--- src/sys/rump/include/rump/Makefile:1.9	Sun Jan 31 23:14:34 2016
+++ src/sys/rump/include/rump/Makefile	Tue Feb  2 12:22:23 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2016/01/31 23:14:34 pooka Exp $
+#	$NetBSD: Makefile,v 1.10 2016/02/02 12:22:23 pooka Exp $
 
 .include 
 
@@ -8,6 +8,7 @@ INCSDIR=	/usr/include/rump
 INCS=		rump.h rump_namei.h rump_syscalls.h rump_syscalls_compat.h
 INCS+=		rump_syscallshotgun.h
 INCS+=		rumpdefs.h rumperr.h rumperrno2host.h rumpuser.h rumpvnode_if.h
+INCS+=		rumpfs.h
 
 INCS+=		rumpkern_if_pub.h rumpvfs_if_pub.h rumpnet_if_pub.h
 .endif

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.136 src/sys/rump/librump/rumpvfs/rumpfs.c:1.137
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.136	Tue Jan 26 23:12:18 2016
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Feb  2 12:22:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.136 2016/01/26 23:12:18 pooka Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.137 2016/02/02 12:22:23 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.136 2016/01/26 23:12:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.137 2016/02/02 12:22:23 pooka Exp $");
 
 #include 
 #include 
@@ -58,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1
 #include 
 #include 
 
+#include 
 #include 
 
 static int rump_vop_lookup(void *);
@@ -84,6 +85,7 @@ static int rump_vop_bmap(void *);
 static int rump_vop_strategy(void *);
 static int rump_vop_advlock(void *);
 static int rump_vop_access(void *);
+static int rump_vop_fcntl(void *);
 
 int (**fifo_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
@@ -128,6 +130,7 @@ const struct vnodeopv_entry_desc rump_vn
 	{ &vop_bmap_desc, rump_vop_bmap },
 	{ &vop_strategy_desc, rump_vop_strategy },
 	{ &vop_advlock_desc, rump_vop_advlock },
+	{ &vop_fcntl_desc, rump_vop_fcntl },
 	{ NULL, NULL }
 };
 const struct vnodeopv_desc rump_vnodeop_opv_desc =
@@ -209,6 +212,7 @@ struct rumpfs_node {
 #define RUMPNODE_DIR_ET		0x02
 #define RUMPNODE_DIR_ETSUBS	0x04
 #define RUMPNODE_ET_PHONE_HOST	0x10
+#define RUMPNODE_EXTSTORAGE	0x20
 
 struct rumpfs_mount {
 	struct vnode *rfsmp_rvp;
@@ -931,7 +935,12 @@ rump_vop_setattr(void *v)
 		copylen = MIN(rn->rn_dlen, newlen);
 		memset(newdata, 0, newlen);
 		memcpy(newdata, rn->rn_data, copylen);
-		rump_hyperfree(rn->rn_data, rn->rn_dlen); 
+
+		if ((rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
+			rump_hyperfree(rn->rn_data, rn->rn_dlen); 
+		} else {
+			rn->rn_flags &= ~RUMPNODE_EXTSTORAGE;
+		}
 
 		rn->rn_data = newdata;
 		rn->rn_dlen = newlen;
@@ -1456,7 +1465,11 @@ rump_vop_write(void *v)
 			rn->rn_dlen = oldlen;
 			uvm_vnp_setsize(vp, oldlen);
 		} else {
-			rump_hyperfree(olddata, oldlen);
+			if ((rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
+rump_hyperfree(olddata, oldlen);
+			} else {
+rn->rn_flags &= ~RUMPNODE_EXTSTORAGE;
+			}
 		}
 	}
 
@@ -1620,7 +1633,11 @@ rump_vop

CVS commit: src/share/man/man3

2016-02-02 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Tue Feb  2 12:25:24 UTC 2016

Modified Files:
src/share/man/man3: queue.3

Log Message:
Fix layout for comments. Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/share/man/man3/queue.3

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/man3/queue.3
diff -u src/share/man/man3/queue.3:1.50 src/share/man/man3/queue.3:1.51
--- src/share/man/man3/queue.3:1.50	Wed Dec  3 20:36:33 2014
+++ src/share/man/man3/queue.3	Tue Feb  2 12:25:24 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: queue.3,v 1.50 2014/12/03 20:36:33 snj Exp $
+.\"	$NetBSD: queue.3,v 1.51 2016/02/02 12:25:24 ryoon Exp $
 .\"
 .\" Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -53,7 +53,7 @@
 .\"
 .\"	@(#)queue.3	8.1 (Berkeley) 12/13/93
 .\"
-.Dd May 17, 2014
+.Dd February 2, 2016
 .Dt QUEUE 3
 .Os
 .Sh NAME
@@ -537,8 +537,8 @@ free(n2);
 n3 = SLIST_FIRST(\*[Am]head);
 SLIST_REMOVE_HEAD(\*[Am]head, entries);  /* Deletion from the head. */
 free(n3);
-/* Forward traversal. */
-SLIST_FOREACH(np, \*[Am]head, entries)
+
+SLIST_FOREACH(np, \*[Am]head, entries)   /* Forward traversal. */
 np-\*[Gt] ...
 
 while (!SLIST_EMPTY(\*[Am]head)) {   /* List Deletion. */
@@ -672,7 +672,7 @@ always making the former empty.
 .Sh LIST EXAMPLE
 .Bd -literal
 LIST_HEAD(listhead, entry) head;
-struct listhead *headp;		/* List head. */
+struct listhead *headp;			/* List head. */
 struct entry {
 	...
 	LIST_ENTRY(entry) entries;	/* List. */
@@ -689,11 +689,11 @@ LIST_INSERT_AFTER(n1, n2, entries);
 
 n2 = malloc(sizeof(struct entry));	/* Insert before. */
 LIST_INSERT_BEFORE(n1, n2, entries);
-	/* Forward traversal. */
-LIST_FOREACH(np, \*[Am]head, entries)
+
+LIST_FOREACH(np, \*[Am]head, entries)	/* Forward traversal. */
 	np-\*[Gt] ...
-	/* Delete. */
-while (LIST_FIRST(\*[Am]head) != NULL)
+
+while (LIST_FIRST(\*[Am]head) != NULL)	/* Delete. */
 	LIST_REMOVE(LIST_FIRST(\*[Am]head), entries);
 if (LIST_EMPTY(\*[Am]head))			/* Test for emptiness. */
 	printf("nothing to do\\n");
@@ -857,11 +857,11 @@ SIMPLEQ_INSERT_TAIL(\*[Am]head, n1, entr
 
 n2 = malloc(sizeof(struct entry));	/* Insert after. */
 SIMPLEQ_INSERT_AFTER(\*[Am]head, n1, n2, entries);
-	/* Forward traversal. */
-SIMPLEQ_FOREACH(np, \*[Am]head, entries)
+
+SIMPLEQ_FOREACH(np, \*[Am]head, entries)	/* Forward traversal. */
 	np-\*[Gt] ...
-	/* Delete. */
-while (SIMPLEQ_FIRST(\*[Am]head) != NULL)
+
+while (SIMPLEQ_FIRST(\*[Am]head) != NULL)	/* Delete. */
 	SIMPLEQ_REMOVE_HEAD(\*[Am]head, entries);
 if (SIMPLEQ_EMPTY(\*[Am]head))		/* Test for emptiness. */
 	printf("nothing to do\\n");
@@ -1015,7 +1015,7 @@ removing all entries from the former.
 .Sh TAIL QUEUE EXAMPLE
 .Bd -literal
 TAILQ_HEAD(tailhead, entry) head;
-struct tailhead *headp;		/* Tail queue head. */
+struct tailhead *headp;			/* Tail queue head. */
 struct entry {
 	...
 	TAILQ_ENTRY(entry) entries;	/* Tail queue. */
@@ -1035,14 +1035,14 @@ TAILQ_INSERT_AFTER(\*[Am]head, n1, n2, e
 
 n2 = malloc(sizeof(struct entry));	/* Insert before. */
 TAILQ_INSERT_BEFORE(n1, n2, entries);
-	/* Forward traversal. */
-TAILQ_FOREACH(np, \*[Am]head, entries)
+
+TAILQ_FOREACH(np, \*[Am]head, entries)	/* Forward traversal. */
 	np-\*[Gt] ...
 	/* Reverse traversal. */
 TAILQ_FOREACH_REVERSE(np, \*[Am]head, tailhead, entries)
 	np-\*[Gt] ...
-	/* Delete. */
-while (TAILQ_FIRST(\*[Am]head) != NULL)
+	
+while (TAILQ_FIRST(\*[Am]head) != NULL)	/* Delete. */
 	TAILQ_REMOVE(\*[Am]head, TAILQ_FIRST(\*[Am]head), entries);
 if (TAILQ_EMPTY(\*[Am]head))			/* Test for emptiness. */
 	printf("nothing to do\\n");



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

2016-02-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Feb  2 13:02:34 UTC 2016

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
optimize for size a.k.a. operation nuke trailing spaces


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.137 src/sys/rump/librump/rumpvfs/rumpfs.c:1.138
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.137	Tue Feb  2 12:22:23 2016
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Feb  2 13:02:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.137 2016/02/02 12:22:23 pooka Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.138 2016/02/02 13:02:34 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.137 2016/02/02 12:22:23 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.138 2016/02/02 13:02:34 pooka Exp $");
 
 #include 
 #include 
@@ -937,7 +937,7 @@ rump_vop_setattr(void *v)
 		memcpy(newdata, rn->rn_data, copylen);
 
 		if ((rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
-			rump_hyperfree(rn->rn_data, rn->rn_dlen); 
+			rump_hyperfree(rn->rn_data, rn->rn_dlen);
 		} else {
 			rn->rn_flags &= ~RUMPNODE_EXTSTORAGE;
 		}
@@ -1739,7 +1739,7 @@ rump_vop_fcntl(void *v)
 
 	KASSERT(cmd == RUMPFS_FCNTL_EXTSTORAGE_ADD);
 	if (rn->rn_data && (rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
-		rump_hyperfree(rn->rn_data, rn->rn_dlen); 
+		rump_hyperfree(rn->rn_data, rn->rn_dlen);
 	}
 
 	rn->rn_data = rfse->rfse_data;



CVS commit: src/sys/rump/include/rump-sys

2016-02-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Feb  2 13:07:30 UTC 2016

Modified Files:
src/sys/rump/include/rump-sys: kern.h

Log Message:
Remove leading spaces.

Bet you didn't see that one coming.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/include/rump-sys/kern.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/rump/include/rump-sys/kern.h
diff -u src/sys/rump/include/rump-sys/kern.h:1.1 src/sys/rump/include/rump-sys/kern.h:1.2
--- src/sys/rump/include/rump-sys/kern.h:1.1	Tue Jan 26 23:12:17 2016
+++ src/sys/rump/include/rump-sys/kern.h	Tue Feb  2 13:07:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.h,v 1.1 2016/01/26 23:12:17 pooka Exp $	*/
+/*	$NetBSD: kern.h,v 1.2 2016/02/02 13:07:30 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -228,13 +228,13 @@ struct rump_sysproxy_ops {
 };
 extern struct rump_sysproxy_ops rump_sysproxy_ops;
 #define rump_sysproxy_copyin(arg, raddr, laddr, len)			\
- 	rump_sysproxy_ops.rspo_copyin(arg, raddr, laddr, len)
+	rump_sysproxy_ops.rspo_copyin(arg, raddr, laddr, len)
 #define rump_sysproxy_copyinstr(arg, raddr, laddr, lenp)		\
- 	rump_sysproxy_ops.rspo_copyinstr(arg, raddr, laddr, lenp)
+	rump_sysproxy_ops.rspo_copyinstr(arg, raddr, laddr, lenp)
 #define rump_sysproxy_copyout(arg, laddr, raddr, len)			\
- 	rump_sysproxy_ops.rspo_copyout(arg, laddr, raddr, len)
+	rump_sysproxy_ops.rspo_copyout(arg, laddr, raddr, len)
 #define rump_sysproxy_copyoutstr(arg, laddr, raddr, lenp)		\
- 	rump_sysproxy_ops.rspo_copyoutstr(arg, laddr, raddr, lenp)
+	rump_sysproxy_ops.rspo_copyoutstr(arg, laddr, raddr, lenp)
 #define rump_sysproxy_anonmmap(arg, howmuch, addr)			\
 	rump_sysproxy_ops.rspo_anonmmap(arg, howmuch, addr)
 #define rump_sysproxy_raise(arg, signo)	\



CVS commit: src/sys/arch

2016-02-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  2 13:55:51 UTC 2016

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_emmc.c bcm2835_gpio.c
bcm2835_gpio_subr.c bcm2835_pwm.c bcm2835_space.c bcm2835reg.h
src/sys/arch/evbarm/rpi: rpi_machdep.c

Log Message:
Fix up bcm283[56] bus_space(4) to really use bus addresses for
peripherals, etc

Simplifies the code in various places and uses the abstraction in
more places. (bcm2835_gpio_subr.c still doesn't)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/broadcom/bcm2835_emmc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_gpio.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm2835_gpio_subr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2835_pwm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/broadcom/bcm2835_space.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/broadcom/bcm2835reg.h
cvs rdiff -u -r1.67 -r1.68 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/arm/broadcom/bcm2835_emmc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.28 src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.29
--- src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.28	Sun Aug  9 13:06:44 2015
+++ src/sys/arch/arm/broadcom/bcm2835_emmc.c	Tue Feb  2 13:55:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_emmc.c,v 1.28 2015/08/09 13:06:44 mlelstv Exp $	*/
+/*	$NetBSD: bcm2835_emmc.c,v 1.29 2016/02/02 13:55:50 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.28 2015/08/09 13:06:44 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.29 2016/02/02 13:55:50 skrll Exp $");
 
 #include "bcmdmac.h"
 
@@ -60,6 +60,7 @@ struct bcmemmc_softc {
 
 	bus_space_tag_t		sc_iot;
 	bus_space_handle_t	sc_ioh;
+	bus_addr_t		sc_iob;
 	bus_size_t		sc_ios;
 	struct sdhc_host	*sc_hosts[1];
 	void			*sc_ih;
@@ -73,8 +74,6 @@ struct bcmemmc_softc {
 	bus_dmamap_t		sc_dmamap;
 	bus_dma_segment_t	sc_segs[1];	/* XXX assumes enough descriptors fit in one page */
 	struct bcm_dmac_conblk	*sc_cblk;
-
-	uint32_t		sc_physaddr;
 };
 
 static int bcmemmc_match(device_t, struct cfdata *, void *);
@@ -137,8 +136,8 @@ bcmemmc_attach(device_t parent, device_t
 		"can't map registers for %s: %d\n", aaa->aaa_name, error);
 		return;
 	}
+	sc->sc_iob = aaa->aaa_addr;
 	sc->sc_ios = aaa->aaa_size;
-	sc->sc_physaddr = aaa->aaa_addr;
 
 	aprint_naive(": SDHC controller\n");
 	aprint_normal(": SDHC controller\n");
@@ -267,8 +266,7 @@ bcmemmc_xfer_data_dma(struct sdhc_softc 
 sc->sc_cblk[seg].cb_ti |= DMAC_TI_DEST_WIDTH;
 			sc->sc_cblk[seg].cb_ti |= DMAC_TI_SRC_DREQ;
 			sc->sc_cblk[seg].cb_source_ad =
-			BCM2835_PERIPHERALS_TO_BUS(sc->sc_physaddr +
-			SDHC_DATA);
+			sc->sc_iob + SDHC_DATA;
 			sc->sc_cblk[seg].cb_dest_ad =
 			cmd->c_dmamap->dm_segs[seg].ds_addr;
 		} else {
@@ -284,8 +282,7 @@ bcmemmc_xfer_data_dma(struct sdhc_softc 
 			sc->sc_cblk[seg].cb_source_ad =
 			cmd->c_dmamap->dm_segs[seg].ds_addr;
 			sc->sc_cblk[seg].cb_dest_ad =
-			BCM2835_PERIPHERALS_TO_BUS(sc->sc_physaddr +
-			SDHC_DATA);
+			sc->sc_iob + SDHC_DATA;
 		}
 		sc->sc_cblk[seg].cb_stride = 0;
 		if (seg == cmd->c_dmamap->dm_nsegs - 1) {

Index: src/sys/arch/arm/broadcom/bcm2835_gpio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.2 src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.3
--- src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.2	Mon May 19 08:33:41 2014
+++ src/sys/arch/arm/broadcom/bcm2835_gpio.c	Tue Feb  2 13:55:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_gpio.c,v 1.2 2014/05/19 08:33:41 skrll Exp $	*/
+/*	$NetBSD: bcm2835_gpio.c,v 1.3 2016/02/02 13:55:50 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.2 2014/05/19 08:33:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.3 2016/02/02 13:55:50 skrll Exp $");
 
 /*
  * Driver for BCM2835 GPIO
@@ -101,9 +101,11 @@ bcmgpio_attach(device_t parent, device_t
 {
 	struct bcmgpio_softc * const sc = device_private(self);
 #if NGPIO > 0
+	struct amba_attach_args *aaa = aux;
+	struct gpiobus_attach_args gba;
 	int pin, minpin, maxpin;
 	u_int func;
-	struct gpiobus_attach_args gba;
+	int error;
 #endif
 	
 	sc->sc_dev = self;
@@ -124,10 +126,15 @@ bcmgpio_attach(device_t parent, device_t
 	aprint_naive("\n");	
 	aprint_normal(": GPIO [%d...%d]\n", minpin, maxpin);
 
-	/* already mapped - nothing to gain from struct amba_attach_args */
-	sc->sc_iot = &bcm2835_bs_tag;
-	sc->sc_ioh = BCM2835_IOPHYSTOVIRT(BCM2835_GPIO_BASE);
-	
+	sc->sc_iot = aaa->aaa_iot;
+	error = bus_space_map(sc->sc_iot, aaa->aaa_addr, aaa->aaa_size, 0,
+	&sc->sc_ioh);
+	if (error) {
+		aprint_error_dev(self,
+		"can't map registers f

CVS commit: src/share/mk

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  2 18:38:10 UTC 2016

Modified Files:
src/share/mk: bsd.kmodule.mk

Log Message:
Add the missing CTFMERGE step.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/share/mk/bsd.kmodule.mk

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

Modified files:

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.57 src/share/mk/bsd.kmodule.mk:1.58
--- src/share/mk/bsd.kmodule.mk:1.57	Fri Jan 29 23:07:27 2016
+++ src/share/mk/bsd.kmodule.mk	Tue Feb  2 13:38:10 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.57 2016/01/30 04:07:27 christos Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.58 2016/02/02 18:38:10 christos Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -10,6 +10,7 @@ MKPIE=no
 CFLAGS+=	-g
 # Only need symbols for ctf, strip them after converting to CTF
 CTFFLAGS=	-L VERSION
+CTFMFLAGS=	-t -L VERSION
 .endif
 
 .include 
@@ -189,6 +190,9 @@ ${PROG}: ${OBJS} ${DPADD} ${KMODSCRIPT}
 		-o ${.TARGET} ${OBJS}
 .endif
 .endif
+.if defined(CTFMERGE)
+	${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS}
+.endif
 
 # Install rules
 .if !target(kmodinstall)



CVS commit: src/external/gpl3/binutils/lib/libbfd

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  2 19:15:40 UTC 2016

Modified Files:
src/external/gpl3/binutils/lib/libbfd: Makefile

Log Message:
Fix SSP build.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/gpl3/binutils/lib/libbfd/Makefile

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

Modified files:

Index: src/external/gpl3/binutils/lib/libbfd/Makefile
diff -u src/external/gpl3/binutils/lib/libbfd/Makefile:1.15 src/external/gpl3/binutils/lib/libbfd/Makefile:1.16
--- src/external/gpl3/binutils/lib/libbfd/Makefile:1.15	Fri Jan 29 09:42:47 2016
+++ src/external/gpl3/binutils/lib/libbfd/Makefile	Tue Feb  2 14:15:40 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2016/01/29 14:42:47 christos Exp $
+#	$NetBSD: Makefile,v 1.16 2016/02/02 19:15:40 christos Exp $
 
 NOLINKLIB=	# defined
 NOLINT=		# defined
@@ -41,6 +41,8 @@ CPPFLAGS+=	-I${.CURDIR}/arch/${BFD_MACHI
 CPPFLAGS.elf.c +=	-O0
 .endif
 
+COPTS.pei-x86_64.c += -Wno-stack-protector
+
 GSRCS=		${G_libbfd_la_OBJECTS:libbfd.lo=lib_bfd.lo} \
 		${G_libbfd_la_DEPENDENCIES:M*.lo}
 SRCS=		${GSRCS:.lo=.c}



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

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  2 20:13:59 UTC 2016

Modified Files:
src/sys/arch/amd64/include: elf_machdep.h

Log Message:
Add more relocation constants


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/include/elf_machdep.h

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

Modified files:

Index: src/sys/arch/amd64/include/elf_machdep.h
diff -u src/sys/arch/amd64/include/elf_machdep.h:1.4 src/sys/arch/amd64/include/elf_machdep.h:1.5
--- src/sys/arch/amd64/include/elf_machdep.h:1.4	Thu Mar 18 04:28:33 2010
+++ src/sys/arch/amd64/include/elf_machdep.h	Tue Feb  2 15:13:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_machdep.h,v 1.4 2010/03/18 08:28:33 cegger Exp $	*/
+/*	$NetBSD: elf_machdep.h,v 1.5 2016/02/02 20:13:59 christos Exp $	*/
 
 #if !defined __i386__
 
@@ -46,6 +46,26 @@
 #define R_X86_64_GOTTPOFF	22
 #define R_X86_64_TPOFF32	23
 
+#define R_X86_64_PC64		24
+#define R_X86_64_GOTOFF64	25
+#define R_X86_64_GOTPC32	26
+#define R_X86_64_GOT64		27
+#define R_X86_64_GOTPCREL64	28
+#define R_X86_64_GOTPC64	29
+#define R_X86_64_GOTPLT64	30
+#define R_X86_64_PLTOFF64	31
+#define R_X86_64_SIZE32		32
+#define R_X86_64_SIZE64		33
+#define R_X86_64_GOTPC32_TLSDESC 34
+#define R_X86_64_TLSDESC_CALL	35
+#define R_X86_64_TLSDESC	36
+#define R_X86_64_IRELATIVE	37
+#define R_X86_64_RELATIVE64	38
+#define R_X86_64_PC32_BND	39
+#define R_X86_64_PLT32_BND	40
+#define R_X86_64_GOTPCRELX	41
+#define R_X86_64_REX_GOTPCRELX	42
+
 #define	R_TYPE(name)	__CONCAT(R_X86_64_,name)
 
 #else	/*	!__i386__	*/



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

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  2 20:16:08 UTC 2016

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

Log Message:
more relocations.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/include/elf_machdep.h

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

Modified files:

Index: src/sys/arch/i386/include/elf_machdep.h
diff -u src/sys/arch/i386/include/elf_machdep.h:1.10 src/sys/arch/i386/include/elf_machdep.h:1.11
--- src/sys/arch/i386/include/elf_machdep.h:1.10	Sat May 30 01:56:52 2009
+++ src/sys/arch/i386/include/elf_machdep.h	Tue Feb  2 15:16:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_machdep.h,v 1.10 2009/05/30 05:56:52 skrll Exp $	*/
+/*	$NetBSD: elf_machdep.h,v 1.11 2016/02/02 20:16:08 christos Exp $	*/
 
 #define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2LSB
 #define	ELF32_MACHDEP_ID_CASES		\
@@ -56,8 +56,15 @@
 #define	R_386_TLS_DTPMOD32	35
 #define	R_386_TLS_DTPOFF32	36
 #define	R_386_TLS_TPOFF32	37
+
+#define R_386_SIZE32		38
+
+/* More TLS relocations */
 #define	R_386_TLS_GOTDESC	39
 #define	R_386_TLS_DESC_CALL	40
 #define	R_386_TLS_DESC		41
 
+#define R_386_IRELATIVE		42
+#define R_386_GOT32X		43
+
 #define	R_TYPE(name)	__CONCAT(R_386_,name)



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

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  2 20:16:59 UTC 2016

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

Log Message:
one more.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/include/elf_machdep.h

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

Modified files:

Index: src/sys/arch/i386/include/elf_machdep.h
diff -u src/sys/arch/i386/include/elf_machdep.h:1.11 src/sys/arch/i386/include/elf_machdep.h:1.12
--- src/sys/arch/i386/include/elf_machdep.h:1.11	Tue Feb  2 15:16:08 2016
+++ src/sys/arch/i386/include/elf_machdep.h	Tue Feb  2 15:16:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_machdep.h,v 1.11 2016/02/02 20:16:08 christos Exp $	*/
+/*	$NetBSD: elf_machdep.h,v 1.12 2016/02/02 20:16:59 christos Exp $	*/
 
 #define	ELF32_MACHDEP_ENDIANNESS	ELFDATA2LSB
 #define	ELF32_MACHDEP_ID_CASES		\
@@ -26,6 +26,7 @@
 #define	R_386_RELATIVE	8
 #define	R_386_GOTOFF	9
 #define	R_386_GOTPC	10
+#define	R_386_32PLT	11
 
 /* TLS relocations */
 #define	R_386_TLS_TPOFF	14



CVS commit: src/share/mk

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  2 20:23:24 UTC 2016

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Switch i386 to new binutils.


To generate a diff of this commit:
cvs rdiff -u -r1.892 -r1.893 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.892 src/share/mk/bsd.own.mk:1.893
--- src/share/mk/bsd.own.mk:1.892	Mon Feb  1 07:56:06 2016
+++ src/share/mk/bsd.own.mk	Tue Feb  2 15:23:24 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.892 2016/02/01 12:56:06 skrll Exp $
+#	$NetBSD: bsd.own.mk,v 1.893 2016/02/02 20:23:24 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -135,6 +135,7 @@ EXTERNAL_GDB_SUBDIR=		/does/not/exist
 
 .if ${MACHINE} == "amd64" || \
 ${MACHINE} == "evbarm" || \
+${MACHINE} == "i386" || \
 ${MACHINE} == "hppa"
 HAVE_BINUTILS?=	226
 .else



CVS commit: src/share/mk

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  2 22:35:47 UTC 2016

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
everyone, back to gdb.old


To generate a diff of this commit:
cvs rdiff -u -r1.893 -r1.894 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.893 src/share/mk/bsd.own.mk:1.894
--- src/share/mk/bsd.own.mk:1.893	Tue Feb  2 15:23:24 2016
+++ src/share/mk/bsd.own.mk	Tue Feb  2 17:35:46 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.893 2016/02/02 20:23:24 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.894 2016/02/02 22:35:46 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -128,9 +128,9 @@ USE_SSP?=	yes
 HAVE_GDB?=	79
 
 .if ${HAVE_GDB} == 79
-EXTERNAL_GDB_SUBDIR=		gdb
+EXTERNAL_GDB_SUBDIR=		gdb.old
 .else
-EXTERNAL_GDB_SUBDIR=		/does/not/exist
+EXTERNAL_GDB_SUBDIR=		gdb
 .endif
 
 .if ${MACHINE} == "amd64" || \



CVS commit: src/external/gpl3/gdb/lib

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 03:24:33 UTC 2016

Modified Files:
src/external/gpl3/gdb/lib/libbfd/arch/x86_64: bfd-in3.h bfd.h
bfd_stdint.h bfdver.h config.h defs.mk targmatch.h
src/external/gpl3/gdb/lib/libdecnumber/arch/x86_64: gstdint.h
src/external/gpl3/gdb/lib/libgdb/arch/x86_64: config.h defs.mk init.c
version.c xml-builtin.c
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/build-gnulib: config.h
src/external/gpl3/gdb/lib/libiberty/arch/x86_64: config.h
src/external/gpl3/gdb/lib/libopcodes/arch/x86_64: defs.mk

Log Message:
regen amd64


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfd-in3.h \
src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfd.h \
src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfdver.h \
src/external/gpl3/gdb/lib/libbfd/arch/x86_64/config.h
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfd_stdint.h \
src/external/gpl3/gdb/lib/libbfd/arch/x86_64/targmatch.h
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gdb/lib/libbfd/arch/x86_64/defs.mk
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/gdb/lib/libdecnumber/arch/x86_64/gstdint.h
cvs rdiff -u -r1.6 -r1.7 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/config.h
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/init.c
cvs rdiff -u -r1.5 -r1.6 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/version.c \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/xml-builtin.c
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/build-gnulib/config.h
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gdb/lib/libiberty/arch/x86_64/config.h
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gdb/lib/libopcodes/arch/x86_64/defs.mk

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

Modified files:

Index: src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfd-in3.h
diff -u src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfd-in3.h:1.4 src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfd-in3.h:1.5
--- src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfd-in3.h:1.4	Sun Aug 16 05:51:58 2015
+++ src/external/gpl3/gdb/lib/libbfd/arch/x86_64/bfd-in3.h	Tue Feb  2 22:24:33 2016
@@ -303,10 +303,13 @@ typedef struct bfd_section *sec_ptr;
 
 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
 
+#define bfd_get_section_limit_octets(bfd, sec)			\
+  ((bfd)->direction != write_direction && (sec)->rawsize != 0	\
+   ? (sec)->rawsize : (sec)->size)
+
 /* Find the address one past the end of SEC.  */
 #define bfd_get_section_limit(bfd, sec) \
-  (((bfd)->direction != write_direction && (sec)->rawsize != 0	\
-? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd))
+  (bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd))
 
 /* Return TRUE if input section SEC has been discarded.  */
 #define discarded_section(sec)\
@@ -445,6 +448,16 @@ extern void bfd_hash_traverse
this size.  */
 extern unsigned long bfd_hash_set_default_size (unsigned long);
 
+/* Types of compressed DWARF debug sections.  We currently support
+   zlib.  */
+enum compressed_debug_section_type
+{
+  COMPRESS_DEBUG_NONE = 0,
+  COMPRESS_DEBUG = 1 << 0,
+  COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1,
+  COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2
+};
+
 /* This structure is used to keep track of stabs in sections
information while linking.  */
 
@@ -942,10 +955,10 @@ extern void bfd_elf32_aarch64_init_maps
   (bfd *);
 
 extern void bfd_elf64_aarch64_set_options
-  (bfd *, struct bfd_link_info *, int, int, int, int);
+  (bfd *, struct bfd_link_info *, int, int, int, int, int);
 
 extern void bfd_elf32_aarch64_set_options
-  (bfd *, struct bfd_link_info *, int, int, int, int);
+  (bfd *, struct bfd_link_info *, int, int, int, int, int);
 
 /* ELF AArch64 mapping symbol support.  */
 #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP	(1 << 0)
@@ -996,6 +1009,13 @@ extern void bfd_elf32_ia64_after_parse
 
 extern void bfd_elf64_ia64_after_parse
   (int);
+
+/* V850 Note manipulation routines.  */
+extern bfd_boolean v850_elf_create_sections
+  (struct bfd_link_info *);
+
+extern bfd_boolean v850_elf_set_note
+  (bfd *, unsigned int, unsigned int);
 /* Extracted from init.c.  */
 void bfd_init (void);
 
@@ -1372,6 +1392,10 @@ typedef struct bfd_section
  executables or shared objects. This is for COFF only.  */
 #define SEC_COFF_SHARED 0x800
 
+  /* This section should be compressed.  This is for ELF linker
+ internal use only.  */
+#define SEC_ELF_COMPRESS 0x800
+
   /* When a section with this flag is being linked, then if the size of
  the input section is less than a page, it should not cross a page
  boundary.  If the size of the input section is one page or more,
@@ -1379,1

CVS commit: src/share/mk

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 03:26:02 UTC 2016

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
switch amd64 to gdb-7.10.1


To generate a diff of this commit:
cvs rdiff -u -r1.894 -r1.895 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.894 src/share/mk/bsd.own.mk:1.895
--- src/share/mk/bsd.own.mk:1.894	Tue Feb  2 17:35:46 2016
+++ src/share/mk/bsd.own.mk	Tue Feb  2 22:26:02 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.894 2016/02/02 22:35:46 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.895 2016/02/03 03:26:02 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -125,7 +125,11 @@ USE_SSP?=	yes
 .endif
 .endif
 
+.if ${MACHINE} == "amd64" 
+HAVE_GDB?=	710
+.else
 HAVE_GDB?=	79
+.endif
 
 .if ${HAVE_GDB} == 79
 EXTERNAL_GDB_SUBDIR=		gdb.old



CVS commit: src/usr.bin/mail

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:18:58 UTC 2016

Modified Files:
src/usr.bin/mail: edit.c

Log Message:
PR/50746: David Binderman: Check bounds before dereferencing.


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

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

Modified files:

Index: src/usr.bin/mail/edit.c
diff -u src/usr.bin/mail/edit.c:1.27 src/usr.bin/mail/edit.c:1.28
--- src/usr.bin/mail/edit.c:1.27	Sun Apr 29 19:50:22 2012
+++ src/usr.bin/mail/edit.c	Wed Feb  3 00:18:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.27 2012/04/29 23:50:22 christos Exp $	*/
+/*	$NetBSD: edit.c,v 1.28 2016/02/03 05:18:58 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)edit.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: edit.c,v 1.27 2012/04/29 23:50:22 christos Exp $");
+__RCSID("$NetBSD: edit.c,v 1.28 2016/02/03 05:18:58 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -163,7 +163,7 @@ edit1(int *msgvec, int editortype)
 	 * Deal with each message to be edited . . .
 	 */
 	msgCount = get_msgCount();
-	for (i = 0; msgvec[i] && i < msgCount; i++) {
+	for (i = 0; i < msgCount && msgvec[i]; i++) {
 		sigset_t oset;
 		struct sigaction osa;
 



CVS commit: src/bin/ksh

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:26:16 UTC 2016

Modified Files:
src/bin/ksh: vi.c

Log Message:
PR/50747: David Binderman: check bounds before dereference.
While here add some continues before semicolons.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/vi.c

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

Modified files:

Index: src/bin/ksh/vi.c
diff -u src/bin/ksh/vi.c:1.12 src/bin/ksh/vi.c:1.13
--- src/bin/ksh/vi.c:1.12	Tue Jun 21 23:56:17 2011
+++ src/bin/ksh/vi.c	Wed Feb  3 00:26:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vi.c,v 1.12 2011/06/22 03:56:17 mrg Exp $	*/
+/*	$NetBSD: vi.c,v 1.13 2016/02/03 05:26:16 christos Exp $	*/
 
 /*
  *	vi command editing
@@ -9,7 +9,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: vi.c,v 1.12 2011/06/22 03:56:17 mrg Exp $");
+__RCSID("$NetBSD: vi.c,v 1.13 2016/02/03 05:26:16 christos Exp $");
 #endif
 
 #include "config.h"
@@ -835,7 +835,7 @@ vi_cmd(argcnt, cmd)
 		(cmd[1]=='w' || cmd[1]=='W') &&
 		!isspace((unsigned char)es->cbuf[es->cursor])) {
 	while (isspace((unsigned char)es->cbuf[--ncursor]))
-		;
+		continue;
 	ncursor++;
 }
 if (ncursor > es->cursor) {
@@ -865,7 +865,7 @@ vi_cmd(argcnt, cmd)
 			if (es->linelen != 0)
 es->cursor++;
 			while (putbuf(ybuf, yanklen, 0) == 0 && --argcnt > 0)
-;
+continue;
 			if (es->cursor != 0)
 es->cursor--;
 			if (argcnt != 0)
@@ -1572,15 +1572,16 @@ forwword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor < es->linelen && argcnt--) {
 		if (is_wordch(es->cbuf[ncursor]))
-			while (is_wordch(es->cbuf[ncursor]) &&
-	ncursor < es->linelen)
+			while (ncursor < es->linelen &&
+			is_wordch(es->cbuf[ncursor]))
 ncursor++;
 		else if (!isspace((unsigned char)es->cbuf[ncursor]))
-			while (!is_wordch(es->cbuf[ncursor]) &&
-	!isspace((unsigned char)es->cbuf[ncursor]) &&
-	ncursor < es->linelen)
+			while (ncursor < es->linelen &&
+			!is_wordch(es->cbuf[ncursor]) &&
+			!isspace((unsigned char)es->cbuf[ncursor]))
 ncursor++;
-		while (isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
+		while (ncursor < es->linelen &&
+		isspace((unsigned char)es->cbuf[ncursor]))
 			ncursor++;
 	}
 	return ncursor;
@@ -1595,17 +1596,17 @@ backword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor > 0 && argcnt--) {
 		while (--ncursor > 0 && isspace((unsigned char)es->cbuf[ncursor]))
-			;
+			continue;
 		if (ncursor > 0) {
 			if (is_wordch(es->cbuf[ncursor]))
 while (--ncursor >= 0 &&
    is_wordch(es->cbuf[ncursor]))
-	;
+	continue;
 			else
 while (--ncursor >= 0 &&
    !is_wordch(es->cbuf[ncursor]) &&
    !isspace((unsigned char)es->cbuf[ncursor]))
-	;
+	continue;
 			ncursor++;
 		}
 	}
@@ -1621,18 +1622,18 @@ endword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor < es->linelen && argcnt--) {
 		while (++ncursor < es->linelen - 1 &&
-isspace((unsigned char)es->cbuf[ncursor]))
-			;
+		isspace((unsigned char)es->cbuf[ncursor]))
+			continue;
 		if (ncursor < es->linelen - 1) {
 			if (is_wordch(es->cbuf[ncursor]))
 while (++ncursor < es->linelen &&
-	  is_wordch(es->cbuf[ncursor]))
-	;
+is_wordch(es->cbuf[ncursor]))
+	continue;
 			else
 while (++ncursor < es->linelen &&
    !is_wordch(es->cbuf[ncursor]) &&
    !isspace((unsigned char)es->cbuf[ncursor]))
-	;
+	continue;
 			ncursor--;
 		}
 	}
@@ -1647,9 +1648,11 @@ Forwword(argcnt)
 
 	ncursor = es->cursor;
 	while (ncursor < es->linelen && argcnt--) {
-		while (!isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
+		while (ncursor < es->linelen &&
+		!isspace((unsigned char)es->cbuf[ncursor]))
 			ncursor++;
-		while (isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
+		while (ncursor < es->linelen &&
+		isspace((unsigned char)es->cbuf[ncursor]))
 			ncursor++;
 	}
 	return ncursor;
@@ -1664,7 +1667,7 @@ Backword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor > 0 && argcnt--) {
 		while (--ncursor >= 0 && isspace((unsigned char)es->cbuf[ncursor]))
-			;
+			continue;
 		while (ncursor >= 0 && !isspace((unsigned char)es->cbuf[ncursor]))
 			ncursor--;
 		ncursor++;
@@ -1681,12 +1684,12 @@ Endword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor < es->linelen - 1 && argcnt--) {
 		while (++ncursor < es->linelen - 1 &&
-isspace((unsigned char)es->cbuf[ncursor]))
-			;
+		isspace((unsigned char)es->cbuf[ncursor]))
+			continue;
 		if (ncursor < es->linelen - 1) {
 			while (++ncursor < es->linelen &&
-	!isspace((unsigned char)es->cbuf[ncursor]))
-;
+			!isspace((unsigned char)es->cbuf[ncursor]))
+continue;
 			ncursor--;
 		}
 	}



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

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:27:53 UTC 2016

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
PR/50748: David Binderman: check bounds before dereference


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

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

Modified files:

Index: src/sys/arch/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.65 src/sys/arch/i386/stand/boot/boot2.c:1.66
--- src/sys/arch/i386/stand/boot/boot2.c:1.65	Thu Jun 11 11:56:53 2015
+++ src/sys/arch/i386/stand/boot/boot2.c	Wed Feb  3 00:27:53 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.65 2015/06/11 15:56:53 khorben Exp $	*/
+/*	$NetBSD: boot2.c,v 1.66 2016/02/03 05:27:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -266,8 +266,8 @@ print_banner(void)
 #ifndef SMALL
 	int n;
 	if (bootcfg_info.banner[0]) {
-		for (n = 0; bootcfg_info.banner[n]
-		&& n < BOOTCFG_MAXBANNER; n++) 
+		for (n = 0; n < BOOTCFG_MAXBANNER && bootcfg_info.banner[n];
+		n++) 
 			printf("%s\n", bootcfg_info.banner[n]);
 	} else {
 #endif /* !SMALL */



CVS commit: src/sys/dev

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:29:43 UTC 2016

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

Log Message:
PR/50749: David Binderman: check bounds before dereference.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/dev_verbose.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/dev_verbose.c
diff -u src/sys/dev/dev_verbose.c:1.1 src/sys/dev/dev_verbose.c:1.2
--- src/sys/dev/dev_verbose.c:1.1	Sun Sep 21 10:30:22 2014
+++ src/sys/dev/dev_verbose.c	Wed Feb  3 00:29:43 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dev_verbose.c,v 1.1 2014/09/21 14:30:22 christos Exp $	*/
+/*	$NetBSD: dev_verbose.c,v 1.2 2016/02/03 05:29:43 christos Exp $	*/
 
 /*
  * Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dev_verbose.c,v 1.1 2014/09/21 14:30:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dev_verbose.c,v 1.2 2016/02/03 05:29:43 christos Exp $");
 
 #include 
 
@@ -65,7 +65,7 @@ dev_findvendor(char *buf, size_t len, co
 
 		/* Skip Tokens */
 		n++;
-		while (vendors[n] != 0 && n < nvendors)
+		while (n < nvendors && vendors[n] != 0)
 			n++;
 	}
 	snprintf(buf, len, "vendor %4.4x", vendor);
@@ -86,7 +86,7 @@ dev_findproduct(char *buf, size_t len, c
 
 		/* Skip Tokens */
 		n += 2;
-		while (products[n] != 0 && n < nproducts)
+		while (n < nproducts && products[n] != 0)
 			n++;
 	}
 	snprintf(buf, len, "product %4.4x", product);



CVS commit: src/usr.bin/unexpand

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:32:14 UTC 2016

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

Log Message:
PR/50750: David Binderman: Check bounds before dereference


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/unexpand/unexpand.c

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

Modified files:

Index: src/usr.bin/unexpand/unexpand.c
diff -u src/usr.bin/unexpand/unexpand.c:1.14 src/usr.bin/unexpand/unexpand.c:1.15
--- src/usr.bin/unexpand/unexpand.c:1.14	Sat Dec 20 21:33:13 2008
+++ src/usr.bin/unexpand/unexpand.c	Wed Feb  3 00:32:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: unexpand.c,v 1.14 2008/12/21 02:33:13 christos Exp $	*/
+/*	$NetBSD: unexpand.c,v 1.15 2016/02/03 05:32:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)unexpand.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: unexpand.c,v 1.14 2008/12/21 02:33:13 christos Exp $");
+__RCSID("$NetBSD: unexpand.c,v 1.15 2016/02/03 05:32:14 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -154,8 +154,8 @@ tabify(const char *line, size_t len)
 dcol = (1 + dcol / DSTOP) * DSTOP;
 continue;
 			} else {
-for (n = 0; tabstops[n] - 1 < dcol &&
-n < nstops; n++)
+for (n = 0; n < nstops &&
+tabstops[n] - 1 < dcol; n++)
 	continue;
 if (n < nstops - 1 && tabstops[n] - 1 < limit) {
 	dcol = tabstops[n];
@@ -174,10 +174,10 @@ tabify(const char *line, size_t len)
 ocol = (1 + ocol / DSTOP) * DSTOP;
 			}
 		} else {
-			for (n = 0; tabstops[n] <= ocol && n < nstops; n++)
+			for (n = 0; n < nstops && tabstops[n] <= ocol; n++)
 continue;
-			while (tabstops[n] <= dcol && ocol < dcol &&
-			n < nstops && ocol < limit) {
+			while (n < nstops && tabstops[n] <= dcol && ocol < dcol
+			&& ocol < limit) {
 if (putchar('\t') == EOF)
 	goto out;
 ocol = tabstops[n++];



CVS commit: src/usr.sbin/syslogd

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:34:21 UTC 2016

Modified Files:
src/usr.sbin/syslogd: tls.c

Log Message:
PR/50751: David Binderman: check bounds before dereferencing.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/syslogd/tls.c

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

Modified files:

Index: src/usr.sbin/syslogd/tls.c
diff -u src/usr.sbin/syslogd/tls.c:1.11 src/usr.sbin/syslogd/tls.c:1.12
--- src/usr.sbin/syslogd/tls.c:1.11	Mon May 27 19:15:51 2013
+++ src/usr.sbin/syslogd/tls.c	Wed Feb  3 00:34:21 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.11 2013/05/27 23:15:51 christos Exp $	*/
+/*	$NetBSD: tls.c,v 1.12 2016/02/03 05:34:21 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.11 2013/05/27 23:15:51 christos Exp $");
+__RCSID("$NetBSD: tls.c,v 1.12 2016/02/03 05:34:21 christos Exp $");
 
 #ifndef DISABLE_TLS
 #include "syslogd.h"
@@ -1590,8 +1590,8 @@ tls_split_messages(struct TLS_Incoming_C
 	}
 
 	/* read length prefix, always at start of buffer */
-	while (isdigit((unsigned char)c->inbuf[offset])
-	&& offset < c->read_pos) {
+	while (offset < c->read_pos && isdigit((unsigned char)c->inbuf[offset]))
+	{
 		msglen *= 10;
 		msglen += c->inbuf[offset] - '0';
 		offset++;