CVS commit: src/sys/lib/libkern/arch/powerpc

2021-07-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jul 24 05:29:26 UTC 2021

Modified Files:
src/sys/lib/libkern/arch/powerpc: Makefile.inc

Log Message:
For evbppc, use C version of memcpy(3), memcmp(3), and memmove(3)
consistently for *.{po,pico,go} (for RUMP), in order to avoid
alignment faults for 403.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libkern/arch/powerpc/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/powerpc/Makefile.inc
diff -u src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.31 src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.32
--- src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.31	Sat Jul  2 03:35:03 2011
+++ src/sys/lib/libkern/arch/powerpc/Makefile.inc	Sat Jul 24 05:29:26 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.31 2011/07/02 03:35:03 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.32 2021/07/24 05:29:26 rin Exp $
 
 SRCS+=	bswap16.c bswap32.c
 SRCS+=	htonl.c htons.c ntohl.c ntohs.c
@@ -9,7 +9,9 @@ SRCS+=	gprsavrest.S
 
 # Disable the asm versions on evbppc because they break the Explora
 .if ${MACHINE} == "evbppc"
-memcpy.o: memcpy.c
-memcmp.o: memcmp.c
-memmove.o: memmove.c
+.  for name in memcmp memcpy memmove
+.for suffix in o po pico go
+${name}.${suffix}: ${name}.c
+.endfor
+.  endfor
 .endif



CVS commit: src/sys/lib/libkern

2021-01-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 25 12:45:49 UTC 2021

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
Build strlist.c.

(Sigh, missed in original commit.)


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.49 src/sys/lib/libkern/Makefile.libkern:1.50
--- src/sys/lib/libkern/Makefile.libkern:1.49	Tue Jun 30 16:20:02 2020
+++ src/sys/lib/libkern/Makefile.libkern	Mon Jan 25 12:45:49 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.49 2020/06/30 16:20:02 maxv Exp $
+#	$NetBSD: Makefile.libkern,v 1.50 2021/01/25 12:45:49 thorpej Exp $
 
 #
 # Variable definitions for libkern.
@@ -56,6 +56,7 @@ SRCS+=	bswap64.c
 .endif
 SRCS+=	md4c.c md5c.c rmd160.c sha1.c sha2.c sha3.c keccak.c murmurhash.c
 SRCS+=	pmatch.c mcount.c crc32.c
+SRCS+=	strlist.c
 
 SRCS+=	ppath_kmem_alloc.c
 



CVS commit: src/sys/lib/libkern

2021-01-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 23 19:41:16 UTC 2021

Modified Files:
src/sys/lib/libkern: strlist.c

Log Message:
Fix building in the _STANDALONE case.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/strlist.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/lib/libkern/strlist.c
diff -u src/sys/lib/libkern/strlist.c:1.1 src/sys/lib/libkern/strlist.c:1.2
--- src/sys/lib/libkern/strlist.c:1.1	Thu Jan 21 15:43:37 2021
+++ src/sys/lib/libkern/strlist.c	Sat Jan 23 19:41:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: strlist.c,v 1.1 2021/01/21 15:43:37 thorpej Exp $	*/
+/*	$NetBSD: strlist.c,v 1.2 2021/01/23 19:41:16 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -65,12 +65,13 @@ strlist_free(void * const v, size_t cons
 	kmem_free(v, size);
 }
 #elif defined(_STANDALONE)
+#include 
 #include 
 
 static void *
 strlist_alloc(size_t const size)
 {
-	cp = alloc(size);
+	char *cp = alloc(size);
 	if (cp != NULL) {
 		memset(cp, 0, size);
 	}



CVS commit: src/sys/lib/libkern

2021-01-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 21 15:44:14 UTC 2021

Modified Files:
src/sys/lib/libkern: pmatch.c

Log Message:
Allow this to be built for the strlist.c unit tests.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libkern/pmatch.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/lib/libkern/pmatch.c
diff -u src/sys/lib/libkern/pmatch.c:1.6 src/sys/lib/libkern/pmatch.c:1.7
--- src/sys/lib/libkern/pmatch.c:1.6	Sat Mar 14 21:04:24 2009
+++ src/sys/lib/libkern/pmatch.c	Thu Jan 21 15:44:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmatch.c,v 1.6 2009/03/14 21:04:24 dsl Exp $	*/
+/*	$NetBSD: pmatch.c,v 1.7 2021/01/21 15:44:14 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1991 The Regents of the University of California.
@@ -30,7 +30,14 @@
  */
 
 #include 
+
+/* So we can build this in userland for the tests in strlist.c */
+#if defined(_KERNEL) || defined(_STANDALONE)
 #include 
+#else
+int pmatch(const char *, const char *, const char **);
+#endif
+
 /*
  * pmatch():
  *	Return 2 on exact match.



CVS commit: src/sys/lib/libkern

2021-01-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 21 15:43:37 UTC 2021

Modified Files:
src/sys/lib/libkern: libkern.h
Added Files:
src/sys/lib/libkern: strlist.c strlist.h

Log Message:
Add a generic set of routines for interacting with OpenFirmware-style
string lists.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/lib/libkern/libkern.h
cvs rdiff -u -r0 -r1.1 src/sys/lib/libkern/strlist.c \
src/sys/lib/libkern/strlist.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.141 src/sys/lib/libkern/libkern.h:1.142
--- src/sys/lib/libkern/libkern.h:1.141	Sat Jan 16 23:51:51 2021
+++ src/sys/lib/libkern/libkern.h	Thu Jan 21 15:43:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.141 2021/01/16 23:51:51 chs Exp $	*/
+/*	$NetBSD: libkern.h,v 1.142 2021/01/21 15:43:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -44,6 +44,8 @@
 #include 
 #include 
 
+#include 
+
 #ifndef LIBKERN_INLINE
 #define LIBKERN_INLINE	static __inline
 #define LIBKERN_BODY

Added files:

Index: src/sys/lib/libkern/strlist.c
diff -u /dev/null src/sys/lib/libkern/strlist.c:1.1
--- /dev/null	Thu Jan 21 15:43:37 2021
+++ src/sys/lib/libkern/strlist.c	Thu Jan 21 15:43:37 2021
@@ -0,0 +1,490 @@
+/*	$NetBSD: strlist.c,v 1.1 2021/01/21 15:43:37 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2021 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * strlist --
+ *
+ *	A set of routines for interacting with IEEE 1275 (OpenFirmware)
+ *	style string lists.
+ *
+ *	An OpenFirmware string list is simply a buffer containing
+ *	multiple NUL-terminated strings concatenated together.
+ *
+ *	So, for example, the a string list consisting of the strings
+ *	"foo", "bar", and "baz" would be represented in memory like:
+ *
+ *		foo\0bar\0baz\0
+ */
+
+#include 
+
+/*
+ * Memory allocation wrappers to handle different environments.
+ */
+#if defined(_KERNEL)
+#include 
+#include 
+
+static void *
+strlist_alloc(size_t const size)
+{
+	return kmem_zalloc(size, KM_SLEEP);
+}
+
+static void
+strlist_free(void * const v, size_t const size)
+{
+	kmem_free(v, size);
+}
+#elif defined(_STANDALONE)
+#include 
+
+static void *
+strlist_alloc(size_t const size)
+{
+	cp = alloc(size);
+	if (cp != NULL) {
+		memset(cp, 0, size);
+	}
+	return cp;
+}
+
+static void
+strlist_free(void * const v, size_t const size)
+{
+	dealloc(v, size);
+}
+#else /* user-space */
+#include 
+#include 
+
+extern int pmatch(const char *, const char *, const char **);
+
+static void *
+strlist_alloc(size_t const size)
+{
+	return calloc(1, size);
+}
+
+static void
+strlist_free(void * const v, size_t const size __unused)
+{
+	free(v);
+}
+#endif
+
+#include "strlist.h"
+
+/*
+ * strlist_next --
+ *
+ *	Return a pointer to the next string in the strlist,
+ *	or NULL if there are no more strings.
+ */
+const char *
+strlist_next(const char * const sl, size_t const slsize, size_t * const cursorp)
+{
+
+	if (sl == NULL || slsize == 0 || cursorp == NULL) {
+		return NULL;
+	}
+
+	size_t cursor = *cursorp;
+
+	if (cursor >= slsize) {
+		/* No more strings in the list. */
+		return NULL;
+	}
+
+	const char *cp = sl + cursor;
+	*cursorp = cursor + strlen(cp) + 1;
+
+	return cp;
+}
+
+/*
+ * strlist_count --
+ *
+ *	Return the number of strings in the strlist.
+ */
+unsigned int
+strlist_count(const char *sl, size_t slsize)
+{
+
+	if (sl == NULL || slsize == 0) 

CVS commit: src/sys/lib/libkern

2020-09-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep  2 04:06:43 UTC 2020

Modified Files:
src/sys/lib/libkern: softfloat.c

Log Message:
Reduce diffs to upstream: get rid of FLOAT64_{,DE}MANGLE(); it's no longer
used.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libkern/softfloat.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/lib/libkern/softfloat.c
diff -u src/sys/lib/libkern/softfloat.c:1.7 src/sys/lib/libkern/softfloat.c:1.8
--- src/sys/lib/libkern/softfloat.c:1.7	Wed Sep  2 03:45:54 2020
+++ src/sys/lib/libkern/softfloat.c	Wed Sep  2 04:06:43 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.7 2020/09/02 03:45:54 thorpej Exp $ */
+/* $NetBSD: softfloat.c,v 1.8 2020/09/02 04:06:43 thorpej Exp $ */
 
 /*
  * This version hacked for use with gcc -msoft-float by bjh21.
@@ -50,7 +50,7 @@ these four paragraphs for those parts of
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: softfloat.c,v 1.7 2020/09/02 03:45:54 thorpej Exp $");
+__RCSID("$NetBSD: softfloat.c,v 1.8 2020/09/02 04:06:43 thorpej Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef SOFTFLOAT_FOR_GCC
@@ -60,17 +60,6 @@ __RCSID("$NetBSD: softfloat.c,v 1.7 2020
 #include "milieu.h"
 #include "softfloat.h"
 
-/*
- * Conversions between floats as stored in memory and floats as
- * SoftFloat uses them
- */
-#ifndef FLOAT64_DEMANGLE
-#define FLOAT64_DEMANGLE(a)	(a)
-#endif
-#ifndef FLOAT64_MANGLE
-#define FLOAT64_MANGLE(a)	(a)
-#endif
-
 /*
 | Floating-point rounding mode, extended double-precision rounding precision,
 | and exception flags.
@@ -406,7 +395,7 @@ static float32
 INLINE bits64 extractFloat64Frac( float64 a )
 {
 
-return FLOAT64_DEMANGLE(a) & LIT64( 0x000F );
+return a & LIT64( 0x000F );
 
 }
 
@@ -417,7 +406,7 @@ INLINE bits64 extractFloat64Frac( float6
 INLINE int16 extractFloat64Exp( float64 a )
 {
 
-return ( FLOAT64_DEMANGLE(a)>>52 ) & 0x7FF;
+return ( a>>52 ) & 0x7FF;
 
 }
 /*
@@ -427,7 +416,7 @@ INLINE int16 extractFloat64Exp( float64 
 INLINE flag extractFloat64Sign( float64 a )
 {
 
-return FLOAT64_DEMANGLE(a)>>63;
+return a>>63;
 
 }
 
@@ -463,8 +452,7 @@ static void
 INLINE float64 packFloat64( flag zSign, int16 zExp, bits64 zSig )
 {
 
-return FLOAT64_MANGLE( ( ( (bits64) zSign )<<63 ) +
-			   ( ( (bits64) zExp )<<52 ) + zSig );
+return ( ( (bits64) zSign )<<63 ) + ( ( (bits64) zExp )<<52 ) + zSig;
 
 }
 
@@ -521,9 +509,7 @@ static float64 roundAndPackFloat64( flag
   && ( (sbits64) ( zSig + roundIncrement ) < 0 ) )
) {
 float_raise( float_flag_overflow | float_flag_inexact );
-return FLOAT64_MANGLE(
-		FLOAT64_DEMANGLE(packFloat64( zSign, 0x7FF, 0 )) -
-		( roundIncrement == 0 ));
+return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 );
 }
 if ( zExp < 0 ) {
 isTiny =
@@ -886,7 +872,6 @@ INLINE int32 extractFloat128Exp( float12
 
 }
 
-
 /*
 | Returns the sign bit of the quadruple-precision floating-point value `a'.
 **/
@@ -3085,8 +3070,7 @@ flag float64_eq( float64 a, float64 b )
 }
 return 0;
 }
-return ( a == b ) ||
-	( (bits64) ( ( FLOAT64_DEMANGLE(a) | FLOAT64_DEMANGLE(b) )<<1 ) == 0 );
+return ( a == b ) || ( (bits64) ( ( a | b )<<1 ) == 0 );
 
 }
 
@@ -3109,12 +3093,8 @@ flag float64_le( float64 a, float64 b )
 }
 aSign = extractFloat64Sign( a );
 bSign = extractFloat64Sign( b );
-if ( aSign != bSign )
-	return aSign ||
-	( (bits64) ( ( FLOAT64_DEMANGLE(a) | FLOAT64_DEMANGLE(b) )<<1 ) ==
-	  0 );
-return ( a == b ) ||
-	( aSign ^ ( FLOAT64_DEMANGLE(a) < FLOAT64_DEMANGLE(b) ) );
+if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 );
+return ( a == b ) || ( aSign ^ ( a < b ) );
 
 }
 
@@ -3136,12 +3116,8 @@ flag float64_lt( float64 a, float64 b )
 }
 aSign = extractFloat64Sign( a );
 bSign = extractFloat64Sign( b );
-if ( aSign != bSign )
-	return aSign &&
-	( (bits64) ( ( FLOAT64_DEMANGLE(a) | FLOAT64_DEMANGLE(b) )<<1 ) !=
-	  0 );
-return ( a != b ) &&
-	( aSign ^ ( FLOAT64_DEMANGLE(a) < FLOAT64_DEMANGLE(b) ) );
+if ( aSign != bSign ) return aSign && ( (bits64) ( ( a | b )<<1 ) != 0 );
+return ( a != b ) && ( aSign ^ ( a < b ) );
 
 }
 



CVS commit: src/sys/lib/libkern

2020-09-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep  2 03:45:54 UTC 2020

Modified Files:
src/sys/lib/libkern: softfloat.c

Log Message:
Update to the SoftFloat-2b version of softfloat.c.  This makes a clarifying
change to the warranty disclaimer and updates the comments.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libkern/softfloat.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/lib/libkern/softfloat.c
diff -u src/sys/lib/libkern/softfloat.c:1.6 src/sys/lib/libkern/softfloat.c:1.7
--- src/sys/lib/libkern/softfloat.c:1.6	Sun Dec 31 11:43:42 2017
+++ src/sys/lib/libkern/softfloat.c	Wed Sep  2 03:45:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.6 2017/12/31 11:43:42 martin Exp $ */
+/* $NetBSD: softfloat.c,v 1.7 2020/09/02 03:45:54 thorpej Exp $ */
 
 /*
  * This version hacked for use with gcc -msoft-float by bjh21.
@@ -14,11 +14,10 @@
  *   properly renamed.
  */
 
-/*
-===
+/*
 
-This C source file is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2a.
+This C source file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic
+Package, Release 2b.
 
 Written by John R. Hauser.  This work was made possible in part by the
 International Computer Science Institute, located at Suite 600, 1947 Center
@@ -27,29 +26,31 @@ National Science Foundation under grant 
 of this code was written as part of a project to build a fixed-point vector
 processor in collaboration with the University of California at Berkeley,
 overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
+is available through the Web page `http://www.cs.berkeley.edu/~jhauser/
 arithmetic/SoftFloat.html'.
 
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort has
+been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
+RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
+AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
+COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
+EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
+INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
+OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
 
 Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
+(1) the source code for the derivative work includes prominent notice that
+the work is derivative, and (2) the source code includes prominent notice with
+these four paragraphs for those parts of this code that are retained.
 
-===
-*/
+=*/
 
 /* If you need this in a boot program, you have bigger problems... */
 #ifndef _STANDALONE
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: softfloat.c,v 1.6 2017/12/31 11:43:42 martin Exp $");
+__RCSID("$NetBSD: softfloat.c,v 1.7 2020/09/02 03:45:54 thorpej Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef SOFTFLOAT_FOR_GCC
@@ -70,13 +71,10 @@ __RCSID("$NetBSD: softfloat.c,v 1.6 2017
 #define FLOAT64_MANGLE(a)	(a)
 #endif
 
-/*

-Floating-point rounding mode, extended double-precision rounding precision,
-and exception flags.

-*/
-
+/*
+| Floating-point rounding mode, extended double-precision rounding precision,
+| and exception flags.
+**/
 /*
  * XXX: This may cause options-MULTIPROCESSOR or thread problems someday.
  * 	Right now, it does not.  I've removed all other dynamic global
@@ -86,40 +84,35 @@ and exception flags.
 int8 floatx80_rounding_precision = 80;
 #endif
 
-/*

-Primitive 

CVS commit: src/sys/lib/libkern

2020-09-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep  2 03:43:22 UTC 2020

Modified Files:
src/sys/lib/libkern: milieu.h

Log Message:
Update to the SoftFloat-2c version of milieu.h.  This includes a
simplification of the license and updates the comments.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libkern/milieu.h

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

Modified files:

Index: src/sys/lib/libkern/milieu.h
diff -u src/sys/lib/libkern/milieu.h:1.4 src/sys/lib/libkern/milieu.h:1.5
--- src/sys/lib/libkern/milieu.h:1.4	Thu Apr 19 21:50:09 2018
+++ src/sys/lib/libkern/milieu.h	Wed Sep  2 03:43:22 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: milieu.h,v 1.4 2018/04/19 21:50:09 christos Exp $ */
+/* $NetBSD: milieu.h,v 1.5 2020/09/02 03:43:22 thorpej Exp $ */
 
 /* This is a derivative work. */
 
@@ -31,29 +31,29 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-/*
-===
+/*
 
-This C header file is part of TestFloat, Release 2a, a package of programs
-for testing the correctness of floating-point arithmetic complying to the
-IEC/IEEE Standard for Floating-Point.
-
-Written by John R. Hauser.  More information is available through the Web
-page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
+This C header file template is part of the Berkeley SoftFloat IEEE Floating-
+Point Arithmetic Package, Release 2c, by John R. Hauser.
 
-===
-*/
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort has
+been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
+RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
+AND ORGANIZATIONS WHO CAN AND WILL TOLERATE ALL LOSSES, COSTS, OR OTHER
+PROBLEMS THEY INCUR DUE TO THE SOFTWARE WITHOUT RECOMPENSE FROM JOHN HAUSER OR
+THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE, AND WHO FURTHERMORE EFFECTIVELY
+INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE
+(possibly via similar legal notice) AGAINST ALL LOSSES, COSTS, OR OTHER
+PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE, OR
+INCURRED BY ANYONE DUE TO A DERIVATIVE WORK THEY CREATE USING ANY PART OF THE
+SOFTWARE.
+
+Derivative works require also that (1) the source code for the derivative work
+includes prominent notice that the work is derivative, and (2) the source code
+includes prominent notice of these three paragraphs for those parts of this
+code that are retained.
+
+=*/
 
 #ifndef MILIEU_H
 #define MILIEU_H
@@ -66,30 +66,29 @@ this code that are retained.
 
 #include 
 
-/*

-One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.

-*/
-
+/*
+| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
+**/
 #if _BYTE_ORDER == _LITTLE_ENDIAN
 #define LITTLEENDIAN
 #else
 #define BIGENDIAN
 #endif
 
+/*
+| The macro `BITS64' can be defined to indicate that 64-bit integer types are
+| supported by the compiler.
+**/
 #define BITS64
 
-/*

-Each of the following `typedef's defines the most convenient type that holds
-integers of at least as many bits as specified.  For example, `uint8' should
-be the most convenient type that can hold unsigned integers of as many as
-8 bits.  The `flag' type must be able to hold either a 0 or 1.  For most
-implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
-to the same as `int'.

-*/

CVS commit: src/sys/lib/libkern

2020-09-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep  2 03:41:56 UTC 2020

Modified Files:
src/sys/lib/libkern: softfloat-specialize.h softfloat.h

Log Message:
Update to the SoftFloat-2c version of softfloat-specialize.h and softfloat.h.
This includes a simplification of the license and updates the comments.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/softfloat-specialize.h
cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libkern/softfloat.h

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

Modified files:

Index: src/sys/lib/libkern/softfloat-specialize.h
diff -u src/sys/lib/libkern/softfloat-specialize.h:1.2 src/sys/lib/libkern/softfloat-specialize.h:1.3
--- src/sys/lib/libkern/softfloat-specialize.h:1.2	Mon Apr 28 20:24:06 2008
+++ src/sys/lib/libkern/softfloat-specialize.h	Wed Sep  2 03:41:56 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat-specialize.h,v 1.2 2008/04/28 20:24:06 martin Exp $ */
+/* $NetBSD: softfloat-specialize.h,v 1.3 2020/09/02 03:41:56 thorpej Exp $ */
 
 /* This is a derivative work. */
 
@@ -31,68 +31,55 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-/*
-===
-
-This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2a.
-
-Written by John R. Hauser.  This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704.  Funding was partially provided by the
-National Science Foundation under grant MIP-9311980.  The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
-arithmetic/SoftFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
+/*
 
-===
-*/
-
-/*

-Underflow tininess-detection mode, statically initialized to default value.

-*/
+This C source fragment is part of the Berkeley SoftFloat IEEE Floating-Point
+Arithmetic Package, Release 2c, by John R. Hauser.
 
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort has
+been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
+RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
+AND ORGANIZATIONS WHO CAN AND WILL TOLERATE ALL LOSSES, COSTS, OR OTHER
+PROBLEMS THEY INCUR DUE TO THE SOFTWARE WITHOUT RECOMPENSE FROM JOHN HAUSER OR
+THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE, AND WHO FURTHERMORE EFFECTIVELY
+INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE
+(possibly via similar legal notice) AGAINST ALL LOSSES, COSTS, OR OTHER
+PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE, OR
+INCURRED BY ANYONE DUE TO A DERIVATIVE WORK THEY CREATE USING ANY PART OF THE
+SOFTWARE.
+
+Derivative works require also that (1) the source code for the derivative work
+includes prominent notice that the work is derivative, and (2) the source code
+includes prominent notice of these three paragraphs for those parts of this
+code that are retained.
+
+=*/
+
+/*
+| Underflow tininess-detection mode, statically initialized to default value.
+| (The declaration in `softfloat.h' must match the `int8' type here.)
+**/
 /* [ MP safe, does not change dynamically ] */
 int float_detect_tininess = float_tininess_after_rounding;
 
-/*

-Internal canonical NaN format.

-*/

CVS commit: src/sys/lib/libkern

2020-09-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Sep  1 15:45:21 UTC 2020

Modified Files:
src/sys/lib/libkern: softfloat-macros.h

Log Message:
Update to the SoftFloat-2c version of softfloat-macros.h.  This has 3
small changes:
- Simplification of the license.
- Minor style changes to 3 comments.
- Fixes a bug in shift128Right() for shift counts >= 64;


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/softfloat-macros.h

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

Modified files:

Index: src/sys/lib/libkern/softfloat-macros.h
diff -u src/sys/lib/libkern/softfloat-macros.h:1.2 src/sys/lib/libkern/softfloat-macros.h:1.3
--- src/sys/lib/libkern/softfloat-macros.h:1.2	Tue Sep  1 15:36:53 2020
+++ src/sys/lib/libkern/softfloat-macros.h	Tue Sep  1 15:45:20 2020
@@ -1,39 +1,32 @@
-/* $NetBSD: softfloat-macros.h,v 1.2 2020/09/01 15:36:53 thorpej Exp $ */
+/* $NetBSD: softfloat-macros.h,v 1.3 2020/09/01 15:45:20 thorpej Exp $ */
 
 /*
 
-This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2b.
-
-Written by John R. Hauser.  This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704.  Funding was partially provided by the
-National Science Foundation under grant MIP-9311980.  The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the Web page `http://www.cs.berkeley.edu/~jhauser/
-arithmetic/SoftFloat.html'.
+This C source fragment is part of the Berkeley SoftFloat IEEE Floating-Point
+Arithmetic Package, Release 2c, by John R. Hauser.
 
 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort has
 been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
 RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
-AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
-COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
-EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
-INSTITUTE (possibly via similar legal notice) AGAINST ALL LOSSES, COSTS, OR
-OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) the source code for the derivative work includes prominent notice that
-the work is derivative, and (2) the source code includes prominent notice with
-these four paragraphs for those parts of this code that are retained.
+AND ORGANIZATIONS WHO CAN AND WILL TOLERATE ALL LOSSES, COSTS, OR OTHER
+PROBLEMS THEY INCUR DUE TO THE SOFTWARE WITHOUT RECOMPENSE FROM JOHN HAUSER OR
+THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE, AND WHO FURTHERMORE EFFECTIVELY
+INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE
+(possibly via similar legal notice) AGAINST ALL LOSSES, COSTS, OR OTHER
+PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE, OR
+INCURRED BY ANYONE DUE TO A DERIVATIVE WORK THEY CREATE USING ANY PART OF THE
+SOFTWARE.
+
+Derivative works require also that (1) the source code for the derivative work
+includes prominent notice that the work is derivative, and (2) the source code
+includes prominent notice of these three paragraphs for those parts of this
+code that are retained.
 
 =*/
 
 /*
 | Shifts `a' right by the number of bits given in `count'.  If any nonzero
-| bits are shifted off, they are ``jammed'' into the least significant bit of
+| bits are shifted off, they are "jammed" into the least significant bit of
 | the result by setting the least significant bit to 1.  The value of `count'
 | can be arbitrarily large; in particular, if `count' is greater than 32, the
 | result will be either 0 or 1, depending on whether `a' is zero or nonzero.
@@ -59,7 +52,7 @@ INLINE void shift32RightJamming( bits32 
 
 /*
 | Shifts `a' right by the number of bits given in `count'.  If any nonzero
-| bits are shifted off, they are ``jammed'' into the least significant bit of
+| bits are shifted off, they are "jammed" into the least significant bit of
 | the result by setting the least significant bit to 1.  The value of `count'
 | can be arbitrarily large; in particular, if `count' is greater than 64, the
 | result will be either 0 or 1, depending on whether `a' is zero or nonzero.
@@ -153,7 +146,7 @@ 

CVS commit: src/sys/lib/libkern

2020-09-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Sep  1 15:36:53 UTC 2020

Modified Files:
src/sys/lib/libkern: softfloat-macros.h

Log Message:
Update to the SoftFloat-2b version of softfloat-macros.h.  This makes a
clarifying change to the warranty disclaimer and updates the comments.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/softfloat-macros.h

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

Modified files:

Index: src/sys/lib/libkern/softfloat-macros.h
diff -u src/sys/lib/libkern/softfloat-macros.h:1.1 src/sys/lib/libkern/softfloat-macros.h:1.2
--- src/sys/lib/libkern/softfloat-macros.h:1.1	Thu Apr 26 03:10:47 2001
+++ src/sys/lib/libkern/softfloat-macros.h	Tue Sep  1 15:36:53 2020
@@ -1,10 +1,9 @@
-/* $NetBSD: softfloat-macros.h,v 1.1 2001/04/26 03:10:47 ross Exp $ */
+/* $NetBSD: softfloat-macros.h,v 1.2 2020/09/01 15:36:53 thorpej Exp $ */
 
-/*
-===
+/*
 
 This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2a.
+Arithmetic Package, Release 2b.
 
 Written by John R. Hauser.  This work was made possible in part by the
 International Computer Science Institute, located at Suite 600, 1947 Center
@@ -13,33 +12,34 @@ National Science Foundation under grant 
 of this code was written as part of a project to build a fixed-point vector
 processor in collaboration with the University of California at Berkeley,
 overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
+is available through the Web page `http://www.cs.berkeley.edu/~jhauser/
 arithmetic/SoftFloat.html'.
 
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort has
+been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
+RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
+AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
+COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
+EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
+INSTITUTE (possibly via similar legal notice) AGAINST ALL LOSSES, COSTS, OR
+OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
 
 Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
-
-===
-*/
-
-/*

-Shifts `a' right by the number of bits given in `count'.  If any nonzero
-bits are shifted off, they are ``jammed'' into the least significant bit of
-the result by setting the least significant bit to 1.  The value of `count'
-can be arbitrarily large; in particular, if `count' is greater than 32, the
-result will be either 0 or 1, depending on whether `a' is zero or nonzero.
-The result is stored in the location pointed to by `zPtr'.

-*/
+(1) the source code for the derivative work includes prominent notice that
+the work is derivative, and (2) the source code includes prominent notice with
+these four paragraphs for those parts of this code that are retained.
+
+=*/
+
+/*
+| Shifts `a' right by the number of bits given in `count'.  If any nonzero
+| bits are shifted off, they are ``jammed'' into the least significant bit of
+| the result by setting the least significant bit to 1.  The value of `count'
+| can be arbitrarily large; in particular, if `count' is greater than 32, the
+| result will be either 0 or 1, depending on whether `a' is zero or nonzero.
+| The result is stored in the location pointed to by `zPtr'.
+**/
+
 INLINE void shift32RightJamming( bits32 a, int16 count, bits32 *zPtr )
 {
 bits32 z;
@@ -57,16 +57,15 @@ INLINE void shift32RightJamming( bits32 
 
 }
 
-/*

CVS commit: src/sys/lib/libkern

2020-04-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 24 00:22:57 UTC 2020

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
For m68k, do not compile in {,u}divmodsi4 also, that are not used by
codes generated by gcc (confirmed not only for kernel, but also all
executables and libraries for userland).

Fix build failure for MODULAR kernel, noticed by mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.11 src/sys/lib/libkern/Makefile.compiler-rt:1.12
--- src/sys/lib/libkern/Makefile.compiler-rt:1.11	Thu Apr 23 03:09:18 2020
+++ src/sys/lib/libkern/Makefile.compiler-rt	Fri Apr 24 00:22:57 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.11 2020/04/23 03:09:18 rin Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.12 2020/04/24 00:22:57 rin Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -62,17 +62,13 @@ GENERIC_SRCS+= \
 	ctzsi2.c
 .endif
 
-.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
-GENERIC_SRCS+= \
-	divmodsi4.c \
-	udivmodsi4.c
-.endif
-
 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" && \
 ${MACHINE_ARCH} != "m68k"
 GENERIC_SRCS+= \
+	divmodsi4.c \
 	divsi3.c \
 	modsi3.c \
+	udivmodsi4.c \
 	udivsi3.c \
 	umodsi3.c
 .endif



CVS commit: src/sys/lib/libkern/arch/m68k

2020-04-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 23 03:12:49 UTC 2020

Modified Files:
src/sys/lib/libkern/arch/m68k: divsi3.S modsi3.S udivsi3.S umodsi3.S

Log Message:
Remove "#ifndef __mc68010__ #error" I added when these {,u}divsi3.S and
{,u}modsi3.S were moved here (It was better to split the commit, sorry);
bootloader for sun3 still depends on them.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libkern/arch/m68k/divsi3.S \
src/sys/lib/libkern/arch/m68k/modsi3.S \
src/sys/lib/libkern/arch/m68k/umodsi3.S
cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libkern/arch/m68k/udivsi3.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/lib/libkern/arch/m68k/divsi3.S
diff -u src/sys/lib/libkern/arch/m68k/divsi3.S:1.3 src/sys/lib/libkern/arch/m68k/divsi3.S:1.4
--- src/sys/lib/libkern/arch/m68k/divsi3.S:1.3	Wed Apr 22 11:58:26 2020
+++ src/sys/lib/libkern/arch/m68k/divsi3.S	Thu Apr 23 03:12:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: divsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $	*/
+/*	$NetBSD: divsi3.S,v 1.4 2020/04/23 03:12:49 rin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -39,13 +39,13 @@
 #if 0
 	RCSID("from: @(#)divsi3.s	5.1 (Berkeley) 6/7/90")
 #else
-	RCSID("$NetBSD: divsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $")
+	RCSID("$NetBSD: divsi3.S,v 1.4 2020/04/23 03:12:49 rin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 /* int / int */
 #ifndef __mc68010__
-#error
+/* XXX sun3 need this for bootloader */
 ENTRY(__divsi3)
 	movel	4(%sp),%d0
 	divsl	8(%sp),%d0
Index: src/sys/lib/libkern/arch/m68k/modsi3.S
diff -u src/sys/lib/libkern/arch/m68k/modsi3.S:1.3 src/sys/lib/libkern/arch/m68k/modsi3.S:1.4
--- src/sys/lib/libkern/arch/m68k/modsi3.S:1.3	Wed Apr 22 11:58:26 2020
+++ src/sys/lib/libkern/arch/m68k/modsi3.S	Thu Apr 23 03:12:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: modsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $	*/
+/*	$NetBSD: modsi3.S,v 1.4 2020/04/23 03:12:49 rin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -39,13 +39,13 @@
 #if 0
 	RCSID("from: @(#)modsi3.s	5.1 (Berkeley) 6/7/90")
 #else
-	RCSID("$NetBSD: modsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $")
+	RCSID("$NetBSD: modsi3.S,v 1.4 2020/04/23 03:12:49 rin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 /* int % int */
 #ifndef __mc68010__
-#error
+/* XXX sun3 need this for bootloader */
 ENTRY(__modsi3)
 	movel	4(%sp),%d1
 #ifdef __mcoldfire__
Index: src/sys/lib/libkern/arch/m68k/umodsi3.S
diff -u src/sys/lib/libkern/arch/m68k/umodsi3.S:1.3 src/sys/lib/libkern/arch/m68k/umodsi3.S:1.4
--- src/sys/lib/libkern/arch/m68k/umodsi3.S:1.3	Wed Apr 22 11:58:26 2020
+++ src/sys/lib/libkern/arch/m68k/umodsi3.S	Thu Apr 23 03:12:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: umodsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $	*/
+/*	$NetBSD: umodsi3.S,v 1.4 2020/04/23 03:12:49 rin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -39,13 +39,13 @@
 #if 0
 	RCSID("from: @(#)umodsi3.s	5.1 (Berkeley) 6/7/90")(
 #else
-	RCSID("$NetBSD: umodsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $")
+	RCSID("$NetBSD: umodsi3.S,v 1.4 2020/04/23 03:12:49 rin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 /* unsigned % unsigned */
 #ifndef __mc68010__
-#error
+/* XXX sun3 need this for bootloader */
 ENTRY(__umodsi3)
 	movel	4(%sp),%d1
 #ifdef __mcoldfire__

Index: src/sys/lib/libkern/arch/m68k/udivsi3.S
diff -u src/sys/lib/libkern/arch/m68k/udivsi3.S:1.5 src/sys/lib/libkern/arch/m68k/udivsi3.S:1.6
--- src/sys/lib/libkern/arch/m68k/udivsi3.S:1.5	Wed Apr 22 11:58:26 2020
+++ src/sys/lib/libkern/arch/m68k/udivsi3.S	Thu Apr 23 03:12:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: udivsi3.S,v 1.5 2020/04/22 11:58:26 rin Exp $	*/
+/*	$NetBSD: udivsi3.S,v 1.6 2020/04/23 03:12:49 rin Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -39,13 +39,13 @@
 #if 0
 	RCSID("from: @(#)udivsi3.s	5.1 (Berkeley) 6/7/90")
 #else
-	RCSID("$NetBSD: udivsi3.S,v 1.5 2020/04/22 11:58:26 rin Exp $")
+	RCSID("$NetBSD: udivsi3.S,v 1.6 2020/04/23 03:12:49 rin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 /* unsigned / unsigned */
 #ifndef __mc68010__
-#error
+/* XXX sun3 need this for bootloader */
 ENTRY(__udivsi3)
 	movel	4(%sp),%d0
 	divul	8(%sp),%d0



CVS commit: src/sys/lib/libkern

2020-04-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 23 03:09:18 UTC 2020

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
For m68k, do not compile in {,u}divsi3 and {,u}modsi3 since codes
generated by gcc do not depend on them.

We should not have unused functions in libkern for MODULAR.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.10 src/sys/lib/libkern/Makefile.compiler-rt:1.11
--- src/sys/lib/libkern/Makefile.compiler-rt:1.10	Sun Sep 29 23:44:59 2019
+++ src/sys/lib/libkern/Makefile.compiler-rt	Thu Apr 23 03:09:18 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.10 2019/09/29 23:44:59 mrg Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.11 2020/04/23 03:09:18 rin Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -65,9 +65,14 @@ GENERIC_SRCS+= \
 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
 GENERIC_SRCS+= \
 	divmodsi4.c \
+	udivmodsi4.c
+.endif
+
+.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" && \
+${MACHINE_ARCH} != "m68k"
+GENERIC_SRCS+= \
 	divsi3.c \
 	modsi3.c \
-	udivmodsi4.c \
 	udivsi3.c \
 	umodsi3.c
 .endif



CVS commit: src/sys/lib/libkern/arch/m68k

2020-04-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 22 11:58:26 UTC 2020

Added Files:
src/sys/lib/libkern/arch/m68k: divsi3.S modsi3.S udivsi3.S umodsi3.S

Log Message:
Restrict usage of m68k assembler versions of {,u}divsi3 and {,u}divsi3 to
kernel and bootloader for 68010.

They requires a special calling convention to udivsi3, and cannot to be
mixed up in normal routines provided by libgcc or compiler_rt. Although,
there's no problem for using in a controlled situation, i.e., kernel and
standalone programs.

Note that this does not affect m68k ports other than sun2, since codes
generated by gcc do not call these routines.

Assembler files are moved from common/lib/libc/arch/m68k/gen to
sys/lib/libkern/arch/m68k in order not to be compiled in libc.

Revert hack introduced to lib/libc/compiler_rt/Makefile.inc rev 1.37:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/compiler_rt/Makefile.inc#rev1.37

Proposed on port-sun2@ with no response...
(Again, this does not affect m68k ports other than sun2.)
http://mail-index.netbsd.org/port-sun2/2020/03/10/msg000102.html


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 src/sys/lib/libkern/arch/m68k/divsi3.S \
src/sys/lib/libkern/arch/m68k/modsi3.S \
src/sys/lib/libkern/arch/m68k/umodsi3.S
cvs rdiff -u -r0 -r1.5 src/sys/lib/libkern/arch/m68k/udivsi3.S

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

Added files:

Index: src/sys/lib/libkern/arch/m68k/divsi3.S
diff -u /dev/null src/sys/lib/libkern/arch/m68k/divsi3.S:1.3
--- /dev/null	Wed Apr 22 11:58:26 2020
+++ src/sys/lib/libkern/arch/m68k/divsi3.S	Wed Apr 22 11:58:26 2020
@@ -0,0 +1,71 @@
+/*	$NetBSD: divsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+	RCSID("from: @(#)divsi3.s	5.1 (Berkeley) 6/7/90")
+#else
+	RCSID("$NetBSD: divsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $")
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+/* int / int */
+#ifndef __mc68010__
+#error
+ENTRY(__divsi3)
+	movel	4(%sp),%d0
+	divsl	8(%sp),%d0
+	rts
+END(__divsi3)
+#else
+ENTRY(__divsi3)
+| NB: this requires that __udivsi3 preserve %a0:
+	movel	4(%sp), %d1	| load the dividend
+	bpl	1f
+	negl	4(%sp)		| store abs(dividend)
+1:	movel	8(%sp), %d0	| load the divisor
+	bpl	2f
+	negl	8(%sp)		| store abs(divisor)
+2:	eorl	%d1, %d0
+	bpl	3f		| branch if sgn(divisor) == sgn(dividend)
+	movel	(%sp)+, %a0	| pop return address
+	pea	(.Lret,%pc)	| push our return address
+3:	jmp	_C_LABEL(__udivsi3)
+.Lret:	negl	%d0		| negate quotient
+	jmp	(%a0)
+END(__divsi3)
+#endif /* __mc68010__ */
Index: src/sys/lib/libkern/arch/m68k/modsi3.S
diff -u /dev/null src/sys/lib/libkern/arch/m68k/modsi3.S:1.3
--- /dev/null	Wed Apr 22 11:58:26 2020
+++ src/sys/lib/libkern/arch/m68k/modsi3.S	Wed Apr 22 11:58:26 2020
@@ -0,0 +1,77 @@
+/*	$NetBSD: modsi3.S,v 1.3 2020/04/22 11:58:26 rin Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * 

CVS commit: src/sys/lib/libkern

2020-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Apr 17 17:24:46 UTC 2020

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
Slightly reorder for clarity, and add header.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.139 src/sys/lib/libkern/libkern.h:1.140
--- src/sys/lib/libkern/libkern.h:1.139	Tue Apr  7 08:07:58 2020
+++ src/sys/lib/libkern/libkern.h	Fri Apr 17 17:24:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.139 2020/04/07 08:07:58 skrll Exp $	*/
+/*	$NetBSD: libkern.h,v 1.140 2020/04/17 17:24:46 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,6 +38,7 @@
 #include "opt_diagnostic.h"
 #include "opt_kasan.h"
 #include "opt_kcsan.h"
+#include "opt_kmsan.h"
 #endif
 
 #include 
@@ -360,7 +361,6 @@ tolower(int ch)
 void	*memcpy(void *, const void *, size_t);
 int	 memcmp(const void *, const void *, size_t);
 void	*memset(void *, int, size_t);
-void	*memmem(const void *, size_t, const void *, size_t);
 #if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE)
 #if defined(_KERNEL) && defined(KASAN)
 void	*kasan_memcpy(void *, const void *, size_t);
@@ -389,12 +389,11 @@ void	*kmsan_memset(void *, int, size_t);
 #define	memset(d, v, l)		__builtin_memset(d, v, l)
 #endif
 #endif
+void	*memmem(const void *, size_t, const void *, size_t);
 
 char	*strcpy(char *, const char *);
 int	 strcmp(const char *, const char *);
 size_t	 strlen(const char *);
-size_t	 strnlen(const char *, size_t);
-char	*strsep(char **, const char *);
 #if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE)
 #if defined(_KERNEL) && defined(KASAN)
 char	*kasan_strcpy(char *, const char *);
@@ -423,16 +422,18 @@ size_t	 kmsan_strlen(const char *);
 #define	strlen(a)		__builtin_strlen(a)
 #endif
 #endif
+size_t	 strnlen(const char *, size_t);
+char	*strsep(char **, const char *);
 
 /* Functions for which we always use built-ins. */
 #ifdef __GNUC__
 #define	alloca(s)		__builtin_alloca(s)
 #endif
 
+/* These exist in GCC 3.x, but we don't bother. */
 char	*strcat(char *, const char *);
 char	*strchr(const char *, int);
 char	*strrchr(const char *, int);
-/* These exist in GCC 3.x, but we don't bother. */
 #if defined(_KERNEL) && defined(KASAN)
 char	*kasan_strcat(char *, const char *);
 char	*kasan_strchr(const char *, int);
@@ -447,10 +448,6 @@ char	*kmsan_strrchr(const char *, int);
 #define	strcat(d, s)		kmsan_strcat(d, s)
 #define	strchr(s, c)		kmsan_strchr(s, c)
 #define	strrchr(s, c)		kmsan_strrchr(s, c)
-#else
-char	*strcat(char *, const char *);
-char	*strchr(const char *, int);
-char	*strrchr(const char *, int);
 #endif
 size_t	 strcspn(const char *, const char *);
 char	*strncpy(char *, const char *, size_t);



CVS commit: src/sys/lib/libkern/arch

2020-01-27 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Jan 27 22:06:13 UTC 2020

Modified Files:
src/sys/lib/libkern/arch/i386: Makefile.inc
src/sys/lib/libkern/arch/x86_64: Makefile.inc

Log Message:
Make x86 use the C version of memcmp().


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libkern/arch/i386/Makefile.inc
cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libkern/arch/x86_64/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/i386/Makefile.inc
diff -u src/sys/lib/libkern/arch/i386/Makefile.inc:1.31 src/sys/lib/libkern/arch/i386/Makefile.inc:1.32
--- src/sys/lib/libkern/arch/i386/Makefile.inc:1.31	Fri Aug 14 19:23:53 2009
+++ src/sys/lib/libkern/arch/i386/Makefile.inc	Mon Jan 27 22:06:13 2020
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile.inc,v 1.31 2009/08/14 19:23:53 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.32 2020/01/27 22:06:13 ad Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S ffs.S
-SRCS+=	memchr.S memcmp.S memcpy.S memmove.S memset.S
+SRCS+=	memchr.S memcpy.S memmove.S memset.S
 SRCS+=	random.S
 SRCS+=	strcat.S strchr.S strcmp.S
 SRCS+=	strcpy.S strlen.S

Index: src/sys/lib/libkern/arch/x86_64/Makefile.inc
diff -u src/sys/lib/libkern/arch/x86_64/Makefile.inc:1.6 src/sys/lib/libkern/arch/x86_64/Makefile.inc:1.7
--- src/sys/lib/libkern/arch/x86_64/Makefile.inc:1.6	Thu Jan 14 02:09:46 2010
+++ src/sys/lib/libkern/arch/x86_64/Makefile.inc	Mon Jan 27 22:06:13 2020
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile.inc,v 1.6 2010/01/14 02:09:46 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.7 2020/01/27 22:06:13 ad Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S byte_swap_8.S
 SRCS+=	ffs.S
-SRCS+=	memchr.S memcmp.S memcpy.S memmove.S memset.S
+SRCS+=	memchr.S memcpy.S memmove.S memset.S
 SRCS+=	strcat.S strchr.S strcmp.S
 SRCS+=	strcpy.S strlen.S
 SRCS+=	strrchr.S



CVS commit: src/sys/lib/libkern

2019-12-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Dec 14 17:24:43 UTC 2019

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.46 src/sys/lib/libkern/Makefile.libkern:1.47
--- src/sys/lib/libkern/Makefile.libkern:1.46	Sat Dec 14 17:23:47 2019
+++ src/sys/lib/libkern/Makefile.libkern	Sat Dec 14 17:24:43 2019
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile.libkern,v 1.46 2019/12/14 17:23:47 riastradh Exp $
+#	$NetBSD: Makefile.libkern,v 1.47 2019/12/14 17:24:43 riastradh Exp $
 
-# 
-# Variable definitions for libkern.  
+#
+# Variable definitions for libkern.
 #
 # Before including this, you _must_ set
 #   KERNDIR: location of sys/lib/libkern
@@ -68,7 +68,7 @@ SRCS+=	memcmp.c memmem.c
 
 SRCS+=	memcpy.c
 .if empty(SRCS:Mmemset2.*)
-SRCS+=	memset.c 
+SRCS+=	memset.c
 .endif
 
 SRCS+=	popcount32.c popcount64.c



CVS commit: src/sys/lib/libkern

2019-12-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Dec 14 17:23:47 UTC 2019

Modified Files:
src/sys/lib/libkern: Makefile.libkern libkern.h
Removed Files:
src/sys/lib/libkern: mertwist.c

Log Message:
Remove never-used Mersenne twister from libkern.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.136 -r1.137 src/sys/lib/libkern/libkern.h
cvs rdiff -u -r1.8 -r0 src/sys/lib/libkern/mertwist.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/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.45 src/sys/lib/libkern/Makefile.libkern:1.46
--- src/sys/lib/libkern/Makefile.libkern:1.45	Sat Dec 14 17:23:31 2019
+++ src/sys/lib/libkern/Makefile.libkern	Sat Dec 14 17:23:47 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.45 2019/12/14 17:23:31 riastradh Exp $
+#	$NetBSD: Makefile.libkern,v 1.46 2019/12/14 17:23:47 riastradh Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -54,7 +54,7 @@ SRCS+=	cpuset.c inet_addr.c intoa.c
 SRCS+=	bswap64.c
 .endif
 SRCS+=	md4c.c md5c.c rmd160.c sha1.c sha2.c sha3.c keccak.c murmurhash.c
-SRCS+=	pmatch.c mcount.c mertwist.c crc32.c
+SRCS+=	pmatch.c mcount.c crc32.c
 
 SRCS+=	ppath_kmem_alloc.c
 

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.136 src/sys/lib/libkern/libkern.h:1.137
--- src/sys/lib/libkern/libkern.h:1.136	Thu Dec  5 04:17:13 2019
+++ src/sys/lib/libkern/libkern.h	Sat Dec 14 17:23:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.136 2019/12/05 04:17:13 riastradh Exp $	*/
+/*	$NetBSD: libkern.h,v 1.137 2019/12/14 17:23:47 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -356,14 +356,6 @@ tolower(int ch)
 ((const TYPE *)(((const char *)(PTR)) - offsetof(TYPE, FIELD))	\
 	+ __validate_const_container_of(PTR, TYPE, FIELD))
 
-#define	MTPRNG_RLEN		624
-struct mtprng_state {
-	unsigned int mt_idx;
-	uint32_t mt_elem[MTPRNG_RLEN];
-	uint32_t mt_count;
-	uint32_t mt_sparse[3];
-};
-
 /* Prototypes for which GCC built-ins exist. */
 void	*memcpy(void *, const void *, size_t);
 int	 memcmp(const void *, const void *, size_t);
@@ -497,10 +489,6 @@ char	*setstate(char *);
 long	 random(void);
 void	 mi_vector_hash(const void * __restrict, size_t, uint32_t,
 	uint32_t[3]);
-void	 mtprng_init32(struct mtprng_state *, uint32_t);
-void	 mtprng_initarray(struct mtprng_state *, const uint32_t *, size_t);
-uint32_t mtprng_rawrandom(struct mtprng_state *);
-uint32_t mtprng_random(struct mtprng_state *);
 int	 scanc(u_int, const u_char *, const u_char *, int);
 int	 skpc(int, size_t, u_char *);
 int	 strcasecmp(const char *, const char *);



CVS commit: src/sys/lib/libkern

2019-12-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Dec 14 17:23:31 UTC 2019

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
Omit vestigial unused commented-out experiment.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.44 src/sys/lib/libkern/Makefile.libkern:1.45
--- src/sys/lib/libkern/Makefile.libkern:1.44	Sat Dec 14 15:30:37 2019
+++ src/sys/lib/libkern/Makefile.libkern	Sat Dec 14 17:23:31 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.44 2019/12/14 15:30:37 ad Exp $
+#	$NetBSD: Makefile.libkern,v 1.45 2019/12/14 17:23:31 riastradh Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -98,9 +98,6 @@ SRCS+=	explicit_memset.c consttime_memeq
 SRCS+=	cdbr.c
 SRCS+=	mi_vector_hash.c
 
-#.PATH:	${NETBSDSRCDIR}/external/bsd/liblzf/dist
-#SRCS+=	lzf_c.c lzf_d.c
-
 # Files to clean up
 CLEANFILES+= lib${LIB}.o lib${LIB}.po
 



CVS commit: src/sys/lib/libkern

2019-12-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Dec  5 04:17:13 UTC 2019

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
#ifdef notyet ---> never


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.135 src/sys/lib/libkern/libkern.h:1.136
--- src/sys/lib/libkern/libkern.h:1.135	Fri Nov 22 14:28:46 2019
+++ src/sys/lib/libkern/libkern.h	Thu Dec  5 04:17:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.135 2019/11/22 14:28:46 maxv Exp $	*/
+/*	$NetBSD: libkern.h,v 1.136 2019/12/05 04:17:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -546,23 +546,4 @@ int	strnvisx(char *, size_t, const char 
 #define VIS_SAFE	0x20
 #define VIS_TRIM	0x40
 
-#ifdef notyet
-/*
- * LZF hashtable/state size: on uncompressible data and on a system with
- * a sufficiently large d-cache, a larger table produces a considerable
- * speed benefit.  On systems with small memory and caches, however...
- */
-#if defined(__vax__) || defined(__m68k__)
-#define LZF_HLOG 14
-#else
-#define LZF_HLOG 15
-#endif
-typedef const uint8_t *LZF_STATE[1 << LZF_HLOG];
-
-unsigned int lzf_compress_r (const void *const, unsigned int, void *,
-			 unsigned int, LZF_STATE);
-unsigned int lzf_decompress (const void *const, unsigned int, void *,
-			 unsigned int);
-#endif
-
 #endif /* !_LIB_LIBKERN_LIBKERN_H_ */



CVS commit: src/sys/lib/libkern

2019-04-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr  5 14:00:16 UTC 2019

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
clzdi2 and ctzdi2 are needed on alpha. (counting instructions are in the
optional CIX extension, and thus not used by the default compiler configuation).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.8 src/sys/lib/libkern/Makefile.compiler-rt:1.9
--- src/sys/lib/libkern/Makefile.compiler-rt:1.8	Thu Feb  7 10:44:54 2019
+++ src/sys/lib/libkern/Makefile.compiler-rt	Fri Apr  5 14:00:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.8 2019/02/07 10:44:54 mrg Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.9 2019/04/05 14:00:16 thorpej Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -72,7 +72,7 @@ GENERIC_SRCS+= \
 	umodsi3.c
 .endif
 
-.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
+.if ${MACHINE_CPU} != "aarch64"
 GENERIC_SRCS+= \
 	clzdi2.c \
 	ctzdi2.c \



CVS commit: src/sys/lib/libkern

2019-02-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb  7 10:44:54 UTC 2019

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
don't use -fnon-call-exceptions on arm.  not needed and triggers eh_frame 
generation.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.7 src/sys/lib/libkern/Makefile.compiler-rt:1.8
--- src/sys/lib/libkern/Makefile.compiler-rt:1.7	Thu Feb  7 05:22:09 2019
+++ src/sys/lib/libkern/Makefile.compiler-rt	Thu Feb  7 10:44:54 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.7 2019/02/07 05:22:09 mrg Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.8 2019/02/07 10:44:54 mrg Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -129,5 +129,7 @@ CPPFLAGS.int_util.c+=	-DKERNEL_USE
 
 # XXX Explicit divide by zero in udivmoddi4.c -> abort().
 .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
+. if ${MACHINE_CPU} != "arm"
 COPTS.udivmoddi4.c+=	-fnon-call-exceptions
+. endif
 .endif



CVS commit: src/sys/lib/libkern

2019-02-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb  7 05:22:09 UTC 2019

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
apply the previous to all GCC-7 platforms.  it affects vax as well.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.6 src/sys/lib/libkern/Makefile.compiler-rt:1.7
--- src/sys/lib/libkern/Makefile.compiler-rt:1.6	Thu Feb  7 04:33:24 2019
+++ src/sys/lib/libkern/Makefile.compiler-rt	Thu Feb  7 05:22:09 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.6 2019/02/07 04:33:24 mrg Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.7 2019/02/07 05:22:09 mrg Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -129,7 +129,5 @@ CPPFLAGS.int_util.c+=	-DKERNEL_USE
 
 # XXX Explicit divide by zero in udivmoddi4.c -> abort().
 .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
-. if ${MACHINE_CPU} == "sh3"
 COPTS.udivmoddi4.c+=	-fnon-call-exceptions
-. endif
 .endif



CVS commit: src/sys/lib/libkern

2019-02-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb  7 04:33:24 UTC 2019

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
for sh3 and GCC 7 pass -fnon-call-exceptions for udivmoddi4.c.
avoids it emitting a call to abort() for an explicit divide by zero.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.5 src/sys/lib/libkern/Makefile.compiler-rt:1.6
--- src/sys/lib/libkern/Makefile.compiler-rt:1.5	Sun Aug 10 05:57:31 2014
+++ src/sys/lib/libkern/Makefile.compiler-rt	Thu Feb  7 04:33:24 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.5 2014/08/10 05:57:31 matt Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.6 2019/02/07 04:33:24 mrg Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -126,3 +126,10 @@ COPTS.${src}+=	-Wno-missing-prototypes \
 .endfor
 
 CPPFLAGS.int_util.c+=	-DKERNEL_USE
+
+# XXX Explicit divide by zero in udivmoddi4.c -> abort().
+.if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
+. if ${MACHINE_CPU} == "sh3"
+COPTS.udivmoddi4.c+=	-fnon-call-exceptions
+. endif
+.endif



CVS commit: src/sys/lib/libkern

2018-09-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Sep  3 18:52:34 UTC 2018

Modified Files:
src/sys/lib/libkern: rngtest.c

Log Message:
We have popcount; no need to reimplement it.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libkern/rngtest.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/lib/libkern/rngtest.c
diff -u src/sys/lib/libkern/rngtest.c:1.3 src/sys/lib/libkern/rngtest.c:1.4
--- src/sys/lib/libkern/rngtest.c:1.3	Mon Mar 28 15:20:16 2016
+++ src/sys/lib/libkern/rngtest.c	Mon Sep  3 18:52:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rngtest.c,v 1.3 2016/03/28 15:20:16 riastradh Exp $ */
+/*	$NetBSD: rngtest.c,v 1.4 2018/09/03 18:52:33 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@ the GNU Public License.
 #include 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rngtest.c,v 1.3 2016/03/28 15:20:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rngtest.c,v 1.4 2018/09/03 18:52:33 riastradh Exp $");
 
 #ifndef _KERNEL
 static inline int
@@ -169,26 +169,6 @@ const int maxones = MAXONES;
 const long long minpoke = (MINPOKE * PRECISION);
 const long long maxpoke = (MAXPOKE * PRECISION);
 
-/* Population count of 1's in a byte */
-const unsigned char Popcount[] = {
-	0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
-	1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
-	1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
-	2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-	1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
-	2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-	2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-	3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
-	1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
-	2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-	2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-	3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
-	2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
-	3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
-	3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
-	4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
-};
-
 /* end of run */
 static void
 endrun(rngtest_t *const rc, const int last, int run)
@@ -221,7 +201,7 @@ rngtest(rngtest_t *const rc)
 
 	/* monobit test */
 	for (p = rc->rt_b, c = 0; p < >rt_b[sizeof rc->rt_b]; ++p)
-		c += Popcount[*p];
+		c += popcount(*p);
 	if (c <= minones || maxones <= c) {
 		printf("Kernel RNG \"%s\" monobit test FAILURE: %d ones\n",
 		   rc->rt_name, c);



CVS commit: src/sys/lib/libkern

2018-09-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Sep  3 16:54:55 UTC 2018

Modified Files:
src/sys/lib/libkern: Makefile.libkern
src/sys/lib/libkern/arch/mips: Makefile.inc
src/sys/lib/libkern/arch/usermode: Makefile.inc
src/sys/lib/libkern/arch/vax: Makefile.inc
Added Files:
src/sys/lib/libkern: uimax.c uimin.c
Removed Files:
src/sys/lib/libkern: max.c min.c

Log Message:
Rename min.c -> uimin.c, max.c -> uimax.c in libkern.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.7 -r0 src/sys/lib/libkern/max.c src/sys/lib/libkern/min.c
cvs rdiff -u -r0 -r1.1 src/sys/lib/libkern/uimax.c \
src/sys/lib/libkern/uimin.c
cvs rdiff -u -r1.23 -r1.24 src/sys/lib/libkern/arch/mips/Makefile.inc
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libkern/arch/usermode/Makefile.inc
cvs rdiff -u -r1.24 -r1.25 src/sys/lib/libkern/arch/vax/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.42 src/sys/lib/libkern/Makefile.libkern:1.43
--- src/sys/lib/libkern/Makefile.libkern:1.42	Sun Jul  8 17:54:42 2018
+++ src/sys/lib/libkern/Makefile.libkern	Mon Sep  3 16:54:54 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.42 2018/07/08 17:54:42 christos Exp $
+#	$NetBSD: Makefile.libkern,v 1.43 2018/09/03 16:54:54 riastradh Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -61,7 +61,7 @@ SRCS+=	ppath_kmem_alloc.c
 SRCS+=	strsep.c strstr.c
 SRCS+=	strlcpy.c strlcat.c
 
-SRCS+=	imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c
+SRCS+=	imax.c imin.c lmax.c lmin.c uimax.c uimin.c ulmax.c ulmin.c
 SRCS+=	memmove.c
 SRCS+=	strchr.c strrchr.c
 SRCS+=	memcmp.c memmem.c

Index: src/sys/lib/libkern/arch/mips/Makefile.inc
diff -u src/sys/lib/libkern/arch/mips/Makefile.inc:1.23 src/sys/lib/libkern/arch/mips/Makefile.inc:1.24
--- src/sys/lib/libkern/arch/mips/Makefile.inc:1.23	Wed Jan 20 18:13:40 2010
+++ src/sys/lib/libkern/arch/mips/Makefile.inc	Mon Sep  3 16:54:54 2018
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile.inc,v 1.23 2010/01/20 18:13:40 pgoyette Exp $
+#	$NetBSD: Makefile.inc,v 1.24 2018/09/03 16:54:54 riastradh Exp $
 #
 #	There are likely more that we will notice when we go native
 
-NO_SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c
+NO_SRCS+= imax.c imin.c lmax.c lmin.c uimax.c uimin.c ulmax.c ulmin.c
 NO_SRCS+= __main.c
 
 SRCS+=	memchr.c memcmp.c random.c scanc.c \

Index: src/sys/lib/libkern/arch/usermode/Makefile.inc
diff -u src/sys/lib/libkern/arch/usermode/Makefile.inc:1.3 src/sys/lib/libkern/arch/usermode/Makefile.inc:1.4
--- src/sys/lib/libkern/arch/usermode/Makefile.inc:1.3	Fri Aug 14 19:23:55 2009
+++ src/sys/lib/libkern/arch/usermode/Makefile.inc	Mon Sep  3 16:54:55 2018
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile.inc,v 1.3 2009/08/14 19:23:55 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.4 2018/09/03 16:54:55 riastradh Exp $
 #
 #	There are likely more that we will notice when we go native
 
-NO_SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c
+NO_SRCS+= imax.c imin.c lmax.c lmin.c uimax.c uimin.c ulmax.c ulmin.c
 NO_SRCS+= __main.c strlen.c strcmp.c

Index: src/sys/lib/libkern/arch/vax/Makefile.inc
diff -u src/sys/lib/libkern/arch/vax/Makefile.inc:1.24 src/sys/lib/libkern/arch/vax/Makefile.inc:1.25
--- src/sys/lib/libkern/arch/vax/Makefile.inc:1.24	Mon Mar 15 11:46:49 2010
+++ src/sys/lib/libkern/arch/vax/Makefile.inc	Mon Sep  3 16:54:55 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.24 2010/03/15 11:46:49 uwe Exp $
+#	$NetBSD: Makefile.inc,v 1.25 2018/09/03 16:54:55 riastradh Exp $
 #
 #	The rest of the lib routines are in machine/macros.h
 #
@@ -7,5 +7,5 @@ SRCS+=	blkcpy.S blkset.S bswap16.S bswap
 SRCS+=	random.S
 SRCS+=	udiv.S urem.S
 
-NO_SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c
+NO_SRCS+= imax.c imin.c lmax.c lmin.c uimax.c uimin.c ulmax.c ulmin.c
 NO_SRCS+= scanc.c skpc.c

Added files:

Index: src/sys/lib/libkern/uimax.c
diff -u /dev/null src/sys/lib/libkern/uimax.c:1.1
--- /dev/null	Mon Sep  3 16:54:55 2018
+++ src/sys/lib/libkern/uimax.c	Mon Sep  3 16:54:54 2018
@@ -0,0 +1,41 @@
+/*	$NetBSD: uimax.c,v 1.1 2018/09/03 16:54:54 riastradh Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1991 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. 

CVS commit: src/sys/lib/libkern

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 17:54:42 UTC 2018

Modified Files:
src/sys/lib/libkern: Makefile.libkern libkern.h

Log Message:
provide memmem


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.126 -r1.127 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.41 src/sys/lib/libkern/Makefile.libkern:1.42
--- src/sys/lib/libkern/Makefile.libkern:1.41	Fri Dec  8 16:51:07 2017
+++ src/sys/lib/libkern/Makefile.libkern	Sun Jul  8 13:54:42 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.41 2017/12/08 21:51:07 christos Exp $
+#	$NetBSD: Makefile.libkern,v 1.42 2018/07/08 17:54:42 christos Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -64,7 +64,7 @@ SRCS+=	strlcpy.c strlcat.c
 SRCS+=	imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c
 SRCS+=	memmove.c
 SRCS+=	strchr.c strrchr.c
-SRCS+=	memcmp.c
+SRCS+=	memcmp.c memmem.c
 
 SRCS+=	memcpy.c
 .if empty(SRCS:Mmemset2.*)

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.126 src/sys/lib/libkern/libkern.h:1.127
--- src/sys/lib/libkern/libkern.h:1.126	Fri Dec  8 19:51:52 2017
+++ src/sys/lib/libkern/libkern.h	Sun Jul  8 13:54:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.126 2017/12/09 00:51:52 christos Exp $	*/
+/*	$NetBSD: libkern.h,v 1.127 2018/07/08 17:54:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -366,6 +366,7 @@ struct mtprng_state {
 void	*memcpy(void *, const void *, size_t);
 int	 memcmp(const void *, const void *, size_t);
 void	*memset(void *, int, size_t);
+void	*memmem(const void *, size_t, const void *, size_t);
 #if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE)
 #define	memcpy(d, s, l)		__builtin_memcpy(d, s, l)
 #define	memcmp(a, b, l)		__builtin_memcmp(a, b, l)



CVS commit: src/sys/lib/libkern/arch/aarch64

2018-03-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Mar 16 07:56:50 UTC 2018

Modified Files:
src/sys/lib/libkern/arch/aarch64: Makefile.inc

Log Message:
use memmove.S


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/arch/aarch64/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/aarch64/Makefile.inc
diff -u src/sys/lib/libkern/arch/aarch64/Makefile.inc:1.1 src/sys/lib/libkern/arch/aarch64/Makefile.inc:1.2
--- src/sys/lib/libkern/arch/aarch64/Makefile.inc:1.1	Sun Aug 10 05:47:38 2014
+++ src/sys/lib/libkern/arch/aarch64/Makefile.inc	Fri Mar 16 07:56:50 2018
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile.inc,v 1.1 2014/08/10 05:47:38 matt Exp $
+# $NetBSD: Makefile.inc,v 1.2 2018/03/16 07:56:50 ryo Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S byte_swap_8.S
 SRCS+=	memcmp.S
 SRCS+=	memcpy.S
+SRCS+=	memmove.S
 SRCS+=	memset.S
-#SRCS+=	memmove.S
 #SRCS+=	strcmp.S
 #SRCS+=	strncmp.S



CVS commit: src/sys/lib/libkern

2017-12-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec  9 00:51:52 UTC 2017

Modified Files:
src/sys/lib/libkern: hexdump.c libkern.h

Log Message:
Even smaller and takes print function.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libkern/hexdump.c
cvs rdiff -u -r1.125 -r1.126 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/hexdump.c
diff -u src/sys/lib/libkern/hexdump.c:1.3 src/sys/lib/libkern/hexdump.c:1.4
--- src/sys/lib/libkern/hexdump.c:1.3	Fri Dec  8 18:57:57 2017
+++ src/sys/lib/libkern/hexdump.c	Fri Dec  8 19:51:52 2017
@@ -27,15 +27,17 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hexdump.c,v 1.3 2017/12/08 23:57:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hexdump.c,v 1.4 2017/12/09 00:51:52 christos Exp $");
 
 #ifdef DEBUG_HEXDUMP
 #include 
 #include 
 #include 
 #include 
+#define RET int
 static const char hexdigits[] = "0123456789abcdef";
 #else
+#define RET void
 #include 
 #include 
 #endif
@@ -46,20 +48,20 @@ static const char hexdigits[] = "0123456
 #define NL (BAR + 18)
 
 void
-hexdump(const char *msg, const void *ptr, size_t len)
+hexdump(RET (*pr)(const char *, ...) __printflike(1, 2), const char *msg,
+const void *ptr, size_t len)
 {
 	size_t i, p, q;
 	const unsigned char *u = ptr;
 	char buf[NL + 2];
 
 	if (msg)
-		printf("%s: %zu bytes @ %p\n", msg, len, ptr);
+		(*pr)("%s: %zu bytes @ %p\n", msg, len, ptr);
 
 	buf[BAR] = '|';
 	buf[BAR + 1] = ' ';
 	buf[NL] = '\n';
 	buf[NL + 1] = '\0';
-	memset(buf, ' ', BAR);
 for (q = p = i = 0; i < len; i++) {
 		unsigned char c = u[i];
 		buf[p++] = hexdigits[(c >> 4) & 0xf];
@@ -72,14 +74,15 @@ hexdump(const char *msg, const void *ptr
 
 		if (q == 16) {
 			q = p = 0;
-			printf("%s", buf);
-			memset(buf, ' ', BAR);
+			(*pr)("%s", buf);
 		}
 }
 	if (q) {
+		while (p < BAR)
+			buf[p++] = ' ';
 		buf[ASC + q++] = '\n';
 		buf[ASC + q] = '\0';
-		printf("%s", buf);
+		(*pr)("%s", buf);
 	}
 }
 
@@ -87,7 +90,7 @@ hexdump(const char *msg, const void *ptr
 int
 main(int argc, char *argv[])
 {
-	hexdump("foo", main, atoi(argv[1]));
+	hexdump(printf, "foo", main, atoi(argv[1]));
 	return 0;
 }
 #endif

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.125 src/sys/lib/libkern/libkern.h:1.126
--- src/sys/lib/libkern/libkern.h:1.125	Fri Dec  8 16:51:07 2017
+++ src/sys/lib/libkern/libkern.h	Fri Dec  8 19:51:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.125 2017/12/08 21:51:07 christos Exp $	*/
+/*	$NetBSD: libkern.h,v 1.126 2017/12/09 00:51:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -448,7 +448,8 @@ intmax_t strtoi(const char * __restrict,
 intmax_t, int *);
 uintmax_t strtou(const char * __restrict, char ** __restrict, int, uintmax_t,
 uintmax_t, int *);
-void	 hexdump(const char *, const void *, size_t);
+void	 hexdump(void (*)(const char *, ...) __printflike(1, 2),
+const char *, const void *, size_t);
 
 int	 snprintb(char *, size_t, const char *, uint64_t);
 int	 snprintb_m(char *, size_t, const char *, uint64_t, size_t);



CVS commit: src/sys/lib/libkern

2017-12-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec  8 23:57:57 UTC 2017

Modified Files:
src/sys/lib/libkern: hexdump.c

Log Message:
don't ifdef _KERNEL


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/hexdump.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/lib/libkern/hexdump.c
diff -u src/sys/lib/libkern/hexdump.c:1.2 src/sys/lib/libkern/hexdump.c:1.3
--- src/sys/lib/libkern/hexdump.c:1.2	Fri Dec  8 18:49:01 2017
+++ src/sys/lib/libkern/hexdump.c	Fri Dec  8 18:57:57 2017
@@ -27,9 +27,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hexdump.c,v 1.2 2017/12/08 23:49:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hexdump.c,v 1.3 2017/12/08 23:57:57 christos Exp $");
 
-#ifndef _KERNEL
+#ifdef DEBUG_HEXDUMP
 #include 
 #include 
 #include 
@@ -83,7 +83,7 @@ hexdump(const char *msg, const void *ptr
 	}
 }
 
-#ifndef _KERNEL
+#ifdef DEBUG_HEXDUMP
 int
 main(int argc, char *argv[])
 {



CVS commit: src/sys/lib/libkern

2017-12-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec  8 23:49:01 UTC 2017

Modified Files:
src/sys/lib/libkern: hexdump.c

Log Message:
use a different, more readable approach.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/hexdump.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/lib/libkern/hexdump.c
diff -u src/sys/lib/libkern/hexdump.c:1.1 src/sys/lib/libkern/hexdump.c:1.2
--- src/sys/lib/libkern/hexdump.c:1.1	Fri Dec  8 16:51:07 2017
+++ src/sys/lib/libkern/hexdump.c	Fri Dec  8 18:49:01 2017
@@ -27,43 +27,67 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hexdump.c,v 1.1 2017/12/08 21:51:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hexdump.c,v 1.2 2017/12/08 23:49:01 christos Exp $");
 
+#ifndef _KERNEL
+#include 
+#include 
+#include 
+#include 
+static const char hexdigits[] = "0123456789abcdef";
+#else
 #include 
 #include 
+#endif
+
+#define MID (3 * 8)
+#define BAR ((3 * 16) + 1)
+#define ASC (BAR + 2)
+#define NL (BAR + 18)
 
 void
 hexdump(const char *msg, const void *ptr, size_t len)
 {
-	size_t i;
+	size_t i, p, q;
 	const unsigned char *u = ptr;
+	char buf[NL + 2];
 
 	if (msg)
 		printf("%s: %zu bytes @ %p\n", msg, len, ptr);
-for (i = 0; i < len; ) {
-printf("%02x ", u[i++]);
-if (!(i & 0x7))
-printf(" ");
-if (!(i & 0xf)) {
-printf("| ");
-for (size_t j = i - 16; j < i; j++) {
-unsigned char c = u[j];
-printf("%c", isprint(c) ? c : '.');
-			}
-printf("\n");
-}
-}
-	if ((i = (len & 0xf)) != 0) {
-for (size_t j = 16 - i; j > 0; j--) {
-printf("   ");
-if (!(j & 0x7) && i != 8)
-printf(" ");
-}
-printf(" | ");
-for (size_t j = len - i; j < len; j++) {
-			unsigned char c = u[j];
-			printf("%c", isprint(c) ? c : '.');
+
+	buf[BAR] = '|';
+	buf[BAR + 1] = ' ';
+	buf[NL] = '\n';
+	buf[NL + 1] = '\0';
+	memset(buf, ' ', BAR);
+for (q = p = i = 0; i < len; i++) {
+		unsigned char c = u[i];
+		buf[p++] = hexdigits[(c >> 4) & 0xf];
+		buf[p++] = hexdigits[(c >> 0) & 0xf];
+		buf[p++] = ' ';
+if (q == 7)
+		   buf[p++] = ' ';
+
+		buf[ASC + q++] = isprint(c) ? c : '.';
+
+		if (q == 16) {
+			q = p = 0;
+			printf("%s", buf);
+			memset(buf, ' ', BAR);
 		}
-		printf("\n");
 }
+	if (q) {
+		buf[ASC + q++] = '\n';
+		buf[ASC + q] = '\0';
+		printf("%s", buf);
+	}
+}
+
+#ifndef _KERNEL
+int
+main(int argc, char *argv[])
+{
+	hexdump("foo", main, atoi(argv[1]));
+	return 0;
 }
+#endif



CVS commit: src/sys/lib/libkern/arch/x86_64

2017-10-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Oct 30 17:13:39 UTC 2017

Modified Files:
src/sys/lib/libkern/arch/x86_64: random.S scanc.S skpc.S

Log Message:
Add END().


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/arch/x86_64/random.S \
src/sys/lib/libkern/arch/x86_64/scanc.S \
src/sys/lib/libkern/arch/x86_64/skpc.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/lib/libkern/arch/x86_64/random.S
diff -u src/sys/lib/libkern/arch/x86_64/random.S:1.2 src/sys/lib/libkern/arch/x86_64/random.S:1.3
--- src/sys/lib/libkern/arch/x86_64/random.S:1.2	Mon Apr 28 20:24:06 2008
+++ src/sys/lib/libkern/arch/x86_64/random.S	Mon Oct 30 17:13:39 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: random.S,v 1.2 2008/04/28 20:24:06 martin Exp $	*/
+/*	$NetBSD: random.S,v 1.3 2017/10/30 17:13:39 maxv Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -88,3 +88,4 @@ ENTRY(random)
 	subl	$0x7fff,%eax
 	movl	%eax,randseed(%rip)
 	ret
+END(random)
Index: src/sys/lib/libkern/arch/x86_64/scanc.S
diff -u src/sys/lib/libkern/arch/x86_64/scanc.S:1.2 src/sys/lib/libkern/arch/x86_64/scanc.S:1.3
--- src/sys/lib/libkern/arch/x86_64/scanc.S:1.2	Mon Apr 28 20:24:06 2008
+++ src/sys/lib/libkern/arch/x86_64/scanc.S	Mon Oct 30 17:13:39 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: scanc.S,v 1.2 2008/04/28 20:24:06 martin Exp $	*/
+/*	$NetBSD: scanc.S,v 1.3 2017/10/30 17:13:39 maxv Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -53,3 +53,4 @@ ENTRY(scanc)
 2:
 	movl	%ecx,%eax
 	ret
+END(scanc)
Index: src/sys/lib/libkern/arch/x86_64/skpc.S
diff -u src/sys/lib/libkern/arch/x86_64/skpc.S:1.2 src/sys/lib/libkern/arch/x86_64/skpc.S:1.3
--- src/sys/lib/libkern/arch/x86_64/skpc.S:1.2	Mon Apr 28 20:24:06 2008
+++ src/sys/lib/libkern/arch/x86_64/skpc.S	Mon Oct 30 17:13:39 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: skpc.S,v 1.2 2008/04/28 20:24:06 martin Exp $	*/
+/*	$NetBSD: skpc.S,v 1.3 2017/10/30 17:13:39 maxv Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -47,3 +47,4 @@ ENTRY(skpc)
 1:
 	movl	%ecx,%eax
 	ret
+END(skpc)



CVS commit: src/sys/lib/libkern

2017-03-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 14 09:22:38 UTC 2017

Modified Files:
src/sys/lib/libkern: kern_assert.c

Log Message:
Add garbage instructions at end of kern_assert after vpanic.

This avoids having the return address passed to vpanic confusingly
appear to be some other symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libkern/kern_assert.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/lib/libkern/kern_assert.c
diff -u src/sys/lib/libkern/kern_assert.c:1.3 src/sys/lib/libkern/kern_assert.c:1.4
--- src/sys/lib/libkern/kern_assert.c:1.3	Tue Nov 19 16:56:21 2013
+++ src/sys/lib/libkern/kern_assert.c	Tue Mar 14 09:22:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_assert.c,v 1.3 2013/11/19 16:56:21 christos Exp $	*/
+/*	$NetBSD: kern_assert.c,v 1.4 2017/03/14 09:22:37 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -50,4 +50,13 @@ kern_assert(const char *fmt, ...)
 	va_start(ap, fmt);
 	vpanic(fmt, ap);
 	va_end(ap);
+
+	/*
+	 * Force instructions at the return address of vpanic before
+	 * the next symbol, which otherwise the compiler may omit
+	 * because vpanic is marked noreturn.  This prevents seeing
+	 * whatever random symbol came after kern_assert in the linked
+	 * kernel in stack traces for assertion failures.
+	 */
+	asm volatile(".long 0");
 }



CVS commit: src/sys/lib/libkern/arch/ia64

2016-08-05 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Fri Aug  5 17:10:48 UTC 2016

Modified Files:
src/sys/lib/libkern/arch/ia64: Makefile.inc
Removed Files:
src/sys/lib/libkern/arch/ia64: memcpy.S

Log Message:
PR port-ia64/51261

Use common/lib/libc/arch/ia64/string functions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libkern/arch/ia64/Makefile.inc
cvs rdiff -u -r1.1 -r0 src/sys/lib/libkern/arch/ia64/memcpy.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/lib/libkern/arch/ia64/Makefile.inc
diff -u src/sys/lib/libkern/arch/ia64/Makefile.inc:1.4 src/sys/lib/libkern/arch/ia64/Makefile.inc:1.5
--- src/sys/lib/libkern/arch/ia64/Makefile.inc:1.4	Fri Aug 14 19:23:54 2009
+++ src/sys/lib/libkern/arch/ia64/Makefile.inc	Fri Aug  5 17:10:48 2016
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile.inc,v 1.4 2009/08/14 19:23:54 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.5 2016/08/05 17:10:48 scole Exp $
 #
 
 SRCS+=	ffs.c
 
 SRCS+=	divdi3.S divsi3.S modsi3.S moddi3.S udivdi3.S udivsi3.S
 SRCS+=	umoddi3.S umodsi3.S bswap64.S bswap32.S bswap16.S ntohl.S htonl.S
-SRCS+=	memcpy.S
+SRCS+=	bcopy.S bzero.S ffs.S memcpy.S memmove.S



CVS commit: src/sys/lib/libkern

2016-05-10 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Wed May 11 03:17:22 UTC 2016

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
provide const versions of container_of macros.

discussed with riastradh@ by email


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.122 src/sys/lib/libkern/libkern.h:1.123
--- src/sys/lib/libkern/libkern.h:1.122	Mon May  2 19:18:29 2016
+++ src/sys/lib/libkern/libkern.h	Wed May 11 03:17:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.122 2016/05/02 19:18:29 christos Exp $	*/
+/*	$NetBSD: libkern.h,v 1.123 2016/05/11 03:17:22 rtr Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -337,15 +337,22 @@ tolower(int ch)
  */
 #ifdef __COVERITY__
 #define __validate_container_of(PTR, TYPE, FIELD) 0
+#define __validate_const_container_of(PTR, TYPE, FIELD) 0
 #else
 #define __validate_container_of(PTR, TYPE, FIELD)			\
 (0 * sizeof((PTR) - &((TYPE *)(((char *)(PTR)) -			\
 offsetof(TYPE, FIELD)))->FIELD))
+#define __validate_const_container_of(PTR, TYPE, FIELD)			\
+(0 * sizeof((PTR) - &((const TYPE *)(((const char *)(PTR)) -	\
+offsetof(TYPE, FIELD)))->FIELD))
 #endif
 
 #define	container_of(PTR, TYPE, FIELD)	\
 ((TYPE *)(((char *)(PTR)) - offsetof(TYPE, FIELD))			\
 	+ __validate_container_of(PTR, TYPE, FIELD))
+#define	const_container_of(PTR, TYPE, FIELD)\
+((const TYPE *)(((const char *)(PTR)) - offsetof(TYPE, FIELD))	\
+	+ __validate_const_container_of(PTR, TYPE, FIELD))
 
 #define	MTPRNG_RLEN		624
 struct mtprng_state {



CVS commit: src/sys/lib/libkern

2016-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 28 15:20:16 UTC 2016

Modified Files:
src/sys/lib/libkern: rngtest.c

Log Message:
Fix relation in rngtest failure message to match reality.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/rngtest.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/lib/libkern/rngtest.c
diff -u src/sys/lib/libkern/rngtest.c:1.2 src/sys/lib/libkern/rngtest.c:1.3
--- src/sys/lib/libkern/rngtest.c:1.2	Fri Nov 25 12:45:00 2011
+++ src/sys/lib/libkern/rngtest.c	Mon Mar 28 15:20:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rngtest.c,v 1.2 2011/11/25 12:45:00 joerg Exp $ */
+/*	$NetBSD: rngtest.c,v 1.3 2016/03/28 15:20:16 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@ the GNU Public License.
 #include 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rngtest.c,v 1.2 2011/11/25 12:45:00 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rngtest.c,v 1.3 2016/03/28 15:20:16 riastradh Exp $");
 
 #ifndef _KERNEL
 static inline int
@@ -263,13 +263,13 @@ rngtest(rngtest_t *const rc)
 		for (last = 0; last <= 1; ++last) {
 			if (rc->rt_runs[last][run] <= minrun[run]) {
 printf("Kernel RNG \"%s\" runs test FAILURE: "
-   "too few runs of %d %ds (%d < %d)\n",
+   "too few runs of %d %ds (%d <= %d)\n",
    rc->rt_name, run, last,
    rc->rt_runs[last][run], minrun[run]);
 ++rc->rt_nerrs;
 			} else if (rc->rt_runs[last][run] >= maxrun[run]) {
 printf("Kernel RNG \"%s\" runs test FAILURE: "
-   "too many runs of %d %ds (%d > %d)\n",
+   "too many runs of %d %ds (%d >= %d)\n",
    rc->rt_name, run, last,
    rc->rt_runs[last][run], maxrun[run]);
 ++rc->rt_nerrs;



CVS commit: src/sys/lib/libkern

2015-10-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Oct 29 00:18:55 UTC 2015

Modified Files:
src/sys/lib/libkern: Makefile.inc

Log Message:
remove "@echo done" from 4 rules that don't need it and the random "done"
in my build logs don't help understanding.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/lib/libkern/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/Makefile.inc
diff -u src/sys/lib/libkern/Makefile.inc:1.43 src/sys/lib/libkern/Makefile.inc:1.44
--- src/sys/lib/libkern/Makefile.inc:1.43	Sun Sep  6 15:34:55 2015
+++ src/sys/lib/libkern/Makefile.inc	Thu Oct 29 00:18:55 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.43 2015/09/06 15:34:55 uebayasi Exp $
+#	$NetBSD: Makefile.inc,v 1.44 2015/10/29 00:18:55 mrg Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -58,7 +58,6 @@ ${KERNLIB}:		.NOTMAIN .MAKE __always_mak
 .else
 	@${KERNMAKE} libkern.o
 .endif
-	@echo done
 
 ${KERNLIB_PROF}:	.NOTMAIN .MAKE __always_make_kernlib
 	@echo making sure the profiled kern library is up to date...
@@ -67,30 +66,25 @@ ${KERNLIB_PROF}:	.NOTMAIN .MAKE __always
 .else
 	@${KERNMAKE} libkern.po
 .endif
-	@echo done
 
 ${KERNLIBLN}:		.NOTMAIN .MAKE __always_make_kernlib
 	@echo making sure the kern lint library is up to date...
 	@${KERNMAKE} ${LIBKERNLNBN}
-	@echo done
 
 clean:			.NOTMAIN cleankernlib
 cleankernlib:		.NOTMAIN
 	@echo cleaning the kern library objects
 	@if [ -d "${KERNDST}" ]; then ${KERNMAKE} clean; fi
-	@echo done
 
 cleandir distclean:	.NOTMAIN cleandirkernlib
 cleandirkernlib:	.NOTMAIN
 	@echo cleandiring the kern library objects
 	@if [ -d "${KERNDST}" ]; then ${KERNMAKE} cleandir; fi
-	@echo done
 
 dependall depend:	.NOTMAIN dependkernlib
 dependkernlib:		.NOTMAIN .MAKE __always_make_kernlib
 	@echo depending the kern library objects
 	@${KERNMAKE} depend
-	@echo done
 
 __always_make_kernlib:	.NOTMAIN
 	@(mkdir -p ${KERNDST})



CVS commit: src/sys/lib/libkern/arch/m68k

2015-07-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jul 30 15:29:52 UTC 2015

Modified Files:
src/sys/lib/libkern/arch/m68k: Makefile.inc

Log Message:
Revert untested and unnecessary change in previous rev 1.36.

Our autobuild doesn't always reflect the latest fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/lib/libkern/arch/m68k/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.36 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.37
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.36	Thu Jul 30 07:44:40 2015
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Thu Jul 30 15:29:52 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.36 2015/07/30 07:44:40 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.37 2015/07/30 15:29:52 tsutsui Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -12,7 +12,7 @@ SRCS+=	ffs.S
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
 .endif
 .if defined(MACHINE_ARCH)  ${MACHINE_ARCH} == m68k
-SRCS+=	mulsi3.S random.S
+SRCS+=	random.S
 .else
 random.o random.po random.pico random.d: random.c
 .endif



CVS commit: src/sys/lib/libkern/arch/m68k

2015-07-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 30 07:44:40 UTC 2015

Modified Files:
src/sys/lib/libkern/arch/m68k: Makefile.inc

Log Message:
add mulsi3, needed by inet_addr.o


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/lib/libkern/arch/m68k/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.35 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.36
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.35	Mon Sep  8 08:12:19 2014
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Thu Jul 30 03:44:40 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.35 2014/09/08 12:12:19 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.36 2015/07/30 07:44:40 christos Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -12,7 +12,7 @@ SRCS+=	ffs.S
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
 .endif
 .if defined(MACHINE_ARCH)  ${MACHINE_ARCH} == m68k
-SRCS+=	random.S
+SRCS+=	mulsi3.S random.S
 .else
 random.o random.po random.pico random.d: random.c
 .endif



CVS commit: src/sys/lib/libkern

2015-05-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May 29 19:38:59 UTC 2015

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
If the platform support popcount as a __builtin, use that in preference
to the libc versions.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.119 src/sys/lib/libkern/libkern.h:1.120
--- src/sys/lib/libkern/libkern.h:1.119	Sat May  9 18:49:36 2015
+++ src/sys/lib/libkern/libkern.h	Fri May 29 19:38:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.119 2015/05/09 18:49:36 christos Exp $	*/
+/*	$NetBSD: libkern.h,v 1.120 2015/05/29 19:38:59 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -443,11 +443,20 @@ int	 snprintb_m(char *, size_t, const ch
 int	 kheapsort(void *, size_t, size_t, int (*)(const void *, const void *),
 		   void *);
 uint32_t crc32(uint32_t, const uint8_t *, size_t);
+#if __GNUC_PREREQ__(4, 5) \
+ (defined(__alpha_cix__) || defined(__mips_popcount))
+#define	popcount	__builtin_popcount
+#define	popcountl	__builtin_popcountl
+#define	popcountll	__builtin_popcountll
+#define	popcount32	__builtin_popcount
+#define	popcount64	__builtin_popcountll
+#else
 unsigned int	popcount(unsigned int) __constfunc;
 unsigned int	popcountl(unsigned long) __constfunc;
 unsigned int	popcountll(unsigned long long) __constfunc;
 unsigned int	popcount32(uint32_t) __constfunc;
 unsigned int	popcount64(uint64_t) __constfunc;
+#endif
 
 void	*explicit_memset(void *, int, size_t);
 int	consttime_memequal(const void *, const void *, size_t);



CVS commit: src/sys/lib/libkern

2015-05-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  9 18:49:36 UTC 2015

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
tricks with sizeof() make coverity complain.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.118 src/sys/lib/libkern/libkern.h:1.119
--- src/sys/lib/libkern/libkern.h:1.118	Mon Apr 20 11:22:17 2015
+++ src/sys/lib/libkern/libkern.h	Sat May  9 14:49:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.118 2015/04/20 15:22:17 riastradh Exp $	*/
+/*	$NetBSD: libkern.h,v 1.119 2015/05/09 18:49:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -329,12 +329,19 @@ tolower(int ch)
  *
  * The 0*sizeof((PTR) - ...) causes the compiler to warn if the type of
  * *fp does not match the type of struct bar::b_foo.
+ * We skip the validation for coverity runs to avoid warnings.
  */
+#ifdef __COVERITY__
+#define __validate_container_of(PTR, TYPE, FIELD) 0
+#else
+#define __validate_container_of(PTR, TYPE, FIELD)			\
+(0 * sizeof((PTR) - ((TYPE *)(((char *)(PTR)) -			\
+offsetof(TYPE, FIELD)))-FIELD))
+#endif
+
 #define	container_of(PTR, TYPE, FIELD)	\
-	((TYPE *)(((char *)(PTR)) - offsetof(TYPE, FIELD) +		\
-	0*sizeof((PTR) -		\
-		((TYPE *)(((char *)(PTR)) -\
-			offsetof(TYPE, FIELD)))-FIELD)))
+((TYPE *)(((char *)(PTR)) - offsetof(TYPE, FIELD))			\
+	+ __validate_container_of(PTR, TYPE, FIELD))
 
 #define	MTPRNG_RLEN		624
 struct mtprng_state {



CVS commit: src/sys/lib/libkern

2015-01-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 16 18:36:31 UTC 2015

Modified Files:
src/sys/lib/libkern: Makefile.libkern libkern.h

Log Message:
strtoi and strtou for the kernel


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.116 -r1.117 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.36 src/sys/lib/libkern/Makefile.libkern:1.37
--- src/sys/lib/libkern/Makefile.libkern:1.36	Thu Nov 20 11:25:16 2014
+++ src/sys/lib/libkern/Makefile.libkern	Fri Jan 16 13:36:31 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.36 2014/11/20 16:25:16 christos Exp $
+#	$NetBSD: Makefile.libkern,v 1.37 2015/01/16 18:36:31 christos Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -73,6 +73,7 @@ SRCS+=	memset.c 
 
 SRCS+=	popcount32.c popcount64.c
 SRCS+=	strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c
+SRCS+=	strtoi.c strtou.c
 
 SRCS+=	scanc.c skpc.c
 SRCS+=	random.c

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.116 src/sys/lib/libkern/libkern.h:1.117
--- src/sys/lib/libkern/libkern.h:1.116	Thu Nov 20 11:25:16 2014
+++ src/sys/lib/libkern/libkern.h	Fri Jan 16 13:36:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.116 2014/11/20 16:25:16 christos Exp $	*/
+/*	$NetBSD: libkern.h,v 1.117 2015/01/16 18:36:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -399,6 +399,11 @@ long long strtoll(const char *, char **,
 unsigned long long strtoull(const char *, char **, int);
 intmax_t  strtoimax(const char *, char **, int);
 uintmax_t strtoumax(const char *, char **, int);
+intmax_t strtoi(const char * __restrict, char ** __restrict, int, intmax_t,
+intmax_t, int *);
+uintmax_t strtou(const char * __restrict, char ** __restrict, int, uintmax_t,
+uintmax_t, int *);
+
 int	 snprintb(char *, size_t, const char *, uint64_t);
 int	 snprintb_m(char *, size_t, const char *, uint64_t, size_t);
 int	 kheapsort(void *, size_t, size_t, int (*)(const void *, const void *),



CVS commit: src/sys/lib/libkern

2014-11-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 20 16:25:16 UTC 2014

Modified Files:
src/sys/lib/libkern: Makefile.libkern libkern.h
Removed Files:
src/sys/lib/libkern: bcd.c

Log Message:
bcdtobin and bintobcd are now inlines in dev/clock_subr.h


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.1 -r0 src/sys/lib/libkern/bcd.c
cvs rdiff -u -r1.115 -r1.116 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.35 src/sys/lib/libkern/Makefile.libkern:1.36
--- src/sys/lib/libkern/Makefile.libkern:1.35	Sun Aug 10 12:44:36 2014
+++ src/sys/lib/libkern/Makefile.libkern	Thu Nov 20 11:25:16 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.35 2014/08/10 16:44:36 tls Exp $
+#	$NetBSD: Makefile.libkern,v 1.36 2014/11/20 16:25:16 christos Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -54,7 +54,7 @@ SRCS+=	cpuset.c inet_addr.c intoa.c
 SRCS+=	bswap64.c
 .endif
 SRCS+=	md4c.c md5c.c rmd160.c sha1.c sha2.c murmurhash.c
-SRCS+=	pmatch.c bcd.c mcount.c mertwist.c crc32.c
+SRCS+=	pmatch.c mcount.c mertwist.c crc32.c
 
 SRCS+=	ppath_kmem_alloc.c
 

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.115 src/sys/lib/libkern/libkern.h:1.116
--- src/sys/lib/libkern/libkern.h:1.115	Sun Aug 10 12:44:36 2014
+++ src/sys/lib/libkern/libkern.h	Thu Nov 20 11:25:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.115 2014/08/10 16:44:36 tls Exp $	*/
+/*	$NetBSD: libkern.h,v 1.116 2014/11/20 16:25:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -367,10 +367,6 @@ int	 ffs(int);
 
 void	 kern_assert(const char *, ...)
 __attribute__((__format__(__printf__, 1, 2)));
-unsigned int
-	bcdtobin(unsigned int);
-unsigned int
-	bintobcd(unsigned int);
 u_int32_t
 	inet_addr(const char *);
 struct in_addr;



CVS commit: src/sys/lib/libkern/arch/m68k

2014-09-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Sep  8 12:12:19 UTC 2014

Modified Files:
src/sys/lib/libkern/arch/m68k: Makefile.inc

Log Message:
Revert 1.33 and 1.34 for now, until either .INVISIBLE is reinstanciated
or random.S dropped.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/lib/libkern/arch/m68k/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.34 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.35
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.34	Mon Sep  1 07:32:35 2014
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Mon Sep  8 12:12:19 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.34 2014/09/01 07:32:35 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.35 2014/09/08 12:12:19 joerg Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -11,6 +11,8 @@ SRCS+=	ffs.S
 .if defined(MACHINE_ARCH)  (${MACHINE_ARCH} == m68000)
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
 .endif
-.if defined(MACHINE_ARCH)  (${MACHINE_ARCH} != m68k)
-random.S: .INVISIBLE
+.if defined(MACHINE_ARCH)  ${MACHINE_ARCH} == m68k
+SRCS+=	random.S
+.else
+random.o random.po random.pico random.d: random.c
 .endif



CVS commit: src/sys/lib/libkern/arch/m68k

2014-09-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Sep  1 07:32:35 UTC 2014

Modified Files:
src/sys/lib/libkern/arch/m68k: Makefile.inc

Log Message:
Make random.S invisible for coldfire too (e.g. anything not m68k)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/lib/libkern/arch/m68k/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.33 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.34
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.33	Wed Aug 27 08:51:37 2014
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Mon Sep  1 07:32:35 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.33 2014/08/27 08:51:37 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.34 2014/09/01 07:32:35 matt Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -10,5 +10,7 @@ SRCS+=	ffs.S
 
 .if defined(MACHINE_ARCH)  (${MACHINE_ARCH} == m68000)
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
+.endif
+.if defined(MACHINE_ARCH)  (${MACHINE_ARCH} != m68k)
 random.S: .INVISIBLE
 .endif



CVS commit: src/sys/lib/libkern/arch/m68k

2014-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 27 08:51:37 UTC 2014

Modified Files:
src/sys/lib/libkern/arch/m68k: Makefile.inc

Log Message:
use .INVISIBLE to hide random.S, instead of extra rules.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/lib/libkern/arch/m68k/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.32 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.33
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.32	Tue Mar 18 14:20:43 2014
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Wed Aug 27 04:51:37 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.32 2014/03/18 18:20:43 riastradh Exp $
+#	$NetBSD: Makefile.inc,v 1.33 2014/08/27 08:51:37 christos Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -10,9 +10,5 @@ SRCS+=	ffs.S
 
 .if defined(MACHINE_ARCH)  (${MACHINE_ARCH} == m68000)
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
-.endif
-.if defined(MACHINE_ARCH)  ${MACHINE_ARCH} == m68k
-SRCS+=	random.S
-.else
-random.o random.po random.pico random.d: random.c
+random.S: .INVISIBLE
 .endif



CVS commit: src/sys/lib/libkern

2014-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  4 16:44:26 UTC 2014

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
${.PARSEDIR} not .${PARSEDIR} for Makefile.compiler-rt include


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.32 src/sys/lib/libkern/Makefile.libkern:1.33
--- src/sys/lib/libkern/Makefile.libkern:1.32	Wed Mar 12 00:22:53 2014
+++ src/sys/lib/libkern/Makefile.libkern	Fri Jul  4 16:44:26 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.32 2014/03/12 00:22:53 pooka Exp $
+#	$NetBSD: Makefile.libkern,v 1.33 2014/07/04 16:44:26 jmcneill Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -44,7 +44,7 @@ CPPFLAGS+=	-I${KERNDIR}/../../../common/
 .endif
 
 .if !defined(RUMPKERNEL)
-.include .${PARSEDIR}/Makefile.compiler-rt
+.include ${.PARSEDIR}/Makefile.compiler-rt
 .endif
 
 # Other stuff



CVS commit: src/sys/lib/libkern/arch/hppa

2014-03-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Mar 13 16:09:11 UTC 2014

Modified Files:
src/sys/lib/libkern/arch/hppa: Makefile.inc

Log Message:
remove compiler-rt duplicates to fix build


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/lib/libkern/arch/hppa/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/hppa/Makefile.inc
diff -u src/sys/lib/libkern/arch/hppa/Makefile.inc:1.11 src/sys/lib/libkern/arch/hppa/Makefile.inc:1.12
--- src/sys/lib/libkern/arch/hppa/Makefile.inc:1.11	Tue Sep 22 09:57:16 2009
+++ src/sys/lib/libkern/arch/hppa/Makefile.inc	Thu Mar 13 16:09:11 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.11 2009/09/22 09:57:16 pooka Exp $
+#	$NetBSD: Makefile.inc,v 1.12 2014/03/13 16:09:11 pooka Exp $
 
 SRCS+=	milli.S
 SRCS+=	bcopy.S memcpy.S memmove.S
@@ -8,5 +8,4 @@ SRCS+=	bcopy.S memcpy.S memmove.S
 SRCS+=	spcopy.S
 .endif
 
-SRCS+= ashrdi3.c divdi3.c
 SRCS+= ffs.c bswap16.c bswap32.c



CVS commit: src/sys/lib/libkern

2014-03-11 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Mar 12 00:22:53 UTC 2014

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
Do not include compiler-rt in librump.  librump is not a toolchain support
library, and toolchain support belongs in the host libc or libgcc or
equivalent entity that is actually supposed to complement the toolchain.

Fixes librump build on (a) Linux ARM (collisions with libgcc)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.31 src/sys/lib/libkern/Makefile.libkern:1.32
--- src/sys/lib/libkern/Makefile.libkern:1.31	Wed Jan 29 23:37:18 2014
+++ src/sys/lib/libkern/Makefile.libkern	Wed Mar 12 00:22:53 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.31 2014/01/29 23:37:18 joerg Exp $
+#	$NetBSD: Makefile.libkern,v 1.32 2014/03/12 00:22:53 pooka Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -43,7 +43,9 @@ CPPFLAGS+=	-I${KERNDIR}/../../../common/
 .include $M/Makefile.inc
 .endif
 
+.if !defined(RUMPKERNEL)
 .include .${PARSEDIR}/Makefile.compiler-rt
+.endif
 
 # Other stuff
 SRCS+=	kern_assert.c __main.c



CVS commit: src/sys/lib/libkern/arch

2014-03-07 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Mar  7 20:23:09 UTC 2014

Modified Files:
src/sys/lib/libkern/arch/sparc: random.S
src/sys/lib/libkern/arch/sparc64: random.S

Log Message:
Align explicitly to make kernels compiled by clang generate
properly aligned code.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libkern/arch/sparc/random.S
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libkern/arch/sparc64/random.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/lib/libkern/arch/sparc/random.S
diff -u src/sys/lib/libkern/arch/sparc/random.S:1.4 src/sys/lib/libkern/arch/sparc/random.S:1.5
--- src/sys/lib/libkern/arch/sparc/random.S:1.4	Thu Sep 12 15:36:17 2013
+++ src/sys/lib/libkern/arch/sparc/random.S	Fri Mar  7 20:23:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: random.S,v 1.4 2013/09/12 15:36:17 joerg Exp $	*/
+/*	$NetBSD: random.S,v 1.5 2014/03/07 20:23:09 nakayama Exp $	*/
 
 /*
  * Copyright (c) 1990,1993 The Regents of the University of California.
@@ -43,6 +43,7 @@
 #include machine/asm.h
 
 	.data
+	.align	4
 randseed:
 	.long	1
 

Index: src/sys/lib/libkern/arch/sparc64/random.S
diff -u src/sys/lib/libkern/arch/sparc64/random.S:1.4 src/sys/lib/libkern/arch/sparc64/random.S:1.5
--- src/sys/lib/libkern/arch/sparc64/random.S:1.4	Thu Sep 12 15:36:17 2013
+++ src/sys/lib/libkern/arch/sparc64/random.S	Fri Mar  7 20:23:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: random.S,v 1.4 2013/09/12 15:36:17 joerg Exp $	*/
+/*	$NetBSD: random.S,v 1.5 2014/03/07 20:23:09 nakayama Exp $	*/
 
 /*
  * Copyright (c) 1990,1993 The Regents of the University of California.
@@ -43,6 +43,7 @@
 #include machine/asm.h
 
 	.data
+	.align	4
 randseed:
 	.long	1
 



CVS commit: src/sys/lib/libkern

2014-02-27 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 27 18:05:07 UTC 2014

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
Provide labs, llabs and imaxabs for kernel use.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.112 src/sys/lib/libkern/libkern.h:1.113
--- src/sys/lib/libkern/libkern.h:1.112	Fri Dec 27 20:25:33 2013
+++ src/sys/lib/libkern/libkern.h	Thu Feb 27 18:05:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.112 2013/12/27 20:25:33 christos Exp $	*/
+/*	$NetBSD: libkern.h,v 1.113 2014/02/27 18:05:07 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -52,6 +52,9 @@ LIBKERN_INLINE long lmin(long, long) __u
 LIBKERN_INLINE u_long ulmax(u_long, u_long) __unused;
 LIBKERN_INLINE u_long ulmin(u_long, u_long) __unused;
 LIBKERN_INLINE int abs(int) __unused;
+LIBKERN_INLINE long labs(long) __unused;
+LIBKERN_INLINE long long llabs(long long) __unused;
+LIBKERN_INLINE intmax_t imaxabs(intmax_t) __unused;
 
 LIBKERN_INLINE int isspace(int) __unused;
 LIBKERN_INLINE int isascii(int) __unused;
@@ -111,6 +114,24 @@ abs(int j)
 	return(j  0 ? -j : j);
 }
 
+LIBKERN_INLINE long
+labs(long j)
+{
+	return(j  0 ? -j : j);
+}
+
+LIBKERN_INLINE long long
+llabs(long long j)
+{
+	return(j  0 ? -j : j);
+}
+
+LIBKERN_INLINE intmax_t
+imaxabs(intmax_t j)
+{
+	return(j  0 ? -j : j);
+}
+
 LIBKERN_INLINE int
 isspace(int ch)
 {



CVS commit: src/sys/lib/libkern

2014-02-09 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Feb  9 12:53:30 UTC 2014

Modified Files:
src/sys/lib/libkern: Makefile

Log Message:
Revert previous revision. It bkeaks profiling kernel builds.
LIBISPRIVATE unconditionnally set MKPROFILE to no, preventing
profiling kernel library.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/lib/libkern/Makefile

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

Modified files:

Index: src/sys/lib/libkern/Makefile
diff -u src/sys/lib/libkern/Makefile:1.96 src/sys/lib/libkern/Makefile:1.97
--- src/sys/lib/libkern/Makefile:1.96	Wed Aug 21 05:50:14 2013
+++ src/sys/lib/libkern/Makefile	Sun Feb  9 12:53:30 2014
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.96 2013/08/21 05:50:14 matt Exp $
+#	$NetBSD: Makefile,v 1.97 2014/02/09 12:53:30 njoly Exp $
 
 LIB=		kern
-LIBISPRIVATE?=	yes
+NOPIC=		# defined
+LLIBS=		# defined
 
 .include Makefile.libkern
 .ifndef ARCHSUBDIR
@@ -10,6 +11,10 @@ LIBISPRIVATE?=	yes
 	@false
 .endif
 
+# only needed during build
+libinstall::
+
+.undef DESTDIR
 .include bsd.lib.mk
 
 lib${LIB}.o:: ${OBJS}



CVS commit: src/sys/lib/libkern

2014-01-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jan 29 22:30:24 UTC 2014

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
For ARM EABI, includ divide-by-0 trap handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.2 src/sys/lib/libkern/Makefile.compiler-rt:1.3
--- src/sys/lib/libkern/Makefile.compiler-rt:1.2	Fri Jan 17 00:49:55 2014
+++ src/sys/lib/libkern/Makefile.compiler-rt	Wed Jan 29 22:30:24 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.2 2014/01/17 00:49:55 joerg Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.3 2014/01/29 22:30:24 joerg Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -86,7 +86,9 @@ GENERIC_SRCS+= \
 	aeabi_idivmod.S \
 	aeabi_ldivmod.S \
 	aeabi_uidivmod.S \
-	aeabi_uldivmod.S
+	aeabi_uldivmod.S \
+	__aeabi_idiv0.c \
+	__aeabi_ldiv0.c
 .  endif
 .endif
 



CVS commit: src/sys/lib/libkern

2014-01-16 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 17 00:49:55 UTC 2014

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
This is not libc, so don't check the libc arch macro.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.1 src/sys/lib/libkern/Makefile.compiler-rt:1.2
--- src/sys/lib/libkern/Makefile.compiler-rt:1.1	Tue Dec  3 16:15:22 2013
+++ src/sys/lib/libkern/Makefile.compiler-rt	Fri Jan 17 00:49:55 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.1 2013/12/03 16:15:22 joerg Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.2 2014/01/17 00:49:55 joerg Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -81,7 +81,7 @@ GENERIC_SRCS+= \
 	umodti3.c
 
 .if ${MACHINE_CPU} == arm
-.  if !empty(LIBC_MACHINE_ARCH:Mearm*)
+.  if !empty(MACHINE_ARCH:Mearm*)
 GENERIC_SRCS+= \
 	aeabi_idivmod.S \
 	aeabi_ldivmod.S \



CVS commit: src/sys/lib/libkern

2014-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jan 15 21:12:57 UTC 2014

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
For HAVE_LIBGCC=no, use compiler-rt for quad support.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.29 src/sys/lib/libkern/Makefile.libkern:1.30
--- src/sys/lib/libkern/Makefile.libkern:1.29	Fri Dec 27 20:25:33 2013
+++ src/sys/lib/libkern/Makefile.libkern	Wed Jan 15 21:12:57 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.29 2013/12/27 20:25:33 christos Exp $
+#	$NetBSD: Makefile.libkern,v 1.30 2014/01/15 21:12:57 joerg Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -43,6 +43,9 @@ CPPFLAGS+=	-I${KERNDIR}/../../../common/
 .include $M/Makefile.inc
 .endif
 
+.if ${HAVE_LIBGCC} == no
+.include .${PARSEDIR}/Makefile.compiler-rt
+.else
 .if (${MACHINE_ARCH} != alpha)  \
 (${MACHINE_ARCH} != mips64eb || !empty(CFLAGS:M-mabi=32))  \
 (${MACHINE_ARCH} != mips64el || !empty(CFLAGS:M-mabi=32))  \
@@ -54,6 +57,7 @@ SRCS+=	adddi3.c anddi3.c ashldi3.c ashrd
 	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
 	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
 .endif
+.endif
 
 # Other stuff
 SRCS+=	kern_assert.c __main.c



CVS commit: src/sys/lib/libkern

2013-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 27 20:25:33 UTC 2013

Modified Files:
src/sys/lib/libkern: Makefile.libkern libkern.h

Log Message:
add strncat (for acpi)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.111 -r1.112 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.28 src/sys/lib/libkern/Makefile.libkern:1.29
--- src/sys/lib/libkern/Makefile.libkern:1.28	Tue Dec 10 20:24:08 2013
+++ src/sys/lib/libkern/Makefile.libkern	Fri Dec 27 15:25:33 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.28 2013/12/11 01:24:08 joerg Exp $
+#	$NetBSD: Makefile.libkern,v 1.29 2013/12/27 20:25:33 christos Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -88,7 +88,7 @@ SRCS+=	rngtest.c
 
 SRCS+=	memchr.c
 SRCS+=	strcat.c strcmp.c strcpy.c strlen.c strnlen.c
-SRCS+=	strncmp.c strncpy.c
+SRCS+=	strncat.c strncmp.c strncpy.c
 SRCS+=	strcasecmp.c strncasecmp.c
 
 SRCS+=	xlat_mbr_fstype.c

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.111 src/sys/lib/libkern/libkern.h:1.112
--- src/sys/lib/libkern/libkern.h:1.111	Sun Dec 15 16:15:41 2013
+++ src/sys/lib/libkern/libkern.h	Fri Dec 27 15:25:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.111 2013/12/15 21:15:41 pooka Exp $	*/
+/*	$NetBSD: libkern.h,v 1.112 2013/12/27 20:25:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -292,6 +292,7 @@ char	*strsep(char **, const char *);
 /* These exist in GCC 3.x, but we don't bother. */
 char	*strcat(char *, const char *);
 char	*strncpy(char *, const char *, size_t);
+char	*strncat(char *, const char *, size_t);
 int	 strncmp(const char *, const char *, size_t);
 char	*strchr(const char *, int);
 char	*strrchr(const char *, int);



CVS commit: src/sys/lib/libkern

2013-12-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 15 21:15:41 UTC 2013

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
Allow overriding CTASSERT.  This helps with building NetBSD sources with
compilers that don't support __COUNTER__ -- shifting the CTASSERTs
around to avoid __LINE__ conflicts is a hopeless struggle.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.110 src/sys/lib/libkern/libkern.h:1.111
--- src/sys/lib/libkern/libkern.h:1.110	Wed Dec 11 01:24:08 2013
+++ src/sys/lib/libkern/libkern.h	Sun Dec 15 21:15:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.110 2013/12/11 01:24:08 joerg Exp $	*/
+/*	$NetBSD: libkern.h,v 1.111 2013/12/15 21:15:41 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -189,9 +189,15 @@ tolower(int ch)
 #endif
 #endif
 
+#ifndef	CTASSERT
 #define	CTASSERT(x)		__CTASSERT(x)
+#endif
+#ifndef	CTASSERT_SIGNED
 #define	CTASSERT_SIGNED(x)	__CTASSERT(((typeof(x))-1)  0)
+#endif
+#ifndef	CTASSERT_UNSIGNED
 #define	CTASSERT_UNSIGNED(x)	__CTASSERT(((typeof(x))-1) = 0)
+#endif
 
 #ifndef DIAGNOSTIC
 #define _DIAGASSERT(a)	(void)0



CVS commit: src/sys/lib/libkern

2013-12-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Dec  3 16:15:22 UTC 2013

Added Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
libkern build glue for compiler-rt.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/lib/libkern/Makefile.compiler-rt

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

Added files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u /dev/null src/sys/lib/libkern/Makefile.compiler-rt:1.1
--- /dev/null	Tue Dec  3 16:15:22 2013
+++ src/sys/lib/libkern/Makefile.compiler-rt	Tue Dec  3 16:15:22 2013
@@ -0,0 +1,106 @@
+# $NetBSD: Makefile.compiler-rt,v 1.1 2013/12/03 16:15:22 joerg Exp $
+
+COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
+
+.if ${MACHINE_ARCH} == powerpc
+COMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/ppc
+COMPILER_RT_ARCH_DIR=	${COMPILER_RT_SRCDIR}/lib/ppc
+.else
+COMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/${MACHINE_CPU}
+COMPILER_RT_ARCH_DIR=	${COMPILER_RT_SRCDIR}/lib/${MACHINE_ARCH}
+.endif
+
+.PATH: ${COMPILER_RT_CPU_DIR}
+.PATH: ${COMPILER_RT_ARCH_DIR}
+.PATH: ${COMPILER_RT_SRCDIR}/lib
+
+GENERIC_SRCS+= \
+	absvdi2.c \
+	absvsi2.c \
+	absvti2.c \
+	addvdi3.c \
+	addvsi3.c \
+	addvti3.c \
+	ashldi3.c \
+	ashlti3.c \
+	ashrdi3.c \
+	ashrti3.c \
+	clzdi2.c \
+	clzsi2.c \
+	clzti2.c \
+	cmpdi2.c \
+	cmpti2.c \
+	ctzdi2.c \
+	ctzsi2.c \
+	ctzti2.c \
+	divdi3.c \
+	divmoddi4.c \
+	divmodsi4.c \
+	divsi3.c \
+	divti3.c \
+	ffsdi2.c \
+	ffsti2.c \
+	int_util.c \
+	lshrdi3.c \
+	lshrti3.c \
+	moddi3.c \
+	modsi3.c \
+	modti3.c \
+	muldi3.c \
+	mulodi4.c \
+	mulosi4.c \
+	muloti4.c \
+	multi3.c \
+	mulvdi3.c \
+	mulvsi3.c \
+	mulvti3.c \
+	negdi2.c \
+	negti2.c \
+	negvdi2.c \
+	negvsi2.c \
+	negvti2.c \
+	paritydi2.c \
+	paritysi2.c \
+	parityti2.c \
+	popcountdi2.c \
+	popcountsi2.c \
+	popcountti2.c \
+	subvdi3.c \
+	subvsi3.c \
+	subvti3.c \
+	ucmpdi2.c \
+	ucmpti2.c \
+	udivdi3.c \
+	udivmoddi4.c \
+	udivmodsi4.c \
+	udivmodti4.c \
+	udivsi3.c \
+	udivti3.c \
+	umoddi3.c \
+	umodsi3.c \
+	umodti3.c
+
+.if ${MACHINE_CPU} == arm
+.  if !empty(LIBC_MACHINE_ARCH:Mearm*)
+GENERIC_SRCS+= \
+	aeabi_idivmod.S \
+	aeabi_ldivmod.S \
+	aeabi_uidivmod.S \
+	aeabi_uldivmod.S
+.  endif
+.endif
+
+.for src in ${GENERIC_SRCS}
+.  if exists(${COMPILER_RT_CPU_DIR}/${src:R}.S) || \
+  exists(${COMPILER_RT_ARCH_DIR}/${src:R}.S)
+SRCS+=	${src:R}.S
+.  else
+SRCS+=	${src}
+COPTS.${src}+=	-Wno-missing-prototypes \
+		-Wno-old-style-definition \
+		-Wno-strict-prototypes \
+		-Wno-uninitialized
+.  endif
+.endfor
+
+CPPFLAGS.int_util.c+=	-DKERNEL_USE



CVS commit: src/sys/lib/libkern

2013-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 19 16:56:21 UTC 2013

Modified Files:
src/sys/lib/libkern: kern_assert.c

Log Message:
For the purposes of static analysis, this never returns.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/kern_assert.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/lib/libkern/kern_assert.c
diff -u src/sys/lib/libkern/kern_assert.c:1.2 src/sys/lib/libkern/kern_assert.c:1.3
--- src/sys/lib/libkern/kern_assert.c:1.2	Thu Sep 29 16:50:09 2011
+++ src/sys/lib/libkern/kern_assert.c	Tue Nov 19 11:56:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_assert.c,v 1.2 2011/09/29 20:50:09 christos Exp $	*/
+/*	$NetBSD: kern_assert.c,v 1.3 2013/11/19 16:56:21 christos Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -38,6 +38,7 @@
 #include lib/libkern/libkern.h
 #endif
 
+/* coverity[+kill] */
 void
 kern_assert(const char *fmt, ...)
 {



CVS commit: src/sys/lib/libkern

2013-11-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov  3 00:01:44 UTC 2013

Modified Files:
src/sys/lib/libkern: softfloat.c

Log Message:
mark some variables as unused, but keep them around as comments


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libkern/softfloat.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/lib/libkern/softfloat.c
diff -u src/sys/lib/libkern/softfloat.c:1.4 src/sys/lib/libkern/softfloat.c:1.5
--- src/sys/lib/libkern/softfloat.c:1.4	Sun Dec 11 07:24:37 2005
+++ src/sys/lib/libkern/softfloat.c	Sat Nov  2 20:01:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.4 2005/12/11 12:24:37 christos Exp $ */
+/* $NetBSD: softfloat.c,v 1.5 2013/11/03 00:01:43 christos Exp $ */
 
 /*
  * This version hacked for use with gcc -msoft-float by bjh21.
@@ -49,7 +49,7 @@ this code that are retained.
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: softfloat.c,v 1.4 2005/12/11 12:24:37 christos Exp $);
+__RCSID($NetBSD: softfloat.c,v 1.5 2013/11/03 00:01:43 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef SOFTFLOAT_FOR_GCC
@@ -1980,7 +1980,7 @@ according to the IEC/IEEE Standard for B
 */
 float32 float32_rem( float32 a, float32 b )
 {
-flag aSign, bSign, zSign;
+flag aSign, bSign __unused, zSign;
 int16 aExp, bExp, expDiff;
 bits32 aSig, bSig;
 bits32 q;
@@ -2950,7 +2950,7 @@ according to the IEC/IEEE Standard for B
 */
 float64 float64_rem( float64 a, float64 b )
 {
-flag aSign, bSign, zSign;
+flag aSign, bSign __unused, zSign;
 int16 aExp, bExp, expDiff;
 bits64 aSig, bSig;
 bits64 q, alternateASig;



CVS commit: src/sys/lib/libkern

2013-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug 28 16:20:38 UTC 2013

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
Fix libkern's prototype for explicit_memset.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.107 src/sys/lib/libkern/libkern.h:1.108
--- src/sys/lib/libkern/libkern.h:1.107	Mon Jun 24 04:21:20 2013
+++ src/sys/lib/libkern/libkern.h	Wed Aug 28 16:20:38 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.107 2013/06/24 04:21:20 riastradh Exp $	*/
+/*	$NetBSD: libkern.h,v 1.108 2013/08/28 16:20:38 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -346,6 +346,6 @@ unsigned int	popcountll(unsigned long lo
 unsigned int	popcount32(uint32_t) __constfunc;
 unsigned int	popcount64(uint64_t) __constfunc;
 
-void	explicit_memset(void *, int, size_t);
+void	*explicit_memset(void *, int, size_t);
 int	consttime_memequal(const void *, const void *, size_t);
 #endif /* !_LIB_LIBKERN_LIBKERN_H_ */



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

2013-08-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 21 08:30:18 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: clzsi2.S

Log Message:
Thumbify


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libkern/arch/arm/clzsi2.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/lib/libkern/arch/arm/clzsi2.S
diff -u src/sys/lib/libkern/arch/arm/clzsi2.S:1.5 src/sys/lib/libkern/arch/arm/clzsi2.S:1.6
--- src/sys/lib/libkern/arch/arm/clzsi2.S:1.5	Sun Aug 11 04:58:01 2013
+++ src/sys/lib/libkern/arch/arm/clzsi2.S	Wed Aug 21 08:30:18 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: clzsi2.S,v 1.5 2013/08/11 04:58:01 matt Exp $ */
+/* $NetBSD: clzsi2.S,v 1.6 2013/08/21 08:30:18 matt Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,6 @@
 #include machine/asm.h
 
 	.text
-ENTRY(__clzdi2)
 #ifdef __ARMEB__
 #define	HI	r0
 #define	LO	r1
@@ -39,22 +38,26 @@ ENTRY(__clzdi2)
 #define	LO	r0
 #endif
 #if defined(_ARM_ARCH_5)
-#ifdef __thumb__
-	cmp	HI, #0
-	beq	1f
+#if defined(__thumb__)  defined(_ARM_ARCH_T2)
+ENTRY(__clzdi2)
+	cbz	HI, 1f
 	clz	r0, HI		/* count leading zeros in high word */
 	RET
 1:	clz	r0, LO		/* yes, count in low word */
-	add	r0, r0, #32	/*  and add the bits in the high word */
+	adds	r0, r0, #32	/*  and add the bits in the high word */
 	RET
+END(__clzdi2)
 #else
+ARM_ENTRY(__clzdi2)
 	teq	HI, #0		/* high word all zero? */
 	clzne	r0, HI		/* count leading zeros in high word */
 	clzeq	r0, LO		/* yes, count in low word */
 	addeq	r0, r0, #32	/*  and add the bits in the high word */
 	RET
+END(__clzdi2)
 #endif
 #else
+ARM_ENTRY(__clzdi2)
 	movs	r3, HI
 	movne	r0, #31
 	bne	.L_clz
@@ -63,14 +66,20 @@ ENTRY(__clzdi2)
 	bne	.L_clz
 	mov	r0, #64
 	RET
-#endif
 END(__clzdi2)
+#endif
 
-ENTRY(__clzsi2)
 #if defined(_ARM_ARCH_5)
+#if defined(_ARM_ARCH_7)
+ENTRY(__clzsi2)
+#else
+ARM_ENTRY(__clzsi2)
+#endif
 	clz	r0, r0
 	RET
+END(__clzsi2)
 #else
+ARM_ENTRY(__clzsi2)
 	movs	r3, r0
 	moveq	r0, #32
 	RETc(eq)
@@ -115,5 +124,5 @@ ENTRY(__clzsi2)
 #endif
 #endif	/* __OPTIMIZE_SIZE__ */
 	RET
-#endif  /* _ARM_ARCH_5 */
 END(__clzsi2)
+#endif  /* _ARM_ARCH_5 */



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

2013-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Aug 20 21:43:03 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: Makefile.inc

Log Message:
Some assembly files need to compiled -marm since they are Thumb compatible.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/lib/libkern/arch/arm/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.19 src/sys/lib/libkern/arch/arm/Makefile.inc:1.20
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.19	Mon Aug 12 23:22:12 2013
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Tue Aug 20 21:43:03 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.19 2013/08/12 23:22:12 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.20 2013/08/20 21:43:03 matt Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
@@ -9,5 +9,17 @@ SRCS+=	modsi3.S umodsi3.S
 .if !empty(MACHINE_ARCH:Mearm*)
 SRCS+=	__aeabi_ldivmod.S __aeabi_uldivmod.S __aeabi_lcmp.c __aeabi_ulcmp.c
 SRCS+=	unwind_stub.c
-.else
+.endif
+.if empty(MACHINE_ARCH:Mearmv7*)
+CPUFLAGS.ffs.S+=	-marm
+.endif
+CPUFLAGS.divide.S+=	-marm
+CPUFLAGS.memcmp.S+=	-marm
+CPUFLAGS.memcpy.S+=	-marm
+CPUFLAGS.memmove.S+=	-marm
+CPUFLAGS.memset.S+=	-marm
+.if empty(CPPFLAGS:M-D_STANDALONE)
+CPUFLAGS.strcpy.S+=	-marm
+CPUFLAGS.strlcpy.S+=	-marm
+CPUFLAGS.strncpy.S+=	-marm
 .endif



CVS commit: src/sys/lib/libkern

2013-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 21 05:50:14 UTC 2013

Modified Files:
src/sys/lib/libkern: Makefile

Log Message:
Simplify by using LIBISPRIVATE?= yes


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/lib/libkern/Makefile

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

Modified files:

Index: src/sys/lib/libkern/Makefile
diff -u src/sys/lib/libkern/Makefile:1.95 src/sys/lib/libkern/Makefile:1.96
--- src/sys/lib/libkern/Makefile:1.95	Sun Jan 18 20:42:11 2009
+++ src/sys/lib/libkern/Makefile	Wed Aug 21 05:50:14 2013
@@ -1,8 +1,7 @@
-#	$NetBSD: Makefile,v 1.95 2009/01/18 20:42:11 he Exp $
+#	$NetBSD: Makefile,v 1.96 2013/08/21 05:50:14 matt Exp $
 
 LIB=		kern
-NOPIC=		# defined
-LLIBS=		# defined
+LIBISPRIVATE?=	yes
 
 .include Makefile.libkern
 .ifndef ARCHSUBDIR
@@ -11,10 +10,6 @@ LLIBS=		# defined
 	@false
 .endif
 
-# only needed during build
-libinstall::
-
-.undef DESTDIR
 .include bsd.lib.mk
 
 lib${LIB}.o:: ${OBJS}



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

2013-08-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 12 23:42:14 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: unwind_stub.c

Log Message:
Fix typos (prX not cpX)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/arch/arm/unwind_stub.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/lib/libkern/arch/arm/unwind_stub.c
diff -u src/sys/lib/libkern/arch/arm/unwind_stub.c:1.1 src/sys/lib/libkern/arch/arm/unwind_stub.c:1.2
--- src/sys/lib/libkern/arch/arm/unwind_stub.c:1.1	Mon Aug 12 23:22:12 2013
+++ src/sys/lib/libkern/arch/arm/unwind_stub.c	Mon Aug 12 23:42:14 2013
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: unwind_stub.c,v 1.1 2013/08/12 23:22:12 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: unwind_stub.c,v 1.2 2013/08/12 23:42:14 matt Exp $);
 
 #include arm/ehabi.h
 
@@ -39,6 +39,6 @@ __aeabi_unwind_cpp_stub(_Unwind_State st
 	return _URC_FAILURE;
 }
 
-__weak_alias(__aeabi_unwind_cpp_cp0, __aeabi_unwind_cpp_stub)
-__weak_alias(__aeabi_unwind_cpp_cp1, __aeabi_unwind_cpp_stub)
-__weak_alias(__aeabi_unwind_cpp_cp2, __aeabi_unwind_cpp_stub)
+__weak_alias(__aeabi_unwind_cpp_pr0, __aeabi_unwind_cpp_stub)
+__weak_alias(__aeabi_unwind_cpp_pr1, __aeabi_unwind_cpp_stub)
+__weak_alias(__aeabi_unwind_cpp_pr2, __aeabi_unwind_cpp_stub)



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

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 04:58:01 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: clzsi2.S

Log Message:
Support thumb


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libkern/arch/arm/clzsi2.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/lib/libkern/arch/arm/clzsi2.S
diff -u src/sys/lib/libkern/arch/arm/clzsi2.S:1.4 src/sys/lib/libkern/arch/arm/clzsi2.S:1.5
--- src/sys/lib/libkern/arch/arm/clzsi2.S:1.4	Sat Sep  1 11:24:36 2012
+++ src/sys/lib/libkern/arch/arm/clzsi2.S	Sun Aug 11 04:58:01 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: clzsi2.S,v 1.4 2012/09/01 11:24:36 matt Exp $ */
+/* $NetBSD: clzsi2.S,v 1.5 2013/08/11 04:58:01 matt Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,11 +39,21 @@ ENTRY(__clzdi2)
 #define	LO	r0
 #endif
 #if defined(_ARM_ARCH_5)
+#ifdef __thumb__
+	cmp	HI, #0
+	beq	1f
+	clz	r0, HI		/* count leading zeros in high word */
+	RET
+1:	clz	r0, LO		/* yes, count in low word */
+	add	r0, r0, #32	/*  and add the bits in the high word */
+	RET
+#else
 	teq	HI, #0		/* high word all zero? */
 	clzne	r0, HI		/* count leading zeros in high word */
 	clzeq	r0, LO		/* yes, count in low word */
 	addeq	r0, r0, #32	/*  and add the bits in the high word */
 	RET
+#endif
 #else
 	movs	r3, HI
 	movne	r0, #31



CVS commit: src/sys/lib/libkern/arch/m68k

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 12:16:40 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/m68k: random.S

Log Message:
Don't use %d2 (violates the ABI since it wasn't saved), use %a0 instead.
Use a pcrelative access for the local data avoiding the GOT.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libkern/arch/m68k/random.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/lib/libkern/arch/m68k/random.S
diff -u src/sys/lib/libkern/arch/m68k/random.S:1.4 src/sys/lib/libkern/arch/m68k/random.S:1.5
--- src/sys/lib/libkern/arch/m68k/random.S:1.4	Tue Jan  6 01:24:56 2009
+++ src/sys/lib/libkern/arch/m68k/random.S	Thu Jul 18 12:16:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: random.S,v 1.4 2009/01/06 01:24:56 pooka Exp $	*/
+/*	$NetBSD: random.S,v 1.5 2013/07/18 12:16:40 matt Exp $	*/
 
 /*
  * Copyright (c) 1990,1993 The Regents of the University of California.
@@ -48,22 +48,14 @@ ASLOCAL(randseed)
 
 ENTRY(random)
 	movl	#16807, %d0
-#ifdef PIC
-	lea	%pc@(_GLOBAL_OFFSET_TABLE_@GOTPC), %a0
-	movl	_ASM_LABEL(randseed)@GOT(%a0), %d2
-	mulsl	(%d2), %d1:%d0
-#else
-	mulsl	_ASM_LABEL(randseed), %d1:%d0
-#endif
+	LEA_LCL(_ASM_LABEL(randseed),%a0)
+	mulsl	(%a0), %d1:%d0
 	lsll	#1, %d0
 	roxll	#2, %d1
 	addl	%d1, %d0
 	moveql	#1, %d1
 	addxl	%d1, %d0
 	lsrl	#1, %d0
-#ifdef PIC
-	movl	%d0, (%d2)
-#else
-	movl	%d0, _ASM_LABEL(randseed)
-#endif
+	movl	%d0, (%a0)
 	rts
+END(random)



CVS commit: src/sys/lib/libkern/arch/m68k

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 12:29:30 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/m68k: skpc.S

Log Message:
Convert to morotola syntax


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libkern/arch/m68k/skpc.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/lib/libkern/arch/m68k/skpc.S
diff -u src/sys/lib/libkern/arch/m68k/skpc.S:1.6 src/sys/lib/libkern/arch/m68k/skpc.S:1.7
--- src/sys/lib/libkern/arch/m68k/skpc.S:1.6	Tue Feb  8 20:20:27 2011
+++ src/sys/lib/libkern/arch/m68k/skpc.S	Thu Jul 18 12:29:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: skpc.S,v 1.6 2011/02/08 20:20:27 rmind Exp $	*/
+/*	$NetBSD: skpc.S,v 1.7 2013/07/18 12:29:30 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,13 +44,13 @@
  *	skpc(mask, count, startc)
  */
 ENTRY(skpc)
-	movl	%sp@(8),%d0	| get length
+	movl	8(%sp),%d0	| get length
 	jeq	Lskdone		| nothing to do, return
-	movb	%sp@(7),%d1	| mask to use
-	movl	%sp@(12),%a0	| where to start
+	movb	7(%sp),%d1	| mask to use
+	movl	12(%sp),%a0	| where to start
 	subqw	#1,%d0		| adjust for dbcc
 Lskloop:
-	cmpb	%a0@+,%d1	| compate with mask
+	cmpb	(%a0)+,%d1	| compate with mask
 	dbne	%d0,Lskloop	| keep going til no more or zero
 	addqw	#1,%d0		| overshot by one
 Lskdone:



CVS commit: src/sys/lib/libkern/arch/m68k

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 12:40:42 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/m68k: scanc.S

Log Message:
Convert to motorola syntax


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libkern/arch/m68k/scanc.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/lib/libkern/arch/m68k/scanc.S
diff -u src/sys/lib/libkern/arch/m68k/scanc.S:1.6 src/sys/lib/libkern/arch/m68k/scanc.S:1.7
--- src/sys/lib/libkern/arch/m68k/scanc.S:1.6	Tue Feb  8 20:20:27 2011
+++ src/sys/lib/libkern/arch/m68k/scanc.S	Thu Jul 18 12:40:42 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: scanc.S,v 1.6 2011/02/08 20:20:27 rmind Exp $	*/
+/*	$NetBSD: scanc.S,v 1.7 2013/07/18 12:40:42 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,20 +44,20 @@
  *	scanc(count, startc, table, mask)
  */
 ENTRY(scanc)
-	movl	%sp@(4),%d0	| get length
+	movl	4(%sp),%d0	| get length
 	jeq	Lscdone		| nothing to do, return
-	movl	%sp@(8),%a0	| start of scan
-	movl	%sp@(12),%a1	| table to compare with
-	movb	%sp@(19),%d1	| and mask to use
-	movw	%d2,%sp@-	| need a scratch register
+	movl	8(%sp),%a0	| start of scan
+	movl	12(%sp),%a1	| table to compare with
+	movb	19(%sp),%d1	| and mask to use
+	movw	%d2,-(%sp)	| need a scratch register
 	clrw	%d2		| clear it out
 	subqw	#1,%d0		| adjust for dbra
 Lscloop:
-	movb	%a0@+,%d2	| get character
-	movb	%a1@(0,%d2:w),%d2 | get table entry
+	movb	(%a0)+,%d2	| get character
+	movb	(%a1,%d2:w),%d2	| get table entry
 	andb	%d1,%d2		| mask it
 	dbne	%d0,Lscloop	| keep going til no more or non-zero
 	addqw	#1,%d0		| overshot by one
-	movw	%sp@+,%d2	| restore scratch
+	movw	(%sp)+,%d2	| restore scratch
 Lscdone:
 	rts



CVS commit: src/sys/lib/libkern/arch/m68k

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 12:42:24 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/m68k: scanc.S

Log Message:
Keep stack longword aligned.
Use longword ops for %d2.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libkern/arch/m68k/scanc.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/lib/libkern/arch/m68k/scanc.S
diff -u src/sys/lib/libkern/arch/m68k/scanc.S:1.7 src/sys/lib/libkern/arch/m68k/scanc.S:1.8
--- src/sys/lib/libkern/arch/m68k/scanc.S:1.7	Thu Jul 18 12:40:42 2013
+++ src/sys/lib/libkern/arch/m68k/scanc.S	Thu Jul 18 12:42:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: scanc.S,v 1.7 2013/07/18 12:40:42 matt Exp $	*/
+/*	$NetBSD: scanc.S,v 1.8 2013/07/18 12:42:24 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -49,15 +49,15 @@ ENTRY(scanc)
 	movl	8(%sp),%a0	| start of scan
 	movl	12(%sp),%a1	| table to compare with
 	movb	19(%sp),%d1	| and mask to use
-	movw	%d2,-(%sp)	| need a scratch register
-	clrw	%d2		| clear it out
+	movl	%d2,-(%sp)	| need a scratch register
+	clrl	%d2		| clear it out
 	subqw	#1,%d0		| adjust for dbra
 Lscloop:
 	movb	(%a0)+,%d2	| get character
-	movb	(%a1,%d2:w),%d2	| get table entry
-	andb	%d1,%d2		| mask it
+	movb	(%a1,%d2),%d2	| get table entry
+	andl	%d1,%d2		| mask it
 	dbne	%d0,Lscloop	| keep going til no more or non-zero
 	addqw	#1,%d0		| overshot by one
-	movw	(%sp)+,%d2	| restore scratch
+	movl	(%sp)+,%d2	| restore scratch
 Lscdone:
 	rts



CVS commit: src/sys/lib/libkern/arch/m68k

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 12:53:09 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/m68k: Makefile.inc

Log Message:
Reorder a little to make clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/lib/libkern/arch/m68k/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.30 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.31
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.30	Fri Aug 14 19:23:54 2009
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Thu Jul 18 12:53:09 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.30 2009/08/14 19:23:54 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.31 2013/07/18 12:53:09 matt Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -10,7 +10,9 @@ SRCS+=	ffs.S
 
 .if defined(MACHINE_ARCH)  (${MACHINE_ARCH} == m68000)
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
-random.o random.d: random.c
-.else
+.endif
+.if defined(MACHINE_ARCH)  ${MACHINE_ARCH} == m68k
 SRCS+=	random.S
+.else
+random.o random.po random.pico random.d: random.c
 .endif



CVS commit: src/sys/lib/libkern/arch/m68k

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 12:54:08 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/m68k: skpc.S

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libkern/arch/m68k/skpc.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/lib/libkern/arch/m68k/skpc.S
diff -u src/sys/lib/libkern/arch/m68k/skpc.S:1.7 src/sys/lib/libkern/arch/m68k/skpc.S:1.8
--- src/sys/lib/libkern/arch/m68k/skpc.S:1.7	Thu Jul 18 12:29:30 2013
+++ src/sys/lib/libkern/arch/m68k/skpc.S	Thu Jul 18 12:54:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: skpc.S,v 1.7 2013/07/18 12:29:30 matt Exp $	*/
+/*	$NetBSD: skpc.S,v 1.8 2013/07/18 12:54:08 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -50,7 +50,7 @@ ENTRY(skpc)
 	movl	12(%sp),%a0	| where to start
 	subqw	#1,%d0		| adjust for dbcc
 Lskloop:
-	cmpb	(%a0)+,%d1	| compate with mask
+	cmpb	(%a0)+,%d1	| compare with mask
 	dbne	%d0,Lskloop	| keep going til no more or zero
 	addqw	#1,%d0		| overshot by one
 Lskdone:



CVS commit: src/sys/lib/libkern/arch/m68k

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 22:14:48 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/m68k: scanc.S skpc.S

Log Message:
Adjust for coldfire


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/lib/libkern/arch/m68k/scanc.S \
src/sys/lib/libkern/arch/m68k/skpc.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/lib/libkern/arch/m68k/scanc.S
diff -u src/sys/lib/libkern/arch/m68k/scanc.S:1.8 src/sys/lib/libkern/arch/m68k/scanc.S:1.9
--- src/sys/lib/libkern/arch/m68k/scanc.S:1.8	Thu Jul 18 12:42:24 2013
+++ src/sys/lib/libkern/arch/m68k/scanc.S	Thu Jul 18 22:14:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: scanc.S,v 1.8 2013/07/18 12:42:24 matt Exp $	*/
+/*	$NetBSD: scanc.S,v 1.9 2013/07/18 22:14:48 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -51,13 +51,22 @@ ENTRY(scanc)
 	movb	19(%sp),%d1	| and mask to use
 	movl	%d2,-(%sp)	| need a scratch register
 	clrl	%d2		| clear it out
+#ifndef __mcoldfire__
 	subqw	#1,%d0		| adjust for dbra
+#endif
 Lscloop:
 	movb	(%a0)+,%d2	| get character
 	movb	(%a1,%d2),%d2	| get table entry
 	andl	%d1,%d2		| mask it
+#ifdef __mcoldfire__
+	jne	1f		| break out if mask matched
+	subql	#1,%d0		| decrement
+	jne	Lscloop		| keep going til no more
+1:
+#else
 	dbne	%d0,Lscloop	| keep going til no more or non-zero
 	addqw	#1,%d0		| overshot by one
+#endif
 	movl	(%sp)+,%d2	| restore scratch
 Lscdone:
 	rts
Index: src/sys/lib/libkern/arch/m68k/skpc.S
diff -u src/sys/lib/libkern/arch/m68k/skpc.S:1.8 src/sys/lib/libkern/arch/m68k/skpc.S:1.9
--- src/sys/lib/libkern/arch/m68k/skpc.S:1.8	Thu Jul 18 12:54:08 2013
+++ src/sys/lib/libkern/arch/m68k/skpc.S	Thu Jul 18 22:14:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: skpc.S,v 1.8 2013/07/18 12:54:08 matt Exp $	*/
+/*	$NetBSD: skpc.S,v 1.9 2013/07/18 22:14:48 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -48,10 +48,18 @@ ENTRY(skpc)
 	jeq	Lskdone		| nothing to do, return
 	movb	7(%sp),%d1	| mask to use
 	movl	12(%sp),%a0	| where to start
+#ifndef __mcoldfire__
 	subqw	#1,%d0		| adjust for dbcc
+#endif
 Lskloop:
 	cmpb	(%a0)+,%d1	| compare with mask
+#ifdef __mcoldfire__
+	jne	Lskdone		| keep going til no more or zero
+	subql	#1,%d0
+	jne	Lskloop
+#else
 	dbne	%d0,Lskloop	| keep going til no more or zero
 	addqw	#1,%d0		| overshot by one
+#endif
 Lskdone:
 	rts



CVS commit: src/sys/lib/libkern

2013-06-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jun 29 16:02:01 UTC 2013

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
libkern: add murmurhash module.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.24 src/sys/lib/libkern/Makefile.libkern:1.25
--- src/sys/lib/libkern/Makefile.libkern:1.24	Mon Jun 24 04:21:20 2013
+++ src/sys/lib/libkern/Makefile.libkern	Sat Jun 29 16:02:01 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.24 2013/06/24 04:21:20 riastradh Exp $
+#	$NetBSD: Makefile.libkern,v 1.25 2013/06/29 16:02:01 rmind Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -61,7 +61,7 @@ SRCS+=	cpuset.c inet_addr.c intoa.c
 .if empty(SRCS:Mbyte_swap_8.*)
 SRCS+=	bswap64.c
 .endif
-SRCS+=	md4c.c md5c.c rmd160.c sha1.c sha2.c
+SRCS+=	md4c.c md5c.c rmd160.c sha1.c sha2.c murmurhash.c
 SRCS+=	pmatch.c arc4random.c bcd.c mcount.c mertwist.c crc32.c
 
 SRCS+=	ppath_kmem_alloc.c



CVS commit: src/sys/lib/libkern

2013-06-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 23 02:38:22 UTC 2013

Modified Files:
src/sys/lib/libkern: arc4random.c

Log Message:
Account bytes drawn from initial call to libkern arc4random.

XXX This unlocked initialization looks rather bogus...


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/lib/libkern/arc4random.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/lib/libkern/arc4random.c
diff -u src/sys/lib/libkern/arc4random.c:1.33 src/sys/lib/libkern/arc4random.c:1.34
--- src/sys/lib/libkern/arc4random.c:1.33	Sun Jun 23 02:35:24 2013
+++ src/sys/lib/libkern/arc4random.c	Sun Jun 23 02:38:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.33 2013/06/23 02:35:24 riastradh Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.34 2013/06/23 02:38:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -251,6 +251,7 @@ _arc4randbytes(void *p, size_t len)
 		arc4_init();
 		/* avoid conditionalizing locking */
 		arc4randbytes_unlocked(p, len);
+		arc4_numbytes += len;
 		return;
 	}
 	mutex_spin_enter(arc4_mtx);



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

2013-06-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jun 20 07:29:50 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: Makefile.inc

Log Message:
modsi3/umodsi3 are only needed !EABI arm


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/lib/libkern/arch/arm/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.16 src/sys/lib/libkern/arch/arm/Makefile.inc:1.17
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.16	Thu May  2 03:56:42 2013
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Thu Jun 20 07:29:50 2013
@@ -1,10 +1,12 @@
-#	$NetBSD: Makefile.inc,v 1.16 2013/05/02 03:56:42 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.17 2013/06/20 07:29:50 matt Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
-SRCS+=	divsi3.S udivsi3.S divide.S clzsi2.S modsi3.S umodsi3.S
+SRCS+=	divsi3.S udivsi3.S divide.S clzsi2.S
 SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S
 
 .if !empty(MACHINE_ARCH:Mearm*)
 SRCS+=	__aeabi_ldivmod.S __aeabi_uldivmod.S __aeabi_lcmp.c __aeabi_ulcmp.c
+.else
+SRCS+=	 modsi3.S umodsi3.S
 .endif



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

2013-06-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun 21 05:06:24 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: Makefile.inc

Log Message:
Add back {,u}modsi3 for libkern since if we are building standalone tools
we might be using the old ABI and might need them.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/lib/libkern/arch/arm/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.17 src/sys/lib/libkern/arch/arm/Makefile.inc:1.18
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.17	Thu Jun 20 07:29:50 2013
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Fri Jun 21 05:06:24 2013
@@ -1,12 +1,12 @@
-#	$NetBSD: Makefile.inc,v 1.17 2013/06/20 07:29:50 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.18 2013/06/21 05:06:24 matt Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
 SRCS+=	divsi3.S udivsi3.S divide.S clzsi2.S
 SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S
+SRCS+=	modsi3.S umodsi3.S
 
 .if !empty(MACHINE_ARCH:Mearm*)
 SRCS+=	__aeabi_ldivmod.S __aeabi_uldivmod.S __aeabi_lcmp.c __aeabi_ulcmp.c
 .else
-SRCS+=	 modsi3.S umodsi3.S
 .endif



CVS commit: src/sys/lib/libkern

2013-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 17 00:47:14 UTC 2013

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
undo sparc64 kludge


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.22 src/sys/lib/libkern/Makefile.libkern:1.23
--- src/sys/lib/libkern/Makefile.libkern:1.22	Thu Mar 14 07:53:33 2013
+++ src/sys/lib/libkern/Makefile.libkern	Sat Mar 16 20:47:13 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.22 2013/03/14 11:53:33 nakayama Exp $
+#	$NetBSD: Makefile.libkern,v 1.23 2013/03/17 00:47:13 christos Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -74,13 +74,11 @@ SRCS+=	memmove.c
 SRCS+=	strchr.c strrchr.c
 SRCS+=	memcmp.c
 
-.if (${MACHINE} != sparc64) || defined(RUMPTOP)
-# provided by memcpyset.s on sparc64, but RUMP does not know about it.
 SRCS+=	memcpy.c
 .if empty(SRCS:Mmemset2.*)
 SRCS+=	memset.c 
 .endif
-.endif
+
 SRCS+=	popcount32.c popcount64.c
 SRCS+=	strtoul.c strtoll.c strtoull.c strtoumax.c
 



CVS commit: src/sys/lib/libkern/arch/sparc

2013-03-16 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Sun Mar 17 04:45:47 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/sparc: Makefile.inc

Log Message:
Revert previous.  christos fixed the root cause.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/lib/libkern/arch/sparc/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/sparc/Makefile.inc
diff -u src/sys/lib/libkern/arch/sparc/Makefile.inc:1.35 src/sys/lib/libkern/arch/sparc/Makefile.inc:1.36
--- src/sys/lib/libkern/arch/sparc/Makefile.inc:1.35	Thu Mar 14 11:53:34 2013
+++ src/sys/lib/libkern/arch/sparc/Makefile.inc	Sun Mar 17 04:45:46 2013
@@ -1,10 +1,7 @@
-#	$NetBSD: Makefile.inc,v 1.35 2013/03/14 11:53:34 nakayama Exp $
+#	$NetBSD: Makefile.inc,v 1.36 2013/03/17 04:45:46 nakayama Exp $
 
 SRCS+=	ffs.S
-.if (${MACHINE} != sparc64) || defined(RUMPTOP)
-# provided by memcpyset.s on sparc64 32-bit kernel
 SRCS+=	memset.S
-.endif
 SRCS+=	strlen.S
 SRCS+=	htonl.S htons.S ntohl.S ntohs.S
 SRCS+=	random.S



CVS commit: src/sys/lib/libkern/arch/sparc64

2013-03-16 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Sun Mar 17 04:47:17 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/sparc64: Makefile.inc

Log Message:
Remove duplicate source files.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libkern/arch/sparc64/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/sparc64/Makefile.inc
diff -u src/sys/lib/libkern/arch/sparc64/Makefile.inc:1.10 src/sys/lib/libkern/arch/sparc64/Makefile.inc:1.11
--- src/sys/lib/libkern/arch/sparc64/Makefile.inc:1.10	Fri Aug 14 19:23:55 2009
+++ src/sys/lib/libkern/arch/sparc64/Makefile.inc	Sun Mar 17 04:47:16 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.10 2009/08/14 19:23:55 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.11 2013/03/17 04:47:16 nakayama Exp $
 
 SRCS+=	ffs.S
 SRCS+=	strlen.S
@@ -7,7 +7,6 @@ SRCS+=	random.S
 
 SRCS+=	bswap16.c bswap32.c
 
-SRCS+=	umul.S mul.S rem.S sdiv.S udiv.S umul.S urem.S
 SRCS+=	mul.S saveregs.S umul.S
 
 # `source' files built from m4 source



CVS commit: src/sys/lib/libkern

2013-03-14 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Thu Mar 14 11:53:34 UTC 2013

Modified Files:
src/sys/lib/libkern: Makefile.libkern
src/sys/lib/libkern/arch/sparc: Makefile.inc

Log Message:
Make sparc64 32-bit kernel buildable.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.34 -r1.35 src/sys/lib/libkern/arch/sparc/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.21 src/sys/lib/libkern/Makefile.libkern:1.22
--- src/sys/lib/libkern/Makefile.libkern:1.21	Mon Mar 11 11:44:48 2013
+++ src/sys/lib/libkern/Makefile.libkern	Thu Mar 14 11:53:33 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.21 2013/03/11 11:44:48 christos Exp $
+#	$NetBSD: Makefile.libkern,v 1.22 2013/03/14 11:53:33 nakayama Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -74,7 +74,7 @@ SRCS+=	memmove.c
 SRCS+=	strchr.c strrchr.c
 SRCS+=	memcmp.c
 
-.if (${MACHINE_ARCH} != sparc64) || defined(RUMPTOP)
+.if (${MACHINE} != sparc64) || defined(RUMPTOP)
 # provided by memcpyset.s on sparc64, but RUMP does not know about it.
 SRCS+=	memcpy.c
 .if empty(SRCS:Mmemset2.*)

Index: src/sys/lib/libkern/arch/sparc/Makefile.inc
diff -u src/sys/lib/libkern/arch/sparc/Makefile.inc:1.34 src/sys/lib/libkern/arch/sparc/Makefile.inc:1.35
--- src/sys/lib/libkern/arch/sparc/Makefile.inc:1.34	Fri Aug 14 19:23:54 2009
+++ src/sys/lib/libkern/arch/sparc/Makefile.inc	Thu Mar 14 11:53:34 2013
@@ -1,7 +1,10 @@
-#	$NetBSD: Makefile.inc,v 1.34 2009/08/14 19:23:54 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.35 2013/03/14 11:53:34 nakayama Exp $
 
 SRCS+=	ffs.S
+.if (${MACHINE} != sparc64) || defined(RUMPTOP)
+# provided by memcpyset.s on sparc64 32-bit kernel
 SRCS+=	memset.S
+.endif
 SRCS+=	strlen.S
 SRCS+=	htonl.S htons.S ntohl.S ntohs.S
 SRCS+=	random.S



CVS commit: src/sys/lib/libkern

2013-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 11:44:48 UTC 2013

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
amend previous sparc64 fix: rump does not know about memcpyset.s


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.20 src/sys/lib/libkern/Makefile.libkern:1.21
--- src/sys/lib/libkern/Makefile.libkern:1.20	Sun Mar 10 03:31:03 2013
+++ src/sys/lib/libkern/Makefile.libkern	Mon Mar 11 07:44:48 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.20 2013/03/10 07:31:03 christos Exp $
+#	$NetBSD: Makefile.libkern,v 1.21 2013/03/11 11:44:48 christos Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -74,7 +74,8 @@ SRCS+=	memmove.c
 SRCS+=	strchr.c strrchr.c
 SRCS+=	memcmp.c
 
-.if (${MACHINE_ARCH} != sparc64) # provided by memcpyset.s
+.if (${MACHINE_ARCH} != sparc64) || defined(RUMPTOP)
+# provided by memcpyset.s on sparc64, but RUMP does not know about it.
 SRCS+=	memcpy.c
 .if empty(SRCS:Mmemset2.*)
 SRCS+=	memset.c 



CVS commit: src/sys/lib/libkern

2013-03-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar  2 22:04:06 UTC 2013

Modified Files:
src/sys/lib/libkern: xlat_mbr_fstype.c

Log Message:
recognize OpenBSD too


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/lib/libkern/xlat_mbr_fstype.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/lib/libkern/xlat_mbr_fstype.c
diff -u src/sys/lib/libkern/xlat_mbr_fstype.c:1.8 src/sys/lib/libkern/xlat_mbr_fstype.c:1.9
--- src/sys/lib/libkern/xlat_mbr_fstype.c:1.8	Mon Jan 16 13:47:57 2012
+++ src/sys/lib/libkern/xlat_mbr_fstype.c	Sat Mar  2 17:04:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: xlat_mbr_fstype.c,v 1.8 2012/01/16 18:47:57 christos Exp $	*/
+/*	$NetBSD: xlat_mbr_fstype.c,v 1.9 2013/03/02 22:04:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0,$NetBSD: xlat_mbr_fstype.c,v 1.8 2012/01/16 18:47:57 christos Exp $);
+__KERNEL_RCSID(0,$NetBSD: xlat_mbr_fstype.c,v 1.9 2013/03/02 22:04:06 christos Exp $);
 
 
 #include sys/disklabel.h
@@ -56,6 +56,7 @@ xlat_mbr_fstype(int mbr_type)
 		{ MBR_PTYPE_NETBSD,	FS_BSDFFS },
 		{ MBR_PTYPE_NTFS,	FS_NTFS },
 		{ MBR_PTYPE_MINIX_14B,	FS_MINIXFS3 },
+		{ MBR_PTYPE_OPENBSD,	FS_BSDFFS },
 		{ 0,			FS_OTHER }
 	};
 	const struct ptn_types *pt;



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

2013-02-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Feb  6 07:18:17 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: Makefile.inc

Log Message:
Modify earm rule to match any machine_arch starting with earm.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/lib/libkern/arch/arm/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.14 src/sys/lib/libkern/arch/arm/Makefile.inc:1.15
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.14	Wed Jan 23 22:34:37 2013
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Wed Feb  6 07:18:15 2013
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile.inc,v 1.14 2013/01/23 22:34:37 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2013/02/06 07:18:15 matt Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
 SRCS+=	divsi3.S udivsi3.S divide.S clzsi2.S modsi3.S umodsi3.S
 SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S
 
-.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb
+.if ${MACHINE_ARCH:Mearm*} != 
 SRCS+=	__aeabi_ldivmod.S __aeabi_uldivmod.S __aeabi_lcmp.c __aeabi_ulcmp.c
 .endif



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

2013-01-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 23 20:38:28 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: Makefile.inc

Log Message:
pull in strnlen.S


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libkern/arch/arm/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.12 src/sys/lib/libkern/arch/arm/Makefile.inc:1.13
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.12	Tue Oct 30 16:36:03 2012
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Wed Jan 23 20:38:27 2013
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile.inc,v 1.12 2012/10/30 16:36:03 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.13 2013/01/23 20:38:27 macallan Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
 SRCS+=	divsi3.S udivsi3.S divide.S clzsi2.S modsi3.S umodsi3.S
-SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S
+SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S strnlen.S
 
 .if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb
 SRCS+=	__aeabi_ldivmod.S __aeabi_uldivmod.S __aeabi_lcmp.c __aeabi_ulcmp.c



CVS commit: src/sys/lib/libkern

2013-01-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 22:34:37 UTC 2013

Modified Files:
src/sys/lib/libkern: Makefile.libkern
src/sys/lib/libkern/arch/arm: Makefile.inc

Log Message:
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.13 -r1.14 src/sys/lib/libkern/arch/arm/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.18 src/sys/lib/libkern/Makefile.libkern:1.19
--- src/sys/lib/libkern/Makefile.libkern:1.18	Thu Aug 30 12:16:49 2012
+++ src/sys/lib/libkern/Makefile.libkern	Wed Jan 23 22:34:37 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.18 2012/08/30 12:16:49 drochner Exp $
+#	$NetBSD: Makefile.libkern,v 1.19 2013/01/23 22:34:37 matt Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -84,7 +84,7 @@ SRCS+=	random.c
 SRCS+=	rngtest.c
 
 SRCS+=	memchr.c
-SRCS+=	strcat.c strcmp.c strcpy.c strlen.c
+SRCS+=	strcat.c strcmp.c strcpy.c strlen.c strnlen.c
 SRCS+=	strncmp.c strncpy.c
 SRCS+=	strcasecmp.c strncasecmp.c
 

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.13 src/sys/lib/libkern/arch/arm/Makefile.inc:1.14
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.13	Wed Jan 23 20:38:27 2013
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Wed Jan 23 22:34:37 2013
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile.inc,v 1.13 2013/01/23 20:38:27 macallan Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2013/01/23 22:34:37 matt Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
 SRCS+=	divsi3.S udivsi3.S divide.S clzsi2.S modsi3.S umodsi3.S
-SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S strnlen.S
+SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S
 
 .if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb
 SRCS+=	__aeabi_ldivmod.S __aeabi_uldivmod.S __aeabi_lcmp.c __aeabi_ulcmp.c



CVS commit: src/sys/lib/libkern

2012-12-12 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 12 15:10:27 UTC 2012

Modified Files:
src/sys/lib/libkern: Makefile.inc

Log Message:
Don't pass down CPUFLAGS since its value is already in CFLAGS.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/lib/libkern/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/Makefile.inc
diff -u src/sys/lib/libkern/Makefile.inc:1.41 src/sys/lib/libkern/Makefile.inc:1.42
--- src/sys/lib/libkern/Makefile.inc:1.41	Fri Aug 10 16:05:27 2012
+++ src/sys/lib/libkern/Makefile.inc	Wed Dec 12 15:10:27 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.41 2012/08/10 16:05:27 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.42 2012/12/12 15:10:27 matt Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -36,7 +36,7 @@ KERNLIBLN=	${KERNDST}/${LIBKERNLNBN}
 KERNMAKE= \
 	cd ${KERNDST}  ${MAKE} -f ${KERNDIR:Q}/Makefile \
 	KERNDIR=${KERNDIR:Q} \
-	CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
+	CC=${CC:Q} CFLAGS=${CFLAGS:Q} CPUFLAGS= \
 	AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
 	LORDER=${LORDER:Q} \
 	TSORT=${TSORT:Q} \



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

2012-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 30 16:36:03 UTC 2012

Modified Files:
src/sys/lib/libkern/arch/arm: Makefile.inc

Log Message:
add new divsi3 related files.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/lib/libkern/arch/arm/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.11 src/sys/lib/libkern/arch/arm/Makefile.inc:1.12
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.11	Tue Oct  9 22:15:31 2012
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Tue Oct 30 12:36:03 2012
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile.inc,v 1.11 2012/10/10 02:15:31 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.12 2012/10/30 16:36:03 christos Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
-SRCS+=	divsi3.S clzsi2.S modsi3.S umodsi3.S
+SRCS+=	divsi3.S udivsi3.S divide.S clzsi2.S modsi3.S umodsi3.S
 SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S
 
 .if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb



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

2012-08-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug  6 02:14:57 UTC 2012

Modified Files:
src/sys/lib/libkern/arch/arm: Makefile.inc

Log Message:
If earm*, compile new aeabi runtime routines.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libkern/arch/arm/Makefile.inc

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

Modified files:

Index: src/sys/lib/libkern/arch/arm/Makefile.inc
diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.9 src/sys/lib/libkern/arch/arm/Makefile.inc:1.10
--- src/sys/lib/libkern/arch/arm/Makefile.inc:1.9	Fri Aug 14 19:23:53 2009
+++ src/sys/lib/libkern/arch/arm/Makefile.inc	Mon Aug  6 02:14:57 2012
@@ -1,6 +1,10 @@
-#	$NetBSD: Makefile.inc,v 1.9 2009/08/14 19:23:53 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.10 2012/08/06 02:14:57 matt Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S
 SRCS+=	ffs.S
 SRCS+=	divsi3.S clzsi2.S
 SRCS+=	memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S
+
+.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb
+SRCS+=	__aeabi_ldivmod.S __aeabi_uldivmod.S __aeabi_lcmp.c __aeabi_ulcmp.c
+.endif



CVS commit: src/sys/lib/libkern

2012-02-14 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Tue Feb 14 18:57:35 UTC 2012

Modified Files:
src/sys/lib/libkern: arc4random.c

Log Message:
void function _arc4randbytes cannot return a value.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/lib/libkern/arc4random.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/lib/libkern/arc4random.c
diff -u src/sys/lib/libkern/arc4random.c:1.30 src/sys/lib/libkern/arc4random.c:1.31
--- src/sys/lib/libkern/arc4random.c:1.30	Thu Feb  2 19:43:07 2012
+++ src/sys/lib/libkern/arc4random.c	Tue Feb 14 18:57:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.30 2012/02/02 19:43:07 tls Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.31 2012/02/14 18:57:35 njoly Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -302,7 +302,8 @@ _arc4randbytes(void *p, size_t len)
 	if (!arc4_initialized) {
 		arc4_init();
 		/* avoid conditionalizing locking */
-		return arc4randbytes_unlocked(p, len);
+		arc4randbytes_unlocked(p, len);
+		return;
 	}
 	mutex_spin_enter(arc4_mtx);
 	arc4randbytes_unlocked(p, len);



CVS commit: src/sys/lib/libkern

2012-01-21 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Jan 22 02:57:37 UTC 2012

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
Add CTASSERT_SIGNED() and CTASSERT_UNSIGNED().


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.104 src/sys/lib/libkern/libkern.h:1.105
--- src/sys/lib/libkern/libkern.h:1.104	Mon Nov 28 08:05:06 2011
+++ src/sys/lib/libkern/libkern.h	Sun Jan 22 02:57:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.104 2011/11/28 08:05:06 tls Exp $	*/
+/*	$NetBSD: libkern.h,v 1.105 2012/01/22 02:57:36 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -190,6 +190,8 @@ tolower(int ch)
 #endif
 
 #define	CTASSERT(x)		__CTASSERT(x)
+#define	CTASSERT_SIGNED(x)	__CTASSERT(((typeof(x))-1)  0)
+#define	CTASSERT_UNSIGNED(x)	__CTASSERT(((typeof(x))-1) = 0)
 
 #ifndef DIAGNOSTIC
 #define _DIAGASSERT(a)	(void)0



CVS commit: src/sys/lib/libkern

2011-11-29 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Tue Nov 29 13:16:27 UTC 2011

Modified Files:
src/sys/lib/libkern: arc4random.c

Log Message:
make rs static -- this name is too unspecific for the global namespace


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/lib/libkern/arc4random.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/lib/libkern/arc4random.c
diff -u src/sys/lib/libkern/arc4random.c:1.28 src/sys/lib/libkern/arc4random.c:1.29
--- src/sys/lib/libkern/arc4random.c:1.28	Tue Nov 29 03:50:32 2011
+++ src/sys/lib/libkern/arc4random.c	Tue Nov 29 13:16:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.28 2011/11/29 03:50:32 tls Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.29 2011/11/29 13:16:27 drochner Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 #include sys/rnd.h
 #include dev/rnd_private.h
 
-rndsink_t	rs;
+static rndsink_t	rs;
 
 #endif
 



CVS commit: src/sys/lib/libkern

2011-11-26 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Sat Nov 26 13:53:37 UTC 2011

Modified Files:
src/sys/lib/libkern: arc4random.c

Log Message:
Fix white space usage.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/lib/libkern/arc4random.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/lib/libkern/arc4random.c
diff -u src/sys/lib/libkern/arc4random.c:1.23 src/sys/lib/libkern/arc4random.c:1.24
--- src/sys/lib/libkern/arc4random.c:1.23	Sun Nov 20 15:37:31 2011
+++ src/sys/lib/libkern/arc4random.c	Sat Nov 26 13:53:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.23 2011/11/20 15:37:31 para Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.24 2011/11/26 13:53:37 enami Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -160,9 +160,9 @@ arc4_randrekey(void *arg)
 		if (callback_pending) {
 			if (arc4_numbytes  ARC4_HARDMAX) {
 printf(arc4random: WARNING, hit 2^29 bytes, 
-   forcibly rekeying.\n);
+forcibly rekeying.\n);
 r = rnd_extract_data(key, ARC4_KEYBYTES,
-		 RND_EXTRACT_ANY);
+RND_EXTRACT_ANY);
 rndsink_detach(rs);
 callback_pending = 0;
 goto got_entropy;
@@ -195,7 +195,7 @@ got_entropy:
 		rs.cb = arc4_randrekey;
 		rs.arg = rs;
 		rs.len = ARC4_KEYBYTES;
-   	rndsink_attach(rs);
+		rndsink_attach(rs);
 	}
 #endif
 	/*
@@ -282,13 +282,13 @@ arc4_randbyte(void)
 u_int32_t
 arc4random(void)
 {
-int ret;
-u_int8_t *retc;
+	int ret;
+	u_int8_t *retc;
 
-retc = (u_int8_t *)ret;
+	retc = (u_int8_t *)ret;
 
-arc4randbytes(retc, sizeof(u_int32_t));
-return ret;
+	arc4randbytes(retc, sizeof(u_int32_t));
+	return ret;
 }
 
 static inline void
@@ -307,7 +307,7 @@ arc4randbytes(void *p, size_t len)
 	/* Initialize array if needed. */
 	if (!arc4_initialized) {
 		arc4_init();
-/* avoid conditionalizing locking */
+		/* avoid conditionalizing locking */
 		return arc4randbytes_unlocked(p, len);
 	}
 	mutex_spin_enter(arc4_mtx);



CVS commit: src/sys/lib/libkern

2011-11-26 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Sat Nov 26 14:04:20 UTC 2011

Modified Files:
src/sys/lib/libkern: arc4random.c

Log Message:
Use exact 32bit integral type to declare variable to store
32bit random value.  This is necessary since it is overwritten
by four bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/lib/libkern/arc4random.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/lib/libkern/arc4random.c
diff -u src/sys/lib/libkern/arc4random.c:1.24 src/sys/lib/libkern/arc4random.c:1.25
--- src/sys/lib/libkern/arc4random.c:1.24	Sat Nov 26 13:53:37 2011
+++ src/sys/lib/libkern/arc4random.c	Sat Nov 26 14:04:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.24 2011/11/26 13:53:37 enami Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.25 2011/11/26 14:04:20 enami Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -282,7 +282,7 @@ arc4_randbyte(void)
 u_int32_t
 arc4random(void)
 {
-	int ret;
+	u_int32_t ret;
 	u_int8_t *retc;
 
 	retc = (u_int8_t *)ret;



CVS commit: src/sys/lib/libkern

2011-11-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Nov 27 00:09:04 UTC 2011

Modified Files:
src/sys/lib/libkern: arc4random.c

Log Message:
Disable a DIAGNOSTIC test which causes kernel stack overflow on all arm ports.

Boot failure is reported from several arm users (nonaka@, ryo@, and others),
and too large auto variable in arc4_randrekey() is pointed out by enami@.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/lib/libkern/arc4random.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/lib/libkern/arc4random.c
diff -u src/sys/lib/libkern/arc4random.c:1.25 src/sys/lib/libkern/arc4random.c:1.26
--- src/sys/lib/libkern/arc4random.c:1.25	Sat Nov 26 14:04:20 2011
+++ src/sys/lib/libkern/arc4random.c	Sun Nov 27 00:09:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.25 2011/11/26 14:04:20 enami Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.26 2011/11/27 00:09:04 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -134,9 +134,11 @@ arc4_randrekey(void *arg)
 	int n, ask_for_more = 0;
 #ifdef _KERNEL
 #ifdef DIAGNOSTIC
+#if 0	/* XXX rngtest_t is too large and could cause stack overflow */
 	rngtest_t rt;
 #endif
 #endif
+#endif
 #if NRND  0
 	static int callback_pending;
 	int r;
@@ -225,6 +227,7 @@ got_entropy:
 		arc4_numbytes = 0;
 #ifdef _KERNEL
 #ifdef DIAGNOSTIC
+#if 0	/* XXX rngtest_t is too large and could cause stack overflow */
 		/*
 		 * Perform the FIPS 140-2 statistical RNG test; warn if our
 		 * output has such poor quality as to fail the test.
@@ -239,6 +242,7 @@ got_entropy:
 		}
 #endif
 #endif
+#endif
 	}
 	if (__predict_true(arc4_initialized)) {
 		mutex_spin_exit(arc4_mtx);



CVS commit: src/sys/lib/libkern

2011-11-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 25 12:45:00 UTC 2011

Modified Files:
src/sys/lib/libkern: rngtest.c

Log Message:
Spell restrict with __.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/rngtest.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/lib/libkern/rngtest.c
diff -u src/sys/lib/libkern/rngtest.c:1.1 src/sys/lib/libkern/rngtest.c:1.2
--- src/sys/lib/libkern/rngtest.c:1.1	Sat Nov 19 22:51:25 2011
+++ src/sys/lib/libkern/rngtest.c	Fri Nov 25 12:45:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rngtest.c,v 1.1 2011/11/19 22:51:25 tls Exp $ */
+/*	$NetBSD: rngtest.c,v 1.2 2011/11/25 12:45:00 joerg Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -142,11 +142,11 @@ the GNU Public License.
 #include lib/libkern/libkern.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rngtest.c,v 1.1 2011/11/19 22:51:25 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: rngtest.c,v 1.2 2011/11/25 12:45:00 joerg Exp $);
 
 #ifndef _KERNEL
 static inline int
-printf(const char *restrict format, ...)
+printf(const char * __restrict format, ...)
 {
 	return 0;	/* XXX no standard way to do output in libkern? */
 }



CVS commit: src/sys/lib/libkern

2011-11-20 Thread Lars Heidieker
Module Name:src
Committed By:   para
Date:   Sun Nov 20 15:37:31 UTC 2011

Modified Files:
src/sys/lib/libkern: arc4random.c

Log Message:
make it compile without DIAGNOSTIC defined


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/lib/libkern/arc4random.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/lib/libkern/arc4random.c
diff -u src/sys/lib/libkern/arc4random.c:1.22 src/sys/lib/libkern/arc4random.c:1.23
--- src/sys/lib/libkern/arc4random.c:1.22	Sat Nov 19 22:51:25 2011
+++ src/sys/lib/libkern/arc4random.c	Sun Nov 20 15:37:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.22 2011/11/19 22:51:25 tls Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.23 2011/11/20 15:37:31 para Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -133,8 +133,10 @@ arc4_randrekey(void *arg)
 	u_int8_t key[256];
 	int n, ask_for_more = 0;
 #ifdef _KERNEL
+#ifdef DIAGNOSTIC
 	rngtest_t rt;
 #endif
+#endif
 #if NRND  0
 	static int callback_pending;
 	int r;



CVS commit: src/sys/lib/libkern/arch/powerpc

2011-10-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 28 02:00:50 UTC 2011

Modified Files:
src/sys/lib/libkern/arch/powerpc: gprsavrest.S

Log Message:
shouldn't need .size for ppc64.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libkern/arch/powerpc/gprsavrest.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/lib/libkern/arch/powerpc/gprsavrest.S
diff -u src/sys/lib/libkern/arch/powerpc/gprsavrest.S:1.3 src/sys/lib/libkern/arch/powerpc/gprsavrest.S:1.4
--- src/sys/lib/libkern/arch/powerpc/gprsavrest.S:1.3	Fri Aug 12 10:48:00 2011
+++ src/sys/lib/libkern/arch/powerpc/gprsavrest.S	Thu Oct 27 22:00:50 2011
@@ -29,23 +29,28 @@
 
 #include powerpc/asm.h
 
-__RCSID($NetBSD: gprsavrest.S,v 1.3 2011/08/12 14:48:00 matt Exp $)
+__RCSID($NetBSD: gprsavrest.S,v 1.4 2011/10/28 02:00:50 christos Exp $)
 
 #ifndef RESTGPR
-#define RESTGPR(n)	RESTOREXGPR(_restgpr_,n,_x)
-#define RESTGPR_END(n)	RESTOREXGPR_END(_restgpr_,n,_x)
-#define SAVEGPR(n)	SAVEXGPR(_savegpr_,n,)
-#define SAVEGPR_END(n)	SAVEXGPR_END(_savegpr_,n,)
+# define RESTGPR(n)	RESTOREXGPR(_restgpr_,n,_x)
+# define RESTGPR_END(n)	RESTOREXGPR_END(_restgpr_,n,_x)
+# define SAVEGPR(n)	SAVEXGPR(_savegpr_,n,)
+# define SAVEGPR_END(n)	SAVEXGPR_END(_savegpr_,n,)
 #endif
 
 #define RESTOREXGPR(a,n,b) \
 	.hidden a##n##b; ENTRY_NOPROFILE(a##n##b); lwz	n,(-4*(32-n))(11)
-#define RESTOREXGPR_END(a,n,b) \
-	.size a##n##b,.-a##n##b
 #define SAVEXGPR(a,n,b) \
 	.hidden a##n##b; ENTRY_NOPROFILE(a##n##b); stw	n,(-4*(32-n))(11)
-#define SAVEXGPR_END(a,n,b) \
+#ifdef _LP64
+# define SAVEXGPR_END(a,n,b) 
+# define RESTOREXGPR_END(a,n,b) 
+#else
+# define SAVEXGPR_END(a,n,b) \
+	.size a##n##b,.-a##n##b
+# define RESTOREXGPR_END(a,n,b) \
 	.size a##n##b,.-a##n##b
+#endif
 
 	RESTGPR(14)
 	RESTGPR(15)



CVS commit: src/sys/lib/libkern

2011-09-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 29 20:50:09 UTC 2011

Modified Files:
src/sys/lib/libkern: kern_assert.c libkern.h

Log Message:
Don't include sys/systm.h because it brings in too much stuff that
conflicts with standalone code. Instead modify kern_assert() to be like
panic() and call that.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/kern_assert.c
cvs rdiff -u -r1.101 -r1.102 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/sys/lib/libkern/kern_assert.c
diff -u src/sys/lib/libkern/kern_assert.c:1.1 src/sys/lib/libkern/kern_assert.c:1.2
--- src/sys/lib/libkern/kern_assert.c:1.1	Tue Jan 19 17:28:30 2010
+++ src/sys/lib/libkern/kern_assert.c	Thu Sep 29 16:50:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_assert.c,v 1.1 2010/01/19 22:28:30 pooka Exp $	*/
+/*	$NetBSD: kern_assert.c,v 1.2 2011/09/29 20:50:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -39,14 +39,14 @@
 #endif
 
 void
-kern_assert(const char *t, const char *f, int l, const char *e)
+kern_assert(const char *fmt, ...)
 {
-
+	va_list ap;
 #ifdef _KERNEL
 	if (panicstr != NULL)
 		return;
 #endif
-
-	panic(kernel %sassertion \%s\ failed: file \%s\, line %d,
-	t, e, f, l);
+	va_start(ap, fmt);
+	vpanic(fmt, ap);
+	va_end(ap);
 }

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.101 src/sys/lib/libkern/libkern.h:1.102
--- src/sys/lib/libkern/libkern.h:1.101	Mon Sep 26 21:02:39 2011
+++ src/sys/lib/libkern/libkern.h	Thu Sep 29 16:50:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.101 2011/09/27 01:02:39 jym Exp $	*/
+/*	$NetBSD: libkern.h,v 1.102 2011/09/29 20:50:09 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,6 @@
 #include sys/types.h
 #include sys/inttypes.h
 #include sys/null.h
-#include sys/systm.h
 
 #ifndef LIBKERN_INLINE
 #define LIBKERN_INLINE	static __inline
@@ -181,7 +180,7 @@ tolower(int ch)
 #define	assert(e)	((void)0)
 #else
 #define	assert(e)	(__predict_true((e)) ? (void)0 :		\
-			panic(__KASSERTSTR, , #e, __FILE__, __LINE__))
+			kern_assert(__KASSERTSTR, , #e, __FILE__, __LINE__))
 #endif
 
 #ifdef __COVERITY__
@@ -205,11 +204,11 @@ tolower(int ch)
 #define _DIAGASSERT(a)	assert(a)
 #define	KASSERTMSG(e, msg, ...)		\
 			(__predict_true((e)) ? (void)0 :		\
-			panic(__KASSERTSTR msg, diagnostic , #e,	\
+			kern_assert(__KASSERTSTR msg, diagnostic , #e,	\
 __FILE__, __LINE__, ## __VA_ARGS__))
 
 #define	KASSERT(e)	(__predict_true((e)) ? (void)0 :		\
-			panic(__KASSERTSTR, diagnostic , #e,	\
+			kern_assert(__KASSERTSTR, diagnostic , #e,	\
 __FILE__, __LINE__))
 #endif
 
@@ -224,11 +223,11 @@ tolower(int ch)
 #else
 #define	KDASSERTMSG(e, msg, ...)	\
 			(__predict_true((e)) ? (void)0 :		\
-			panic(__KASSERTSTR msg, debugging , #e,	\
+			kern_assert(__KASSERTSTR msg, debugging , #e,	\
 __FILE__, __LINE__, ## __VA_ARGS__))
 
 #define	KDASSERT(e)	(__predict_true((e)) ? (void)0 :		\
-			panic(__KASSERTSTR, debugging , #e,	\
+			kern_assert(__KASSERTSTR, debugging , #e,	\
 __FILE__, __LINE__))
 #endif
 
@@ -300,7 +299,8 @@ int	 ffs(int);
 #define	ffs(x)		__builtin_ffs(x)
 #endif
 
-void	 kern_assert(const char *, const char *, int, const char *);
+void	 kern_assert(const char *, ...)
+__attribute__((__format__(__printf__, 1, 2)));
 unsigned int
 	bcdtobin(unsigned int);
 unsigned int



  1   2   >