CVS commit: src/crypto/external/bsd/openssh/dist

2014-02-20 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Thu Feb 20 08:20:05 UTC 2014

Modified Files:
src/crypto/external/bsd/openssh/dist: ssh.c

Log Message:
Don't print an empty line after the debug message Enabled Dynamic
Window Scaling.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/crypto/external/bsd/openssh/dist/ssh.c

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/ssh.c
diff -u src/crypto/external/bsd/openssh/dist/ssh.c:1.13 src/crypto/external/bsd/openssh/dist/ssh.c:1.14
--- src/crypto/external/bsd/openssh/dist/ssh.c:1.13	Fri Nov  8 19:18:25 2013
+++ src/crypto/external/bsd/openssh/dist/ssh.c	Thu Feb 20 08:20:05 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssh.c,v 1.13 2013/11/08 19:18:25 christos Exp $	*/
+/*	$NetBSD: ssh.c,v 1.14 2014/02/20 08:20:05 gson Exp $	*/
 /* $OpenBSD: ssh.c,v 1.381 2013/07/25 00:29:10 djm Exp $ */
 /*
  * Author: Tatu Ylonen y...@cs.hut.fi
@@ -42,7 +42,7 @@
  */
 
 #include includes.h
-__RCSID($NetBSD: ssh.c,v 1.13 2013/11/08 19:18:25 christos Exp $);
+__RCSID($NetBSD: ssh.c,v 1.14 2014/02/20 08:20:05 gson Exp $);
 #include sys/types.h
 #include sys/param.h
 #include sys/ioctl.h
@@ -1456,7 +1456,7 @@ ssh_session2_open(void)
 
 	if ((options.tcp_rcv_buf_poll  0)  (!options.hpn_disabled)) {
 		c-dynamic_window = 1;
-		debug (Enabled Dynamic Window Scaling\n);
+		debug (Enabled Dynamic Window Scaling);
 	}
 	debug3(ssh_session2_open: channel_new: %d, c-self);
 



CVS commit: src/lib/libcurses

2014-02-20 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Thu Feb 20 09:42:42 UTC 2014

Modified Files:
src/lib/libcurses: curses_private.h mvwin.c refresh.c

Log Message:
Correct the implementation of mvderwin, it now works as specified by
SUSv2.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.18 -r1.19 src/lib/libcurses/mvwin.c
cvs rdiff -u -r1.78 -r1.79 src/lib/libcurses/refresh.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/libcurses/curses_private.h
diff -u src/lib/libcurses/curses_private.h:1.49 src/lib/libcurses/curses_private.h:1.50
--- src/lib/libcurses/curses_private.h:1.49	Sat Nov  9 11:16:59 2013
+++ src/lib/libcurses/curses_private.h	Thu Feb 20 09:42:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses_private.h,v 1.49 2013/11/09 11:16:59 blymn Exp $	*/
+/*	$NetBSD: curses_private.h,v 1.50 2014/02/20 09:42:42 blymn Exp $	*/
 
 /*-
  * Copyright (c) 1998-2000 Brett Lymn
@@ -130,6 +130,7 @@ struct __window {		/* Window structure. 
 #define	__NOTIMEOUT	0x0002	/* Wait indefinitely for func keys */
 #define __IDCHAR	0x0004	/* insert/delete char sequences */
 #define __ISPAD		0x0008	/* window is a pad */
+#define __ISDERWIN	0x0010	/* window is derived from parent */
 	unsigned int flags;
 	int	delay;			/* delay for getch() */
 	attr_t	wattr;			/* Character attributes */
@@ -140,6 +141,9 @@ struct __window {		/* Window structure. 
 	int	pbegy, pbegx,
 		sbegy, sbegx,
 		smaxy, smaxx;		/* Saved prefresh() values */
+	int	dery, derx;		/* derived window coordinates
+	   - top left corner of source 
+	   relative to parent win */
 #ifdef HAVE_WCHAR
 	nschar_t *bnsp;			/* Background non-spacing char list */
 #endif /* HAVE_WCHAR */

Index: src/lib/libcurses/mvwin.c
diff -u src/lib/libcurses/mvwin.c:1.18 src/lib/libcurses/mvwin.c:1.19
--- src/lib/libcurses/mvwin.c:1.18	Fri Oct 18 19:53:59 2013
+++ src/lib/libcurses/mvwin.c	Thu Feb 20 09:42:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvwin.c,v 1.18 2013/10/18 19:53:59 christos Exp $	*/
+/*	$NetBSD: mvwin.c,v 1.19 2014/02/20 09:42:42 blymn Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)mvwin.c	8.2 (Berkeley) 5/4/94;
 #else
-__RCSID($NetBSD: mvwin.c,v 1.18 2013/10/18 19:53:59 christos Exp $);
+__RCSID($NetBSD: mvwin.c,v 1.19 2014/02/20 09:42:42 blymn Exp $);
 #endif
 #endif/* not lint */
 
@@ -53,12 +53,7 @@ mvderwin(WINDOW *win, int dy, int dx)
 {
 	WINDOW *parent;
 	int x, i;
-	__LINE *lp, *olp;
-#ifdef HAVE_WCHAR
-	__LDATA *cp;
-	int j;
-	nschar_t *np;
-#endif /* HAVE_WCHAR */
+	__LINE *plp;
 
 	if (win == NULL)
 		return ERR;
@@ -72,39 +67,26 @@ mvderwin(WINDOW *win, int dy, int dx)
 	((win-maxy + dy)  parent-maxy))
 		return ERR;
 
+	win-flags |= __ISDERWIN;
+	win-derx = dx;
+	win-dery = dy;
+
 	x = parent-begx + dx;
 
-	win-ch_off = x;
-	/* Point the line pointers to line space */
-	for (lp = win-lspace, i = 0; i  win-maxy; i++, lp++) {
-		lp-flags = __ISDIRTY;
-		win-alines[i] = lp;
-		olp = parent-alines[i + dy];
+	/*
+	 * Mark the source area for the derwin as changed so it will be
+	 * copied to the destination window on refresh.
+	 */
+	for (i = 0; i  win-maxy; i++) {
+		plp = parent-alines[i + dy];
+		plp-flags = __ISDIRTY;
+		if (*plp-firstchp  x)
+			*plp-firstchp = x;
+		if (*plp-lastchp  x + win-maxx)
+			*plp-lastchp = x + win-maxx;
 #ifdef DEBUG
-		lp-sentinel = SENTINEL_VALUE;
+		__CTRACE(__CTRACE_REFRESH, mvderwin: firstchp = %d, lastchp = %d\n, *plp-firstchp, *plp-lastchp);
 #endif
-		lp-line = olp-line[win-ch_off];
-		lp-firstchp = olp-firstch;
-		lp-lastchp = olp-lastch;
-#ifndef HAVE_WCHAR
-		lp-hash = __hash((char *)(void *)lp-line,
-		(size_t) (win-maxx * __LDATASIZE));
-#else
-		for (cp = lp-line, j = 0; j  win-maxx; j++, cp++) {
-			lp-hash = __hash_more(cp-ch, sizeof(wchar_t),
-			lp-hash);
-			lp-hash = __hash_more(cp-attr, sizeof(wchar_t),
-			lp-hash);
-			if (cp-nsp) {
-np = cp-nsp;
-while (np) {
-	lp-hash = __hash_more(np-ch,
-	sizeof(wchar_t), lp-hash);
-	np = np-next;
-}
-			}
-		}
-#endif /* HAVE_WCHAR */
 	}
 
 	return OK;

Index: src/lib/libcurses/refresh.c
diff -u src/lib/libcurses/refresh.c:1.78 src/lib/libcurses/refresh.c:1.79
--- src/lib/libcurses/refresh.c:1.78	Fri Dec  6 11:23:47 2013
+++ src/lib/libcurses/refresh.c	Thu Feb 20 09:42:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: refresh.c,v 1.78 2013/12/06 11:23:47 blymn Exp $	*/
+/*	$NetBSD: refresh.c,v 1.79 2014/02/20 09:42:42 blymn Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)refresh.c	8.7 (Berkeley) 8/13/94;
 #else
-__RCSID($NetBSD: refresh.c,v 1.78 2013/12/06 11:23:47 blymn Exp $);
+__RCSID($NetBSD: refresh.c,v 1.79 2014/02/20 09:42:42 blymn Exp $);
 #endif
 #endif/* not lint */
 
@@ -144,9 +144,9 @@ 

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

2014-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 20 11:00:40 UTC 2014

Modified Files:
src/sys/arch/sparc64/dev: lom.c

Log Message:
Don't use conditional format strings, if they aren't equivalent in the
arguments they use.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c
diff -u src/sys/arch/sparc64/dev/lom.c:1.11 src/sys/arch/sparc64/dev/lom.c:1.12
--- src/sys/arch/sparc64/dev/lom.c:1.11	Thu Jan 24 11:06:20 2013
+++ src/sys/arch/sparc64/dev/lom.c	Thu Feb 20 11:00:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: lom.c,v 1.11 2013/01/24 11:06:20 nakayama Exp $	*/
+/*	$NetBSD: lom.c,v 1.12 2014/02/20 11:00:40 joerg Exp $	*/
 /*	$OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.11 2013/01/24 11:06:20 nakayama Exp $);
+__KERNEL_RCSID(0, $NetBSD: lom.c,v 1.12 2014/02/20 11:00:40 joerg Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -352,8 +352,12 @@ lom_attach(device_t parent, device_t sel
 	for (i = 0; i  sc-sc_num_alarm; i++) {
 		sc-sc_alarm[i].units = ENVSYS_INDICATOR;
 		sc-sc_alarm[i].state = ENVSYS_SINVALID;
-		snprintf(sc-sc_alarm[i].desc, sizeof(sc-sc_alarm[i].desc),
-		i == 0 ? Fault LED : Alarm%d, i);
+		if (i == 0)
+			strlcpy(sc-sc_alarm[i].desc, Fault LED,
+			sizeof(sc-sc_alarm[i].desc));
+		else
+			snprintf(sc-sc_alarm[i].desc,
+			sizeof(sc-sc_alarm[i].desc), Alarm%d, i);
 		if (sysmon_envsys_sensor_attach(sc-sc_sme, sc-sc_alarm[i])) {
 			sysmon_envsys_destroy(sc-sc_sme);
 			aprint_error_dev(self, can't attach alarm sensor\n);



CVS commit: src/sys/netsmb

2014-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 20 11:08:57 UTC 2014

Modified Files:
src/sys/netsmb: iconv.c

Log Message:
Don't dereference NULL pointers.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/netsmb/iconv.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/netsmb/iconv.c
diff -u src/sys/netsmb/iconv.c:1.12 src/sys/netsmb/iconv.c:1.13
--- src/sys/netsmb/iconv.c:1.12	Thu Nov 16 01:33:51 2006
+++ src/sys/netsmb/iconv.c	Thu Feb 20 11:08:57 2014
@@ -1,9 +1,9 @@
-/*	$NetBSD: iconv.c,v 1.12 2006/11/16 01:33:51 christos Exp $	*/
+/*	$NetBSD: iconv.c,v 1.13 2014/02/20 11:08:57 joerg Exp $	*/
 
 /* Public domain */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: iconv.c,v 1.12 2006/11/16 01:33:51 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: iconv.c,v 1.13 2014/02/20 11:08:57 joerg Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -60,9 +60,6 @@ iconv_convstr(void *handle, char *dst, c
 		return dst;
 	}
 	inlen = outlen = strlen(src);
-	error = iconv_conv(handle, NULL, NULL, p, outlen);
-	if (error)
-		return NULL;
 	error = iconv_conv(handle, src, inlen, p, outlen);
 	if (error)
 		return NULL;
@@ -85,9 +82,6 @@ iconv_convmem(void *handle, void *dst, c
 		return dst;
 	}
 	inlen = outlen = size;
-	error = iconv_conv(handle, NULL, NULL, d, outlen);
-	if (error)
-		return NULL;
 	error = iconv_conv(handle, s, inlen, d, outlen);
 	if (error)
 		return NULL;



CVS commit: [netbsd-6] src/lib/libpthread

2014-02-20 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Feb 20 13:00:40 UTC 2014

Modified Files:
src/lib/libpthread [netbsd-6]: pthread_cond.c pthread_mutex.c

Log Message:
Pull up the following revisions(s) (requested by prlw1 in ticket #1029):
lib/libpthread/pthread_cond.c:  revision 1.62
lib/libpthread/pthread_mutex.c: revision 1.57,1.59

Partial fix for thread deadlock commonly observed with named.
Also address PR/44756.


To generate a diff of this commit:
cvs rdiff -u -r1.56.8.3 -r1.56.8.4 src/lib/libpthread/pthread_cond.c
cvs rdiff -u -r1.51.22.1 -r1.51.22.2 src/lib/libpthread/pthread_mutex.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/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.56.8.3 src/lib/libpthread/pthread_cond.c:1.56.8.4
--- src/lib/libpthread/pthread_cond.c:1.56.8.3	Mon Apr 29 01:50:18 2013
+++ src/lib/libpthread/pthread_cond.c	Thu Feb 20 13:00:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.56.8.3 2013/04/29 01:50:18 riz Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.56.8.4 2014/02/20 13:00:40 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_cond.c,v 1.56.8.3 2013/04/29 01:50:18 riz Exp $);
+__RCSID($NetBSD: pthread_cond.c,v 1.56.8.4 2014/02/20 13:00:40 sborrill Exp $);
 
 #include errno.h
 #include sys/time.h
@@ -181,10 +181,12 @@ pthread_cond_timedwait(pthread_cond_t *c
 		pthread_mutex_unlock(mutex);
 		self-pt_willpark = 0;
 		self-pt_blocking++;
-		retval = _lwp_park(abstime, self-pt_unpark,
-		__UNVOLATILE(mutex-ptm_waiters),
-		__UNVOLATILE(mutex-ptm_waiters));
-		self-pt_unpark = 0;
+		do {
+			retval = _lwp_park(abstime, self-pt_unpark,
+			__UNVOLATILE(mutex-ptm_waiters),
+			__UNVOLATILE(mutex-ptm_waiters));
+			self-pt_unpark = 0;
+		} while (retval == -1  errno == ESRCH);
 		self-pt_blocking--;
 		membar_sync();
 		pthread_mutex_lock(mutex);

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.51.22.1 src/lib/libpthread/pthread_mutex.c:1.51.22.2
--- src/lib/libpthread/pthread_mutex.c:1.51.22.1	Mon Apr 29 01:50:18 2013
+++ src/lib/libpthread/pthread_mutex.c	Thu Feb 20 13:00:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.51.22.1 2013/04/29 01:50:18 riz Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.51.22.2 2014/02/20 13:00:40 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_mutex.c,v 1.51.22.1 2013/04/29 01:50:18 riz Exp $);
+__RCSID($NetBSD: pthread_mutex.c,v 1.51.22.2 2014/02/20 13:00:40 sborrill Exp $);
 
 #include sys/types.h
 #include sys/lwpctl.h
@@ -211,11 +211,61 @@ pthread__mutex_spin(pthread_mutex_t *ptm
 	return owner;
 }
 
+NOINLINE static void
+pthread__mutex_setwaiters(pthread_t self, pthread_mutex_t *ptm)
+{
+	void *new, *owner;
+
+	/*
+	 * Note that the mutex can become unlocked before we set
+	 * the waiters bit.  If that happens it's not safe to sleep
+	 * as we may never be awoken: we must remove the current
+	 * thread from the waiters list and try again.
+	 *
+	 * Because we are doing this atomically, we can't remove
+	 * one waiter: we must remove all waiters and awken them,
+	 * then sleep in _lwp_park() until we have been awoken. 
+	 *
+	 * Issue a memory barrier to ensure that we are reading
+	 * the value of ptm_owner/pt_mutexwait after we have entered
+	 * the waiters list (the CAS itself must be atomic).
+	 */
+again:
+	membar_consumer();
+	owner = ptm-ptm_owner;
+
+	if (MUTEX_OWNER(owner) == 0) {
+		pthread__mutex_wakeup(self, ptm);
+		return;
+	}
+	if (!MUTEX_HAS_WAITERS(owner)) {
+		new = (void *)((uintptr_t)owner | MUTEX_WAITERS_BIT);
+		if (atomic_cas_ptr(ptm-ptm_owner, owner, new) != owner) {
+			goto again;
+		}
+	}
+
+	/*
+	 * Note that pthread_mutex_unlock() can do a non-interlocked CAS.
+	 * We cannot know if the presence of the waiters bit is stable
+	 * while the holding thread is running.  There are many assumptions;
+	 * see sys/kern/kern_mutex.c for details.  In short, we must spin if
+	 * we see that the holder is running again.
+	 */
+	membar_sync();
+	pthread__mutex_spin(ptm, owner);
+
+	if (membar_consumer(), !MUTEX_HAS_WAITERS(ptm-ptm_owner)) {
+		goto again;
+	}
+}
+
 NOINLINE static int
 pthread__mutex_lock_slow(pthread_mutex_t *ptm)
 {
 	void *waiters, *new, *owner, *next;
 	pthread_t self;
+	int serrno;
 
 	pthread__error(EINVAL, Invalid mutex,
 	ptm-ptm_magic == _PT_MUTEX_MAGIC);
@@ -235,6 +285,7 @@ pthread__mutex_lock_slow(pthread_mutex_t
 			return EDEADLK;
 	}
 
+	serrno = errno;
 	for (;; owner = ptm-ptm_owner) {
 		/* Spin while the owner is running. */
 		owner = pthread__mutex_spin(ptm, owner);
@@ -247,6 +298,7 @@ pthread__mutex_lock_slow(pthread_mutex_t
 next 

CVS commit: [netbsd-6] src/doc

2014-02-20 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Feb 20 13:01:50 UTC 2014

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

Log Message:
Ticket #1029


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

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.91 src/doc/CHANGES-6.2:1.1.2.92
--- src/doc/CHANGES-6.2:1.1.2.91	Fri Feb 14 23:27:34 2014
+++ src/doc/CHANGES-6.2	Thu Feb 20 13:01:50 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.91 2014/02/14 23:27:34 bouyer Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.92 2014/02/20 13:01:50 sborrill Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -1322,3 +1322,10 @@ sys/kern/exec_elf.c1.55
 	Fix memory leak on bogus ELF binary.
 	[maxv, ticket #1028]
 
+lib/libpthread/pthread_cond.c			1.62
+lib/libpthread/pthread_mutex.c			1.57,1.59
+
+	Partial fix for thread deadlock commonly observed with
+	named. Also address PR/44756.
+	[prlw1, #ticket 1029]
+



CVS commit: src/sys/netinet6

2014-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 20 13:36:06 UTC 2014

Modified Files:
src/sys/netinet6: icmp6.c

Log Message:
Bail out in case m_pulldown failed.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/netinet6/icmp6.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/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.163 src/sys/netinet6/icmp6.c:1.164
--- src/sys/netinet6/icmp6.c:1.163	Sat Nov 23 14:20:22 2013
+++ src/sys/netinet6/icmp6.c	Thu Feb 20 13:36:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.163 2013/11/23 14:20:22 christos Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.164 2014/02/20 13:36:06 joerg Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: icmp6.c,v 1.163 2013/11/23 14:20:22 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: icmp6.c,v 1.164 2014/02/20 13:36:06 joerg Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -630,6 +630,8 @@ icmp6_input(struct mbuf **mp, int *offp,
 		}
 		IP6_EXTHDR_GET(nicmp6, struct icmp6_hdr *, n, off,
 		sizeof(*nicmp6));
+		if (nicmp6 == NULL)
+			goto freeit;
 		nicmp6-icmp6_type = ICMP6_ECHO_REPLY;
 		nicmp6-icmp6_code = 0;
 		if (n) {



CVS commit: [netbsd-5] src/lib/libpthread

2014-02-20 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Feb 20 13:53:26 UTC 2014

Modified Files:
src/lib/libpthread [netbsd-5]: pthread_cond.c pthread_mutex.c

Log Message:
Pull up the following revisions(s) (requested by prlw1 in ticket #1898):
lib/libpthread/pthread_cond.c:  revision 1.62
lib/libpthread/pthread_mutex.c: revision 1.57,1.59

Partial fix for thread deadlock commonly observed with named.
Also address PR/44756.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.53.2.1 src/lib/libpthread/pthread_cond.c
cvs rdiff -u -r1.51 -r1.51.4.1 src/lib/libpthread/pthread_mutex.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/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.53 src/lib/libpthread/pthread_cond.c:1.53.2.1
--- src/lib/libpthread/pthread_cond.c:1.53	Sat Oct 25 14:14:11 2008
+++ src/lib/libpthread/pthread_cond.c	Thu Feb 20 13:53:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.53 2008/10/25 14:14:11 yamt Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.53.2.1 2014/02/20 13:53:26 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_cond.c,v 1.53 2008/10/25 14:14:11 yamt Exp $);
+__RCSID($NetBSD: pthread_cond.c,v 1.53.2.1 2014/02/20 13:53:26 sborrill Exp $);
 
 #include errno.h
 #include sys/time.h
@@ -145,10 +145,12 @@ pthread_cond_timedwait(pthread_cond_t *c
 		pthread_mutex_unlock(mutex);
 		self-pt_willpark = 0;
 		self-pt_blocking++;
-		retval = _lwp_park(abstime, self-pt_unpark,
-		__UNVOLATILE(mutex-ptm_waiters),
-		__UNVOLATILE(mutex-ptm_waiters));
-		self-pt_unpark = 0;
+		do {
+			retval = _lwp_park(abstime, self-pt_unpark,
+			__UNVOLATILE(mutex-ptm_waiters),
+			__UNVOLATILE(mutex-ptm_waiters));
+			self-pt_unpark = 0;
+		} while (retval == -1  errno == ESRCH);
 		self-pt_blocking--;
 		membar_sync();
 		pthread_mutex_lock(mutex);

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.51 src/lib/libpthread/pthread_mutex.c:1.51.4.1
--- src/lib/libpthread/pthread_mutex.c:1.51	Sat Aug  2 19:46:30 2008
+++ src/lib/libpthread/pthread_mutex.c	Thu Feb 20 13:53:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.51 2008/08/02 19:46:30 matt Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.51.4.1 2014/02/20 13:53:26 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_mutex.c,v 1.51 2008/08/02 19:46:30 matt Exp $);
+__RCSID($NetBSD: pthread_mutex.c,v 1.51.4.1 2014/02/20 13:53:26 sborrill Exp $);
 
 #include sys/types.h
 #include sys/lwpctl.h
@@ -200,11 +200,61 @@ pthread__mutex_spin(pthread_mutex_t *ptm
 	return owner;
 }
 
+NOINLINE static void
+pthread__mutex_setwaiters(pthread_t self, pthread_mutex_t *ptm)
+{
+	void *new, *owner;
+
+	/*
+	 * Note that the mutex can become unlocked before we set
+	 * the waiters bit.  If that happens it's not safe to sleep
+	 * as we may never be awoken: we must remove the current
+	 * thread from the waiters list and try again.
+	 *
+	 * Because we are doing this atomically, we can't remove
+	 * one waiter: we must remove all waiters and awken them,
+	 * then sleep in _lwp_park() until we have been awoken. 
+	 *
+	 * Issue a memory barrier to ensure that we are reading
+	 * the value of ptm_owner/pt_mutexwait after we have entered
+	 * the waiters list (the CAS itself must be atomic).
+	 */
+again:
+	membar_consumer();
+	owner = ptm-ptm_owner;
+
+	if (MUTEX_OWNER(owner) == 0) {
+		pthread__mutex_wakeup(self, ptm);
+		return;
+	}
+	if (!MUTEX_HAS_WAITERS(owner)) {
+		new = (void *)((uintptr_t)owner | MUTEX_WAITERS_BIT);
+		if (atomic_cas_ptr(ptm-ptm_owner, owner, new) != owner) {
+			goto again;
+		}
+	}
+
+	/*
+	 * Note that pthread_mutex_unlock() can do a non-interlocked CAS.
+	 * We cannot know if the presence of the waiters bit is stable
+	 * while the holding thread is running.  There are many assumptions;
+	 * see sys/kern/kern_mutex.c for details.  In short, we must spin if
+	 * we see that the holder is running again.
+	 */
+	membar_sync();
+	pthread__mutex_spin(ptm, owner);
+
+	if (membar_consumer(), !MUTEX_HAS_WAITERS(ptm-ptm_owner)) {
+		goto again;
+	}
+}
+
 NOINLINE static int
 pthread__mutex_lock_slow(pthread_mutex_t *ptm)
 {
 	void *waiters, *new, *owner, *next;
 	pthread_t self;
+	int serrno;
 
 	pthread__error(EINVAL, Invalid mutex,
 	ptm-ptm_magic == _PT_MUTEX_MAGIC);
@@ -224,6 +274,7 @@ pthread__mutex_lock_slow(pthread_mutex_t
 			return EDEADLK;
 	}
 
+	serrno = errno;
 	for (;; owner = ptm-ptm_owner) {
 		/* Spin while the owner is running. */
 		owner = pthread__mutex_spin(ptm, owner);
@@ -236,6 +287,7 @@ pthread__mutex_lock_slow(pthread_mutex_t
 next = atomic_cas_ptr(ptm-ptm_owner, owner,
  

CVS commit: [netbsd-5] src/doc

2014-02-20 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Feb 20 13:54:43 UTC 2014

Modified Files:
src/doc [netbsd-5]: CHANGES-5.3

Log Message:
Ticket #1898


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.47 -r1.1.2.48 src/doc/CHANGES-5.3

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

Modified files:

Index: src/doc/CHANGES-5.3
diff -u src/doc/CHANGES-5.3:1.1.2.47 src/doc/CHANGES-5.3:1.1.2.48
--- src/doc/CHANGES-5.3:1.1.2.47	Wed Jan 15 10:12:12 2014
+++ src/doc/CHANGES-5.3	Thu Feb 20 13:54:42 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.3,v 1.1.2.47 2014/01/15 10:12:12 bouyer Exp $
+# $NetBSD: CHANGES-5.3,v 1.1.2.48 2014/02/20 13:54:42 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.2 release to the NetBSD 5.3
 release:
@@ -709,3 +709,10 @@ dist/bind/bin/named/query.c			patch
 			   when serving NSEC3 signed zones.  [RT #35120]
 	[spz, ticket #1897]
 
+lib/libpthread/pthread_cond.c			1.62
+lib/libpthread/pthread_mutex.c			1.57, 1.59
+
+	Partial fix for thread deadlock commonly observed with
+	named. Also address PR/44756.
+	[prlw1, ticket #1898]
+



CVS commit: [netbsd-6] src/doc

2014-02-20 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Feb 20 13:55:53 UTC 2014

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

Log Message:
Fix formatting errors in last commit


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

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.92 src/doc/CHANGES-6.2:1.1.2.93
--- src/doc/CHANGES-6.2:1.1.2.92	Thu Feb 20 13:01:50 2014
+++ src/doc/CHANGES-6.2	Thu Feb 20 13:55:53 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.92 2014/02/20 13:01:50 sborrill Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.93 2014/02/20 13:55:53 sborrill Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -1323,9 +1323,9 @@ sys/kern/exec_elf.c1.55
 	[maxv, ticket #1028]
 
 lib/libpthread/pthread_cond.c			1.62
-lib/libpthread/pthread_mutex.c			1.57,1.59
+lib/libpthread/pthread_mutex.c			1.57, 1.59
 
 	Partial fix for thread deadlock commonly observed with
 	named. Also address PR/44756.
-	[prlw1, #ticket 1029]
+	[prlw1, ticket #1029]
 



CVS commit: src

2014-02-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb 20 14:30:23 UTC 2014

Modified Files:
src/distrib/luna68k/ramdisk: Makefile list
src/sys/arch/luna68k/conf: INSTALL

Log Message:
Add dhcpcd(8) to luna68k sysinst.  Also bump ramdisk size.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/luna68k/ramdisk/Makefile
cvs rdiff -u -r1.2 -r1.3 src/distrib/luna68k/ramdisk/list
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/luna68k/conf/INSTALL

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

Modified files:

Index: src/distrib/luna68k/ramdisk/Makefile
diff -u src/distrib/luna68k/ramdisk/Makefile:1.1 src/distrib/luna68k/ramdisk/Makefile:1.2
--- src/distrib/luna68k/ramdisk/Makefile:1.1	Sat Jul 16 15:52:21 2011
+++ src/distrib/luna68k/ramdisk/Makefile	Thu Feb 20 14:30:23 2014
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.1 2011/07/16 15:52:21 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.2 2014/02/20 14:30:23 tsutsui Exp $
 
 .include bsd.own.mk
 .include ${NETBSDSRCDIR}/distrib/common/Makefile.distrib
 
 IMAGE=		ramdisk.fs
-IMAGESIZE=	1600k
+IMAGESIZE=	1700k
 MAKEFS_FLAGS=	-f 15
 
 WARNS=		1
@@ -28,6 +28,7 @@ HACKSRC=	${DISTRIBDIR}/utils/libhack
 ${CRUNCHBIN}:	libhack.o
 
 .include ${DISTRIBDIR}/common/Makefile.crunch
+.include ${DISTRIBDIR}/common/Makefile.dhcpcd
 .include ${DISTRIBDIR}/common/Makefile.makedev
 .include ${DISTRIBDIR}/common/Makefile.image
 

Index: src/distrib/luna68k/ramdisk/list
diff -u src/distrib/luna68k/ramdisk/list:1.2 src/distrib/luna68k/ramdisk/list:1.3
--- src/distrib/luna68k/ramdisk/list:1.2	Sat Feb 15 18:41:20 2014
+++ src/distrib/luna68k/ramdisk/list	Thu Feb 20 14:30:23 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: list,v 1.2 2014/02/15 18:41:20 tsutsui Exp $
+#	$NetBSD: list,v 1.3 2014/02/20 14:30:23 tsutsui Exp $
 
 SRCDIRS	bin sbin usr.bin usr.sbin
 
@@ -43,6 +43,7 @@ PROG	sbin/route
 PROG	sbin/shutdown
 PROG	sbin/slattach
 PROG	sbin/swapctl	sbin/swapon
+PROG	sbin/sysctl
 PROG	sbin/umount
 
 PROG	usr/bin/ftp

Index: src/sys/arch/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.14 src/sys/arch/luna68k/conf/INSTALL:1.15
--- src/sys/arch/luna68k/conf/INSTALL:1.14	Sun Jun 30 21:38:57 2013
+++ src/sys/arch/luna68k/conf/INSTALL	Thu Feb 20 14:30:23 2014
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.14 2013/06/30 21:38:57 rmind Exp $
+# $NetBSD: INSTALL,v 1.15 2014/02/20 14:30:23 tsutsui Exp $
 #
 # config for installation ramdisk kernel
 # 
@@ -15,7 +15,7 @@ options 	FPSP	# on m68040 to emulate som
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT		# Force root on ram-disk
 options 	MEMORY_DISK_SERVER=0		# no userspace md(4) support
-options 	MEMORY_DISK_ROOT_SIZE=3200	# 1.60 Megabytes
+options 	MEMORY_DISK_ROOT_SIZE=3400	# 1.60 Megabytes
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 # Standard system options



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 14:48:11 UTC 2014

Modified Files:
src/sys/arch/arm/arm: cpufunc.c

Log Message:
Make sure AFLT_ENABLE in the cpuctrl mask for armv7_setup.


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

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

Modified files:

Index: src/sys/arch/arm/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.136 src/sys/arch/arm/arm/cpufunc.c:1.137
--- src/sys/arch/arm/arm/cpufunc.c:1.136	Thu Jan 23 19:28:47 2014
+++ src/sys/arch/arm/arm/cpufunc.c	Thu Feb 20 14:48:11 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.136 2014/01/23 19:28:47 matt Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.137 2014/02/20 14:48:11 matt Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.136 2014/01/23 19:28:47 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.137 2014/02/20 14:48:11 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_cpuoptions.h
@@ -3055,20 +3055,13 @@ armv7_setup(char *args)
 #ifdef __ARMEB__
 	| CPU_CONTROL_EX_BEND
 #endif
+#ifndef ARM32_DISABLE_ALIGNMENT_FAULTS
+	| CPU_CONTROL_AFLT_ENABLE;
+#endif
 	| CPU_CONTROL_UNAL_ENABLE;
 
-#if 0
-	int cpuctrlmask = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_SYST_ENABLE
-	| CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE
-	| CPU_CONTROL_ROM_ENABLE | CPU_CONTROL_BPRD_ENABLE
-	| CPU_CONTROL_BEND_ENABLE | CPU_CONTROL_AFLT_ENABLE
-	| CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK;
-#endif
+	int cpuctrlmask = cpuctrl | CPU_CONTROL_AFLT_ENABLE;
 
-#ifdef ARM32_DISABLE_ALIGNMENT_FAULTS
-#else
-	cpuctrl |= CPU_CONTROL_AFLT_ENABLE;
-#endif
 
 	cpuctrl = parse_cpu_options(args, armv7_options, cpuctrl);
 
@@ -3082,7 +3075,7 @@ armv7_setup(char *args)
 
 	/* Set the control register */
 	curcpu()-ci_ctrl = cpuctrl;
-	cpu_control(cpuctrl, cpuctrl);
+	cpu_control(cpuctrlmask, cpuctrl);
 }
 #endif /* CPU_CORTEX */
 



CVS commit: src/sys/arch/sparc/stand/ofwboot

2014-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 20 14:50:39 UTC 2014

Modified Files:
src/sys/arch/sparc/stand/ofwboot: boot.h

Log Message:
Add prototype for main.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/stand/ofwboot/boot.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/sparc/stand/ofwboot/boot.h
diff -u src/sys/arch/sparc/stand/ofwboot/boot.h:1.9 src/sys/arch/sparc/stand/ofwboot/boot.h:1.10
--- src/sys/arch/sparc/stand/ofwboot/boot.h:1.9	Wed Jun  1 11:43:12 2011
+++ src/sys/arch/sparc/stand/ofwboot/boot.h	Thu Feb 20 14:50:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.h,v 1.9 2011/06/01 11:43:12 tsutsui Exp $	*/
+/*	$NetBSD: boot.h,v 1.10 2014/02/20 14:50:39 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -69,4 +69,7 @@ void	freeall(void);
 /* ofdev.c */
 char *filename(char *, char *);
 
+/* boot.c */
+void main(void *);
+
 #endif /* _BOOT_H_ */



CVS commit: src/sys/arch/sparc/stand/ofwboot

2014-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 20 15:11:36 UTC 2014

Modified Files:
src/sys/arch/sparc/stand/ofwboot: ofdev.c

Log Message:
Zero the block on failure, not just the first pointer in it.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sparc/stand/ofwboot/ofdev.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/sparc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.34 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.35
--- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.34	Tue Apr 16 07:45:37 2013
+++ src/sys/arch/sparc/stand/ofwboot/ofdev.c	Thu Feb 20 15:11:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.34 2013/04/16 07:45:37 martin Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.35 2014/02/20 15:11:36 joerg Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -353,7 +353,7 @@ search_label(struct of_dev *devp, u_long
 		return (disklabel_sun_to_bsd(buf, lp));
 
 
-	memset(buf, 0, sizeof(buf));
+	memset(buf, 0, DEV_BSIZE);
 	return (no disk label);
 }
 



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 15:45:20 UTC 2014

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

Log Message:
Make sure to clear MDLWP_NOALIGNFLT on !aapcs or !(armv6  armv7)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/arm/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/arm/arm/cpu_exec.c
diff -u src/sys/arch/arm/arm/cpu_exec.c:1.8 src/sys/arch/arm/arm/cpu_exec.c:1.9
--- src/sys/arch/arm/arm/cpu_exec.c:1.8	Fri Dec 20 06:50:28 2013
+++ src/sys/arch/arm/arm/cpu_exec.c	Thu Feb 20 15:45:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_exec.c,v 1.8 2013/12/20 06:50:28 matt Exp $	*/
+/*	$NetBSD: cpu_exec.c,v 1.9 2014/02/20 15:45:20 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu_exec.c,v 1.8 2013/12/20 06:50:28 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_exec.c,v 1.9 2014/02/20 15:45:20 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_compat_netbsd32.h
@@ -111,12 +111,15 @@ arm_netbsd_elf32_probe(struct lwp *l, st
 		strlcpy(l-l_proc-p_md.md_march, epp-ep_machine_arch,
 		sizeof(l-l_proc-p_md.md_march));
 	}
+
 	/*
 	 * If we are AAPCS (EABI) and armv6/armv7, we want alignment faults
-	 * be off.
+	 * to be off.
 	 */
 	if (aapcs_p  (CPU_IS_ARMV7_P() || CPU_IS_ARMV6_P())) {
 		l-l_md.md_flags |= MDLWP_NOALIGNFLT;
+	} else {
+		l-l_md.md_flags = ~MDLWP_NOALIGNFLT;
 	}
 	return 0;
 }



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 15:52:30 UTC 2014

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_armv7.S

Log Message:
for non-of-power-2 sets, we need to round to next power of 2.  (which is
simply doubling the value and then subtracting 1).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/arm/cpufunc_asm_armv7.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/arm/arm/cpufunc_asm_armv7.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.12 src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.13
--- src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.12	Sun Aug 18 06:28:18 2013
+++ src/sys/arch/arm/arm/cpufunc_asm_armv7.S	Thu Feb 20 15:52:30 2014
@@ -243,6 +243,8 @@ ENTRY_NP(armv7_icache_inv_all)
 
 	ubfx	r2, r0, #13, #15	@ get num sets - 1 from CCSIDR
 	ubfx	r3, r0, #3, #10		@ get numways - 1 from CCSIDR
+	lsl	r3, r3, #1 		@ double
+	sub	r3, r3, #1		@ subtract one (now rounded up)
 	clz	r1, r3			@ number of bits to MSB of way
 	lsl	r3, r3, r1		@ shift into position
 	mov	ip, #1			@ 
@@ -301,6 +303,8 @@ ENTRY_NP(armv7_dcache_inv_all)
 	lsl	r1, r1, ip		@ r1 = set decr
 
 	ubfx	ip, r0, #3, #10		@ get numways - 1 from [to be discarded] CCSIDR
+	lsl	ip, ip, #1 		@ double
+	sub	ip, ip, #1		@ subtract one (now rounded up)
 	clz	r2, ip			@ number of bits to MSB of way
 	lsl	ip, ip, r2		@ shift by that into way position
 	mov	r0, #1			@ 
@@ -364,6 +368,8 @@ ENTRY_NP(armv7_dcache_wbinv_all)
 	lsl	r1, r1, ip		@ r1 = set decr
 
 	ubfx	ip, r0, #3, #10		@ get numways - 1 from [to be discarded] CCSIDR
+	lsl	ip, ip, #1 		@ double
+	sub	ip, ip, #1		@ subtract one (now rounded up)
 	clz	r2, ip			@ number of bits to MSB of way
 	lsl	ip, ip, r2		@ shift by that into way position
 	mov	r0, #1			@ 



CVS commit: src/common/lib/libc/arch/m68k/atomic

2014-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 16:33:23 UTC 2014

Modified Files:
src/common/lib/libc/arch/m68k/atomic: atomic_cas.S

Log Message:
Simplify the variants returning a bool


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S

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

Modified files:

Index: src/common/lib/libc/arch/m68k/atomic/atomic_cas.S
diff -u src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.8 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.9
--- src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.8	Tue Feb 18 16:19:28 2014
+++ src/common/lib/libc/arch/m68k/atomic/atomic_cas.S	Thu Feb 20 16:33:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_cas.S,v 1.8 2014/02/18 16:19:28 martin Exp $	*/
+/*	$NetBSD: atomic_cas.S,v 1.9 2014/02/20 16:33:23 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,11 +68,11 @@ ENTRY(__sync_bool_compare_and_swap_4)
 	movl	12(%sp), %d1
 	casl	%d3, %d1, (%a0)
 	/* %d3 now contains the old value */
-	clrl	%d0	/* assume it did not work */
-	cmpl	%d3, %d2
-	bne	1f
-	movl	#1, %d0	/* return success */
-1:	rts
+	beq	1f
+	clrl	%d0	/* return false */
+	rts
+1:	movl	#1, %d0	/* return success */
+	rts
 END(__sync_bool_compare_and_swap_4)
 
 ENTRY(_atomic_cas_16)
@@ -94,11 +94,11 @@ ENTRY(__sync_bool_compare_and_swap_2)
 	movw	10(%sp), %d1
 	casw	%d3, %d1, (%a0)
 	/* %d3 now contains the old value */
-	clrl	%d0	/* assume it did not work */
-	cmpw	%d3, %d2
-	bne	1f
-	movl	#1, %d0	/* return success */
-1:	rts
+	beq	1f
+	clrl	%d0	/* return failure */
+	rts
+1:	movl	#1, %d0	/* return success */
+	rts
 END(__sync_bool_compare_and_swap_2)
 
 ENTRY(_atomic_cas_8)
@@ -121,10 +121,10 @@ ENTRY(__sync_bool_compare_and_swap_1)
 	movb	9(%sp), %d1
 	casb	%d3, %d1, (%a0)
 	/* %d3 now contains the old value */
-	clrl	%d0	/* assume it did not work */
-	cmpb	%d3, %d2
-	bne	1f
-	movl	#1, %d0	/* return success */
-1:	rts
+	beq	1f
+	clrl	%d0	/* return failure */
+	rts
+1:	movl	#1, %d0	/* return success */
+	rts
 END(__sync_bool_compare_and_swap_1)
 



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 17:19:55 UTC 2014

Modified Files:
src/sys/arch/arm/include: cpufunc.h

Log Message:
Make the tlb_flush*SE take a vaddr_t, not a u_int.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/arm/include/cpufunc.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/arm/include/cpufunc.h
diff -u src/sys/arch/arm/include/cpufunc.h:1.65 src/sys/arch/arm/include/cpufunc.h:1.66
--- src/sys/arch/arm/include/cpufunc.h:1.65	Wed Jan 29 00:42:15 2014
+++ src/sys/arch/arm/include/cpufunc.h	Thu Feb 20 17:19:55 2014
@@ -67,11 +67,11 @@ struct cpu_functions {
 	/* TLB functions */
 
 	void	(*cf_tlb_flushID)	(void);
-	void	(*cf_tlb_flushID_SE)	(u_int);
+	void	(*cf_tlb_flushID_SE)	(vaddr_t);
 	void	(*cf_tlb_flushI)	(void);
-	void	(*cf_tlb_flushI_SE)	(u_int);
+	void	(*cf_tlb_flushI_SE)	(vaddr_t);
 	void	(*cf_tlb_flushD)	(void);
-	void	(*cf_tlb_flushD_SE)	(u_int);
+	void	(*cf_tlb_flushD_SE)	(vaddr_t);
 
 	/*
 	 * Cache operations:
@@ -258,7 +258,7 @@ int	arm7_dataabt_fixup	(void *);
 void	arm7tdmi_setup		(char *);
 void	arm7tdmi_setttb		(u_int, bool);
 void	arm7tdmi_tlb_flushID	(void);
-void	arm7tdmi_tlb_flushID_SE	(u_int);
+void	arm7tdmi_tlb_flushID_SE	(vaddr_t);
 void	arm7tdmi_cache_flushID	(void);
 void	arm7tdmi_context_switch	(u_int);
 #endif /* CPU_ARM7TDMI */
@@ -266,7 +266,7 @@ void	arm7tdmi_context_switch	(u_int);
 #ifdef CPU_ARM8
 void	arm8_setttb		(u_int, bool);
 void	arm8_tlb_flushID	(void);
-void	arm8_tlb_flushID_SE	(u_int);
+void	arm8_tlb_flushID_SE	(vaddr_t);
 void	arm8_cache_flushID	(void);
 void	arm8_cache_flushID_E	(u_int);
 void	arm8_cache_cleanID	(void);
@@ -293,8 +293,8 @@ void	fa526_setup		(char *);
 void	fa526_setttb		(u_int, bool);
 void	fa526_context_switch	(u_int);
 void	fa526_cpu_sleep		(int);
-void	fa526_tlb_flushI_SE	(u_int);
-void	fa526_tlb_flushID_SE	(u_int);
+void	fa526_tlb_flushI_SE	(vaddr_t);
+void	fa526_tlb_flushID_SE	(vaddr_t);
 void	fa526_flush_prefetchbuf	(void);
 void	fa526_flush_brnchtgt_E	(u_int);
 
@@ -325,12 +325,12 @@ void	sa11x0_setup		(char *);
 #if defined(CPU_SA110) || defined(CPU_SA1100) || defined(CPU_SA1110)
 void	sa1_setttb		(u_int, bool);
 
-void	sa1_tlb_flushID_SE	(u_int);
+void	sa1_tlb_flushID_SE	(vaddr_t);
 
 void	sa1_cache_flushID	(void);
 void	sa1_cache_flushI	(void);
 void	sa1_cache_flushD	(void);
-void	sa1_cache_flushD_SE	(u_int);
+void	sa1_cache_flushD_SE	(vaddr_t);
 
 void	sa1_cache_cleanID	(void);
 void	sa1_cache_cleanD	(void);
@@ -353,7 +353,7 @@ void	sa1_cache_syncI_rng	(vaddr_t, vsize
 #ifdef CPU_ARM9
 void	arm9_setttb		(u_int, bool);
 
-void	arm9_tlb_flushID_SE	(u_int);
+void	arm9_tlb_flushID_SE	(vaddr_t);
 
 void	arm9_icache_sync_all	(void);
 void	arm9_icache_sync_range	(vaddr_t, vsize_t);
@@ -377,8 +377,8 @@ extern unsigned arm9_dcache_index_inc;
 #endif
 
 #if defined(CPU_ARM9E) || defined(CPU_ARM10) || defined(CPU_SHEEVA)
-void	arm10_tlb_flushID_SE	(u_int);
-void	arm10_tlb_flushI_SE	(u_int);
+void	arm10_tlb_flushID_SE	(vaddr_t);
+void	arm10_tlb_flushI_SE	(vaddr_t);
 
 void	arm10_context_switch	(u_int);
 
@@ -427,9 +427,6 @@ void	arm11mpcore_setup		(char *);
 #if defined(CPU_ARM11) || defined(CPU_CORTEX)
 void	arm11_setttb		(u_int, bool);
 
-void	arm11_tlb_flushID_SE	(u_int);
-void	arm11_tlb_flushI_SE	(u_int);
-
 void	arm11_context_switch	(u_int);
 
 void	arm11_cpu_sleep		(int);
@@ -437,7 +434,9 @@ void	arm11_setup		(char *string);
 void	arm11_tlb_flushID	(void);
 void	arm11_tlb_flushI	(void);
 void	arm11_tlb_flushD	(void);
-void	arm11_tlb_flushD_SE	(u_int va);
+void	arm11_tlb_flushID_SE	(vaddr_t);
+void	arm11_tlb_flushI_SE	(vaddr_t);
+void	arm11_tlb_flushD_SE	(vaddr_t);
 
 void	armv11_dcache_wbinv_all (void);
 void	armv11_idcache_wbinv_all(void);
@@ -469,9 +468,17 @@ void	armv7_dcache_inv_range(vaddr_t, vsi
 void	armv7_idcache_wbinv_range(vaddr_t, vsize_t);
 
 void	armv7_icache_sync_all(void);
+
+void	armv7_tlb_flushID(void);
+void	armv7_tlb_flushI(void);
+void	armv7_tlb_flushD(void);
+
+void	armv7_tlb_flushID_SE(vaddr_t);
+void	armv7_tlb_flushI_SE(vaddr_t);
+void	armv7_tlb_flushD_SE(vaddr_t);
+
 void	armv7_cpu_sleep(int);
 void	armv7_context_switch(u_int);
-void	armv7_tlb_flushID_SE(u_int);
 void	armv7_drain_writebuf(void);
 void	armv7_setup(char *string);
 #endif
@@ -484,7 +491,7 @@ void	armv7_idcache_wbinv_all(void);
 #if defined(CPU_PJ4B)
 void	pj4b_setttb(u_int, bool);
 void	pj4b_tlb_flushID(void);
-void	pj4b_tlb_flushID_SE(u_int);
+void	pj4b_tlb_flushID_SE(vaddr_t);
 
 void	pj4b_icache_sync_range(vm_offset_t, vm_size_t);
 void	pj4b_idcache_wbinv_range(vm_offset_t, vm_size_t);
@@ -530,7 +537,7 @@ void	arm1136_sleep_rev0		(int);	/* for e
 void	armv4_tlb_flushID	(void);
 void	armv4_tlb_flushI	(void);
 void	armv4_tlb_flushD	(void);
-void	armv4_tlb_flushD_SE	(u_int);
+void	armv4_tlb_flushD_SE	(vaddr_t);
 
 void	armv4_drain_writebuf	(void);
 #endif
@@ -554,12 

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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 17:27:46 UTC 2014

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_arm11.S

Log Message:
Refactor and cleanup a bit.  Prepare for ASIDs.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/arm/cpufunc_asm_arm11.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/arm/arm/cpufunc_asm_arm11.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_arm11.S:1.10 src/sys/arch/arm/arm/cpufunc_asm_arm11.S:1.11
--- src/sys/arch/arm/arm/cpufunc_asm_arm11.S:1.10	Sun Aug 18 06:28:18 2013
+++ src/sys/arch/arm/arm/cpufunc_asm_arm11.S	Thu Feb 20 17:27:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc_asm_arm11.S,v 1.10 2013/08/18 06:28:18 matt Exp $	*/
+/*	$NetBSD: cpufunc_asm_arm11.S,v 1.11 2014/02/20 17:27:46 matt Exp $	*/
 
 /*
  * Copyright (c) 2002, 2005 ARM Limited
@@ -57,22 +57,6 @@ ENTRY(arm11_setttb)
 	RET
 END(arm11_setttb)
 
-/*
- * TLB functions
- */
-ENTRY(arm11_tlb_flushID_SE)
-	mcr	p15, 0, r0, c8, c6, 1	/* flush D tlb single entry */
-	mcr	p15, 0, r0, c8, c5, 1	/* flush I tlb single entry */
-	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
-	RET
-END(arm11_tlb_flushID_SE)
-
-ENTRY(arm11_tlb_flushI_SE)
-	mcr	p15, 0, r0, c8, c5, 1	/* flush I tlb single entry */
-	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
-	RET
-END(arm11_tlb_flushI_SE)
-
 
 /*
  * Context switch.
@@ -99,30 +83,67 @@ END(arm11_context_switch)
 /*
  * TLB functions
  */
-ENTRY(arm11_tlb_flushID)
-	mcr	p15, 0, r0, c8, c7, 0	/* flush I+D tlb */
-	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
-	RET
-END(arm11_tlb_flushID)
 
 ENTRY(arm11_tlb_flushI)
+	mov	r0, #0
 	mcr	p15, 0, r0, c8, c5, 0	/* flush I tlb */
 	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
 	RET
 END(arm11_tlb_flushI)
 
+ENTRY(arm11_tlb_flushI_SE)
+#ifdef ARM_MMU_EXTENDED
+	orr	r0, r0, r1		/* insert ASID into MVA */
+#endif
+	mcr	p15, 0, r0, c8, c5, 1	/* flush I tlb single entry */
+	mov	r0, #0
+	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
+	RET
+END(arm11_tlb_flushI_SE)
+
 ENTRY(arm11_tlb_flushD)
+	mov	r0, #0
 	mcr	p15, 0, r0, c8, c6, 0	/* flush D tlb */
 	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
 	RET
 END(arm11_tlb_flushD)
 
 ENTRY(arm11_tlb_flushD_SE)
+#ifdef ARM_MMU_EXTENDED
+	orr	r0, r0, r1		/* insert ASID into MVA */
+#endif
 	mcr	p15, 0, r0, c8, c6, 1	/* flush D tlb single entry */
+	mov	r0, #0
 	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
 	RET
 END(arm11_tlb_flushD_SE)
 
+ENTRY(arm11_tlb_flushID)
+	mov	r0, #0
+	mcr	p15, 0, r0, c8, c7, 0	/* flush I+D tlb */
+	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
+	RET
+END(arm11_tlb_flushID)
+
+ENTRY(arm11_tlb_flushID_SE)
+#ifdef ARM_MMU_EXTENDED
+	orr	r0, r0, r1		/* insert ASID into MVA */
+#endif
+	mcr	p15, 0, r0, c8, c7, 1	/* flush I+D tlb single entry */
+	mov	r0, #0
+	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
+	RET
+END(arm11_tlb_flushID_SE)
+
+#ifdef ARM_MMU_EXTENDED
+ENTRY(arm11_tlb_flushID_ASID)
+	mcr	p15, 0, r0, c8, c7, 2	/* flush I+D tlb */
+	mov	r0, #0
+	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
+	RET
+END(arm11_tlb_flushID_ASID)
+#endif
+
 /*
  * Other functions
  */



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 17:38:11 UTC 2014

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_armv7.S

Log Message:
Add armv7 versions of tlb routines.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/arm/cpufunc_asm_armv7.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/arm/arm/cpufunc_asm_armv7.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.13 src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.14
--- src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.13	Thu Feb 20 15:52:30 2014
+++ src/sys/arch/arm/arm/cpufunc_asm_armv7.S	Thu Feb 20 17:38:11 2014
@@ -46,8 +46,8 @@ END(armv7_wait)
 
 ENTRY(armv7_context_switch)
 	dsb@ data synchronization barrier
-	mrc	p15, 0, r2, c0, c0, 5	@ get MPIDR
-	cmp	r2, #0
+	mrc	p15, 0, ip, c0, c0, 5	@ get MPIDR
+	cmp	ip, #0
 	orrlt	r0, r0, #0x5b		@ MP, cachable (Normal WB)
 	orrge	r0, r0, #0x1b		@ Non-MP, cacheable, normal WB
 	mcr	p15, 0, r0, c2, c0, 0 	@ set the new TTB
@@ -61,7 +61,25 @@ ENTRY(armv7_context_switch)
 	bx	lr
 END(armv7_context_switch)
 
+#ifdef ARM_MMU_EXTENDED
+ENTRY(armv7_tlb_flushID_ASID)
+#ifdef MULTIPROCESSOR
+	mcr	p15, 0, r0, c8, c3, 2	@ flush I+D tlb all ASID
+#else
+	mcr	p15, 0, r0, c8, c7, 2	@ flush I+D tlb all ASID
+#endif
+	dsb@ data synchronization barrier
+	isb
+	bx	lr
+END(armv7_tlb_flushID_ASID)
+#endif
+
+STRONG_ALIAS(armv7_tlb_flushD_SE, armv7_tlb_flushID_SE)
+STRONG_ALIAS(armv7_tlb_flushI_SE, armv7_tlb_flushID_SE)
 ENTRY(armv7_tlb_flushID_SE)
+#ifdef ARM_MMU_EXTENDED
+	bfi	r0, r1, #0, #8		@ insert ASID into MVA
+#endif
 #ifdef MULTIPROCESSOR
 	mcr	p15, 0, r0, c8, c3, 1	@ flush I+D tlb single entry
 #else
@@ -72,10 +90,27 @@ ENTRY(armv7_tlb_flushID_SE)
 	bx	lr
 END(armv7_tlb_flushID_SE)
 
+ENTRY(armv7_tlb_flushD)
+	mov	r0, #0
+	mcr	p15, 0, r0, c8, c6, 0	@ flush entire D tlb
+	dsb@ data synchronization barrier
+	isb
+	bx  lr
+END(armv7_tlb_flushD)
+
+STRONG_ALIAS(armv7_tlb_flushI, armv7_tlb_flushID)
+ENTRY(armv7_tlb_flushID)
+	mov	r0, #0
+	mcr	p15, 0, r0, c8, c7, 0	@ flush entire I+D tlb
+	dsb@ data synchronization barrier
+	isb
+	bx  lr
+END(armv7_tlb_flushID)
+
 
 ENTRY_NP(armv7_setttb)
-	mrc	p15, 0, r2, c0, c0, 5	@ get MPIDR
-	cmp	r2, #0
+	mrc	p15, 0, ip, c0, c0, 5	@ get MPIDR
+	cmp	ip, #0
 	orrlt	r0, r0, #0x5b		@ MP, cachable (Normal WB)
 	orrge	r0, r0, #0x1b		@ Non-MP, cacheable, normal WB
 	mcr	p15, 0, r0, c2, c0, 0   @ load new TTB



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 17:38:42 UTC 2014

Modified Files:
src/sys/arch/arm/arm: cpufunc.c

Log Message:
armv7 doens't need to use the arm11 routines anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/arch/arm/arm/cpufunc.c

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

Modified files:

Index: src/sys/arch/arm/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.137 src/sys/arch/arm/arm/cpufunc.c:1.138
--- src/sys/arch/arm/arm/cpufunc.c:1.137	Thu Feb 20 14:48:11 2014
+++ src/sys/arch/arm/arm/cpufunc.c	Thu Feb 20 17:38:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.137 2014/02/20 14:48:11 matt Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.138 2014/02/20 17:38:42 matt Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.137 2014/02/20 14:48:11 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.138 2014/02/20 17:38:42 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_cpuoptions.h
@@ -1292,12 +1292,12 @@ struct cpu_functions cortex_cpufuncs = {
 
 	/* TLB functions */
 
-	.cf_tlb_flushID		= arm11_tlb_flushID,
+	.cf_tlb_flushID		= armv7_tlb_flushID,
 	.cf_tlb_flushID_SE	= armv7_tlb_flushID_SE,
-	.cf_tlb_flushI		= arm11_tlb_flushI,
-	.cf_tlb_flushI_SE	= arm11_tlb_flushI_SE,
-	.cf_tlb_flushD		= arm11_tlb_flushD,
-	.cf_tlb_flushD_SE	= arm11_tlb_flushD_SE,
+	.cf_tlb_flushI		= armv7_tlb_flushI,
+	.cf_tlb_flushI_SE	= armv7_tlb_flushI_SE,
+	.cf_tlb_flushD		= armv7_tlb_flushD,
+	.cf_tlb_flushD_SE	= armv7_tlb_flushD_SE,
 
 	/* Cache operations */
 



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 17:39:59 UTC 2014

Modified Files:
src/sys/arch/arm/conf: files.arm

Log Message:
cpu_cortex doesn't need the arm11 cpufuncs any more


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/arm/conf/files.arm

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

Modified files:

Index: src/sys/arch/arm/conf/files.arm
diff -u src/sys/arch/arm/conf/files.arm:1.123 src/sys/arch/arm/conf/files.arm:1.124
--- src/sys/arch/arm/conf/files.arm:1.123	Tue Nov 12 17:05:09 2013
+++ src/sys/arch/arm/conf/files.arm	Thu Feb 20 17:39:59 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.arm,v 1.123 2013/11/12 17:05:09 matt Exp $
+#	$NetBSD: files.arm,v 1.124 2014/02/20 17:39:59 matt Exp $
 
 # temporary define to allow easy moving to ../arch/arm/arm32
 defflagARM32
@@ -136,7 +136,7 @@ file	arch/arm/arm/cpufunc_asm_arm8.S		cp
 file	arch/arm/arm/cpufunc_asm_arm9.S		cpu_arm9
 file	arch/arm/arm/cpufunc_asm_arm10.S	cpu_arm9e | cpu_arm10 |
 			cpu_sheeva
-file	arch/arm/arm/cpufunc_asm_arm11.S	cpu_arm11 | cpu_cortex
+file	arch/arm/arm/cpufunc_asm_arm11.S	cpu_arm11
 file	arch/arm/arm/cpufunc_asm_arm1136.S	cpu_arm1136
 file	arch/arm/arm/cpufunc_asm_arm11x6.S	cpu_arm1136 | cpu_arm1176
 file	arch/arm/arm/cpufunc_asm_armv4.S	cpu_arm9 | cpu_arm9e |



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

2014-02-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Thu Feb 20 18:14:11 UTC 2014

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

Log Message:
This needs stdint.h in userspace (for uint64_t)


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/x86/include/cpu.h

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

Modified files:

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.62 src/sys/arch/x86/include/cpu.h:1.63
--- src/sys/arch/x86/include/cpu.h:1.62	Sat Feb 15 10:11:15 2014
+++ src/sys/arch/x86/include/cpu.h	Thu Feb 20 18:14:11 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.62 2014/02/15 10:11:15 dsl Exp $	*/
+/*	$NetBSD: cpu.h,v 1.63 2014/02/20 18:14:11 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -40,6 +40,7 @@
 #if defined(_KERNEL) || defined(_STANDALONE)
 #include sys/types.h
 #else
+#include stdint.h
 #include stdbool.h
 #endif /* _KERNEL || _STANDALONE */
 



CVS commit: src/sys

2014-02-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Thu Feb 20 18:19:10 UTC 2014

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf machdep.c
src/sys/arch/amd64/include: pcb.h proc.h
src/sys/arch/i386/i386: locore.S machdep.c
src/sys/arch/i386/include: pcb.h proc.h
src/sys/arch/x86/x86: vm_machdep.c
src/sys/sys: param.h

Log Message:
Move the amd64 and i386 pcb to the bottom of the uarea, and move the
  kernel stack to the top.
Change the pcb layouts so that fpu save area is at the end and is
  64byte aligned ready for xsave (saving the ymm registers).
Welcome to 6.99.32


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.205 -r1.206 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/include/pcb.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/include/proc.h
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.749 -r1.750 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/i386/include/pcb.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/i386/include/proc.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/x86/vm_machdep.c
cvs rdiff -u -r1.440 -r1.441 src/sys/sys/param.h

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

Modified files:

Index: src/sys/arch/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.55 src/sys/arch/amd64/amd64/genassym.cf:1.56
--- src/sys/arch/amd64/amd64/genassym.cf:1.55	Sat Feb 15 10:11:14 2014
+++ src/sys/arch/amd64/amd64/genassym.cf	Thu Feb 20 18:19:09 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.55 2014/02/15 10:11:14 dsl Exp $
+#	$NetBSD: genassym.cf,v 1.56 2014/02/20 18:19:09 dsl Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,6 @@ define	IP_DST			offsetof(struct ip, ip_d
 define	PCB_CR3			offsetof(struct pcb, pcb_cr3)
 define	PCB_RBP			offsetof(struct pcb, pcb_rbp)
 define	PCB_RSP			offsetof(struct pcb, pcb_rsp)
-define	PCB_USERSP		offsetof(struct pcb, pcb_usersp)
 define	PCB_RSP0		offsetof(struct pcb, pcb_rsp0)
 define	PCB_CR0			offsetof(struct pcb, pcb_cr0)
 define	PCB_ONFAULT		offsetof(struct pcb, pcb_onfault)

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.205 src/sys/arch/amd64/amd64/machdep.c:1.206
--- src/sys/arch/amd64/amd64/machdep.c:1.205	Sat Feb 15 22:20:41 2014
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Feb 20 18:19:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.205 2014/02/15 22:20:41 dsl Exp $	*/
+/*	$NetBSD: machdep.c,v 1.206 2014/02/20 18:19:09 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.205 2014/02/15 22:20:41 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.206 2014/02/20 18:19:09 dsl Exp $);
 
 /* #define XENDEBUG_LOW  */
 
@@ -467,7 +467,7 @@ x86_64_proc0_tss_ldt_init(void)
 	pcb-pcb_flags = 0;
 	pcb-pcb_fs = 0;
 	pcb-pcb_gs = 0;
-	pcb-pcb_rsp0 = (uvm_lwp_getuarea(l) + KSTACK_SIZE - 16)  ~0xf;
+	pcb-pcb_rsp0 = (uvm_lwp_getuarea(l) + USPACE - 16)  ~0xf;
 	pcb-pcb_iopl = SEL_KPL;
 
 	pmap_kernel()-pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL);

Index: src/sys/arch/amd64/include/pcb.h
diff -u src/sys/arch/amd64/include/pcb.h:1.24 src/sys/arch/amd64/include/pcb.h:1.25
--- src/sys/arch/amd64/include/pcb.h:1.24	Tue Feb 11 20:17:16 2014
+++ src/sys/arch/amd64/include/pcb.h	Thu Feb 20 18:19:10 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.24 2014/02/11 20:17:16 dsl Exp $	*/
+/*	$NetBSD: pcb.h,v 1.25 2014/02/20 18:19:10 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -72,12 +72,7 @@
 
 #ifdef __x86_64__
 
-#include sys/signal.h
-
-#include machine/segments.h
-#include machine/tss.h
-#include x86/fpu.h
-#include machine/sysarch.h
+#include x86/cpu_extended_state.h
 
 #define	NIOPORTS	1024		/* # of ports we allow to be mapped */
 
@@ -91,16 +86,18 @@ struct pcb {
 	uint64_t pcb_cr3;
 	uint64_t pcb_rsp;
 	uint64_t pcb_rbp;
-	uint64_t pcb_usersp;
-	uint32_t pcb_unused[2];		/* unused */
-	union	savefpu pcb_savefpu __aligned(16); /* floating point state */
-	uint32_t pcb_unused_1[4];	/* unused */
 	void *pcb_onfault;		/* copyin/out fault recovery */
-	struct cpu_info *pcb_fpcpu;	/* cpu holding our fp state. */
 	uint64_t  pcb_fs;
 	uint64_t  pcb_gs;
 	int pcb_iopl;
+
+	uint32_t pcb_unused[11];		/* unused */
+
+	struct cpu_info *pcb_fpcpu;	/* cpu holding our fp state. */
+	union savefpu	pcb_savefpu __aligned(64); /* floating point state */
+	/*  DO NOT ADD ANYTHING HERE  */
 };
+__CTASSERT(sizeof(struct pcb) - sizeof (union savefpu) ==  128);
 
 #else	/*	__x86_64__	*/
 

Index: src/sys/arch/amd64/include/proc.h
diff -u src/sys/arch/amd64/include/proc.h:1.18 src/sys/arch/amd64/include/proc.h:1.19
--- src/sys/arch/amd64/include/proc.h:1.18	Sat Feb 15 

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

2014-02-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Thu Feb 20 18:20:39 UTC 2014

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

Log Message:
This doesn't need fpu.h, but should include ucontext.h


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/frame.h

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

Modified files:

Index: src/sys/arch/amd64/include/frame.h
diff -u src/sys/arch/amd64/include/frame.h:1.16 src/sys/arch/amd64/include/frame.h:1.17
--- src/sys/arch/amd64/include/frame.h:1.16	Tue Feb 11 20:17:16 2014
+++ src/sys/arch/amd64/include/frame.h	Thu Feb 20 18:20:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.16 2014/02/11 20:17:16 dsl Exp $	*/
+/*	$NetBSD: frame.h,v 1.17 2014/02/20 18:20:39 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 #ifdef __x86_64__
 
 #include sys/signal.h
-#include x86/fpu.h
+#include sys/ucontext.h
 #include machine/frame_regs.h
 
 /*
@@ -119,6 +119,7 @@ struct sigframe_siginfo {
 };
 
 #ifdef _KERNEL
+struct lwp;
 void buildcontext(struct lwp *, void *, void *);
 #endif
 



CVS commit: src/bin/ls

2014-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 20 18:56:36 UTC 2014

Modified Files:
src/bin/ls: ls.1 ls.c ls.h print.c

Log Message:
Add -O (only leaf files) and -P (print full path), from tls@


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/bin/ls/ls.1
cvs rdiff -u -r1.70 -r1.71 src/bin/ls/ls.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ls/ls.h
cvs rdiff -u -r1.52 -r1.53 src/bin/ls/print.c

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

Modified files:

Index: src/bin/ls/ls.1
diff -u src/bin/ls/ls.1:1.72 src/bin/ls/ls.1:1.73
--- src/bin/ls/ls.1:1.72	Tue Nov 20 07:37:29 2012
+++ src/bin/ls/ls.1	Thu Feb 20 13:56:36 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: ls.1,v 1.72 2012/11/20 12:37:29 abs Exp $
+.\	$NetBSD: ls.1,v 1.73 2014/02/20 18:56:36 christos Exp $
 .\
 .\ Copyright (c) 1980, 1990, 1991, 1993, 1994
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\ @(#)ls.1	8.7 (Berkeley) 7/29/94
 .\
-.Dd November 20, 2012
+.Dd February 20, 2014
 .Dt LS 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd list directory contents
 .Sh SYNOPSIS
 .Nm
-.Op Fl 1AaBbCcdFfghikLlMmnopqRrSsTtuWwx
+.Op Fl 1AaBbCcdFfghikLlMmnOoPpqRrSsTtuWwx
 .Op Ar
 .Sh DESCRIPTION
 For each
@@ -183,6 +183,8 @@ The same as
 except that
 the owner and group IDs are displayed numerically rather than converting
 to a owner or group name.
+.It Fl O
+Output only leaf files (not directories), eliding other ls output.
 .It Fl o
 Include the file flags in a long
 .Pq Fl l
@@ -193,6 +195,8 @@ is displayed.
 (See
 .Xr chflags 1
 for a list of possible flags and their meanings.)
+.It Fl P
+Print the full pathname for each file.
 .It Fl p
 Display a slash
 .Pq Sq \/

Index: src/bin/ls/ls.c
diff -u src/bin/ls/ls.c:1.70 src/bin/ls/ls.c:1.71
--- src/bin/ls/ls.c:1.70	Tue Nov 20 07:37:29 2012
+++ src/bin/ls/ls.c	Thu Feb 20 13:56:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ls.c,v 1.70 2012/11/20 12:37:29 abs Exp $	*/
+/*	$NetBSD: ls.c,v 1.71 2014/02/20 18:56:36 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = @(#)ls.c	8.7 (Berkeley) 8/5/94;
 #else
-__RCSID($NetBSD: ls.c,v 1.70 2012/11/20 12:37:29 abs Exp $);
+__RCSID($NetBSD: ls.c,v 1.71 2014/02/20 18:56:36 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -111,6 +111,8 @@ int f_stream;			/* stream format */
 int f_type;			/* add type character for non-regular files */
 int f_typedir;			/* add type character for directories */
 int f_whiteout;			/* show whiteout entries */
+int f_fullpath;			/* print full pathname, not filename */
+int f_leafonly;			/* when recursing, print leaf names only */
 
 __dead static void
 usage(void)
@@ -149,7 +151,7 @@ ls_main(int argc, char *argv[])
 		f_listdot = 1;
 
 	fts_options = FTS_PHYSICAL;
-	while ((ch = getopt(argc, argv, 1ABCFLMRSTWabcdfghiklmnopqrstuwx)) != -1) {
+	while ((ch = getopt(argc, argv, 1ABCFLMOPRSTWabcdfghiklmnopqrstuwx)) != -1) {
 		switch (ch) {
 		/*
 		 * The -1, -C, -l, -m and -x options all override each other so
@@ -253,9 +255,15 @@ ls_main(int argc, char *argv[])
 			f_longform = 1;
 			f_column = f_columnacross = f_singlecol = f_stream = 0;
 			break;
+		case 'O':
+			f_leafonly = 1;
+			break;
 		case 'o':
 			f_flags = 1;
 			break;
+		case 'P':
+			f_fullpath = 1;
+			break;
 		case 'p':
 			f_typedir = 1;
 			break;
@@ -446,11 +454,13 @@ traverse(int argc, char *argv[], int opt
 			 * a separator.  If multiple arguments, precede each
 			 * directory with its name.
 			 */
-			if (output)
-(void)printf(\n%s:\n, p-fts_path);
-			else if (argc  1) {
-(void)printf(%s:\n, p-fts_path);
-output = 1;
+			if (!f_leafonly) {
+if (output)
+	(void)printf(\n%s:\n, p-fts_path);
+else if (argc  1) {
+	(void)printf(%s:\n, p-fts_path);
+	output = 1;
+}
 			}
 
 			chp = fts_children(ftsp, ch_options);

Index: src/bin/ls/ls.h
diff -u src/bin/ls/ls.h:1.18 src/bin/ls/ls.h:1.19
--- src/bin/ls/ls.h:1.18	Mon Mar 14 23:52:38 2011
+++ src/bin/ls/ls.h	Thu Feb 20 13:56:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ls.h,v 1.18 2011/03/15 03:52:38 erh Exp $	*/
+/*	$NetBSD: ls.h,v 1.19 2014/02/20 18:56:36 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -53,6 +53,8 @@ extern int f_statustime;	/* use time of 
 extern int f_type;		/* add type character for non-regular files */
 extern int f_typedir;		/* add type character for directories */
 extern int f_nonprint;		/* show unprintables as ? */
+extern int f_fullpath;		/* print full pathname, not filename */
+extern int f_leafonly;		/* when recursing, print leaf names only */
 
 typedef struct {
 	FTSENT *list;

Index: src/bin/ls/print.c
diff -u src/bin/ls/print.c:1.52 src/bin/ls/print.c:1.53
--- src/bin/ls/print.c:1.52	Thu May  2 18:43:55 2013
+++ src/bin/ls/print.c	Thu Feb 20 13:56:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.52 2013/05/02 22:43:55 zafer Exp $	

CVS commit: src/bin/ls

2014-02-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 20 19:10:25 UTC 2014

Modified Files:
src/bin/ls: ls.1

Log Message:
Use .Nm for 'ls'.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/bin/ls/ls.1

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

Modified files:

Index: src/bin/ls/ls.1
diff -u src/bin/ls/ls.1:1.73 src/bin/ls/ls.1:1.74
--- src/bin/ls/ls.1:1.73	Thu Feb 20 18:56:36 2014
+++ src/bin/ls/ls.1	Thu Feb 20 19:10:25 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: ls.1,v 1.73 2014/02/20 18:56:36 christos Exp $
+.\	$NetBSD: ls.1,v 1.74 2014/02/20 19:10:25 wiz Exp $
 .\
 .\ Copyright (c) 1980, 1990, 1991, 1993, 1994
 .\	The Regents of the University of California.  All rights reserved.
@@ -184,7 +184,9 @@ except that
 the owner and group IDs are displayed numerically rather than converting
 to a owner or group name.
 .It Fl O
-Output only leaf files (not directories), eliding other ls output.
+Output only leaf files (not directories), eliding other
+.Nm
+output.
 .It Fl o
 Include the file flags in a long
 .Pq Fl l



CVS commit: src/sys/dev

2014-02-20 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu Feb 20 19:47:19 UTC 2014

Modified Files:
src/sys/dev: DEVNAMES

Log Message:
(Belatedly) add lmenv.


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/sys/dev/DEVNAMES

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/DEVNAMES
diff -u src/sys/dev/DEVNAMES:1.285 src/sys/dev/DEVNAMES:1.286
--- src/sys/dev/DEVNAMES:1.285	Sat Sep  7 17:23:55 2013
+++ src/sys/dev/DEVNAMES	Thu Feb 20 19:47:19 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: DEVNAMES,v 1.285 2013/09/07 17:23:55 rkujawa Exp $
+#	$NetBSD: DEVNAMES,v 1.286 2014/02/20 19:47:19 jdc Exp $
 #
 # This file contains all used device names and defined attributes in
 # alphabetical order. New devices added to the system somewhere should first
@@ -767,6 +767,7 @@ lkms			vax
 lm			MI
 lm700x			MI
 lmc			MI
+lmenv			MI
 lms			bebox
 lms			i386
 lockstat		MI



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 20:36:29 UTC 2014

Modified Files:
src/sys/arch/arm/cortex [matt-nb5-mips64]: a9_mpsubr.S

Log Message:
Use right register when setting ttbr


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/arch/arm/cortex/a9_mpsubr.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/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.12.2.2 src/sys/arch/arm/cortex/a9_mpsubr.S:1.12.2.3
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.12.2.2	Sat Feb 15 16:18:36 2014
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Thu Feb 20 20:36:29 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.12.2.2 2014/02/15 16:18:36 matt Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.12.2.3 2014/02/20 20:36:29 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -178,7 +178,7 @@ arm_cpuinit:
 	cmp	r1, #0
 	orrlt	r10, r10, #0x5b		/* MP, cachable (Normal WB) */
 	orrge	r10, r10, #0x1b		/* Non-MP, cacheable, normal WB */
-	mcr	p15, 0, r1, c2, c0, 0	/* Set Translation Table Base */
+	mcr	p15, 0, r10, c2, c0, 0	/* Set Translation Table Base */
 
 	XPUTC(#49)
 	mov	r1, #0



CVS commit: src/common/lib/libc/arch/m68k/atomic

2014-02-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 20 20:39:01 UTC 2014

Modified Files:
src/common/lib/libc/arch/m68k/atomic: Makefile.inc atomic_add.S
atomic_and.S atomic_or.S
Added Files:
src/common/lib/libc/arch/m68k/atomic: atomic_nand.S atomic_sub.S
atomic_xor.S

Log Message:
Add missing __sync_* ops


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/common/lib/libc/arch/m68k/atomic/Makefile.inc
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/m68k/atomic/atomic_add.S
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/m68k/atomic/atomic_and.S \
src/common/lib/libc/arch/m68k/atomic/atomic_or.S
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/m68k/atomic/atomic_nand.S \
src/common/lib/libc/arch/m68k/atomic/atomic_sub.S \
src/common/lib/libc/arch/m68k/atomic/atomic_xor.S

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

Modified files:

Index: src/common/lib/libc/arch/m68k/atomic/Makefile.inc
diff -u src/common/lib/libc/arch/m68k/atomic/Makefile.inc:1.11 src/common/lib/libc/arch/m68k/atomic/Makefile.inc:1.12
--- src/common/lib/libc/arch/m68k/atomic/Makefile.inc:1.11	Wed Jan 29 10:20:11 2014
+++ src/common/lib/libc/arch/m68k/atomic/Makefile.inc	Thu Feb 20 20:39:01 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.11 2014/01/29 10:20:11 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.12 2014/02/20 20:39:01 martin Exp $
 
 #
 # Note: The atomic operations here in these assembly files are atomic
@@ -14,7 +14,8 @@
 .if ${MACHINE_ARCH} == m68k
 
 SRCS+=	atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \
-	atomic_inc.S atomic_or.S atomic_swap.S membar_ops_nop.c
+	atomic_inc.S atomic_or.S atomic_swap.S membar_ops_nop.c \
+	atomic_sub.S atomic_xor.S atomic_nand.S
 
 .else
 

Index: src/common/lib/libc/arch/m68k/atomic/atomic_add.S
diff -u src/common/lib/libc/arch/m68k/atomic/atomic_add.S:1.7 src/common/lib/libc/arch/m68k/atomic/atomic_add.S:1.8
--- src/common/lib/libc/arch/m68k/atomic/atomic_add.S:1.7	Tue Feb 18 16:19:28 2014
+++ src/common/lib/libc/arch/m68k/atomic/atomic_add.S	Thu Feb 20 20:39:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_add.S,v 1.7 2014/02/18 16:19:28 martin Exp $	*/
+/*	$NetBSD: atomic_add.S,v 1.8 2014/02/20 20:39:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -68,6 +68,17 @@ ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomi
 STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv)
 STRONG_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv)
 
+ENTRY(__sync_fetch_and_add_4)
+	movl	4(%sp), %a0
+1:	movl	(%a0), %d0
+	movl	%d0, %d1
+	addl	8(%sp), %d1
+	casl	%d0, %d1, (%a0)
+	bne	1b
+	movl	%d0, %a0	/* pointers return also in %a0 */
+	rts
+END(__sync_fetch_and_add_4)
+
 ENTRY(_atomic_add_16_nv)
 	movl	4(%sp), %a0
 1:	movw	(%a0), %d0
@@ -80,6 +91,16 @@ END(_atomic_add_16_nv)
 
 STRONG_ALIAS(__sync_add_and_fetch_2,_atomic_add_16_nv)
 
+ENTRY(__sync_fetch_and_add_2)
+	movl	4(%sp), %a0
+1:	movw	(%a0), %d0
+	movw	%d0, %d1
+	addw	8(%sp), %d1
+	casw	%d0, %d1, (%a0)
+	bne	1b
+	rts
+END(__sync_fetch_and_add_2)
+
 ENTRY(_atomic_add_8_nv)
 	movl	4(%sp), %a0
 1:	movb	(%a0), %d0
@@ -91,3 +112,13 @@ ENTRY(_atomic_add_8_nv)
 END(_atomic_add_8_nv)
 
 STRONG_ALIAS(__sync_add_and_fetch_1,_atomic_add_8_nv)
+
+ENTRY(__sync_fetch_and_add_1)
+	movl	4(%sp), %a0
+1:	movb	(%a0), %d0
+	movb	%d0, %d1
+	addb	8(%sp), %d1
+	casb	%d0, %d1, (%a0)
+	bne	1b
+	rts
+END(__sync_fetch_and_add_1)

Index: src/common/lib/libc/arch/m68k/atomic/atomic_and.S
diff -u src/common/lib/libc/arch/m68k/atomic/atomic_and.S:1.8 src/common/lib/libc/arch/m68k/atomic/atomic_and.S:1.9
--- src/common/lib/libc/arch/m68k/atomic/atomic_and.S:1.8	Tue Jul 16 23:24:18 2013
+++ src/common/lib/libc/arch/m68k/atomic/atomic_and.S	Thu Feb 20 20:39:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_and.S,v 1.8 2013/07/16 23:24:18 matt Exp $	*/
+/*	$NetBSD: atomic_and.S,v 1.9 2014/02/20 20:39:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -54,6 +54,7 @@ ENTRY(_atomic_and_32_nv)
 	andl	8(%sp), %d0
 	casl	%d1, %d0, (%a0)
 	bne	1b
+	movl	%d0, %a0
 	rts
 END(_atomic_and_32_nv)
 ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv)
@@ -63,3 +64,63 @@ ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_ato
 STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv)
 ATOMIC_OP_ALIAS(atomic_and_ptr_nv,_atomic_and_32_nv)
 STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_32_nv)
+STRONG_ALIAS(__sync_and_and_fetch_4,_atomic_and_32_nv)
+
+ENTRY(__sync_fetch_and_and_4)
+	movl	4(%sp), %a0
+1:	movl	(%a0), %d0
+	movl	%d0, %d1
+	andl	8(%sp), %d1
+	casl	%d0, %d1, (%a0)
+	bne	1b
+	movl	%d0, %a0
+	rts
+END(__sync_fetch_and_and_4)
+
+
+ENTRY(_atomic_and_16_nv)
+	movl	4(%sp), %a0
+1:	movw	(%a0), %d0
+	movw	%d0, %d1
+	andw	8(%sp), %d0
+	casw	%d1, %d0, (%a0)
+	bne	1b
+	rts
+END(_atomic_and_16_nv)
+
+STRONG_ALIAS(__sync_and_and_fetch_2,_atomic_and_16_nv)
+
+ENTRY(__sync_fetch_and_and_2)
+	movl	4(%sp), %a0
+1:	movw	(%a0), %d0
+	movw	%d0, %d1

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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 21:45:06 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_var.h

Log Message:
Add prototype for awin_cpu_hatch


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/allwinner/awin_var.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/arm/allwinner/awin_var.h
diff -u src/sys/arch/arm/allwinner/awin_var.h:1.6 src/sys/arch/arm/allwinner/awin_var.h:1.7
--- src/sys/arch/arm/allwinner/awin_var.h:1.6	Sat Sep  7 19:47:28 2013
+++ src/sys/arch/arm/allwinner/awin_var.h	Thu Feb 20 21:45:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_var.h,v 1.6 2013/09/07 19:47:28 matt Exp $ */
+/* $NetBSD: awin_var.h,v 1.7 2014/02/20 21:45:06 matt Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -79,6 +79,7 @@ extern struct arm32_bus_dma_tag awin_dma
 psize_t awin_memprobe(void);
 void	awin_bootstrap(vaddr_t, vaddr_t); 
 void	awin_pll6_enable(void);
+void	awin_cpu_hatch(struct cpu_info *);
 
 void	awin_gpio_init(void);
 bool	awin_gpio_pinset_available(const struct awin_gpio_pinset *);



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 21:45:49 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_space.c

Log Message:
Add support for running BE


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

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

Modified files:

Index: src/sys/arch/arm/allwinner/awin_space.c
diff -u src/sys/arch/arm/allwinner/awin_space.c:1.2 src/sys/arch/arm/allwinner/awin_space.c:1.3
--- src/sys/arch/arm/allwinner/awin_space.c:1.2	Thu Jan 23 19:26:55 2014
+++ src/sys/arch/arm/allwinner/awin_space.c	Thu Feb 20 21:45:49 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_space.c,v 1.2 2014/01/23 19:26:55 matt Exp $	*/
+/*	$NetBSD: awin_space.c,v 1.3 2014/02/20 21:45:49 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awin_space.c,v 1.2 2014/01/23 19:26:55 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: awin_space.c,v 1.3 2014/02/20 21:45:49 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -193,14 +193,14 @@ struct bus_space awin_a4x_bs_tag = {
 
 	/* read (single) */
 	a4x_bs_r_1,
-	a4x_bs_r_2,
-	a4x_bs_r_4,
+	NSWAP(a4x_bs_r_2),
+	NSWAP(a4x_bs_r_4),
 	bs_notimpl_bs_r_8,
 
 	/* read multiple */
 	a4x_bs_rm_1,
-	a4x_bs_rm_2,
-	a4x_bs_rm_4,
+	NSWAP(a4x_bs_rm_2),
+	NSWAP(a4x_bs_rm_4),
 	bs_notimpl_bs_rm_8,
 
 	/* read region */
@@ -211,14 +211,14 @@ struct bus_space awin_a4x_bs_tag = {
 
 	/* write (single) */
 	a4x_bs_w_1,
-	a4x_bs_w_2,
-	a4x_bs_w_4,
+	NSWAP(a4x_bs_w_2),
+	NSWAP(a4x_bs_w_4),
 	bs_notimpl_bs_w_8,
 
 	/* write multiple */
 	a4x_bs_wm_1,
-	a4x_bs_wm_2,
-	a4x_bs_wm_4,
+	NSWAP(a4x_bs_wm_2),
+	NSWAP(a4x_bs_wm_4),
 	bs_notimpl_bs_wm_8,
 
 	/* write region */
@@ -248,38 +248,38 @@ struct bus_space awin_a4x_bs_tag = {
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
 	/* read (single) */
 	a4x_bs_r_1,
-	a4x_bs_r_2,
-	a4x_bs_r_4,
+	NSWAP(a4x_bs_r_2),
+	NSWAP(a4x_bs_r_4),
 	bs_notimpl_bs_r_8,
 
 	/* read multiple */
 	a4x_bs_rm_1,
-	a4x_bs_rm_2,
-	a4x_bs_rm_4,
+	NSWAP(a4x_bs_rm_2),
+	NSWAP(a4x_bs_rm_4),
 	bs_notimpl_bs_rm_8,
 
 	/* read region */
 	a4x_bs_rr_1,
-	a4x_bs_rr_2,
-	a4x_bs_rr_4,
+	NSWAP(a4x_bs_rr_2),
+	NSWAP(a4x_bs_rr_4),
 	bs_notimpl_bs_rr_8,
 
 	/* write (single) */
 	a4x_bs_w_1,
-	a4x_bs_w_2,
-	a4x_bs_w_4,
+	NSWAP(a4x_bs_w_2),
+	NSWAP(a4x_bs_w_4),
 	bs_notimpl_bs_w_8,
 
 	/* write multiple */
 	a4x_bs_wm_1,
-	a4x_bs_wm_2,
-	a4x_bs_wm_4,
+	NSWAP(a4x_bs_wm_2),
+	NSWAP(a4x_bs_wm_4),
 	bs_notimpl_bs_wm_8,
 
 	/* write region */
 	a4x_bs_wr_1,
-	a4x_bs_wr_2,
-	a4x_bs_wr_4,
+	NSWAP(a4x_bs_wr_2),
+	NSWAP(a4x_bs_wr_4),
 	bs_notimpl_bs_wr_8,
 #endif
 };



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 21:46:14 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_board.c

Log Message:
Include gtmr_var.h


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/allwinner/awin_board.c

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

Modified files:

Index: src/sys/arch/arm/allwinner/awin_board.c
diff -u src/sys/arch/arm/allwinner/awin_board.c:1.6 src/sys/arch/arm/allwinner/awin_board.c:1.7
--- src/sys/arch/arm/allwinner/awin_board.c:1.6	Mon Sep  9 17:53:36 2013
+++ src/sys/arch/arm/allwinner/awin_board.c	Thu Feb 20 21:46:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_board.c,v 1.6 2013/09/09 17:53:36 matt Exp $	*/
+/*	$NetBSD: awin_board.c,v 1.7 2014/02/20 21:46:14 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_board.c,v 1.6 2013/09/09 17:53:36 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_board.c,v 1.7 2014/02/20 21:46:14 matt Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -51,6 +51,8 @@ __KERNEL_RCSID(1, $NetBSD: awin_board.c
 #include arm/allwinner/awin_reg.h
 #include arm/allwinner/awin_var.h
 
+#include arm/cortex/gtmr_var.h
+
 bus_space_handle_t awin_core_bsh;
 
 struct arm32_bus_dma_tag awin_dma_tag = {



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 21:48:38 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_com.c awin_gige.c awin_gpio.c
awin_icu.c awin_io.c awin_nand.c awin_sdhc.c awin_tmr.c awin_twi.c
awin_usb.c awin_wdc.c awin_wdt.c

Log Message:
#include sys/param.h


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/allwinner/awin_com.c \
src/sys/arch/arm/allwinner/awin_sdhc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/allwinner/awin_gige.c \
src/sys/arch/arm/allwinner/awin_twi.c \
src/sys/arch/arm/allwinner/awin_wdt.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/allwinner/awin_gpio.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/allwinner/awin_icu.c \
src/sys/arch/arm/allwinner/awin_nand.c \
src/sys/arch/arm/allwinner/awin_tmr.c \
src/sys/arch/arm/allwinner/awin_wdc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/allwinner/awin_io.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/allwinner/awin_usb.c

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

Modified files:

Index: src/sys/arch/arm/allwinner/awin_com.c
diff -u src/sys/arch/arm/allwinner/awin_com.c:1.3 src/sys/arch/arm/allwinner/awin_com.c:1.4
--- src/sys/arch/arm/allwinner/awin_com.c:1.3	Sat Sep  7 01:50:12 2013
+++ src/sys/arch/arm/allwinner/awin_com.c	Thu Feb 20 21:48:38 2014
@@ -31,8 +31,9 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_com.c,v 1.3 2013/09/07 01:50:12 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_com.c,v 1.4 2014/02/20 21:48:38 matt Exp $);
 
+#include sys/param.h
 #include sys/bus.h
 #include sys/device.h
 #include sys/intr.h
Index: src/sys/arch/arm/allwinner/awin_sdhc.c
diff -u src/sys/arch/arm/allwinner/awin_sdhc.c:1.3 src/sys/arch/arm/allwinner/awin_sdhc.c:1.4
--- src/sys/arch/arm/allwinner/awin_sdhc.c:1.3	Sat Sep  7 00:35:52 2013
+++ src/sys/arch/arm/allwinner/awin_sdhc.c	Thu Feb 20 21:48:38 2014
@@ -31,8 +31,9 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_sdhc.c,v 1.3 2013/09/07 00:35:52 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_sdhc.c,v 1.4 2014/02/20 21:48:38 matt Exp $);
 
+#include sys/param.h
 #include sys/bus.h
 #include sys/device.h
 #include sys/intr.h

Index: src/sys/arch/arm/allwinner/awin_gige.c
diff -u src/sys/arch/arm/allwinner/awin_gige.c:1.2 src/sys/arch/arm/allwinner/awin_gige.c:1.3
--- src/sys/arch/arm/allwinner/awin_gige.c:1.2	Sun Sep  8 04:06:44 2013
+++ src/sys/arch/arm/allwinner/awin_gige.c	Thu Feb 20 21:48:38 2014
@@ -31,8 +31,9 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_gige.c,v 1.2 2013/09/08 04:06:44 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_gige.c,v 1.3 2014/02/20 21:48:38 matt Exp $);
 
+#include sys/param.h
 #include sys/bus.h
 #include sys/device.h
 #include sys/intr.h
Index: src/sys/arch/arm/allwinner/awin_twi.c
diff -u src/sys/arch/arm/allwinner/awin_twi.c:1.2 src/sys/arch/arm/allwinner/awin_twi.c:1.3
--- src/sys/arch/arm/allwinner/awin_twi.c:1.2	Sat Sep  7 00:35:52 2013
+++ src/sys/arch/arm/allwinner/awin_twi.c	Thu Feb 20 21:48:38 2014
@@ -31,8 +31,9 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_twi.c,v 1.2 2013/09/07 00:35:52 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_twi.c,v 1.3 2014/02/20 21:48:38 matt Exp $);
 
+#include sys/param.h
 #include sys/bus.h
 #include sys/device.h
 #include sys/intr.h
Index: src/sys/arch/arm/allwinner/awin_wdt.c
diff -u src/sys/arch/arm/allwinner/awin_wdt.c:1.2 src/sys/arch/arm/allwinner/awin_wdt.c:1.3
--- src/sys/arch/arm/allwinner/awin_wdt.c:1.2	Wed Sep  4 17:45:40 2013
+++ src/sys/arch/arm/allwinner/awin_wdt.c	Thu Feb 20 21:48:38 2014
@@ -33,8 +33,9 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_wdt.c,v 1.2 2013/09/04 17:45:40 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_wdt.c,v 1.3 2014/02/20 21:48:38 matt Exp $);
 
+#include sys/param.h
 #include sys/bus.h
 #include sys/device.h
 #include sys/intr.h

Index: src/sys/arch/arm/allwinner/awin_gpio.c
diff -u src/sys/arch/arm/allwinner/awin_gpio.c:1.7 src/sys/arch/arm/allwinner/awin_gpio.c:1.8
--- src/sys/arch/arm/allwinner/awin_gpio.c:1.7	Thu Dec 19 22:13:38 2013
+++ src/sys/arch/arm/allwinner/awin_gpio.c	Thu Feb 20 21:48:38 2014
@@ -32,8 +32,9 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_gpio.c,v 1.7 2013/12/19 22:13:38 joerg Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_gpio.c,v 1.8 2014/02/20 21:48:38 matt Exp $);
 
+#include sys/param.h
 #include sys/bus.h
 #include sys/device.h
 #include sys/intr.h

Index: src/sys/arch/arm/allwinner/awin_icu.c
diff -u src/sys/arch/arm/allwinner/awin_icu.c:1.1 src/sys/arch/arm/allwinner/awin_icu.c:1.2
--- src/sys/arch/arm/allwinner/awin_icu.c:1.1	Wed Sep  4 02:39:01 2013
+++ src/sys/arch/arm/allwinner/awin_icu.c	Thu Feb 20 21:48:38 2014
@@ -31,8 +31,9 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_icu.c,v 1.1 2013/09/04 02:39:01 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_icu.c,v 1.2 

CVS commit: src/doc

2014-02-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 20 22:01:24 UTC 2014

Modified Files:
src/doc: 3RDPARTY

Log Message:
tmux-1.9 out.


To generate a diff of this commit:
cvs rdiff -u -r1.1094 -r1.1095 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.1094 src/doc/3RDPARTY:1.1095
--- src/doc/3RDPARTY:1.1094	Wed Feb 19 07:39:52 2014
+++ src/doc/3RDPARTY	Thu Feb 20 22:01:24 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1094 2014/02/19 07:39:52 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1095 2014/02/20 22:01:24 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1220,7 +1220,7 @@ for the import.
 
 Package:	tmux
 Version:	1.5
-Current Vers:	1.8
+Current Vers:	1.9
 Maintainer:	Nicholas Marriott n...@users.sourceforge.net
 Archive site:	http://downloads.sourceforge.net/tmux/
 Home page:	http://tmux.sourceforge.net/



CVS commit: src/sys/arch/arm

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 20 23:24:55 UTC 2014

Modified Files:
src/sys/arch/arm/arm: cpufunc.c
src/sys/arch/arm/arm32: cpu.c
src/sys/arch/arm/include: cpufunc.h

Log Message:
Keep track of what each cache is (VIVT/VIPT/PIPT).

cpu0: 32KB/32B 2-way L1 VIPT Instruction cache
cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
cpu0: 256KB/64B 8-way write-through L2 PIPT Unified cache


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/arm/arm/cpufunc.c
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/arm/include/cpufunc.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/arm/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.138 src/sys/arch/arm/arm/cpufunc.c:1.139
--- src/sys/arch/arm/arm/cpufunc.c:1.138	Thu Feb 20 17:38:42 2014
+++ src/sys/arch/arm/arm/cpufunc.c	Thu Feb 20 23:24:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.138 2014/02/20 17:38:42 matt Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.139 2014/02/20 23:24:55 matt Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.138 2014/02/20 17:38:42 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.139 2014/02/20 23:24:55 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_cpuoptions.h
@@ -1509,7 +1509,7 @@ get_cacheinfo_clidr(struct arm_cache_inf
 	u_int nsets;
 
 	if (clidr  6) {
-		csid = get_cachesize_cp15(level  1); /* select L1 dcache values */
+		csid = get_cachesize_cp15(level  1); /* select dcache values */
 		nsets = CPU_CSID_NUMSETS(csid) + 1;
 		info-dcache_ways = CPU_CSID_ASSOC(csid) + 1;
 		info-dcache_line_size = 1U  (CPU_CSID_LEN(csid) + 4);
@@ -1518,22 +1518,32 @@ get_cacheinfo_clidr(struct arm_cache_inf
 		if (level == 0) {
 			arm_dcache_log2_assoc = CPU_CSID_ASSOC(csid) + 1;
 			arm_dcache_log2_linesize = CPU_CSID_LEN(csid) + 4;
-			arm_dcache_log2_nsets = 31 - __builtin_clz(nsets);
+			arm_dcache_log2_nsets = 31 - __builtin_clz(nsets*2-1);
 		}
 	}
 
 	info-cache_unified = (clidr == 4);
 
-	if (clidr  1) {
-		csid = get_cachesize_cp15((level  1)|CPU_CSSR_InD); /* select L1 icache values */
+	if (level  0) {
+		info-dcache_type = CACHE_TYPE_PIPT;
+		info-icache_type = CACHE_TYPE_PIPT;
+	}
+
+	if (info-cache_unified) {
+		info-icache_ways = info-dcache_ways;
+		info-icache_line_size = info-dcache_line_size;
+		info-icache_size = info-dcache_size;
+	} else {
+		csid = get_cachesize_cp15((level  1)|CPU_CSSR_InD); /* select icache values */
 		nsets = CPU_CSID_NUMSETS(csid) + 1;
 		info-icache_ways = CPU_CSID_ASSOC(csid) + 1;
 		info-icache_line_size = 1U  (CPU_CSID_LEN(csid) + 4);
 		info-icache_size = info-icache_line_size * info-icache_ways * nsets;
-	} else {
-		info-icache_ways = info-dcache_ways;
-		info-icache_line_size = info-dcache_line_size;
-		info-icache_size = info-dcache_size;
+	}
+	if (level == 0
+	 info-dcache_size / info-dcache_ways = PAGE_SIZE
+	 info-icache_size / info-icache_ways = PAGE_SIZE) {
+		arm_cache_prefer_mask = 0;
 	}
 }
 #endif /* (ARM_MMU_V6 + ARM_MMU_V7)  0 */
@@ -1561,9 +1571,20 @@ get_cachetype_cp15(void)
 	if (CPU_CT_FORMAT(ctype) == 4) {
 		u_int clidr = armreg_clidr_read();
 
-		if (CPU_CT4_L1IPOLICY(ctype) != CPU_CT4_L1_PIPT) {
+		if (CPU_CT4_L1IPOLICY(ctype) == CPU_CT4_L1_PIPT) {
+			arm_pcache.icache_type = CACHE_TYPE_PIPT;
+		} else {
+			arm_pcache.icache_type = CACHE_TYPE_VIPT;
 			arm_cache_prefer_mask = PAGE_SIZE;
 		}
+#ifdef CPU_CORTEX
+		if (CPU_ID_CORTEX_P(cpu_id())) {
+			arm_pcache.dcache_type = CACHE_TYPE_PIPT;
+		} else
+#endif
+		{
+			arm_pcache.dcache_type = CACHE_TYPE_VIPT;
+		}
 		arm_pcache.cache_type = CPU_CT_CTYPE_WB14;
 
 		get_cacheinfo_clidr(arm_pcache, 0, clidr  7);
@@ -1574,6 +1595,9 @@ get_cachetype_cp15(void)
 			if (arm_scache.dcache_line_size  arm_dcache_align)
 arm_dcache_align = arm_scache.dcache_line_size;
 		}
+		if (arm_pcache.dcache_type == CACHE_TYPE_PIPT) {
+			arm_cache_prefer_mask = 0;
+		}
 		goto out;
 	}
 #endif /* ARM_MMU_V6 + ARM_MMU_V7  0 */
@@ -1600,6 +1624,7 @@ get_cachetype_cp15(void)
 			arm_pcache.icache_ways = multiplier 
 			(CPU_CT_xSIZE_ASSOC(isize) - 1);
 #if (ARM_MMU_V6 + ARM_MMU_V7)  0
+			arm_pcache.icache_type = CACHE_TYPE_VIPT;
 			if (CPU_CT_xSIZE_P  isize)
 arm_cache_prefer_mask |=
 __BIT(9 + CPU_CT_xSIZE_SIZE(isize)
@@ -1621,11 +1646,14 @@ get_cachetype_cp15(void)
 	} else {
 		arm_pcache.dcache_ways = multiplier 
 		(CPU_CT_xSIZE_ASSOC(dsize) - 1);
-#if (ARM_MMU_V6 + ARM_MMU_V7)  0
-		if (CPU_CT_xSIZE_P  dsize)
+#if (ARM_MMU_V6)  0
+		arm_pcache.dcache_type = CACHE_TYPE_VIPT;
+		if ((CPU_CT_xSIZE_P  dsize)
+		 CPU_ID_ARM11_P(curcpu()-ci_arm_cpuid)) {
 			arm_cache_prefer_mask |=
 			__BIT(9 + CPU_CT_xSIZE_SIZE(dsize)
   - 

CVS commit: src/crypto/external/bsd/netpgp/dist

2014-02-20 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Fri Feb 21 01:55:10 UTC 2014

Modified Files:
src/crypto/external/bsd/netpgp/dist: configure configure.ac
src/crypto/external/bsd/netpgp/dist/src/lib: errors.h netpgpsdk.h
version.h
src/crypto/external/bsd/netpgp/dist/src/libbn: misc.h
src/crypto/external/bsd/netpgp/dist/src/libverify: libverify.c

Log Message:
Update to version 20140220

Changes from previous version:

+ portability fixes from xtraeme for his Linux distribution:
+ add search for ar(1) into autoconf
+ define __printflike if it's not already defined
+ fix missing asprintf (I fixed this differently)


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/crypto/external/bsd/netpgp/dist/configure \
src/crypto/external/bsd/netpgp/dist/configure.ac
cvs rdiff -u -r1.8 -r1.9 src/crypto/external/bsd/netpgp/dist/src/lib/errors.h
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgpsdk.h
cvs rdiff -u -r1.46 -r1.47 \
src/crypto/external/bsd/netpgp/dist/src/lib/version.h
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/netpgp/dist/src/libbn/misc.h
cvs rdiff -u -r1.7 -r1.8 \
src/crypto/external/bsd/netpgp/dist/src/libverify/libverify.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/configure
diff -u src/crypto/external/bsd/netpgp/dist/configure:1.40 src/crypto/external/bsd/netpgp/dist/configure:1.41
--- src/crypto/external/bsd/netpgp/dist/configure:1.40	Mon Feb 17 07:23:18 2014
+++ src/crypto/external/bsd/netpgp/dist/configure	Fri Feb 21 01:55:10 2014
@@ -1,7 +1,7 @@
 #! /bin/sh
 # From configure.ac Revision: 1.40 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for netpgp 20140210.
+# Generated by GNU Autoconf 2.69 for netpgp 20140220.
 #
 # Report bugs to Alistair Crooks a...@netbsd.org c0596823.
 #
@@ -730,8 +730,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='netpgp'
 PACKAGE_TARNAME='netpgp'
-PACKAGE_VERSION='20140210'
-PACKAGE_STRING='netpgp 20140210'
+PACKAGE_VERSION='20140220'
+PACKAGE_STRING='netpgp 20140220'
 PACKAGE_BUGREPORT='Alistair Crooks a...@netbsd.org c0596823'
 PACKAGE_URL=''
 
@@ -1451,7 +1451,7 @@ if test $ac_init_help = long; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat _ACEOF
-\`configure' configures netpgp 20140210 to adapt to many kinds of systems.
+\`configure' configures netpgp 20140220 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1521,7 +1521,7 @@ fi
 
 if test -n $ac_init_help; then
   case $ac_init_help in
- short | recursive ) echo Configuration of netpgp 20140210:;;
+ short | recursive ) echo Configuration of netpgp 20140220:;;
esac
   cat \_ACEOF
 
@@ -1623,7 +1623,7 @@ fi
 test -n $ac_init_help  exit $ac_status
 if $ac_init_version; then
   cat \_ACEOF
-netpgp configure 20140210
+netpgp configure 20140220
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2100,7 +2100,7 @@ cat config.log _ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by netpgp $as_me 20140210, which was
+It was created by netpgp $as_me 20140220, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2919,7 +2919,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='netpgp'
- VERSION='20140210'
+ VERSION='20140220'
 
 
 cat confdefs.h _ACEOF
@@ -3191,6 +3191,7 @@ $as_echo no 6; }
   SET_MAKE=MAKE=${MAKE-make}
 fi
 
+AM_PROG_AR
 for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of $ac_prog, so it can be a program name with args.
@@ -4802,13 +4803,13 @@ if ${lt_cv_nm_interface+:} false; then :
 else
   lt_cv_nm_interface=BSD nm
   echo int some_variable = 0;  conftest.$ac_ext
-  (eval echo \\$as_me:4805: $ac_compile\ 5)
+  (eval echo \\$as_me:4806: $ac_compile\ 5)
   (eval $ac_compile 2conftest.err)
   cat conftest.err 5
-  (eval echo \\$as_me:4808: $NM \\\conftest.$ac_objext 5)
+  (eval echo \\$as_me:4809: $NM \\\conftest.$ac_objext 5)
   (eval $NM \conftest.$ac_objext\ 2conftest.err  conftest.out)
   cat conftest.err 5
-  (eval echo \\$as_me:4811: output\ 5)
+  (eval echo \\$as_me:4812: output\ 5)
   cat conftest.out 5
   if $GREP 'External.*some_variable' conftest.out  /dev/null; then
 lt_cv_nm_interface=MS dumpbin
@@ -6014,7 +6015,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 6017 configure'  conftest.$ac_ext
+  echo '#line 6018 configure'  conftest.$ac_ext
   if { { eval echo \\$as_me\:${as_lineno-$LINENO}: \$ac_compile\; } 5
   (eval $ac_compile) 25
   ac_status=$?
@@ -7539,11

CVS commit: src/sys

2014-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 21 02:10:40 UTC 2014

Modified Files:
src/sys/dev/pci: if_age.c if_alc.c if_ale.c
src/sys/dev/pcmcia: if_malo_pcmcia.c
src/sys/rump/net/lib/libvirtif: if_virt.c

Log Message:
PR/48606: Lloyd Parkes: Drivers not using ifp-if_input but using ether_input
directly.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pcmcia/if_malo_pcmcia.c
cvs rdiff -u -r1.36 -r1.37 src/sys/rump/net/lib/libvirtif/if_virt.c

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

Modified files:

Index: src/sys/dev/pci/if_age.c
diff -u src/sys/dev/pci/if_age.c:1.42 src/sys/dev/pci/if_age.c:1.43
--- src/sys/dev/pci/if_age.c:1.42	Fri Mar 29 23:21:02 2013
+++ src/sys/dev/pci/if_age.c	Thu Feb 20 21:10:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_age.c,v 1.42 2013/03/30 03:21:02 christos Exp $ */
+/*	$NetBSD: if_age.c,v 1.43 2014/02/21 02:10:40 christos Exp $ */
 /*	$OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $	*/
 
 /*-
@@ -31,7 +31,7 @@
 /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_age.c,v 1.42 2013/03/30 03:21:02 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_age.c,v 1.43 2014/02/21 02:10:40 christos Exp $);
 
 #include vlan.h
 
@@ -1506,7 +1506,7 @@ age_rxeof(struct age_softc *sc, struct r
 
 			bpf_mtap(ifp, m);
 			/* Pass it on. */
-			ether_input(ifp, m);
+			(*ifp-if_input)(ifp, m);
 
 			/* Reset mbuf chains. */
 			AGE_RXCHAIN_RESET(sc);

Index: src/sys/dev/pci/if_alc.c
diff -u src/sys/dev/pci/if_alc.c:1.9 src/sys/dev/pci/if_alc.c:1.10
--- src/sys/dev/pci/if_alc.c:1.9	Sun Apr 21 15:59:40 2013
+++ src/sys/dev/pci/if_alc.c	Thu Feb 20 21:10:40 2014
@@ -1989,10 +1989,8 @@ alc_rxeof(struct alc_softc *sc, struct r
 
 			bpf_mtap(ifp, m);
 
-			{
 			/* Pass it on. */
-			ether_input(ifp, m);
-			}
+			(*ifp-if_input)(ifp, m);
 		}
 	}
 	/* Reset mbuf chains. */

Index: src/sys/dev/pci/if_ale.c
diff -u src/sys/dev/pci/if_ale.c:1.15 src/sys/dev/pci/if_ale.c:1.16
--- src/sys/dev/pci/if_ale.c:1.15	Fri Mar 29 23:21:03 2013
+++ src/sys/dev/pci/if_ale.c	Thu Feb 20 21:10:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ale.c,v 1.15 2013/03/30 03:21:03 christos Exp $	*/
+/*	$NetBSD: if_ale.c,v 1.16 2014/02/21 02:10:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, Pyun YongHyeon yong...@freebsd.org
@@ -32,7 +32,7 @@
 /* Driver for Atheros AR8121/AR8113/AR8114 PCIe Ethernet. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ale.c,v 1.15 2013/03/30 03:21:03 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ale.c,v 1.16 2014/02/21 02:10:40 christos Exp $);
 
 #include vlan.h
 
@@ -1549,7 +1549,7 @@ ale_rxeof(struct ale_softc *sc)
 		bpf_mtap(ifp, m);
 
 		/* Pass it to upper layer. */
-		ether_input(ifp, m);
+		(*ifp-if_input)(ifp, m);
 
 		ale_rx_update_page(sc, rx_page, length, prod);
 	}

Index: src/sys/dev/pcmcia/if_malo_pcmcia.c
diff -u src/sys/dev/pcmcia/if_malo_pcmcia.c:1.3 src/sys/dev/pcmcia/if_malo_pcmcia.c:1.4
--- src/sys/dev/pcmcia/if_malo_pcmcia.c:1.3	Tue Jan 28 07:18:56 2014
+++ src/sys/dev/pcmcia/if_malo_pcmcia.c	Thu Feb 20 21:10:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_malo_pcmcia.c,v 1.3 2014/01/28 12:18:56 martin Exp $	*/
+/*	$NetBSD: if_malo_pcmcia.c,v 1.4 2014/02/21 02:10:40 christos Exp $	*/
 /*  $OpenBSD: if_malo.c,v 1.65 2009/03/29 21:53:53 sthen Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_malo_pcmcia.c,v 1.3 2014/01/28 12:18:56 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_malo_pcmcia.c,v 1.4 2014/02/21 02:10:40 christos Exp $);
 
 #ifdef _MODULE
 #include sys/module.h
@@ -1013,7 +1013,7 @@ cmalo_rx(struct malo_softc *sc)
 
 	/* push the frame up to the network stack if not in monitor mode */
 	if (ic-ic_opmode != IEEE80211_M_MONITOR) {
-		ether_input(ifp, m);
+		(*ifp-if_input)(ifp, m);
 		ifp-if_ipackets++;
 	}
 }

Index: src/sys/rump/net/lib/libvirtif/if_virt.c
diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.36 src/sys/rump/net/lib/libvirtif/if_virt.c:1.37
--- src/sys/rump/net/lib/libvirtif/if_virt.c:1.36	Thu Jul  4 07:46:51 2013
+++ src/sys/rump/net/lib/libvirtif/if_virt.c	Thu Feb 20 21:10:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_virt.c,v 1.36 2013/07/04 11:46:51 pooka Exp $	*/
+/*	$NetBSD: if_virt.c,v 1.37 2014/02/21 02:10:40 christos Exp $	*/
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.36 2013/07/04 11:46:51 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.37 2014/02/21 02:10:40 christos Exp $);
 
 #include sys/param.h
 #include sys/condvar.h
@@ -278,7 +278,7 @@ virtif_receiver(void *arg)
 		m-m_len = m-m_pkthdr.len = n;
 		

CVS commit: src/bin/ls

2014-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 21 02:42:41 UTC 2014

Modified Files:
src/bin/ls: ls.1 ls.c

Log Message:
Add -X (don't cross mount points when recursing) from tls@


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/bin/ls/ls.1
cvs rdiff -u -r1.71 -r1.72 src/bin/ls/ls.c

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

Modified files:

Index: src/bin/ls/ls.1
diff -u src/bin/ls/ls.1:1.74 src/bin/ls/ls.1:1.75
--- src/bin/ls/ls.1:1.74	Thu Feb 20 14:10:25 2014
+++ src/bin/ls/ls.1	Thu Feb 20 21:42:41 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: ls.1,v 1.74 2014/02/20 19:10:25 wiz Exp $
+.\	$NetBSD: ls.1,v 1.75 2014/02/21 02:42:41 christos Exp $
 .\
 .\ Copyright (c) 1980, 1990, 1991, 1993, 1994
 .\	The Regents of the University of California.  All rights reserved.
@@ -40,7 +40,7 @@
 .Nd list directory contents
 .Sh SYNOPSIS
 .Nm
-.Op Fl 1AaBbCcdFfghikLlMmnOoPpqRrSsTtuWwx
+.Op Fl 1AaBbCcdFfghikLlMmnOoPpqRrSsTtuWwXx
 .Op Ar
 .Sh DESCRIPTION
 For each
@@ -254,6 +254,8 @@ Force raw printing of non-printable char
 This is the default when output is not to a terminal.
 .It Fl x
 Multi-column output sorted across the page rather than down the page.
+.It Fl X
+Don't cross mount points when recursing.
 .El
 .Pp
 The

Index: src/bin/ls/ls.c
diff -u src/bin/ls/ls.c:1.71 src/bin/ls/ls.c:1.72
--- src/bin/ls/ls.c:1.71	Thu Feb 20 13:56:36 2014
+++ src/bin/ls/ls.c	Thu Feb 20 21:42:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ls.c,v 1.71 2014/02/20 18:56:36 christos Exp $	*/
+/*	$NetBSD: ls.c,v 1.72 2014/02/21 02:42:41 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = @(#)ls.c	8.7 (Berkeley) 8/5/94;
 #else
-__RCSID($NetBSD: ls.c,v 1.71 2014/02/20 18:56:36 christos Exp $);
+__RCSID($NetBSD: ls.c,v 1.72 2014/02/21 02:42:41 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -119,7 +119,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	usage: %s [-1AaBbCcdFfghikLlMmnopqRrSsTtuWwx] [file ...]\n,
+	usage: %s [-1AaBbCcdFfghikLlMmnOoPpqRrSsTtuWwXx] [file ...]\n,
 	getprogname());
 	exit(EXIT_FAILURE);
 	/* NOTREACHED */
@@ -151,7 +151,8 @@ ls_main(int argc, char *argv[])
 		f_listdot = 1;
 
 	fts_options = FTS_PHYSICAL;
-	while ((ch = getopt(argc, argv, 1ABCFLMOPRSTWabcdfghiklmnopqrstuwx)) != -1) {
+	while ((ch = getopt(argc, argv, 1AaBbCcdFfghikLlMmnOoPpqRrSsTtWwXx))
+	!= -1) {
 		switch (ch) {
 		/*
 		 * The -1, -C, -l, -m and -x options all override each other so
@@ -297,6 +298,9 @@ ls_main(int argc, char *argv[])
 			f_octal = 0;
 			f_octal_escape = 0;
 			break;
+		case 'X':
+			fts_options |= FTS_XDEV;
+			break;
 		default:
 		case '?':
 			usage();



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

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 21 06:28:25 UTC 2014

Modified Files:
src/sys/arch/arm/arm: cpufunc.c

Log Message:
For now, don't reset arm_cache_prefer_mask unless both l1 caches are PIPT


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/arm/arm/cpufunc.c

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

Modified files:

Index: src/sys/arch/arm/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.139 src/sys/arch/arm/arm/cpufunc.c:1.140
--- src/sys/arch/arm/arm/cpufunc.c:1.139	Thu Feb 20 23:24:55 2014
+++ src/sys/arch/arm/arm/cpufunc.c	Fri Feb 21 06:28:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.139 2014/02/20 23:24:55 matt Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.140 2014/02/21 06:28:25 matt Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.139 2014/02/20 23:24:55 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpufunc.c,v 1.140 2014/02/21 06:28:25 matt Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_cpuoptions.h
@@ -1595,7 +1595,8 @@ get_cachetype_cp15(void)
 			if (arm_scache.dcache_line_size  arm_dcache_align)
 arm_dcache_align = arm_scache.dcache_line_size;
 		}
-		if (arm_pcache.dcache_type == CACHE_TYPE_PIPT) {
+		if (arm_pcache.dcache_type == CACHE_TYPE_PIPT
+		 arm_pcache.icache_type == CACHE_TYPE_PIPT) {
 			arm_cache_prefer_mask = 0;
 		}
 		goto out;



CVS commit: src/sys/conf

2014-02-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 21 07:32:43 UTC 2014

Modified Files:
src/sys/conf: files

Log Message:
defparam KERNHIST_DELAY


To generate a diff of this commit:
cvs rdiff -u -r1.1082 -r1.1083 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1082 src/sys/conf/files:1.1083
--- src/sys/conf/files:1.1082	Mon Dec  9 16:45:23 2013
+++ src/sys/conf/files	Fri Feb 21 07:32:43 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1082 2013/12/09 16:45:23 pooka Exp $
+#	$NetBSD: files,v 1.1083 2014/02/21 07:32:43 matt Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -170,6 +170,7 @@ include crypto/nist_ctr_drbg/files.nist
 # Kernel history/tracing. Old UVMHIST depends upon this.
 #
 defflag opt_kernhist.h			KERNHIST KERNHIST_PRINT
+defparam opt_kernhist.h			KERNHIST_DELAY
 file	kern/kern_history.c		kernhist
 
 #



CVS commit: src/sys/kern

2014-02-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 21 07:47:02 UTC 2014

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

Log Message:
Properly check the section size to avoid out-of-bound reads. The
computed size must be the exact same size that is indicated in
sh_size.

ok agc@ christos@


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/kern/exec_elf.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.59 src/sys/kern/exec_elf.c:1.60
--- src/sys/kern/exec_elf.c:1.59	Wed Feb 19 15:23:20 2014
+++ src/sys/kern/exec_elf.c	Fri Feb 21 07:47:02 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.59 2014/02/19 15:23:20 maxv Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.60 2014/02/21 07:47:02 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exec_elf.c,v 1.59 2014/02/19 15:23:20 maxv Exp $);
+__KERNEL_RCSID(1, $NetBSD: exec_elf.c,v 1.60 2014/02/21 07:47:02 maxv Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_pax.h
@@ -873,7 +873,7 @@ netbsd_elf_signature(struct lwp *l, stru
 	size_t i;
 	Elf_Shdr *sh;
 	Elf_Nhdr *np;
-	size_t shsize;
+	size_t shsize, nsize;
 	int error;
 	int isnetbsd = 0;
 	char *ndata;
@@ -902,11 +902,23 @@ netbsd_elf_signature(struct lwp *l, stru
 		if (error)
 			continue;
 
+		/* Point to the note, skip the header */
 		ndata = (char *)(np + 1);
-		unsigned int maxlen = (unsigned int)(shp-sh_size -
-		((char *)ndata - (char *)np));
-		if (maxlen  np-n_namesz)
+
+		/*
+		 * Padding is present if necessary to ensure 4-byte alignment.
+		 * The actual section size is therefore:
+		 *header size + 4-byte aligned name + 4-byte aligned desc
+		 * Ensure this size is consistent with what is indicated
+		 * in sh_size. The first check avoids integer overflows.
+		 */
+		if (np-n_namesz  shp-sh_size || np-n_descsz  shp-sh_size)
 			goto bad;
+		nsize = sizeof(*np) + roundup(np-n_namesz, 4) +
+		roundup(np-n_descsz, 4);
+		if (nsize != shp-sh_size)
+			goto bad;
+
 		switch (np-n_type) {
 		case ELF_NOTE_TYPE_NETBSD_TAG:
 			/*
@@ -917,7 +929,7 @@ netbsd_elf_signature(struct lwp *l, stru
 			memcmp(ndata, ELF_NOTE_NETBSD_NAME,
 			ELF_NOTE_NETBSD_NAMESZ) == 0) {
 memcpy(epp-ep_osversion,
-ndata + ELF_NOTE_NETBSD_NAMESZ + 1,
+ndata + roundup(ELF_NOTE_NETBSD_NAMESZ, 4),
 ELF_NOTE_NETBSD_DESCSZ);
 isnetbsd = 1;
 break;
@@ -949,7 +961,8 @@ bad:
 memcmp(ndata, ELF_NOTE_GNU_NAME,
 ELF_NOTE_GNU_NAMESZ) == 0)
 break;
-int ns = MIN(np-n_namesz, maxlen);
+
+int ns = MIN(np-n_namesz, shp-sh_size - sizeof(*np));
 printf(%s: Unknown elf note type %d: 
 [namesz=%d, descsz=%d name=%*.*s]\n,
 epp-ep_kname, np-n_type, np-n_namesz,
@@ -959,7 +972,7 @@ bad:
 continue;
 			}
 			(void)memcpy(epp-ep_pax_flags,
-			ndata + ELF_NOTE_PAX_NAMESZ,
+			ndata + roundup(ELF_NOTE_PAX_NAMESZ, 4),
 			sizeof(epp-ep_pax_flags));
 			break;
 



CVS commit: src/sys/compat

2014-02-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 21 07:53:53 UTC 2014

Modified Files:
src/sys/compat/linux/arch/amd64: linux_exec_machdep.c
src/sys/compat/linux/common: linux_exec.h linux_exec_elf32.c
src/sys/compat/linux32/arch/amd64: linux32_exec.h
src/sys/compat/linux32/common: linux32_exec_elf32.c

Log Message:
Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase
XX_AUX_ENTRIES's when adding vectors.

Reported by martin@ (CV), with suggestions from chs@.

ok martin@ chs@


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
src/sys/compat/linux/arch/amd64/linux_exec_machdep.c
cvs rdiff -u -r1.50 -r1.51 src/sys/compat/linux/common/linux_exec.h
cvs rdiff -u -r1.88 -r1.89 src/sys/compat/linux/common/linux_exec_elf32.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/linux32/arch/amd64/linux32_exec.h
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/linux32/common/linux32_exec_elf32.c

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

Modified files:

Index: src/sys/compat/linux/arch/amd64/linux_exec_machdep.c
diff -u src/sys/compat/linux/arch/amd64/linux_exec_machdep.c:1.20 src/sys/compat/linux/arch/amd64/linux_exec_machdep.c:1.21
--- src/sys/compat/linux/arch/amd64/linux_exec_machdep.c:1.20	Mon Nov 18 01:32:22 2013
+++ src/sys/compat/linux/arch/amd64/linux_exec_machdep.c	Fri Feb 21 07:53:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_exec_machdep.c,v 1.20 2013/11/18 01:32:22 chs Exp $ */
+/*	$NetBSD: linux_exec_machdep.c,v 1.21 2014/02/21 07:53:53 maxv Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_exec_machdep.c,v 1.20 2013/11/18 01:32:22 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_exec_machdep.c,v 1.21 2014/02/21 07:53:53 maxv Exp $);
 
 #define ELFSIZE 64
 
@@ -233,13 +233,8 @@ ELFNAME2(linux,copyargs)(struct lwp *l, 
 	esd.ai[i].a_type = AT_NULL;
 	esd.ai[i++].a_v = 0;
 
-#ifdef DEBUG_LINUX
-	if (i != LINUX_ELF_AUX_ENTRIES) {
-		printf(linux_elf64_copyargs: %d Aux entries\n, i);
-		return EINVAL;
-	}
-#endif
-		
+	KASSERT(i == LINUX_ELF_AUX_ENTRIES);
+
 	strcpy(esd.hw_platform, LINUX_PLATFORM); 
 
 	exec_free_emul_arg(pack);

Index: src/sys/compat/linux/common/linux_exec.h
diff -u src/sys/compat/linux/common/linux_exec.h:1.50 src/sys/compat/linux/common/linux_exec.h:1.51
--- src/sys/compat/linux/common/linux_exec.h:1.50	Sun Feb  9 16:41:42 2014
+++ src/sys/compat/linux/common/linux_exec.h	Fri Feb 21 07:53:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_exec.h,v 1.50 2014/02/09 16:41:42 chs Exp $	*/
+/*	$NetBSD: linux_exec.h,v 1.51 2014/02/21 07:53:53 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -82,6 +82,7 @@
 #define LINUX_N_BSSADDR(x,m) (LINUX_N_DATADDR(x,m) + (x).a_data)
 
 #ifndef LINUX_MACHDEP_ELF_COPYARGS
+/* Counted from linux_exec_elf32.c */
 #define LINUX_ELF_AUX_ENTRIES	14
 #endif
 

Index: src/sys/compat/linux/common/linux_exec_elf32.c
diff -u src/sys/compat/linux/common/linux_exec_elf32.c:1.88 src/sys/compat/linux/common/linux_exec_elf32.c:1.89
--- src/sys/compat/linux/common/linux_exec_elf32.c:1.88	Sun Feb  9 16:41:42 2014
+++ src/sys/compat/linux/common/linux_exec_elf32.c	Fri Feb 21 07:53:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_exec_elf32.c,v 1.88 2014/02/09 16:41:42 chs Exp $	*/
+/*	$NetBSD: linux_exec_elf32.c,v 1.89 2014/02/21 07:53:53 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux_exec_elf32.c,v 1.88 2014/02/09 16:41:42 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux_exec_elf32.c,v 1.89 2014/02/21 07:53:53 maxv Exp $);
 
 #ifndef ELFSIZE
 /* XXX should die */
@@ -495,6 +495,7 @@ ELFNAME2(linux,copyargs)(struct lwp *l, 
 	*stackp += len;
 
 	len = (a - ai) * sizeof(AuxInfo);
+	KASSERT(len = LINUX_ELF_AUX_ENTRIES);
 	if ((error = copyout(ai, *stackp, len)) != 0)
 		return error;
 	*stackp += len;

Index: src/sys/compat/linux32/arch/amd64/linux32_exec.h
diff -u src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.5 src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.6
--- src/sys/compat/linux32/arch/amd64/linux32_exec.h:1.5	Sun Feb  9 16:41:42 2014
+++ src/sys/compat/linux32/arch/amd64/linux32_exec.h	Fri Feb 21 07:53:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_exec.h,v 1.5 2014/02/09 16:41:42 chs Exp $ */
+/*	$NetBSD: linux32_exec.h,v 1.6 2014/02/21 07:53:53 maxv Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -41,7 +41,8 @@
 
 #define LINUX32_DEBUGLINK_SIGNATURE	1
 
-#define LINUX32_ELF_AUX_ENTRIES 14
+/* Counted from common/linux32_exec_elf32.c */
+#define LINUX32_ELF_AUX_ENTRIES 15
 
 #define LINUX32_RANDOM_BYTES 16		/* 16 bytes for AT_RANDOM */
 

Index: