CVS commit: src/sys/lib/libkern

2024-01-01 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Mon Jan  1 20:33:34 UTC 2024

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

Log Message:
avoid dependency on NETBSDSRCDIR being set.

(similar to an earlier commit)
due to various things, non-build.sh builds don't have it set already
and it ends up defaulting to /usr/src, so if that doesn't exist or
is the wrong version, building libkern fails.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 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.53 src/sys/lib/libkern/Makefile.libkern:1.54
--- src/sys/lib/libkern/Makefile.libkern:1.53	Wed Oct 27 03:06:59 2021
+++ src/sys/lib/libkern/Makefile.libkern	Mon Jan  1 20:33:34 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.53 2021/10/27 03:06:59 ryo Exp $
+#	$NetBSD: Makefile.libkern,v 1.54 2024/01/01 20:33:34 rhialto Exp $
 
 #
 # Variable definitions for libkern.
@@ -102,7 +102,7 @@ SRCS+=	entpool.c
 SRCS+=	dkcksum.c
 SRCS+=	disklabel_swap.c
 
-.PATH:	${NETBSDSRCDIR}/common/lib/libc/cdb
+.PATH:	${.PARSEDIR}/../../../common/lib/libc/cdb
 SRCS+=	cdbr.c
 SRCS+=	mi_vector_hash.c
 



CVS commit: src/sys/lib/libkern

2024-01-01 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Mon Jan  1 20:33:34 UTC 2024

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

Log Message:
avoid dependency on NETBSDSRCDIR being set.

(similar to an earlier commit)
due to various things, non-build.sh builds don't have it set already
and it ends up defaulting to /usr/src, so if that doesn't exist or
is the wrong version, building libkern fails.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 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.



CVS commit: src/sys/lib/libkern

2023-11-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Nov 13 19:07:00 UTC 2023

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

Log Message:
avoid dependency on NETBSDSRCDIR being set.

due to various things, non-build.sh builds don't have it set already
and it ends up defaulting to /usr/src, so if that doesn't exist or
is the wrong version, building libkern fails.

XXX: pullup-10, ..?


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/lib/libkern/Makefile.compiler-rt:1.14
--- src/sys/lib/libkern/Makefile.compiler-rt:1.13	Wed Jun 16 05:21:09 2021
+++ src/sys/lib/libkern/Makefile.compiler-rt	Mon Nov 13 19:07:00 2023
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile.compiler-rt,v 1.13 2021/06/16 05:21:09 rin Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.14 2023/11/13 19:07:00 mrg Exp $
 
-COMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
+COMPILER_RT_DIR=	${.PARSEDIR}/../../external/bsd/compiler_rt
 COMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
 
 .if ${MACHINE_ARCH} == "powerpc"



CVS commit: src/sys/lib/libkern

2023-11-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Nov 13 19:07:00 UTC 2023

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

Log Message:
avoid dependency on NETBSDSRCDIR being set.

due to various things, non-build.sh builds don't have it set already
and it ends up defaulting to /usr/src, so if that doesn't exist or
is the wrong version, building libkern fails.

XXX: pullup-10, ..?


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.



CVS commit: src/sys/lib/libkern

2023-09-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Sep  6 19:14:52 UTC 2023

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

Log Message:
fix the example for container_of().

needs to be a pointer into the containing structure, not the
value of a pointer inside the structure.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 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.144 src/sys/lib/libkern/libkern.h:1.145
--- src/sys/lib/libkern/libkern.h:1.144	Fri Dec 31 14:19:57 2021
+++ src/sys/lib/libkern/libkern.h	Wed Sep  6 19:14:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.144 2021/12/31 14:19:57 riastradh Exp $	*/
+/*	$NetBSD: libkern.h,v 1.145 2023/09/06 19:14:52 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -335,7 +335,7 @@ tolower(int ch)
  *	};
  *
  *	struct bar b;
- *	struct foo *fp = b.b_foo;
+ *	struct foo *fp = _foo;
  *
  * Now we can get at b from fp by:
  *



CVS commit: src/sys/lib/libkern

2023-09-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Sep  6 19:14:52 UTC 2023

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

Log Message:
fix the example for container_of().

needs to be a pointer into the containing structure, not the
value of a pointer inside the structure.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 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.



CVS commit: src/sys/lib/libkern

2022-06-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jun 19 18:28:16 UTC 2022

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

Log Message:
libkern: fix wrong escaping in makefile

In the unlikely event that KERNDIR contains a '$' character, that '$'
should not be doubled to '$$'. It only needs the usual shell quoting.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 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.47 src/sys/lib/libkern/Makefile.inc:1.48
--- src/sys/lib/libkern/Makefile.inc:1.47	Mon May 30 14:13:59 2022
+++ src/sys/lib/libkern/Makefile.inc	Sun Jun 19 18:28:16 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.47 2022/05/30 14:13:59 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.48 2022/06/19 18:28:16 rillig Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -41,7 +41,7 @@ KERNLIBLN=	${KERNDST}/${LIBKERNLNBN}
 LIBKERN_MD_FLAGS?=	none
 
 KERNMAKE= \
-	cd ${KERNDST} && ${MAKE} -f ${KERNDIR:q}/Makefile \
+	cd ${KERNDST} && ${MAKE} -f ${KERNDIR:Q}/Makefile \
 	KERNDIR=${KERNDIR:q} \
 	CC=${CC:q} CFLAGS=${CFLAGS:q} CPUFLAGS= \
 	AS=${AS:q} AFLAGS=${AFLAGS:q} \



CVS commit: src/sys/lib/libkern

2022-06-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jun 19 18:28:16 UTC 2022

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

Log Message:
libkern: fix wrong escaping in makefile

In the unlikely event that KERNDIR contains a '$' character, that '$'
should not be doubled to '$$'. It only needs the usual shell quoting.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 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.



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

2022-06-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 15 21:31:19 UTC 2022

Modified Files:
src/sys/lib/libkern/arch/hppa: milli_extra.S

Log Message:
Fix a dumb typo/thinko

Thanks to Tom Lane for spotting it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/arch/hppa/milli_extra.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/hppa/milli_extra.S
diff -u src/sys/lib/libkern/arch/hppa/milli_extra.S:1.1 src/sys/lib/libkern/arch/hppa/milli_extra.S:1.2
--- src/sys/lib/libkern/arch/hppa/milli_extra.S:1.1	Mon Jun 13 16:03:07 2022
+++ src/sys/lib/libkern/arch/hppa/milli_extra.S	Wed Jun 15 21:31:19 2022
@@ -37,6 +37,6 @@
 	.entry
 
 MILLI_ENTRY(__canonicalize_funcptr_for_compare)
-	bv	%r0(%sp)
+	bv	%r0(%rp)
 	 copy	%arg0, %ret0
 EXIT(__canonicalize_funcptr_for_compare)



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

2022-06-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 15 21:31:19 UTC 2022

Modified Files:
src/sys/lib/libkern/arch/hppa: milli_extra.S

Log Message:
Fix a dumb typo/thinko

Thanks to Tom Lane for spotting it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/arch/hppa/milli_extra.S

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



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

2022-06-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 13 16:03:07 UTC 2022

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

Log Message:
Provide a __canonicalize_funcptr_for_compare which only needs to return
the passed value as the kernel doesn't do PLABELS.

PR/56878 (hppa: kernel module lua fails to load)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libkern/arch/hppa/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/sys/lib/libkern/arch/hppa/milli_extra.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/hppa/Makefile.inc
diff -u src/sys/lib/libkern/arch/hppa/Makefile.inc:1.12 src/sys/lib/libkern/arch/hppa/Makefile.inc:1.13
--- src/sys/lib/libkern/arch/hppa/Makefile.inc:1.12	Thu Mar 13 16:09:11 2014
+++ src/sys/lib/libkern/arch/hppa/Makefile.inc	Mon Jun 13 16:03:07 2022
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile.inc,v 1.12 2014/03/13 16:09:11 pooka Exp $
+#	$NetBSD: Makefile.inc,v 1.13 2022/06/13 16:03:07 skrll Exp $
 
 SRCS+=	milli.S
 SRCS+=	bcopy.S memcpy.S memmove.S
+SRCS+=	milli_extra.S
 
 # XXX: spcopy does not really belong in libkern in the first place
 .ifndef RUMPKERNEL

Added files:

Index: src/sys/lib/libkern/arch/hppa/milli_extra.S
diff -u /dev/null src/sys/lib/libkern/arch/hppa/milli_extra.S:1.1
--- /dev/null	Mon Jun 13 16:03:07 2022
+++ src/sys/lib/libkern/arch/hppa/milli_extra.S	Mon Jun 13 16:03:07 2022
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "machine/asm.h"
+
+
+#define	MILLI_ENTRY(x)	!\
+	.text ! .align 4!\
+	.export x, millicode ! .label x ! .proc		!\
+	.callinfo no_calls!\
+	.entry
+
+MILLI_ENTRY(__canonicalize_funcptr_for_compare)
+	bv	%r0(%sp)
+	 copy	%arg0, %ret0
+EXIT(__canonicalize_funcptr_for_compare)



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

2022-06-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 13 16:03:07 UTC 2022

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

Log Message:
Provide a __canonicalize_funcptr_for_compare which only needs to return
the passed value as the kernel doesn't do PLABELS.

PR/56878 (hppa: kernel module lua fails to load)


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

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



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

2022-06-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 13 16:00:05 UTC 2022

Modified Files:
src/sys/lib/libkern/arch/hppa: milli.S

Log Message:
Don't need $$sh_func_adrs


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/arch/hppa/milli.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/hppa/milli.S
diff -u src/sys/lib/libkern/arch/hppa/milli.S:1.2 src/sys/lib/libkern/arch/hppa/milli.S:1.3
--- src/sys/lib/libkern/arch/hppa/milli.S:1.2	Tue Aug 17 22:00:32 2021
+++ src/sys/lib/libkern/arch/hppa/milli.S	Mon Jun 13 16:00:05 2022
@@ -1,4 +1,4 @@
-;	$NetBSD: milli.S,v 1.2 2021/08/17 22:00:32 andvar Exp $
+;	$NetBSD: milli.S,v 1.3 2022/06/13 16:00:05 skrll Exp $
 ;
 ;	$OpenBSD: milli.S,v 1.5 2001/03/29 04:08:20 mickey Exp $
 ;
@@ -443,7 +443,6 @@ noshlibs:
 	be	0(sr0,r22)
 	stw	rp,-24(sp)
 	.procend
-#endif
 
 $$sh_func_adrs:
 	.proc
@@ -456,6 +455,7 @@ $$sh_func_adrs:
 	bv	r0(r31)
 	ldws	0(r26),ret1
 	.procend
+#endif
 
 temp: .EQU	r1
 



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

2022-06-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 13 16:00:05 UTC 2022

Modified Files:
src/sys/lib/libkern/arch/hppa: milli.S

Log Message:
Don't need $$sh_func_adrs


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/lib/libkern/arch/hppa/milli.S

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



CVS commit: src/sys/lib/libkern

2022-05-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 30 14:13:59 UTC 2022

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

Log Message:
Introduce LIBKERN_MD_FLAGS to pass some MD flags for libkern.

This is necessary since libkern is built by coprocess, and
threfore subsets of make(1) variables are passed.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 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.46 src/sys/lib/libkern/Makefile.inc:1.47
--- src/sys/lib/libkern/Makefile.inc:1.46	Sat Sep 22 12:24:04 2018
+++ src/sys/lib/libkern/Makefile.inc	Mon May 30 14:13:59 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.46 2018/09/22 12:24:04 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.47 2022/05/30 14:13:59 rin Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -38,6 +38,8 @@ KERNLIB_PROF=	${KERNDST}/libkern_p.a
 LIBKERNLNBN=	llib-lkern.ln
 KERNLIBLN=	${KERNDST}/${LIBKERNLNBN}
 
+LIBKERN_MD_FLAGS?=	none
+
 KERNMAKE= \
 	cd ${KERNDST} && ${MAKE} -f ${KERNDIR:q}/Makefile \
 	KERNDIR=${KERNDIR:q} \
@@ -54,6 +56,7 @@ KERNMAKE= \
 	LINTFLAGS=${KERNLINTFLAGS:q} \
 	LIBKERN_ARCH=${LIBKERN_ARCH:q} \
 	COMMON_MACHINE_ARCH=${COMMON_MACHINE_ARCH:q} \
+	LIBKERN_MD_FLAGS=${LIBKERN_MD_FLAGS:q} \
 	${KERNMISCMAKEFLAGS}
 
 ${KERNLIB}:		.NOTMAIN .MAKE __always_make_kernlib



CVS commit: src/sys/lib/libkern

2022-05-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May 30 14:13:59 UTC 2022

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

Log Message:
Introduce LIBKERN_MD_FLAGS to pass some MD flags for libkern.

This is necessary since libkern is built by coprocess, and
threfore subsets of make(1) variables are passed.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 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.



CVS commit: src/sys/lib/libkern

2021-12-12 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Dec 13 01:33:32 UTC 2021

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

Log Message:
revert rev 1.4 ("Add garbage instructions at end of kern_assert after vpanic.")

that change had no effect because vpanic() is marked __dead / noreturn
and thus the compiler would optimize away everything after a call to vpanic().
the original problem has now been fixed differently (but only for x86 so far).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/lib/libkern/kern_assert.c:1.5
--- src/sys/lib/libkern/kern_assert.c:1.4	Tue Mar 14 09:22:37 2017
+++ src/sys/lib/libkern/kern_assert.c	Mon Dec 13 01:33:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_assert.c,v 1.4 2017/03/14 09:22:37 riastradh Exp $	*/
+/*	$NetBSD: kern_assert.c,v 1.5 2021/12/13 01:33:32 chs Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -50,13 +50,4 @@ 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

2021-12-12 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Dec 13 01:33:32 UTC 2021

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

Log Message:
revert rev 1.4 ("Add garbage instructions at end of kern_assert after vpanic.")

that change had no effect because vpanic() is marked __dead / noreturn
and thus the compiler would optimize away everything after a call to vpanic().
the original problem has now been fixed differently (but only for x86 so far).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.



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/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.



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-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.



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-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.



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: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.



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

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.



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 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.



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: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.



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.



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:   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.



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.



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-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.



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.



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.



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

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.



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

2020-04-22 Thread Rin Okuyama

In addition to these files in this mail:

Modified Files:
src/lib/libc/arch/m68k/gen: Makefile.inc
src/lib/libc/compiler_rt: Makefile.inc
src/sys/arch/sun68k/stand/libsa: Makefile.inc

Removed Files:
src/common/lib/libc/arch/m68k/gen: divsi3.S modsi3.S udivsi3.S umodsi3.S

However, cvs aborted since I forgot to ``cvs add'' and commit mail was
not sent. Sorry for the inconvenience...

Diffs are attached to this message.

Thanks,
rin

On 2020/04/22 20:58, Rin Okuyama wrote:

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
+   negl4(%sp)  | store abs(dividend)
+1: movel   8(%sp), %d0 | load the divisor
+   bpl 2f
+   negl8(%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: 

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/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.



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.



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/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.



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: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.



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: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.



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.



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-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.



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.



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-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.



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 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.



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.



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 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.



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.



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

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.



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/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.



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.



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: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.



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

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.



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/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.



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

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.



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/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.



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-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.



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.



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

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.



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 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.



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.



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.



  1   2   3   >