CVS commit: src/games/fish

2021-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  1 21:10:57 UTC 2021

Modified Files:
src/games/fish: fish.c

Log Message:
fish: remove modulo bias from random number generation

It probably doesn't matter in practice, but omitting this piece of code
always looks like an oversight.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/games/fish/fish.c

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

Modified files:

Index: src/games/fish/fish.c
diff -u src/games/fish/fish.c:1.23 src/games/fish/fish.c:1.24
--- src/games/fish/fish.c:1.23	Mon Mar  5 04:59:54 2018
+++ src/games/fish/fish.c	Sat May  1 21:10:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fish.c,v 1.23 2018/03/05 04:59:54 eadler Exp $	*/
+/*	$NetBSD: fish.c,v 1.24 2021/05/01 21:10:57 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19
 #if 0
 static char sccsid[] = "@(#)fish.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fish.c,v 1.23 2018/03/05 04:59:54 eadler Exp $");
+__RCSID("$NetBSD: fish.c,v 1.24 2021/05/01 21:10:57 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -435,8 +435,13 @@ init(void)
 static int
 nrandom(int n)
 {
+	long r;
 
-	return((int)random() % n);
+	for (;;) {
+		r = random();
+		if (r < RANDOM_MAX - RANDOM_MAX % n)
+			return (int)(r % n);
+	}
 }
 
 static void



CVS commit: src/games/cgram

2021-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  1 20:29:23 UTC 2021

Modified Files:
src/games/cgram: cgram.c

Log Message:
cgram: rename local functions

The word 'cleanup' should have been named clean_up all along, but 'done'
is even shorter.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/games/cgram/cgram.c

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

Modified files:

Index: src/games/cgram/cgram.c
diff -u src/games/cgram/cgram.c:1.22 src/games/cgram/cgram.c:1.23
--- src/games/cgram/cgram.c:1.22	Thu Apr 29 20:17:20 2021
+++ src/games/cgram/cgram.c	Sat May  1 20:29:23 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cgram.c,v 1.22 2021/04/29 20:17:20 rillig Exp $ */
+/* $NetBSD: cgram.c,v 1.23 2021/05/01 20:29:23 rillig Exp $ */
 
 /*-
  * Copyright (c) 2013, 2021 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.c,v 1.22 2021/04/29 20:17:20 rillig Exp $");
+__RCSID("$NetBSD: cgram.c,v 1.23 2021/05/01 20:29:23 rillig Exp $");
 #endif
 
 #include 
@@ -143,7 +143,7 @@ stringarray_init(struct stringarray *a)
 }
 
 static void
-stringarray_cleanup(struct stringarray *a)
+stringarray_done(struct stringarray *a)
 {
 	for (size_t i = 0; i < a->num; i++)
 		free(a->v[i].s);
@@ -584,12 +584,12 @@ loop(void)
 }
 
 static void
-clean_up(void)
+done(void)
 {
 	endwin();
 
-	stringarray_cleanup(&sollines);
-	stringarray_cleanup(&lines);
+	stringarray_done(&sollines);
+	stringarray_done(&lines);
 }
 
 
@@ -611,5 +611,5 @@ main(int argc, char *argv[])
 
 	init(argc > 1 ? argv[1] : NULL);
 	loop();
-	clean_up();
+	done();
 }



CVS commit: src/games/caesar

2021-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  1 20:21:25 UTC 2021

Modified Files:
src/games/caesar: Makefile caesar.c

Log Message:
caesar: WARNS=6, strict bool mode

The rotation is validated to be nonnegative, therefore use unsigned int
for it.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/games/caesar/Makefile
cvs rdiff -u -r1.22 -r1.23 src/games/caesar/caesar.c

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

Modified files:

Index: src/games/caesar/Makefile
diff -u src/games/caesar/Makefile:1.8 src/games/caesar/Makefile:1.9
--- src/games/caesar/Makefile:1.8	Mon Jan 28 07:03:59 2008
+++ src/games/caesar/Makefile	Sat May  1 20:21:25 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2008/01/28 07:03:59 dholland Exp $
+#	$NetBSD: Makefile,v 1.9 2021/05/01 20:21:25 rillig Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
 PROG=	caesar
@@ -8,4 +8,7 @@ LDADD=	-lm
 MLINKS=	caesar.6 rot13.6
 SCRIPTS=rot13.sh
 
+WARNS=		6
+LINTFLAGS+=	-T
+
 .include 

Index: src/games/caesar/caesar.c
diff -u src/games/caesar/caesar.c:1.22 src/games/caesar/caesar.c:1.23
--- src/games/caesar/caesar.c:1.22	Sun Jul 20 01:03:21 2008
+++ src/games/caesar/caesar.c	Sat May  1 20:21:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: caesar.c,v 1.22 2008/07/20 01:03:21 lukem Exp $	*/
+/*	$NetBSD: caesar.c,v 1.23 2021/05/01 20:21:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)caesar.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: caesar.c,v 1.22 2008/07/20 01:03:21 lukem Exp $");
+__RCSID("$NetBSD: caesar.c,v 1.23 2021/05/01 20:21:25 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -79,7 +79,7 @@ static unsigned char rottbl[NCHARS];
 
 
 static void
-init_rottbl(int rot)
+init_rottbl(unsigned int rot)
 {
 	size_t i;
 
@@ -121,7 +121,7 @@ print_array(const unsigned char *a, size
 	}
 }
 
-static int
+static unsigned int
 get_rotation(const char *arg)
 {
 	long rot;
@@ -135,7 +135,7 @@ get_rotation(const char *arg)
 		errno = ERANGE;
 	if (errno)
 		err(EXIT_FAILURE, "Bad rotation value `%s'", arg);
-	return (int)rot;
+	return (unsigned int)rot;
 }
 
 static void
@@ -145,7 +145,7 @@ guess_and_rotate(void)
 	unsigned int obs[NCHARS];
 	size_t i, nread;
 	double dot, winnerdot;
-	int try, winner;
+	unsigned int try, winner;
 	int ch;
 
 	/* adjust frequency table to weight low probs REAL low */



CVS commit: src/usr.bin/ktruss

2021-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  1 18:07:52 UTC 2021

Modified Files:
src/usr.bin/ktruss: dump.c

Log Message:
ktruss: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/ktruss/dump.c

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

Modified files:

Index: src/usr.bin/ktruss/dump.c
diff -u src/usr.bin/ktruss/dump.c:1.47 src/usr.bin/ktruss/dump.c:1.48
--- src/usr.bin/ktruss/dump.c:1.47	Tue Jan 14 11:28:35 2020
+++ src/usr.bin/ktruss/dump.c	Sat May  1 18:07:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dump.c,v 1.47 2020/01/14 11:28:35 kamil Exp $	*/
+/*	$NetBSD: dump.c,v 1.48 2021/05/01 18:07:52 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: dump.c,v 1.47 2020/01/14 11:28:35 kamil Exp $");
+__RCSID("$NetBSD: dump.c,v 1.48 2021/05/01 18:07:52 rillig Exp $");
 #endif /* not lint */
 
 #include 
@@ -673,7 +673,7 @@ ktrsysret(struct ktr_entry *kte)
 	syscall_ent = getpendq(kth, KTR_SYSCALL, NULL);
 	if (syscall_ent == NULL) {
 		/*
-		 * Possibilly a child of fork/vfork, or tracing of
+		 * Possibly a child of fork/vfork, or tracing of
 		 * process started during system call.
 		 */
 		syscallnameprint(ktr->ktr_code);



CVS commit: src/doc

2021-05-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May  1 16:14:35 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
fix syntax of latest CHANGES entry


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2801 src/doc/CHANGES:1.2802
--- src/doc/CHANGES:1.2801	Fri Apr 30 22:22:49 2021
+++ src/doc/CHANGES	Sat May  1 16:14:35 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2801 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2802 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -367,5 +367,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	aarch64: Switch to GCC 10.  [mrg 20210425]
 	bind: Import version 9.16.15. [christos 20210429]
 	resolver: The default has been changed to check-names
-	(see resolv.conf(5)), which means that hostnames that
-	contain invalid characters will not resolve. [christos 20210430]
+		(see resolv.conf(5)), which means that hostnames that
+		contain invalid characters will not resolve. [christos 20210430]



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

2021-05-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May  1 15:12:26 UTC 2021

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

Log Message:
Remove unnecessary interface attributes from "smu".


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/macppc/conf/files.macppc

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

Modified files:

Index: src/sys/arch/macppc/conf/files.macppc
diff -u src/sys/arch/macppc/conf/files.macppc:1.116 src/sys/arch/macppc/conf/files.macppc:1.117
--- src/sys/arch/macppc/conf/files.macppc:1.116	Sat Apr 24 23:36:41 2021
+++ src/sys/arch/macppc/conf/files.macppc	Sat May  1 15:12:25 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.macppc,v 1.116 2021/04/24 23:36:41 thorpej Exp $
+#	$NetBSD: files.macppc,v 1.117 2021/05/01 15:12:25 thorpej Exp $
 #
 # macppc-specific configuration info
 
@@ -175,8 +175,7 @@ device zstty: tty
 attach zstty at zsc
 file dev/ic/z8530tty.czstty needs-flag
 
-define smu {}
-device smu: smu, obio
+device smu { }
 attach smu at mainbus
 file arch/macppc/dev/smu.c			smu needs-flag
 defflag	opt_smu.h	SMU_DEBUG



CVS commit: src/sys/miscfs/fdesc

2021-05-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat May  1 15:08:14 UTC 2021

Modified Files:
src/sys/miscfs/fdesc: fdesc_vnops.c

Log Message:
Make sure fdesc_lookup() never returns VNON vnodes.

Should fix PR kern/56130 (fdescfs create nodes with wrong major number)


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/miscfs/fdesc/fdesc_vnops.c

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

Modified files:

Index: src/sys/miscfs/fdesc/fdesc_vnops.c
diff -u src/sys/miscfs/fdesc/fdesc_vnops.c:1.134 src/sys/miscfs/fdesc/fdesc_vnops.c:1.135
--- src/sys/miscfs/fdesc/fdesc_vnops.c:1.134	Sat Jun 27 17:29:19 2020
+++ src/sys/miscfs/fdesc/fdesc_vnops.c	Sat May  1 15:08:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdesc_vnops.c,v 1.134 2020/06/27 17:29:19 christos Exp $	*/
+/*	$NetBSD: fdesc_vnops.c,v 1.135 2021/05/01 15:08:14 hannken Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.134 2020/06/27 17:29:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.135 2021/05/01 15:08:14 hannken Exp $");
 
 #include 
 #include 
@@ -295,9 +295,20 @@ bad:
 good:
 	KASSERT(ix != -1);
 	error = vcache_get(dvp->v_mount, &ix, sizeof(ix), vpp);
-	if (error == 0 && ix == FD_CTTY)
+	if (error)
+		return error;
+
+	/*
+	 * Prevent returning VNON nodes.
+	 * Operation fdesc_inactive() will reset the type to VNON.
+	 */
+	if (ix == FD_CTTY)
 		(*vpp)->v_type = VCHR;
-	return error;
+	else if (ix >= FD_DESC)
+		(*vpp)->v_type = VREG;
+	KASSERT((*vpp)->v_type != VNON);
+
+	return 0;
 }
 
 int



CVS commit: src/sys/uvm/pmap

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 14:00:57 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Revert previous


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/uvm/pmap/pmap_tlb.c

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

Modified files:

Index: src/sys/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.42 src/sys/uvm/pmap/pmap_tlb.c:1.43
--- src/sys/uvm/pmap/pmap_tlb.c:1.42	Sat May  1 06:56:41 2021
+++ src/sys/uvm/pmap/pmap_tlb.c	Sat May  1 14:00:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.42 2021/05/01 06:56:41 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.43 2021/05/01 14:00:57 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.42 2021/05/01 06:56:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.43 2021/05/01 14:00:57 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -733,6 +733,7 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 }
 #endif /* MULTIPROCESSOR && PMAP_TLB_NEED_SHOOTDOWN */
 
+#ifndef PMAP_HWPAGEWALKER
 int
 pmap_tlb_update_addr(pmap_t pm, vaddr_t va, pt_entry_t pte, u_int flags)
 {
@@ -772,6 +773,7 @@ pmap_tlb_update_addr(pmap_t pm, vaddr_t 
 
 	return rv;
 }
+#endif /* !PMAP_HWPAGEWALKER */
 
 void
 pmap_tlb_invalidate_addr(pmap_t pm, vaddr_t va)



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

2021-05-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May  1 13:23:07 UTC 2021

Modified Files:
src/sys/arch/alpha/include: userret.h

Log Message:
Make sure preemption is disabled around PMAP_USERRET(); it uses
per-cpu information.

XXX mi_userret() also internally disables preemption.  Should restructure
these to remove redundancies.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/alpha/include/userret.h

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

Modified files:

Index: src/sys/arch/alpha/include/userret.h
diff -u src/sys/arch/alpha/include/userret.h:1.10 src/sys/arch/alpha/include/userret.h:1.11
--- src/sys/arch/alpha/include/userret.h:1.10	Mon Feb  6 02:14:13 2012
+++ src/sys/arch/alpha/include/userret.h	Sat May  1 13:23:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: userret.h,v 1.10 2012/02/06 02:14:13 matt Exp $ */
+/* $NetBSD: userret.h,v 1.11 2021/05/01 13:23:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -103,7 +103,9 @@ userret(struct lwp *l)
 	struct proc *p = l->l_proc;
 
 	/* Do any deferred user pmap operations. */
+	KPREEMPT_DISABLE(l);
 	PMAP_USERRET(vm_map_pmap(&p->p_vmspace->vm_map));
+	KPREEMPT_ENABLE(l);
 
 	/* Invoke MI userret code */
 	mi_userret(l);



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

2021-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  1 07:56:20 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_attribute.c gcc_attribute.exp

Log Message:
tests/lint: add test for __attribute__((nonnull()))


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/gcc_attribute.c \
src/tests/usr.bin/xlint/lint1/gcc_attribute.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/gcc_attribute.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.3
--- src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.2	Sat May  1 07:25:07 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute.c	Sat May  1 07:56:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gcc_attribute.c,v 1.2 2021/05/01 07:25:07 rillig Exp $	*/
+/*	$NetBSD: gcc_attribute.c,v 1.3 2021/05/01 07:56:20 rillig Exp $	*/
 # 3 "gcc_attribute.c"
 
 /*
@@ -23,6 +23,14 @@ do_not_inline(void)
 void __attribute__((nonnull))
 function_nonnull(void *, const void *, int);
 
+/*
+ * The documentation suggests that the argument list of nonnull be nonempty,
+ * but GCC 9.3.0 accepts an empty list as well, treating all parameters as
+ * nonnull.
+ */
+void __attribute__((nonnull()))
+function_nonnull_list(void *, const void *, int);
+
 /* Arguments 1 and 2 must be nonnull. */
 void __attribute__((nonnull(1, 2)))
 function_nonnull_list(void *, const void *, int);
Index: src/tests/usr.bin/xlint/lint1/gcc_attribute.exp
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.3
--- src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.2	Sat May  1 07:25:07 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute.exp	Sat May  1 07:56:20 2021
@@ -1 +1 @@
-gcc_attribute.c(31): error: syntax error 'unknown_attribute' [249]
+gcc_attribute.c(39): error: syntax error 'unknown_attribute' [249]



CVS commit: src/sys/arch/riscv

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 07:41:24 UTC 2021

Modified Files:
src/sys/arch/riscv/include: pmap.h pte.h vmparam.h
src/sys/arch/riscv/riscv: pmap_machdep.c

Log Message:
Fixup some pmap / VM related #defines and code


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/riscv/include/pmap.h \
src/sys/arch/riscv/include/vmparam.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/include/pte.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/riscv/pmap_machdep.c

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

Modified files:

Index: src/sys/arch/riscv/include/pmap.h
diff -u src/sys/arch/riscv/include/pmap.h:1.8 src/sys/arch/riscv/include/pmap.h:1.9
--- src/sys/arch/riscv/include/pmap.h:1.8	Sun Dec 20 16:38:25 2020
+++ src/sys/arch/riscv/include/pmap.h	Sat May  1 07:41:24 2021
@@ -1,11 +1,12 @@
-/* $NetBSD: pmap.h,v 1.8 2020/12/20 16:38:25 skrll Exp $ */
+/* $NetBSD: pmap.h,v 1.9 2021/05/01 07:41:24 skrll Exp $ */
 
 /*
- * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas (of 3am Software Foundry) and Maxime Villard.
+ * by Matt Thomas (of 3am Software Foundry), Maxime Villard, and
+ * Nick Hudson.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -38,6 +39,7 @@
 
 #if !defined(_MODULE)
 
+#include 
 #include 
 #include 
 #include 
@@ -46,26 +48,35 @@
 #include 
 
 #include 
+#include 
 
 #define PMAP_SEGTABSIZE	NPTEPG
-
-#define NBSEG		(PAGE_SIZE * NPTEPG)
+#define PMAP_PDETABSIZE	NPTEPG
 
 #ifdef _LP64
-#define NBXSEG		(NBSEG * NSEGPG)
-#define XSEGSHIFT	(SEGSHIFT + PGSHIFT - 3)
-#define XSEGOFSET	(PTE_PPN1 | SEGOFSET)
-#define SEGSHIFT	(PGSHIFT + PGSHIFT - 3)
+#define PTPSHIFT	3
+/* This is SV48. */
+//#define SEGLENGTH + SEGSHIFT + SEGSHIFT */
+
+/* This is SV39. */
+#define XSEGSHIFT	(SEGSHIFT + SEGLENGTH)
+#define NBXSEG		(1ULL << XSEGSHIFT)
+#define XSEGOFSET	(NBXSEG - 1)		/* byte offset into xsegment */
+#define XSEGLENGTH	(PGSHIFT - 3)
+#define NXSEGPG		(1 << XSEGLENGTH)
 #else
-#define SEGSHIFT	(PGSHIFT + PGSHIFT - 2)
+#define PTPSHIFT	2
+#define XSEGSHIFT	SEGLENGTH
 #endif
 
-#define SEGOFSET	(PTE_PPN0|PAGE_MASK)
+#define SEGLENGTH	(PGSHIFT - PTPSHIFT)
+#define SEGSHIFT	(SEGLENGTH + PGSHIFT)
+#define NBSEG		(1 << SEGSHIFT)		/* bytes/segment */
+#define SEGOFSET	(NBSEG - 1)		/* byte offset into segment */
 
 #define KERNEL_PID	0
 
 #define PMAP_HWPAGEWALKER		1
-#define PMAP_TLB_NUM_PIDS		256
 #define PMAP_TLB_MAX			1
 #ifdef _LP64
 #define PMAP_INVALID_PDETAB_ADDRESS	((pmap_pdetab_t *)(VM_MIN_KERNEL_ADDRESS - PAGE_SIZE))
@@ -74,6 +85,8 @@
 #define PMAP_INVALID_PDETAB_ADDRESS	((pmap_pdetab_t *)0xdeadbeef)
 #define PMAP_INVALID_SEGTAB_ADDRESS	((pmap_segtab_t *)0xdeadbeef)
 #endif
+#define PMAP_TLB_NUM_PIDS		(__SHIFTOUT_MASK(SATP_ASID) + 1)
+#define PMAP_TLB_BITMAP_LENGTH  PMAP_TLB_NUM_PIDS
 #define PMAP_TLB_FLUSH_ASID_ON_RESET	false
 
 #define pmap_phys_address(x)		(x)
@@ -120,9 +133,9 @@ paddr_t	pmap_md_direct_mapped_vaddr_to_p
 vaddr_t	pmap_md_direct_map_paddr(paddr_t);
 void	pmap_md_init(void);
 bool	pmap_md_tlb_check_entry(void *, vaddr_t, tlb_asid_t, pt_entry_t);
-voidpmap_md_page_syncicache(struct vm_page_md *, const kcpuset_t *);
 
-void	pmap_md_pdetab_activate(struct pmap *);
+void	pmap_md_xtab_activate(struct pmap *, struct lwp *);
+void	pmap_md_xtab_deactivate(struct pmap *);
 void	pmap_md_pdetab_init(struct pmap *);
 bool	pmap_md_ok_to_steal_p(const uvm_physseg_t, size_t);
 
@@ -131,6 +144,9 @@ extern vaddr_t pmap_direct_end;
 #define PMAP_DIRECT_MAP(pa)	(pmap_direct_base + (pa))
 #define PMAP_DIRECT_UNMAP(va)	((paddr_t)(va) - pmap_direct_base)
 
+#define MEGAPAGE_TRUNC(x)	((x) & ~SEGOFSET)
+#define MEGAPAGE_ROUND(x)	MEGAPAGE_TRUNC((x) + SEGOFSET)
+
 #ifdef __PMAP_PRIVATE
 static inline void
 pmap_md_page_syncicache(struct vm_page_md *mdpg, const kcpuset_t *kc)
@@ -150,7 +166,6 @@ pmap_md_vca_add(struct vm_page_md *mdpg,
 static inline void
 pmap_md_vca_remove(struct vm_page_md *mdpg, vaddr_t va)
 {
-
 }
 
 static inline void
@@ -164,20 +179,6 @@ pmap_md_tlb_asid_max(void)
 	return PMAP_TLB_NUM_PIDS - 1;
 }
 
-static inline void
-pmap_md_xtab_activate(struct pmap *pm, struct lwp *l)
-{
-
-	/* nothing */
-}
-
-static inline void
-pmap_md_xtab_deactivate(struct pmap *pm)
-{
-
-	/* nothing */
-}
-
 #endif /* __PMAP_PRIVATE */
 #endif /* _KERNEL */
 
Index: src/sys/arch/riscv/include/vmparam.h
diff -u src/sys/arch/riscv/include/vmparam.h:1.8 src/sys/arch/riscv/include/vmparam.h:1.9
--- src/sys/arch/riscv/include/vmparam.h:1.8	Fri Feb 26 02:18:29 2021
+++ src/sys/arch/riscv/include/vmparam.h	Sat May  1 07:41:24 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: vmparam.h,v 1.8 2021

CVS commit: src/share/man/man7

2021-05-01 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat May  1 07:41:14 UTC 2021

Modified Files:
src/share/man/man7: intro.7

Log Message:
intro.7: add missing entries


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/share/man/man7/intro.7

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

Modified files:

Index: src/share/man/man7/intro.7
diff -u src/share/man/man7/intro.7:1.28 src/share/man/man7/intro.7:1.29
--- src/share/man/man7/intro.7:1.28	Wed Feb 26 10:06:08 2020
+++ src/share/man/man7/intro.7	Sat May  1 07:41:14 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: intro.7,v 1.28 2020/02/26 10:06:08 wiz Exp $
+.\"	$NetBSD: intro.7,v 1.29 2021/05/01 07:41:14 nia Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)intro.7	8.1 (Berkeley) 6/5/93
 .\"
-.Dd May 15, 2018
+.Dd May 1, 2021
 .Dt INTRO 7
 .Os
 .Sh NAME
@@ -37,11 +37,13 @@
 .Nd miscellaneous information pages
 .Sh DESCRIPTION
 This section contains miscellaneous documentation, including:
-.Bl -tag -width "mdoc.samples(7)" -offset indent
+.Bl -tag -width "kernel_sanitizers(7)" -offset indent
 .It Xr ascii 7
 map of ASCII character set
 .It Xr c 7
 the C programming language
+.It Xr entropy 7
+random unpredictable secrets needed for security
 .It Xr environ 7
 user environment
 .It Xr glob 7
@@ -57,6 +59,10 @@ file system hierarchy in
 .Nx
 .It Xr hostname 7
 host name resolution description
+.It Xr kernel_sanitizers 7
+bug detection features in the
+.Nx
+kernel
 .It Xr mailaddr 7
 mail addressing description
 .\" .It Sy man
@@ -76,6 +82,9 @@ tutorial for writing BSD manuals with
 kernel modules
 .It Xr nls 7
 overview of national language support
+.It Xr npf 7
+.Nx
+Packet Filter
 .It Xr operator 7
 C operator precedence and order of evaluation
 .It Xr orders 7
@@ -100,6 +109,10 @@ checklist for security and setuid progra
 .It Xr signal 7
 available signals under
 .Nx
+.It Xr src 7
+layout of the
+.Nx
+source tree
 .It Xr sticky 7
 sticky bit
 .Pq Dv S_ISVTX



CVS commit: src

2021-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May  1 07:25:07 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_attribute.c gcc_attribute.exp
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: support all documented variants of __attribute__((nonnull))


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute.c \
src/tests/usr.bin/xlint/lint1/gcc_attribute.exp
cvs rdiff -u -r1.223 -r1.224 src/usr.bin/xlint/lint1/cgram.y

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/gcc_attribute.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.1 src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.2
--- src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.1	Fri Apr 30 23:49:36 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute.c	Sat May  1 07:25:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gcc_attribute.c,v 1.1 2021/04/30 23:49:36 rillig Exp $	*/
+/*	$NetBSD: gcc_attribute.c,v 1.2 2021/05/01 07:25:07 rillig Exp $	*/
 # 3 "gcc_attribute.c"
 
 /*
@@ -19,9 +19,13 @@ do_not_inline(void)
 {
 }
 
-/* expect+1: syntax error 'nonnull' */
+/* All pointer arguments must be nonnull. */
+void __attribute__((nonnull))
+function_nonnull(void *, const void *, int);
+
+/* Arguments 1 and 2 must be nonnull. */
 void __attribute__((nonnull(1, 2)))
-my_memcpy(void *dest, const void *src, unsigned long len);
+function_nonnull_list(void *, const void *, int);
 
 /* expect+1: syntax error 'unknown_attribute' */
 void __attribute__((unknown_attribute))
Index: src/tests/usr.bin/xlint/lint1/gcc_attribute.exp
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.1 src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.2
--- src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.1	Fri Apr 30 23:49:36 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute.exp	Sat May  1 07:25:07 2021
@@ -1,2 +1 @@
-gcc_attribute.c(23): error: syntax error 'nonnull' [249]
-gcc_attribute.c(27): error: syntax error 'unknown_attribute' [249]
+gcc_attribute.c(31): error: syntax error 'unknown_attribute' [249]

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.223 src/usr.bin/xlint/lint1/cgram.y:1.224
--- src/usr.bin/xlint/lint1/cgram.y:1.223	Fri Apr 30 19:46:24 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Sat May  1 07:25:07 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.223 2021/04/30 19:46:24 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.224 2021/05/01 07:25:07 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.223 2021/04/30 19:46:24 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.224 2021/05/01 07:25:07 rillig Exp $");
 #endif
 
 #include 
@@ -563,7 +563,8 @@ type_attribute_spec:
 	| T_AT_SENTINEL T_LPAREN constant_expr T_RPAREN
 	| T_AT_SENTINEL
 	| T_AT_FORMAT_ARG T_LPAREN constant_expr T_RPAREN
-	| T_AT_NONNULL T_LPAREN constant_expr T_RPAREN
+	| T_AT_NONNULL
+	| T_AT_NONNULL T_LPAREN constant_expr_list_opt T_RPAREN
 	| T_AT_NONSTRING
 	| T_AT_MODE T_LPAREN T_NAME T_RPAREN
 	| T_AT_ALIAS T_LPAREN string T_RPAREN
@@ -1844,6 +1845,16 @@ declaration_list:
 	  }
 	;
 
+constant_expr_list_opt:
+	  /* empty */
+	| constant_expr_list
+	;
+
+constant_expr_list:
+	  constant_expr
+	| constant_expr_list T_COMMA constant_expr
+	;
+
 constant_expr:			/* C99 6.6 */
 	  expr%prec T_ASSIGN {
 		  $$ = $1;



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

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 07:13:21 UTC 2021

Modified Files:
src/sys/arch/riscv/conf: Makefile.riscv kern.ldscript

Log Message:
Fixup kernel linking and provide a linker script with standard sections
and symbols


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/conf/Makefile.riscv
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/conf/kern.ldscript

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

Modified files:

Index: src/sys/arch/riscv/conf/Makefile.riscv
diff -u src/sys/arch/riscv/conf/Makefile.riscv:1.6 src/sys/arch/riscv/conf/Makefile.riscv:1.7
--- src/sys/arch/riscv/conf/Makefile.riscv:1.6	Sat Mar 14 16:12:15 2020
+++ src/sys/arch/riscv/conf/Makefile.riscv	Sat May  1 07:13:21 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.riscv,v 1.6 2020/03/14 16:12:15 skrll Exp $
+#	$NetBSD: Makefile.riscv,v 1.7 2021/05/01 07:13:21 skrll Exp $
 
 # Makefile for NetBSD
 #
@@ -74,11 +74,17 @@ TEXTADDR?=		0xFFC0
 TEXTADDR?=		0xC0001000
 .endif
 KERNLDSCRIPT?=		${RISCV}/conf/kern.ldscript
-LINKFORMAT+=		-T ${KERNLDSCRIPT}
 EXTRA_LINKFLAGS=	${LDOPTS} --relax
 LINKFLAGS_NORMAL=	-X
 STRIPFLAGS=		-g -X
 
+# Set the physical load address (aka LMA) to the address that OpenSBI's
+# fw_jump jumps to.  This allows us to load the kernel with the -kernel flag
+# in QEMU without having to embed it inside BBL or OpenSBI's fw_payload first.
+#
+KERNEL_PHYS?=		0x8020
+EXTRA_LINKFLAGS+=	--defsym='KERNEL_PHYS=${KERNEL_PHYS}'
+
 ##
 ## (6) port specific target dependencies
 ##

Index: src/sys/arch/riscv/conf/kern.ldscript
diff -u src/sys/arch/riscv/conf/kern.ldscript:1.7 src/sys/arch/riscv/conf/kern.ldscript:1.8
--- src/sys/arch/riscv/conf/kern.ldscript:1.7	Wed Nov  4 07:09:45 2020
+++ src/sys/arch/riscv/conf/kern.ldscript	Sat May  1 07:13:21 2021
@@ -1,4 +1,6 @@
-/*	$NetBSD: kern.ldscript,v 1.7 2020/11/04 07:09:45 skrll Exp $	*/
+/*	$NetBSD: kern.ldscript,v 1.8 2021/05/01 07:13:21 skrll Exp $	*/
+
+#include "assym.h"
 
 OUTPUT_ARCH(riscv)
 ENTRY(start)
@@ -8,8 +10,10 @@ __LARGE_PAGE_SIZE = 0x20 ;
 
 SECTIONS
 {
-	.text : AT (ADDR(.text) & 0x0fff)
+
+	.text : AT (KERNEL_PHYS)
 	{
+		PROVIDE(__kernel_text = .);
 		*(.text)
 		*(.text.*)
 		*(.stub)
@@ -19,7 +23,7 @@ SECTIONS
 
 	. = ALIGN(__LARGE_PAGE_SIZE);
 
-	__rodata_start = . ;
+	PROVIDE(__rodata_start = .);
 	.rodata :
 	{
 		*(.rodata)
@@ -28,17 +32,36 @@ SECTIONS
 		*(.srodata.*)
 	}
 
+	PROVIDE(_etext = .);
+	PROVIDE(etext = .);
 	. = ALIGN(__LARGE_PAGE_SIZE);
 
-	__data_start = . ;
 	.data :
 	{
+		PROVIDE(__data_start = .);
 		*(.data)
+	}
+
+	. = ALIGN(COHERENCY_UNIT);
+	.data.cacheline_aligned :
+	{
+		*(.data.cacheline_aligned)
+	}
+	. = ALIGN(COHERENCY_UNIT);
+	.data.read_mostly :
+	{
+		*(.data.read_mostly)
+	}
+	. = ALIGN(COHERENCY_UNIT);
+
+	.sdata :
+	{
+		__global_pointer$ = . + 0x800;
 		*(.sdata)
 		*(.sdata.*)
 	}
-	_edata = . ;
-	PROVIDE (edata = .) ;
+	_edata = .;
+	PROVIDE (edata = .);
 
 	__bss_start = .;
 	.bss :
@@ -50,14 +73,13 @@ SECTIONS
 		*(COMMON)
 		. = ALIGN(__LARGE_PAGE_SIZE);
 	}
-
+	_bss_end__ = . ;
+	__bss_end__ = . ;
 	. = ALIGN(__PAGE_SIZE);
 
-	/* End of the kernel image */
-	__kernel_end = . ;
-
-	_end = . ;
-	PROVIDE (end = .) ;
+	__end__ = . ;
+	_end = .;
+	PROVIDE(end = .);
 	.note.netbsd.ident :
 	{
 		KEEP(*(.note.netbsd.ident));



CVS commit: src/sys/arch/riscv/riscv

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 07:11:12 UTC 2021

Modified Files:
src/sys/arch/riscv/riscv: autoconf.c

Log Message:
Enable interrupts at the end of cpu_configure


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

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

Modified files:

Index: src/sys/arch/riscv/riscv/autoconf.c
diff -u src/sys/arch/riscv/riscv/autoconf.c:1.2 src/sys/arch/riscv/riscv/autoconf.c:1.3
--- src/sys/arch/riscv/riscv/autoconf.c:1.2	Wed Nov  4 07:09:46 2020
+++ src/sys/arch/riscv/riscv/autoconf.c	Sat May  1 07:11:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.2 2020/11/04 07:09:46 skrll Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.3 2021/05/01 07:11:12 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__RCSID("$NetBSD: autoconf.c,v 1.2 2020/11/04 07:09:46 skrll Exp $");
+__RCSID("$NetBSD: autoconf.c,v 1.3 2021/05/01 07:11:12 skrll Exp $");
 
 #include 
 #include 
@@ -47,6 +47,8 @@ cpu_configure(void)
 
 	if (config_rootfound("mainbus", NULL) == NULL)
 		panic("no mainbus found");
+
+	spl0();
 }
 
 void



CVS commit: src/sys/arch/riscv/riscv

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 07:10:34 UTC 2021

Modified Files:
src/sys/arch/riscv/riscv: locore.S

Log Message:
Quick hack to make this link


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/riscv/riscv/locore.S

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

Modified files:

Index: src/sys/arch/riscv/riscv/locore.S
diff -u src/sys/arch/riscv/riscv/locore.S:1.20 src/sys/arch/riscv/riscv/locore.S:1.21
--- src/sys/arch/riscv/riscv/locore.S:1.20	Sun Nov  8 10:08:28 2020
+++ src/sys/arch/riscv/riscv/locore.S	Sat May  1 07:10:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.20 2020/11/08 10:08:28 skrll Exp $ */
+/* $NetBSD: locore.S,v 1.21 2021/05/01 07:10:34 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -120,8 +120,7 @@ ENTRY_NP(start)
 #endif
 
 	// We should have a VM so let's start using our real addresses
-	lui	t0, %hi(.Lmmu_on)	// load hi part of absolute address
-	jr	t0, %lo(.Lmmu_on)	// jump to absolute address
+	PTR_LA	t0, .Lmmu_on
 
 .Lmmu_on:
 	// MMU is on!



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

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 07:09:55 UTC 2021

Modified Files:
src/sys/arch/riscv/include: sysreg.h

Log Message:
Provide riscvreg_satp_{read,write}


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/riscv/include/sysreg.h

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

Modified files:

Index: src/sys/arch/riscv/include/sysreg.h
diff -u src/sys/arch/riscv/include/sysreg.h:1.12 src/sys/arch/riscv/include/sysreg.h:1.13
--- src/sys/arch/riscv/include/sysreg.h:1.12	Sat May  1 07:09:04 2021
+++ src/sys/arch/riscv/include/sysreg.h	Sat May  1 07:09:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sysreg.h,v 1.12 2021/05/01 07:09:04 skrll Exp $ */
+/* $NetBSD: sysreg.h,v 1.13 2021/05/01 07:09:55 skrll Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,6 +36,8 @@
 #include 
 #endif
 
+#include 
+
 #define FCSR_FMASK	0	// no exception bits
 #define FCSR_FRM	__BITS(7,5)
 #define  FCSR_FRM_RNE	0b000	// Round Nearest, ties to Even
@@ -262,6 +264,20 @@ riscvreg_cycle_read(void)
 #define SATP_PPN		__BITS(21,0)
 #endif
 
+static inline uintptr_t
+riscvreg_satp_read(void)
+{
+	uintptr_t satp;
+	__asm __volatile("csrr	%0, satp" : "=r" (satp));
+	return satp;
+}
+
+static inline void
+riscvreg_satp_write(uintptr_t satp)
+{
+	__asm __volatile("csrw	satp, %0" :: "r" (satp));
+}
+
 static inline uint32_t
 riscvreg_asid_read(void)
 {



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

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 07:09:04 UTC 2021

Modified Files:
src/sys/arch/riscv/include: sysreg.h

Log Message:
Indent the FCSR_FRM value #defines


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/riscv/include/sysreg.h

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

Modified files:

Index: src/sys/arch/riscv/include/sysreg.h
diff -u src/sys/arch/riscv/include/sysreg.h:1.11 src/sys/arch/riscv/include/sysreg.h:1.12
--- src/sys/arch/riscv/include/sysreg.h:1.11	Wed Dec 16 19:49:04 2020
+++ src/sys/arch/riscv/include/sysreg.h	Sat May  1 07:09:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sysreg.h,v 1.11 2020/12/16 19:49:04 christos Exp $ */
+/* $NetBSD: sysreg.h,v 1.12 2021/05/01 07:09:04 skrll Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -38,12 +38,12 @@
 
 #define FCSR_FMASK	0	// no exception bits
 #define FCSR_FRM	__BITS(7,5)
-#define FCSR_FRM_RNE	0b000	// Round Nearest, ties to Even
-#define FCSR_FRM_RTZ	0b001	// Round Towards Zero
-#define FCSR_FRM_RDN	0b010	// Round DowN (-infinity)
-#define FCSR_FRM_RUP	0b011	// Round UP (+infinity)
-#define FCSR_FRM_RMM	0b100	// Round to nearest, ties to Max Magnitude
-#define FCSR_FRM_DYN	0b111	// Dynamic rounding
+#define  FCSR_FRM_RNE	0b000	// Round Nearest, ties to Even
+#define  FCSR_FRM_RTZ	0b001	// Round Towards Zero
+#define  FCSR_FRM_RDN	0b010	// Round DowN (-infinity)
+#define  FCSR_FRM_RUP	0b011	// Round UP (+infinity)
+#define  FCSR_FRM_RMM	0b100	// Round to nearest, ties to Max Magnitude
+#define  FCSR_FRM_DYN	0b111	// Dynamic rounding
 #define FCSR_FFLAGS	__BITS(4,0)	// Sticky bits
 #define FCSR_NV		__BIT(4)	// iNValid operation
 #define FCSR_DZ		__BIT(3)	// Divide by Zero



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

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 07:06:54 UTC 2021

Modified Files:
src/sys/arch/riscv/include: param.h

Log Message:
Bump MSGBUFSIZE (if not defined)

Provide COHERENCY_UNIT and CACHE_LINE_SIZE

Also provide MAXCPUS


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/include/param.h

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

Modified files:

Index: src/sys/arch/riscv/include/param.h
diff -u src/sys/arch/riscv/include/param.h:1.3 src/sys/arch/riscv/include/param.h:1.4
--- src/sys/arch/riscv/include/param.h:1.3	Sat Jun  1 12:42:28 2019
+++ src/sys/arch/riscv/include/param.h	Sat May  1 07:06:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.3 2019/06/01 12:42:28 maxv Exp $ */
+/* $NetBSD: param.h,v 1.4 2021/05/01 07:06:54 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -88,6 +88,15 @@
 
 #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
 
+#ifndef MSGBUFSIZE
+#define MSGBUFSIZE		65536	/* default message buffer size */
+#endif
+
+#define COHERENCY_UNIT		64
+#define CACHE_LINE_SIZE		64
+
+#define MAXCPUS			32
+
 #ifdef _KERNEL
 void delay(unsigned long);
 #define	DELAY(x)	delay(x)



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

2021-05-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  1 07:05:07 UTC 2021

Modified Files:
src/sys/arch/riscv/include: asm.h

Log Message:
Provide __CONCAT, __STRING and ___CONCAT


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/include/asm.h

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

Modified files:

Index: src/sys/arch/riscv/include/asm.h
diff -u src/sys/arch/riscv/include/asm.h:1.5 src/sys/arch/riscv/include/asm.h:1.6
--- src/sys/arch/riscv/include/asm.h:1.5	Fri Apr 17 14:19:44 2020
+++ src/sys/arch/riscv/include/asm.h	Sat May  1 07:05:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.5 2020/04/17 14:19:44 joerg Exp $	*/
+/*	$NetBSD: asm.h,v 1.6 2021/05/01 07:05:07 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,6 +34,11 @@
 
 #define	_C_LABEL(x)	x
 
+#define	__CONCAT(x,y)	x ## y
+#define	__STRING(x)	#x
+
+#define	___CONCAT(x,y)	__CONCAT(x,y)
+
 /*
  * Define -pg profile entry code.
  * Must always be noreorder, must never use a macro instruction