CVS commit: src

2011-04-29 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sat Apr 30 06:20:37 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/syscall: Makefile
Added Files:
src/tests/syscall: t_kill.c

Log Message:
Few fundamental consistency checks for kill(2).


To generate a diff of this commit:
cvs rdiff -u -r1.312 -r1.313 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.22 -r1.23 src/tests/syscall/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/syscall/t_kill.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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.312 src/distrib/sets/lists/tests/mi:1.313
--- src/distrib/sets/lists/tests/mi:1.312	Sat Apr 30 00:35:03 2011
+++ src/distrib/sets/lists/tests/mi	Sat Apr 30 06:20:37 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.312 2011/04/30 00:35:03 alnsn Exp $
+# $NetBSD: mi,v 1.313 2011/04/30 06:20:37 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -599,6 +599,7 @@
 ./usr/libdata/debug/usr/tests/syscall/t_getpid.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_getrusage.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_getsid.debug			tests-syscall-debug	debug,atf
+./usr/libdata/debug/usr/tests/syscall/t_kill.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_mmap.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_mprotect.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_msync.debug			tests-syscall-debug	debug,atf
@@ -2272,6 +2273,7 @@
 ./usr/tests/syscall/t_getpid			tests-syscall-tests	atf
 ./usr/tests/syscall/t_getrusage			tests-syscall-tests	atf
 ./usr/tests/syscall/t_getsid			tests-syscall-tests	atf
+./usr/tests/syscall/t_kill			tests-syscall-tests	atf
 ./usr/tests/syscall/t_mmap			tests-syscall-tests	atf
 ./usr/tests/syscall/t_mprotect			tests-syscall-tests	atf
 ./usr/tests/syscall/t_msync			tests-syscall-tests	atf

Index: src/tests/syscall/Makefile
diff -u src/tests/syscall/Makefile:1.22 src/tests/syscall/Makefile:1.23
--- src/tests/syscall/Makefile:1.22	Sun Apr 17 06:26:02 2011
+++ src/tests/syscall/Makefile	Sat Apr 30 06:20:37 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2011/04/17 06:26:02 jruoho Exp $
+# $NetBSD: Makefile,v 1.23 2011/04/30 06:20:37 jruoho Exp $
 
 .include 
 
@@ -6,7 +6,7 @@
 
 TESTS_C+=	t_access t_cmsg t_dup t_fsync
 TESTS_C+=	t_getgroups t_getpid t_getrusage t_getsid
-TESTS_C+=	t_mmap t_mprotect t_msync
+TESTS_C+=	t_kill t_mmap t_mprotect t_msync
 TESTS_C+=	t_setrlimit t_setuid t_timer t_umask
 
 LDADD.t_getpid+=	-lpthread

Added files:

Index: src/tests/syscall/t_kill.c
diff -u /dev/null src/tests/syscall/t_kill.c:1.1
--- /dev/null	Sat Apr 30 06:20:37 2011
+++ src/tests/syscall/t_kill.c	Sat Apr 30 06:20:37 2011
@@ -0,0 +1,312 @@
+/* $NetBSD: t_kill.c,v 1.1 2011/04/30 06:20:37 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jukka Ruohonen.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 
+__RCSID("$NetBSD: t_kill.c,v 1.1 2011/04/30 06:20:37 jruoho Exp $");
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+ATF_TC(kill_basic);
+ATF_TC_HEAD(kill_basic, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test that kill(2) works");
+}
+
+ATF_TC_BODY(kill_basic, tc)
+{
+	const int sig[] = { SIGHUP, SIGINT, SIGKILL, SIGTERM };
+	pid_t pid;
+	size_t i;
+	int sta;
+
+	for (i = 0

CVS commit: src/sys/dev/raidframe

2011-04-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Apr 30 01:44:37 UTC 2011

Modified Files:
src/sys/dev/raidframe: rf_driver.c rf_driver.h rf_mcpair.c rf_raid.h
rf_reconutil.c rf_stripelocks.c rf_threadstuff.h

Log Message:
- convert rf_printf_mutex to a kmutex
- convert rf_rad_lock and the per-raid "cv" to per-raid kmutex/and real cv
- use rf_mutex_init() in places, and move it with the similar definitions


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/raidframe/rf_driver.h
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/raidframe/rf_mcpair.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/raidframe/rf_raid.h
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_reconutil.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/raidframe/rf_stripelocks.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_threadstuff.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/raidframe/rf_driver.c
diff -u src/sys/dev/raidframe/rf_driver.c:1.125 src/sys/dev/raidframe/rf_driver.c:1.126
--- src/sys/dev/raidframe/rf_driver.c:1.125	Wed Apr 27 07:55:14 2011
+++ src/sys/dev/raidframe/rf_driver.c	Sat Apr 30 01:44:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_driver.c,v 1.125 2011/04/27 07:55:14 mrg Exp $	*/
+/*	$NetBSD: rf_driver.c,v 1.126 2011/04/30 01:44:36 mrg Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,7 +66,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.125 2011/04/27 07:55:14 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.126 2011/04/30 01:44:36 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_diagnostic.h"
@@ -118,7 +118,6 @@
 #endif
 
 /* rad == RF_RaidAccessDesc_t */
-RF_DECLARE_MUTEX(rf_rad_lock)
 #define RF_MAX_FREE_RAD 128
 #define RF_MIN_FREE_RAD  32
 
@@ -134,7 +133,7 @@
 static void rf_ShutdownRDFreeList(void *);
 static int rf_ConfigureRDFreeList(RF_ShutdownList_t **);
 
-RF_DECLARE_MUTEX(rf_printf_mutex)	/* debug only:  avoids interleaved
+rf_declare_mutex2(rf_printf_mutex);	/* debug only:  avoids interleaved
 	 * printfs by different stripes */
 
 #define SIGNAL_QUIESCENT_COND(_raid_)  wakeup(&((_raid_)->accesses_suspended))
@@ -213,16 +212,16 @@
  * cuts down on the amount of serialization we've got going
  * on.
  */
-	RF_LOCK_MUTEX(rf_rad_lock);
+	rf_lock_mutex2(raidPtr->rad_lock);
 	if (raidPtr->waitShutdown) {
-		RF_UNLOCK_MUTEX(rf_rad_lock);
+		rf_unlock_mutex2(raidPtr->rad_lock);
 		return (EBUSY);
 	}
 	raidPtr->waitShutdown = 1;
 	while (raidPtr->nAccOutstanding) {
-		RF_WAIT_COND(raidPtr->outstandingCond, rf_rad_lock);
+		rf_wait_cond2(raidPtr->outstandingCond, raidPtr->rad_lock);
 	}
-	RF_UNLOCK_MUTEX(rf_rad_lock);
+	rf_unlock_mutex2(raidPtr->rad_lock);
 
 	/* Wait for any parity re-writes to stop... */
 	while (raidPtr->parity_rewrite_in_progress) {
@@ -253,6 +252,9 @@
 
 	rf_ShutdownList(&raidPtr->shutdownList);
 
+	rf_destroy_cond2(raidPtr->outstandingCond);
+	rf_destroy_mutex2(raidPtr->rad_lock);
+
 	rf_UnconfigureArray();
 
 	return (0);
@@ -299,7 +301,7 @@
 	rf_lock_mutex2(configureMutex);
 	configureCount++;
 	if (isconfigged == 0) {
-		rf_mutex_init(&rf_printf_mutex);
+		rf_init_mutex2(rf_printf_mutex, IPL_VM);
 
 		/* initialize globals */
 
@@ -353,7 +355,8 @@
 	DO_RAID_INIT_CONFIGURE(rf_ConfigureEngine);
 	DO_RAID_INIT_CONFIGURE(rf_ConfigureStripeLocks);
 
-	raidPtr->outstandingCond = 0;
+	rf_init_cond2(raidPtr->outstandingCond, "rfocond");
+	rf_init_mutex2(raidPtr->rad_lock, IPL_VM);
 
 	raidPtr->nAccOutstanding = 0;
 	raidPtr->waitShutdown = 0;
@@ -544,7 +547,6 @@
 	rf_pool_init(&rf_pools.rad, sizeof(RF_RaidAccessDesc_t),
 		 "rf_rad_pl", RF_MIN_FREE_RAD, RF_MAX_FREE_RAD);
 	rf_ShutdownCreate(listp, rf_ShutdownRDFreeList, NULL);
-	simple_lock_init(&rf_rad_lock);
 	return (0);
 }
 
@@ -558,20 +560,20 @@
 
 	desc = pool_get(&rf_pools.rad, PR_WAITOK);
 
-	RF_LOCK_MUTEX(rf_rad_lock);
+	rf_lock_mutex2(raidPtr->rad_lock);
 	if (raidPtr->waitShutdown) {
 		/*
 	 * Actually, we're shutting the array down. Free the desc
 	 * and return NULL.
 	 */
 
-		RF_UNLOCK_MUTEX(rf_rad_lock);
+		rf_unlock_mutex2(raidPtr->rad_lock);
 		pool_put(&rf_pools.rad, desc);
 		return (NULL);
 	}
 	raidPtr->nAccOutstanding++;
 
-	RF_UNLOCK_MUTEX(rf_rad_lock);
+	rf_unlock_mutex2(raidPtr->rad_lock);
 
 	desc->raidPtr = (void *) raidPtr;
 	desc->type = type;
@@ -628,12 +630,12 @@
 	}
 
 	pool_put(&rf_pools.rad, desc);
-	RF_LOCK_MUTEX(rf_rad_lock);
+	rf_lock_mutex2(raidPtr->rad_lock);
 	raidPtr->nAccOutstanding--;
 	if (raidPtr->waitShutdown) {
-		RF_SIGNAL_COND(raidPtr->outstandingCond);
+		rf_signal_cond2(raidPtr->outstandingCond);
 	}
-	RF_UNLOCK_MUTEX(rf_rad_lock);
+	rf_unlock_mutex2(raidPtr->rad_lock);
 }
 /*
  * Main routin

CVS commit: src/tests/util/awk

2011-04-29 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sat Apr 30 01:10:08 UTC 2011

Modified Files:
src/tests/util/awk: t_awk.sh

Log Message:
PR/42320 doesn't seem to be fixed, mark the failure as expected.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/util/awk/t_awk.sh

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

Modified files:

Index: src/tests/util/awk/t_awk.sh
diff -u src/tests/util/awk/t_awk.sh:1.4 src/tests/util/awk/t_awk.sh:1.5
--- src/tests/util/awk/t_awk.sh:1.4	Thu Apr 28 23:28:23 2011
+++ src/tests/util/awk/t_awk.sh	Sat Apr 30 01:10:07 2011
@@ -1,4 +1,4 @@
-# $NetBSD: t_awk.sh,v 1.4 2011/04/28 23:28:23 alnsn Exp $
+# $NetBSD: t_awk.sh,v 1.5 2011/04/30 01:10:07 alnsn Exp $
 #
 # Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -94,6 +94,7 @@
 {
 	export LANG=ru_RU.KOI8-R
 
+	atf_expect_fail "PR/42320"
 	h_check period -v x=0.5
 }
 



CVS commit: src/distrib/sets/lists/tests

2011-04-29 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sat Apr 30 00:35:03 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
Add files required for the new testcase in t_awk.sh.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/distrib/sets/lists/tests/mi

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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.311 src/distrib/sets/lists/tests/mi:1.312
--- src/distrib/sets/lists/tests/mi:1.311	Fri Apr 22 00:53:44 2011
+++ src/distrib/sets/lists/tests/mi	Sat Apr 30 00:35:03 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.311 2011/04/22 00:53:44 joerg Exp $
+# $NetBSD: mi,v 1.312 2011/04/30 00:35:03 alnsn Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2316,6 +2316,9 @@
 ./usr/tests/util/awk/d_end2.awk			tests-util-tests
 ./usr/tests/util/awk/d_end2.in			tests-util-tests
 ./usr/tests/util/awk/d_end2.out			tests-util-tests
+./usr/tests/util/awk/d_period.awk		tests-util-tests
+./usr/tests/util/awk/d_period.in		tests-util-tests
+./usr/tests/util/awk/d_period.out		tests-util-tests
 ./usr/tests/util/awk/d_string1.awk		tests-util-tests
 ./usr/tests/util/awk/d_string1.out		tests-util-tests
 ./usr/tests/util/awk/d_tolower.awk		tests-util-tests



CVS commit: src/sys/dev/ata

2011-04-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Apr 30 00:34:03 UTC 2011

Modified Files:
src/sys/dev/ata: ata.c atavar.h

Log Message:
Add simplistic atabus(4) rescan support.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ata/atavar.h

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

Modified files:

Index: src/sys/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.114 src/sys/dev/ata/ata.c:1.115
--- src/sys/dev/ata/ata.c:1.114	Mon Apr 18 01:47:28 2011
+++ src/sys/dev/ata/ata.c	Sat Apr 30 00:34:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.114 2011/04/18 01:47:28 rmind Exp $	*/
+/*	$NetBSD: ata.c,v 1.115 2011/04/30 00:34:03 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.114 2011/04/18 01:47:28 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.115 2011/04/30 00:34:03 jakllsch Exp $");
 
 #include "opt_ata.h"
 
@@ -105,6 +105,7 @@
 extern struct cfdriver atabus_cd;
 
 static void atabus_childdetached(device_t, device_t);
+static int atabus_rescan(device_t, const char *, const int *);
 static bool atabus_resume(device_t, const pmf_qual_t *);
 static bool atabus_suspend(device_t, const pmf_qual_t *);
 static void atabusconfig_thread(void *);
@@ -396,6 +397,10 @@
 		if (chp->ch_flags & ATACH_SHUTDOWN) {
 			break;
 		}
+		if (chp->ch_flags & ATACH_TH_RESCAN) {
+			atabusconfig(sc);
+			chp->ch_flags &= ~ATACH_TH_RESCAN;
+		}
 		if (chp->ch_flags & ATACH_TH_RESET) {
 			/*
 			 * ata_reset_channel() will freeze 2 times, so
@@ -585,7 +590,7 @@
 }
 
 CFATTACH_DECL3_NEW(atabus, sizeof(struct atabus_softc),
-atabus_match, atabus_attach, atabus_detach, NULL, NULL,
+atabus_match, atabus_attach, atabus_detach, NULL, atabus_rescan,
 atabus_childdetached, DVF_DETACH_SHUTDOWN);
 
 /*
@@ -1560,3 +1565,39 @@
 
 	return true;
 }
+
+static int
+atabus_rescan(device_t self, const char *ifattr, const int *locators)
+{
+	struct atabus_softc *sc = device_private(self);
+	struct ata_channel *chp = sc->sc_chan;
+	struct atabus_initq *initq;
+	int i;
+	int s;
+
+	if (chp->atapibus != NULL) {
+		return EBUSY;
+	}
+
+	for (i = 0; i < ATA_MAXDRIVES; i++) {
+		if (chp->ata_drives[i] != NULL) {
+			return EBUSY;
+		}
+	}
+
+	s = splbio();
+	for (i = 0; i < ATA_MAXDRIVES; i++) {
+		chp->ch_drive[i].drive_flags = 0;
+	}
+	splx(s);
+
+	initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
+	initq->atabus_sc = sc;
+	TAILQ_INSERT_TAIL(&atabus_initq_head, initq, atabus_initq);
+	config_pending_incr();
+
+	chp->ch_flags |= ATACH_TH_RESCAN;
+	wakeup(&chp->ch_thread);
+
+	return 0;
+}

Index: src/sys/dev/ata/atavar.h
diff -u src/sys/dev/ata/atavar.h:1.81 src/sys/dev/ata/atavar.h:1.82
--- src/sys/dev/ata/atavar.h:1.81	Mon Apr 18 01:47:28 2011
+++ src/sys/dev/ata/atavar.h	Sat Apr 30 00:34:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: atavar.h,v 1.81 2011/04/18 01:47:28 rmind Exp $	*/
+/*	$NetBSD: atavar.h,v 1.82 2011/04/30 00:34:03 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -331,6 +331,7 @@
 #define	ATACH_DISABLED 0x80	/* channel is disabled */
 #define ATACH_TH_RUN   0x100	/* the kernel thread is working */
 #define ATACH_TH_RESET 0x200	/* someone ask the thread to reset */
+#define ATACH_TH_RESCAN 0x400	/* rescan requested */
 	u_int8_t ch_status;	/* copy of status register */
 	u_int8_t ch_error;	/* copy of error register */
 



CVS commit: src/sys/arch/xen/xen

2011-04-29 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Fri Apr 29 22:58:46 UTC 2011

Modified Files:
src/sys/arch/xen/xen: xbdback_xenbus.c xennetback_xenbus.c

Log Message:
Move the connection code of xbdback(4) and xvif(4) backends in separate
functions. The frontend watch function is easier to read, and mixing
switch() with goto's error paths is rather error-prone.

While here, sprinkle some aprint_*.

Tested under amd64 dom0 with i386 PAE and amd64 domUs.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/xen/xen/xennetback_xenbus.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/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.33 src/sys/arch/xen/xen/xbdback_xenbus.c:1.34
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.33	Sat Mar  5 15:12:16 2011
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Fri Apr 29 22:58:46 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.33 2011/03/05 15:12:16 bouyer Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.34 2011/04/29 22:58:46 jym Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.33 2011/03/05 15:12:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.34 2011/04/29 22:58:46 jym Exp $");
 
 #include 
 #include 
@@ -479,20 +479,152 @@
 	return 0;
 }
 
-static void
-xbdback_frontend_changed(void *arg, XenbusState new_state)
+static int
+xbdback_connect(struct xbdback_instance *xbdi)
 {
-	struct xbdback_instance *xbdi = arg;
-	struct xenbus_device *xbusd = xbdi->xbdi_xbusd;
-	u_long ring_ref, revtchn;
+	int len, err;
 	struct gnttab_map_grant_ref grop;
 	struct gnttab_unmap_grant_ref ungrop;
 	evtchn_op_t evop;
+	u_long ring_ref, revtchn;
+	char *xsproto;
 	char evname[16];
 	const char *proto;
-	char *xsproto;
-	int len;
-	int err, s;
+	struct xenbus_device *xbusd = xbdi->xbdi_xbusd;
+
+	/* read comunication informations */
+	err = xenbus_read_ul(NULL, xbusd->xbusd_otherend,
+	"ring-ref", &ring_ref, 10);
+	if (err) {
+		xenbus_dev_fatal(xbusd, err, "reading %s/ring-ref",
+		xbusd->xbusd_otherend);
+		return -1;
+	}
+	err = xenbus_read_ul(NULL, xbusd->xbusd_otherend,
+	"event-channel", &revtchn, 10);
+	if (err) {
+		xenbus_dev_fatal(xbusd, err, "reading %s/event-channel",
+		xbusd->xbusd_otherend);
+		return -1;
+	}
+	err = xenbus_read(NULL, xbusd->xbusd_otherend, "protocol",
+	&len, &xsproto);
+	if (err) {
+		xbdi->xbdi_proto = XBDIP_NATIVE;
+		proto = "unspecified";
+	} else {
+		if (strcmp(xsproto, XEN_IO_PROTO_ABI_NATIVE) == 0) {
+			xbdi->xbdi_proto = XBDIP_NATIVE;
+			proto = XEN_IO_PROTO_ABI_NATIVE;
+		} else if (strcmp(xsproto, XEN_IO_PROTO_ABI_X86_32) == 0) {
+			xbdi->xbdi_proto = XBDIP_32;
+			proto = XEN_IO_PROTO_ABI_X86_32;
+		} else if (strcmp(xsproto, XEN_IO_PROTO_ABI_X86_64) == 0) {
+			xbdi->xbdi_proto = XBDIP_64;
+			proto = XEN_IO_PROTO_ABI_X86_64;
+		} else {
+			aprint_error("xbd domain %d: unknown proto %s\n",
+			xbdi->xbdi_domid, xsproto);
+			free(xsproto, M_DEVBUF);
+			return -1;
+		}
+	}
+	free(xsproto, M_DEVBUF);
+
+	/* allocate VA space and map rings */
+	xbdi->xbdi_ring_va = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
+	UVM_KMF_VAONLY);
+	if (xbdi->xbdi_ring_va == 0) {
+		xenbus_dev_fatal(xbusd, ENOMEM,
+		"can't get VA for ring", xbusd->xbusd_otherend);
+		return -1;
+	}
+
+	grop.host_addr = xbdi->xbdi_ring_va;
+	grop.flags = GNTMAP_host_map;
+	grop.ref = ring_ref;
+	grop.dom = xbdi->xbdi_domid;
+	err = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
+	&grop, 1);
+	if (err || grop.status) {
+		aprint_error("xbdback %s: can't map grant ref: %d/%d\n",
+		xbusd->xbusd_path, err, grop.status);
+		xenbus_dev_fatal(xbusd, EINVAL,
+		"can't map ring", xbusd->xbusd_otherend);
+		goto err;
+	}
+	xbdi->xbdi_ring_handle = grop.handle;
+
+	switch(xbdi->xbdi_proto) {
+	case XBDIP_NATIVE:
+	{
+		blkif_sring_t *sring = (void *)xbdi->xbdi_ring_va;
+		BACK_RING_INIT(&xbdi->xbdi_ring.ring_n, sring, PAGE_SIZE);
+		break;
+	}
+	case XBDIP_32:
+	{
+		blkif_x86_32_sring_t *sring = (void *)xbdi->xbdi_ring_va;
+		BACK_RING_INIT(&xbdi->xbdi_ring.ring_32, sring, PAGE_SIZE);
+		break;
+	}
+	case XBDIP_64:
+	{
+		blkif_x86_64_sring_t *sring = (void *)xbdi->xbdi_ring_va;
+		BACK_RING_INIT(&xbdi->xbdi_ring.ring_64, sring, PAGE_SIZE);
+		break;
+	}
+	}
+
+	evop.cmd = EVTCHNOP_bind_interdomain;
+	evop.u.bind_interdomain.remote_dom = xbdi->xbdi_domid;
+	evop.u.bind_interdomain.remote_port = revtchn;
+	err = HYPERVISOR_event_channel_op(&evop);
+	if (err) {
+		aprint_error("blkback %s: "
+		"can't get event channel: %d\n",
+		xbusd->xbusd_otherend, err);
+		xenbus_dev_fatal(xbusd, err,
+		"can't bind event channel", xbusd->xbusd_otherend);
+		goto err2;
+	}
+	xbdi->xbdi_evtchn = evop.u.b

CVS commit: src/sys/kern

2011-04-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Apr 29 22:57:54 UTC 2011

Modified Files:
src/sys/kern: kern_core.c

Log Message:
Small comment improvement.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/kern/kern_core.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/kern_core.c
diff -u src/sys/kern/kern_core.c:1.17 src/sys/kern/kern_core.c:1.18
--- src/sys/kern/kern_core.c:1.17	Fri Nov 19 06:44:42 2010
+++ src/sys/kern/kern_core.c	Fri Apr 29 22:57:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_core.c,v 1.17 2010/11/19 06:44:42 dholland Exp $	*/
+/*	$NetBSD: kern_core.c,v 1.18 2011/04/29 22:57:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.17 2010/11/19 06:44:42 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.18 2011/04/29 22:57:54 rmind Exp $");
 
 #include 
 #include 
@@ -164,17 +164,20 @@
 		pattern = security_setidcore_path;
 	}
 
-	/* It is (just) possible for p_limit and pl_corename to change */
+	/* Lock, as p_limit and pl_corename might change. */
 	lim = p->p_limit;
 	mutex_enter(&lim->pl_lock);
-	if (pattern == NULL)
+	if (pattern == NULL) {
 		pattern = lim->pl_corename;
+	}
 	error = coredump_buildname(p, name, pattern, MAXPATHLEN);
 	mutex_exit(&lim->pl_lock);
+
 	mutex_exit(p->p_lock);
 	mutex_exit(proc_lock);
-	if (error)
+	if (error) {
 		goto done;
+	}
 
 	pb = pathbuf_create(name);
 	if (pb == NULL) {



CVS commit: src/sys/arch/xen/xen

2011-04-29 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Fri Apr 29 22:52:02 UTC 2011

Modified Files:
src/sys/arch/xen/xen: balloon.c

Log Message:
Silence xenbus_read_target() in ENOENT case (== entry is missing from
Xenstore). The error case does not bring much here; assume that the value
is 0.

Print the error code when writing the ``target'' value fails.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/xen/balloon.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/xen/xen/balloon.c
diff -u src/sys/arch/xen/xen/balloon.c:1.8 src/sys/arch/xen/xen/balloon.c:1.9
--- src/sys/arch/xen/xen/balloon.c:1.8	Mon Apr 18 03:04:31 2011
+++ src/sys/arch/xen/xen/balloon.c	Fri Apr 29 22:52:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: balloon.c,v 1.8 2011/04/18 03:04:31 rmind Exp $ */
+/* $NetBSD: balloon.c,v 1.9 2011/04/29 22:52:02 jym Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
 #define BALLOONDEBUG 0
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: balloon.c,v 1.8 2011/04/18 03:04:31 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: balloon.c,v 1.9 2011/04/29 22:52:02 jym Exp $");
 
 #include 
 #include 
@@ -302,29 +302,37 @@
 
 /*
  * Get value (in KiB) of memory/target in XenStore for current domain
- * A return value of 0 can be considered as bogus.
+ * A return value of 0 can be considered as bogus or absent.
  */
 static unsigned long long
 balloon_xenbus_read_target(void)
 {
 	unsigned long long new_target;
+	int err = xenbus_read_ull(NULL, "memory", "target", &new_target, 0);
 
-	if (0 != xenbus_read_ull(NULL, "memory", "target", &new_target, 0)) {
+	switch(err) {
+	case 0:
+		return new_target;
+	case ENOENT:
+		break;
+	default:
 		device_printf(balloon_sc->sc_dev,
-		"error, couldn't read xenbus target node\n");
-		return 0;
+		"error %d, couldn't read xenbus target node\n", err);
+		break;
 	}
 
-	return new_target;
+	return 0;
 }
 
 /* Set memory/target value (in KiB) in XenStore for current domain */
 static void
 balloon_xenbus_write_target(unsigned long long new_target)
 {
-	if (0 != xenbus_printf(NULL, "memory", "target", "%llu", new_target)) {
+	int err = xenbus_printf(NULL, "memory", "target", "%llu", new_target);
+
+	if (err != 0) {
 		device_printf(balloon_sc->sc_dev,
-		"error, couldn't write xenbus target node\n");
+		"error %d, couldn't write xenbus target node\n", err);
 	}
 
 	return;



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

2011-04-29 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Fri Apr 29 22:45:41 UTC 2011

Modified Files:
src/sys/arch/xen/include: xenpmap.h

Log Message:
Apply DRY: xpmap_{mtop,ptom}() can reuse xpmap_{mtop,ptom}_masked() for
the frame number lookup.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/xen/include/xenpmap.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/xen/include/xenpmap.h
diff -u src/sys/arch/xen/include/xenpmap.h:1.26 src/sys/arch/xen/include/xenpmap.h:1.27
--- src/sys/arch/xen/include/xenpmap.h:1.26	Sun Apr 17 09:50:33 2011
+++ src/sys/arch/xen/include/xenpmap.h	Fri Apr 29 22:45:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenpmap.h,v 1.26 2011/04/17 09:50:33 mrg Exp $	*/
+/*	$NetBSD: xenpmap.h,v 1.27 2011/04/29 22:45:41 jym Exp $	*/
 
 /*
  *
@@ -76,14 +76,6 @@
 #define pfn_to_mfn(pfn) (xpmap_phys_to_machine_mapping[(pfn)])
 
 static __inline paddr_t
-xpmap_mtop(paddr_t mpa)
-{
-	return (
-	((paddr_t)machine_to_phys_mapping[mpa >> PAGE_SHIFT] << PAGE_SHIFT)
-	+ XPMAP_OFFSET) | (mpa & ~PG_FRAME);
-}
-
-static __inline paddr_t
 xpmap_mtop_masked(paddr_t mpa)
 {
 	return (
@@ -92,11 +84,9 @@
 }
 
 static __inline paddr_t
-xpmap_ptom(paddr_t ppa)
+xpmap_mtop(paddr_t mpa)
 {
-	return (((paddr_t)xpmap_phys_to_machine_mapping[(ppa -
-	XPMAP_OFFSET) >> PAGE_SHIFT]) << PAGE_SHIFT)
-		| (ppa & ~PG_FRAME);
+	return (xpmap_mtop_masked(mpa) | (mpa & ~PG_FRAME));
 }
 
 static __inline paddr_t
@@ -106,6 +96,12 @@
 	XPMAP_OFFSET) >> PAGE_SHIFT]) << PAGE_SHIFT);
 }
 
+static __inline paddr_t
+xpmap_ptom(paddr_t ppa)
+{
+	return (xpmap_ptom_masked(ppa) | (ppa & ~PG_FRAME));
+}
+
 static inline void
 MULTI_update_va_mapping(
 	multicall_entry_t *mcl, vaddr_t va,



CVS commit: src/sys/arch/sandpoint/stand/altboot

2011-04-29 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Fri Apr 29 22:21:36 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: rge.c

Log Message:
When we stretch a short frame to 60 bytes in rge_send() do not return 60,
but the original frame size.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/stand/altboot/rge.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/sandpoint/stand/altboot/rge.c
diff -u src/sys/arch/sandpoint/stand/altboot/rge.c:1.4 src/sys/arch/sandpoint/stand/altboot/rge.c:1.5
--- src/sys/arch/sandpoint/stand/altboot/rge.c:1.4	Mon Apr  4 16:41:34 2011
+++ src/sys/arch/sandpoint/stand/altboot/rge.c	Fri Apr 29 22:21:36 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rge.c,v 1.4 2011/04/04 16:41:34 phx Exp $ */
+/* $NetBSD: rge.c,v 1.5 2011/04/29 22:21:36 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -217,8 +217,9 @@
 {
 	struct local *l = dev;
 	volatile struct desc *txd;
-	unsigned loop;
+	unsigned loop, ret;
 
+	ret = len;
 	if (len < 60) {
 		memset(buf + len, 0, 60 - len);
 		len = 60; /* RTL does not stretch <60 Tx frame */
@@ -241,7 +242,7 @@
 	return -1;
   done:
 	l->tx ^= 1;
-	return len;
+	return ret;
 }
 
 int



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:19:30 UTC 2011

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

Log Message:
simplify.  Don't limit data way size to a page.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/mips/cache_mipsNN.c

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

Modified files:

Index: src/sys/arch/mips/mips/cache_mipsNN.c
diff -u src/sys/arch/mips/mips/cache_mipsNN.c:1.13 src/sys/arch/mips/mips/cache_mipsNN.c:1.14
--- src/sys/arch/mips/mips/cache_mipsNN.c:1.13	Sun Feb 20 07:45:47 2011
+++ src/sys/arch/mips/mips/cache_mipsNN.c	Fri Apr 29 22:19:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache_mipsNN.c,v 1.13 2011/02/20 07:45:47 matt Exp $	*/
+/*	$NetBSD: cache_mipsNN.c,v 1.14 2011/04/29 22:19:30 matt Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache_mipsNN.c,v 1.13 2011/02/20 07:45:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache_mipsNN.c,v 1.14 2011/04/29 22:19:30 matt Exp $");
 
 #include 
 
@@ -60,7 +60,7 @@
 #define	SYNC	__asm volatile("sync")
 #endif
 
-#if defined(__mips_o32)
+#ifdef __mips_o32
 __asm(".set mips32");
 #else
 __asm(".set mips64");
@@ -68,14 +68,12 @@
 
 static int picache_stride;
 static int picache_loopcount;
-static int pdcache_stride;
-static int pdcache_loopcount;
 
 void
 mipsNN_cache_init(uint32_t config, uint32_t config1)
 {
 	struct mips_cache_info * const mci = &mips_cache_info;
-	int flush_multiple_lines_per_way;
+	bool flush_multiple_lines_per_way;
 
 	flush_multiple_lines_per_way = mci->mci_picache_way_size > PAGE_SIZE;
 	if (config & MIPSNN_CFG_VI) {
@@ -84,7 +82,7 @@
 		 * multiples of the page size with index ops; we just
 		 * need to flush one pages' worth.
 		 */
-		flush_multiple_lines_per_way = 0;
+		flush_multiple_lines_per_way = false;
 	}
 
 	if (flush_multiple_lines_per_way) {
@@ -96,22 +94,12 @@
 		picache_loopcount = mci->mci_picache_ways;
 	}
 
-	if (mci->mci_pdcache_way_size < PAGE_SIZE) {
-		pdcache_stride = mci->mci_pdcache_way_size;
-		pdcache_loopcount = mci->mci_pdcache_ways;
-	} else {
-		pdcache_stride = PAGE_SIZE;
-		pdcache_loopcount = (mci->mci_pdcache_way_size / PAGE_SIZE) *
-		mci->mci_pdcache_ways;
-	}
 #define CACHE_DEBUG
 #ifdef CACHE_DEBUG
 	if (config & MIPSNN_CFG_VI)
 		printf("  icache is virtual\n");
 	printf("  picache_stride= %d\n", picache_stride);
 	printf("  picache_loopcount = %d\n", picache_loopcount);
-	printf("  pdcache_stride= %d\n", pdcache_stride);
-	printf("  pdcache_loopcount = %d\n", pdcache_loopcount);
 #endif
 }
 
@@ -228,6 +216,15 @@
 	va = trunc_line16(va);
 
 	/*
+	 * If we are going to flush more than is in a way, we are flushing
+	 * everything.
+	 */
+	if (eva - va >= mci->mci_picache_way_size) {
+		mipsNN_icache_sync_all_16();
+		return;
+	}
+
+	/*
 	 * GCC generates better code in the loops if we reference local
 	 * copies of these global variables.
 	 */
@@ -238,17 +235,19 @@
 
 	while ((eva - va) >= (8 * 16)) {
 		tmpva = va;
-		for (i = 0; i < loopcount; i++, tmpva += stride)
+		for (i = 0; i < loopcount; i++, tmpva += stride) {
 			cache_r4k_op_8lines_16(tmpva,
 			CACHE_R4K_I|CACHEOP_R4K_INDEX_INV);
+		}
 		va += 8 * 16;
 	}
 
 	while (va < eva) {
 		tmpva = va;
-		for (i = 0; i < loopcount; i++, tmpva += stride)
+		for (i = 0; i < loopcount; i++, tmpva += stride) {
 			cache_op_r4k_line(tmpva,
 			CACHE_R4K_I|CACHEOP_R4K_INDEX_INV);
+		}
 		va += 16;
 	}
 }
@@ -266,14 +265,18 @@
 	 * bits that determine the cache index, and make a KSEG0
 	 * address out of them.
 	 */
-	if (size >= mci->mci_picache_way_size) {
-		va = MIPS_KSEG0_START;
-		eva = va + mci->mci_picache_way_size;
-	} else {
-		va = MIPS_PHYS_TO_KSEG0(va & mci->mci_picache_way_mask);
+	va = MIPS_PHYS_TO_KSEG0(va & mci->mci_picache_way_mask);
+
+	eva = round_line32(va + size);
+	va = trunc_line32(va);
 
-		eva = round_line32(va + size);
-		va = trunc_line32(va);
+	/*
+	 * If we are going to flush more than is in a way, we are flushing
+	 * everything.
+	 */
+	if (eva - va >= mci->mci_picache_way_size) {
+		mipsNN_icache_sync_all_32();
+		return;
 	}
 
 	/*
@@ -287,17 +290,19 @@
 
 	while ((eva - va) >= (8 * 32)) {
 		tmpva = va;
-		for (i = 0; i < loopcount; i++, tmpva += stride)
+		for (i = 0; i < loopcount; i++, tmpva += stride) {
 			cache_r4k_op_8lines_32(tmpva,
 			CACHE_R4K_I|CACHEOP_R4K_INDEX_INV);
+		}
 		va += 8 * 32;
 	}
 
 	while (va < eva) {
 		tmpva = va;
-		for (i = 0; i < loopcount; i++, tmpva += stride)
+		for (i = 0; i < loopcount; i++, tmpva += stride) {
 			cache_op_r4k_line(tmpva,
 			CACHE_R4K_I|CACHEOP_R4K_INDEX_INV);
+		}
 		va += 32;
 	}
 }
@@ -392,87 +397,115 @@
 	SYNC;
 }
 
-void
-mipsNN_pdcache_wbinv_range_index_16(vaddr_t va, vsize_t size)
+static void
+mipsNN_pdcache_wbinv_range_index_16_intern(vaddr_t va, vaddr_t eva)
 {
-	struct mips_cache_info * const mci

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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:18:54 UTC 2011

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

Log Message:
whitespace cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/mips/mips/pmap.c

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

Modified files:

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.198 src/sys/arch/mips/mips/pmap.c:1.199
--- src/sys/arch/mips/mips/pmap.c:1.198	Tue Mar 15 07:31:33 2011
+++ src/sys/arch/mips/mips/pmap.c	Fri Apr 29 22:18:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.198 2011/03/15 07:31:33 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.199 2011/04/29 22:18:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.198 2011/03/15 07:31:33 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.199 2011/04/29 22:18:53 matt Exp $");
 
 /*
  *	Manages physical address maps.
@@ -271,7 +271,7 @@
 #endif
 	},
 };
-struct pmap		*const kernel_pmap_ptr = &kernel_pmap_store.kernel_pmap;
+struct pmap * const kernel_pmap_ptr = &kernel_pmap_store.kernel_pmap;
 
 paddr_t mips_avail_start;	/* PA of first available physical page */
 paddr_t mips_avail_end;		/* PA of last available physical page */
@@ -660,8 +660,8 @@
 
 		printf("%s: seg %u: %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR"\n",
 		__func__, bank,
-		seg->avail_start, seg->start, 
-		seg->avail_end, seg->end); 
+		seg->avail_start, seg->start,
+		seg->avail_end, seg->end);
 
 		if (seg->avail_start != seg->start
 		|| seg->avail_start >= seg->avail_end) {
@@ -773,11 +773,11 @@
 		 * Disable sosend_loan() in src/sys/kern/uipc_socket.c
 		 * on MIPS3 CPUs to avoid possible virtual cache aliases
 		 * and uncached mappings in pmap_enter_pv().
-		 * 
+		 *
 		 * Ideally, read only shared mapping won't cause aliases
 		 * so pmap_enter_pv() should handle any shared read only
 		 * mappings without uncached ops like ARM pmap.
-		 * 
+		 *
 		 * On the other hand, R4000 and R4400 have the virtual
 		 * coherency exceptions which will happen even on read only
 		 * mappings, so we always have to disable sosend_loan()
@@ -1491,11 +1491,12 @@
 	if (!MIPS_HAS_R4K_MMU
 	&& pg != NULL
 	&& prot == (VM_PROT_READ | VM_PROT_EXECUTE)) {
+		struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 		PMAP_COUNT(enter_exec_mapping);
 		if (!PG_MD_EXECPAGE_P(md)) {
 			mips_icache_sync_range(MIPS_PHYS_TO_KSEG0(pa),
 			PAGE_SIZE);
-			pmap_set_page_attributes(pg, PG_MD_EXECPAGE);
+			pmap_set_mdpage_attributes(md, PG_MD_EXECPAGE);
 			PMAP_COUNT(exec_syncicache_entry);
 		}
 	}
@@ -1695,7 +1696,7 @@
 (void)PG_MD_PVLIST_LOCK(md, false);
 pv_entry_t pv = &md->pvh_first;
 if (pv->pv_pmap == NULL) {
-	pv->pv_va = va; 
+	pv->pv_va = va;
 } else if (PG_MD_CACHED_P(md)
 && mips_cache_badalias(pv->pv_va, va)) {
 	mips_dcache_wbinv_range(va, PAGE_SIZE);
@@ -2238,7 +2239,7 @@
 			/*
 			 * To allocate a PV, we have to release the PVLIST lock
 			 * so get the page generation.  We allocate the PV, and
-			 * then reacquire the lock.  
+			 * then reacquire the lock.
 			 */
 			PG_MD_PVLIST_UNLOCK(md);
 #endif
@@ -2496,7 +2497,7 @@
 	if (MIPS_CACHE_VIRTUAL_ALIAS)
 		mips_dcache_inv_range(va, PAGE_SIZE);
 #endif
-	struct vm_page *pg = PHYS_TO_VM_PAGE(pa);
+	struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
 	KASSERT(pg != NULL);
 	pmap_clear_mdpage_attributes(VM_PAGE_TO_MD(pg), PG_MD_POOLPAGE);
 	uvm_pagefree(pg);
@@ -2623,7 +2624,7 @@
 		KASSERT(pv->pv_pmap == NULL);
 		pv->pv_va = va;
 		if (PG_MD_CACHED_P(md) && mips_cache_badalias(last_va, va))
-			mips_dcache_wbinv_range_index(last_va, PAGE_SIZE); 
+			mips_dcache_wbinv_range_index(last_va, PAGE_SIZE);
 		PG_MD_PVLIST_UNLOCK(md);
 	}
 #endif



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:18:16 UTC 2011

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

Log Message:
minor cleanup (remove redundant static, fix whitespace).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/mips/mips_fpu.c

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

Modified files:

Index: src/sys/arch/mips/mips/mips_fpu.c
diff -u src/sys/arch/mips/mips/mips_fpu.c:1.3 src/sys/arch/mips/mips/mips_fpu.c:1.4
--- src/sys/arch/mips/mips/mips_fpu.c:1.3	Sun Feb 20 16:38:13 2011
+++ src/sys/arch/mips/mips/mips_fpu.c	Fri Apr 29 22:18:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_fpu.c,v 1.3 2011/02/20 16:38:13 rmind Exp $	*/
+/*	$NetBSD: mips_fpu.c,v 1.4 2011/04/29 22:18:16 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_fpu.c,v 1.3 2011/02/20 16:38:13 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_fpu.c,v 1.4 2011/04/29 22:18:16 matt Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -86,7 +86,7 @@
 	return pcu_used(&mips_fpu_ops, l);
 }
 
-static void
+void
 mips_fpu_state_save(lwp_t *l, bool release)
 {
 	struct trapframe * const tf = l->l_md.md_utf;
@@ -115,7 +115,7 @@
 		"cfc1	%1, $31"	"\n\t"
 		"cfc1	%1, $31"	"\n\t"
 		".set reorder"		"\n\t"
-		".set at" 
+		".set at"
 	:	"=&r" (status), "=r"(fpcsr)
 	:	"r"(tf->tf_regs[_R_SR] & (MIPS_SR_COP_1_BIT|MIPS3_SR_FR|MIPS_SR_KX|MIPS_SR_INT_IE)),
 		"n"(MIPS_COP_0_STATUS));
@@ -217,7 +217,7 @@
 }
 
 void
-mips_fpu_state_load(struct lwp *l, bool used)
+mips_fpu_state_load(lwp_t *l, bool used)
 {
 	struct trapframe * const tf = l->l_md.md_utf;
 	struct pcb * const pcb = lwp_getpcb(l);



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:17:18 UTC 2011

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

Log Message:
Remove redundant opt_multiprocessor.h include


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/mips/mips_fixup.c

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

Modified files:

Index: src/sys/arch/mips/mips/mips_fixup.c
diff -u src/sys/arch/mips/mips/mips_fixup.c:1.5 src/sys/arch/mips/mips/mips_fixup.c:1.6
--- src/sys/arch/mips/mips/mips_fixup.c:1.5	Fri Mar 18 15:19:43 2011
+++ src/sys/arch/mips/mips/mips_fixup.c	Fri Apr 29 22:17:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_fixup.c,v 1.5 2011/03/18 15:19:43 tsutsui Exp $	*/
+/*	$NetBSD: mips_fixup.c,v 1.6 2011/04/29 22:17:17 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,9 +30,8 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_fixup.c,v 1.5 2011/03/18 15:19:43 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_fixup.c,v 1.6 2011/04/29 22:17:17 matt Exp $");
 
-#include "opt_multiprocessor.h"
 #include "opt_mips3_wired.h"
 #include "opt_multiprocessor.h"
 #include 



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:16:50 UTC 2011

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
Add/move some COP0_SYNC.  increment tlb miss counter on mips3 and mips64r2
#ifdef MIPS3 / #endif more nops


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/mips/mips/mipsX_subr.S

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

Modified files:

Index: src/sys/arch/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.45 src/sys/arch/mips/mips/mipsX_subr.S:1.46
--- src/sys/arch/mips/mips/mipsX_subr.S:1.45	Thu Apr 14 09:25:05 2011
+++ src/sys/arch/mips/mips/mipsX_subr.S	Fri Apr 29 22:16:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.45 2011/04/14 09:25:05 matt Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.46 2011/04/29 22:16:49 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -162,11 +162,14 @@
 #if (MIPS3 + MIPS64 + MIPS64R2) > 0
 #define	USE_64BIT_INSTRUCTIONS
 #define	USE_64BIT_CP0_FUNCTIONS
+#elif (MIPS32 + MIPS32R2) > 0
+#ifdef _LP64
+#error	MIPS32 and MIPS32R2 can't run 64-bit kernels.
 #endif
-
-#if (MIPS32 + MIPS32R2) > 0
 #undef	USE_64BIT_INSTRUCTIONS
 #undef	USE_64BIT_CP0_FUNCTIONS
+#else
+#error	One of MIPS{3,32,32R2,64,64R2} must be defined
 #endif
 
 #ifdef _LP64
@@ -355,20 +358,19 @@
 	_SLL	k1, WIRED_SHIFT			#14: chop top 2 bits (part 2a)
 	_SRL	k1, WIRED_SHIFT			#15: chop top 2 bits (part 2b)
 	_MTC0	k1, MIPS_COP_0_TLB_LO1		#16: lo1 is loaded
-	nop	#17: standard nop
+	sll	$0, $0, 3			#17: standard nop (ehb)
+#ifdef MIPS3
 	nop	#18: extra nop for QED5230
+#endif
 	tlbwr	#19: write to tlb
-#ifdef MIPS64
-	lui	k1, %hi(CPUVAR(EV_TLBMISSES))	#01: k1=hi of tlbmisses
-	REG_L	k0, %lo(CPUVAR(EV_TLBMISSES))(k1)
-	REG_ADDU k0, 1
-	REG_S	k0, %lo(CPUVAR(EV_TLBMISSES))(k1)
-#else
-	nop	#1a: standard nop
-	nop	#1b: needed by R4000/4400
-	nop	#1c: needed by R4000/4400
+	sll	$0, $0, 3			#1a: standard nop (ehb)
+#if (MIPS3 + MIPS64 + MIPS64R2) > 0
+	lui	k1, %hi(CPUVAR(EV_TLBMISSES))	#1b: k1=hi of tlbmisses
+	REG_L	k0, %lo(CPUVAR(EV_TLBMISSES))(k1) #1c
+	REG_ADDU k0, 1#1d
+	REG_S	k0, %lo(CPUVAR(EV_TLBMISSES))(k1) #1e
 #endif
-	eret	#1d: return from exception
+	eret	#1f: return from exception
 	.set	at
 _VECTOR_END(MIPSX(tlb_miss))
 
@@ -1586,7 +1588,7 @@
 	dsll32	k1, k1, 0
 #endif
 	bgez	k0, _C_LABEL(MIPSX(kern_gen_exception))	# full trap processing
-	 nop		
+	 nop	# - delay slot -
 	PTR_SUBU k0, k1
 	INT_L	k1, _C_LABEL(Sysmapsize)	# index within range?
 	PTR_SRL	k0, PGSHIFT
@@ -1604,7 +1606,7 @@
 	nop
 #endif
 	bltz	k0, _C_LABEL(MIPSX(kern_gen_exception)) # ASSERT(TLB entry exists)
-	 nop		
+	 nop	# - delay slot -
 
 	and	k0, k1, 4			# check even/odd page
 #ifdef MIPS3
@@ -1614,7 +1616,6 @@
 	 nop
 
 	INT_L	k0, 0(k1)			# get PTE entry
-
 	_SLL	k0, k0, WIRED_SHIFT		# get rid of "wired" bit
 	_SRL	k0, k0, WIRED_SHIFT
 	_MTC0	k0, MIPS_COP_0_TLB_LO0		# load PTE entry
@@ -1624,7 +1625,8 @@
 	nop	# required for QED5230
 #endif
 	beqz	k0, _C_LABEL(MIPSX(kern_gen_exception))	# PTE invalid
-	 nop		
+	 nop	# - delay slot -
+
 	INT_L	k0, 4(k1)			# get odd PTE entry
 	_SLL	k0, k0, WIRED_SHIFT
 	mfc0	k1, MIPS_COP_0_TLB_INDEX
@@ -1647,7 +1649,6 @@
 
 MIPSX(kern_tlbi_odd):
 	INT_L	k0, 0(k1)			# get PTE entry
-
 	_SLL	k0, k0, WIRED_SHIFT		# get rid of wired bit
 	_SRL	k0, k0, WIRED_SHIFT
 	_MTC0	k0, MIPS_COP_0_TLB_LO1		# save PTE entry
@@ -1657,7 +1658,8 @@
 	nop	# required for QED5230
 #endif
 	beqz	k0, _C_LABEL(MIPSX(kern_gen_exception))	# PTE invalid
-	 nop
+	 nop	# - delay slot -
+
 	INT_L	k0, -4(k1)			# get even PTE entry
 	_SLL	k0, k0, WIRED_SHIFT
 	mfc0	k1, MIPS_COP_0_TLB_INDEX
@@ -1766,7 +1768,6 @@
 #ifdef MIPS3
 	nop	# required for QED5230
 #endif
-
 	tlbr	# read the entry first
 	COP0_SYNC
 	_MTC0	a1, MIPS_COP_0_TLB_LO1		# init low reg1.
@@ -1841,7 +1842,6 @@
 	_MFC0	ta0, MIPS_COP_0_TLB_LO0		# See what we got
 	_MFC0	ta1, MIPS_COP_0_TLB_LO1		# See what we got
 	_MTC0	t0, MIPS_COP_0_TLB_HI		# restore PID
-	COP0_SYNC
 	mtc0	ta2, MIPS_COP_0_TLB_PG_MASK	# restore pgMask
 	COP0_SYNC
 	mtc0	v1, MIPS_COP_0_STATUS		# Restore the status register
@@ -1874,8 +1874,6 @@
 	tlbp	# probe the entry in question
 	COP0_SYNC
 	mfc0	v0, MIPS_COP_0_TLB_INDEX	# see what we got
-	#nop	# -slip-
-	#nop	# -slip-
 	bltz	v0, 1f# index < 0 then skip
 	 li	t1, MIPS_KSEG0_START		# invalid address
 	PTR_SLL	v0, PGSHIFT + 1			# PAGE_SHIFT + 1
@@ -1883,20 +1881,21 @@
 	_MTC0	t1, MIPS_COP_0_TLB_HI		# make entryHi invalid
 	_MTC0	zero, MIPS_COP_0_TLB_LO0	# zero out entryLo0
 	_MTC0	zero, MIPS_COP_0_TLB_LO1	# zero out entryLo1
-	COP0_SYNC
-#if 1
-	nop
-#else
+#if 0
 	mtc0	zero, MIPS_COP_0_TLB_PG_MASK	# zero out pageMask
 #endif
 	COP0_SYNC
+#ifdef MIPS3
 	nop
 	nop
+#endif
 
 	tlbwi
 	COP0_SYNC
+#ifdef MIPS3
 	nop
 	nop
+#endif
 1:
 	_MTC0	t0, MIPS_COP_0_TLB_HI		# restore current ASID
 	mtc0	t

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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:14:59 UTC 2011

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

Log Message:
Add whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/mips/mips/db_trace.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_trace.c
diff -u src/sys/arch/mips/mips/db_trace.c:1.41 src/sys/arch/mips/mips/db_trace.c:1.42
--- src/sys/arch/mips/mips/db_trace.c:1.41	Sun Feb 20 07:45:47 2011
+++ src/sys/arch/mips/mips/db_trace.c	Fri Apr 29 22:14:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.41 2011/02/20 07:45:47 matt Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.42 2011/04/29 22:14:59 matt Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.41 2011/02/20 07:45:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.42 2011/04/29 22:14:59 matt Exp $");
 
 #include "opt_ddb.h"
 
@@ -182,6 +182,7 @@
 		}	
 		l = LIST_FIRST(&p->p_lwps); /* XXX NJWLWP */
 	}
+
 	pcb = lwp_getpcb(l);
 	(*pr)("at %p\n", pcb);
 



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:14:35 UTC 2011

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

Log Message:
KNF cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/mips/mips/db_interface.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.73 src/sys/arch/mips/mips/db_interface.c:1.74
--- src/sys/arch/mips/mips/db_interface.c:1.73	Thu Apr 14 17:43:07 2011
+++ src/sys/arch/mips/mips/db_interface.c	Fri Apr 29 22:14:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.73 2011/04/14 17:43:07 matt Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.74 2011/04/29 22:14:35 matt Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.73 2011/04/14 17:43:07 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.74 2011/04/29 22:14:35 matt Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_cputype.h"	/* which mips CPUs do we support? */
@@ -47,8 +47,8 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -521,7 +521,7 @@
 	if (!have_addr) {
 		db_printf("%-3s %-5s %-16s %4s %4s\n",
 			"#", "MODE", "ADDR", "MASK", "ASID");
-		for (int i=0; i < ci->ci_cpuwatch_count; i++) {
+		for (u_int i=0; i < ci->ci_cpuwatch_count; i++) {
 			cwp = &ci->ci_cpuwatch_tab[i];
 			mode = cwp->cw_mode;
 			if ((mode & CPUWATCH_RWX) == 0)
@@ -532,9 +532,9 @@
 			str[3] = (mode & CPUWATCH_MASK)  ?  'm' : '-';
 			str[4] = (mode & CPUWATCH_ASID)  ?  'a' : 'g';
 			str[5] = '\0';
-			db_printf("%2d: %s %16" PRIxREGISTER
-  " %4" PRIxREGISTER " %4x\n",
-  i, str, cwp->cw_addr, cwp->cw_mask, cwp->cw_asid);
+			db_printf("%2u: %s %16" PRIxREGISTER
+			" %4" PRIxREGISTER " %4x\n",
+			i, str, cwp->cw_addr, cwp->cw_mask, cwp->cw_asid);
 		}
 		db_flush_lex();
 		return;
@@ -629,13 +629,12 @@
 		 const char *modif)
 {
 	struct cpu_info * const ci = curcpu();
-	cpu_watchpoint_t *cwp;
-	int i, n;
-	bool unwatch_all = !have_addr;
+	const bool unwatch_all = !have_addr;
+	int n;
 
 	n = 0;
-	for (i=0; i < ci->ci_cpuwatch_count; i++) {
-		cwp = &ci->ci_cpuwatch_tab[i];
+	for (u_int i=0; i < ci->ci_cpuwatch_count; i++) {
+		cpu_watchpoint_t * const cwp = &ci->ci_cpuwatch_tab[i];
 		if (unwatch_all || (cwp->cw_addr == (register_t)address)) {
 			cpuwatch_free(cwp);
 			n++;
@@ -643,8 +642,7 @@
 	}
 	if (n == 0)
 		db_printf("no watch found on address %#" PRIxREGISTER "\n",
-			(register_t)address);
-
+		(register_t)address);
 }
 #endif	/* (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */
 



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:13:49 UTC 2011

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

Log Message:
whitespace cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/mips/cpu_subr.c

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

Modified files:

Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.10 src/sys/arch/mips/mips/cpu_subr.c:1.11
--- src/sys/arch/mips/mips/cpu_subr.c:1.10	Thu Apr 14 15:44:39 2011
+++ src/sys/arch/mips/mips/cpu_subr.c	Fri Apr 29 22:13:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.10 2011/04/14 15:44:39 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.11 2011/04/29 22:13:49 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.10 2011/04/14 15:44:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.11 2011/04/29 22:13:49 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -150,7 +150,7 @@
 ci->ci_cycles_per_hz = cpu_info_store.ci_cycles_per_hz;
 ci->ci_divisor_delay = cpu_info_store.ci_divisor_delay;
 ci->ci_divisor_recip = cpu_info_store.ci_divisor_recip;
-ci->ci_cpuwatch_count = cpu_info_store.ci_cpuwatch_count;
+	ci->ci_cpuwatch_count = cpu_info_store.ci_cpuwatch_count;
 
 	/*
 	 * Attach its TLB info (which must be direct-mapped)



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:12:22 UTC 2011

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

Log Message:
fix mips32/mips64 program on mips32/mips64 r2 bug.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/mips/mips/cpu_exec.c

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

Modified files:

Index: src/sys/arch/mips/mips/cpu_exec.c
diff -u src/sys/arch/mips/mips/cpu_exec.c:1.62 src/sys/arch/mips/mips/cpu_exec.c:1.63
--- src/sys/arch/mips/mips/cpu_exec.c:1.62	Tue Mar 15 07:39:22 2011
+++ src/sys/arch/mips/mips/cpu_exec.c	Fri Apr 29 22:12:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_exec.c,v 1.62 2011/03/15 07:39:22 matt Exp $	*/
+/*	$NetBSD: cpu_exec.c,v 1.63 2011/04/29 22:12:22 matt Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.62 2011/03/15 07:39:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.63 2011/04/29 22:12:22 matt Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_ultrix.h"
@@ -280,8 +280,9 @@
 		break;
 	case EF_MIPS_ARCH_32:
 	case EF_MIPS_ARCH_64:
-		if (!CPUISMIPSNN)
+		if (!CPUISMIPSNN && !CPUISMIPS32R2 && !CPUISMIPS64R2)
 			return ENOEXEC;
+		break;
 	case EF_MIPS_ARCH_32R2:
 	case EF_MIPS_ARCH_64R2:
 		if (!CPUISMIPS32R2 && !CPUISMIPS64R2)



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:11:15 UTC 2011

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

Log Message:
constification.


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

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

Modified files:

Index: src/sys/arch/mips/mips/compat_16_machdep.c
diff -u src/sys/arch/mips/mips/compat_16_machdep.c:1.18 src/sys/arch/mips/mips/compat_16_machdep.c:1.19
--- src/sys/arch/mips/mips/compat_16_machdep.c:1.18	Sun Feb 20 07:45:47 2011
+++ src/sys/arch/mips/mips/compat_16_machdep.c	Fri Apr 29 22:11:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_16_machdep.c,v 1.18 2011/02/20 07:45:47 matt Exp $	*/
+/*	$NetBSD: compat_16_machdep.c,v 1.19 2011/04/29 22:11:15 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 	
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.18 2011/02/20 07:45:47 matt Exp $"); 
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.19 2011/04/29 22:11:15 matt Exp $"); 
 
 #ifdef _KERNEL_OPT
 #include "opt_cputype.h"
@@ -57,6 +57,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -65,8 +66,6 @@
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 
@@ -92,14 +91,14 @@
 sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *returnmask)
 {
 	int sig = ksi->ksi_signo;
-	struct lwp *l = curlwp;
-	struct proc *p = l->l_proc;
-	struct pcb *pcb;
-	struct sigacts *ps = p->p_sigacts;
+	struct lwp * const l = curlwp;
+	struct proc * const p = l->l_proc;
+	struct sigacts * const ps = p->p_sigacts;
+	struct pcb * const pcb = lwp_getpcb(l);
 	int onstack, error;
 	struct sigcontext *scp = getframe(l, sig, &onstack);
 	struct sigcontext ksc;
-	struct trapframe *tf = l->l_md.md_utf;
+	struct trapframe * const tf = l->l_md.md_utf;
 	sig_t catcher = SIGACTION(p, sig).sa_handler;
 
 #if !defined(__mips_o32)
@@ -132,9 +131,8 @@
 #endif
 
 	/* Save the FP state, if necessary, then copy it. */
-	pcb = lwp_getpcb(l);
-#if defined(FPEMUL) || !defined(NOFPU)
 	ksc.sc_fpused = fpu_used_p(l);
+#if !defined(NOFPU)
 	if (ksc.sc_fpused) {
 		/* if FPU has current state, save it first */
 		fpu_save();
@@ -238,9 +236,9 @@
 		syscallarg(struct sigcontext *) sigcntxp;
 	} */
 	struct sigcontext *scp, ksc;
-	struct trapframe *tf = l->l_md.md_utf;
-	struct proc *p = l->l_proc;
-	struct pcb *pcb;
+	struct trapframe * const tf = l->l_md.md_utf;
+	struct proc * const p = l->l_proc;
+	struct pcb * const pcb = lwp_getpcb(l);
 	int error;
 
 #if !defined(__mips_o32)
@@ -271,19 +269,16 @@
 #if defined(__mips_o32)
 	memcpy(&tf->tf_regs[1], &scp->sc_regs[1],
 	sizeof(scp->sc_regs) - sizeof(scp->sc_regs[0]));
-
 #else
 	for (size_t i = 1; i < __arraycount(tf->tf_regs); i++)
 		tf->tf_regs[i] = ksc.sc_regs[i];
 #endif
-	if (scp->sc_fpused) {
 #if !defined(NOFPU)
+	if (scp->sc_fpused) {
 		fpu_discard();
-#endif
-		pcb = lwp_getpcb(l);
-		*(struct fpreg *)&pcb->pcb_fpregs
-		= *(struct fpreg *)scp->sc_fpregs;
 	}
+#endif
+	*(struct fpreg *)&pcb->pcb_fpregs = *(struct fpreg *)scp->sc_fpregs;
 
 	mutex_enter(p->p_lock);
 	/* Restore signal stack. */



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:10:22 UTC 2011

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

Log Message:
remove redundant opt_multiprocessor.h include


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/mips/pmap_segtab.c

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

Modified files:

Index: src/sys/arch/mips/mips/pmap_segtab.c
diff -u src/sys/arch/mips/mips/pmap_segtab.c:1.2 src/sys/arch/mips/mips/pmap_segtab.c:1.3
--- src/sys/arch/mips/mips/pmap_segtab.c:1.2	Sun Feb 20 07:45:48 2011
+++ src/sys/arch/mips/mips/pmap_segtab.c	Fri Apr 29 22:10:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_segtab.c,v 1.2 2011/02/20 07:45:48 matt Exp $	*/
+/*	$NetBSD: pmap_segtab.c,v 1.3 2011/04/29 22:10:22 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.2 2011/02/20 07:45:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.3 2011/04/29 22:10:22 matt Exp $");
 
 /*
  *	Manages physical address maps.
@@ -111,7 +111,6 @@
  * These warnings probably applies to other files under sys/arch/mips.
  */
 
-#include "opt_multiprocessor.h"
 #include "opt_sysv.h"
 #include "opt_cputype.h"
 #include "opt_mips_cache.h"



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:09:42 UTC 2011

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

Log Message:
constification


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/mips/mips/sig_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/sig_machdep.c
diff -u src/sys/arch/mips/mips/sig_machdep.c:1.21 src/sys/arch/mips/mips/sig_machdep.c:1.22
--- src/sys/arch/mips/mips/sig_machdep.c:1.21	Sun Feb 20 07:45:48 2011
+++ src/sys/arch/mips/mips/sig_machdep.c	Fri Apr 29 22:09:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig_machdep.c,v 1.21 2011/02/20 07:45:48 matt Exp $	*/
+/*	$NetBSD: sig_machdep.c,v 1.22 2011/04/29 22:09:41 matt Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 	
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.21 2011/02/20 07:45:48 matt Exp $"); 
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.22 2011/04/29 22:09:41 matt Exp $"); 
 
 #include "opt_cputype.h"
 
@@ -75,10 +75,10 @@
 void
 sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
 {
-	struct lwp *l = curlwp;
-	struct proc *p = l->l_proc;
-	struct sigacts *ps = p->p_sigacts;
-	struct trapframe *tf = l->l_md.md_utf;
+	struct lwp * const l = curlwp;
+	struct proc * const p = l->l_proc;
+	struct sigacts * const sa = p->p_sigacts;
+	struct trapframe * const tf = l->l_md.md_utf;
 	int onstack, error;
 	const int signo = ksi->ksi_signo;
 	struct sigframe_siginfo *sf = getframe(l, signo, &onstack);
@@ -121,7 +121,7 @@
 	tf->tf_regs[_R_PC] = (intptr_t)catcher;
 	tf->tf_regs[_R_T9] = (intptr_t)catcher;
 	tf->tf_regs[_R_SP] = (intptr_t)sf;
-	tf->tf_regs[_R_RA] = (intptr_t)ps->sa_sigdesc[signo].sd_tramp;
+	tf->tf_regs[_R_RA] = (intptr_t)sa->sa_sigdesc[signo].sd_tramp;
 
 	/* Remember that we're now on the signal stack. */
 	if (onstack)



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:09:08 UTC 2011

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

Log Message:
Use sizeof(*pte) instead sizeof(type)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mips/mips/process_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/process_machdep.c
diff -u src/sys/arch/mips/mips/process_machdep.c:1.33 src/sys/arch/mips/mips/process_machdep.c:1.34
--- src/sys/arch/mips/mips/process_machdep.c:1.33	Sun Feb 20 07:45:48 2011
+++ src/sys/arch/mips/mips/process_machdep.c	Fri Apr 29 22:09:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.33 2011/02/20 07:45:48 matt Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.34 2011/04/29 22:09:08 matt Exp $	*/
 
 /*
  * Copyright (c) 1993 The Regents of the University of California.
@@ -76,7 +76,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.33 2011/02/20 07:45:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.34 2011/04/29 22:09:08 matt Exp $");
 
 /*
  * This file may seem a bit stylized, but that so that it's easier to port.
@@ -145,7 +145,7 @@
 #endif
 
 	fpu_save_lwp(l);
-	memcpy(regs, &pcb->pcb_fpregs, sizeof(struct fpreg));
+	memcpy(regs, &pcb->pcb_fpregs, sizeof(*regs));
 	return 0;
 }
 



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:08:17 UTC 2011

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

Log Message:
cleanup cpu.h includes


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/arch/mips/mips/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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.230 src/sys/arch/mips/mips/trap.c:1.231
--- src/sys/arch/mips/mips/trap.c:1.230	Wed Apr  6 05:33:07 2011
+++ src/sys/arch/mips/mips/trap.c	Fri Apr 29 22:08:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.230 2011/04/06 05:33:07 matt Exp $	*/
+/*	$NetBSD: trap.c,v 1.231 2011/04/29 22:08:17 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.230 2011/04/06 05:33:07 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.231 2011/04/29 22:08:17 matt Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -58,7 +59,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -67,7 +67,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 #include 			/* symbolic register indices */



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:07:46 UTC 2011

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

Log Message:
Deal with uarea mapped in either kseg0 or xkphys.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/mips/mips/vm_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.136 src/sys/arch/mips/mips/vm_machdep.c:1.137
--- src/sys/arch/mips/mips/vm_machdep.c:1.136	Sun Feb 20 07:45:48 2011
+++ src/sys/arch/mips/mips/vm_machdep.c	Fri Apr 29 22:07:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.136 2011/02/20 07:45:48 matt Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.137 2011/04/29 22:07:46 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.136 2011/02/20 07:45:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.137 2011/04/29 22:07:46 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -120,17 +120,16 @@
 
 	l2->l_md.md_utf = tf;
 #if USPACE > PAGE_SIZE
+	bool direct_mapped_p = MIPS_KSEG0_P(ua2);
 #ifdef _LP64
-	if (!MIPS_XKPHYS_P(ua2))
-#else
-	if (!MIPS_KSEG0_P(ua2))
+	direct_mapped_p = direct_mapped_p || MIPS_XKPHYS_P(ua2);
 #endif
-	{
-		const int x = (MIPS_HAS_R4K_MMU) ?
+	if (!direct_mapped_p) {
+		pt_entry_t * const pte = kvtopte(ua2);
+		const uint32_t x = (MIPS_HAS_R4K_MMU) ?
 		(MIPS3_PG_G | MIPS3_PG_RO | MIPS3_PG_WIRED) : MIPS1_PG_G;
-		pt_entry_t *pte = kvtopte(ua2);
 
-		for (size_t i = 0; i < UPAGES; i++) {
+		for (u_int i = 0; i < UPAGES; i++) {
 			l2->l_md.md_upte[i] = pte[i].pt_entry &~ x;
 		}
 	}



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:06:43 UTC 2011

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

Log Message:
whitespace cleanup


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

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

Modified files:

Index: src/sys/arch/mips/mips/cache_r5k.c
diff -u src/sys/arch/mips/mips/cache_r5k.c:1.14 src/sys/arch/mips/mips/cache_r5k.c:1.15
--- src/sys/arch/mips/mips/cache_r5k.c:1.14	Sun Feb 20 07:45:47 2011
+++ src/sys/arch/mips/mips/cache_r5k.c	Fri Apr 29 22:06:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache_r5k.c,v 1.14 2011/02/20 07:45:47 matt Exp $	*/
+/*	$NetBSD: cache_r5k.c,v 1.15 2011/04/29 22:06:43 matt Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache_r5k.c,v 1.14 2011/02/20 07:45:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache_r5k.c,v 1.15 2011/04/29 22:06:43 matt Exp $");
 
 #include 
 
@@ -621,8 +621,8 @@
 	r5k_sdcache_wbinv_range(va, size);
 }
 
-#define	mips_r5k_round_page(x)		(((x) + (128 * 32 - 1)) & ~(128 * 32 - 1))
-#define	mips_r5k_trunc_page(x)		((x) & ~(128 * 32 - 1))
+#define	mips_r5k_round_page(x)	(((x) + (128 * 32 - 1)) & ~(128 * 32 - 1))
+#define	mips_r5k_trunc_page(x)	((x) & ~(128 * 32 - 1))
 
 void
 r5k_sdcache_wbinv_range(vaddr_t va, vsize_t size)



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:06:12 UTC 2011

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

Log Message:
add cop2 instructions


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.21 src/sys/arch/mips/mips/db_disasm.c:1.22
--- src/sys/arch/mips/mips/db_disasm.c:1.21	Mon Dec 14 00:46:06 2009
+++ src/sys/arch/mips/mips/db_disasm.c	Fri Apr 29 22:06:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.21 2009/12/14 00:46:06 matt Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.22 2011/04/29 22:06:12 matt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.21 2009/12/14 00:46:06 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.22 2011/04/29 22:06:12 matt Exp $");
 
 #include 
 #include 
@@ -134,11 +134,11 @@
 
 static const char * const c0_reg[32] = {
 	"index","random",   "tlblo0",  "tlblo1",
-	"context",  "pagemask", "wired",   "cp0r7",
+	"context",  "pagemask", "wired",   "hwrena",
 	"badvaddr", "count","tlbhi",   "compare",
 	"status",   "cause","epc", "prid",
 	"config",   "lladdr",   "watchlo", "watchhi",
-	"xcontext", "cp0r21",   "cp0r22",  "debug",
+	"xcontext", "cp0r21",   "osscratch",  "debug",
 	"depc", "perfcnt",  "ecc", "cacheerr",
 	"taglo","taghi","errepc",  "desave"
 };
@@ -429,6 +429,70 @@
 		}
 		break;
 
+	case OP_COP2:
+		switch (i.RType.rs) {
+		case OP_BCx:
+		case OP_BCy:
+			db_printf("bc2%c\t",
+			"ft"[i.RType.rt & COPz_BC_TF_MASK]);
+			goto pr_displ;
+
+		case OP_MT:
+			db_printf("mtc2\t%s,f%d",
+			reg_name[i.RType.rt],
+			i.RType.rd);
+			break;
+
+		case OP_MF:
+			db_printf("mfc2\t%s,f%d",
+			reg_name[i.RType.rt],
+			i.RType.rd);
+			break;
+
+		case OP_CT:
+			db_printf("ctc2\t%s,f%d",
+			reg_name[i.RType.rt],
+			i.RType.rd);
+			break;
+
+		case OP_CF:
+			db_printf("cfc2\t%s,f%d",
+			reg_name[i.RType.rt],
+			i.RType.rd);
+			break;
+
+		case OP_DMT:
+			db_printf("dmtc2\t%s,f%d",
+			reg_name[i.RType.rt],
+			i.RType.rd);
+			break;
+
+		case OP_DMF:
+			db_printf("dmfc2\t%s,f%d",
+			reg_name[i.RType.rt],
+			i.RType.rd);
+			break;
+
+		case OP_MTH:
+			db_printf("mthc2\t%s,f%d",
+			reg_name[i.RType.rt],
+			i.RType.rd);
+			break;
+
+		case OP_MFH:
+			db_printf("mfhc2\t%s,f%d",
+			reg_name[i.RType.rt],
+			i.RType.rd);
+			break;
+
+		default:
+			db_printf("%s\t%s,%s,%d", op_name[i.IType.op],
+			reg_name[i.IType.rt],
+			reg_name[i.IType.rs],
+			(short)i.IType.imm);
+		}
+		break;
+
 	case OP_J:
 	case OP_JAL:
 		db_printf("%s\t", op_name[i.JType.op]);



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:05:16 UTC 2011

Modified Files:
src/sys/arch/mips/include: locore.h

Log Message:
ras atomicvec is no more.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/mips/include/locore.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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.89 src/sys/arch/mips/include/locore.h:1.90
--- src/sys/arch/mips/include/locore.h:1.89	Thu Apr 14 17:43:07 2011
+++ src/sys/arch/mips/include/locore.h	Fri Apr 29 22:05:16 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.89 2011/04/14 17:43:07 matt Exp $ */
+/* $NetBSD: locore.h,v 1.90 2011/04/29 22:05:16 matt Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -376,7 +376,6 @@
  * The "active" locore-function vector, and
  */
 extern const mips_locore_atomicvec_t mips_llsc_locore_atomicvec;
-extern const mips_locore_atomicvec_t mips_ras_locore_atomicvec;
 
 extern mips_locore_atomicvec_t mips_locore_atomicvec;
 extern mips_locore_jumpvec_t mips_locore_jumpvec;



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:04:42 UTC 2011

Modified Files:
src/sys/arch/mips/mips: lock_stubs_ras.S mips_machdep.c

Log Message:
Since the RAS lock stubs are the default, don't bother assigning them just
make the default.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/mips/lock_stubs_ras.S
cvs rdiff -u -r1.239 -r1.240 src/sys/arch/mips/mips/mips_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/lock_stubs_ras.S
diff -u src/sys/arch/mips/mips/lock_stubs_ras.S:1.2 src/sys/arch/mips/mips/lock_stubs_ras.S:1.3
--- src/sys/arch/mips/mips/lock_stubs_ras.S:1.2	Tue Mar  8 15:01:02 2011
+++ src/sys/arch/mips/mips/lock_stubs_ras.S	Fri Apr 29 22:04:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_ras.S,v 1.2 2011/03/08 15:01:02 tsutsui Exp $	*/
+/*	$NetBSD: lock_stubs_ras.S,v 1.3 2011/04/29 22:04:42 matt Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -446,8 +446,8 @@
 END(ras_mutex_spin_exit)
 #endif	/* !LOCKDEBUG */
 
-	.rdata
-EXPORT(mips_ras_locore_atomicvec)
+	.data
+EXPORT(mips_locore_atomicvec)
 	PTR_WORD 	ras_atomic_cas_uint
 	PTR_WORD 	ras_atomic_cas_ulong
 	PTR_WORD	ras_ucas_uint

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.239 src/sys/arch/mips/mips/mips_machdep.c:1.240
--- src/sys/arch/mips/mips/mips_machdep.c:1.239	Thu Apr 14 05:10:04 2011
+++ src/sys/arch/mips/mips/mips_machdep.c	Fri Apr 29 22:04:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.239 2011/04/14 05:10:04 cliff Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.240 2011/04/29 22:04:42 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.239 2011/04/14 05:10:04 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.240 2011/04/29 22:04:42 matt Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -250,7 +250,6 @@
 mips_locore_jumpvec_t mips_locore_jumpvec;
 
 struct locoresw mips_locoresw;
-mips_locore_atomicvec_t mips_locore_atomicvec;
 
 extern const struct splsw std_splsw;
 struct splsw mips_splsw;
@@ -1141,9 +1140,8 @@
 	mips_config_cache();
 
 	/*
-	 * Default to RAS atomic ops since they are the lowest overhead.
+	 * We default to RAS atomic ops since they are the lowest overhead.
 	 */
-	mips_locore_atomicvec = mips_ras_locore_atomicvec;
 #ifdef MULTIPROCESSOR
 	if (multicpu_p) {
 		/*
@@ -1844,14 +1842,13 @@
 {
 	vsize_t sz = (vsize_t)round_page(MSGBUFSIZE);
 	vsize_t reqsz = sz;
-	struct vm_physseg *vps;
-
-	vps = VM_PHYSMEM_PTR(vm_nphysseg - 1);
+	u_int bank = vm_nphysseg - 1;
+	struct vm_physseg *vps = VM_PHYSMEM_PTR(bank);
 #ifndef _LP64
 	/*
 	 * Fist the physical segment that can be mapped to KSEG0
 	 */
-	for (; vps >= vm_physmem; vps--) {
+	for (; vps >= vm_physmem; vps--, bank--) {
 		if (vps->avail_start + atop(sz) <= atop(MIPS_PHYS_MASK))
 			break;
 	}
@@ -1872,9 +1869,9 @@
 
 	/* Remove the [last] segment if it now has no pages. */
 	if (vps->start == vps->end) {
-		for (; vps != &vm_physmem[vm_nphysseg - 1]; vps++)
-			vps[0] = vps[1];
-		vm_nphysseg--;
+		for (vm_nphysseg--; bank < vm_nphysseg - 1; bank++) {
+			VM_PHYSMEM_PTR_SWAP(bank, bank + 1);
+		}
 	}
 
 	/* warn if the message buffer had to be shrunk */



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:00:54 UTC 2011

Modified Files:
src/sys/arch/mips/include: types.h

Log Message:
define -> define


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/mips/include/types.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/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.50 src/sys/arch/mips/include/types.h:1.51
--- src/sys/arch/mips/include/types.h:1.50	Tue Mar 15 07:33:36 2011
+++ src/sys/arch/mips/include/types.h	Fri Apr 29 22:00:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.50 2011/03/15 07:33:36 matt Exp $	*/
+/*	$NetBSD: types.h,v 1.51 2011/04/29 22:00:54 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -67,14 +67,14 @@
 typedef __uint64_t	vaddr_t;
 typedef __uint64_t	vsize_t;
 #define	PRIxVADDR	PRIx64
-#define PRIxVSIZE	PRIx64
-#define PRIdVSIZE	PRId64
+#define	PRIxVSIZE	PRIx64
+#define	PRIdVSIZE	PRId64
 #else
 typedef __uint32_t	vaddr_t;
 typedef __uint32_t	vsize_t;
-#define PRIxVADDR	PRIx32
-#define PRIxVSIZE	PRIx32
-#define PRIdVSIZE	PRId32
+#define	PRIxVADDR	PRIx32
+#define	PRIxVSIZE	PRIx32
+#define	PRIdVSIZE	PRId32
 #endif
 #endif
 
@@ -92,8 +92,8 @@
 typedef __uint32_t	uregister_t;
 typedef __int32_t	mips_reg_t;		/* do not use */
 typedef __uint32_t	mips_ureg_t;		/* do not use */
-#define PRIxREGISTER	PRIx32
-#define PRIxUREGISTER	PRIx32
+#define	PRIxREGISTER	PRIx32
+#define	PRIxUREGISTER	PRIx32
 #else
 typedef __int64_t	register_t;
 typedef __uint64_t	uregister_t;
@@ -101,8 +101,8 @@
 typedef __uint64_t	mips_ureg_t;		/* do not use */
 typedef __int64_t	register32_t;
 typedef __uint64_t	uregister32_t;
-#define PRIxREGISTER	PRIx64
-#define PRIxUREGISTER	PRIx64
+#define	PRIxREGISTER	PRIx64
+#define	PRIxUREGISTER	PRIx64
 #endif /* __mips_o32 */
 
 #if defined(_KERNEL) || defined(_NETBSD_SOURCE)



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 22:00:03 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_cpu.c rmixl_cpucore.c rmixl_cpucorevar.h

Log Message:
minor cleanups.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/rmi/rmixl_cpu.c \
src/sys/arch/mips/rmi/rmixl_cpucorevar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/rmi/rmixl_cpucore.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.3 src/sys/arch/mips/rmi/rmixl_cpu.c:1.4
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.3	Thu Apr 14 05:12:58 2011
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Fri Apr 29 22:00:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpu.c,v 1.3 2011/04/14 05:12:58 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpu.c,v 1.4 2011/04/29 22:00:03 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,13 +38,11 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c,v 1.3 2011/04/14 05:12:58 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c,v 1.4 2011/04/29 22:00:03 matt Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_ddb.h"
 
-#include "opt_multiprocessor.h"
-
 #include 
 #include 
 #include 
@@ -100,7 +98,7 @@
 #endif
 
 /*
- * cpu_rmixl_db_watch_init - initialize COP0 watchpoint stuff
+ * cpu_rmixl_watchpoint_init - initialize COP0 watchpoint stuff
  *
  * clear IEU_DEFEATURE[DBE] to ensure T_WATCH on watchpoint exception
  * set COP0 watchhi and watchlo
@@ -108,7 +106,7 @@
  * disable all watchpoints
  */
 static void
-cpu_rmixl_db_watch_init(void)
+cpu_rmixl_watchpoint_init(void)
 {
 	uint32_t r;
 
@@ -195,7 +193,7 @@
 		mips_locoresw.lsw_cpu_init = cpu_rmixl_hatch;
 		mips_locoresw.lsw_cpu_run = cpu_rmixl_run;
 	} else {
-		struct cpucore_attach_args *ca = aux;
+		struct cpucore_attach_args * const ca = aux;
 		struct cpucore_softc * const ccsc = device_private(parent);
 		rmixlfw_psb_type_t psb_type = rmixl_configuration.rc_psb_type;
 		cpuid_t cpuid;
@@ -263,7 +261,7 @@
 	asm volatile("dmfc0 %0, $15, 1;" : "=r"(ebase));
 	ci->ci_cpuid = ebase & __BITS(9,0);
 
-	cpu_rmixl_db_watch_init();
+	cpu_rmixl_watchpoint_init();
 
 	rmixl_fmn_init();
 
@@ -280,7 +278,6 @@
 			__func__);
 	sc->sc_ih_fmn = ih;
 #endif
-
 }
 
 #ifdef NOTYET
@@ -336,7 +333,7 @@
 
 	cpucore_rmixl_hatch(device_parent(sc->sc_dev));
 
-	cpu_rmixl_db_watch_init();
+	cpu_rmixl_watchpoint_init();
 }
 
 static int
Index: src/sys/arch/mips/rmi/rmixl_cpucorevar.h
diff -u src/sys/arch/mips/rmi/rmixl_cpucorevar.h:1.3 src/sys/arch/mips/rmi/rmixl_cpucorevar.h:1.4
--- src/sys/arch/mips/rmi/rmixl_cpucorevar.h:1.3	Thu Apr 14 05:15:22 2011
+++ src/sys/arch/mips/rmi/rmixl_cpucorevar.h	Fri Apr 29 22:00:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucorevar.h,v 1.3 2011/04/14 05:15:22 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpucorevar.h,v 1.4 2011/04/29 22:00:03 matt Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,11 +37,11 @@
 
 struct cpucore_softc {
 	device_t	sc_dev;
-	bool		sc_attached;
-	bool		sc_running;
 	u_int		sc_core;
 	u_int		sc_threads_enb;
 	u_int		sc_threads_dis;
+	bool		sc_attached;
+	bool		sc_running;
 	bool		sc_hatched;
 #ifdef MULTIPROCESSOR
 	struct pmap_tlb_info *sc_tlbinfo;
@@ -54,7 +54,9 @@
 	int		ca_thread;
 };
 
-extern void cpucore_rmixl_hatch(device_t);
-extern void cpucore_rmixl_run(device_t);
+#ifdef _KERNEL
+void cpucore_rmixl_hatch(device_t);
+void cpucore_rmixl_run(device_t);
+#endif
 
 #endif	/* _ARCH_MIPS_RMI_RMIXL_CPUCOREVAR_H_ */

Index: src/sys/arch/mips/rmi/rmixl_cpucore.c
diff -u src/sys/arch/mips/rmi/rmixl_cpucore.c:1.4 src/sys/arch/mips/rmi/rmixl_cpucore.c:1.5
--- src/sys/arch/mips/rmi/rmixl_cpucore.c:1.4	Thu Apr 14 06:12:21 2011
+++ src/sys/arch/mips/rmi/rmixl_cpucore.c	Fri Apr 29 22:00:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucore.c,v 1.4 2011/04/14 06:12:21 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpucore.c,v 1.5 2011/04/29 22:00:03 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,9 +38,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.4 2011/04/14 06:12:21 cliff Exp $");
-
-#include "opt_multiprocessor.h"
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.5 2011/04/29 22:00:03 matt Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -93,7 +91,7 @@
 
 	sc->sc_dev = self;
 	sc->sc_core = na->na_core;
-	sc->sc_hatched = false;
+	KASSERT(sc->sc_hatched == false);
 
 #if 0
 #ifdef MULTIPROCESSOR
@@ -150,7 +148,7 @@
 		aprint_normal_dev(self, "threads");
 		u_int d = threads_dis;
 		while (d != 0) {
-			u_int t = ffs(d) - 1;
+			const u_int t = ffs(d) - 1;
 			d ^= (1 << t);
 			aprint_normal(" %d%s", t, (d==0) ? "" : ",");
 		}
@@ -159,8 +157,9 @@
 
 	u_int threads_try_attach = threads_enb;
 	while (threads_try_attach != 0) {
-		u_int t = ffs(threads_try_attach) - 1;
-		threads_try_attach ^= (1

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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 21:59:09 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_pcix.c

Log Message:
Use M_ZERO with malloc instead of doing a explicit memset


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/rmi/rmixl_pcix.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_pcix.c
diff -u src/sys/arch/mips/rmi/rmixl_pcix.c:1.5 src/sys/arch/mips/rmi/rmixl_pcix.c:1.6
--- src/sys/arch/mips/rmi/rmixl_pcix.c:1.5	Thu Apr 14 05:22:47 2011
+++ src/sys/arch/mips/rmi/rmixl_pcix.c	Fri Apr 29 21:59:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcix.c,v 1.5 2011/04/14 05:22:47 cliff Exp $	*/
+/*	$NetBSD: rmixl_pcix.c,v 1.6 2011/04/29 21:59:09 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.5 2011/04/14 05:22:47 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.6 2011/04/29 21:59:09 matt Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -983,7 +983,7 @@
 	 * allocate and initialize softc intr struct
 	 * with one or more dispatch handles
 	 */
-	pip_new = malloc(size, M_DEVBUF, M_NOWAIT);
+	pip_new = malloc(size, M_DEVBUF, M_NOWAIT|M_ZERO);
 	if (pip_new == NULL) {
 #ifdef DIAGNOSTIC
 		printf("%s: cannot malloc\n", __func__);
@@ -991,8 +991,6 @@
 		return NULL;
 	}
 
-	memset(pip_new, 0, size);
-
 	if (pip_old == NULL) {
 		/* initialize the interrupt struct */
 		pip_new->sc = sc;



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 21:58:27 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_intr.c

Log Message:
minor constification, format cleanups


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/rmi/rmixl_intr.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.4 src/sys/arch/mips/rmi/rmixl_intr.c:1.5
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.4	Thu Apr 14 05:16:00 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Fri Apr 29 21:58:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.4 2011/04/14 05:16:00 cliff Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.5 2011/04/29 21:58:27 matt Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_intr.c,v 1.4 2011/04/14 05:16:00 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_intr.c,v 1.5 2011/04/29 21:58:27 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -471,7 +471,6 @@
 void
 rmixl_intr_init_ipi(void)
 {
-
 	mutex_enter(&rmixl_intr_lock);
 
 	for (u_int ipi = 0; ipi < NIPIS; ipi++) {
@@ -482,9 +481,9 @@
 			panic("%s: establish ipi %d at vec %d failed",
 __func__, ipi, vec);
 	}
- 
+
 	mips_locoresw.lsw_send_ipi = rmixl_send_ipi;
- 
+
 	mutex_exit(&rmixl_intr_lock);
 }
 #endif 	/* MULTIPROCESSOR */
@@ -730,7 +729,7 @@
 
 	KASSERT(mutex_owned(&rmixl_intr_lock));
 
-	DPRINTF(("%s: vec %d cpumask %#x ipl %d func %p arg %p mpsage %d\n",
+	DPRINTF(("%s: vec %d cpumask %#x ipl %d func %p arg %p mpsafe %d\n",
 			__func__, vec, cpumask, ipl, func, arg, mpsafe));
 #ifdef DIAGNOSTIC
 	if (rmixl_pic_init_done == 0)
@@ -848,9 +847,7 @@
 rmixl_intr_disestablish(void *cookie)
 {
 	rmixl_intrhand_t *ih = cookie;
-	int vec;
-
-	vec = ih->ih_vec;
+	const int vec = ih->ih_vec;
 
 	KASSERT(vec < NINTRVECS);
 	KASSERT(ih == &rmixl_intrhand[vec]);
@@ -876,7 +873,7 @@
 {
 	struct rmixl_cpu_softc *sc = (void *)curcpu()->ci_softc;
 
-	DPRINTF(("%s: cpu%ld: ipl %d, pc %#"PRIxVADDR", pending %#x\n",
+	DPRINTF(("%s: cpu%u: ipl %d, pc %#"PRIxVADDR", pending %#x\n",
 		__func__, cpu_number(), ipl, pc, pending));
 
 	/*
@@ -896,7 +893,7 @@
 		asm volatile("dmfc0 %0, $9, 7;" : "=r"(eimr));
 
 #ifdef IOINTR_DEBUG
-		printf("%s: cpu%ld: eirr %#"PRIx64", eimr %#"PRIx64", mask %#"PRIx64"\n",
+		printf("%s: cpu%u: eirr %#"PRIx64", eimr %#"PRIx64", mask %#"PRIx64"\n",
 			__func__, cpu_number(), eirr, eimr, ipl_eimr_map[ipl-1]);
 #endif	/* IOINTR_DEBUG */
 



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 21:55:43 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_fmnvar.h

Log Message:
Use mips64 for m[tf]c2, not arch=xlr


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/rmi/rmixl_fmnvar.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/mips/rmi/rmixl_fmnvar.h
diff -u src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.3 src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.4
--- src/sys/arch/mips/rmi/rmixl_fmnvar.h:1.3	Thu Apr 14 09:25:05 2011
+++ src/sys/arch/mips/rmi/rmixl_fmnvar.h	Fri Apr 29 21:55:43 2011
@@ -1,4 +1,4 @@
-/*	$Id: rmixl_fmnvar.h,v 1.3 2011/04/14 09:25:05 matt Exp $	*/
+/*	$Id: rmixl_fmnvar.h,v 1.4 2011/04/29 21:55:43 matt Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -102,7 +102,7 @@
 	\
 	__asm volatile(			\
 		".set push"			"\n\t"			\
-		".set arch=xlr"			"\n\t"			\
+		".set mips64"			"\n\t"			\
 		"mfc2 %0,$%1,%2"		"\n\t"			\
 		".set pop"			"\n\t"			\
 	: "=r"(__val) : "n"(regnum), "n"(sel));			\
@@ -115,7 +115,7 @@
 	\
 	__asm volatile(			\
 		".set push"			"\n\t"			\
-		".set arch=xlr"			"\n\t"			\
+		".set mips64"			"\n\t"			\
 		"mtc2 %0,$%1,%2"		"\n\t"			\
 		".set pop"			"\n\t"			\
 	:: "r"(__val), "n"(regnum), "n"(sel));			\



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 21:55:20 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_fmn.c

Log Message:
cpu_number() return an u_int, use %u for format


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_fmn.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_fmn.c
diff -u src/sys/arch/mips/rmi/rmixl_fmn.c:1.2 src/sys/arch/mips/rmi/rmixl_fmn.c:1.3
--- src/sys/arch/mips/rmi/rmixl_fmn.c:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_fmn.c	Fri Apr 29 21:55:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_fmn.c,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_fmn.c,v 1.3 2011/04/29 21:55:20 matt Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -907,14 +907,14 @@
 		if ((msg_status & (RMIXL_MSG_STS0_LPF)) == 0)
 			goto recv;
 	}
-	DIAG_PRF(("%s: cpu%d, bucket=%d, sts=%#x: Load Pending Fail\n",
+	DIAG_PRF(("%s: cpu%u, bucket=%d, sts=%#x: Load Pending Fail\n",
 		__func__, cpu_number(), bucket, msg_status));
 	rv = -1;
 	goto out;
  recv:
 	rmixl_msgld(bucket);
 	RMIXL_MFC2(RMIXL_COP_2_MSG_STS, 0, msg_status);
-	DPRINTF(("%s: cpu%d, bucket=%d, sts=%#x\n",
+	DPRINTF(("%s: cpu%u, bucket=%d, sts=%#x\n",
 		__func__, cpu_number(), bucket, msg_status));
 	rv = msg_status & (RMIXL_MSG_STS0_LEF|RMIXL_MSG_STS0_LPF);
 	if (rv == 0) {
@@ -1148,7 +1148,7 @@
 	FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+3, 0, &cc[3][0]);
 	FMN_CP2_4SEL_READ(RMIXL_COP_2_CREDITS+3, 4, &cc[3][4]);
 
-	printf("%s: cpu%d\n", __func__, cpu_number());
+	printf("%s: cpu%u\n", __func__, cpu_number());
 	for (int i=0; i < 4; i++) {
 		for (int j=0; j < 8; j++)
 			printf(" %#x,", cc[i][j]);



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 21:54:14 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_ehci.c rmixl_ohci.c rmixl_usbi.c
rmixl_usbivar.h

Log Message:
Provide OHCI companions devices to EHCI.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_ehci.c \
src/sys/arch/mips/rmi/rmixl_ohci.c src/sys/arch/mips/rmi/rmixl_usbivar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/rmi/rmixl_usbi.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_ehci.c
diff -u src/sys/arch/mips/rmi/rmixl_ehci.c:1.2 src/sys/arch/mips/rmi/rmixl_ehci.c:1.3
--- src/sys/arch/mips/rmi/rmixl_ehci.c:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_ehci.c	Fri Apr 29 21:54:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_ehci.c,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_ehci.c,v 1.3 2011/04/29 21:54:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_ehci.c,v 1.2 2011/02/20 07:48:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_ehci.c,v 1.3 2011/04/29 21:54:14 matt Exp $");
 
 #include "locators.h"
 
@@ -76,8 +76,9 @@
 void
 rmixl_ehci_attach(device_t parent, device_t self, void *aux)
 {
-	ehci_softc_t *sc = device_private(self);
-	struct rmixl_usbi_attach_args *usbi = aux;
+	ehci_softc_t * const sc = device_private(self);
+	rmixl_usbi_softc_t * const psc = device_private(parent);
+	struct rmixl_usbi_attach_args * const usbi = aux;
 	void *ih = NULL;
 	uint32_t r;
 	usbd_status status;
@@ -97,6 +98,18 @@
 	sc->sc_bus.dmatag = usbi->usbi_dmat;
 	sc->sc_bus.usbrev = USBREV_1_0;
 
+	/*
+	 * Grab the companion OHCI devices from our parent.
+	 */
+	if (psc->sc_ohci_devs[1] != NULL) {
+		sc->sc_comps[0] = psc->sc_ohci_devs[0];
+		sc->sc_comps[1] = psc->sc_ohci_devs[1];
+		sc->sc_ncomp = 2;
+	} else {
+		sc->sc_comps[0] = psc->sc_ohci_devs[0];
+		sc->sc_ncomp = 1;
+	}
+
 	if (bus_space_map(sc->iot, usbi->usbi_addr, sc->sc_size, 0, &sc->ioh)) {
 		aprint_error_dev(self, "unable to map registers\n");
 		return;
Index: src/sys/arch/mips/rmi/rmixl_ohci.c
diff -u src/sys/arch/mips/rmi/rmixl_ohci.c:1.2 src/sys/arch/mips/rmi/rmixl_ohci.c:1.3
--- src/sys/arch/mips/rmi/rmixl_ohci.c:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_ohci.c	Fri Apr 29 21:54:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_ohci.c,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_ohci.c,v 1.3 2011/04/29 21:54:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_ohci.c,v 1.2 2011/02/20 07:48:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_ohci.c,v 1.3 2011/04/29 21:54:14 matt Exp $");
 
 #include 
 #include 
@@ -77,8 +77,9 @@
 void
 rmixl_ohci_attach(device_t parent, device_t self, void *aux)
 {
-	ohci_softc_t *sc = device_private(self);
-	struct rmixl_usbi_attach_args *usbi = aux;
+	ohci_softc_t * const sc = device_private(self);
+	rmixl_usbi_softc_t * const psc = device_private(parent);
+	struct rmixl_usbi_attach_args * const usbi = aux;
 	void *ih = NULL;
 	uint32_t r;
 	usbd_status status;
@@ -126,7 +127,14 @@
 		return;
 	}
 
+	if (psc->sc_ohci_devs[0] == NULL) {
+		psc->sc_ohci_devs[0] = self;
+	} else if (psc->sc_ohci_devs[1] == NULL) {
+		psc->sc_ohci_devs[1] = self;
+	} else {
+		panic("%s: too many ohci devices", __func__);
+	}
+
 	/* Attach USB device */
 	sc->sc_child = config_found(self, &sc->sc_bus, usbctlprint);
 }
-
Index: src/sys/arch/mips/rmi/rmixl_usbivar.h
diff -u src/sys/arch/mips/rmi/rmixl_usbivar.h:1.2 src/sys/arch/mips/rmi/rmixl_usbivar.h:1.3
--- src/sys/arch/mips/rmi/rmixl_usbivar.h:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_usbivar.h	Fri Apr 29 21:54:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_usbivar.h,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_usbivar.h,v 1.3 2011/04/29 21:54:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -44,7 +44,27 @@
 	bus_dma_tag_t	usbi_dmat;
 };
 
-extern void *rmixl_usbi_intr_establish(void *, u_int, int (*)(void *), void *);
-extern void  rmixl_usbi_intr_disestablish(void *, void *);
+typedef struct rmixl_usbi_dispatch {
+	int (*func)(void *);
+	void *arg; 
+	struct evcnt count;
+} rmixl_usbi_dispatch_t;
+
+typedef struct rmixl_usbi_softc {
+	device_t		sc_dev;
+	bus_space_tag_t		sc_eb_bst;
+	bus_space_tag_t		sc_el_bst;
+	bus_addr_t		sc_addr;
+	bus_size_t		sc_size;
+	bus_dma_tag_t		sc_dmat;
+	device_t		sc_ohci_devs[2];
+	rmixl_usbi_dispatch_t	sc_dispatch[RMIXL_UB_INTERRUPT_MAX + 1];
+} rmixl_usbi_softc_t;
+
+
+#ifdef _KERNEL
+void *rmixl_usbi_intr_establish(void *, u_int, int (*)(void *), void *);
+void  rmixl_usbi_intr_disestablish(void *, void *);
+#endif
 
 #en

CVS commit: src/sys/arch/powerpc/include/booke

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 21:43:51 UTC 2011

Modified Files:
src/sys/arch/powerpc/include/booke: spr.h

Log Message:
Add some P10xx SVRs


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/include/booke/spr.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/powerpc/include/booke/spr.h
diff -u src/sys/arch/powerpc/include/booke/spr.h:1.5 src/sys/arch/powerpc/include/booke/spr.h:1.6
--- src/sys/arch/powerpc/include/booke/spr.h:1.5	Wed Feb 16 18:39:26 2011
+++ src/sys/arch/powerpc/include/booke/spr.h	Fri Apr 29 21:43:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: spr.h,v 1.5 2011/02/16 18:39:26 matt Exp $	*/
+/*	$NetBSD: spr.h,v 1.6 2011/04/29 21:43:51 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -65,6 +65,12 @@
 
 #define	SVR_P2020v2		  0x80e20020
 #define	SVR_P2010v2		  0x80e30020
+#define	SVR_P1011v2		  0x80e50020
+#define	SVR_P1012v2		  0x80e50120
+#define	SVR_P1013v2		  0x80e70020
+#define	SVR_P1020v2		  0x80e40020
+#define	SVR_P1021v2		  0x80e40120
+#define	SVR_P1022v2		  0x80e60020
 
 #define	SVR_SECURITY_P(svr)	  (((svr) & 0x0008) != 0)
 



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 21:42:41 UTC 2011

Modified Files:
src/sys/arch/powerpc/include: profile.h

Log Message:
Use the wrtee inlines for booke.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/include/profile.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/powerpc/include/profile.h
diff -u src/sys/arch/powerpc/include/profile.h:1.7 src/sys/arch/powerpc/include/profile.h:1.8
--- src/sys/arch/powerpc/include/profile.h:1.7	Fri Jul  7 21:28:03 2006
+++ src/sys/arch/powerpc/include/profile.h	Fri Apr 29 21:42:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.h,v 1.7 2006/07/07 21:28:03 ross Exp $	*/
+/*	$NetBSD: profile.h,v 1.8 2011/04/29 21:42:40 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -26,6 +26,10 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef _KERNEL_OPT
+#include "opt_ppcarch.h"
+#endif
+
 #define	_MCOUNT_DECL	void __mcount
 
 #ifdef _LP64
@@ -122,6 +126,12 @@
 #endif
 
 #ifdef _KERNEL
+#ifdef PPC_BOOKE
+#include 
+
+#define MCOUNT_ENTER	do s = wrtee(0); while (/*CONSTCOND*/ 0)
+#define MCOUNT_EXIT	wrtee(s)
+#else
 #define MCOUNT_ENTER		\
 	__asm volatile("mfmsr %0" : "=r"(s));			\
 	if ((s & (PSL_IR | PSL_DR)) != (PSL_IR | PSL_DR))	\
@@ -132,3 +142,5 @@
 #define MCOUNT_EXIT		\
 	__asm volatile("mtmsr %0" :: "r"(s))
 #endif
+
+#endif



CVS commit: src/doc

2011-04-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Apr 29 20:33:43 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
Mention PowerPC BookE support and addition of PCU.


To generate a diff of this commit:
cvs rdiff -u -r1.1542 -r1.1543 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.1542 src/doc/CHANGES:1.1543
--- src/doc/CHANGES:1.1542	Fri Apr 29 01:53:36 2011
+++ src/doc/CHANGES	Fri Apr 29 20:33:42 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1542 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1543 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -887,6 +887,10 @@
 	rump(3): Rework rump syscall compat.  The interface provided
 		by a newer NetBSD version is now always compatible
 		with a client compiled on an older version.  [pooka 20110117]
+	powerpc: Added support for Book E Freescale MPC85xx (e500 core)
+		processors.  Added "fast" software interrupts support and
+		SOFTFLOAT for PowerPC (Book E only), reworked FPU/VEC support
+		for e500 SPE, other improvements. [matt 20110118]
 	atactl(8): Fix mislabelled S.M.A.R.T. lifetime temperature record
 		reading. [nisimura 20110119]
 	rump.dhcpclient(1): Add a very simple DHCP client for rump kernels.
@@ -925,6 +929,8 @@
 	hp700: Add support for HIL devices. From OpenBSD. [tsutsui 20110215]
 	bind: Update to 9.8.0rc1: Response policy zones (RPZ) and DNS64 support.
 		[christos 20110215]
+	kernel: Add PCU (Per-CPU Unit) interface to unify synchronization of
+		per CPU context, like lazy FPU management. [rmind 20110217]
 	acpi(4): Updated ACPICA to 20110211. [jruoho 20110217]
 	rumphijack(3): Support hijacking of pathname-based system calls.
 		[pooka 20110217]
@@ -937,6 +943,7 @@
 		more efficient, added "fast" software interrupts and kernel
 		preemption.  Added support for RMI (NetLogic) XLS/XLR models.
 		Major clean up for MIPS port. [matt 20110220]
+	mips: Converted MIPS to use PCU. [matt 20110220]
 	ath(4): Add support for AR9285 devices. [cegger 20110221]
 	libsaslc(3): Complete integration of libsaslc written for GSoC 2010
 		by Mateusz Kocielski, improved and integrated with Postfix



CVS commit: src/external/ibm-public/postfix

2011-04-29 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Fri Apr 29 15:21:44 UTC 2011

Modified Files:
src/external/ibm-public/postfix: Makefile.inc

Log Message:
Remove (off by default) option to build Postfix with Cyrus SASL support.
As "libsasl" integration can now be considered stable it is no longer
necessary to suppor this hack.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/ibm-public/postfix/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/external/ibm-public/postfix/Makefile.inc
diff -u src/external/ibm-public/postfix/Makefile.inc:1.10 src/external/ibm-public/postfix/Makefile.inc:1.11
--- src/external/ibm-public/postfix/Makefile.inc:1.10	Tue Feb 15 23:17:02 2011
+++ src/external/ibm-public/postfix/Makefile.inc	Fri Apr 29 15:21:44 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.10 2011/02/15 23:17:02 tron Exp $
+#	$NetBSD: Makefile.inc,v 1.11 2011/04/29 15:21:44 tron Exp $
 
 .include 
 
@@ -29,14 +29,6 @@
 . endif
 .endif
 
-# XXX: Use only if you have cyrus-sasl installed; never part of a normal build!
-.if defined(HAVE_CYRUS_SASL)
-PKGROOT?= /usr/pkg
-CPPFLAGS+= -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-	-I${PKGROOT}/include/sasl
-LDADD+= -L${PKGROOT}/lib -Wl,-R${PKGROOT}/lib -lsasl2 
-.endif
-
 .if defined(HAVE_PCC)
 # code uses gcc-specific aggregate dynamic array
 CPPFLAGS+=	-DCANT_USE_SEND_RECV_MSG



CVS commit: src/tests/util/sh

2011-04-29 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Fri Apr 29 12:49:36 UTC 2011

Modified Files:
src/tests/util/sh: t_exit.sh

Log Message:
Add test cases for PR bin/6764: 'trap ... 0' is supposed to execute the
command when the shell exits but it does not work in ksh when the shells
exits "implicitly" (without an explicit exit/return statement).

These new tests cover both sh and ksh.  The ksh part of this does not
strictly belong to this directory, but I think it'd be nice to extend
all the tests in here to cover both interpreters whenever that makes
sense, much like we do with the file system tests.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/util/sh/t_exit.sh

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

Modified files:

Index: src/tests/util/sh/t_exit.sh
diff -u src/tests/util/sh/t_exit.sh:1.1 src/tests/util/sh/t_exit.sh:1.2
--- src/tests/util/sh/t_exit.sh:1.1	Tue Oct 20 21:58:35 2009
+++ src/tests/util/sh/t_exit.sh	Fri Apr 29 12:49:36 2011
@@ -1,4 +1,4 @@
-# $NetBSD: t_exit.sh,v 1.1 2009/10/20 21:58:35 jmmv Exp $
+# $NetBSD: t_exit.sh,v 1.2 2011/04/29 12:49:36 jmmv Exp $
 #
 # Copyright (c) 2007 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -62,8 +62,33 @@
 	'( trap "echo exiting" EXIT; /usr/bin/true )'
 }
 
+atf_test_case trap_zero__implicit_exit
+trap_zero__implicit_exit_body() {
+	echo '( trap "echo exiting" 0 )' >helper.sh
+	atf_check -s eq:0 -o match:exiting -e empty /bin/sh helper.sh
+	atf_expect_fail "PR bin/6764: sh works but ksh does not"
+	atf_check -s eq:0 -o match:exiting -e empty /bin/ksh helper.sh
+}
+
+atf_test_case trap_zero__explicit_exit
+trap_zero__explicit_exit_body() {
+	echo '( trap "echo exiting" 0; exit )' >helper.sh
+	atf_check -s eq:0 -o match:exiting -e empty /bin/sh helper.sh
+	atf_check -s eq:0 -o match:exiting -e empty /bin/ksh helper.sh
+}
+
+atf_test_case trap_zero__explicit_return
+trap_zero__explicit_return_body() {
+	echo '( trap "echo exiting" 0; return )' >helper.sh
+	atf_check -s eq:0 -o match:exiting -e empty /bin/sh helper.sh
+	atf_check -s eq:0 -o match:exiting -e empty /bin/ksh helper.sh
+}
+
 atf_init_test_cases() {
 	atf_add_test_case function
 	atf_add_test_case readout
 	atf_add_test_case trap_subshell
+	atf_add_test_case trap_zero__implicit_exit
+	atf_add_test_case trap_zero__explicit_exit
+	atf_add_test_case trap_zero__explicit_return
 }



CVS commit: src/share/man/man4

2011-04-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Apr 29 10:40:46 UTC 2011

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

Log Message:
New sentence, new line. Use more markup.


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

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

Modified files:

Index: src/share/man/man4/spdmem.4
diff -u src/share/man/man4/spdmem.4:1.3 src/share/man/man4/spdmem.4:1.4
--- src/share/man/man4/spdmem.4:1.3	Fri Dec  4 13:53:38 2009
+++ src/share/man/man4/spdmem.4	Fri Apr 29 10:40:46 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: spdmem.4,v 1.3 2009/12/04 13:53:38 njoly Exp $
+.\"	$NetBSD: spdmem.4,v 1.4 2011/04/29 10:40:46 wiz Exp $
 .\"
 .\"Copyright (c) 2007 Nicolas Joly
 .\"Copyright (c) 2007 Paul Goyette
@@ -43,13 +43,18 @@
 .Nm
 driver provides support for generic memory module Serial Presence Detect.
 During kernel boot it displays module type, and where possible, the size and
-rated speed of the memory module. Additional information such as bank
-configuration and width is printed if the kernel is booted in verbose mode.
+rated speed of the memory module.
+Additional information such as bank configuration and width is
+printed if the kernel is booted in verbose mode.
 .Pp
 The Serial Presence Detect data for each memory module is also made accessible
-to user mode via sysctl(8).  An entry for each 
+to user mode via
+.Xr sysctl 8 .
+An entry for each
 .Nm
-device is created under the 'hw' top-level MIB.
+device is created under the
+.Dv hw
+top-level MIB.
 .Sh SEE ALSO
 .Xr iic 4 ,
 .Xr intro 4
@@ -63,6 +68,6 @@
 The
 .Nm
 driver was written by
-.An Nicolas Joly 
-with additional work by 
-.An Paul Goyette  .
+.An Nicolas Joly Aq nj...@pasteur.fr
+with additional work by
+.An Paul Goyette Aq p...@whooppee.com .



CVS commit: src/sbin/fsck_ffs

2011-04-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Apr 29 10:34:52 UTC 2011

Modified Files:
src/sbin/fsck_ffs: fsck_ffs.8

Log Message:
Re-add -q description that got lost when -x was added.
Sort descriptions.
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sbin/fsck_ffs/fsck_ffs.8

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

Modified files:

Index: src/sbin/fsck_ffs/fsck_ffs.8
diff -u src/sbin/fsck_ffs/fsck_ffs.8:1.46 src/sbin/fsck_ffs/fsck_ffs.8:1.47
--- src/sbin/fsck_ffs/fsck_ffs.8:1.46	Thu May  7 08:27:14 2009
+++ src/sbin/fsck_ffs/fsck_ffs.8	Fri Apr 29 10:34:52 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fsck_ffs.8,v 1.46 2009/05/07 08:27:14 wiz Exp $
+.\"	$NetBSD: fsck_ffs.8,v 1.47 2011/04/29 10:34:52 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)fsck.8	8.3 (Berkeley) 11/29/94
 .\"
-.Dd May 7, 2009
+.Dd April 29, 2011
 .Dt FSCK_FFS 8
 .Os
 .Sh NAME
@@ -255,6 +255,14 @@
 Specify
 .Dq preen
 mode, described above.
+.It Fl q
+Quiet mode, do not output any messages for clean filesystems.
+.It Fl U
+Resolve user ids to usernames.
+.It Fl X
+Similar to
+.Fl x
+but uses a file system internal snapshot on the file system to be checked.
 .It Fl x Ar snap-backup
 Use a snapshot with
 .Ar snap-backup
@@ -267,12 +275,6 @@
 The point is to check an internally-consistent version of the
 filesystem to find out if it is damaged; on failure one should unmount
 the filesystem and repair it.
-.It Fl U
-Resolve user ids to usernames.
-.It Fl X
-Similar to
-.Fl x
-but uses a file system internal snapshot on the file system to be checked.
 .It Fl y
 Assume a yes response to all questions asked by
 .Nm ;



CVS commit: src/usr.sbin/btpand

2011-04-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Apr 29 10:31:02 UTC 2011

Modified Files:
src/usr.sbin/btpand: btpand.8

Log Message:
Sort sections, SEE ALSO, and fix xref.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/btpand/btpand.8

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/btpand/btpand.8
diff -u src/usr.sbin/btpand/btpand.8:1.4 src/usr.sbin/btpand/btpand.8:1.5
--- src/usr.sbin/btpand/btpand.8:1.4	Sat Oct 24 12:22:24 2009
+++ src/usr.sbin/btpand/btpand.8	Fri Apr 29 10:31:02 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: btpand.8,v 1.4 2009/10/24 12:22:24 reed Exp $
+.\" $NetBSD: btpand.8,v 1.5 2011/04/29 10:31:02 wiz Exp $
 .\"
 .\" Copyright (c) 2008 Iain Hibbert
 .\" All rights reserved.
@@ -80,7 +80,7 @@
 .Nm
 are in the SDP service record.
 The bridging of packets by the NAP must be configured separately with
-.Xr brconfig 4 .
+.Xr brconfig 8 .
 .Pp
 The options are as follows:
 .Bl -tag -width ".Fl a Ar address"
@@ -178,8 +178,6 @@
 has set up the client or server connection and opened the
 .Xr tap 4
 interface, it will create a pid file and detach.
-.Sh EXIT STATUS
-.Ex -std
 .Sh FILES
 .Bl -tag -compact
 .It Pa /dev/tap
@@ -187,6 +185,8 @@
 .It Pa /var/run/sdp
 .It Pa /var/run/tap Ns Em N Ns No .pid
 .El
+.Sh EXIT STATUS
+.Ex -std
 .Sh EXAMPLES
 .Dl ifconfig tap1 create
 .Dl btpand -a host -d ubt0 -s NAP -m encrypt -i tap1
@@ -205,10 +205,10 @@
 .Sh SEE ALSO
 .Xr bluetooth 3 ,
 .Xr bluetooth 4 ,
-.Xr tap 4 ,
 .Xr bridge 4 ,
-.Xr btconfig 8 ,
+.Xr tap 4 ,
 .Xr brconfig 8 ,
+.Xr btconfig 8 ,
 .Xr dhclient 8 ,
 .Xr dhcpd 8 ,
 .Xr ifconfig 8 ,



CVS commit: src/share/i18n/csmapper/CBM

2011-04-29 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Fri Apr 29 09:57:49 UTC 2011

Modified Files:
src/share/i18n/csmapper/CBM: charset.pivot.CBM.src mapper.dir.CBM.src

Log Message:
missing files


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/i18n/csmapper/CBM/charset.pivot.CBM.src \
src/share/i18n/csmapper/CBM/mapper.dir.CBM.src

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

Modified files:

Index: src/share/i18n/csmapper/CBM/charset.pivot.CBM.src
diff -u src/share/i18n/csmapper/CBM/charset.pivot.CBM.src:1.1 src/share/i18n/csmapper/CBM/charset.pivot.CBM.src:1.2
--- src/share/i18n/csmapper/CBM/charset.pivot.CBM.src:1.1	Wed Apr 27 20:05:56 2011
+++ src/share/i18n/csmapper/CBM/charset.pivot.CBM.src	Fri Apr 29 09:57:49 2011
@@ -1,2 +1,4 @@
-# $NetBSD: charset.pivot.CBM.src,v 1.1 2011/04/27 20:05:56 mbalmer Exp $
+# $NetBSD: charset.pivot.CBM.src,v 1.2 2011/04/29 09:57:49 mbalmer Exp $
 
+CMBINT			UCS			1
+UCS			CBMINT			1
Index: src/share/i18n/csmapper/CBM/mapper.dir.CBM.src
diff -u src/share/i18n/csmapper/CBM/mapper.dir.CBM.src:1.1 src/share/i18n/csmapper/CBM/mapper.dir.CBM.src:1.2
--- src/share/i18n/csmapper/CBM/mapper.dir.CBM.src:1.1	Wed Apr 27 20:05:56 2011
+++ src/share/i18n/csmapper/CBM/mapper.dir.CBM.src	Fri Apr 29 09:57:49 2011
@@ -1,2 +1,4 @@
-# $NetBSD: mapper.dir.CBM.src,v 1.1 2011/04/27 20:05:56 mbalmer Exp $
+# $NetBSD: mapper.dir.CBM.src,v 1.2 2011/04/29 09:57:49 mbalmer Exp $
 
+CBMINT/UCS		mapper_std	CBM/CBMINT%UCS.mps
+UCS/CBMINT		mapper_std	CBM/UCS%CBMINT.mps



CVS commit: src/sys/ufs/ffs

2011-04-29 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Apr 29 09:45:15 UTC 2011

Modified Files:
src/sys/ufs/ffs: ffs_snapshot.c

Log Message:
Before expunging all snapshots take the snapshot lock and resume the file
system as this is sufficient for the remaining operations.

Reduces the time the file system is suspended and should make this time
independent of the number of snapshots already present.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/ufs/ffs/ffs_snapshot.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/ffs/ffs_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.113 src/sys/ufs/ffs/ffs_snapshot.c:1.114
--- src/sys/ufs/ffs/ffs_snapshot.c:1.113	Sat Apr 23 08:23:52 2011
+++ src/sys/ufs/ffs/ffs_snapshot.c	Fri Apr 29 09:45:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_snapshot.c,v 1.113 2011/04/23 08:23:52 hannken Exp $	*/
+/*	$NetBSD: ffs_snapshot.c,v 1.114 2011/04/29 09:45:15 hannken Exp $	*/
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.113 2011/04/23 08:23:52 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.114 2011/04/29 09:45:15 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -177,7 +177,7 @@
 	return EOPNOTSUPP;
 }
 #else /* defined(FFS_NO_SNAPSHOT) */
-	bool suspended = false;
+	bool suspended = false, snapshot_locked = false;
 	int error, redo = 0, snaploc;
 	void *sbbuf = NULL;
 	daddr_t *snaplist = NULL, snaplistsize = 0;
@@ -310,6 +310,24 @@
 	DIP_ASSIGN(ip, mtimensec, ts.tv_nsec);
 	ip->i_flag |= IN_CHANGE | IN_UPDATE;
 	/*
+	 * Lock the snapshot and resume file system.
+	 */
+	mutex_enter(&si->si_snaplock);
+	mutex_enter(&si->si_lock);
+	si->si_owner = curlwp;
+	mutex_exit(&si->si_lock);
+	snapshot_locked = true;
+	KASSERT(suspended);
+	vfs_resume(vp->v_mount);
+	suspended = false;
+#ifdef DEBUG
+	getmicrotime(&endtime);
+	timersub(&endtime, &starttime, &endtime);
+	printf("%s: suspended %lld.%03d sec, redo %d of %d\n",
+	mp->mnt_stat.f_mntonname, (long long)endtime.tv_sec,
+	endtime.tv_usec / 1000, redo, fs->fs_ncg);
+#endif
+	/*
 	 * Copy allocation information from all snapshots and then
 	 * expunge them from our view.
 	 */
@@ -381,15 +399,13 @@
 	si->si_gen++;
 	mutex_exit(&si->si_lock);
 
-	if (suspended) {
+	if (suspended)
 		vfs_resume(vp->v_mount);
-#ifdef DEBUG
-		getmicrotime(&endtime);
-		timersub(&endtime, &starttime, &endtime);
-		printf("%s: suspended %lld.%03d sec, redo %d of %d\n",
-		mp->mnt_stat.f_mntonname, (long long)endtime.tv_sec,
-		endtime.tv_usec / 1000, redo, fs->fs_ncg);
-#endif
+	if (snapshot_locked) {
+		mutex_enter(&si->si_lock);
+		si->si_owner = NULL;
+		mutex_exit(&si->si_lock);
+		mutex_exit(&si->si_snaplock);
 	}
 	if (error) {
 		if (!UFS_WAPBL_BEGIN(mp)) {



CVS commit: src/lib/libc/gen

2011-04-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Apr 29 09:43:28 UTC 2011

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

Log Message:
Mark up NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/gen/sysconf.3

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

Modified files:

Index: src/lib/libc/gen/sysconf.3
diff -u src/lib/libc/gen/sysconf.3:1.37 src/lib/libc/gen/sysconf.3:1.38
--- src/lib/libc/gen/sysconf.3:1.37	Mon Mar 22 19:30:54 2010
+++ src/lib/libc/gen/sysconf.3	Fri Apr 29 09:43:28 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysconf.3,v 1.37 2010/03/22 19:30:54 joerg Exp $
+.\"	$NetBSD: sysconf.3,v 1.38 2011/04/29 09:43:28 wiz Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -86,7 +86,8 @@
 Return 1 if the File Synchronization Option is available on this system,
 otherwise \-1.
 .It Li _SC_HOST_NAME_MAX
-The maximum size of a hostname, including NULL.
+The maximum size of a hostname, including
+.Dv NULL .
 .It Li _SC_IOV_MAX
 The maximum number of
 .Va iovec
@@ -128,7 +129,8 @@
 .It Li _SC_PAGESIZE
 The size of a system page in bytes.
 .It Li _SC_PASS_MAX
-The maximum length of the password, not counting NULL.
+The maximum length of the password, not counting
+.Dv NULL .
 .It Li _SC_READER_WRITER_LOCKS
 The version of
 .St -p1003.1



CVS commit: [matt-nb5-mips64] src/usr.bin/xlint/arch/mips64

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 09:35:37 UTC 2011

Modified Files:
src/usr.bin/xlint/arch/mips64 [matt-nb5-mips64]: targparam.h

Log Message:
Update LDOUBLE size


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.30.1 src/usr.bin/xlint/arch/mips64/targparam.h

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/xlint/arch/mips64/targparam.h
diff -u src/usr.bin/xlint/arch/mips64/targparam.h:1.1 src/usr.bin/xlint/arch/mips64/targparam.h:1.1.30.1
--- src/usr.bin/xlint/arch/mips64/targparam.h:1.1	Fri Aug 25 23:35:04 2006
+++ src/usr.bin/xlint/arch/mips64/targparam.h	Fri Apr 29 09:35:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: targparam.h,v 1.1 2006/08/25 23:35:04 matt Exp $	*/
+/*	$NetBSD: targparam.h,v 1.1.30.1 2011/04/29 09:35:37 matt Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -49,6 +49,6 @@
 
 #define	FLOAT_SIZE		(4 * CHAR_BIT)
 #define	DOUBLE_SIZE		(8 * CHAR_BIT)
-#define	LDOUBLE_SIZE		(8 * CHAR_BIT)
+#define	LDOUBLE_SIZE		(16 * CHAR_BIT)
 
 #define	ENUM_SIZE		(4 * CHAR_BIT)



CVS commit: [matt-nb5-mips64] src/sys/arch/evbmips/conf

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 09:27:13 UTC 2011

Modified Files:
src/sys/arch/evbmips/conf [matt-nb5-mips64]: XLSATX32

Log Message:
sync with current


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/evbmips/conf/XLSATX32

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/evbmips/conf/XLSATX32
diff -u src/sys/arch/evbmips/conf/XLSATX32:1.1.2.1 src/sys/arch/evbmips/conf/XLSATX32:1.1.2.2
--- src/sys/arch/evbmips/conf/XLSATX32:1.1.2.1	Mon Dec 14 07:24:33 2009
+++ src/sys/arch/evbmips/conf/XLSATX32	Fri Apr 29 09:27:12 2011
@@ -1,8 +1,10 @@
-# $NetBSD: XLSATX32,v 1.1.2.1 2009/12/14 07:24:33 cliff Exp $
+# $NetBSD: XLSATX32,v 1.1.2.2 2011/04/29 09:27:12 matt Exp $
 #
 
+#ident  	"XLSATX32-$Revision: 1.1.2.2 $"
+
 include "arch/evbmips/conf/XLSATX"
 
-#ident 		"XLSATX32-$Revision: 1.1.2.1 $"
+options 	MEMLIMIT=0x2000			# 512MB 
 
 makeoptions	LP64="no"



CVS commit: src/usr.bin/xlint/xlint

2011-04-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Apr 29 09:23:29 UTC 2011

Modified Files:
src/usr.bin/xlint/xlint: lint.1

Log Message:
Sort options and option descriptions. Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/xlint/xlint/lint.1

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/xlint/xlint/lint.1
diff -u src/usr.bin/xlint/xlint/lint.1:1.34 src/usr.bin/xlint/xlint/lint.1:1.35
--- src/usr.bin/xlint/xlint/lint.1:1.34	Tue Mar 10 13:44:02 2009
+++ src/usr.bin/xlint/xlint/lint.1	Fri Apr 29 09:23:29 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: lint.1,v 1.34 2009/03/10 13:44:02 joerg Exp $
+.\" $NetBSD: lint.1,v 1.35 2011/04/29 09:23:29 wiz Exp $
 .\"
 .\" Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
 .\" Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,73 +38,31 @@
 .Nd a C program verifier
 .Sh SYNOPSIS
 .Nm
-.Op Fl abceghpPrvwxzHFV
-.Bk -words
-.Op Fl s | Fl t
-.Ek
-.Bk -words
+.Op Fl abceFgHhPprVvwxz
 .Op Fl i | Fl nu
-.Ek
-.Bk -words
-.Op Fl MD
-.Ek
-.Bk -words
+.Op Fl S | Fl s | Fl t
+.Op Fl B Ar directory
 .Op Fl D Ar name Ns Op =def
-.Ek
-.Bk -words
-.Op Fl U Ar name
-.Ek
-.Bk -words
-.Op Fl I Ar directory
-.Ek
-.Bk -words
 .Op Fl d Ar directory
-.Ek
-.Bk -words
+.Op Fl I Ar directory
 .Op Fl L Ar directory
-.Ek
-.Bk -words
+.Op Fl MD
 .Op Fl l Ar library
-.Ek
-.Bk -words
 .Op Fl o Ar outputfile
-.Ek
-.Bk -words
-.Op Fl B Ar directory
-.Ek
-.Bk -words
+.Op Fl U Ar name
 .Op Fl X Ar id Ns Op ,id ...
-.Ek
 .Ar
 .Nm lint
-.Op Fl abceghprvwzHFV
-.Bk -words
-.Op Fl s | Fl t | Fl S
-.Ek
-.Bk -words
-.Op Fl MD
-.Ek
-.Bk -words
+.Op Fl abceFgHhprVvwz
+.Op Fl S | Fl s | Fl t
 .Fl C Ar library
-.Ek
-.Bk -words
+.Op Fl B Ar directory
 .Op Fl D Ar name Ns Op =def
-.Ek
-.Bk -words
-.Op Fl U Ar name
-.Ek
-.Bk -words
-.Op Fl I Ar directory
-.Ek
-.Bk -words
 .Op Fl d Ar directory
-.Ek
-.Bk -words
-.Op Fl B Ar directory
-.Ek
-.Bk -words
+.Op Fl I Ar directory
+.Op Fl MD
+.Op Fl U Ar name
 .Op Fl X Ar id Ns Op ,id ...
-.Ek
 .Ar
 .Sh DESCRIPTION
 .Nm
@@ -222,7 +180,7 @@
 flag must also be specified to provide an output file name.
 .Pp
 .Sy Options
-.Bl -tag -width Fl
+.Bl -tag -width XoXoutputfileXXX
 .It Fl a
 Report assignments of
 .Sy long
@@ -235,6 +193,10 @@
 .Em all
 assignments of integer values to other integer values which
 cause implicit narrowing conversion.
+.It Fl B Ns Ar path
+Path to use when looking for the lint1 and lint2 binaries.
+Defaults to
+.Pa /usr/libexec .
 .It Fl b
 Report
 .Sy break
@@ -244,8 +206,41 @@
 and many
 .Xr yacc 1
 outputs produce many such complaints.
+.It Fl C Ns Ar library
+Create a
+.Nm
+library with the name
+.Pa llib-l Ns Ar library Ns Pa .ln .
+This library is built from all
+.Pa \&.c
+and
+.Pa \&.ln
+input files.
+After all global definitions of functions and
+variables in these files are written to the newly created library,
+.Nm
+checks all input files, including libraries specified with the
+.Fl l
+option, for mutual compatibility.
 .It Fl c
 Complain about casts which have questionable portability.
+.It Fl D Ns Ar name Ns Op =def
+Define
+.Ar name
+for
+.Xr cpp 1 ,
+as if by a
+.Li #define
+directive.
+If no definition is given,
+.Ar name
+is defined as 1.
+.It Fl d Ns Ar directory
+Use
+.Ar directory
+instead of
+.Pa /usr/include
+as the default place to find include files.
 .It Fl e
 Complain about unusual operations on
 .Sy enum Ns -Types
@@ -253,6 +248,10 @@
 .Sy enum Ns -
 and
 .Sy integer Ns -Types .
+.It Fl F
+Print pathnames of files.
+.Nm
+normally prints the filename without the path.
 .It Fl g
 Don't print warnings for some extensions of
 .Xr gcc 1
@@ -276,9 +275,18 @@
 and
 .Sy inline
 are always available).
+.It Fl H
+If a complaint stems from an included file
+.Nm
+prints the name of the included file instead of the source file name
+followed by a question mark.
 .It Fl h
 Apply a number of heuristic tests to attempt to intuit
 bugs, improve style, and reduce waste.
+.It Fl I Ns Ar directory
+Add
+.Ar directory
+to the list of directories in which to search for include files.
 .It Fl i
 Produce a
 .Pa \&.ln
@@ -291,17 +299,57 @@
 .Nm Ns 's
 first pass only, and are not checked for compatibility
 between functions.
+.It Fl L Ns Ar directory
+Search for lint libraries in
+.Ar directory
+and
+.Ar directory Ns Pa /lint
+before searching the standard place.
+.It Fl l Ns Ar library
+Include the lint library
+.Pa llib-l Ns Ar library Ns Pa \&.ln .
+.It Fl MD
+Pass
+.Fl MD
+to
+.Xr cpp 1
+causing cpp to create files containing dependency information for
+each source file.
 .It Fl n
 Do not check compatibility against the standard library.
-.It Fl p
-Attempt to check portability of code to other dialects of C.
+.It Fl o Ns Ar outputfile
+Name the output file
+.Ar outputfile .
+The output file produced is the input that is given to
+.Nm Ns 's
+second pass.
+The
+.Fl o
+option simply saves thi

CVS commit: [matt-nb5-mips64] src/sys/arch/evbmips/conf

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 09:23:16 UTC 2011

Modified Files:
src/sys/arch/evbmips/conf [matt-nb5-mips64]: XLSATX

Log Message:
White space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/arch/evbmips/conf/XLSATX

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/evbmips/conf/XLSATX
diff -u src/sys/arch/evbmips/conf/XLSATX:1.1.2.13 src/sys/arch/evbmips/conf/XLSATX:1.1.2.14
--- src/sys/arch/evbmips/conf/XLSATX:1.1.2.13	Tue Feb  8 19:04:43 2011
+++ src/sys/arch/evbmips/conf/XLSATX	Fri Apr 29 09:23:16 2011
@@ -1,8 +1,8 @@
-#	$NetBSD: XLSATX,v 1.1.2.13 2011/02/08 19:04:43 cliff Exp $
+#	$NetBSD: XLSATX,v 1.1.2.14 2011/04/29 09:23:16 matt Exp $
 
 include 	"arch/evbmips/conf/std.rmixl"
 
-#ident 		"XLSATX-$Revision: 1.1.2.13 $"
+#ident 		"XLSATX-$Revision: 1.1.2.14 $"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
@@ -11,13 +11,13 @@
 #
 # MEMSIZE can be used to limit memory amount used
 #
-#options 		MEMSIZE=0x1000		# 256MB 
+#options 	MEMSIZE=0x1000		# 256MB
 
 #
 # MEMLIMIT can be used to limit memory address used
 #
 defparam opt_memsize.h MEMLIMIT
-#options 	MEMLIMIT=0x1000			# 256MB 
+#options 	MEMLIMIT=0x1000		# 256MB
 
 options 	NOFPU		# No FPU
 #options 	FPEMUL		# emulate FPU insn
@@ -39,7 +39,6 @@
 options 	USERCONF	# userconf(4) support
 #options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 options 	DDB		# kernel dynamic debugger
-options 	MIPS_DDB_WATCH	# enable T_WATCH (see IEU_DEFAUTURE[DBE])
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG="-g"	# compile full symbol table
 options 	SYMTAB_SPACE=50	# size for embedded symbol table
@@ -68,20 +67,20 @@
 file-system	MFS		# memory-based filesystem
 #file-system 	EXT2FS		# second extended file system (linux)
 file-system	NFS		# Sun NFS-compatible filesystem client
-#file-system	KERNFS		# kernel data-structure filesystem
+file-system	KERNFS		# kernel data-structure filesystem
 #file-system	NULLFS		# NULL layered filesystem
 #file-system 	OVERLAY		# overlay file system
 #file-system	FDESC		# user file descriptor filesystem
 #file-system	UMAPFS		# uid/gid remapping filesystem
 #file-system	LFS		# Log-based filesystem (still experimental)
-#file-system	PORTAL		# portal filesystem (still experimental)
-#file-system	PROCFS		# /proc
+#file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
+file-system	PROCFS		# /proc
 #file-system	CD9660		# ISO 9660 + Rock Ridge file system
 file-system	TMPFS		# Efficient memory file system
 #file-system	UNION		# union file system
 #file-system	MSDOSFS		# MS-DOS FAT filesystem(s).
 #file-system 	CODA		# Coda File System; also needs vcoda (below)
-#file-system	PTYFS		# /dev/pts/N support
+file-system	PTYFS		# /dev/pts/N support
 
 # File system options
 #options 	NFSSERVER	# Sun NFS-compatible filesystem server
@@ -140,16 +139,16 @@
 
 
 mainbus0 	at root
-cpunode*	at mainbus? node ?
-cpucore*	at cpunode? core ?
+cpunode* 	at mainbus? node ?
+cpucore* 	at cpunode? core ?
 cpu*		at cpucore? thread ?
 obio0		at cpunode?
 com0		at obio0	addr 0x14000 intr 9
 com1		at obio0	addr 0x15000 intr 10
 options 	COM_REGMAP
-rmixl_pcix0	at obio0
+rmixl_pcix0 	at obio0
 pci*		at rmixl_pcix0
-rmixl_pcie0	at obio0
+rmixl_pcie0 	at obio0
 pci*		at rmixl_pcie0
 ppb*		at pci?
 pci*		at ppb?
@@ -160,11 +159,11 @@
 msk*		at mskc?
 makphy*		at mii? phy ?			# Marvell 88E1000 PHYs
 ukphy*		at mii? phy ?			# unknown PHY
-rmixl_usbi0	at obio0	addr 0x25000 intr 31
+rmixl_usbi0 	at obio0	addr 0x25000 intr 31
 ohci0		at rmixl_usbi0	addr 0x24400 size 0x400 intr 0
 ohci1		at rmixl_usbi0	addr 0x24800 size 0x400 intr 1
 ehci0		at rmixl_usbi0	addr 0x24000 size 0x400 intr 2
-siisata*	at pci? dev ? function ?
+siisata* 	at pci? dev ? function ?
 atabus*		at ata?
 wd*		at atabus? drive ? flags 0x
 
@@ -175,7 +174,7 @@
 uhub*		at uhub? port ?
 umass*		at uhub? port ? configuration ? interface ?
 wd*		at umass?
-scsibus*	at umass? channel ?
+scsibus* 	at umass? channel ?
 sd*		at scsibus? target ? lun ?
 
 



CVS commit: [matt-nb5-mips64] src/sys/arch/sbmips/conf

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 09:21:46 UTC 2011

Modified Files:
src/sys/arch/sbmips/conf [matt-nb5-mips64]: GENERIC

Log Message:
increase SYMTAB_SPACE


To generate a diff of this commit:
cvs rdiff -u -r1.70.8.5 -r1.70.8.6 src/sys/arch/sbmips/conf/GENERIC

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/sbmips/conf/GENERIC
diff -u src/sys/arch/sbmips/conf/GENERIC:1.70.8.5 src/sys/arch/sbmips/conf/GENERIC:1.70.8.6
--- src/sys/arch/sbmips/conf/GENERIC:1.70.8.5	Fri May 14 23:16:08 2010
+++ src/sys/arch/sbmips/conf/GENERIC	Fri Apr 29 09:21:46 2011
@@ -1,10 +1,10 @@
-# $NetBSD: GENERIC,v 1.70.8.5 2010/05/14 23:16:08 cliff Exp $
+# $NetBSD: GENERIC,v 1.70.8.6 2011/04/29 09:21:46 matt Exp $
 
 include 	"arch/sbmips/conf/std.sbmips"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.70.8.5 $"
+#ident 		"GENERIC-$Revision: 1.70.8.6 $"
 
 #options 	LOCKDEBUG	# XXX XXX XXX XXX
 #options 	DEBUG		# extra kernel debugging support
@@ -35,7 +35,7 @@
 options 	DDB		# kernel dynamic debugger
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG="-g"	# compile full symbol table
-options 	SYMTAB_SPACE=38	# size for embedded symbol table
+options 	SYMTAB_SPACE=40	# size for embedded symbol table
 
 # Compatibility options
 options 	COMPAT_43	# compatibility with 4.3BSD binaries



CVS commit: src/external/bsd/pcc/libexec/mkext

2011-04-29 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Fri Apr 29 08:33:02 UTC 2011

Modified Files:
src/external/bsd/pcc/libexec/mkext: Makefile

Log Message:
build mkext with the same flags as ccom (lack of -DGCC_COMPAT in
particular, but add -Dos_ and -Dmach_ just in case)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/pcc/libexec/mkext/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/bsd/pcc/libexec/mkext/Makefile
diff -u src/external/bsd/pcc/libexec/mkext/Makefile:1.1 src/external/bsd/pcc/libexec/mkext/Makefile:1.2
--- src/external/bsd/pcc/libexec/mkext/Makefile:1.1	Thu Apr 14 09:31:25 2011
+++ src/external/bsd/pcc/libexec/mkext/Makefile	Fri Apr 29 08:33:02 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2011/04/14 09:31:25 plunky Exp $
+#	$NetBSD: Makefile,v 1.2 2011/04/29 08:33:02 plunky Exp $
 
 #
 # this is really part of ccom, but HOSTPROG and PROG don't mix
@@ -6,15 +6,17 @@
 
 .include 
 
-.PATH:	${PCC_DIST}/cc/ccom \
-	${PCC_DIST}/arch/${TARGMACH} \
-	${PCC_DIST}/mip
+.PATH:	${PCC_DIST}/mip \
+	${PCC_DIST}/arch/${TARGMACH}
 
 HOSTPROG=	mkext
 MAN=
 SRCS=		mkext.c table.c common.c
 
 HOST_CPPFLAGS+=	-DMKEXT
+HOST_CPPFLAGS+=	-DGCC_COMPAT
+HOST_CPPFLAGS+=	-Dos_${TARGOS}
+HOST_CPPFLAGS+=	-Dmach_${TARGMACH}
 HOST_CPPFLAGS+=	-I${PCC_DIST}/mip
 HOST_CPPFLAGS+=	-I${PCC_DIST}/arch/${TARGMACH}
 HOST_CPPFLAGS+=	-I${PCC_DIR}/include



CVS commit: src/doc

2011-04-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Apr 29 08:26:33 UTC 2011

Modified Files:
src/doc: 3RDPARTY

Log Message:
file-5.06 out.


To generate a diff of this commit:
cvs rdiff -u -r1.832 -r1.833 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.832 src/doc/3RDPARTY:1.833
--- src/doc/3RDPARTY:1.832	Mon Apr 18 08:36:14 2011
+++ src/doc/3RDPARTY	Fri Apr 29 08:26:33 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.832 2011/04/18 08:36:14 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.833 2011/04/29 08:26:33 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -309,7 +309,7 @@
 
 Package:	file
 Version:	5.03
-Current Vers:	5.03
+Current Vers:	5.06
 Maintainer:	Christos Zoulas 
 Archive Site:	ftp://ftp.astron.com/pub/file/
 Home Page:



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:21:25 UTC 2011

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: siisata_pci.c

Log Message:
Add 3114 entry


To generate a diff of this commit:
cvs rdiff -u -r1.1.14.1.4.1 -r1.1.14.1.4.2 src/sys/dev/pci/siisata_pci.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/siisata_pci.c
diff -u src/sys/dev/pci/siisata_pci.c:1.1.14.1.4.1 src/sys/dev/pci/siisata_pci.c:1.1.14.1.4.2
--- src/sys/dev/pci/siisata_pci.c:1.1.14.1.4.1	Wed Apr 21 00:27:49 2010
+++ src/sys/dev/pci/siisata_pci.c	Fri Apr 29 08:21:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_pci.c,v 1.1.14.1.4.1 2010/04/21 00:27:49 matt Exp $ */
+/* $NetBSD: siisata_pci.c,v 1.1.14.1.4.2 2011/04/29 08:21:25 matt Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -93,6 +93,12 @@
 static const struct siisata_pci_board siisata_pci_boards[] = {
 	{
 		.spb_vend = PCI_VENDOR_CMDTECH,
+		.spb_prod = PCI_PRODUCT_CMDTECH_3114,
+		.spb_port = 4,
+		.spb_chip = 3114,
+	},
+	{
+		.spb_vend = PCI_VENDOR_CMDTECH,
 		.spb_prod = PCI_PRODUCT_CMDTECH_3124,
 		.spb_port = 4,
 		.spb_chip = 3124,



CVS commit: [matt-nb5-mips64] src/sys/dev/ic

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:20:51 UTC 2011

Modified Files:
src/sys/dev/ic [matt-nb5-mips64]: siisata.c

Log Message:
Fix sense of KASSERTMSGs


To generate a diff of this commit:
cvs rdiff -u -r1.2.14.1 -r1.2.14.2 src/sys/dev/ic/siisata.c

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

Modified files:

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.2.14.1 src/sys/dev/ic/siisata.c:1.2.14.2
--- src/sys/dev/ic/siisata.c:1.2.14.1	Wed Apr 21 00:27:37 2010
+++ src/sys/dev/ic/siisata.c	Fri Apr 29 08:20:50 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.2.14.1 2010/04/21 00:27:37 matt Exp $ */
+/* $NetBSD: siisata.c,v 1.2.14.2 2011/04/29 08:20:50 matt Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -1193,7 +1193,7 @@
 
 	sc = (struct siisata_softc *)schp->ata_channel.ch_atac;
 
-	KASSERTMSG(((schp->sch_active_slots & __BIT(slot)) == __BIT(slot)),
+	KASSERTMSG(((schp->sch_active_slots & __BIT(slot)) == 0),
 	("%s: trying to activate active slot %d", SIISATANAME(sc), slot));
 
 	SIISATA_PRB_SYNC(sc, schp, slot, BUS_DMASYNC_PREWRITE);
@@ -1215,7 +1215,7 @@
 	
 	sc = (struct siisata_softc *)schp->ata_channel.ch_atac;
 
-	KASSERTMSG(((schp->sch_active_slots & __BIT(slot)) == 0),
+	KASSERTMSG(((schp->sch_active_slots & __BIT(slot)) != 0),
 	("%s: trying to deactivate inactive slot %d", SIISATANAME(sc),
 	slot));
 



CVS commit: [matt-nb5-mips64] src/sys

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:20:16 UTC 2011

Modified Files:
src/sys/kern [matt-nb5-mips64]: kern_exec.c kern_fork.c kern_lwp.c
sys_lwp.c
src/sys/sys [matt-nb5-mips64]: cpu.h lwp.h

Log Message:
Pull in lwp_setprivate/cpu_lwp_setprivate from -current.
Also pull in lwp_getpcb


To generate a diff of this commit:
cvs rdiff -u -r1.280.4.3.4.2 -r1.280.4.3.4.3 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.171 -r1.171.10.1 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.126.2.2.4.1 -r1.126.2.2.4.2 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.43 -r1.43.10.1 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.23.4.3 -r1.23.4.3.4.1 src/sys/sys/cpu.h
cvs rdiff -u -r1.114.4.1.4.2 -r1.114.4.1.4.3 src/sys/sys/lwp.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/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.280.4.3.4.2 src/sys/kern/kern_exec.c:1.280.4.3.4.3
--- src/sys/kern/kern_exec.c:1.280.4.3.4.2	Thu Aug 19 07:23:24 2010
+++ src/sys/kern/kern_exec.c	Fri Apr 29 08:20:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.280.4.3.4.2 2010/08/19 07:23:24 matt Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.280.4.3.4.3 2011/04/29 08:20:14 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.280.4.3.4.2 2010/08/19 07:23:24 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.280.4.3.4.3 2011/04/29 08:20:14 matt Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_syscall_debug.h"
@@ -1030,6 +1030,9 @@
 	if (pack.ep_esch->es_setregs)
 		(*pack.ep_esch->es_setregs)(l, &pack, (u_long) stack);
 
+	/* Provide a consistent LWP private setting */
+	(void)lwp_setprivate(l, NULL);
+
 	/* map the process's signal trampoline code */
 	if ((error = exec_sigcode_map(p, pack.ep_esch->es_emul)) != 0) {
 		DPRINTF(("execve: map sigcode failed %d\n", error));

Index: src/sys/kern/kern_fork.c
diff -u src/sys/kern/kern_fork.c:1.171 src/sys/kern/kern_fork.c:1.171.10.1
--- src/sys/kern/kern_fork.c:1.171	Sat Oct 11 13:40:57 2008
+++ src/sys/kern/kern_fork.c	Fri Apr 29 08:20:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_fork.c,v 1.171 2008/10/11 13:40:57 pooka Exp $	*/
+/*	$NetBSD: kern_fork.c,v 1.171.10.1 2011/04/29 08:20:15 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.171 2008/10/11 13:40:57 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.171.10.1 2011/04/29 08:20:15 matt Exp $");
 
 #include "opt_ktrace.h"
 
@@ -293,9 +293,11 @@
 	 * The p_stats and p_sigacts substructs are set in uvm_fork().
 	 * Inherit flags we want to keep.  The flags related to SIGCHLD
 	 * handling are important in order to keep a consistent behaviour
-	 * for the child after the fork.
+	 * for the child after the fork.  If we are a 32-bit process, the
+	 * child will be too. 
 	 */
-	p2->p_flag = p1->p_flag & (PK_SUGID | PK_NOCLDWAIT | PK_CLDSIGIGN);
+	p2->p_flag =
+	p1->p_flag & (PK_SUGID | PK_NOCLDWAIT | PK_CLDSIGIGN | PK_32);
 	p2->p_emul = p1->p_emul;
 	p2->p_execsw = p1->p_execsw;
 
@@ -433,6 +435,7 @@
 	lwp_create(l1, p2, uaddr, inmem, (flags & FORK_PPWAIT) ? LWP_VFORK : 0,
 	stack, stacksize, (func != NULL) ? func : child_return, arg, &l2,
 	l1->l_class);
+	lwp_setprivate(l2, l1->l_private);
 
 	/*
 	 * It's now safe for the scheduler and other processes to see the

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.126.2.2.4.1 src/sys/kern/kern_lwp.c:1.126.2.2.4.2
--- src/sys/kern/kern_lwp.c:1.126.2.2.4.1	Sat Feb  5 06:00:13 2011
+++ src/sys/kern/kern_lwp.c	Fri Apr 29 08:20:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.126.2.2.4.1 2011/02/05 06:00:13 cliff Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.126.2.2.4.2 2011/04/29 08:20:15 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -206,7 +206,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.126.2.2.4.1 2011/02/05 06:00:13 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.126.2.2.4.2 2011/04/29 08:20:15 matt Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_ddb.h"
@@ -1721,6 +1721,21 @@
 	p->p_lwpctl = NULL;
 }
 
+/*  
+ * Set an LWP's private data pointer.
+ */ 
+int 
+lwp_setprivate(lwp_t *l, void *ptr)
+{   
+	int error = 0;  
+
+	l->l_private = ptr;
+#ifdef __HAVE_CPU_LWP_SETPRIVATE
+	error = cpu_lwp_setprivate(l, ptr); 
+#endif  
+	return error;
+}
+
 #if defined(DDB)
 void
 lwp_whatis(uintptr_t addr, void (*pr)(const char *, ...))

Index: src/sys/kern/sys_lwp.c
diff -u src/sys/kern/sys_lwp.c:1.43 src/sys/kern/sys_lwp.c:1.43.10.1
--- src/sys/kern/sys_lwp.c:1.43	Thu Oct 16 08:47:07 2008
+++ src/sys/kern/sys_lwp.c	Fri Apr 29 08:20:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_lwp.c,v 1.43 2008/10

CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:16:43 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_page.h

Log Message:
Add macros from current (VM_PAGE_TO_MD, VM_PHYSMEM_PTR, VM_PHYSMEM_PTR_SWAP)


To generate a diff of this commit:
cvs rdiff -u -r1.55.14.1 -r1.55.14.2 src/sys/uvm/uvm_page.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/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.55.14.1 src/sys/uvm/uvm_page.h:1.55.14.2
--- src/sys/uvm/uvm_page.h:1.55.14.1	Sat Jan 23 19:54:04 2010
+++ src/sys/uvm/uvm_page.h	Fri Apr 29 08:16:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.55.14.1 2010/01/23 19:54:04 matt Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.55.14.2 2011/04/29 08:16:42 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -255,6 +255,9 @@
 /*
  * physical memory config is stored in vm_physmem.
  */
+#define	VM_PHYSMEM_PTR(i)	(&vm_physmem[i])
+#define	VM_PHYSMEM_PTR_SWAP(i, j) \
+	do { vm_physmem[(i)] = vm_physmem[(j)]; } while (0)
 
 extern struct vm_physseg vm_physmem[VM_PHYSSEG_MAX];
 extern int vm_nphysseg;
@@ -305,6 +308,10 @@
 
 #define VM_PAGE_TO_PHYS(entry)	((entry)->phys_addr)
 
+#ifdef __HAVE_VM_PAGE_MD
+#define VM_PAGE_TO_MD(pg)	(&(pg)->mdpage)
+#endif
+
 /*
  * Compute the page color bucket for a given page.
  */



CVS commit: [matt-nb5-mips64] src/sys/uvm

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:15:10 UTC 2011

Modified Files:
src/sys/uvm [matt-nb5-mips64]: uvm_unix.c

Log Message:
Fix PRIdVSIZE macro


To generate a diff of this commit:
cvs rdiff -u -r1.40.28.1 -r1.40.28.2 src/sys/uvm/uvm_unix.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_unix.c
diff -u src/sys/uvm/uvm_unix.c:1.40.28.1 src/sys/uvm/uvm_unix.c:1.40.28.2
--- src/sys/uvm/uvm_unix.c:1.40.28.1	Sun Aug 23 06:38:07 2009
+++ src/sys/uvm/uvm_unix.c	Fri Apr 29 08:15:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_unix.c,v 1.40.28.1 2009/08/23 06:38:07 matt Exp $	*/
+/*	$NetBSD: uvm_unix.c,v 1.40.28.2 2011/04/29 08:15:09 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_unix.c,v 1.40.28.1 2009/08/23 06:38:07 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_unix.c,v 1.40.28.2 2011/04/29 08:15:09 matt Exp $");
 
 #include "opt_pax.h"
 
@@ -118,7 +118,7 @@
 UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
 		if (error) {
 #ifndef PRIdVSIZE
-#define	PRIdVSIZE	"%ld"
+#define	PRIdVSIZE	"ld"
 #endif
 			uprintf("sbrk: grow %"PRIdVSIZE" failed, error = %d\n",
 new - old, error);



CVS commit: [matt-nb5-mips64] src/sys/sys

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:14:36 UTC 2011

Modified Files:
src/sys/sys [matt-nb5-mips64]: ucontext.h

Log Message:
Sync with -current


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.12.1 src/sys/sys/ucontext.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/sys/ucontext.h
diff -u src/sys/sys/ucontext.h:1.11 src/sys/sys/ucontext.h:1.11.12.1
--- src/sys/sys/ucontext.h:1.11	Wed Oct 15 06:51:21 2008
+++ src/sys/sys/ucontext.h	Fri Apr 29 08:14:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.11 2008/10/15 06:51:21 wrstuden Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.11.12.1 2011/04/29 08:14:36 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2003 The NetBSD Foundation, Inc.
@@ -57,10 +57,30 @@
 #define _UC_STACK	0x02		/* valid uc_stack */
 #define _UC_CPU		0x04		/* valid GPR context in uc_mcontext */
 #define _UC_FPU		0x08		/* valid FPU context in uc_mcontext */
+#define	_UC_MD		0x40070020	/* MD bits.  see below */
+
+/*
+ * _UC_MD includes:
+ *	_UC_SETSTACK	0x0001 (many ports) and 0x0002 (arm)
+ *	_UC_CLRSTACK	0x0002 (many ports) and 0x0004 (arm)
+ *	_UC_POWERPC_VEC	0x0001 (powerpc)
+ *	_UC_M68K_UC_USER 0x4000 (m68k)
+ *	_UC_UNIQUE	0x0020 (alpha)
+ *	_UC_ARM_VFP	0x0001 (arm)
+ *	_UC_VM		0x0004 (i386)
+ *	_UC_FXSAVE	0x0020 (i386)
+ *
+ * if your port needs more MD bits, please try to choose bits from _UC_MD
+ * first, rather than picking random unused bits.
+ */
 
 #ifdef _KERNEL
 struct lwp;
 
+#ifdef __UCONTEXT_SIZE
+__CTASSERT(sizeof(ucontext_t) == __UCONTEXT_SIZE)
+#endif
+
 void	getucontext(struct lwp *, ucontext_t *);
 void	getucontext_sa(struct lwp *, ucontext_t *);
 int	setucontext(struct lwp *, const ucontext_t *);



CVS commit: [matt-nb5-mips64] src/sys/sys

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:13:53 UTC 2011

Modified Files:
src/sys/sys [matt-nb5-mips64]: cpu_data.h

Log Message:
Change cpu_node_id to cpu_package_id to be like current.


To generate a diff of this commit:
cvs rdiff -u -r1.27.16.1 -r1.27.16.2 src/sys/sys/cpu_data.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/sys/cpu_data.h
diff -u src/sys/sys/cpu_data.h:1.27.16.1 src/sys/sys/cpu_data.h:1.27.16.2
--- src/sys/sys/cpu_data.h:1.27.16.1	Sun May  9 20:25:45 2010
+++ src/sys/sys/cpu_data.h	Fri Apr 29 08:13:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_data.h,v 1.27.16.1 2010/05/09 20:25:45 rmind Exp $	*/
+/*	$NetBSD: cpu_data.h,v 1.27.16.2 2011/04/29 08:13:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
 	lwp_t		*cpu_onproc;		/* bottom level LWP */
 	CIRCLEQ_ENTRY(cpu_info) cpu_qchain;	/* circleq of all CPUs */
 
-	cpuid_t		cpu_node_id;
+	cpuid_t		cpu_package_id;
 	cpuid_t		cpu_core_id;
 	cpuid_t		cpu_smt_id;
 



CVS commit: [matt-nb5-mips64] src/sys/miscfs/genfs

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:12:55 UTC 2011

Modified Files:
src/sys/miscfs/genfs [matt-nb5-mips64]: genfs_io.c

Log Message:
Fix placement of #ifdef DEBUG / #endif


To generate a diff of this commit:
cvs rdiff -u -r1.13.4.2 -r1.13.4.2.4.1 src/sys/miscfs/genfs/genfs_io.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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.13.4.2 src/sys/miscfs/genfs/genfs_io.c:1.13.4.2.4.1
--- src/sys/miscfs/genfs/genfs_io.c:1.13.4.2	Sat Apr  4 18:14:50 2009
+++ src/sys/miscfs/genfs/genfs_io.c	Fri Apr 29 08:12:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.13.4.2 2009/04/04 18:14:50 snj Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.13.4.2.4.1 2011/04/29 08:12:54 matt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.13.4.2 2009/04/04 18:14:50 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.13.4.2.4.1 2011/04/29 08:12:54 matt Exp $");
 
 #include 
 #include 
@@ -845,19 +845,19 @@
 	by_list = (uobj->uo_npages <=
 	((endoff - startoff) >> PAGE_SHIFT) * UVM_PAGE_HASH_PENALTY);
 
-#if !defined(DEBUG)
 	/*
 	 * if this vnode is known not to have dirty pages,
 	 * don't bother to clean it out.
 	 */
 
 	if ((vp->v_iflag & VI_ONWORKLST) == 0) {
+#if !defined(DEBUG)
 		if ((flags & (PGO_FREE|PGO_DEACTIVATE)) == 0) {
 			goto skip_scan;
 		}
+#endif /* !defined(DEBUG) */
 		flags &= ~PGO_CLEANIT;
 	}
-#endif /* !defined(DEBUG) */
 
 	/*
 	 * start the loop.  when scanning by list, hold the last page



CVS commit: [matt-nb5-mips64] src/sys/miscfs/procfs

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:12:08 UTC 2011

Modified Files:
src/sys/miscfs/procfs [matt-nb5-mips64]: procfs_linux.c

Log Message:
Use _KERNEL_OPT


To generate a diff of this commit:
cvs rdiff -u -r1.54.14.2 -r1.54.14.3 src/sys/miscfs/procfs/procfs_linux.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/miscfs/procfs/procfs_linux.c
diff -u src/sys/miscfs/procfs/procfs_linux.c:1.54.14.2 src/sys/miscfs/procfs/procfs_linux.c:1.54.14.3
--- src/sys/miscfs/procfs/procfs_linux.c:1.54.14.2	Sat Feb  5 06:00:15 2011
+++ src/sys/miscfs/procfs/procfs_linux.c	Fri Apr 29 08:12:08 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: procfs_linux.c,v 1.54.14.2 2011/02/05 06:00:15 cliff Exp $  */
+/*  $NetBSD: procfs_linux.c,v 1.54.14.3 2011/04/29 08:12:08 matt Exp $  */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,9 +36,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.54.14.2 2011/02/05 06:00:15 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.54.14.3 2011/04/29 08:12:08 matt Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
+#endif
 
 #include 
 #include 



CVS commit: [matt-nb5-mips64] src/sys/sys

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:11:22 UTC 2011

Modified Files:
src/sys/sys [matt-nb5-mips64]: Makefile

Log Message:
Add tls.h


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.114.8.1 src/sys/sys/Makefile

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

Modified files:

Index: src/sys/sys/Makefile
diff -u src/sys/sys/Makefile:1.114 src/sys/sys/Makefile:1.114.8.1
--- src/sys/sys/Makefile:1.114	Sun Oct 19 22:05:23 2008
+++ src/sys/sys/Makefile	Fri Apr 29 08:11:22 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.114 2008/10/19 22:05:23 apb Exp $
+#	$NetBSD: Makefile,v 1.114.8.1 2011/04/29 08:11:22 matt Exp $
 
 .include 
 
@@ -33,7 +33,7 @@
 	syscall.h syscallargs.h sysctl.h stdint.h swap.h \
 	syncobj.h syslimits.h syslog.h \
 	tape.h termios.h time.h timeb.h timepps.h times.h \
-	timex.h trace.h tree.h tty.h ttychars.h ttycom.h \
+	timex.h tls.h trace.h tree.h tty.h ttychars.h ttycom.h \
 	ttydefaults.h ttydev.h types.h \
 	ucontext.h ucred.h uio.h un.h unistd.h unpcb.h user.h utsname.h uuid.h \
 	vadvise.h verified_exec.h videoio.h vmmeter.h vnode.h vnode_if.h \



CVS commit: [matt-nb5-mips64] src/sys

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:10:38 UTC 2011

Modified Files:
src/sys/lib/libkern [matt-nb5-mips64]: libkern.h
src/sys/sys [matt-nb5-mips64]: cdefs.h

Log Message:
Move CTASSERT to __CTASSERT in  (from current)
Add KDASSERTMSG (from current)


To generate a diff of this commit:
cvs rdiff -u -r1.82.8.2 -r1.82.8.3 src/sys/lib/libkern/libkern.h
cvs rdiff -u -r1.69 -r1.69.10.1 src/sys/sys/cdefs.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/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.82.8.2 src/sys/lib/libkern/libkern.h:1.82.8.3
--- src/sys/lib/libkern/libkern.h:1.82.8.2	Thu Feb  3 02:24:21 2011
+++ src/sys/lib/libkern/libkern.h	Fri Apr 29 08:10:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.82.8.2 2011/02/03 02:24:21 cliff Exp $	*/
+/*	$NetBSD: libkern.h,v 1.82.8.3 2011/04/29 08:10:38 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -192,9 +192,7 @@
 #endif
 #endif
 
-#define	CTASSERT(x)		_CTASSERT(x, __LINE__)
-#define	_CTASSERT(x, y)		__CTASSERT(x, y)
-#define	__CTASSERT(x, y)	typedef char __ctassert ## y[(x) ? 1 : -1];
+#define	CTASSERT(x)		__CTASSERT(x)
 
 #ifndef DIAGNOSTIC
 #define _DIAGASSERT(a)	(void)0
@@ -222,11 +220,17 @@
 
 #ifndef DEBUG
 #ifdef lint
-#define	KDASSERT(e)	/* NOTHING */
+#define	KDASSERTMSG(e, msg)	/* NOTHING */
+#define	KDASSERT(e)		/* NOTHING */
 #else /* lint */
-#define	KDASSERT(e)	((void)0)
+#define	KDASSERTMSG(e, msg)	((void)0)
+#define	KDASSERT(e)		((void)0)
 #endif /* lint */
 #else
+#define	KDASSERTMSG(e, msg) do {	\
+	if (__predict_false(!(e)))	\
+		panic msg;		\
+	} while (/*CONSTCOND*/ 0)
 #ifdef __STDC__
 #define	KDASSERT(e)	(__predict_true((e)) ? (void)0 :		\
 			__kernassert("debugging ", __FILE__, __LINE__, #e))

Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.69 src/sys/sys/cdefs.h:1.69.10.1
--- src/sys/sys/cdefs.h:1.69	Sun Aug 17 00:23:02 2008
+++ src/sys/sys/cdefs.h	Fri Apr 29 08:10:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.69 2008/08/17 00:23:02 gmcgarry Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.69.10.1 2011/04/29 08:10:38 matt Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -136,6 +136,17 @@
 #endif
 
 /*
+ * Compile Time Assertion.
+ */
+#ifdef __COUNTER__
+#define	__CTASSERT(x)		__CTASSERT0(x, __ctassert, __COUNTER__)
+#else
+#define	__CTASSERT(x)		__CTASSERT0(x, __ctassert, __LINE__)
+#endif
+#define	__CTASSERT0(x, y, z)	__CTASSERT1(x, y, z)
+#define	__CTASSERT1(x, y, z)	typedef char y ## z[(x) ? 1 : -1];
+
+/*
  * The following macro is used to remove const cast-away warnings
  * from gcc -Wcast-qual; it should be used with caution because it
  * can hide valid errors; in particular most valid uses are in



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

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:05:22 UTC 2011

Modified Files:
src/lib/libc/arch/mips/gen: _lwp.c

Log Message:
Use correct CALLFRAME_SIZ depending on ABI.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/mips/gen/_lwp.c

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

Modified files:

Index: src/lib/libc/arch/mips/gen/_lwp.c
diff -u src/lib/libc/arch/mips/gen/_lwp.c:1.7 src/lib/libc/arch/mips/gen/_lwp.c:1.8
--- src/lib/libc/arch/mips/gen/_lwp.c:1.7	Tue Mar 15 07:40:18 2011
+++ src/lib/libc/arch/mips/gen/_lwp.c	Fri Apr 29 08:05:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: _lwp.c,v 1.7 2011/03/15 07:40:18 matt Exp $	*/
+/*	$NetBSD: _lwp.c,v 1.8 2011/04/29 08:05:22 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.7 2011/03/15 07:40:18 matt Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.8 2011/04/29 08:05:22 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -40,7 +40,11 @@
 #include 
 #include 
 
-#define CALLFRAME_SIZ	24
+#if defined(__mips_o32) || defined(__mips_o64)
+#define CALLFRAME_SIZ	(6 * sizeof(void *))
+#else
+#define CALLFRAME_SIZ	(4 * sizeof(uint64_t))
+#endif
 
 void
 _lwp_makecontext(ucontext_t *u, void (*start)(void *),



CVS commit: [matt-nb5-mips64] src/lib/libc/arch/mips/gen

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:03:55 UTC 2011

Modified Files:
src/lib/libc/arch/mips/gen [matt-nb5-mips64]: _lwp.c

Log Message:
Both N32/N64 use 64-bit stack slots.


To generate a diff of this commit:
cvs rdiff -u -r1.5.14.1 -r1.5.14.2 src/lib/libc/arch/mips/gen/_lwp.c

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

Modified files:

Index: src/lib/libc/arch/mips/gen/_lwp.c
diff -u src/lib/libc/arch/mips/gen/_lwp.c:1.5.14.1 src/lib/libc/arch/mips/gen/_lwp.c:1.5.14.2
--- src/lib/libc/arch/mips/gen/_lwp.c:1.5.14.1	Fri Apr 29 08:01:50 2011
+++ src/lib/libc/arch/mips/gen/_lwp.c	Fri Apr 29 08:03:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: _lwp.c,v 1.5.14.1 2011/04/29 08:01:50 matt Exp $	*/
+/*	$NetBSD: _lwp.c,v 1.5.14.2 2011/04/29 08:03:55 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.5.14.1 2011/04/29 08:01:50 matt Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.5.14.2 2011/04/29 08:03:55 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -43,7 +43,7 @@
 #if defined(__mips_o32) || defined(__mips_o64)
 #define CALLFRAME_SIZ	(6 * sizeof(void *))
 #else
-#define CALLFRAME_SIZ	(4 * sizeof(void *))
+#define CALLFRAME_SIZ	(4 * sizeof(uint64_t))
 #endif
 
 void



CVS commit: [matt-nb5-mips64] src/lib

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 08:01:52 UTC 2011

Modified Files:
src/lib/libc/arch/mips/gen [matt-nb5-mips64]: _lwp.c _setjmp.S
longjmp.c
src/lib/libc/arch/mips/net [matt-nb5-mips64]: Makefile.inc
src/lib/libc/arch/mips/string [matt-nb5-mips64]: bzero.S
src/lib/libc/arch/mips/sys [matt-nb5-mips64]: brk.S sbrk.S
src/lib/libpthread/arch/mips [matt-nb5-mips64]: _context_u.S

Log Message:
Pull in fixes from -current.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.14.1 src/lib/libc/arch/mips/gen/_lwp.c
cvs rdiff -u -r1.20.34.5 -r1.20.34.6 src/lib/libc/arch/mips/gen/_setjmp.S
cvs rdiff -u -r1.2.14.2 -r1.2.14.3 src/lib/libc/arch/mips/gen/longjmp.c
cvs rdiff -u -r1.3 -r1.3.46.1 src/lib/libc/arch/mips/net/Makefile.inc
cvs rdiff -u -r1.8.46.2 -r1.8.46.3 src/lib/libc/arch/mips/string/bzero.S
cvs rdiff -u -r1.16.46.3 -r1.16.46.4 src/lib/libc/arch/mips/sys/brk.S
cvs rdiff -u -r1.16.34.3 -r1.16.34.4 src/lib/libc/arch/mips/sys/sbrk.S
cvs rdiff -u -r1.3.14.2 -r1.3.14.3 src/lib/libpthread/arch/mips/_context_u.S

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/mips/gen/_lwp.c
diff -u src/lib/libc/arch/mips/gen/_lwp.c:1.5 src/lib/libc/arch/mips/gen/_lwp.c:1.5.14.1
--- src/lib/libc/arch/mips/gen/_lwp.c:1.5	Mon Apr 28 20:22:56 2008
+++ src/lib/libc/arch/mips/gen/_lwp.c	Fri Apr 29 08:01:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:56 martin Exp $	*/
+/*	$NetBSD: _lwp.c,v 1.5.14.1 2011/04/29 08:01:50 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.5 2008/04/28 20:22:56 martin Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.5.14.1 2011/04/29 08:01:50 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -40,10 +40,15 @@
 #include 
 #include 
 
-#define CALLFRAME_SIZ	24
-
-void _lwp_makecontext(ucontext_t *u, void (*start)(void *),
-	void *arg, void *private, caddr_t stack_base, size_t stack_size)
+#if defined(__mips_o32) || defined(__mips_o64)
+#define CALLFRAME_SIZ	(6 * sizeof(void *))
+#else
+#define CALLFRAME_SIZ	(4 * sizeof(void *))
+#endif
+
+void
+_lwp_makecontext(ucontext_t *u, void (*start)(void *),
+	void *arg, void *tcb, caddr_t stack_base, size_t stack_size)
 {
 	caddr_t sp;
 	__greg_t *gr;
@@ -56,9 +61,12 @@
 	u->uc_stack.ss_size = stack_size;
 	sp = stack_base + stack_size - CALLFRAME_SIZ;
 
-	gr[_REG_EPC] = (unsigned long) start;
-	gr[_REG_T9] = (unsigned long) start; /* required for .abicalls */
-	gr[_REG_RA] = (unsigned long) _lwp_exit;
-	gr[_REG_A0] = (unsigned long) arg;
-	gr[_REG_SP] = (unsigned long) sp;
+	gr[_REG_EPC] = (uintptr_t) start;
+	gr[_REG_T9] = (uintptr_t) start; /* required for .abicalls */
+	gr[_REG_RA] = (uintptr_t) _lwp_exit;
+	gr[_REG_A0] = (uintptr_t) arg;
+	gr[_REG_SP] = (uintptr_t) sp;
+	u->uc_mcontext._mc_tlsbase =
+	(uintptr_t)tcb + TLS_TP_OFFSET + sizeof(struct tls_tcb);
+	u->uc_flags |= _UC_TLSBASE;
 }

Index: src/lib/libc/arch/mips/gen/_setjmp.S
diff -u src/lib/libc/arch/mips/gen/_setjmp.S:1.20.34.5 src/lib/libc/arch/mips/gen/_setjmp.S:1.20.34.6
--- src/lib/libc/arch/mips/gen/_setjmp.S:1.20.34.5	Wed Feb  3 23:46:47 2010
+++ src/lib/libc/arch/mips/gen/_setjmp.S	Fri Apr 29 08:01:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $	*/
+/*	$NetBSD: _setjmp.S,v 1.20.34.6 2011/04/29 08:01:50 matt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@
 #if 0
 	RCSID("from: @(#)_setjmp.s	8.1 (Berkeley) 6/4/93")
 #else
-	RCSID("$NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $")
+	RCSID("$NetBSD: _setjmp.S,v 1.20.34.6 2011/04/29 08:01:50 matt Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -88,7 +88,6 @@
 	 */
 #ifndef SOFTFLOAT_FOR_GCC
 	cfc1	v0, $31# too bad cant check if FP used
-	INT_S	v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
 #if defined(__mips_n64) || defined(__mips_n32)
 	FP_S	$f30, _OFFSETOF_SC_FPREGS_F30(a0)
 	FP_S	$f28, _OFFSETOF_SC_FPREGS_F28(a0)
@@ -109,6 +108,7 @@
 	FP_S	$f29, _OFFSETOF_SC_FPREGS_F29(a0)
 	FP_S	$f31, _OFFSETOF_SC_FPREGS_F31(a0)
 #endif
+	INT_S	v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
 #endif	/* SOFTFLOAT_FOR_GCC */
 	REG_EPILOGUE
 
@@ -139,11 +139,13 @@
 #if defined(__mips_n32) || defined(__mips_n64)
 	REG_L		gp, _OFFSETOF_SC_REGS_GP(a0)
 #endif
+#ifndef SOFTFLOAT_FOR_GCC
 	# get fpu status
+	INT_L		v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
+#endif
 	REG_L		sp, _OFFSETOF_SC_REGS_SP(a0)
 	REG_L		s8, _OFFSETOF_SC_REGS_S8(a0)
 #ifndef SOFTFLOAT_FOR_GCC
-	INT_L		v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
 	ctc1		v0, $31
 	/*
 	 * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
@@ -173,9 +175,8 @@
 #endif	/* SOFTFLOAT_FOR_GCC */
 
 	REG_EPILOGUE
-	move	v0, a1			# get return value in 1st arg
 	j	ra
-	nop
+	 move	v0, a1			# get return value in 1

CVS commit: [matt-nb5-mips64] src

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 07:48:37 UTC 2011

Modified Files:
src/gnu/dist/gcc4/gcc/config/mips [matt-nb5-mips64]: netbsd64.h
src/lib/libc/arch/mips [matt-nb5-mips64]: Makefile.inc
src/lib/libc/arch/mips/gdtoa [matt-nb5-mips64]: Makefile.inc gd_qnan.h
src/lib/libc/arch/mips/gen [matt-nb5-mips64]: Makefile.inc
src/lib/libc/arch/mips/softfloat [matt-nb5-mips64]: mips-gcc.h
softfloat.h
src/lib/libc/softfloat [matt-nb5-mips64]: Makefile.inc
src/share/mk [matt-nb5-mips64]: bsd.own.mk
src/sys/arch/mips/include [matt-nb5-mips64]: float.h ieee.h ieeefp.h
math.h
Added Files:
src/lib/libc/gen [matt-nb5-mips64]: fpclassifyl_ieee754.c
infinityl_ieee754.c isfinitel_ieee754.c isinfl_ieee754.c
isnanl_ieee754.c signbitl_ieee754.c
src/lib/libc/softfloat [matt-nb5-mips64]: eqtf2.c getf2.c gttf2.c
letf2.c lttf2.c negtf2.c netf2.c

Log Message:
Pull in true (128-bit) long double support for MIPS from -current.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h
cvs rdiff -u -r1.8.34.2 -r1.8.34.3 src/lib/libc/arch/mips/Makefile.inc
cvs rdiff -u -r1.1 -r1.1.34.1 src/lib/libc/arch/mips/gdtoa/Makefile.inc \
src/lib/libc/arch/mips/gdtoa/gd_qnan.h
cvs rdiff -u -r1.28.34.2 -r1.28.34.3 src/lib/libc/arch/mips/gen/Makefile.inc
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/lib/libc/arch/mips/softfloat/mips-gcc.h \
src/lib/libc/arch/mips/softfloat/softfloat.h
cvs rdiff -u -r0 -r1.1.4.2 src/lib/libc/gen/fpclassifyl_ieee754.c \
src/lib/libc/gen/infinityl_ieee754.c src/lib/libc/gen/isfinitel_ieee754.c \
src/lib/libc/gen/signbitl_ieee754.c
cvs rdiff -u -r0 -r1.4.4.2 src/lib/libc/gen/isinfl_ieee754.c
cvs rdiff -u -r0 -r1.6.4.2 src/lib/libc/gen/isnanl_ieee754.c
cvs rdiff -u -r1.4 -r1.4.40.1 src/lib/libc/softfloat/Makefile.inc
cvs rdiff -u -r0 -r1.1.4.2 src/lib/libc/softfloat/eqtf2.c \
src/lib/libc/softfloat/getf2.c src/lib/libc/softfloat/gttf2.c \
src/lib/libc/softfloat/letf2.c src/lib/libc/softfloat/lttf2.c \
src/lib/libc/softfloat/negtf2.c src/lib/libc/softfloat/netf2.c
cvs rdiff -u -r1.542.2.9.4.5 -r1.542.2.9.4.6 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.13 -r1.13.126.1 src/sys/arch/mips/include/float.h
cvs rdiff -u -r1.5 -r1.5.96.1 src/sys/arch/mips/include/ieee.h
cvs rdiff -u -r1.5 -r1.5.12.1 src/sys/arch/mips/include/ieeefp.h
cvs rdiff -u -r1.4 -r1.4.140.1 src/sys/arch/mips/include/math.h

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

Modified files:

Index: src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h
diff -u src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h:1.1.2.3 src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h:1.1.2.4
--- src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h:1.1.2.3	Sat Sep  5 03:26:20 2009
+++ src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h	Fri Apr 29 07:48:33 2011
@@ -50,9 +50,3 @@
%{mips32} %{mips32r2} %{mips64} %{mips64r2} \
%{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
%(netbsd_link_spec)"
-
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
-#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64

Index: src/lib/libc/arch/mips/Makefile.inc
diff -u src/lib/libc/arch/mips/Makefile.inc:1.8.34.2 src/lib/libc/arch/mips/Makefile.inc:1.8.34.3
--- src/lib/libc/arch/mips/Makefile.inc:1.8.34.2	Thu Aug 27 16:51:27 2009
+++ src/lib/libc/arch/mips/Makefile.inc	Fri Apr 29 07:48:33 2011
@@ -1,4 +1,6 @@
-#	$NetBSD: Makefile.inc,v 1.8.34.2 2009/08/27 16:51:27 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.8.34.3 2011/04/29 07:48:33 matt Exp $
+
+.include 
 
 SRCS+=	__sigaction14_sigtramp.c __sigtramp2.S
 
@@ -8,4 +10,5 @@
 .if ${MKSOFTFLOAT} != "no"
 .include 
 CPPFLAGS+= -DSOFTFLOAT_NEED_FIXUNS
+CPPFLAGS+= -DSOFTFLOAT
 .endif

Index: src/lib/libc/arch/mips/gdtoa/Makefile.inc
diff -u src/lib/libc/arch/mips/gdtoa/Makefile.inc:1.1 src/lib/libc/arch/mips/gdtoa/Makefile.inc:1.1.34.1
--- src/lib/libc/arch/mips/gdtoa/Makefile.inc:1.1	Wed Mar 15 17:35:18 2006
+++ src/lib/libc/arch/mips/gdtoa/Makefile.inc	Fri Apr 29 07:48:33 2011
@@ -1,3 +1,9 @@
-#	$NetBSD: Makefile.inc,v 1.1 2006/03/15 17:35:18 kleink Exp $
+#	$NetBSD: Makefile.inc,v 1.1.34.1 2011/04/29 07:48:33 matt Exp $
 
 SRCS+=	strtof.c
+.if (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
+.if !defined(CPUFLAGS) || empty(CPUFLAGS:M-mabi=32)
+SRCS+=	strtold_pQ.c
+SRCS+=	strtopQ.c
+.endif
+.endif
Index: src/lib/libc/arch/mips/gdtoa/gd_qnan.h
diff -u src/lib/libc/arch/mips/gdtoa/gd_qnan.h:1.1 src/lib/libc/arch/mips/gdtoa/gd_qnan.h:1.1.34.1
--- src/lib/libc/arch/mips/gdtoa/gd_qnan.h:1.1	Wed Jan 25 15:33:28 2006
+++ src/lib/libc/arch/mips/gdtoa/gd_qnan.h	Fri Apr 29 07:48:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: gd_qnan.h,v 1.1 2006/01/25 15:33:28 kleink Exp $ */
+/* $NetBSD: gd_qnan.h,v 1.1.34.1 2011/04/29 07:48:3

CVS commit: [matt-nb5-mips64] src

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 07:43:19 UTC 2011

Modified Files:
src/distrib/sets/lists/comp [matt-nb5-mips64]: mi
Added Files:
src/sys/sys [matt-nb5-mips64]: tls.h

Log Message:
Bring in  from current.


To generate a diff of this commit:
cvs rdiff -u -r1.1201.2.9.2.1.2.4 -r1.1201.2.9.2.1.2.5 \
src/distrib/sets/lists/comp/mi
cvs rdiff -u -r0 -r1.1.4.2 src/sys/sys/tls.h

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1201.2.9.2.1.2.4 src/distrib/sets/lists/comp/mi:1.1201.2.9.2.1.2.5
--- src/distrib/sets/lists/comp/mi:1.1201.2.9.2.1.2.4	Wed Apr 21 05:20:40 2010
+++ src/distrib/sets/lists/comp/mi	Fri Apr 29 07:43:18 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1201.2.9.2.1.2.4 2010/04/21 05:20:40 matt Exp $
+#	$NetBSD: mi,v 1.1201.2.9.2.1.2.5 2011/04/29 07:43:18 matt Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2049,6 +2049,7 @@
 ./usr/include/sys/timepps.h			comp-c-include
 ./usr/include/sys/times.h			comp-c-include
 ./usr/include/sys/timex.h			comp-c-include
+./usr/include/sys/tls.hcomp-c-include
 ./usr/include/sys/tprintf.h			comp-obsolete		obsolete
 ./usr/include/sys/trace.h			comp-c-include
 ./usr/include/sys/tree.h			comp-c-include

Added files:

Index: src/sys/sys/tls.h
diff -u /dev/null src/sys/sys/tls.h:1.1.4.2
--- /dev/null	Fri Apr 29 07:43:20 2011
+++ src/sys/sys/tls.h	Fri Apr 29 07:43:19 2011
@@ -0,0 +1,61 @@
+/*	$NetBSD: tls.h,v 1.1.4.2 2011/04/29 07:43:19 matt Exp $	*/
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _SYS_TLS_H_
+#define _SYS_TLS_H_
+
+#include 
+#include 
+
+#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
+
+#if defined(__HAVE_TLS_VARIANT_I) && defined(__HAVE_TLS_VARIANT_II)
+#error Only one TLS variant can be supported at a time
+#endif
+
+struct tls_tcb {
+#ifdef __HAVE_TLS_VARIANT_I
+	void	**tcb_dtv;
+	void	*tcb_pthread;
+#else
+	void	*tcb_self;
+	void	**tcb_dtv;
+	void	*tcb_pthread;
+#endif
+};
+
+__BEGIN_DECLS
+struct tls_tcb	*_rtld_tls_allocate(void);
+void	 	 _rtld_tls_free(struct tls_tcb *);
+void		 _rtld_tls_static_setup(void);
+__END_DECLS
+#endif /* __HAVE_TLS_VARIANT_I || __HAVE_TLS_VARIANT_II */
+
+#endif /* _SYS_TLS_H_ */



CVS commit: [matt-nb5-mips64] src

2011-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Apr 29 07:40:47 UTC 2011

Modified Files:
src/include [matt-nb5-mips64]: math.h
src/lib/libc/arch/mips/gen [matt-nb5-mips64]: nanf.c

Log Message:
Use GCC builtin for NAN (sync with current)


To generate a diff of this commit:
cvs rdiff -u -r1.47.16.1 -r1.47.16.2 src/include/math.h
cvs rdiff -u -r1.3 -r1.3.36.1 src/lib/libc/arch/mips/gen/nanf.c

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

Modified files:

Index: src/include/math.h
diff -u src/include/math.h:1.47.16.1 src/include/math.h:1.47.16.2
--- src/include/math.h:1.47.16.1	Wed Apr 21 05:26:00 2010
+++ src/include/math.h	Fri Apr 29 07:40:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: math.h,v 1.47.16.1 2010/04/21 05:26:00 matt Exp $	*/
+/*	$NetBSD: math.h,v 1.47.16.2 2011/04/29 07:40:46 matt Exp $	*/
 
 /*
  * 
@@ -98,8 +98,12 @@
 
 /* 7.12#5 NAN: a quiet NaN, if supported */
 #ifdef __HAVE_NANF
+#if __GNUC_PREREQ__(3,3)
+#define NAN __builtin_nanf("")
+#else
 extern const union __float_u __nanf;
 #define	NAN		__nanf.__val
+#endif
 #endif /* __HAVE_NANF */
 
 /* 7.12#6 number classification macros */

Index: src/lib/libc/arch/mips/gen/nanf.c
diff -u src/lib/libc/arch/mips/gen/nanf.c:1.3 src/lib/libc/arch/mips/gen/nanf.c:1.3.36.1
--- src/lib/libc/arch/mips/gen/nanf.c:1.3	Fri Apr 15 22:39:11 2005
+++ src/lib/libc/arch/mips/gen/nanf.c	Fri Apr 29 07:40:47 2011
@@ -1,8 +1,8 @@
-/*	$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $	*/
+/*	$NetBSD: nanf.c,v 1.3.36.1 2011/04/29 07:40:47 matt Exp $	*/
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: nanf.c,v 1.3 2005/04/15 22:39:11 kleink Exp $");
+__RCSID("$NetBSD: nanf.c,v 1.3.36.1 2011/04/29 07:40:47 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -15,3 +15,5 @@
 #else
 		{ {0,0, 0xa0, 0x7f } };
 #endif
+
+__warn_references(__nanf, "warning:  defines NAN incorrectly for your compiler.")