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

2012-10-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct  9 08:57:36 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: SHEEVAPLUG

Log Message:
Add {INET,TCP,UDP}_CSUM_COUNTERS and LOCKDEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbarm/conf/SHEEVAPLUG

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/conf/SHEEVAPLUG
diff -u src/sys/arch/evbarm/conf/SHEEVAPLUG:1.23 src/sys/arch/evbarm/conf/SHEEVAPLUG:1.24
--- src/sys/arch/evbarm/conf/SHEEVAPLUG:1.23	Wed Sep 12 00:50:30 2012
+++ src/sys/arch/evbarm/conf/SHEEVAPLUG	Tue Oct  9 08:57:36 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: SHEEVAPLUG,v 1.23 2012/09/12 00:50:30 msaitoh Exp $
+#	$NetBSD: SHEEVAPLUG,v 1.24 2012/10/09 08:57:36 msaitoh Exp $
 #
 #  This configuration supports for generically Marvell SheevaPlug
 #
@@ -92,6 +92,10 @@ options 	INET6		# IPv6
 #options 	IPFILTER_DEFAULT_BLOCK	# block all packets by default
 #options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
 
+#options 	INET_CSUM_COUNTERS
+#options 	TCP_CSUM_COUNTERS
+#options 	UDP_CSUM_COUNTERS
+
 #options 	NFS_BOOT_BOOTP
 options 	NFS_BOOT_DHCP
 #options 	NFS_BOOT_BOOTPARAM
@@ -153,6 +157,7 @@ options 	USBVERBOSE	# verbose USB device
 #options 	PERFCTRS	# performance counters
 options 	DIAGNOSTIC	# internally consistency checks
 options 	DEBUG
+#options 	LOCKDEBUG
 #options 	PMAP_DEBUG	# Enable pmap_debug_level code
 #options 	VERBOSE_INIT_ARM # verbose bootstraping messages
 options 	DDB		# in-kernel debugger



CVS commit: src/sys/dev/pci

2012-10-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct  9 10:25:45 UTC 2012

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

Log Message:
Use PRIxPADDR to print a DMA address. This fix a problem that if_wm.c
can't compile with WM_DEBUG on non-64bit platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.234 src/sys/dev/pci/if_wm.c:1.235
--- src/sys/dev/pci/if_wm.c:1.234	Sat Sep  1 02:08:28 2012
+++ src/sys/dev/pci/if_wm.c	Tue Oct  9 10:25:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.234 2012/09/01 02:08:28 matt Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.235 2012/10/09 10:25:44 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.234 2012/09/01 02:08:28 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.235 2012/10/09 10:25:44 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -3154,7 +3154,7 @@ wm_nq_start(struct ifnet *ifp)
 			sc-sc_nq_txdescs[nexttx].nqtx_data.nqtxd_fields =
 			htole32(fields);
 			DPRINTF(WM_DEBUG_TX,
-			(%s: TX: adv data desc %d 0x% PRIx64 \n,
+			(%s: TX: adv data desc %d 0x% PRIxPADDR \n,
 			device_xname(sc-sc_dev), nexttx, 
 			dmamap-dm_segs[0].ds_addr));
 			DPRINTF(WM_DEBUG_TX,



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

2012-10-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Oct  9 13:35:51 UTC 2012

Modified Files:
src/sys/rump/librump/rumpkern: klock.c rump.c rump_private.h

Log Message:
Gather some statistics about biglock usage.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpkern/klock.c
cvs rdiff -u -r1.246 -r1.247 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.70 -r1.71 src/sys/rump/librump/rumpkern/rump_private.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/librump/rumpkern/klock.c
diff -u src/sys/rump/librump/rumpkern/klock.c:1.4 src/sys/rump/librump/rumpkern/klock.c:1.5
--- src/sys/rump/librump/rumpkern/klock.c:1.4	Mon Feb 20 22:35:14 2012
+++ src/sys/rump/librump/rumpkern/klock.c	Tue Oct  9 13:35:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: klock.c,v 1.4 2012/02/20 22:35:14 mrg Exp $	*/
+/*	$NetBSD: klock.c,v 1.5 2012/10/09 13:35:50 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -29,10 +29,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: klock.c,v 1.4 2012/02/20 22:35:14 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: klock.c,v 1.5 2012/10/09 13:35:50 pooka Exp $);
 
 #include sys/param.h
 #include sys/systm.h
+#include sys/evcnt.h
 
 #include rump/rumpuser.h
 
@@ -46,6 +47,22 @@ struct rumpuser_mtx *rump_giantlock;
 static int giantcnt;
 static struct lwp *giantowner;
 
+static struct evcnt ev_biglock_fast;
+static struct evcnt ev_biglock_slow;
+static struct evcnt ev_biglock_recurse;
+
+void 
+rump_biglock_init(void)
+{
+
+	evcnt_attach_dynamic(ev_biglock_fast, EVCNT_TYPE_MISC, NULL,
+	rump biglock, fast);
+	evcnt_attach_dynamic(ev_biglock_slow, EVCNT_TYPE_MISC, NULL,
+	rump biglock, slow);
+	evcnt_attach_dynamic(ev_biglock_recurse, EVCNT_TYPE_MISC, NULL,
+	rump biglock, recurse);
+}
+
 void
 rump_kernel_bigwrap(int *nlocks)
 {
@@ -74,11 +91,15 @@ _kernel_lock(int nlocks)
 		if (giantowner == l) {
 			giantcnt += nlocks;
 			nlocks = 0;
+			ev_biglock_recurse.ev_count++;
 		} else {
 			if (!rumpuser_mutex_tryenter(rump_giantlock)) {
 rump_unschedule_cpu1(l, NULL);
 rumpuser_mutex_enter_nowrap(rump_giantlock);
 rump_schedule_cpu(l);
+ev_biglock_slow.ev_count++;
+			} else {
+ev_biglock_fast.ev_count++;
 			}
 			giantowner = l;
 			giantcnt = 1;

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.246 src/sys/rump/librump/rumpkern/rump.c:1.247
--- src/sys/rump/librump/rumpkern/rump.c:1.246	Thu Aug 16 19:40:48 2012
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Oct  9 13:35:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.246 2012/08/16 19:40:48 pgoyette Exp $	*/
+/*	$NetBSD: rump.c,v 1.247 2012/10/09 13:35:50 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.246 2012/08/16 19:40:48 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.247 2012/10/09 13:35:50 pooka Exp $);
 
 #include sys/systm.h
 #define ELFSIZE ARCH_ELFSIZE
@@ -340,6 +340,8 @@ rump__init(int rump_version)
 	lwpinit_specificdata();
 	lwp_initspecific(lwp0);
 
+	rump_biglock_init();
+
 	rump_scheduler_init(numcpu);
 	/* revert temporary context and schedule a semireal context */
 	rumpuser_set_curlwp(NULL);

Index: src/sys/rump/librump/rumpkern/rump_private.h
diff -u src/sys/rump/librump/rumpkern/rump_private.h:1.70 src/sys/rump/librump/rumpkern/rump_private.h:1.71
--- src/sys/rump/librump/rumpkern/rump_private.h:1.70	Mon Mar 21 16:41:09 2011
+++ src/sys/rump/librump/rumpkern/rump_private.h	Tue Oct  9 13:35:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_private.h,v 1.70 2011/03/21 16:41:09 pooka Exp $	*/
+/*	$NetBSD: rump_private.h,v 1.71 2012/10/09 13:35:50 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -103,6 +103,7 @@ extern bool rump_ttycomponent;
 struct lwp *	rump__lwproc_alloclwp(struct proc *);
 
 void	rump_cpus_bootstrap(int *);
+void	rump_biglock_init(void);
 void	rump_scheduler_init(int);
 void	rump_schedule(void);
 void	rump_unschedule(void);



CVS commit: [tls-maxphys] src/sys/dev

2012-10-09 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct  9 13:36:07 UTC 2012

Modified Files:
src/sys/dev/ata [tls-maxphys]: atareg.h wd.c
src/sys/dev/ic [tls-maxphys]: ahcisata_core.c ahcisatareg.h
src/sys/dev/pci [tls-maxphys]: acardide.c aceride.c ahcisata_pci.c
artsata.c cmdide.c cypide.c geodeide.c hptide.c iteide.c ixpide.c
jmide.c nside.c optiide.c pciide.c pciide_common.c pdcide.c
pdcsata.c piixide.c rccide.c rdcide.c schide.c siside.c slide.c
stpcide.c svwsata.c toshide.c viaide.c

Log Message:
Support transfers of up to MACHINE_MAXPHYS in all pciide variants, and ahci.
wd(4) limits its maxphys depending on the drives's capability (64k sectors
for LBA48, 256 sectors for LBA and 128 sectors for older devices).

I assumed all pciide controllers could do MACHINE_MAXPHYS transfers, but
this may not be true. The capabilities of each controller variants should be
looked at more closely.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.12.1 src/sys/dev/ata/atareg.h
cvs rdiff -u -r1.400 -r1.400.2.1 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.43 -r1.43.2.1 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.11 -r1.11.12.1 src/sys/dev/ic/ahcisatareg.h
cvs rdiff -u -r1.30 -r1.30.2.1 src/sys/dev/pci/acardide.c \
src/sys/dev/pci/ahcisata_pci.c
cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/dev/pci/aceride.c
cvs rdiff -u -r1.24 -r1.24.2.1 src/sys/dev/pci/artsata.c \
src/sys/dev/pci/geodeide.c src/sys/dev/pci/ixpide.c \
src/sys/dev/pci/optiide.c
cvs rdiff -u -r1.38 -r1.38.2.1 src/sys/dev/pci/cmdide.c
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/dev/pci/cypide.c
cvs rdiff -u -r1.33 -r1.33.2.1 src/sys/dev/pci/hptide.c \
src/sys/dev/pci/siside.c
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/dev/pci/iteide.c
cvs rdiff -u -r1.18 -r1.18.2.1 src/sys/dev/pci/jmide.c
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/dev/pci/nside.c src/sys/dev/pci/rdcide.c \
src/sys/dev/pci/schide.c
cvs rdiff -u -r1.219.18.1 -r1.219.18.2 src/sys/dev/pci/pciide.c
cvs rdiff -u -r1.57 -r1.57.2.1 src/sys/dev/pci/pciide_common.c
cvs rdiff -u -r1.34 -r1.34.2.1 src/sys/dev/pci/pdcide.c
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/dev/pci/pdcsata.c
cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/dev/pci/piixide.c
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/dev/pci/rccide.c \
src/sys/dev/pci/stpcide.c
cvs rdiff -u -r1.28 -r1.28.2.1 src/sys/dev/pci/slide.c
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/dev/pci/svwsata.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/dev/pci/toshide.c
cvs rdiff -u -r1.83 -r1.83.2.1 src/sys/dev/pci/viaide.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/atareg.h
diff -u src/sys/dev/ata/atareg.h:1.40 src/sys/dev/ata/atareg.h:1.40.12.1
--- src/sys/dev/ata/atareg.h:1.40	Mon Oct 24 20:52:34 2011
+++ src/sys/dev/ata/atareg.h	Tue Oct  9 13:36:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: atareg.h,v 1.40 2011/10/24 20:52:34 jakllsch Exp $	*/
+/*	$NetBSD: atareg.h,v 1.40.12.1 2012/10/09 13:36:04 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -138,6 +138,11 @@
 #define	WDCC_READDMA_EXT	0x25	/* read 48-bit addressing with DMA */
 #define	WDCC_WRITEDMA_EXT	0x35	/* write 48-bit addressing with DMA */
 
+/* max transfer size for READ and WRITE commands */
+#define WDC_SECCNT_MAX			(1  7)
+#define WDC_SECCNT_MAX_LBA		(1  8)
+#define WDC_SECCNT_MAX_LBAEXT		(1  16)
+
 #if defined(_KERNEL) || defined(_STANDALONE)
 #include dev/ata/ataconf.h
 

Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.400 src/sys/dev/ata/wd.c:1.400.2.1
--- src/sys/dev/ata/wd.c:1.400	Tue Jul 31 15:50:34 2012
+++ src/sys/dev/ata/wd.c	Tue Oct  9 13:36:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.400 2012/07/31 15:50:34 bouyer Exp $ */
+/*	$NetBSD: wd.c,v 1.400.2.1 2012/10/09 13:36:04 bouyer Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wd.c,v 1.400 2012/07/31 15:50:34 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: wd.c,v 1.400.2.1 2012/10/09 13:36:04 bouyer Exp $);
 
 #include opt_ata.h
 
@@ -356,17 +356,24 @@ wdattach(device_t parent, device_t self,
 		wd-sc_capacity28 =
 		(wd-sc_params.atap_capacity[1]  16) |
 		wd-sc_params.atap_capacity[0];
+		wd-sc_dev-dv_maxphys =
+			min(WDC_SECCNT_MAX_LBAEXT * DEV_BSIZE, parent-dv_maxphys);
+
 	} else if ((wd-sc_flags  WDF_LBA) != 0) {
 		aprint_verbose( LBA addressing\n);
 		wd-sc_capacity28 = wd-sc_capacity =
 		(wd-sc_params.atap_capacity[1]  16) |
 		wd-sc_params.atap_capacity[0];
+		wd-sc_dev-dv_maxphys =
+			min(WDC_SECCNT_MAX_LBA * DEV_BSIZE, parent-dv_maxphys);
 	} else {
 		aprint_verbose( chs addressing\n);
 		wd-sc_capacity28 = wd-sc_capacity =
 		wd-sc_params.atap_cylinders *
 		wd-sc_params.atap_heads *
 		wd-sc_params.atap_sectors;
+		wd-sc_dev-dv_maxphys =
+			min(WDC_SECCNT_MAX * DEV_BSIZE, 

CVS commit: [tls-maxphys] src/sys/uvm

2012-10-09 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct  9 20:07:29 UTC 2012

Modified Files:
src/sys/uvm [tls-maxphys]: uvm_readahead.c

Log Message:
Fix panic bad chunksize ... in read-ahead code:
- off comes from the pager, so should already be page-aligned.
  KASSERT() that it is, and remove the off = trunc_page(off)
- as off is not changed any more, the size of the transfer is chunksize.
  Don't compute bytelen any more,  which is what required chunksize
  to be a power of 2. KASSERT() that chunksize is a multiple of page size.


To generate a diff of this commit:
cvs rdiff -u -r1.8.12.1 -r1.8.12.2 src/sys/uvm/uvm_readahead.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/uvm/uvm_readahead.c
diff -u src/sys/uvm/uvm_readahead.c:1.8.12.1 src/sys/uvm/uvm_readahead.c:1.8.12.2
--- src/sys/uvm/uvm_readahead.c:1.8.12.1	Wed Sep 12 06:15:36 2012
+++ src/sys/uvm/uvm_readahead.c	Tue Oct  9 20:07:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_readahead.c,v 1.8.12.1 2012/09/12 06:15:36 tls Exp $	*/
+/*	$NetBSD: uvm_readahead.c,v 1.8.12.2 2012/10/09 20:07:28 bouyer Exp $	*/
 
 /*-
  * Copyright (c)2003, 2005, 2009 YAMAMOTO Takashi,
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_readahead.c,v 1.8.12.1 2012/09/12 06:15:36 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_readahead.c,v 1.8.12.2 2012/10/09 20:07:28 bouyer Exp $);
 
 #include sys/param.h
 #include sys/pool.h
@@ -109,30 +109,23 @@ ra_startio(struct uvm_object *uobj, off_
 
 	DPRINTF((%s: uobj=%p, off=% PRIu64 , endoff=% PRIu64 \n,
 	__func__, uobj, off, endoff));
-	off = trunc_page(off);
+
+	KASSERT((off  (PAGE_SIZE - 1)) == 0);
+	KASSERT((chunksz  (PAGE_SIZE - 1)) == 0);
 	while (off  endoff) {
 		const size_t chunksize = MIN(chunksz, round_page(sz));
 		int error;
 		size_t donebytes;
 		int npages;
 		int orignpages;
-		size_t bytelen;
 
-		if ((chunksize  (chunksize - 1)) != 0) {
+		if ((chunksize  (PAGE_SIZE - 1)) != 0) {
 		panic(bad chunksize %d, iochunk %d, request size %d,
 			  (int)chunksize, (int)chunksz, (int)sz);
 		}
-		/* KASSERT((chunksize  (chunksize - 1)) == 0); */
+		/* KASSERT((chunksize  (PAGE_SIZE - 1)) == 0); */
 		KASSERT((off  PAGE_MASK) == 0);
-		bytelen = ((off + chunksize)  -(off_t)chunksize) - off;
-		if ((bytelen  PAGE_MASK) != 0) {
-			panic(bad bytelen %d with off %d, chunksize %d
-			  (iochunk %d, sz %d),
-			  (int)bytelen, (int)off, (int)chunksize,
-			  (int)chunksz, (int)sz);
-		}
-		KASSERT((bytelen  PAGE_MASK) == 0);
-		npages = orignpages = bytelen  PAGE_SHIFT;
+		npages = orignpages = chunksize  PAGE_SHIFT;
 		KASSERT(npages != 0);
 
 		/*
@@ -142,8 +135,8 @@ ra_startio(struct uvm_object *uobj, off_
 		mutex_enter(uobj-vmobjlock);
 		error = (*uobj-pgops-pgo_get)(uobj, off, NULL,
 		npages, 0, VM_PROT_READ, UVM_ADV_RANDOM, 0);
-		DPRINTF((%s:  off=% PRIu64 , bytelen=%zu - %d\n,
-		__func__, off, bytelen, error));
+		DPRINTF((%s:  off=% PRIu64 , chunksize=%zu - %d\n,
+		__func__, off, chunksize, error));
 		if (error != 0  error != EBUSY) {
 			if (error != EINVAL) { /* maybe past EOF */
 DPRINTF((%s: error=%d\n, __func__, error));
@@ -204,6 +197,9 @@ uvm_ra_request(struct uvm_ractx *ra, int
 
 	KASSERT(mutex_owned(uobj-vmobjlock));
 
+	KASSERT((reqoff  (PAGE_SIZE - 1)) == 0);
+	KASSERT((reqsize  (PAGE_SIZE - 1)) == 0);
+
 	if (ra == NULL || advice == UVM_ADV_RANDOM) {
 		return;
 	}



CVS commit: src/sys/arch/sparc64/dev

2012-10-09 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Tue Oct  9 20:55:05 UTC 2012

Added Files:
src/sys/arch/sparc64/dev: pckbc_ebus.c

Log Message:
Driver for pckbc at ebus, as found on Tadpole SPARCle.
Largely based on sparc's pckbc_js.c.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc64/dev/pckbc_ebus.c

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

Added files:

Index: src/sys/arch/sparc64/dev/pckbc_ebus.c
diff -u /dev/null src/sys/arch/sparc64/dev/pckbc_ebus.c:1.1
--- /dev/null	Tue Oct  9 20:55:05 2012
+++ src/sys/arch/sparc64/dev/pckbc_ebus.c	Tue Oct  9 20:55:04 2012
@@ -0,0 +1,182 @@
+/*	$NetBSD: pckbc_ebus.c,v 1.1 2012/10/09 20:55:04 jdc Exp $ */
+
+/*
+ * Copyright (c) 2002 Valeriy E. Ushakov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: pckbc_ebus.c,v 1.1 2012/10/09 20:55:04 jdc Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/device.h
+#include sys/malloc.h
+#include sys/bus.h
+#include sys/intr.h
+
+#include machine/autoconf.h
+
+#include dev/ic/i8042reg.h
+#include dev/ic/pckbcvar.h
+#include dev/pckbport/pckbportvar.h
+
+#include dev/ebus/ebusreg.h
+#include dev/ebus/ebusvar.h
+
+struct pckbc_ebus_softc {
+	struct pckbc_softc psc_pckbc;	/* real pckbc softc */
+	uint32_t psc_intr[PCKBC_NSLOTS];
+};
+
+static int	pckbc_ebus_match(device_t, cfdata_t, void *);
+static void	pckbc_ebus_attach(device_t, device_t, void *);
+
+static void	pckbc_ebus_intr_establish(struct pckbc_softc *, pckbport_slot_t);
+
+#define PCKBC_PROM_DEVICE_NAME 8042
+
+CFATTACH_DECL_NEW(pckbc_ebus, sizeof(struct pckbc_ebus_softc),
+pckbc_ebus_match, pckbc_ebus_attach, NULL, NULL);
+
+
+static int
+pckbc_ebus_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct ebus_attach_args *ea = aux;
+
+	return (strcmp(ea-ea_name, PCKBC_PROM_DEVICE_NAME) == 0);
+}
+
+static void
+pckbc_ebus_attach(device_t parent, device_t self, void *aux)
+{
+	struct pckbc_ebus_softc *sc = device_private(self);
+	struct pckbc_softc *psc = (struct pckbc_softc *) sc;
+	struct ebus_attach_args *ea = aux;
+	struct pckbc_internal *t;
+	bus_space_tag_t iot;
+	bus_addr_t ioaddr;
+	int stdin_node, node;
+	int isconsole, i;
+
+	psc-sc_dv = self;
+	iot = ea-ea_bustag;
+	ioaddr = EBUS_ADDR_FROM_REG(ea-ea_reg[0]);
+
+	stdin_node = prom_instance_to_package(prom_stdin());
+	isconsole = 0;
+	for (node = prom_firstchild(ea-ea_node);
+	 node != 0; node = prom_nextsibling(node))
+		if (node == stdin_node) {
+			isconsole = 1;
+			break;
+		}
+
+	psc-intr_establish = pckbc_ebus_intr_establish;
+
+	for (i = 0; i  PCKBC_NSLOTS; i++)
+		sc-psc_intr[i] = ea-ea_intr[i];
+
+	if (isconsole) {
+		int status;
+
+		status = pckbc_cnattach(iot, ioaddr, KBCMDP, 0,
+		PCKBC_NEED_AUXWRITE | PCKBC_CANT_TRANSLATE);
+		if (status == 0)
+			aprint_normal(: cnattach ok);
+		else
+			aprint_error(: cnattach %d, status);
+	}
+
+	if (pckbc_is_console(iot, ioaddr)) {
+		t = pckbc_consdata;
+		pckbc_console_attached = 1;
+	} else {
+		bus_space_handle_t ioh_d, ioh_c;
+
+		if (bus_space_map(iot, ioaddr + KBDATAP, 1, 0, ioh_d) != 0) {
+			aprint_error(: unable to map data register\n);
+			return;
+		}
+
+		if (bus_space_map(iot, ioaddr + KBCMDP,  1, 0, ioh_c) != 0) {
+			bus_space_unmap(iot, ioh_d, 1);
+			aprint_error(: unable to map cmd register\n);
+			return;
+		}
+
+		t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
+		memset(t, 0, sizeof(struct pckbc_internal));
+		t-t_iot = iot;
+		

CVS commit: src/sys/external/bsd/ipf/netinet

2012-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  9 21:32:54 UTC 2012

Modified Files:
src/sys/external/bsd/ipf/netinet: fil.c

Log Message:
remove wrong ntohl (from Aran Clauson)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/ipf/netinet/fil.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/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.5 src/sys/external/bsd/ipf/netinet/fil.c:1.6
--- src/sys/external/bsd/ipf/netinet/fil.c:1.5	Sun Jul 22 12:26:56 2012
+++ src/sys/external/bsd/ipf/netinet/fil.c	Tue Oct  9 17:32:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.5 2012/07/22 16:26:56 darrenr Exp $	*/
+/*	$NetBSD: fil.c,v 1.6 2012/10/09 21:32:54 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fil.c,v 1.5 2012/07/22 16:26:56 darrenr Exp $);
+__KERNEL_RCSID(0, $NetBSD: fil.c,v 1.6 2012/10/09 21:32:54 christos Exp $);
 #else
 static const char sccsid[] = @(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed;
 static const char rcsid[] = @(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $;
@@ -1685,7 +1685,7 @@ ipf_pr_ipv4hdr(fr_info_t *fin)
 	fin-fin_crc += fi-fi_saddr;
 	fi-fi_daddr = ip-ip_dst.s_addr;
 	fin-fin_crc += fi-fi_daddr;
-	if (IN_CLASSD(ntohl(fi-fi_daddr)))
+	if (IN_CLASSD(fi-fi_daddr))
 		fin-fin_flx |= FI_MULTICAST|FI_MBCAST;
 
 	/*



CVS commit: [tls-maxphys] src/sys/uvm

2012-10-09 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct  9 21:37:47 UTC 2012

Modified Files:
src/sys/uvm [tls-maxphys]: uvm_readahead.c

Log Message:
Redo previous: it seems that the point of the bytelen computation was to
get transfers aligned to chunksz. So reintroduce the code, but using chunksz
instead of chunksize (if the readahead is trucated there's no point in
trying to align it anyway).
Now I get 64k read requests at the drive level again.


To generate a diff of this commit:
cvs rdiff -u -r1.8.12.2 -r1.8.12.3 src/sys/uvm/uvm_readahead.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/uvm/uvm_readahead.c
diff -u src/sys/uvm/uvm_readahead.c:1.8.12.2 src/sys/uvm/uvm_readahead.c:1.8.12.3
--- src/sys/uvm/uvm_readahead.c:1.8.12.2	Tue Oct  9 20:07:28 2012
+++ src/sys/uvm/uvm_readahead.c	Tue Oct  9 21:37:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_readahead.c,v 1.8.12.2 2012/10/09 20:07:28 bouyer Exp $	*/
+/*	$NetBSD: uvm_readahead.c,v 1.8.12.3 2012/10/09 21:37:47 bouyer Exp $	*/
 
 /*-
  * Copyright (c)2003, 2005, 2009 YAMAMOTO Takashi,
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_readahead.c,v 1.8.12.2 2012/10/09 20:07:28 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_readahead.c,v 1.8.12.3 2012/10/09 21:37:47 bouyer Exp $);
 
 #include sys/param.h
 #include sys/pool.h
@@ -118,6 +118,7 @@ ra_startio(struct uvm_object *uobj, off_
 		size_t donebytes;
 		int npages;
 		int orignpages;
+		size_t bytelen;
 
 		if ((chunksize  (PAGE_SIZE - 1)) != 0) {
 		panic(bad chunksize %d, iochunk %d, request size %d,
@@ -125,7 +126,16 @@ ra_startio(struct uvm_object *uobj, off_
 		}
 		/* KASSERT((chunksize  (PAGE_SIZE - 1)) == 0); */
 		KASSERT((off  PAGE_MASK) == 0);
-		npages = orignpages = chunksize  PAGE_SHIFT;
+		KASSERT((chunksz  (chunksz - 1)) == 0);
+		bytelen = ((off + chunksz)  -(off_t)chunksz) - off;
+		if ((bytelen  PAGE_MASK) != 0) {
+			panic(bad bytelen %d with off %d, chunksize %d
+			(iochunk %d, sz %d),
+			(int)bytelen, (int)off, (int)chunksize,
+			(int)chunksz, (int)sz);
+		}
+		KASSERT((bytelen  PAGE_MASK) == 0);
+		npages = orignpages = bytelen  PAGE_SHIFT;
 		KASSERT(npages != 0);
 
 		/*
@@ -135,8 +145,8 @@ ra_startio(struct uvm_object *uobj, off_
 		mutex_enter(uobj-vmobjlock);
 		error = (*uobj-pgops-pgo_get)(uobj, off, NULL,
 		npages, 0, VM_PROT_READ, UVM_ADV_RANDOM, 0);
-		DPRINTF((%s:  off=% PRIu64 , chunksize=%zu - %d\n,
-		__func__, off, chunksize, error));
+		DPRINTF((%s:  off=% PRIu64 , bytelen=%zu - %d\n,
+		__func__, off, bytelen, error));
 		if (error != 0  error != EBUSY) {
 			if (error != EINVAL) { /* maybe past EOF */
 DPRINTF((%s: error=%d\n, __func__, error));



CVS commit: [tls-maxphys] src/sys/ufs/ufs

2012-10-09 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct  9 21:53:03 UTC 2012

Modified Files:
src/sys/ufs/ufs [tls-maxphys]: ufs_bmap.c

Log Message:
Use mnt_maxphys not MAXPHYS to limit the size of I/O to disk.
Now the read-ahead code does issue 512k requests to disk.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.49.14.1 src/sys/ufs/ufs/ufs_bmap.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/ufs/ufs/ufs_bmap.c
diff -u src/sys/ufs/ufs/ufs_bmap.c:1.49 src/sys/ufs/ufs/ufs_bmap.c:1.49.14.1
--- src/sys/ufs/ufs/ufs_bmap.c:1.49	Sun Mar  6 17:08:39 2011
+++ src/sys/ufs/ufs/ufs_bmap.c	Tue Oct  9 21:53:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_bmap.c,v 1.49 2011/03/06 17:08:39 bouyer Exp $	*/
+/*	$NetBSD: ufs_bmap.c,v 1.49.14.1 2012/10/09 21:53:03 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_bmap.c,v 1.49 2011/03/06 17:08:39 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_bmap.c,v 1.49.14.1 2012/10/09 21:53:03 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -138,12 +138,12 @@ ufs_bmaparray(struct vnode *vp, daddr_t 
 	if (runp) {
 		/*
 		 * XXX
-		 * If MAXBSIZE is the largest transfer the disks can handle,
+		 * If mnt_maxphys is the largest transfer the disks can handle,
 		 * we probably want maxrun to be 1 block less so that we
 		 * don't create a block larger than the device can handle.
 		 */
 		*runp = 0;
-		maxrun = MAXPHYS / mp-mnt_stat.f_iosize - 1;
+		maxrun = mp-mnt_maxphys / mp-mnt_stat.f_iosize - 1;
 	}
 
 	if (bn = 0  bn  NDADDR) {



CVS commit: src/sys/dev/pci

2012-10-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Oct  9 21:59:19 UTC 2012

Modified Files:
src/sys/dev/pci: wcfb.c wcfbreg.h

Log Message:
add acceleration support, for Sun XVR-1200 and compatible only so far
adapted from OpenBSD with various improvements, no support for Expert3D has
been added
this is still suboptimal since we have to sync the engine all the time but
it's an improvement over software-only operation


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/wcfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/wcfbreg.h

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

Modified files:

Index: src/sys/dev/pci/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.11 src/sys/dev/pci/wcfb.c:1.12
--- src/sys/dev/pci/wcfb.c:1.11	Tue Mar 13 18:40:34 2012
+++ src/sys/dev/pci/wcfb.c	Tue Oct  9 21:59:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.11 2012/03/13 18:40:34 elad Exp $ */
+/*	$NetBSD: wcfb.c,v 1.12 2012/10/09 21:59:19 macallan Exp $ */
 
 /*-
  * Copyright (c) 2010 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.11 2012/03/13 18:40:34 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: wcfb.c,v 1.12 2012/10/09 21:59:19 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -104,7 +104,7 @@ struct wcfb_softc {
 	void (*eraserows)(void *, int, int, long);
 	void (*putchar)(void *, int, int, u_int, long);
 	void (*cursor)(void *, int, int, int);
-	
+	int sc_is_jfb;
 };
 
 static void	wcfb_init_screen(void *, struct vcons_screen *, int, long *);
@@ -130,8 +130,24 @@ static void	wcfb_erasecols(void *, int, 
 static void	wcfb_copyrows(void *, int, int, int);
 static void	wcfb_eraserows(void *, int, int, long);
 
+static void	wcfb_acc_putchar(void *, int, int, u_int, long);
+static void	wcfb_acc_cursor(void *, int, int, int);
+static void	wcfb_acc_copycols(void *, int, int, int, int);
+static void	wcfb_acc_erasecols(void *, int, int, int, long);
+static void	wcfb_acc_copyrows(void *, int, int, int);
+static void	wcfb_acc_eraserows(void *, int, int, long);
+
 static void 	wcfb_putpalreg(struct wcfb_softc *, int, int, int, int);
 
+static void	wcfb_bitblt(struct wcfb_softc *, int, int, int, int, int,
+			int, uint32_t);
+static void	wcfb_rectfill(struct wcfb_softc *, int, int, int, int, int);
+static void	wcfb_rop_common(struct wcfb_softc *, bus_addr_t, int, int, int, 
+			int, int, int, uint32_t, int32_t);
+static void	wcfb_rop_jfb(struct wcfb_softc *, int, int, int, int, int, int, 
+			uint32_t, int32_t);
+static int	wcfb_rop_wait(struct wcfb_softc *);
+
 static int
 wcfb_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -156,7 +172,8 @@ wcfb_attach(device_t parent, device_t se
 	uint32_t		reg;
 	unsigned long		defattr;
 	bool			is_console = 0;
-	void *wtf;
+	void 			*wtf;
+	uint32_t		sub;
 
 	sc-sc_dev = self;
 	sc-putchar = NULL;
@@ -195,14 +212,29 @@ wcfb_attach(device_t parent, device_t se
 	sc-sc_fbaddr = bus_space_vaddr(sc-sc_memt, sc-sc_fbh);
 
 	sc-sc_fb0off =
-	bus_space_read_4(sc-sc_regt, sc-sc_regh, WC_FB8_ADDR0) - sc-sc_fb;
+	bus_space_read_4(sc-sc_regt, sc-sc_regh,
+	WC_FB8_ADDR0) - sc-sc_fb;
 	sc-sc_fb0 = sc-sc_fbaddr + sc-sc_fb0off;
 	sc-sc_fb1off = 
-	bus_space_read_4(sc-sc_regt, sc-sc_regh, WC_FB8_ADDR1) - sc-sc_fb;
+	bus_space_read_4(sc-sc_regt, sc-sc_regh,
+	WC_FB8_ADDR1) - sc-sc_fb;
 	sc-sc_fb1 = sc-sc_fbaddr + sc-sc_fb1off;
 
+	sub = pci_conf_read(sc-sc_pc, sc-sc_pcitag, PCI_SUBSYS_ID_REG);
+	printf(subsys: %08x\n, sub);
+	switch (sub) {
+		case WC_XVR1200:
+			sc-sc_is_jfb = 1;
+			break;
+		default:
+			sc-sc_is_jfb = 0;
+	}
+
 	reg = bus_space_read_4(sc-sc_regt, sc-sc_regh, WC_RESOLUTION);
 	sc-sc_height = (reg  16) + 1;
+#ifdef WCFB_DEBUG
+	sc-sc_height -= 200;
+#endif
 	sc-sc_width = (reg  0x) + 1;
 	sc-sc_stride = 1 
 	((bus_space_read_4(sc-sc_regt, sc-sc_regh, WC_CONFIG) 
@@ -210,11 +242,14 @@ wcfb_attach(device_t parent, device_t se
 	printf(%s: %d x %d, %d\n, device_xname(sc-sc_dev), 
 	sc-sc_width, sc-sc_height, sc-sc_stride);
 
-	sc-sc_shadow = kmem_alloc(sc-sc_stride * sc-sc_height, KM_SLEEP);
-	if (sc-sc_shadow == NULL) {
-		printf(%s: failed to allocate shadow buffer\n,
-		device_xname(self));
-		return;
+	if (sc-sc_is_jfb == 0) {
+		sc-sc_shadow = kmem_alloc(sc-sc_stride * sc-sc_height,
+		KM_SLEEP);
+		if (sc-sc_shadow == NULL) {
+			printf(%s: failed to allocate shadow buffer\n,
+			device_xname(self));
+			return;
+		}
 	}
 
 	for (i = 0x40; i  0x100; i += 16) {
@@ -269,10 +304,17 @@ wcfb_attach(device_t parent, device_t se
 		defattr);
 		sc-sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
 
-		memset(sc-sc_fb0, ri-ri_devcmap[(defattr  16)  0xff],
-		sc-sc_stride * sc-sc_height);
-		memset(sc-sc_fb1, ri-ri_devcmap[(defattr  16)  0xff],
-		sc-sc_stride * sc-sc_height);
+		if (sc-sc_is_jfb) {
+			wcfb_rectfill(sc, 0, 0, sc-sc_width, 

CVS commit: src/external/bsd/bind/dist

2012-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct  9 22:55:40 UTC 2012

Modified Files:
src/external/bsd/bind/dist: CHANGES version
src/external/bsd/bind/dist/bin/named: query.c

Log Message:
Apply P4:

3383.  [security]  A certain combination of records in the RBT could
   cause named to hang while populating the additional
   section of a response. [RT #31090]


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/bind/dist/CHANGES
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/bind/dist/version
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/bind/dist/bin/named/query.c

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

Modified files:

Index: src/external/bsd/bind/dist/CHANGES
diff -u src/external/bsd/bind/dist/CHANGES:1.6 src/external/bsd/bind/dist/CHANGES:1.7
--- src/external/bsd/bind/dist/CHANGES:1.6	Thu Sep 13 01:32:07 2012
+++ src/external/bsd/bind/dist/CHANGES	Tue Oct  9 18:55:39 2012
@@ -1,3 +1,9 @@
+	--- 9.9.1-P4 released ---
+
+3383.	[security]	A certain combination of records in the RBT could
+cause named to hang while populating the additional
+section of a response. [RT #31090]
+
 	--- 9.9.1-P3 released ---
 
 3364.	[security]	Named could die on specially crafted record.

Index: src/external/bsd/bind/dist/version
diff -u src/external/bsd/bind/dist/version:1.3 src/external/bsd/bind/dist/version:1.4
--- src/external/bsd/bind/dist/version:1.3	Thu Sep 13 01:32:07 2012
+++ src/external/bsd/bind/dist/version	Tue Oct  9 18:55:39 2012
@@ -7,4 +7,4 @@ MAJORVER=9
 MINORVER=9
 PATCHVER=1
 RELEASETYPE=-P
-RELEASEVER=3
+RELEASEVER=4

Index: src/external/bsd/bind/dist/bin/named/query.c
diff -u src/external/bsd/bind/dist/bin/named/query.c:1.8 src/external/bsd/bind/dist/bin/named/query.c:1.9
--- src/external/bsd/bind/dist/bin/named/query.c:1.8	Mon Jun  4 20:39:03 2012
+++ src/external/bsd/bind/dist/bin/named/query.c	Tue Oct  9 18:55:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: query.c,v 1.8 2012/06/05 00:39:03 christos Exp $	*/
+/*	$NetBSD: query.c,v 1.9 2012/10/09 22:55:40 christos Exp $	*/
 
 /*
  * Copyright (C) 2004-2012  Internet Systems Consortium, Inc. (ISC)
@@ -1121,13 +1121,6 @@ query_isduplicate(ns_client_t *client, d
 		mname = NULL;
 	}
 
-	/*
-	 * If the dns_name_t we're looking up is already in the message,
-	 * we don't want to trigger the caller's name replacement logic.
-	 */
-	if (name == mname)
-		mname = NULL;
-
 	if (mnamep != NULL)
 		*mnamep = mname;
 
@@ -1332,6 +1325,7 @@ query_addadditional(void *arg, dns_name_
 	if (dns_rdataset_isassociated(rdataset) 
 	!query_isduplicate(client, fname, type, mname)) {
 		if (mname != NULL) {
+			INSIST(mname != fname);
 			query_releasename(client, fname);
 			fname = mname;
 		} else
@@ -1401,11 +1395,13 @@ query_addadditional(void *arg, dns_name_
 #endif
 			if (!query_isduplicate(client, fname,
 	   dns_rdatatype_a, mname)) {
-if (mname != NULL) {
-	query_releasename(client, fname);
-	fname = mname;
-} else
-	need_addname = ISC_TRUE;
+if (mname != fname) {
+	if (mname != NULL) {
+		query_releasename(client, fname);
+		fname = mname;
+	} else
+		need_addname = ISC_TRUE;
+}
 ISC_LIST_APPEND(fname-list, rdataset, link);
 added_something = ISC_TRUE;
 if (sigrdataset != NULL 
@@ -1458,11 +1454,13 @@ query_addadditional(void *arg, dns_name_
 #endif
 			if (!query_isduplicate(client, fname,
 	   dns_rdatatype_, mname)) {
-if (mname != NULL) {
-	query_releasename(client, fname);
-	fname = mname;
-} else
-	need_addname = ISC_TRUE;
+if (mname != fname) {
+	if (mname != NULL) {
+		query_releasename(client, fname);
+		fname = mname;
+	} else
+		need_addname = ISC_TRUE;
+}
 ISC_LIST_APPEND(fname-list, rdataset, link);
 added_something = ISC_TRUE;
 if (sigrdataset != NULL 
@@ -1993,22 +1991,24 @@ query_addadditional2(void *arg, dns_name
 		crdataset-type == dns_rdatatype_) {
 			if (!query_isduplicate(client, fname, crdataset-type,
 	   mname)) {
-if (mname != NULL) {
-	/*
-	 * A different type of this name is
-	 * already stored in the additional
-	 * section.  We'll reuse the name.
-	 * Note that this should happen at most
-	 * once.  Otherwise, fname-link could
-	 * leak below.
-	 */
-	INSIST(mname0 == NULL);
-
-	query_releasename(client, fname);
-	fname = mname;
-	mname0 = mname;
-} else
-	need_addname = ISC_TRUE;
+if (mname != fname) {
+	if (mname != NULL) {
+		/*
+		 * A different type of this name is
+		 * already stored in the additional
+		 * section.  We'll reuse the name.
+		 * Note that this should happen at most
+		 * once.  Otherwise, fname-link could
+		 * leak below.
+		 */
+		INSIST(mname0 

CVS commit: [netbsd-6] src/etc/rc.d

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 22:58:35 UTC 2012

Modified Files:
src/etc/rc.d [netbsd-6]: named

Log Message:
Pull up following revision(s) (requested by christos in ticket #587):
etc/rc.d/named: revision 1.23
PR/47024: Taylor R Campbell: handle keys directory and directory
permissions in general


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.8.1 src/etc/rc.d/named

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

Modified files:

Index: src/etc/rc.d/named
diff -u src/etc/rc.d/named:1.22 src/etc/rc.d/named:1.22.8.1
--- src/etc/rc.d/named:1.22	Mon Aug  3 17:45:48 2009
+++ src/etc/rc.d/named	Tue Oct  9 22:58:35 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: named,v 1.22 2009/08/03 17:45:48 perry Exp $
+# $NetBSD: named,v 1.22.8.1 2012/10/09 22:58:35 riz Exp $
 #
 
 # PROVIDE: named
@@ -20,38 +20,43 @@ required_dirs=$named_chrootdir	# if it
 
 named_migrate()
 {
-	local src=$1
-	local dst=$2$1
+	local src=$1
+	local dst=$2$1
 	echo Migrating $src to $dst
 (
 	diff=false
-	cd $src
+	cd $src
+	mkdir -p $dst
 	for f in $(find . -type f)
 	do
-		f=${f##./}
-		case $f in
+		f=${f##./}
+		case $f in
 		*/*)
-			d=$dst/$(dirname $f)
+			ds=$(dirname $f)
+			dd=$dst/$ds
+			mkdir -p $dd
+			chmod $(stat -f %p $ds |
+			sed -e 's/.*\([0-7][0-7][0-7][0-7]\)$/\1/g') $dd
+			chown $(stat -f %u:%g $ds) $dd
 			;;
-		*)	d=$dst
+		*)
 			;;
 		esac
-		mkdir -p $d
 		if [ -r $dst/$f ]
 		then
-			if ! cmp $f $dst/$f; then
+			if ! cmp $f $dst/$f; then
 diff=true
 			fi
 		else
-			cp -p $f $dst/$f
+			cp -p $f $dst/$f
 		fi
 	done
 	if $diff; then
 		echo Cannot complete migration because files are different
 		echo Run 'diff -r $src $dst' resolve the differences
 	else
-		rm -fr $src
-		ln -s $dst $src
+		rm -fr $src
+		ln -s $dst $src
 	fi
 )
 }
@@ -59,6 +64,10 @@ named_migrate()
 named_precmd()
 {
 	if [ -z $named_chrootdir ]; then
+		if [ ! -d /etc/namedb/keys ]; then
+			mkdir -m 775 /etc/namedb/keys
+			chown named:named /etc/namedb/keys
+		fi
 		return 0;
 	fi
 
@@ -87,8 +96,7 @@ named_precmd()
 		;;
 	esac
 
-	for i in null random
-	do
+	for i in null random; do
 		if [ ! -c ${named_chrootdir}/dev/$i ]; then
 			rm -f ${named_chrootdir}/dev/$i
 			(cd /dev  
@@ -99,12 +107,15 @@ named_precmd()
 	if [ ! -h /etc/namedb ]; then
 		named_migrate /etc/namedb ${named_chrootdir}
 	fi
-	if [ \( -r /etc/named.conf \) -a \( ! -h /etc/named.conf \) -a \
-	 \( ! -r ${named_chrootdir}/etc/named.conf \) ]
-	then
-		mv /etc/named.conf ${named_chrootdir}/etc/named.conf
-		ln -s ${named_chrootdir}/etc/named.conf /etc/named.conf
-	fi
+
+	for i in named.conf rndc.key; do
+		if [ \( -r /etc/$i \) -a \( ! -h /etc/$i \) -a \
+		 \( ! -r ${named_chrootdir}/etc/$i \) ]; then
+			mv /etc/$i ${named_chrootdir}/etc/$i
+			ln -s ${named_chrootdir}/etc/$i /etc/$i
+		fi
+	done
+
 	if [ \( ! -r ${named_chrootdir}/etc/named.conf \) -a \
 	\( -r ${named_chrootdir}/etc/namedb/named.conf \) ]; then
 		ln -s namedb/named.conf ${named_chrootdir}/etc



CVS commit: [netbsd-6] src/share/man/man5

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:03:47 UTC 2012

Modified Files:
src/share/man/man5 [netbsd-6]: ifconfig.if.5 rc.conf.5

Log Message:
Pull up following revision(s) (requested by roy in ticket #588):
share/man/man5/ifconfig.if.5: revision 1.16
share/man/man5/rc.conf.5: revision 1.154
Discourage the use of ifconfig_bge0=dhcp and prefer setting dhcpcd=YES
in rc.conf(5) instead.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.6.1 src/share/man/man5/ifconfig.if.5
cvs rdiff -u -r1.151.2.1 -r1.151.2.2 src/share/man/man5/rc.conf.5

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/man5/ifconfig.if.5
diff -u src/share/man/man5/ifconfig.if.5:1.15 src/share/man/man5/ifconfig.if.5:1.15.6.1
--- src/share/man/man5/ifconfig.if.5:1.15	Thu Apr  7 00:22:59 2011
+++ src/share/man/man5/ifconfig.if.5	Tue Oct  9 23:03:47 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: ifconfig.if.5,v 1.15 2011/04/07 00:22:59 jym Exp $
+.\	$NetBSD: ifconfig.if.5,v 1.15.6.1 2012/10/09 23:03:47 riz Exp $
 .\
 .\ Copyright (c) 1996 Matthew R. Green
 .\ All rights reserved.
@@ -87,6 +87,12 @@ If the line is equal to
 .Dq dhcp ,
 .Xr dhcpcd 8
 will be started for the interface.
+However, it is instead recommended that
+.Sy dhcpcd
+is set to true in
+.Xr rc.conf 5
+and any per interface configuration or restriction is done in
+.Xr dhcpcd.conf 5 .
 .Pp
 If a line is empty, or starts with
 .Sq # ,

Index: src/share/man/man5/rc.conf.5
diff -u src/share/man/man5/rc.conf.5:1.151.2.1 src/share/man/man5/rc.conf.5:1.151.2.2
--- src/share/man/man5/rc.conf.5:1.151.2.1	Sat Jun 23 22:54:59 2012
+++ src/share/man/man5/rc.conf.5	Tue Oct  9 23:03:47 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: rc.conf.5,v 1.151.2.1 2012/06/23 22:54:59 riz Exp $
+.\	$NetBSD: rc.conf.5,v 1.151.2.2 2012/10/09 23:03:47 riz Exp $
 .\
 .\ Copyright (c) 1996 Matthew R. Green
 .\ All rights reserved.
@@ -642,13 +642,30 @@ then you should specify an alternate loc
 file in the
 .Sy dhclient_flags
 variable - for example, -lf /tmp/dhclient.leases.
+.It Sy dhcpcd
+Boolean value.
+Set true to configure some or all network interfaces using dhcpcd.
+If you set
+.Sy dhcpcd
+true, then
+.Pa /var
+must be in
+.Sy critical_filesystems_local ,
+or
+.Pa /var
+must be on the root file system.
+If you need to restrict dhcpcd to one or a number of interfaces,
+or need a separate configuration per interface,
+then this should be done in the configuration file - see
+.Xr dhcpcd.conf 5
+for details.
 .It Sy dhcpcd_flags
-Additional arguments to pass to
+Passes
+.Sy dhcpcd_flags
+to dhcpcd.
+See
 .Xr dhcpcd 8
-when requesting configuration via
-.Sy ifconfig_xxN
-or
-.Pa /etc/ifconfig.xxN .
+for complete documentation.
 .It Sy flushroutes
 Boolean value.
 Flushes the route table on networking startup.
@@ -816,12 +833,7 @@ variable contains a single line with emb
 then the value is split into multiple lines prior to further parsing,
 treating the semicolon as a line separator.
 .Pp
-One common case is to set
-.Sy ifconfig_xxN Ns Li \= Ns Qq dhcp ,
-which will cause
-.Xr dhcpcd 8
-to be started for the interface.
-Another common case it to set the
+One common case it to set the
 .Sy ifconfig_xxN
 variable to a set of arguments to be passed to an
 .Xr ifconfig 8



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

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:06:13 UTC 2012

Modified Files:
src/sys/arch/powerpc/powerpc [netbsd-6]: trap.c

Log Message:
sys/arch/powerpc/powerpc/trap.c patch

Silence trap printfs caused by OpenSSL.
[christos, ticket #589]


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.145.8.1 src/sys/arch/powerpc/powerpc/trap.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/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.145 src/sys/arch/powerpc/powerpc/trap.c:1.145.8.1
--- src/sys/arch/powerpc/powerpc/trap.c:1.145	Tue Sep 27 01:02:36 2011
+++ src/sys/arch/powerpc/powerpc/trap.c	Tue Oct  9 23:06:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.145 2011/09/27 01:02:36 jym Exp $	*/
+/*	$NetBSD: trap.c,v 1.145.8.1 2012/10/09 23:06:13 riz Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.145 2011/09/27 01:02:36 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.145.8.1 2012/10/09 23:06:13 riz Exp $);
 
 #include opt_altivec.h
 #include opt_ddb.h
@@ -258,7 +258,9 @@ trap(struct trapframe *tf)
 			break;
 		}
 		ci-ci_ev_udsi_fatal.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		 (p-p_slflag  PSL_TRACED) == 0
+		 !sigismember(p-p_sigctx.ps_sigcatch, SIGSEGV)) {
 			printf(trap: pid %d.%d (%s): user %s DSI trap @ %#lx 
 			by %#lx (DSISR %#x, err=%d)\n,
 			p-p_pid, l-l_lid, p-p_comm,
@@ -325,7 +327,9 @@ trap(struct trapframe *tf)
 			break;
 		}
 		ci-ci_ev_isi_fatal.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		 (p-p_slflag  PSL_TRACED) == 0
+		 !sigismember(p-p_sigctx.ps_sigcatch, SIGSEGV)) {
 			printf(trap: pid %d.%d (%s): user ISI trap @ %#lx 
 			(SRR1=%#lx)\n, p-p_pid, l-l_lid, p-p_comm,
 			tf-tf_srr0, tf-tf_srr1);
@@ -352,7 +356,9 @@ trap(struct trapframe *tf)
 		ci-ci_ev_ali.ev_count++;
 		if (fix_unaligned(l, tf) != 0) {
 			ci-ci_ev_ali_fatal.ev_count++;
-			if (cpu_printfataltraps) {
+			if (cpu_printfataltraps
+			 (p-p_slflag  PSL_TRACED) == 0
+			 !sigismember(p-p_sigctx.ps_sigcatch, SIGBUS)) {
 printf(trap: pid %d.%d (%s): user ALI trap @ 
 %#lx by %#lx (DSISR %#x)\n,
 p-p_pid, l-l_lid, p-p_comm,
@@ -376,7 +382,9 @@ trap(struct trapframe *tf)
 		vec_load();
 		break;
 #else
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		 (p-p_slflag  PSL_TRACED) == 0
+		 !sigismember(p-p_sigctx.ps_sigcatch, SIGILL)) {
 			printf(trap: pid %d.%d (%s): user VEC trap @ %#lx 
 			(SRR1=%#lx)\n,
 			p-p_pid, l-l_lid, p-p_comm,
@@ -392,7 +400,9 @@ trap(struct trapframe *tf)
 #endif
 	case EXC_MCHK|EXC_USER:
 		ci-ci_ev_umchk.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		 (p-p_slflag  PSL_TRACED) == 0
+		 !sigismember(p-p_sigctx.ps_sigcatch, SIGBUS)) {
 			printf(trap: pid %d (%s): user MCHK trap @ %#lx 
 			(SRR1=%#lx)\n,
 			p-p_pid, p-p_comm, tf-tf_srr0, tf-tf_srr1);
@@ -436,10 +446,14 @@ trap(struct trapframe *tf)
 ksi.ksi_code = ILL_PRVOPC;
 			} else
 ksi.ksi_code = ILL_ILLOPC;
-			if (cpu_printfataltraps)
+			if (cpu_printfataltraps
+			 (p-p_slflag  PSL_TRACED) == 0
+			 !sigismember(p-p_sigctx.ps_sigcatch,
+ksi.ksi_signo)) {
 printf(trap: pid %d.%d (%s): user PGM trap @
  %#lx (SRR1=%#lx)\n, p-p_pid, l-l_lid,
 p-p_comm, tf-tf_srr0, tf-tf_srr1);
+			}
 			(*p-p_emul-e_trapsignal)(l, ksi);
 		}
 		break;



CVS commit: [netbsd-6] src/usr.sbin/npf/npfctl

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:08:21 UTC 2012

Modified Files:
src/usr.sbin/npf/npfctl [netbsd-6]: npf_parse.y

Log Message:
Pull up following revision(s) (requested by rmind in ticket #590):
usr.sbin/npf/npfctl/npf_parse.y: revision 1.14
npfctl/yyerror(): print the right line number if we already parsed the line.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.6 -r1.3.2.7 src/usr.sbin/npf/npfctl/npf_parse.y

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf_parse.y
diff -u src/usr.sbin/npf/npfctl/npf_parse.y:1.3.2.6 src/usr.sbin/npf/npfctl/npf_parse.y:1.3.2.7
--- src/usr.sbin/npf/npfctl/npf_parse.y:1.3.2.6	Mon Aug 13 17:49:52 2012
+++ src/usr.sbin/npf/npfctl/npf_parse.y	Tue Oct  9 23:08:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_parse.y,v 1.3.2.6 2012/08/13 17:49:52 riz Exp $	*/
+/*	$NetBSD: npf_parse.y,v 1.3.2.7 2012/10/09 23:08:21 riz Exp $	*/
 
 /*-
  * Copyright (c) 2011-2012 The NetBSD Foundation, Inc.
@@ -55,17 +55,23 @@ yyerror(const char *fmt, ...)
 	extern char *yytext;
 
 	char *msg, *context = xstrndup(yytext, yyleng);
-	size_t len = strlen(context);
-	char *dst = zalloc(len * 4 + 1);
+	bool eol = (*context == '\n');
 	va_list ap;
 
 	va_start(ap, fmt);
 	vasprintf(msg, fmt, ap);
 	va_end(ap);
 
-	strvisx(dst, context, len, VIS_WHITE|VIS_CSTYLE);
-	fprintf(stderr, %s:%d:%d: %s near '%s'\n, yyfilename, yylineno,
-	yycolumn, msg, dst);
+	fprintf(stderr, %s:%d:%d: %s, yyfilename,
+	yylineno - (int)eol, yycolumn, msg);
+	if (!eol) {
+		size_t len = strlen(context);
+		char *dst = zalloc(len * 4 + 1);
+
+		strvisx(dst, context, len, VIS_WHITE|VIS_CSTYLE);
+		fprintf(stderr,  near '%s', dst);
+	}
+	fprintf(stderr, \n);
 	exit(EXIT_FAILURE);
 }
 



CVS commit: [netbsd-6] src/doc

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:12:57 UTC 2012

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

Log Message:
Tickets 587-590.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.213 -r1.1.2.214 src/doc/CHANGES-6.0

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
diff -u src/doc/CHANGES-6.0:1.1.2.213 src/doc/CHANGES-6.0:1.1.2.214
--- src/doc/CHANGES-6.0:1.1.2.213	Mon Oct  1 23:09:00 2012
+++ src/doc/CHANGES-6.0	Tue Oct  9 23:12:57 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.213 2012/10/01 23:09:00 riz Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.214 2012/10/09 23:12:57 riz Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -8780,3 +8780,26 @@ sys/sys/lwp.h	1.164 via patch
 	Fix a race condition in exit_lwps, lwp_rwait.  PR#46168, PR#46402.
 	[rmind, ticket #583]
 
+etc/rc.d/named	1.23
+
+	Handle keys directory and directory permissions better, so
+	that DNSSEC validation works out of the box. PR#47024.
+	[christos, ticket #587]
+
+share/man/man5/ifconfig.if.5			1.16
+share/man/man5/rc.conf.5			1.154 via patch
+
+	Discourage the use of ifconfig_bge0=dhcp and prefer setting dhcpcd=YES
+	in rc.conf(5) instead.
+	[roy, ticket #588]
+
+sys/arch/powerpc/powerpc/trap.c			patch
+
+	Silence trap printfs caused by OpenSSL.
+	[christos, ticket #589]
+
+usr.sbin/npf/npfctl/npf_parse.y			1.14
+
+	Print the correct line number in npfctl.
+	[rmind, ticket #590]
+



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

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:45:21 UTC 2012

Modified Files:
src/sys/kern [netbsd-6]: uipc_usrreq.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #593):
sys/kern/uipc_usrreq.c: revision 1.140
Avoid crash dereferencing a NULL fp in fd_affix() in unp_externalize
caused by the sequence of passing two fd's with two sendmsg()'s,
then doing a read() and a recvmsg(). The read() calls dom_dispose()
which discards both messages in the mbuf, and sets the fp's in the
array to NULL. Linux dequeues only one message per read() so the
second recvmsg() gets the fd from the second message.  This fix
just avoids the NULL pointer de-reference, making the second
recvmsg() to fail. It is dubious to pass fd's with stream sockets
and expect mixing read() and recvmsg() to work. Plus processing
one control message per read() changes the current semantics and
should be examined before applied. In addition there is a race between
dom_externalize() and dom_dispose(): what happens in a multi-threaded
network stack when one thread disposes where the other externalizes
the same array?
NB: Pullup to 6.


To generate a diff of this commit:
cvs rdiff -u -r1.136.8.1 -r1.136.8.2 src/sys/kern/uipc_usrreq.c

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

Modified files:

Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.136.8.1 src/sys/kern/uipc_usrreq.c:1.136.8.2
--- src/sys/kern/uipc_usrreq.c:1.136.8.1	Mon Jun 11 23:20:38 2012
+++ src/sys/kern/uipc_usrreq.c	Tue Oct  9 23:45:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.136.8.1 2012/06/11 23:20:38 riz Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.136.8.2 2012/10/09 23:45:21 riz Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_usrreq.c,v 1.136.8.1 2012/06/11 23:20:38 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_usrreq.c,v 1.136.8.2 2012/10/09 23:45:21 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1235,78 +1235,66 @@ unp_drain(void)
 int
 unp_externalize(struct mbuf *rights, struct lwp *l, int flags)
 {
-	struct cmsghdr *cm = mtod(rights, struct cmsghdr *);
-	struct proc *p = l-l_proc;
-	int i, *fdp;
+	struct cmsghdr * const cm = mtod(rights, struct cmsghdr *);
+	struct proc * const p = l-l_proc;
 	file_t **rp;
-	file_t *fp;
-	int nfds, error = 0;
+	int error = 0;
 
-	nfds = (cm-cmsg_len - CMSG_ALIGN(sizeof(*cm))) /
+	const size_t nfds = (cm-cmsg_len - CMSG_ALIGN(sizeof(*cm))) /
 	sizeof(file_t *);
-	rp = (file_t **)CMSG_DATA(cm);
 
-	fdp = malloc(nfds * sizeof(int), M_TEMP, M_WAITOK);
+	int * const fdp = kmem_alloc(nfds * sizeof(int), KM_SLEEP);
 	rw_enter(p-p_cwdi-cwdi_lock, RW_READER);
 
 	/* Make sure the recipient should be able to see the files.. */
-	if (p-p_cwdi-cwdi_rdir != NULL) {
-		rp = (file_t **)CMSG_DATA(cm);
-		for (i = 0; i  nfds; i++) {
-			fp = *rp++;
-			/*
-			 * If we are in a chroot'ed directory, and
-			 * someone wants to pass us a directory, make
-			 * sure it's inside the subtree we're allowed
-			 * to access.
-			 */
-			if (fp-f_type == DTYPE_VNODE) {
-vnode_t *vp = (vnode_t *)fp-f_data;
-if ((vp-v_type == VDIR) 
-!vn_isunder(vp, p-p_cwdi-cwdi_rdir, l)) {
-	error = EPERM;
-	break;
-}
+	rp = (file_t **)CMSG_DATA(cm);
+	for (size_t i = 0; i  nfds; i++) {
+		file_t * const fp = *rp++;
+		if (fp == NULL) {
+			error = EINVAL;
+			goto out;
+		}
+		/*
+		 * If we are in a chroot'ed directory, and
+		 * someone wants to pass us a directory, make
+		 * sure it's inside the subtree we're allowed
+		 * to access.
+		 */
+		if (p-p_cwdi-cwdi_rdir != NULL  fp-f_type == DTYPE_VNODE) {
+			vnode_t *vp = (vnode_t *)fp-f_data;
+			if ((vp-v_type == VDIR) 
+			!vn_isunder(vp, p-p_cwdi-cwdi_rdir, l)) {
+error = EPERM;
+goto out;
 			}
 		}
 	}
 
  restart:
-	rp = (file_t **)CMSG_DATA(cm);
-	if (error != 0) {
-		for (i = 0; i  nfds; i++) {
-			fp = *rp;
-			*rp++ = 0;
-			unp_discard_now(fp);
-		}
-		goto out;
-	}
-
 	/*
 	 * First loop -- allocate file descriptor table slots for the
 	 * new files.
 	 */
-	for (i = 0; i  nfds; i++) {
-		fp = *rp++;
+	for (size_t i = 0; i  nfds; i++) {
 		if ((error = fd_alloc(p, 0, fdp[i])) != 0) {
 			/*
 			 * Back out what we've done so far.
 			 */
-			for (--i; i = 0; i--) {
+			while (i--  0) {
 fd_abort(p, NULL, fdp[i]);
 			}
 			if (error == ENOSPC) {
 fd_tryexpand(p);
 error = 0;
-			} else {
-/*
- * This is the error that has historically
- * been returned, and some callers may
- * expect it.
- */
-error = EMSGSIZE;
+goto restart;
 			}
-			goto restart;
+			/*
+			 * This is the error that has historically
+			 * been returned, and some callers may
+			 * expect it.
+			 */
+			error = EMSGSIZE;
+			goto out;
 		}
 	}
 
@@ -1315,12 +1303,17 @@ 

CVS commit: [netbsd-6] src/sys/net/npf

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:49:03 UTC 2012

Modified Files:
src/sys/net/npf [netbsd-6]: npf_handler.c

Log Message:
Pull up following revision(s) (requested by rmind in ticket #594):
sys/net/npf/npf_handler.c: revision 1.23
npf_packet_handler: drop the packet if IPv6 reassembly did not work.


To generate a diff of this commit:
cvs rdiff -u -r1.13.2.5 -r1.13.2.6 src/sys/net/npf/npf_handler.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/net/npf/npf_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.13.2.5 src/sys/net/npf/npf_handler.c:1.13.2.6
--- src/sys/net/npf/npf_handler.c:1.13.2.5	Mon Aug 13 17:49:52 2012
+++ src/sys/net/npf/npf_handler.c	Tue Oct  9 23:49:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.13.2.5 2012/08/13 17:49:52 riz Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.13.2.6 2012/10/09 23:49:03 riz Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_handler.c,v 1.13.2.5 2012/08/13 17:49:52 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_handler.c,v 1.13.2.6 2012/10/09 23:49:03 riz Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -136,8 +136,10 @@ npf_packet_handler(void *arg, struct mbu
 		nbuf = (nbuf_t *)*mp;
 		npc.npc_info = 0;
 
-		int ret __unused = npf_cache_all(npc, nbuf);
-		KASSERT((ret  NPC_IPFRAG) == 0);
+		if (npf_cache_all(npc, nbuf)  NPC_IPFRAG) {
+			se = NULL;
+			goto out;
+		}
 		npf_stats_inc(NPF_STAT_REASSEMBLY);
 	}
 



CVS commit: [netbsd-6] src/distrib/notes/macppc

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:51:14 UTC 2012

Modified Files:
src/distrib/notes/macppc [netbsd-6]: install

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #595):
distrib/notes/macppc/install: revision 1.39
Add some text to Common Problems about Open Firmware 3.x not
setting up the console and how to work around the problem.  This
is an initial stab at solving PR/35348 for NetBSD 6.0.  After 6.0
is released, a better solution can be done for 6.1.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.6.1 src/distrib/notes/macppc/install

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

Modified files:

Index: src/distrib/notes/macppc/install
diff -u src/distrib/notes/macppc/install:1.38 src/distrib/notes/macppc/install:1.38.6.1
--- src/distrib/notes/macppc/install:1.38	Mon May 30 06:19:53 2011
+++ src/distrib/notes/macppc/install	Tue Oct  9 23:51:14 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: install,v 1.38 2011/05/30 06:19:53 wiz Exp $
+.\	$NetBSD: install,v 1.38.6.1 2012/10/09 23:51:14 riz Exp $
 .
 .Ss2 Open Firmware boot syntax
 .
@@ -650,6 +650,25 @@ If your system is a PowerBook,
 may have turned down the brightness of the backlight.
 Use the buttons to turn your brightness back up.
 .Pp
+Open Firmware 3.x and newer often won't setup the console if you don't
+drop to a prompt, and
+.Nx
+doesn't know how to setup the console itself.
+To get the system to boot when you have auto-boot? set to true, you
+can try this workaround.
+First, try one of the following commands:
+.sp
+.Dl setenv boot-command \*[q] screen\*[q] output boot
+.Dl setenv boot-command . screen output boot
+.Dl setenv boot-command . Booting NetBSD... cr \*[q] screen\*[q] output boot
+.sp
+You should follow the command with:
+.sp
+.Dl reset-all
+.sp
+This will cause Open Firmware to output some text to the screen prior
+to booting, thus forcing it to setup the console.
+.Pp
 Otherwise, you need a serial console.
 See the section entitled
 .Sx Open Firmware 1 and 2 System Preparation



CVS commit: [netbsd-6] src/external/bsd/wpa/dist/src/eap_server

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:54:57 UTC 2012

Modified Files:
src/external/bsd/wpa/dist/src/eap_server [netbsd-6]:
eap_server_tls_common.c

Log Message:
external/bsd/wpa/dist/src/eap_server/eap_server_tls_common.cpatch

Fix overflow in hostapd.  PRE-SA-2012-07.
[christos, ticket #597]


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.8.1 \
src/external/bsd/wpa/dist/src/eap_server/eap_server_tls_common.c

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

Modified files:

Index: src/external/bsd/wpa/dist/src/eap_server/eap_server_tls_common.c
diff -u src/external/bsd/wpa/dist/src/eap_server/eap_server_tls_common.c:1.1.1.1 src/external/bsd/wpa/dist/src/eap_server/eap_server_tls_common.c:1.1.1.1.8.1
--- src/external/bsd/wpa/dist/src/eap_server/eap_server_tls_common.c:1.1.1.1	Wed Aug  4 10:21:14 2010
+++ src/external/bsd/wpa/dist/src/eap_server/eap_server_tls_common.c	Tue Oct  9 23:54:57 2012
@@ -225,6 +225,13 @@ static int eap_server_tls_process_fragme
 			return -1;
 		}
 
+		if (len  message_length) {
+			wpa_printf(MSG_INFO, SSL: Too much data (%zu bytes) 
+   in first fragment of frame (TLS Message 
+   Length %u bytes), len, message_length);
+			return -1;
+		}
+
 		data-tls_in = wpabuf_alloc(message_length);
 		if (data-tls_in == NULL) {
 			wpa_printf(MSG_DEBUG, SSL: No memory for message);



CVS commit: [netbsd-6] src/external/bsd/bind/dist

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:58:09 UTC 2012

Modified Files:
src/external/bsd/bind/dist [netbsd-6]: CHANGES version
src/external/bsd/bind/dist/bin/named [netbsd-6]: query.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #598):
external/bsd/bind/dist/version: revision 1.4
external/bsd/bind/dist/CHANGES: revision 1.7
external/bsd/bind/dist/bin/named/query.c: revision 1.9
Apply P4:
3383.  [security]  A certain combination of records in the RBT could
   cause named to hang while populating the additional
   section of a response. [RT #31090]


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.3 -r1.2.2.4 src/external/bsd/bind/dist/CHANGES
cvs rdiff -u -r1.1.1.10.4.3 -r1.1.1.10.4.4 src/external/bsd/bind/dist/version
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/external/bsd/bind/dist/bin/named/query.c

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

Modified files:

Index: src/external/bsd/bind/dist/CHANGES
diff -u src/external/bsd/bind/dist/CHANGES:1.2.2.3 src/external/bsd/bind/dist/CHANGES:1.2.2.4
--- src/external/bsd/bind/dist/CHANGES:1.2.2.3	Thu Sep 13 08:03:43 2012
+++ src/external/bsd/bind/dist/CHANGES	Tue Oct  9 23:58:08 2012
@@ -1,3 +1,9 @@
+	--- 9.9.1-P4 released ---
+
+3383.	[security]	A certain combination of records in the RBT could
+cause named to hang while populating the additional
+section of a response. [RT #31090]
+
 	--- 9.9.1-P3 released ---
 
 3364.	[security]	Named could die on specially crafted record.

Index: src/external/bsd/bind/dist/version
diff -u src/external/bsd/bind/dist/version:1.1.1.10.4.3 src/external/bsd/bind/dist/version:1.1.1.10.4.4
--- src/external/bsd/bind/dist/version:1.1.1.10.4.3	Thu Sep 13 08:03:43 2012
+++ src/external/bsd/bind/dist/version	Tue Oct  9 23:58:08 2012
@@ -7,4 +7,4 @@ MAJORVER=9
 MINORVER=9
 PATCHVER=1
 RELEASETYPE=-P
-RELEASEVER=3
+RELEASEVER=4

Index: src/external/bsd/bind/dist/bin/named/query.c
diff -u src/external/bsd/bind/dist/bin/named/query.c:1.7.2.1 src/external/bsd/bind/dist/bin/named/query.c:1.7.2.2
--- src/external/bsd/bind/dist/bin/named/query.c:1.7.2.1	Tue Jun  5 21:15:20 2012
+++ src/external/bsd/bind/dist/bin/named/query.c	Tue Oct  9 23:58:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: query.c,v 1.7.2.1 2012/06/05 21:15:20 bouyer Exp $	*/
+/*	$NetBSD: query.c,v 1.7.2.2 2012/10/09 23:58:09 riz Exp $	*/
 
 /*
  * Copyright (C) 2004-2012  Internet Systems Consortium, Inc. (ISC)
@@ -1121,13 +1121,6 @@ query_isduplicate(ns_client_t *client, d
 		mname = NULL;
 	}
 
-	/*
-	 * If the dns_name_t we're looking up is already in the message,
-	 * we don't want to trigger the caller's name replacement logic.
-	 */
-	if (name == mname)
-		mname = NULL;
-
 	if (mnamep != NULL)
 		*mnamep = mname;
 
@@ -1332,6 +1325,7 @@ query_addadditional(void *arg, dns_name_
 	if (dns_rdataset_isassociated(rdataset) 
 	!query_isduplicate(client, fname, type, mname)) {
 		if (mname != NULL) {
+			INSIST(mname != fname);
 			query_releasename(client, fname);
 			fname = mname;
 		} else
@@ -1401,11 +1395,13 @@ query_addadditional(void *arg, dns_name_
 #endif
 			if (!query_isduplicate(client, fname,
 	   dns_rdatatype_a, mname)) {
-if (mname != NULL) {
-	query_releasename(client, fname);
-	fname = mname;
-} else
-	need_addname = ISC_TRUE;
+if (mname != fname) {
+	if (mname != NULL) {
+		query_releasename(client, fname);
+		fname = mname;
+	} else
+		need_addname = ISC_TRUE;
+}
 ISC_LIST_APPEND(fname-list, rdataset, link);
 added_something = ISC_TRUE;
 if (sigrdataset != NULL 
@@ -1458,11 +1454,13 @@ query_addadditional(void *arg, dns_name_
 #endif
 			if (!query_isduplicate(client, fname,
 	   dns_rdatatype_, mname)) {
-if (mname != NULL) {
-	query_releasename(client, fname);
-	fname = mname;
-} else
-	need_addname = ISC_TRUE;
+if (mname != fname) {
+	if (mname != NULL) {
+		query_releasename(client, fname);
+		fname = mname;
+	} else
+		need_addname = ISC_TRUE;
+}
 ISC_LIST_APPEND(fname-list, rdataset, link);
 added_something = ISC_TRUE;
 if (sigrdataset != NULL 
@@ -1993,22 +1991,24 @@ query_addadditional2(void *arg, dns_name
 		crdataset-type == dns_rdatatype_) {
 			if (!query_isduplicate(client, fname, crdataset-type,
 	   mname)) {
-if (mname != NULL) {
-	/*
-	 * A different type of this name is
-	 * already stored in the additional
-	 * section.  We'll reuse the name.
-	 * Note that this should happen at most
-	 * once.  Otherwise, fname-link could
-	 * leak below.
-	 */
-	INSIST(mname0 == NULL);
-
-	query_releasename(client, fname);
-	fname = mname;
-	mname0 = mname;
-} else
-	need_addname = 

CVS commit: [netbsd-6] src/doc

2012-10-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Oct  9 23:59:33 UTC 2012

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

Log Message:
Tickets 593-595, 597-598.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.214 -r1.1.2.215 src/doc/CHANGES-6.0

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
diff -u src/doc/CHANGES-6.0:1.1.2.214 src/doc/CHANGES-6.0:1.1.2.215
--- src/doc/CHANGES-6.0:1.1.2.214	Tue Oct  9 23:12:57 2012
+++ src/doc/CHANGES-6.0	Tue Oct  9 23:59:32 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.214 2012/10/09 23:12:57 riz Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.215 2012/10/09 23:59:32 riz Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -8803,3 +8803,31 @@ usr.sbin/npf/npfctl/npf_parse.y			1.14
 	Print the correct line number in npfctl.
 	[rmind, ticket #590]
 
+sys/kern/uipc_usrreq.c1.140 via patch
+
+	Avoid a NULL dereferencing crash.
+	[christos, ticket #593]
+
+sys/net/npf/npf_handler.c			1.23
+
+	npf_packet_handler: drop the packet if IPv6 reassembly did not work.
+	[rmind, ticket #594]
+
+distrib/notes/macppc/install			1.39
+
+	Add some text to Common Problems about Open Firmware 3.x not
+	setting up the console and how to work around the problem. PR#35348.
+	[jnemeth, ticket #595]
+
+external/bsd/wpa/dist/src/eap_server/eap_server_tls_common.c	patch
+
+	Fix overflow in hostapd.  PRE-SA-2012-07.
+	[christos, ticket #597]
+
+external/bsd/bind/dist/CHANGES			1.7
+external/bsd/bind/dist/bin/named/query.c	1.9
+external/bsd/bind/dist/version			1.4
+
+	Update to BIND 9.9.1-P4, to address CVE-2012-5166.
+	[christos, ticket #598]
+



CVS commit: src/lib/libc/arch/arm/gen

2012-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 10 02:15:03 UTC 2012

Modified Files:
src/lib/libc/arch/arm/gen: Makefile.inc

Log Message:
add split files


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/arch/arm/gen/Makefile.inc

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

Modified files:

Index: src/lib/libc/arch/arm/gen/Makefile.inc
diff -u src/lib/libc/arch/arm/gen/Makefile.inc:1.18 src/lib/libc/arch/arm/gen/Makefile.inc:1.19
--- src/lib/libc/arch/arm/gen/Makefile.inc:1.18	Mon Jul 30 08:57:54 2012
+++ src/lib/libc/arch/arm/gen/Makefile.inc	Tue Oct  9 22:15:03 2012
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.18 2012/07/30 12:57:54 skrll Exp $
+# $NetBSD: Makefile.inc,v 1.19 2012/10/10 02:15:03 christos Exp $
 
 SRCS+=	alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divsi3.S \
-	fabs.c flt_rounds.c
+	fabs.c flt_rounds.c modsi3.S umodsi3.S
 
 # Common ieee754 constants and functions
 SRCS+=	infinityf_ieee754.c infinity_ieee754.c infinityl_dbl_ieee754.c



CVS commit: src/common/lib/libc/arch/arm/gen

2012-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 10 02:16:54 UTC 2012

Modified Files:
src/common/lib/libc/arch/arm/gen: divsi3.S
Added Files:
src/common/lib/libc/arch/arm/gen: modsi3.S umodsi3.S

Log Message:
Split out modsi3 and umodsi3 from the divsi3 file. This is so that
we don't get re-defined symbols in libc from libgcc in static linking.
Example: cc -pthread -static main-calls-pthread-create.c


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/gen/divsi3.S
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/arm/gen/modsi3.S \
src/common/lib/libc/arch/arm/gen/umodsi3.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/gen/divsi3.S
diff -u src/common/lib/libc/arch/arm/gen/divsi3.S:1.2 src/common/lib/libc/arch/arm/gen/divsi3.S:1.3
--- src/common/lib/libc/arch/arm/gen/divsi3.S:1.2	Sun Aug  5 00:22:01 2012
+++ src/common/lib/libc/arch/arm/gen/divsi3.S	Tue Oct  9 22:16:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: divsi3.S,v 1.2 2012/08/05 04:22:01 matt Exp $	*/
+/*	$NetBSD: divsi3.S,v 1.3 2012/10/10 02:16:54 christos Exp $	*/
 
 /*
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@@ -21,22 +21,6 @@
  * which makes a C call
  */
 
-ENTRY(__umodsi3)
-	stmfd	sp!, {lr}
-	sub	sp, sp, #4	/* align stack */
-	bl	.L_udivide
-	add	sp, sp, #4	/* unalign stack */
-	mov	r0, r1
-	ldmfd	sp!, {pc}
-
-ENTRY(__modsi3)
-	stmfd	sp!, {lr}
-	sub	sp, sp, #4	/* align stack */
-	bl	.L_divide
-	add	sp, sp, #4	/* unalign stack */
-	mov	r0, r1
-	ldmfd	sp!, {pc}
-
 .L_overflow:
 #if !defined(_KERNEL)  !defined(_STANDALONE)
 	mov	r0, #8			/* SIGFPE */

Added files:

Index: src/common/lib/libc/arch/arm/gen/modsi3.S
diff -u /dev/null src/common/lib/libc/arch/arm/gen/modsi3.S:1.1
--- /dev/null	Tue Oct  9 22:16:54 2012
+++ src/common/lib/libc/arch/arm/gen/modsi3.S	Tue Oct  9 22:16:54 2012
@@ -0,0 +1,31 @@
+/*	$NetBSD: modsi3.S,v 1.1 2012/10/10 02:16:54 christos Exp $	*/
+
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include machine/asm.h
+
+/* 
+ * stack is aligned as there's a possibility of branching to .L_overflow
+ * which makes a C call
+ */
+
+ENTRY(__modsi3)
+	stmfd	sp!, {lr}
+	sub	sp, sp, #4	/* align stack */
+	bl	PIC_SYM(__divsi3, PLT)
+	add	sp, sp, #4	/* unalign stack */
+	mov	r0, r1
+	ldmfd	sp!, {pc}
+
Index: src/common/lib/libc/arch/arm/gen/umodsi3.S
diff -u /dev/null src/common/lib/libc/arch/arm/gen/umodsi3.S:1.1
--- /dev/null	Tue Oct  9 22:16:54 2012
+++ src/common/lib/libc/arch/arm/gen/umodsi3.S	Tue Oct  9 22:16:54 2012
@@ -0,0 +1,30 @@
+/*	$NetBSD: umodsi3.S,v 1.1 2012/10/10 02:16:54 christos Exp $	*/
+
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include machine/asm.h
+
+/* 
+ * stack is aligned as there's a possibility of branching to .L_overflow
+ * which makes a C call
+ */
+
+ENTRY(__umodsi3)
+	stmfd	sp!, {lr}
+	sub	sp, sp, #4	/* align stack */
+	bl	PIC_SYM(__udivsi3, PLT)
+	add	sp, sp, #4	/* unalign stack */
+	mov	r0, r1
+	ldmfd	sp!, {pc}