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

2021-07-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Jul 28 08:01:10 UTC 2021

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_op_asm.h

Log Message:
#define consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/arch/arm/atomic/atomic_op_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/common/lib/libc/arch/arm/atomic/atomic_op_asm.h
diff -u src/common/lib/libc/arch/arm/atomic/atomic_op_asm.h:1.9 src/common/lib/libc/arch/arm/atomic/atomic_op_asm.h:1.10
--- src/common/lib/libc/arch/arm/atomic/atomic_op_asm.h:1.9	Wed Jul 28 07:32:20 2021
+++ src/common/lib/libc/arch/arm/atomic/atomic_op_asm.h	Wed Jul 28 08:01:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_op_asm.h,v 1.9 2021/07/28 07:32:20 skrll Exp $	*/
+/*	$NetBSD: atomic_op_asm.h,v 1.10 2021/07/28 08:01:10 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -75,11 +75,11 @@
 #endif
 
 #ifdef _ARM_ARCH_7
-#define DMB	dmb	ish
+#define	DMB	dmb	ish
 #define	DMBST	dmb	ishst
 #else
-#define DMB	mcr	p15, 0, r0, c7, c10, 5	/* Data Memory Barrier */
-#define DMBST	DMB
+#define	DMB	mcr	p15, 0, r0, c7, c10, 5	/* Data Memory Barrier */
+#define	DMBST	DMB
 #endif
 
 #endif /* _ATOMIC_OP_ASM_H_ */



CVS commit: src

2021-07-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 25 08:52:03 UTC 2021

Modified Files:
src/lib/libc/stdio: mktemp.3
src/usr.bin/mktemp: mktemp.1

Log Message:
Update to reflect current reality for template characters - the process
ID is not longer used and we replace each "X" with one of 64 values not
26 values.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/stdio/mktemp.3
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mktemp/mktemp.1

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

Modified files:

Index: src/lib/libc/stdio/mktemp.3
diff -u src/lib/libc/stdio/mktemp.3:1.30 src/lib/libc/stdio/mktemp.3:1.31
--- src/lib/libc/stdio/mktemp.3:1.30	Thu Jun 19 09:30:33 2014
+++ src/lib/libc/stdio/mktemp.3	Sun Jul 25 08:52:03 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mktemp.3,v 1.30 2014/06/19 09:30:33 wiz Exp $
+.\"	$NetBSD: mktemp.3,v 1.31 2021/07/25 08:52:03 simonb Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)mktemp.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd June 18, 2014
+.Dd July 25, 2021
 .Dt MKTEMP 3
 .Os
 .Sh NAME
@@ -67,33 +67,26 @@ This file name is unique and suitable fo
 by the application.
 The template may be any file name with some number of
 .So Li X
-.Sc Ns s
-appended
-to it, for example
+characters appended to it, for example
 .Pa /tmp/temp.XX .
 The trailing
 .So Li X
-.Sc Ns s
-are replaced with the current process number and/or a
-unique letter combination.
-The number of unique file names
+characters in the template are replaced with a unique letter and number
+combination.
 .Fn mktemp
 can return depends on the number of
 .So Li X
-.Sc Ns s
-provided.
+characters provided.
 Although the
 .Nx
 implementation of the functions will accept any number of trailing
 .So Li X
-.Sc Ns s ,
-for portability reasons one should use only six.
+characters, for portability reasons one should use only six.
 Using six
 .So Li X
-.Sc Ns s
-will result in
+characters will result in
 .Fn mktemp
-testing roughly 26 ** 6 (308915776) combinations.
+testing roughly 62 ** 6 (56800235584) combinations.
 .Pp
 The
 .Fn mkstemp

Index: src/usr.bin/mktemp/mktemp.1
diff -u src/usr.bin/mktemp/mktemp.1:1.23 src/usr.bin/mktemp/mktemp.1:1.24
--- src/usr.bin/mktemp/mktemp.1:1.23	Mon Jul  3 21:34:20 2017
+++ src/usr.bin/mktemp/mktemp.1	Sun Jul 25 08:52:03 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: mktemp.1,v 1.23 2017/07/03 21:34:20 wiz Exp $
+.\" $NetBSD: mktemp.1,v 1.24 2021/07/25 08:52:03 simonb Exp $
 .\" From: $FreeBSD: src/usr.bin/mktemp/mktemp.1,v 1.5 1999/08/28 01:04:13 peter Exp $
 .\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $
 .\"
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD: src/usr.bin/mktemp/mktemp.1,v 1.5 1999/08/28 01:04:13 peter Exp $
 .\"
-.Dd November 4, 2012
+.Dd July 25, 2021
 .Dt MKTEMP 1
 .Os
 .Sh NAME
@@ -61,8 +61,8 @@ characters, such as
 .Pa /tmp/prefix. .
 The trailing
 .Ql X
-characters in the template are replaced by unique values derived from
-the current process number and additional letters or numbers.
+characters in the template are replaced with a unique letter and number
+combination.
 Any
 .Ql X
 characters other than at the end of the template are taken literally.
@@ -74,7 +74,7 @@ in the template; six
 .Ql X Ns s
 will result in
 .Nm
-testing roughly 26 ** 6 combinations.
+testing roughly 62 ** 6 (56800235584) combinations.
 .Pp
 The templates used to create the unique names are derived from the
 .Fl t Ar prefix



CVS commit: src/sys/kern

2021-07-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 25 06:06:40 UTC 2021

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

Log Message:
If we're only doing a count-only kern.buf sysctl, just return the number
of active members in the pool cache (plus some slop) instead of looking
in all the free buffer list.  Should reduce CPU usage for "systat vm"
to << 1% especially for machines with a larger number of buffers.


To generate a diff of this commit:
cvs rdiff -u -r1.300 -r1.301 src/sys/kern/vfs_bio.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.300 src/sys/kern/vfs_bio.c:1.301
--- src/sys/kern/vfs_bio.c:1.300	Sat Jul 24 13:28:14 2021
+++ src/sys/kern/vfs_bio.c	Sun Jul 25 06:06:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.300 2021/07/24 13:28:14 simonb Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.301 2021/07/25 06:06:40 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.300 2021/07/24 13:28:14 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.301 2021/07/25 06:06:40 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1804,6 +1804,14 @@ sysctl_dobuf(SYSCTLFN_ARGS)
 	elem_size < 1 || elem_count < 0)
 		return (EINVAL);
 
+	if (oldp == NULL) {
+		/* count only, don't run through the buffer queues */
+		needed = pool_cache_nget(buf_cache) - pool_cache_nput(buf_cache);
+		*oldlenp = (needed + KERN_BUFSLOP) * elem_size;
+
+		return 0;
+	}
+
 	error = 0;
 	needed = 0;
 	sysctl_unlock();
@@ -1848,8 +1856,6 @@ sysctl_dobuf(SYSCTLFN_ARGS)
 	sysctl_relock();
 
 	*oldlenp = needed;
-	if (oldp == NULL)
-		*oldlenp += KERN_BUFSLOP * elem_size;
 
 	return (error);
 }



CVS commit: src/sys

2021-07-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jul 25 06:00:32 UTC 2021

Modified Files:
src/sys/kern: subr_pool.c
src/sys/sys: pool.h

Log Message:
Add accessor functions to get the number of gets and puts on pools and
pool caches.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.93 -r1.94 src/sys/sys/pool.h

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

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.276 src/sys/kern/subr_pool.c:1.277
--- src/sys/kern/subr_pool.c:1.276	Wed Feb 24 05:36:02 2021
+++ src/sys/kern/subr_pool.c	Sun Jul 25 06:00:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.276 2021/02/24 05:36:02 mrg Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.277 2021/07/25 06:00:31 simonb Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.276 2021/02/24 05:36:02 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.277 2021/07/25 06:00:31 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1609,6 +1609,20 @@ pool_sethardlimit(struct pool *pp, int n
 	mutex_exit(>pr_lock);
 }
 
+unsigned int
+pool_nget(struct pool *pp)
+{
+
+	return pp->pr_nget;
+}
+
+unsigned int
+pool_nput(struct pool *pp)
+{
+
+	return pp->pr_nput;
+}
+
 /*
  * Release all complete pages that have not been used recently.
  *
@@ -2459,6 +2473,20 @@ pool_cache_prime(pool_cache_t pc, int n)
 	pool_prime(>pc_pool, n);
 }
 
+unsigned int
+pool_cache_nget(pool_cache_t pc)
+{
+
+	return pool_nget(>pc_pool);
+}
+
+unsigned int
+pool_cache_nput(pool_cache_t pc)
+{
+
+	return pool_nput(>pc_pool);
+}
+
 /*
  * pool_pcg_get:
  *

Index: src/sys/sys/pool.h
diff -u src/sys/sys/pool.h:1.93 src/sys/sys/pool.h:1.94
--- src/sys/sys/pool.h:1.93	Wed Feb 24 06:11:38 2021
+++ src/sys/sys/pool.h	Sun Jul 25 06:00:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pool.h,v 1.93 2021/02/24 06:11:38 simonb Exp $	*/
+/*	$NetBSD: pool.h,v 1.94 2021/07/25 06:00:31 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2007, 2020
@@ -319,6 +319,9 @@ bool		pool_drain(struct pool **);
 int		pool_totalpages(void);
 int		pool_totalpages_locked(void);
 
+unsigned int	pool_nget(struct pool *);
+unsigned int	pool_nput(struct pool *);
+
 /*
  * Debugging and diagnostic aides.
  */
@@ -353,6 +356,9 @@ void		pool_cache_sethardlimit(pool_cache
 void		pool_cache_prime(pool_cache_t, int);
 void		pool_cache_cpu_init(struct cpu_info *);
 
+unsigned int	pool_cache_nget(pool_cache_t);
+unsigned int	pool_cache_nput(pool_cache_t);
+
 #define		pool_cache_get(pc, f) pool_cache_get_paddr((pc), (f), NULL)
 #define		pool_cache_put(pc, o) pool_cache_put_paddr((pc), (o), \
   POOL_PADDR_INVALID)



CVS commit: src/usr.bin/systat

2021-07-24 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jul 24 13:42:05 UTC 2021

Modified Files:
src/usr.bin/systat: vmstat.c

Log Message:
Instead of getting an estimate of the number of kernel buffers,
allocating memory for them, requesting all the metadata contents of
these buffers (and repeating in the unlikely case of the number of
buffers increasing too much since the estimate) and then straight away
throwing all the contents out just to count how many buffers there were,
just get the initial estimate from the kernel and subtract the slop.

Reduces system CPU usage of "systat vm" by approx 80% for any system
with a reasonable number of buffers.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/usr.bin/systat/vmstat.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/systat/vmstat.c
diff -u src/usr.bin/systat/vmstat.c:1.88 src/usr.bin/systat/vmstat.c:1.89
--- src/usr.bin/systat/vmstat.c:1.88	Mon Mar  2 09:50:12 2020
+++ src/usr.bin/systat/vmstat.c	Sat Jul 24 13:42:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmstat.c,v 1.88 2020/03/02 09:50:12 mrg Exp $	*/
+/*	$NetBSD: vmstat.c,v 1.89 2021/07/24 13:42:05 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1983, 1989, 1992, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 1/12/94";
 #endif
-__RCSID("$NetBSD: vmstat.c,v 1.88 2020/03/02 09:50:12 mrg Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.89 2021/07/24 13:42:05 simonb Exp $");
 #endif /* not lint */
 
 /*
@@ -481,10 +481,8 @@ showvmstat(void)
 	static int relabel = 0;
 	static int last_disks = 0;
 	static u_long bufmem;
-	struct buf_sysctl *buffers;
 	int mib[6];
 	size_t size;
-	int extraslop = 0;
 
 	if (relabel) {
 		labelvmstat();
@@ -528,14 +526,12 @@ showvmstat(void)
 
 	/* Get number of metadata buffers */
 	size = 0;
-	buffers = NULL;
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_BUF;
 	mib[2] = KERN_BUF_ALL;
 	mib[3] = KERN_BUF_ALL;
 	mib[4] = (int)sizeof(struct buf_sysctl);
 	mib[5] = INT_MAX; /* we want them all */
-again:
 	if (sysctl(mib, 6, NULL, , NULL, 0) < 0) {
 		error("can't get buffers size: %s\n", strerror(errno));
 		return;
@@ -544,23 +540,8 @@ again:
 		error("buffers size is zero: %s\n", strerror(errno));
 		return;
 	}
-	size += extraslop * sizeof(struct buf_sysctl);
-	buffers = malloc(size);
-	if (buffers == NULL) {
-		error("can't allocate buffers: %s\n", strerror(errno));
-		return;
-	}
-	if (sysctl(mib, 6, buffers, , NULL, 0) < 0) {
-		free(buffers);
-		if (extraslop < 1000) {
-			extraslop += 100;
-			goto again;
-		}
-		error("can't get buffers: %s\n", strerror(errno));
-		return;
-	}
-	free(buffers);			/* XXX there must be a better way! */
 	nbuf = size / sizeof(struct buf_sysctl);
+	nbuf -= KERN_BUFSLOP;
 
 	putint((int) (bufmem / 1024),		MEMROW + 3, MEMCOL + 5, 12);
 	putint((int) ((bufmem * 100) + 0.5) / s.uvmexp.pagesize / s.uvmexp.npages,



CVS commit: src/sys

2021-07-24 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jul 24 13:28:14 UTC 2021

Modified Files:
src/sys/kern: vfs_bio.c
src/sys/sys: sysctl.h

Log Message:
Expose KERN_BUFSLOP in .


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/kern/vfs_bio.c
cvs rdiff -u -r1.233 -r1.234 src/sys/sys/sysctl.h

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.299 src/sys/kern/vfs_bio.c:1.300
--- src/sys/kern/vfs_bio.c:1.299	Sat Jul 24 13:27:39 2021
+++ src/sys/kern/vfs_bio.c	Sat Jul 24 13:28:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.299 2021/07/24 13:27:39 simonb Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.300 2021/07/24 13:28:14 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.299 2021/07/24 13:27:39 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.300 2021/07/24 13:28:14 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1765,7 +1765,6 @@ sysctl_fillbuf(const buf_t *i, struct bu
 	o->b_lblkno = i->b_lblkno;
 }
 
-#define KERN_BUFSLOP 20
 static int
 sysctl_dobuf(SYSCTLFN_ARGS)
 {

Index: src/sys/sys/sysctl.h
diff -u src/sys/sys/sysctl.h:1.233 src/sys/sys/sysctl.h:1.234
--- src/sys/sys/sysctl.h:1.233	Tue Apr 13 01:10:24 2021
+++ src/sys/sys/sysctl.h	Sat Jul 24 13:28:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.h,v 1.233 2021/04/13 01:10:24 mrg Exp $	*/
+/*	$NetBSD: sysctl.h,v 1.234 2021/07/24 13:28:14 simonb Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -662,6 +662,8 @@ struct buf_sysctl {
 	uint64_t b_lblkno;	/* DADDR_T: Logical block number */
 };
 
+#define	KERN_BUFSLOP	20
+
 /*
  * kern.file2 returns an array of these structures, which are designed
  * both to be immune to 32/64 bit emulation issues and to



CVS commit: src/sys/kern

2021-07-24 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jul 24 13:27:39 UTC 2021

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

Log Message:
Pad out the slop for kern.buf based on the passed in element size,
rather than a size of an unrelated struct.


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/sys/kern/vfs_bio.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.298 src/sys/kern/vfs_bio.c:1.299
--- src/sys/kern/vfs_bio.c:1.298	Thu Apr  1 06:25:59 2021
+++ src/sys/kern/vfs_bio.c	Sat Jul 24 13:27:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.298 2021/04/01 06:25:59 simonb Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.299 2021/07/24 13:27:39 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.298 2021/04/01 06:25:59 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.299 2021/07/24 13:27:39 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1850,7 +1850,7 @@ sysctl_dobuf(SYSCTLFN_ARGS)
 
 	*oldlenp = needed;
 	if (oldp == NULL)
-		*oldlenp += KERN_BUFSLOP * sizeof(buf_t);
+		*oldlenp += KERN_BUFSLOP * elem_size;
 
 	return (error);
 }



CVS commit: src/usr.bin/gzip

2021-06-24 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jun 24 07:16:49 UTC 2021

Modified Files:
src/usr.bin/gzip: gzip.c

Log Message:
Call check_siginfo() in compression loop to provide SIGINFO compression
progress.
Suggested by mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/gzip/gzip.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/gzip/gzip.c
diff -u src/usr.bin/gzip/gzip.c:1.116 src/usr.bin/gzip/gzip.c:1.117
--- src/usr.bin/gzip/gzip.c:1.116	Sat Oct 27 11:39:12 2018
+++ src/usr.bin/gzip/gzip.c	Thu Jun 24 07:16:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gzip.c,v 1.116 2018/10/27 11:39:12 skrll Exp $	*/
+/*	$NetBSD: gzip.c,v 1.117 2021/06/24 07:16:49 simonb Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\
  2009, 2010, 2011, 2015, 2017 Matthew R. Green.  All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.116 2018/10/27 11:39:12 skrll Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.117 2021/06/24 07:16:49 simonb Exp $");
 #endif /* not lint */
 
 /*
@@ -622,6 +622,7 @@ gz_compress(int in, int out, off_t *gsiz
 
 	crc = crc32(0L, Z_NULL, 0);
 	for (;;) {
+		check_siginfo();
 		if (z.avail_out == 0) {
 			if (write_retry(out, outbufp, BUFLEN) != BUFLEN) {
 maybe_warn("write");



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

2021-06-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Jun 23 15:11:40 UTC 2021

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

Log Message:
Remove an unused #define.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/mips/include/vmparam.h

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

Modified files:

Index: src/sys/arch/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.65 src/sys/arch/mips/include/vmparam.h:1.66
--- src/sys/arch/mips/include/vmparam.h:1.65	Fri Feb 26 02:18:29 2021
+++ src/sys/arch/mips/include/vmparam.h	Wed Jun 23 15:11:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.65 2021/02/26 02:18:29 simonb Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.66 2021/06/23 15:11:40 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -198,7 +198,6 @@
 
 /* VM_PHYSSEG_MAX defined by platform-dependent code. */
 #define	VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
-#define	VM_PHYSSEG_NOADD	/* can add RAM after vm_mem_init */
 
 #ifndef VM_NFREELIST
 #define	VM_NFREELIST		16	/* 16 distinct memory segments */



CVS commit: src/sys/kern

2021-06-13 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Jun 13 14:58:50 UTC 2021

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

Log Message:
Return ENOENT if the hashstat sysctl was called to query a specific hash
name and that hash name doesn't exist.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/subr_hash.c

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

Modified files:

Index: src/sys/kern/subr_hash.c
diff -u src/sys/kern/subr_hash.c:1.11 src/sys/kern/subr_hash.c:1.12
--- src/sys/kern/subr_hash.c:1.11	Sun Jun 13 14:02:46 2021
+++ src/sys/kern/subr_hash.c	Sun Jun 13 14:58:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_hash.c,v 1.11 2021/06/13 14:02:46 christos Exp $	*/
+/*	$NetBSD: subr_hash.c,v 1.12 2021/06/13 14:58:49 simonb Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.11 2021/06/13 14:02:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.12 2021/06/13 14:58:49 simonb Exp $");
 
 #include 
 #include 
@@ -243,6 +243,9 @@ hashstat_sysctl(SYSCTLFN_ARGS)
 	rw_exit(_lock);
 	sysctl_relock();
 
+	if (query && written == 0)	/* query not found? */
+		error = ENOENT;
+
 	*oldlenp = written;
 	return error;
 }



CVS commit: src/sbin/mount

2021-06-04 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Jun  4 11:55:45 UTC 2021

Modified Files:
src/sbin/mount: mount.8 mount.c

Log Message:
Remove the warning about autoselecting nfs based on : or @.

Ok jmcneill@, mrg@.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sbin/mount/mount.8
cvs rdiff -u -r1.103 -r1.104 src/sbin/mount/mount.c

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

Modified files:

Index: src/sbin/mount/mount.8
diff -u src/sbin/mount/mount.8:1.88 src/sbin/mount/mount.8:1.89
--- src/sbin/mount/mount.8:1.88	Sat Oct 24 10:51:34 2020
+++ src/sbin/mount/mount.8	Fri Jun  4 11:55:45 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mount.8,v 1.88 2020/10/24 10:51:34 nia Exp $
+.\"	$NetBSD: mount.8,v 1.89 2021/06/04 11:55:45 simonb Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)mount.8	8.8 (Berkeley) 6/16/94
 .\"
-.Dd October 24, 2020
+.Dd June 4, 2021
 .Dt MOUNT 8
 .Os
 .Sh NAME
@@ -137,10 +137,7 @@ or at sign
 .Pq Ql \&@ ,
 then the
 .Li nfs
-type is inferred, but this behaviour is deprecated, and will be
-removed in a future version of
-.Nm .
-.Pp
+type is inferred.
 In
 .Nx ,
 the file-system mounting policy is dictated by the running security models.

Index: src/sbin/mount/mount.c
diff -u src/sbin/mount/mount.c:1.103 src/sbin/mount/mount.c:1.104
--- src/sbin/mount/mount.c:1.103	Sun Oct 18 10:57:30 2020
+++ src/sbin/mount/mount.c	Fri Jun  4 11:55:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mount.c,v 1.103 2020/10/18 10:57:30 mlelstv Exp $	*/
+/*	$NetBSD: mount.c,v 1.104 2021/06/04 11:55:45 simonb Exp $	*/
 
 /*
  * Copyright (c) 1980, 1989, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)mount.c	8.25 (Berkeley) 5/8/95";
 #else
-__RCSID("$NetBSD: mount.c,v 1.103 2020/10/18 10:57:30 mlelstv Exp $");
+__RCSID("$NetBSD: mount.c,v 1.104 2021/06/04 11:55:45 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -294,11 +294,6 @@ out:
 			err(EXIT_FAILURE, "%s", buf);
 		if (vfslist == NULL) {
 			if (strpbrk(argv[0], ":@") != NULL) {
-fprintf(stderr, "WARNING: autoselecting nfs "
-"based on : or @ in the device name is "
-"deprecated!\n"
-"WARNING: This behaviour will be removed "
-"in a future release\n");
 vfstype = "nfs";
 			} else {
 vfstype = getfslab(mntfromname);



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

2021-06-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Jun  2 00:00:39 UTC 2021

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

Log Message:
s/leading spaces/tabs/


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/sys/arch/mips/mips/mips_machdep.c

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

Modified files:

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.301 src/sys/arch/mips/mips/mips_machdep.c:1.302
--- src/sys/arch/mips/mips/mips_machdep.c:1.301	Tue Mar 23 13:22:40 2021
+++ src/sys/arch/mips/mips/mips_machdep.c	Wed Jun  2 00:00:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.301 2021/03/23 13:22:40 simonb Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.302 2021/06/02 00:00:39 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.301 2021/03/23 13:22:40 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.302 2021/06/02 00:00:39 simonb Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -1785,9 +1785,9 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 		   CTL_MACHDEP, CPU_ROOT_DEVICE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
-   CTLTYPE_INT, "llsc", NULL,
-   NULL, MIPS_HAS_LLSC, NULL, 0,
-   CTL_MACHDEP, CPU_LLSC, CTL_EOL);
+		   CTLTYPE_INT, "llsc", NULL,
+		   NULL, MIPS_HAS_LLSC, NULL, 0,
+		   CTL_MACHDEP, CPU_LLSC, CTL_EOL);
 #ifdef MIPS3_LOONGSON2
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
@@ -1797,8 +1797,8 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 #endif
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
-   CTLTYPE_INT, "fpu_present", NULL,
-   NULL,
+		   CTLTYPE_INT, "fpu_present", NULL,
+		   NULL,
 #ifdef NOFPU
 		   0,
 #else



CVS commit: src/sys/arch

2021-05-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May 31 14:38:57 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: param.h
src/sys/arch/alpha/include: param.h
src/sys/arch/cats/include: param.h
src/sys/arch/hppa/include: param.h
src/sys/arch/i386/include: param.h
src/sys/arch/ia64/include: param.h
src/sys/arch/m68k/include: param.h
src/sys/arch/macppc/include: param.h
src/sys/arch/mips/include: mips_param.h
src/sys/arch/powerpc/include: param.h
src/sys/arch/powerpc/include/ibm4xx: cpu.h
src/sys/arch/riscv/include: param.h
src/sys/arch/sgimips/include: param.h
src/sys/arch/sh3/include: param.h
src/sys/arch/sparc64/include: param.h
src/sys/arch/sun2/include: param.h
src/sys/arch/sun3/include: param.h
src/sys/arch/vax/include: param.h
src/sys/arch/x68k/include: param.h

Log Message:
Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include .


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/include/param.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/cats/include/param.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/hppa/include/param.h
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/i386/include/param.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/include/param.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/include/param.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/macppc/include/param.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/include/param.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/include/ibm4xx/cpu.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/include/param.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sgimips/include/param.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sh3/include/param.h
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sparc64/include/param.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sun2/include/param.h
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sun3/include/param.h
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/vax/include/param.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x68k/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/aarch64/include/param.h
diff -u src/sys/arch/aarch64/include/param.h:1.15 src/sys/arch/aarch64/include/param.h:1.16
--- src/sys/arch/aarch64/include/param.h:1.15	Sun Jan 24 12:51:32 2021
+++ src/sys/arch/aarch64/include/param.h	Mon May 31 14:38:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.15 2021/01/24 12:51:32 jmcneill Exp $ */
+/* $NetBSD: param.h,v 1.16 2021/05/31 14:38:57 simonb Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_cputypes.h"
+#include "opt_param.h"
 #endif
 
 /*

Index: src/sys/arch/alpha/include/param.h
diff -u src/sys/arch/alpha/include/param.h:1.47 src/sys/arch/alpha/include/param.h:1.48
--- src/sys/arch/alpha/include/param.h:1.47	Sat Oct 10 21:59:03 2020
+++ src/sys/arch/alpha/include/param.h	Mon May 31 14:38:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.47 2020/10/10 21:59:03 thorpej Exp $ */
+/* $NetBSD: param.h,v 1.48 2021/05/31 14:38:55 simonb Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -38,6 +38,10 @@
  *	@(#)param.h	8.1 (Berkeley) 6/10/93
  */
 
+#ifdef _KERNEL_OPT
+#include "opt_param.h"
+#endif
+
 /*
  * Machine dependent constants for the Alpha.
  */

Index: src/sys/arch/cats/include/param.h
diff -u src/sys/arch/cats/include/param.h:1.8 src/sys/arch/cats/include/param.h:1.9
--- src/sys/arch/cats/include/param.h:1.8	Wed Dec  1 06:47:16 2010
+++ src/sys/arch/cats/include/param.h	Mon May 31 14:38:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.8 2010/12/01 06:47:16 skrll Exp $	*/
+/*	$NetBSD: param.h,v 1.9 2021/05/31 14:38:55 simonb Exp $	*/
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe.
@@ -35,6 +35,10 @@
 #ifndef	_CATS_PARAM_H_
 #define	_CATS_PARAM_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_param.h"
+#endif
+
 /*
  * Machine dependent constants for ARM6+ processors
  */

Index: src/sys/arch/hppa/include/param.h
diff -u src/sys/arch/hppa/include/param.h:1.28 src/sys/arch/hppa/include/param.h:1.29
--- src/sys/arch/hppa/include/param.h:1.28	Sat May  8 13:10:29 2021
+++ src/sys/arch/hppa/include/param.h	Mon May 31 14:38:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.28 2021/05/08 13:10:29 skrll Exp $	*/
+/*	$NetBSD: param.h,v 1.29 2021/05/31 14:38:55 simonb Exp $	*/
 
 /*	$OpenBSD: param.h,v 1.12 2001/07/06 02:07:41 provos Exp $	*/
 
@@ -27,6 +27,9 @@
 
 #ifdef _KERNEL
 #include 
+#ifdef _KERNEL_OPT
+#include "opt_param.h"
+#endif
 #endif
 
 /*

Index: src/sys/arch/i386/include/param.h
diff -u src/sys/arch/i386/include/param.h:1.87 src/sys/arch/i386/include/param.h:1.88
--- 

CVS commit: src/share/man/man9

2021-05-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May 31 12:24:15 UTC 2021

Modified Files:
src/share/man/man9: delay.9

Log Message:
Use  in the synopsis rather than ; an MI
interface should be pulled in via .


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/delay.9

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/man9/delay.9
diff -u src/share/man/man9/delay.9:1.7 src/share/man/man9/delay.9:1.8
--- src/share/man/man9/delay.9:1.7	Wed Jul 20 05:20:54 2011
+++ src/share/man/man9/delay.9	Mon May 31 12:24:15 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: delay.9,v 1.7 2011/07/20 05:20:54 jruoho Exp $
+.\" $NetBSD: delay.9,v 1.8 2021/05/31 12:24:15 simonb Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .Nm DELAY
 .Nd microsecond delay
 .Sh SYNOPSIS
-.In machine/param.h
+.In sys/param.h
 .Ft void
 .Fn delay "unsigned int us"
 .Ft void



CVS commit: src/compat

2021-05-30 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May 31 02:10:37 UTC 2021

Modified Files:
src/compat: exec.mk

Log Message:
MIPS n64 dynamic binaries have worked for a while now, remove -static
for these.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/compat/exec.mk

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

Modified files:

Index: src/compat/exec.mk
diff -u src/compat/exec.mk:1.5 src/compat/exec.mk:1.6
--- src/compat/exec.mk:1.5	Tue Jan  5 11:08:00 2021
+++ src/compat/exec.mk	Mon May 31 02:10:37 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: exec.mk,v 1.5 2021/01/05 11:08:00 simonb Exp $
+#	$NetBSD: exec.mk,v 1.6 2021/05/31 02:10:37 simonb Exp $
 
 # this makefile fragment can be included to modify the default
 # ABI a program is compiled with.  this is designed to be used
@@ -34,8 +34,6 @@
 
 # XXX -pie makes n64 crash
 NOPIE=1
-# XXX interesting dynamic binaries crash (hello.c works.)
-LDSTATIC=-static
 
 . include 
 



CVS commit: src/sys/conf

2021-05-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat May 29 12:03:34 UTC 2021

Modified Files:
src/sys/conf: files

Log Message:
Put the MSGBUFSIZE option in opt_param.h so that changes of its setting
in kernel config files will be picked up automatically without needing
a "make clean".  Added to opt_param.h since ports define their default
MSGBUFSIZE settings in their  (or equivalent).


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

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1284 src/sys/conf/files:1.1285
--- src/sys/conf/files:1.1284	Wed May 19 03:44:46 2021
+++ src/sys/conf/files	Sat May 29 12:03:34 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1284 2021/05/19 03:44:46 yamaguchi Exp $
+#	$NetBSD: files,v 1.1285 2021/05/29 12:03:34 simonb Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -18,6 +18,7 @@ devclass bus
 # (note, these are case-sensitive)
 #
 defparam opt_param.h		MAXUSERS
+defparam opt_param.h		MSGBUFSIZE
 defflagINSECURE
 defflagKTRACE
 defflagMBUFTRACE



CVS commit: src/sys/arch/mips

2021-05-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat May 29 12:35:27 UTC 2021

Modified Files:
src/sys/arch/mips/include: cpuregs.h
src/sys/arch/mips/mips: fp.S locore.S mips_emul.c mips_fpu.c
mips_fputrap.c

Log Message:
Update the FPU register names and bit definitions to something somewhat
modern (MIPS32/MIPS64) and convert to __BIT/__BITS.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mips/mips/fp.S
cvs rdiff -u -r1.227 -r1.228 src/sys/arch/mips/mips/locore.S
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mips/mips/mips_emul.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/mips/mips_fpu.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/mips/mips_fputrap.c

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

Modified files:

Index: src/sys/arch/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.110 src/sys/arch/mips/include/cpuregs.h:1.111
--- src/sys/arch/mips/include/cpuregs.h:1.110	Wed Mar 17 11:05:37 2021
+++ src/sys/arch/mips/include/cpuregs.h	Sat May 29 12:35:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuregs.h,v 1.110 2021/03/17 11:05:37 simonb Exp $	*/
+/*	$NetBSD: cpuregs.h,v 1.111 2021/05/29 12:35:27 simonb Exp $	*/
 
 /*
  * Copyright (c) 2009 Miodrag Vallat.
@@ -704,40 +704,41 @@
 /*
  * The floating point version and status registers.
  */
-#define	MIPS_FPU_ID	$0
-#define	MIPS_FPU_CSR	$31
+#define	MIPS_FIR	$0	/* FP Implementation and Revision Register */
+#define	MIPS_FCSR	$31	/* FP Control/Status Register */
 
 /*
  * The floating point coprocessor status register bits.
  */
-#define	MIPS_FPU_ROUNDING_BITS		0x0003
-#define	MIPS_FPU_ROUND_RN		0x
-#define	MIPS_FPU_ROUND_RZ		0x0001
-#define	MIPS_FPU_ROUND_RP		0x0002
-#define	MIPS_FPU_ROUND_RM		0x0003
-#define	MIPS_FPU_STICKY_BITS		0x007c
-#define	MIPS_FPU_STICKY_INEXACT		0x0004
-#define	MIPS_FPU_STICKY_UNDERFLOW	0x0008
-#define	MIPS_FPU_STICKY_OVERFLOW	0x0010
-#define	MIPS_FPU_STICKY_DIV0		0x0020
-#define	MIPS_FPU_STICKY_INVALID		0x0040
-#define	MIPS_FPU_ENABLE_BITS		0x0f80
-#define	MIPS_FPU_ENABLE_INEXACT		0x0080
-#define	MIPS_FPU_ENABLE_UNDERFLOW	0x0100
-#define	MIPS_FPU_ENABLE_OVERFLOW	0x0200
-#define	MIPS_FPU_ENABLE_DIV0		0x0400
-#define	MIPS_FPU_ENABLE_INVALID		0x0800
-#define	MIPS_FPU_EXCEPTION_BITS		0x0003f000
-#define	MIPS_FPU_EXCEPTION_INEXACT	0x1000
-#define	MIPS_FPU_EXCEPTION_UNDERFLOW	0x2000
-#define	MIPS_FPU_EXCEPTION_OVERFLOW	0x4000
-#define	MIPS_FPU_EXCEPTION_DIV0		0x8000
-#define	MIPS_FPU_EXCEPTION_INVALID	0x0001
-#define	MIPS_FPU_EXCEPTION_UNIMPL	0x0002
-#define	MIPS_FPU_COND_BIT		0x0080
-#define	MIPS_FPU_FLUSH_BIT		0x0100	/* r4k,	 MBZ on r3k */
-#define	MIPS1_FPC_MBZ_BITS		0xff7c
-#define	MIPS3_FPC_MBZ_BITS		0xfe7c
+#define	MIPS_FCSR_RM		__BITS(1,0)
+#define	  MIPS_FCSR_RM_RN	  0	/* round to nearest */
+#define	  MIPS_FCSR_RM_RZ	  1	/* round toward zerO */
+#define	  MIPS_FCSR_RM_RP	  2	/* round towards +infinity */
+#define	  MIPS_FCSR_RM_RM	  3	/* round towards -infinity */
+#define	MIPS_FCSR_FLAGS		__BITS(6,2)
+#define	  MIPS_FCSR_FLAGS_I	  __BIT(2)	/* inexact */
+#define	  MIPS_FCSR_FLAGS_U	  __BIT(3)	/* underflow */
+#define	  MIPS_FCSR_FLAGS_O	  __BIT(4)	/* overflow */
+#define	  MIPS_FCSR_FLAGS_Z	  __BIT(5)	/* divide by zero */
+#define	  MIPS_FCSR_FLAGS_V	  __BIT(6)	/* invalid operation */
+#define	MIPS_FCSR_ENABLES	__BITS(11,7)
+#define	  MIPS_FCSR_ENABLES_I	  __BIT(7)	/* inexact */
+#define	  MIPS_FCSR_ENABLES_U	  __BIT(8)	/* underflow */
+#define	  MIPS_FCSR_ENABLES_O	  __BIT(9)	/* overflow */
+#define	  MIPS_FCSR_ENABLES_Z	  __BIT(10)	/* divide by zero */
+#define	  MIPS_FCSR_ENABLES_V	  __BIT(11)	/* invalid operation */
+#define	MIPS_FCSR_CAUSE		__BITS(17,12)
+#define	  MIPS_FCSR_CAUSE_I	  __BIT(12)	/* inexact */
+#define	  MIPS_FCSR_CAUSE_U	  __BIT(13)	/* underflow */
+#define	  MIPS_FCSR_CAUSE_O	  __BIT(14)	/* overflow */
+#define	  MIPS_FCSR_CAUSE_Z	  __BIT(15)	/* divide by zero */
+#define	  MIPS_FCSR_CAUSE_V	  __BIT(16)	/* invalid operation */
+#define	  MIPS_FCSR_CAUSE_E	  __BIT(17)	/* unimplemented operation */
+#define	MIPS_FCSR_NAN_2008	__BIT(18)
+#define	MIPS_FCSR_ABS_2008	__BIT(19)
+#define	MIPS_FCSR_FCC0		__BIT(23)
+#define	MIPS_FCSR_FCC		(MIPS_FPU_COND_BIT | __BITS(31,25))
+#define	MIPS_FCSR_FS		__BIT(24)	/* r4k+ */
 
 
 /*

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.57 src/sys/arch/mips/mips/fp.S:1.58
--- src/sys/arch/mips/mips/fp.S:1.57	Mon May 24 07:27:39 2021
+++ src/sys/arch/mips/mips/fp.S	Sat May 29 12:35:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.57 2021/05/24 07:27:39 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.58 2021/05/29 12:35:27 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -143,10 +143,10 @@ NESTED(mips_emul_fp, CALLFRAME_SIZ, ra)
 	PTR_L	a3, 

CVS commit: src/sys/arch/mips

2021-05-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri May 28 00:18:27 UTC 2021

Modified Files:
src/sys/arch/mips: README.models

Log Message:
Update R6000 description.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/README.models

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

Modified files:

Index: src/sys/arch/mips/README.models
diff -u src/sys/arch/mips/README.models:1.6 src/sys/arch/mips/README.models:1.7
--- src/sys/arch/mips/README.models:1.6	Sat Aug 15 05:41:57 2020
+++ src/sys/arch/mips/README.models	Fri May 28 00:18:27 2021
@@ -1,4 +1,4 @@
-# $NetBSD: README.models,v 1.6 2020/08/15 05:41:57 mrg Exp $
+# $NetBSD: README.models,v 1.7 2021/05/28 00:18:27 simonb Exp $
 
 MIPS models and architecture levels
 ---
@@ -51,7 +51,7 @@ which have model numbers with fewer zero
 	R4400		MIPS-III (64-bit)	[idt96 A-197]
 	R4600		MIPS-III (64-bit)	[idt96 A-197]
 	R5000		MIPS-IV (64-bit)	[idt96 1-5]
-	R6000		MIPS-II ??
+	R6000		MIPS-II (32-bit) with 64-bit FPU regs
 	R8000		MIPS-IV (64-bit)	[idt96 1-5]
 	R1		MIPS-IV (64-bit)	[idt96 1-5]
 	R1x000		MIPS-IV (64-bit)



CVS commit: src/sys/arch/mips

2021-05-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 15:00:02 UTC 2021

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

Log Message:
Rename the unhelpfully named mips_emul_lwc0() and mips_emul_swc0() to
mips_emul_ll() and mips_emul_sc(); make these static to mips_emul.c.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/mips/mips/mips_emul.c

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

Modified files:

Index: src/sys/arch/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.118 src/sys/arch/mips/include/locore.h:1.119
--- src/sys/arch/mips/include/locore.h:1.118	Wed May 12 03:53:37 2021
+++ src/sys/arch/mips/include/locore.h	Thu May 27 15:00:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.118 2021/05/12 03:53:37 simonb Exp $ */
+/* $NetBSD: locore.h,v 1.119 2021/05/27 15:00:02 simonb Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -347,8 +347,6 @@ void	mips_emul_inst(uint32_t, uint32_t, 
 void	mips_emul_fp(uint32_t, struct trapframe *, uint32_t);
 void	mips_emul_branchdelayslot(uint32_t, struct trapframe *, uint32_t);
 
-void	mips_emul_lwc0(uint32_t, struct trapframe *, uint32_t);
-void	mips_emul_swc0(uint32_t, struct trapframe *, uint32_t);
 void	mips_emul_special(uint32_t, struct trapframe *, uint32_t);
 void	mips_emul_special3(uint32_t, struct trapframe *, uint32_t);
 

Index: src/sys/arch/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.28 src/sys/arch/mips/mips/mips_emul.c:1.29
--- src/sys/arch/mips/mips/mips_emul.c:1.28	Thu May 27 13:32:54 2021
+++ src/sys/arch/mips/mips/mips_emul.c	Thu May 27 15:00:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_emul.c,v 1.28 2021/05/27 13:32:54 simonb Exp $ */
+/*	$NetBSD: mips_emul.c,v 1.29 2021/05/27 15:00:02 simonb Exp $ */
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.28 2021/05/27 13:32:54 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.29 2021/05/27 15:00:02 simonb Exp $");
 
 #include 
 #include 
@@ -47,6 +47,9 @@ static inline void	send_sigsegv(intptr_t
 			uint32_t);
 static inline void	update_pc(struct trapframe *, uint32_t);
 
+static void	mips_emul_ll(uint32_t, struct trapframe *, uint32_t);
+static void	mips_emul_sc(uint32_t, struct trapframe *, uint32_t);
+
 /*
  * MIPS2 LL instruction emulation state
  */
@@ -198,11 +201,11 @@ mips_emul_inst(uint32_t status, uint32_t
 		inst = mips_ufetch32((uint32_t *)opc);
 
 	switch (((InstFmt)inst).FRType.op) {
-	case OP_LWC0:
-		mips_emul_lwc0(inst, tf, cause);
+	case OP_LL:
+		mips_emul_ll(inst, tf, cause);
 		break;
-	case OP_SWC0:
-		mips_emul_swc0(inst, tf, cause);
+	case OP_SC:
+		mips_emul_sc(inst, tf, cause);
 		break;
 	case OP_SPECIAL:
 		mips_emul_special(inst, tf, cause);
@@ -289,7 +292,7 @@ update_pc(struct trapframe *tf, uint32_t
  * MIPS2 LL instruction
  */
 void
-mips_emul_lwc0(uint32_t inst, struct trapframe *tf, uint32_t cause)
+mips_emul_ll(uint32_t inst, struct trapframe *tf, uint32_t cause)
 {
 	intptr_t	vaddr;
 	int16_t		offset;
@@ -322,7 +325,7 @@ mips_emul_lwc0(uint32_t inst, struct tra
  * MIPS2 SC instruction
  */
 void
-mips_emul_swc0(uint32_t inst, struct trapframe *tf, uint32_t cause)
+mips_emul_sc(uint32_t inst, struct trapframe *tf, uint32_t cause)
 {
 	intptr_t	vaddr;
 	uint32_t	value;



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

2021-05-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 13:32:54 UTC 2021

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

Log Message:
Print the CP0 status register too in the debug trap code.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mips/mips/mips_emul.c

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

Modified files:

Index: src/sys/arch/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.27 src/sys/arch/mips/mips/mips_emul.c:1.28
--- src/sys/arch/mips/mips/mips_emul.c:1.27	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/mips/mips/mips_emul.c	Thu May 27 13:32:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_emul.c,v 1.27 2019/04/06 03:06:26 thorpej Exp $ */
+/*	$NetBSD: mips_emul.c,v 1.28 2021/05/27 13:32:54 simonb Exp $ */
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.27 2019/04/06 03:06:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.28 2021/05/27 13:32:54 simonb Exp $");
 
 #include 
 #include 
@@ -240,7 +240,10 @@ mips_emul_inst(uint32_t status, uint32_t
 #endif
 	default:
 #ifdef DEBUG
-		printf("pid %d (%s): trap: bad insn @ %#"PRIxVADDR" cause %#x insn %#x code %d\n", curproc->p_pid, curproc->p_comm, opc, cause, inst, code);
+		printf("pid %d (%s): trap: bad insn @ %#"PRIxVADDR
+		" cause %#x status %#"PRIxREGISTER" insn %#x code %d\n",
+		curproc->p_pid, curproc->p_comm, opc,
+		cause, tf->tf_regs[_R_SR], inst, code);
 #endif
 		tf->tf_regs[_R_CAUSE] = cause;
 		tf->tf_regs[_R_BADVADDR] = opc;



CVS commit: src/sys/nfs

2021-05-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 08:58:29 UTC 2021

Modified Files:
src/sys/nfs: nfsnode.h

Log Message:
Remove nfs_putpages() prototype; it's not defined anywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/nfs/nfsnode.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/nfs/nfsnode.h
diff -u src/sys/nfs/nfsnode.h:1.73 src/sys/nfs/nfsnode.h:1.74
--- src/sys/nfs/nfsnode.h:1.73	Fri May 30 08:47:45 2014
+++ src/sys/nfs/nfsnode.h	Thu May 27 08:58:29 2021
@@ -1,4 +1,4 @@
-/*	 $NetBSD: nfsnode.h,v 1.73 2014/05/30 08:47:45 hannken Exp $	*/
+/*	 $NetBSD: nfsnode.h,v 1.74 2021/05/27 08:58:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -280,7 +280,6 @@ int	nfs_print(void *);
 int	nfs_pathconf(void *);
 int	nfs_advlock(void *);
 int	nfs_getpages(void *);
-int	nfs_putpages(void *);
 int	nfs_kqfilter(void *);
 
 extern int (**nfsv2_vnodeop_p)(void *);



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

2021-05-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 03:23:29 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Move the send queue checking to a new function, and also call this
in the rx interrupt path.  Measureable improvement on a NFS "create
small files" test.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/cavium/dev/if_cnmac.c

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

Modified files:

Index: src/sys/arch/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.26
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25	Thu May 27 01:43:32 2021
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Thu May 27 03:23:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $");
 
 /*
  * If no free send buffer is available, free all the sent buffers and bail out.
@@ -122,6 +122,7 @@ static inline void cnmac_send_queue_flus
 static inline void cnmac_send_queue_flush_fetch(struct cnmac_softc *);
 static inline void cnmac_send_queue_flush(struct cnmac_softc *);
 static inline void cnmac_send_queue_flush_sync(struct cnmac_softc *);
+static void cnmac_send_queue_check_and_flush(struct cnmac_softc *);
 static inline int cnmac_send_queue_is_full(struct cnmac_softc *);
 static inline void cnmac_send_queue_add(struct cnmac_softc *, struct mbuf *,
 uint64_t *);
@@ -604,6 +605,23 @@ cnmac_send_queue_is_full(struct cnmac_so
 	return 0;
 }
 
+static void
+cnmac_send_queue_check_and_flush(struct cnmac_softc *sc)
+{
+	int s;
+
+	/* XXX XXX XXX */
+	s = splnet();
+	if (sc->sc_soft_req_cnt > 0) {
+		cnmac_send_queue_flush_prefetch(sc);
+		cnmac_send_queue_flush_fetch(sc);
+		cnmac_send_queue_flush(sc);
+		cnmac_send_queue_flush_sync(sc);
+	}
+	splx(s);
+	/* XXX XXX XXX */
+}
+
 /*
  * (Ab)use m_nextpkt and m_paddr to maintain mbuf chain and pointer to gather
  * buffer.  Other mbuf members may be used by m_freem(), so don't touch them!
@@ -1299,6 +1317,8 @@ cnmac_intr(void *arg)
 		}
 
 		(void)cnmac_recv(sc, work);
+
+		cnmac_send_queue_check_and_flush(sc);
 	}
 
 	_POW_WR8(sc->sc_pow, POW_WQ_INT_OFFSET, wqmask);
@@ -1326,21 +1346,11 @@ cnmac_tick_free(void *arg)
 {
 	struct cnmac_softc *sc = arg;
 	int timo;
-	int s;
 
-	s = splnet();
-	/* XXX XXX XXX */
-	if (sc->sc_soft_req_cnt > 0) {
-		cnmac_send_queue_flush_prefetch(sc);
-		cnmac_send_queue_flush_fetch(sc);
-		cnmac_send_queue_flush(sc);
-		cnmac_send_queue_flush_sync(sc);
-	}
-	/* XXX XXX XXX */
+	cnmac_send_queue_check_and_flush(sc);
 
 	timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz;
 	callout_schedule(>sc_tick_free_ch, timo);
-	splx(s);
 }
 
 /*



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

2021-05-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 01:43:32 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Schedule the send cleanup function for next tick in cnmac_start().  In
the send cleanup function, schedule for the next tick instead of waiting
for HZ ticks if there are still send requests outstanding.  Greatly
increases NFS throughput, perhaps other types of network traffic.

Use callout_setfunc() after callout_init() instead of callout_reset().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mips/cavium/dev/if_cnmac.c

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

Modified files:

Index: src/sys/arch/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24	Tue Jun 23 05:17:13 2020
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Thu May 27 01:43:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $");
 
 /*
  * If no free send buffer is available, free all the sent buffers and bail out.
@@ -278,7 +278,10 @@ cnmac_attach(device_t parent, device_t s
 	octgmx_stats_init(sc->sc_gmx_port);
 
 	callout_init(>sc_tick_misc_ch, 0);
+	callout_setfunc(>sc_tick_misc_ch, cnmac_tick_misc, sc);
+
 	callout_init(>sc_tick_free_ch, 0);
+	callout_setfunc(>sc_tick_free_ch, cnmac_tick_free, sc);
 
 	const int dv_unit = device_unit(self);
 	octfau_op_init(>sc_fau_done,
@@ -998,6 +1001,7 @@ cnmac_start(struct ifnet *ifp)
 			if (wdc > 0)
 octpko_op_doorbell_write(sc->sc_port,
 sc->sc_port, wdc);
+			callout_schedule(>sc_tick_free_ch, 1);
 			return;
 		}
 		/* XXX XXX XXX */
@@ -1031,6 +1035,7 @@ cnmac_start(struct ifnet *ifp)
 
 last:
 	cnmac_send_queue_flush_fetch(sc);
+	callout_schedule(>sc_tick_free_ch, 1);
 }
 
 static void
@@ -1073,8 +1078,8 @@ cnmac_init(struct ifnet *ifp)
 
 	octgmx_set_filter(sc->sc_gmx_port);
 
-	callout_reset(>sc_tick_misc_ch, hz, cnmac_tick_misc, sc);
-	callout_reset(>sc_tick_free_ch, hz, cnmac_tick_free, sc);
+	callout_schedule(>sc_tick_misc_ch, hz);
+	callout_schedule(>sc_tick_free_ch, hz);
 
 	SET(ifp->if_flags, IFF_RUNNING);
 	CLR(ifp->if_flags, IFF_OACTIVE);
@@ -1097,7 +1102,6 @@ cnmac_stop(struct ifnet *ifp, int disabl
 	/* Mark the interface as down and cancel the watchdog timer. */
 	CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE);
 	ifp->if_timer = 0;
-
 }
 
 /*  misc */
@@ -1334,13 +1338,8 @@ cnmac_tick_free(void *arg)
 	}
 	/* XXX XXX XXX */
 
-	/* XXX XXX XXX */
-	/* ??? */
-	timo = hz - (100 * sc->sc_ext_callback_cnt);
-	if (timo < 10)
-		 timo = 10;
+	timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz;
 	callout_schedule(>sc_tick_free_ch, timo);
-	/* XXX XXX XXX */
 	splx(s);
 }
 



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

2021-05-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue May 25 09:19:28 UTC 2021

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

Log Message:
Alignment nit.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/mips/conf/files.mips

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

Modified files:

Index: src/sys/arch/mips/conf/files.mips
diff -u src/sys/arch/mips/conf/files.mips:1.83 src/sys/arch/mips/conf/files.mips:1.84
--- src/sys/arch/mips/conf/files.mips:1.83	Tue Mar 23 13:22:40 2021
+++ src/sys/arch/mips/conf/files.mips	Tue May 25 09:19:28 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mips,v 1.83 2021/03/23 13:22:40 simonb Exp $
+#	$NetBSD: files.mips,v 1.84 2021/05/25 09:19:28 simonb Exp $
 #
 
 defflag	opt_cputype.h		NOFPU FPEMUL
@@ -75,7 +75,7 @@ file	arch/mips/mips/cache_ls2.c		mips3_l
 file	arch/mips/mips/cache_r4k.c		mips3 | mips4
 file	arch/mips/mips/cache_r5k.c		mips3 | mips4
 file	arch/mips/mips/cache_r5k_subr.S		mips3 | mips4
-file	arch/mips/mips/cache_r10k.c	(mips3|mips4) & enable_mips4_cache_r10k
+file	arch/mips/mips/cache_r10k.c		(mips3|mips4) & enable_mips4_cache_r10k
 file	arch/mips/mips/cache_octeon.c		mips64_octeon
 file	arch/mips/mips/cache_mipsNN.c		mips32|mips32r2|mips64|mips64r2
 file	arch/mips/mips/cache_r4k_pcache16.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2



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

2021-05-24 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May 24 07:27:39 UTC 2021

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

Log Message:
Whitespace alignment nit.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mips/mips/fp.S

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

Modified files:

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.56 src/sys/arch/mips/mips/fp.S:1.57
--- src/sys/arch/mips/mips/fp.S:1.56	Thu May 13 06:15:29 2021
+++ src/sys/arch/mips/mips/fp.S	Mon May 24 07:27:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.56 2021/05/13 06:15:29 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.57 2021/05/24 07:27:39 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -773,7 +773,7 @@ branchc1:
 
 	.rdata
 branchc1_tbl:
-	PTR_WORD bcfalse		# br 0
+	PTR_WORD bcfalse	# br 0
 	PTR_WORD bctrue		# br 1
 	PTR_WORD bcfalse_l	# br 2
 	PTR_WORD bctrue_l	# br 3



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

2021-05-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat May 15 02:37:07 UTC 2021

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

Log Message:
The MIPS O64 ABI uses full 64-bit FP regs.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/mips/include/types.h

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

Modified files:

Index: src/sys/arch/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.75 src/sys/arch/mips/include/types.h:1.76
--- src/sys/arch/mips/include/types.h:1.75	Mon Mar 29 02:07:43 2021
+++ src/sys/arch/mips/include/types.h	Sat May 15 02:37:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.75 2021/03/29 02:07:43 simonb Exp $	*/
+/*	$NetBSD: types.h,v 1.76 2021/05/15 02:37:07 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -49,13 +49,10 @@ typedef __uint64_t		__fpregister64_t;
 typedef	unsigned int		__cpu_simple_lock_nv_t;
 #if defined(__mips_o32)
 typedef __register32_t		__register_t;
+typedef __fpregister32_t	__fpregister_t;
 #else
 typedef __register64_t		__register_t;
-#endif
-#if defined(__mips_o64) || defined(__mips_o32)
-typedef	__fpregister32_t	__fpregister_t;
-#else
-typedef	__fpregister64_t	__fpregister_t;
+typedef __fpregister64_t	__fpregister_t;
 #endif
 
 /*



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

2021-05-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri May 14 13:36:28 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_gmx.c

Log Message:
Fix a missed bitmask to __SHIFTOUT conversion in rev 1.12.

Fixes negotiation problems on non-gige switches.  Problem discovered and
tested by riastradh@.


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

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

Modified files:

Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.19
--- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18	Wed May  5 06:47:29 2021
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c	Fri May 14 13:36:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $	*/
+/*	$NetBSD: octeon_gmx.c,v 1.19 2021/05/14 13:36:28 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.19 2021/05/14 13:36:28 simonb Exp $");
 
 #include 
 #include 
@@ -834,7 +834,7 @@ octgmx_rgmii_speed_speed(struct octgmx_p
 
 	prt_cfg = _GMX_PORT_RD8(sc, GMX0_PRT0_CFG);
 
-	switch (sc->sc_link & RXN_RX_INBND_SPEED) {
+	switch (__SHIFTOUT(sc->sc_link, RXN_RX_INBND_SPEED)) {
 	case RXN_RX_INBND_SPEED_2_5:
 		/* 10Mbps */
 		/*



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

2021-05-13 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 13 06:15:29 UTC 2021

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

Log Message:
Update ISA for some "L" variant instructions after checking the R4400 UM.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/mips/mips/fp.S

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

Modified files:

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.55 src/sys/arch/mips/mips/fp.S:1.56
--- src/sys/arch/mips/mips/fp.S:1.55	Thu May 13 04:55:12 2021
+++ src/sys/arch/mips/mips/fp.S	Thu May 13 06:15:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.55 2021/05/13 04:55:12 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.56 2021/05/13 06:15:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -350,7 +350,7 @@ func_single_tbl:
 	PTR_WORD ill		# func 34 42
 	PTR_WORD ill		# func 35 43
 	PTR_WORD cvt_w_s	# func 36 44	CVT.W.S
-	PTR_WORD cvt_l_s	# func 37 45	CVT.L.S		MIPS64r2
+	PTR_WORD cvt_l_s	# func 37 45	CVT.L.S		MIPS3/MIPS64
 	PTR_WORD cvt_ps_s	# func 38 46	CVT.PS.S	MIPS32r2
 	PTR_WORD ill		# func 39 47
 	PTR_WORD ill		# func 40 50
@@ -387,10 +387,10 @@ func_double_tbl:
 	PTR_WORD abs_d		# func  5 05	ABS.D
 	PTR_WORD mov_d		# func  6 06	MOV.D
 	PTR_WORD neg_d		# func  7 07	NEG.D 
-	PTR_WORD round_l_d	# func  8 10	ROUND.L.D	MIPS64r2
-	PTR_WORD trunc_l_d	# func  9 11	TRUNC.L.D	MIPS64r2
-	PTR_WORD ceil_l_d	# func 10 12	CEIL.L.D	MIPS64r2
-	PTR_WORD floor_l_d	# func 11 13	FLOOR.L.D	MIPS64r2
+	PTR_WORD round_l_d	# func  8 10	ROUND.L.D	MIPS3/MIPS64
+	PTR_WORD trunc_l_d	# func  9 11	TRUNC.L.D	MIPS3/MIPS64
+	PTR_WORD ceil_l_d	# func 10 12	CEIL.L.D	MIPS3/MIPS64
+	PTR_WORD floor_l_d	# func 11 13	FLOOR.L.D	MIPS3/MIPS64
 	PTR_WORD round_w_d	# func 12 14	ROUND.W.D
 	PTR_WORD trunc_w_d	# func 13 15	TRUNC.W.D
 	PTR_WORD ceil_w_d	# func 14 16	CEIL.W.D
@@ -416,7 +416,7 @@ func_double_tbl:
 	PTR_WORD ill		# func 34 42
 	PTR_WORD ill		# func 35 43
 	PTR_WORD cvt_w_d	# func 36 44	CVT.W.D
-	PTR_WORD cvt_l_d	# func 37 45	CVT.L.D		MIPS64r2
+	PTR_WORD cvt_l_d	# func 37 45	CVT.L.D		MIPS3/MIPS64
 	PTR_WORD ill		# func 38 46
 	PTR_WORD ill		# func 39 47
 	PTR_WORD ill		# func 40 50
@@ -543,8 +543,8 @@ func_long_fixed_tbl:
 	PTR_WORD ill		# func 29 35
 	PTR_WORD ill		# func 30 36
 	PTR_WORD ill		# func 31 37
-	PTR_WORD cvt_s_l	# func 32 40	CVT.S.L		MIPS32r2
-	PTR_WORD cvt_d_l	# func 33 41	CVT.D.L		MIPS32r2
+	PTR_WORD cvt_s_l	# func 32 40	CVT.S.L		MIPS3/MIPS64
+	PTR_WORD cvt_d_l	# func 33 41	CVT.D.L		MIPS3/MIPS64
 	PTR_WORD ill		# func 34 42
 	PTR_WORD ill		# func 35 43
 	PTR_WORD ill		# func 36 44



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

2021-05-12 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 13 04:55:12 UTC 2021

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

Log Message:
Note which ISA the unimplemented instructions belong to.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/mips/mips/fp.S

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

Modified files:

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.54 src/sys/arch/mips/mips/fp.S:1.55
--- src/sys/arch/mips/mips/fp.S:1.54	Thu Apr 29 08:45:29 2021
+++ src/sys/arch/mips/mips/fp.S	Thu May 13 04:55:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.54 2021/04/29 08:45:29 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.55 2021/05/13 04:55:12 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -282,14 +282,14 @@ fmt_tbl:
 	PTR_WORD mfromc1	# sub 0		mfc1
 	PTR_WORD dmfromc1	# sub 1		dmfc1
 	PTR_WORD cfromc1	# sub 2		cfc1
-	PTR_WORD ill		# sub 3		mfhc1
+	PTR_WORD ill		# sub 3		mfhc1		MIPS32r2
 	PTR_WORD mtoc1		# sub 4		mtc1
 	PTR_WORD dmtoc1		# sub 5		dmtc1
 	PTR_WORD ctoc1		# sub 6		ctc1
-	PTR_WORD ill		# sub 7		mthc1
+	PTR_WORD ill		# sub 7		mthc1		MIPS32r2
 	PTR_WORD branchc1	# sub 8		bc1
-	PTR_WORD branchc1any2	# sub 9		bc1any2
-	PTR_WORD branchc1any4	# sub 10	bc1any4
+	PTR_WORD branchc1any2	# sub 9		bc1any2		MIPS-3D ASE
+	PTR_WORD branchc1any4	# sub 10	bc1any4		MIPS-3D ASE
 	PTR_WORD ill		# sub 11
 	PTR_WORD ill		# sub 12
 	PTR_WORD ill		# sub 13
@@ -321,37 +321,37 @@ func_single_tbl:
 	PTR_WORD abs_s		# func  5 05	ABS.S
 	PTR_WORD mov_s		# func  6 06	MOV.S
 	PTR_WORD neg_s		# func  7 07	NEG.S 
-	PTR_WORD round_l_s	# func  8 10	ROUND.L.S
-	PTR_WORD trunc_l_s	# func  9 11	TRUNC.L.S
-	PTR_WORD ceil_l_s	# func 10 12	CEIL.L.S
-	PTR_WORD floor_l_s	# func 11 13	FLOOR.L.S
+	PTR_WORD round_l_s	# func  8 10	ROUND.L.S	MIPS3/MIPS64
+	PTR_WORD trunc_l_s	# func  9 11	TRUNC.L.S	MIPS3/MIPS64
+	PTR_WORD ceil_l_s	# func 10 12	CEIL.L.S	MIPS3/MIPS64
+	PTR_WORD floor_l_s	# func 11 13	FLOOR.L.S	MIPS3/MIPS64
 	PTR_WORD round_w_s	# func 12 14	ROUND.W.S
 	PTR_WORD trunc_w_s	# func 13 15	TRUNC.W.S
 	PTR_WORD ceil_w_s	# func 14 16	CEIL.W.S
 	PTR_WORD floor_w_s	# func 15 17	FLOOR.W.S
 	PTR_WORD ill		# func 16 20
-	PTR_WORD movcf_s	# func 17 21	MOVCF.S
-	PTR_WORD movz_s		# func 18 22	MOVZ.S
-	PTR_WORD movn_s		# func 19 23	MOVN.S
+	PTR_WORD movcf_s	# func 17 21	MOVCF.S		MIPS32
+	PTR_WORD movz_s		# func 18 22	MOVZ.S		MIPS32
+	PTR_WORD movn_s		# func 19 23	MOVN.S		MIPS32
 	PTR_WORD ill		# func 20 24
-	PTR_WORD recip_s	# func 21 25	RECIP.S
-	PTR_WORD rsqrt_s	# func 22 26	RSQRT.S
+	PTR_WORD recip_s	# func 21 25	RECIP.S		MIPS32r2
+	PTR_WORD rsqrt_s	# func 22 26	RSQRT.S		MIPS32r2
 	PTR_WORD ill		# func 23 27
 	PTR_WORD ill		# func 24 30
 	PTR_WORD ill		# func 25 31
 	PTR_WORD ill		# func 26 32
 	PTR_WORD ill		# func 27 33
-	PTR_WORD recip2_s	# func 28 34	RECIP2.S
-	PTR_WORD recip1_s	# func 29 35	RECIP1.S
-	PTR_WORD rsqrt1_s	# func 30 36	RSQRT1.S
-	PTR_WORD rsqrt2_s	# func 31 37	RSQRT2.S
+	PTR_WORD recip2_s	# func 28 34	RECIP2.S	MIPS-3D ASE
+	PTR_WORD recip1_s	# func 29 35	RECIP1.S	MIPS-3D ASE
+	PTR_WORD rsqrt1_s	# func 30 36	RSQRT1.S	MIPS-3D ASE
+	PTR_WORD rsqrt2_s	# func 31 37	RSQRT2.S	MIPS-3D ASE
 	PTR_WORD ill		# func 32 40
 	PTR_WORD cvt_d_s	# func 33 41	CVT.D.S
 	PTR_WORD ill		# func 34 42
 	PTR_WORD ill		# func 35 43
 	PTR_WORD cvt_w_s	# func 36 44	CVT.W.S
-	PTR_WORD cvt_l_s	# func 37 45	CVT.L.S
-	PTR_WORD cvt_ps_s	# func 38 46	CVT.PS.S
+	PTR_WORD cvt_l_s	# func 37 45	CVT.L.S		MIPS64r2
+	PTR_WORD cvt_ps_s	# func 38 46	CVT.PS.S	MIPS32r2
 	PTR_WORD ill		# func 39 47
 	PTR_WORD ill		# func 40 50
 	PTR_WORD ill		# func 41 51
@@ -387,36 +387,36 @@ func_double_tbl:
 	PTR_WORD abs_d		# func  5 05	ABS.D
 	PTR_WORD mov_d		# func  6 06	MOV.D
 	PTR_WORD neg_d		# func  7 07	NEG.D 
-	PTR_WORD round_l_d	# func  8 10	ROUND.L.D
-	PTR_WORD trunc_l_d	# func  9 11	TRUNC.L.D
-	PTR_WORD ceil_l_d	# func 10 12	CEIL.L.D
-	PTR_WORD floor_l_d	# func 11 13	FLOOR.L.D
+	PTR_WORD round_l_d	# func  8 10	ROUND.L.D	MIPS64r2
+	PTR_WORD trunc_l_d	# func  9 11	TRUNC.L.D	MIPS64r2
+	PTR_WORD ceil_l_d	# func 10 12	CEIL.L.D	MIPS64r2
+	PTR_WORD floor_l_d	# func 11 13	FLOOR.L.D	MIPS64r2
 	PTR_WORD round_w_d	# func 12 14	ROUND.W.D
 	PTR_WORD trunc_w_d	# func 13 15	TRUNC.W.D
 	PTR_WORD ceil_w_d	# func 14 16	CEIL.W.D
 	PTR_WORD floor_w_d	# func 15 17	FLOOR.W.D
 	PTR_WORD ill		# func 16 20
-	PTR_WORD movcf_d	# func 17 21	MOVCF.D
-	PTR_WORD movz_d		# func 18 22	MOVZ.D
-	PTR_WORD movn_d		# func 19 23	MOVN.D
+	PTR_WORD movcf_d	# func 17 21	MOVCF.D		MIPS32
+	PTR_WORD movz_d		# func 18 22	MOVZ.D		MIPS32
+	PTR_WORD movn_d		# func 19 23	MOVN.D		MIPS32
 	PTR_WORD ill		# func 20 24
-	PTR_WORD recip_d	# func 21 25	RECIP.D
-	PTR_WORD rsqrt_d	# func 22 26	RSQRT.D
+	PTR_WORD recip_d	# func 21 25	RECIP.D		MIPS32r2
+	PTR_WORD rsqrt_d	# func 22 26	RSQRT.D		MIPS32r2
 	PTR_WORD ill		# func 23 27
 	PTR_WORD ill		# func 24 30
 	PTR_WORD ill		# func 25 31
 	

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

2021-05-12 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 13 03:41:46 UTC 2021

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

Log Message:
If we're going to print a number in hex, at least put a 0x in front of it.


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

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

Modified files:

Index: src/sys/arch/mips/mips/mips_fputrap.c
diff -u src/sys/arch/mips/mips/mips_fputrap.c:1.10 src/sys/arch/mips/mips/mips_fputrap.c:1.11
--- src/sys/arch/mips/mips/mips_fputrap.c:1.10	Sat Feb 26 15:41:32 2011
+++ src/sys/arch/mips/mips/mips_fputrap.c	Thu May 13 03:41:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_fputrap.c,v 1.10 2011/02/26 15:41:32 tsutsui Exp $ */
+/* $NetBSD: mips_fputrap.c,v 1.11 2021/05/13 03:41:46 simonb Exp $ */
 
 /*
  * Copyright (c) 2004
@@ -47,7 +47,7 @@ mips_fpuexcept(struct lwp *l, uint32_t f
 	ksiginfo_t ksi;
 
 #ifdef FPEMUL_DEBUG
-	printf("%s(%x,%#"PRIxREGISTER")\n",
+	printf("%s(%#x,%#"PRIxREGISTER")\n",
 	   __func__, fpustat, l->l_md.md_utf->tf_regs[_R_PC]);
 #endif
 
@@ -64,7 +64,7 @@ mips_fpuillinst(struct lwp *l, uint32_t 
 	ksiginfo_t ksi;
 
 #ifdef FPEMUL_DEBUG
-	printf("%s(%x,%#"PRIxREGISTER")\n",
+	printf("%s(%#x,%#"PRIxREGISTER")\n",
 	   __func__, opcode, l->l_md.md_utf->tf_regs[_R_PC]);
 #endif
 



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

2021-05-11 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed May 12 03:53:37 UTC 2021

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

Log Message:
Whitespace nit.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/mips/include/locore.h

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

Modified files:

Index: src/sys/arch/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.117 src/sys/arch/mips/include/locore.h:1.118
--- src/sys/arch/mips/include/locore.h:1.117	Tue Mar  2 08:16:52 2021
+++ src/sys/arch/mips/include/locore.h	Wed May 12 03:53:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.117 2021/03/02 08:16:52 skrll Exp $ */
+/* $NetBSD: locore.h,v 1.118 2021/05/12 03:53:37 simonb Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -306,7 +306,7 @@ struct mips_options {
 #endif
 #define	MIPS_HAS_LLADDR		((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
 #define	MIPS_HAS_DSP		(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_DSP)
-# define MIPS_HAS_USERLOCAL	(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_USERLOCAL)
+#define MIPS_HAS_USERLOCAL	(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_USERLOCAL)
 
 /* This test is ... rather bogus */
 #define	CPUISMIPS3	((mips_options.mips_cpu_arch & \



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

2021-05-11 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue May 11 14:41:08 UTC 2021

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

Log Message:
Use "static" in the function intro if the function is static.


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

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

Modified files:

Index: src/sys/arch/mips/mips/mips_fpu.c
diff -u src/sys/arch/mips/mips/mips_fpu.c:1.15 src/sys/arch/mips/mips/mips_fpu.c:1.16
--- src/sys/arch/mips/mips/mips_fpu.c:1.15	Sun May  7 05:45:07 2017
+++ src/sys/arch/mips/mips/mips_fpu.c	Tue May 11 14:41:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_fpu.c,v 1.15 2017/05/07 05:45:07 skrll Exp $	*/
+/*	$NetBSD: mips_fpu.c,v 1.16 2021/05/11 14:41:08 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_fpu.c,v 1.15 2017/05/07 05:45:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_fpu.c,v 1.16 2021/05/11 14:41:08 simonb Exp $");
 
 #include 
 #include 
@@ -79,7 +79,7 @@ fpu_used_p(const lwp_t *l)
 	return pcu_valid_p(_fpu_ops, l);
 }
 
-void
+static void
 mips_fpu_state_save(lwp_t *l)
 {
 	struct trapframe * const tf = l->l_md.md_utf;
@@ -206,7 +206,7 @@ mips_fpu_state_save(lwp_t *l)
 	__asm volatile ("mtc0 %0, $%1" :: "r"(status), "n"(MIPS_COP_0_STATUS));
 }
 
-void
+static void
 mips_fpu_state_load(lwp_t *l, u_int flags)
 {
 	struct trapframe * const tf = l->l_md.md_utf;
@@ -350,7 +350,7 @@ mips_fpu_state_load(lwp_t *l, u_int flag
 		"n"(MIPS_COP_0_STATUS));
 }
 
-void
+static void
 mips_fpu_state_release(lwp_t *l)
 {
 	l->l_md.md_utf->tf_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;



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

2021-05-11 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue May 11 09:21:25 UTC 2021

Modified Files:
src/sys/arch/mips/conf: std.octeon

Log Message:
Revert rev 1.5 - put the NOFPU option back.  Older cnMIPS cores don't
have an FPU.


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

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

Modified files:

Index: src/sys/arch/mips/conf/std.octeon
diff -u src/sys/arch/mips/conf/std.octeon:1.5 src/sys/arch/mips/conf/std.octeon:1.6
--- src/sys/arch/mips/conf/std.octeon:1.5	Sun Apr 18 12:05:29 2021
+++ src/sys/arch/mips/conf/std.octeon	Tue May 11 09:21:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.octeon,v 1.5 2021/04/18 12:05:29 simonb Exp $
+#	$NetBSD: std.octeon,v 1.6 2021/05/11 09:21:24 simonb Exp $
 
 machine evbmips mips
 include 	"conf/std"	# MI standard options
@@ -10,6 +10,7 @@ options 	MIPS3_ENABLE_CLOCK_INTR
 makeoptions	LP64="yes"
 
 options 	MIPS64R2
+options 	NOFPU		# No FPU
 options 	EXEC_ELF32	# exec ELF32 binaries
 options 	EXEC_ELF64	# exec ELF64 binaries
 options 	COMPAT_NETBSD32



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

2021-05-10 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May 10 14:27:47 UTC 2021

Modified Files:
src/distrib/sets/lists/modules: ad.mips

Log Message:
Column alignment.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/distrib/sets/lists/modules/ad.mips

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

Modified files:

Index: src/distrib/sets/lists/modules/ad.mips
diff -u src/distrib/sets/lists/modules/ad.mips:1.17 src/distrib/sets/lists/modules/ad.mips:1.18
--- src/distrib/sets/lists/modules/ad.mips:1.17	Sun Nov  1 18:51:34 2020
+++ src/distrib/sets/lists/modules/ad.mips	Mon May 10 14:27:47 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips,v 1.17 2020/11/01 18:51:34 pgoyette Exp $
+# $NetBSD: ad.mips,v 1.18 2021/05/10 14:27:47 simonb Exp $
 ./@MODULEDIR@/compat_netbsd32			modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32/compat_netbsd32.kmod modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_09		modules-base-kernel	kmod,arch64,nocompatmodules
@@ -29,27 +29,27 @@
 ./@MODULEDIR@/compat_netbsd32_80/compat_netbsd32_80.kmod modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_90		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_90/compat_netbsd32_90.kmod modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_coredump			modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_coredump		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_coredump/compat_netbsd32_coredump.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_mqueue			modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_mqueue		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_mqueue/compat_netbsd32_mqueue.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_nfssrv			modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_nfssrv		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_nfssrv/compat_netbsd32_nfssrv.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_ptrace			modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_ptrace		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_ptrace/compat_netbsd32_ptrace.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_quota			modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_quota		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_quota/compat_netbsd32_quota.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_quota_50			modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_quota_50		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_quota_50/compat_netbsd32_quota_50.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_raid			modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_raid		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_raid/compat_netbsd32_raid.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_sysvipc			modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_sysvipc		modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_sysvipc/compat_netbsd32_sysvipc.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_sysvipc_10		modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_sysvipc_10	modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_sysvipc_10/compat_netbsd32_sysvipc_10.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_sysvipc_14		modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_sysvipc_14	modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_sysvipc_14/compat_netbsd32_sysvipc_14.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
-./@MODULEDIR@/compat_netbsd32_sysvipc_50		modules-base-kernel	kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_sysvipc_50	modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_sysvipc_50/compat_netbsd32_sysvipc_50.kmod	modules-base-kernel	kmod,arch64,nocompatmodules
 ./@MODULEDIR@/exec_elf32			modules-base-kernel	kmod
 ./@MODULEDIR@/exec_elf32/exec_elf32.kmod	modules-base-kernel	kmod



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

2021-05-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed May  5 06:47:29 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_cib.c octeon_gmx.c octeon_intc.c

Log Message:
Sprinkle some static.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/octeon_cib.c \
src/sys/arch/mips/cavium/dev/octeon_intc.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/cavium/dev/octeon_gmx.c

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

Modified files:

Index: src/sys/arch/mips/cavium/dev/octeon_cib.c
diff -u src/sys/arch/mips/cavium/dev/octeon_cib.c:1.6 src/sys/arch/mips/cavium/dev/octeon_cib.c:1.7
--- src/sys/arch/mips/cavium/dev/octeon_cib.c:1.6	Wed Jan 27 03:10:21 2021
+++ src/sys/arch/mips/cavium/dev/octeon_cib.c	Wed May  5 06:47:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_cib.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $ */
+/* $NetBSD: octeon_cib.c,v 1.7 2021/05/05 06:47:29 simonb Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_cib.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_cib.c,v 1.7 2021/05/05 06:47:29 simonb Exp $");
 
 #include 
 #include 
@@ -53,7 +53,7 @@ static bool	octeon_cib_intrstr(device_t,
 
 static int	octeon_cib_intr(void *);
 
-struct fdtbus_interrupt_controller_func octeon_cib_funcs = {
+static struct fdtbus_interrupt_controller_func octeon_cib_funcs = {
 	.establish = octeon_cib_establish,
 	.disestablish = octeon_cib_disestablish,
 	.intrstr = octeon_cib_intrstr
Index: src/sys/arch/mips/cavium/dev/octeon_intc.c
diff -u src/sys/arch/mips/cavium/dev/octeon_intc.c:1.6 src/sys/arch/mips/cavium/dev/octeon_intc.c:1.7
--- src/sys/arch/mips/cavium/dev/octeon_intc.c:1.6	Wed Jan 27 03:10:21 2021
+++ src/sys/arch/mips/cavium/dev/octeon_intc.c	Wed May  5 06:47:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_intc.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $ */
+/* $NetBSD: octeon_intc.c,v 1.7 2021/05/05 06:47:29 simonb Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_intc.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_intc.c,v 1.7 2021/05/05 06:47:29 simonb Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ static void *	octeon_intc_establish(devi
 static void	octeon_intc_disestablish(device_t, void *);
 static bool	octeon_intc_intrstr(device_t, u_int *, char *, size_t);
 
-struct fdtbus_interrupt_controller_func octeon_intc_funcs = {
+static struct fdtbus_interrupt_controller_func octeon_intc_funcs = {
 	.establish = octeon_intc_establish,
 	.disestablish = octeon_intc_disestablish,
 	.intrstr = octeon_intc_intrstr

Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.17 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18
--- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.17	Sat Apr 24 23:36:42 2021
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c	Wed May  5 06:47:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_gmx.c,v 1.17 2021/04/24 23:36:42 thorpej Exp $	*/
+/*	$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.17 2021/04/24 23:36:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $");
 
 #include 
 #include 
@@ -138,33 +138,33 @@ static const int	octgmx_rx_adr_cam_regs[
 	GMX0_RX0_ADR_CAM3, GMX0_RX0_ADR_CAM4, GMX0_RX0_ADR_CAM5
 };
 
-struct octgmx_port_ops octgmx_port_ops_mii = {
+static struct octgmx_port_ops octgmx_port_ops_mii = {
 	/* XXX not implemented */
 };
 
-struct octgmx_port_ops octgmx_port_ops_gmii = {
+static struct octgmx_port_ops octgmx_port_ops_gmii = {
 	.port_ops_enable = octgmx_rgmii_enable,
 	.port_ops_speed = octgmx_rgmii_speed,
 	.port_ops_timing = octgmx_rgmii_timing,
 };
 
-struct octgmx_port_ops octgmx_port_ops_rgmii = {
+static struct octgmx_port_ops octgmx_port_ops_rgmii = {
 	.port_ops_enable = octgmx_rgmii_enable,
 	.port_ops_speed = octgmx_rgmii_speed,
 	.port_ops_timing = octgmx_rgmii_timing,
 };
 
-struct octgmx_port_ops octgmx_port_ops_sgmii = {
+static struct octgmx_port_ops octgmx_port_ops_sgmii = {
 	.port_ops_enable = octgmx_sgmii_enable,
 	.port_ops_speed = octgmx_sgmii_speed,
 	.port_ops_timing = octgmx_sgmii_timing,
 };
 
-struct octgmx_port_ops octgmx_port_ops_spi42 = {
+static struct octgmx_port_ops octgmx_port_ops_spi42 = {
 	/* XXX not implemented */
 };
 
-struct octgmx_port_ops *octgmx_port_ops[] = {
+static struct octgmx_port_ops *octgmx_port_ops[] = {
 	[GMX_MII_PORT] = _port_ops_mii,
 	[GMX_GMII_PORT] = _port_ops_gmii,
 	[GMX_RGMII_PORT] = _port_ops_rgmii,



CVS commit: src/sys/arch/evbmips/cavium

2021-05-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed May  5 06:46:37 UTC 2021

Modified Files:
src/sys/arch/evbmips/cavium: machdep.c

Log Message:
The watchdog setup code isn't used (yet), so don't compile in the
octeon_nmi_stack that it uses either.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbmips/cavium/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/evbmips/cavium/machdep.c
diff -u src/sys/arch/evbmips/cavium/machdep.c:1.23 src/sys/arch/evbmips/cavium/machdep.c:1.24
--- src/sys/arch/evbmips/cavium/machdep.c:1.23	Mon Aug 17 07:50:42 2020
+++ src/sys/arch/evbmips/cavium/machdep.c	Wed May  5 06:46:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.23 2020/08/17 07:50:42 simonb Exp $	*/
+/*	$NetBSD: machdep.c,v 1.24 2021/05/05 06:46:37 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -114,7 +114,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.23 2020/08/17 07:50:42 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.24 2021/05/05 06:46:37 simonb Exp $");
 
 #include 
 #include 
@@ -186,7 +186,9 @@ struct octeon_config octeon_configuratio
 struct octeon_btdesc octeon_btdesc;
 struct octeon_btinfo octeon_btinfo;
 
-char octeon_nmi_stack[PAGE_SIZE] __section(".data1") __aligned(PAGE_SIZE);
+#ifdef notyet
+static char octeon_nmi_stack[PAGE_SIZE] __section(".data1") __aligned(PAGE_SIZE);
+#endif
 
 /* Currently the OCTEON kernels only support big endian boards */
 CTASSERT(_BYTE_ORDER == _BIG_ENDIAN);
@@ -264,7 +266,7 @@ mach_init(uint64_t arg0, uint64_t arg1, 
 	 */
 	mips_init_lwp0_uarea();
 
-#if 0
+#ifdef notyet
 	curcpu()->ci_nmi_stack = octeon_nmi_stack + sizeof(octeon_nmi_stack) - sizeof(struct kernframe);
 	*(uint64_t *)MIPS_PHYS_TO_KSEG0(0x800) = (intptr_t)octeon_reset_vector;
 	const uint64_t wdog_reg = MIPS_PHYS_TO_XKPHYS_UNCACHED(CIU_WDOG0);
@@ -274,7 +276,7 @@ mach_init(uint64_t arg0, uint64_t arg1, 
 	wdog |= CIU_WDOGX_LEN;		// max period
 	mips64_sd_a64(wdog_reg, wdog);
 	printf("Watchdog enabled!\n");
-#endif
+#endif /* notyet */
 
 #if defined(DDB)
 	if (boothowto & RB_KDB)



CVS commit: src

2021-05-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May  3 11:07:55 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: mi
src/lib/libc/gen: Makefile.inc

Log Message:
Add links for the other functions documented in arc4random(3).


To generate a diff of this commit:
cvs rdiff -u -r1.2385 -r1.2386 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.213 -r1.214 src/lib/libc/gen/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/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2385 src/distrib/sets/lists/comp/mi:1.2386
--- src/distrib/sets/lists/comp/mi:1.2385	Wed Apr 28 02:15:03 2021
+++ src/distrib/sets/lists/comp/mi	Mon May  3 11:07:55 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2385 2021/04/28 02:15:03 rin Exp $
+#	$NetBSD: mi,v 1.2386 2021/05/03 11:07:55 simonb Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -5766,6 +5766,10 @@
 ./usr/share/man/cat3/allocaddrinfo.0		comp-c-catman		.cat
 ./usr/share/man/cat3/alphasort.0		comp-c-catman		.cat
 ./usr/share/man/cat3/arc4random.0		comp-c-catman		.cat
+./usr/share/man/cat3/arc4random_addrandom.0	comp-c-catman		.cat
+./usr/share/man/cat3/arc4random_buf.0		comp-c-catman		.cat
+./usr/share/man/cat3/arc4random_stir.0		comp-c-catman		.cat
+./usr/share/man/cat3/arc4random_uniform.0	comp-c-catman		.cat
 ./usr/share/man/cat3/archive.0			comp-c-catman		.cat
 ./usr/share/man/cat3/archive_clear_error.0	comp-c-catman		.cat
 ./usr/share/man/cat3/archive_compression.0	comp-c-catman		.cat
@@ -14090,6 +14094,10 @@
 ./usr/share/man/html3/allocaddrinfo.html	comp-c-htmlman		html
 ./usr/share/man/html3/alphasort.html		comp-c-htmlman		html
 ./usr/share/man/html3/arc4random.html		comp-c-htmlman		html
+./usr/share/man/html3/arc4random_addrandom.html	comp-c-htmlman		html
+./usr/share/man/html3/arc4random_buf.html	comp-c-htmlman		html
+./usr/share/man/html3/arc4random_stir.html	comp-c-htmlman		html
+./usr/share/man/html3/arc4random_uniform.html	comp-c-htmlman		html
 ./usr/share/man/html3/archive.html		comp-c-htmlman		html
 ./usr/share/man/html3/archive_clear_error.html	comp-c-htmlman		html
 ./usr/share/man/html3/archive_compression.html	comp-c-htmlman		html
@@ -22251,6 +22259,10 @@
 ./usr/share/man/man3/allocaddrinfo.3		comp-c-man		.man
 ./usr/share/man/man3/alphasort.3		comp-c-man		.man
 ./usr/share/man/man3/arc4random.3		comp-c-man		.man
+./usr/share/man/man3/arc4random_addrandom.3	comp-c-man		.man
+./usr/share/man/man3/arc4random_buf.3		comp-c-man		.man
+./usr/share/man/man3/arc4random_stir.3		comp-c-man		.man
+./usr/share/man/man3/arc4random_uniform.3	comp-c-man		.man
 ./usr/share/man/man3/archive.3			comp-c-man		.man
 ./usr/share/man/man3/archive_clear_error.3	comp-c-man		.man
 ./usr/share/man/man3/archive_compression.3	comp-c-man		.man

Index: src/lib/libc/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.213 src/lib/libc/gen/Makefile.inc:1.214
--- src/lib/libc/gen/Makefile.inc:1.213	Mon May  3 08:30:30 2021
+++ src/lib/libc/gen/Makefile.inc	Mon May  3 11:07:55 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.213 2021/05/03 08:30:30 simonb Exp $
+#	$NetBSD: Makefile.inc,v 1.214 2021/05/03 11:07:55 simonb Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -87,6 +87,8 @@ MAN+=	alarm.3 arc4random.3 basename.3 bs
 	ualarm.3 ulimit.3 uname.3 unvis.3 usleep.3 utime.3 valloc.3 vis.3 \
 	wordexp.3
 
+MLINKS+=arc4random.3 arc4random_addrandom.3 arc4random.3 arc4random_buf.3 \
+	arc4random.3 arc4random_stir.3 arc4random.3 arc4random_uniform.3
 MLINKS+=bswap.3 bswap16.3 bswap.3 bswap32.3 bswap.3 bswap64.3
 MLINKS+=cpuset.3 cpuset_create.3 cpuset.3 cpuset_destroy.3 \
 	cpuset.3 cpuset_zero.3 cpuset.3 cpuset_set.3 cpuset.3 cpuset_clr.3 \



CVS commit: src/lib/libc/gen

2021-05-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May  3 08:30:30 UTC 2021

Modified Files:
src/lib/libc/gen: Makefile.inc

Log Message:
Whitespace police.


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/lib/libc/gen/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/lib/libc/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.212 src/lib/libc/gen/Makefile.inc:1.213
--- src/lib/libc/gen/Makefile.inc:1.212	Tue Apr 20 21:42:32 2021
+++ src/lib/libc/gen/Makefile.inc	Mon May  3 08:30:30 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.212 2021/04/20 21:42:32 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.213 2021/05/03 08:30:30 simonb Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -102,7 +102,7 @@ MLINKS+=endutxent.3 getutxent.3 endutxen
 MLINKS+=endutent.3 getutent.3 endutent.3 getutline.3 endutent.3 pututline.3 \
 	endutent.3 setutent.3
 MLINKS+=err.3 verr.3 err.3 errx.3 err.3 verrx.3 err.3 warn.3 err.3 vwarn.3 \
-err.3 warnx.3 err.3 vwarnx.3 err.3 errc.3 err.3 verrc.3 err.3 warnc.3 \
+	err.3 warnx.3 err.3 vwarnx.3 err.3 errc.3 err.3 verrc.3 err.3 warnc.3 \
 	err.3 vwarnc.3
 MLINKS+=exec.3 execl.3 exec.3 execle.3 exec.3 execlp.3 exec.3 execlpe.3 \
 	exec.3 execv.3 exec.3 execvp.3 exec.3 execvpe.3 exec.3 exect.3 
@@ -113,7 +113,7 @@ MLINKS+=extattr_namespace_to_string.3 ex
 	extattr_copy_file.3 fcpxattr.3 \
 	extattr_copy_file.3 lcpxattr.3
 MLINKS+=fpgetmask.3 fpgetround.3 fpgetmask.3 fpgetsticky.3 \
-	fpgetmask.3 fpsetmask.3  fpgetmask.3 fpsetround.3 \
+	fpgetmask.3 fpsetmask.3 fpgetmask.3 fpsetround.3 \
 	fpgetmask.3 fpsetsticky.3 fpgetmask.3 fpgetprec.3 \
 	fpgetmask.3 fpsetprec.3
 MLINKS+=fts.3 fts_open.3 fts.3 fts_read.3 fts.3 fts_children.3 \



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

2021-04-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 29 08:47:26 UTC 2021

Modified Files:
src/sys/arch/evbmips/conf: std.malta

Log Message:
Don't force all MALTA kernels to be compiled with -mips64 when they
also support MIPS32-only CPU configs.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbmips/conf/std.malta

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

Modified files:

Index: src/sys/arch/evbmips/conf/std.malta
diff -u src/sys/arch/evbmips/conf/std.malta:1.9 src/sys/arch/evbmips/conf/std.malta:1.10
--- src/sys/arch/evbmips/conf/std.malta:1.9	Thu Apr 11 04:28:17 2019
+++ src/sys/arch/evbmips/conf/std.malta	Thu Apr 29 08:47:26 2021
@@ -1,4 +1,4 @@
-# $NetBSD: std.malta,v 1.9 2019/04/11 04:28:17 simonb Exp $
+# $NetBSD: std.malta,v 1.10 2021/04/29 08:47:26 simonb Exp $
 
 machine evbmips mips
 include		"conf/std"	# MI standard options
@@ -11,8 +11,6 @@ options	MIPS_MALTA
 options	EXEC_ELF32	# exec ELF32 binaries
 options	EXEC_SCRIPT	# exec #! scripts
 
-makeoptions	CFLAGS+="-mips64"
-makeoptions	AFLAGS+="-mips64"
 makeoptions	DEFTEXTADDR="0x8010"
 makeoptions	BOARDTYPE="malta"
 makeoptions	NEED_SREC=yes



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

2021-04-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 29 08:45:29 UTC 2021

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

Log Message:
Fix another misplaced label for cvt_s_w() but use a named local label
and redo fix for cvt_d_w() in rev 1.52 the same way.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/mips/mips/fp.S

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

Modified files:

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.53 src/sys/arch/mips/mips/fp.S:1.54
--- src/sys/arch/mips/mips/fp.S:1.53	Thu Apr 29 08:14:08 2021
+++ src/sys/arch/mips/mips/fp.S	Thu Apr 29 08:45:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.53 2021/04/29 08:14:08 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.54 2021/04/29 08:45:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1754,17 +1754,18 @@ cvt_s_d:
  */
 cvt_s_w:
 	jal	_C_LABEL(get_fs_int)
-	bne	t2, zero, 1f			# check for zero
+	bne	t2, zero, .Lcvtswnot0		# check for zero
 	move	t1, zero
 	b	result_fs_s
 /*
  * Find out how many leading zero bits are in t2 and put in v1.
  */
+.Lcvtswnot0:
 #if __mips == 32 || __mips == 64
 	clz	v1, t2
 #else
 	.set	noat
-1:
+
 	move	v0, t2
 	move	v1, zero
 	srl	AT, v0, 16
@@ -1843,18 +1844,19 @@ cvt_d_s:
  */
 cvt_d_w:
 	jal	_C_LABEL(get_fs_int)
-	bne	t2, zero, 1f			# check for zero
+	bne	t2, zero, .Lcvtdwnot0		# check for zero
 	move	t1, zero			# result=0
 	move	t3, zero
 	b	result_fs_d
 /*
  * Find out how many leading zero bits are in t2 and put in v1.
  */
-1:
+.Lcvtdwnot0:
 #if __mips == 32 || __mips == 64
 	clz	v1, t2
 #else /* __mips == 32 || __mips == 64 */
 	.set	noat
+
 	move	v0, t2
 	move	v1, zero
 	srl	AT, v0, 16



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

2021-04-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 29 08:14:08 UTC 2021

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

Log Message:
Move a comment slighty so that it's before two #ifdef blocks that do the
same thing instead of in the middle of them.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/mips/mips/fp.S

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

Modified files:

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.52 src/sys/arch/mips/mips/fp.S:1.53
--- src/sys/arch/mips/mips/fp.S:1.52	Thu Apr 29 08:11:38 2021
+++ src/sys/arch/mips/mips/fp.S	Thu Apr 29 08:14:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.52 2021/04/29 08:11:38 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.53 2021/04/29 08:14:08 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -4411,13 +4411,14 @@ END(renorm_fs_d)
  *
  */
 STATIC_LEAF(renorm_ft_s)
+/*
+ * Find out how many leading zero bits are in ta2 and put in v1.
+ */
 #if __mips == 32 || __mips == 64
 	clz	v1, ta2
 #else
 	.set	noat
-/*
- * Find out how many leading zero bits are in ta2 and put in v1.
- */
+
 	move	v0, ta2
 	move	v1, zero
 	srl	AT, v0, 16



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

2021-04-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 29 08:11:38 UTC 2021

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

Log Message:
Move a branch target in cvt_d_w() to where it will be hit for either
case of an #ifdef block of code.  Fixes an FP emulation problem if
compiled with -mips32 or -mips64.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/mips/mips/fp.S

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

Modified files:

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.51 src/sys/arch/mips/mips/fp.S:1.52
--- src/sys/arch/mips/mips/fp.S:1.51	Thu Jun 25 11:48:39 2020
+++ src/sys/arch/mips/mips/fp.S	Thu Apr 29 08:11:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.51 2020/06/25 11:48:39 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.52 2021/04/29 08:11:38 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1850,11 +1850,11 @@ cvt_d_w:
 /*
  * Find out how many leading zero bits are in t2 and put in v1.
  */
+1:
 #if __mips == 32 || __mips == 64
 	clz	v1, t2
 #else /* __mips == 32 || __mips == 64 */
 	.set	noat
-1:
 	move	v0, t2
 	move	v1, zero
 	srl	AT, v0, 16



CVS commit: src/sys/arch

2021-04-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr 23 08:42:26 UTC 2021

Modified Files:
src/sys/arch/mips/conf: kern.ldscript stand.ldscript
src/sys/arch/mipsco/conf: stand.ldscript
src/sys/arch/sparc/conf: kern.ldscript
src/sys/arch/sparc64/conf: kern.ldscript kern32.ldscript

Log Message:
Merge the .text.* sections into the .text section on MIPS, SPARC and
SPARC64 as is done on all other ports.  Mostly costmetic, but does mean
that main() now appears before the _etext symbol instead of after it.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/conf/kern.ldscript
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/conf/stand.ldscript
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mipsco/conf/stand.ldscript
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/conf/kern.ldscript
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc64/conf/kern.ldscript \
src/sys/arch/sparc64/conf/kern32.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/mips/conf/kern.ldscript
diff -u src/sys/arch/mips/conf/kern.ldscript:1.11 src/sys/arch/mips/conf/kern.ldscript:1.12
--- src/sys/arch/mips/conf/kern.ldscript:1.11	Tue Aug 25 08:08:12 2015
+++ src/sys/arch/mips/conf/kern.ldscript	Fri Apr 23 08:42:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: kern.ldscript,v 1.11 2015/08/25 08:08:12 uebayasi Exp $ */
+/* $NetBSD: kern.ldscript,v 1.12 2021/04/23 08:42:25 simonb Exp $ */
 
 #include "assym.h"
 
@@ -16,6 +16,7 @@ SECTIONS
   {
 _ftext = . ;
 *(.text)
+*(.text.*)
 __stub_start = . ;
 *(.stub*)
 __stub_end = . ;

Index: src/sys/arch/mips/conf/stand.ldscript
diff -u src/sys/arch/mips/conf/stand.ldscript:1.7 src/sys/arch/mips/conf/stand.ldscript:1.8
--- src/sys/arch/mips/conf/stand.ldscript:1.7	Sat Aug 22 23:49:54 2015
+++ src/sys/arch/mips/conf/stand.ldscript	Fri Apr 23 08:42:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: stand.ldscript,v 1.7 2015/08/22 23:49:54 uebayasi Exp $ */
+/* $NetBSD: stand.ldscript,v 1.8 2021/04/23 08:42:25 simonb Exp $ */
 
 /*  ldscript for NetBSD/mips stand-alone programs */
 OUTPUT_ARCH(mips)
@@ -11,6 +11,7 @@ SECTIONS
   {
 _ftext = . ;
 *(.text)
+*(.text.*)
 *(.gnu.warning)
   } =0
   _etext = .;

Index: src/sys/arch/mipsco/conf/stand.ldscript
diff -u src/sys/arch/mipsco/conf/stand.ldscript:1.5 src/sys/arch/mipsco/conf/stand.ldscript:1.6
--- src/sys/arch/mipsco/conf/stand.ldscript:1.5	Thu Aug 20 07:00:49 2015
+++ src/sys/arch/mipsco/conf/stand.ldscript	Fri Apr 23 08:42:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: stand.ldscript,v 1.5 2015/08/20 07:00:49 uebayasi Exp $	*/
+/*	$NetBSD: stand.ldscript,v 1.6 2021/04/23 08:42:26 simonb Exp $	*/
 
 /*  ldscript for NetBSD/mipsco standalone bootstraps */
 OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")
@@ -12,6 +12,7 @@ SECTIONS
   {
 _ftext = . ;
 *(.text)
+*(.text.*)
 *(.gnu.warning)
   } =0
   _etext = .;

Index: src/sys/arch/sparc/conf/kern.ldscript
diff -u src/sys/arch/sparc/conf/kern.ldscript:1.12 src/sys/arch/sparc/conf/kern.ldscript:1.13
--- src/sys/arch/sparc/conf/kern.ldscript:1.12	Tue Aug 25 02:58:59 2015
+++ src/sys/arch/sparc/conf/kern.ldscript	Fri Apr 23 08:42:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript,v 1.12 2015/08/25 02:58:59 uebayasi Exp $	*/
+/*	$NetBSD: kern.ldscript,v 1.13 2021/04/23 08:42:26 simonb Exp $	*/
 
 #undef sparc
 
@@ -20,6 +20,7 @@ SECTIONS
   .text  :
   {
 *(.text)
+*(.text.*)
 *(.stub)
 /* .gnu.warning sections are handled specially by elf32.em.  */
 *(.gnu.warning)

Index: src/sys/arch/sparc64/conf/kern.ldscript
diff -u src/sys/arch/sparc64/conf/kern.ldscript:1.17 src/sys/arch/sparc64/conf/kern.ldscript:1.18
--- src/sys/arch/sparc64/conf/kern.ldscript:1.17	Tue Aug 25 02:59:00 2015
+++ src/sys/arch/sparc64/conf/kern.ldscript	Fri Apr 23 08:42:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript,v 1.17 2015/08/25 02:59:00 uebayasi Exp $	*/
+/*	$NetBSD: kern.ldscript,v 1.18 2021/04/23 08:42:26 simonb Exp $	*/
 
 #undef sparc
 
@@ -19,6 +19,7 @@ SECTIONS
   .text  :
   {
 *(.text)
+*(.text.*)
 *(.stub)
 /* .gnu.warning sections are handled specially by elf32.em.  */
 *(.gnu.warning)
Index: src/sys/arch/sparc64/conf/kern32.ldscript
diff -u src/sys/arch/sparc64/conf/kern32.ldscript:1.17 src/sys/arch/sparc64/conf/kern32.ldscript:1.18
--- src/sys/arch/sparc64/conf/kern32.ldscript:1.17	Fri Mar 25 14:58:53 2016
+++ src/sys/arch/sparc64/conf/kern32.ldscript	Fri Apr 23 08:42:26 2021
@@ -1,5 +1,3 @@
-/*	$NetBSD: kern32.ldscript,v 1.17 2016/03/25 14:58:53 nakayama Exp $	*/
-
 #undef sparc
 
 /*
@@ -20,6 +18,7 @@ SECTIONS
   .text  :
   {
 *(.text)
+*(.text.*)
 *(.stub)
 /* .gnu.warning sections are handled specially by elf32.em.  */
 *(.gnu.warning)



CVS commit: src/common/lib/libc/string

2021-04-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr 19 01:12:10 UTC 2021

Modified Files:
src/common/lib/libc/string: memset2.c

Log Message:
Add CVS ID line.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/common/lib/libc/string/memset2.c

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

Modified files:

Index: src/common/lib/libc/string/memset2.c
diff -u src/common/lib/libc/string/memset2.c:1.9 src/common/lib/libc/string/memset2.c:1.10
--- src/common/lib/libc/string/memset2.c:1.9	Sat Apr 17 21:43:47 2021
+++ src/common/lib/libc/string/memset2.c	Mon Apr 19 01:12:10 2021
@@ -1,3 +1,5 @@
+/*	$NetBSD: memset2.c,v 1.10 2021/04/19 01:12:10 simonb Exp $	*/
+
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: memset2.c,v 1.9 2021/04/17 21:43:47 mrg Exp $");
+__RCSID("$NetBSD: memset2.c,v 1.10 2021/04/19 01:12:10 simonb Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 



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

2021-04-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Apr 18 12:05:29 UTC 2021

Modified Files:
src/sys/arch/mips/conf: std.octeon

Log Message:
Delete the NOFPU option.  These CPUs do have an FPU.  Allows o32
binaries to work now.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/conf/std.octeon

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

Modified files:

Index: src/sys/arch/mips/conf/std.octeon
diff -u src/sys/arch/mips/conf/std.octeon:1.4 src/sys/arch/mips/conf/std.octeon:1.5
--- src/sys/arch/mips/conf/std.octeon:1.4	Mon Jun  1 22:55:12 2015
+++ src/sys/arch/mips/conf/std.octeon	Sun Apr 18 12:05:29 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.octeon,v 1.4 2015/06/01 22:55:12 matt Exp $
+#	$NetBSD: std.octeon,v 1.5 2021/04/18 12:05:29 simonb Exp $
 
 machine evbmips mips
 include 	"conf/std"	# MI standard options
@@ -10,7 +10,6 @@ options 	MIPS3_ENABLE_CLOCK_INTR
 makeoptions	LP64="yes"
 
 options 	MIPS64R2
-options 	NOFPU		# No FPU
 options 	EXEC_ELF32	# exec ELF32 binaries
 options 	EXEC_ELF64	# exec ELF64 binaries
 options 	COMPAT_NETBSD32



CVS commit: src/common/lib/libc/string

2021-04-17 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr 17 08:06:58 UTC 2021

Modified Files:
src/common/lib/libc/string: memset2.c

Log Message:
Use __register_t instead of uregister_t - this is available to all ports
and both userland and kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/string/memset2.c

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

Modified files:

Index: src/common/lib/libc/string/memset2.c
diff -u src/common/lib/libc/string/memset2.c:1.7 src/common/lib/libc/string/memset2.c:1.8
--- src/common/lib/libc/string/memset2.c:1.7	Sat Apr 17 06:02:35 2021
+++ src/common/lib/libc/string/memset2.c	Sat Apr 17 08:06:58 2021
@@ -29,7 +29,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: memset2.c,v 1.7 2021/04/17 06:02:35 simonb Exp $");
+__RCSID("$NetBSD: memset2.c,v 1.8 2021/04/17 08:06:58 simonb Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -60,11 +60,9 @@ __RCSID("$NetBSD: memset2.c,v 1.7 2021/0
 #undef memset
 
 /*
- * Assume uregister_t is the widest non-synthetic unsigned type.
+ * Assume __register_t is the widest non-synthetic unsigned type.
  */
-typedef uregister_t memword_t;
-
-__CTASSERT((~(memword_t)0U >> 1) != ~(memword_t)0U);
+typedef __register_t memword_t;
 
 #ifdef BZERO
 static inline



CVS commit: src/common/lib/libc/string

2021-04-17 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr 17 06:02:35 UTC 2021

Modified Files:
src/common/lib/libc/string: memset2.c

Log Message:
Cast the fill value to unsigned char so that the "fill" value used for
full-word fills isn't garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/string/memset2.c

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

Modified files:

Index: src/common/lib/libc/string/memset2.c
diff -u src/common/lib/libc/string/memset2.c:1.6 src/common/lib/libc/string/memset2.c:1.7
--- src/common/lib/libc/string/memset2.c:1.6	Sat Apr 17 05:57:11 2021
+++ src/common/lib/libc/string/memset2.c	Sat Apr 17 06:02:35 2021
@@ -29,7 +29,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: memset2.c,v 1.6 2021/04/17 05:57:11 simonb Exp $");
+__RCSID("$NetBSD: memset2.c,v 1.7 2021/04/17 06:02:35 simonb Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -97,7 +97,7 @@ memset(void *addr, int c, size_t len)
 	 * The conditional at the end prevents GCC from complaing about
 	 * shift count >= width of type 
 	 */
-	fill = c;
+	fill = (unsigned char)c;
 	fill |= fill << 8;
 	fill |= fill << 16;
 	fill |= fill << (sizeof(c) < sizeof(fill) ? 32 : 0);



CVS commit: src/common/lib/libc/string

2021-04-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr 17 05:57:11 UTC 2021

Modified Files:
src/common/lib/libc/string: memset2.c

Log Message:
Disable the larger/faster code path.  While the optimised code path was
indeed quicker, it nonetheless failed to actually fill all the requested
memory with the specified value much of the time if a non-aligned start
address was used.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/string/memset2.c

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

Modified files:

Index: src/common/lib/libc/string/memset2.c
diff -u src/common/lib/libc/string/memset2.c:1.5 src/common/lib/libc/string/memset2.c:1.6
--- src/common/lib/libc/string/memset2.c:1.5	Fri Mar  2 16:22:27 2012
+++ src/common/lib/libc/string/memset2.c	Sat Apr 17 05:57:11 2021
@@ -29,7 +29,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: memset2.c,v 1.5 2012/03/02 16:22:27 apb Exp $");
+__RCSID("$NetBSD: memset2.c,v 1.6 2021/04/17 05:57:11 simonb Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -47,6 +47,8 @@ __RCSID("$NetBSD: memset2.c,v 1.5 2012/0
 #include 
 #include 
 
+#define __OPTIMIZE_SIZE__	/* other code path is very broken */
+
 #ifdef TEST
 #include 
 #define _DIAGASSERT(a)		assert(a)



CVS commit: src/sys/compat/netbsd32

2021-04-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr 17 03:57:42 UTC 2021

Modified Files:
src/sys/compat/netbsd32: files.netbsd32

Log Message:
Compile in compat32 syscall names all the time, as we do for native
syscall names.  Needed for dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/netbsd32/files.netbsd32

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

Modified files:

Index: src/sys/compat/netbsd32/files.netbsd32
diff -u src/sys/compat/netbsd32/files.netbsd32:1.52 src/sys/compat/netbsd32/files.netbsd32:1.53
--- src/sys/compat/netbsd32/files.netbsd32:1.52	Sat May 16 18:31:48 2020
+++ src/sys/compat/netbsd32/files.netbsd32	Sat Apr 17 03:57:42 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.netbsd32,v 1.52 2020/05/16 18:31:48 christos Exp $
+#	$NetBSD: files.netbsd32,v 1.53 2021/04/17 03:57:42 simonb Exp $
 #
 # config file description for machine-independent netbsd32 compat code.
 # included by ports that need it.
@@ -41,7 +41,7 @@ file	compat/netbsd32/netbsd32_time.c		co
 file	compat/netbsd32/netbsd32_wait.c		compat_netbsd32
 file	compat/netbsd32/netbsd32_vm.c		compat_netbsd32
 file	compat/netbsd32/netbsd32_sysent.c	compat_netbsd32
-file	compat/netbsd32/netbsd32_syscalls.c	compat_netbsd32 & syscall_debug
+file	compat/netbsd32/netbsd32_syscalls.c	compat_netbsd32
 
 file	compat/netbsd32/netbsd32_compat_09.c	compat_netbsd32 & (compat_09 | compat_sunos)
 file	compat/netbsd32/netbsd32_compat_10_sysv.c compat_netbsd32 & compat_10 &



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

2021-04-12 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr 12 11:35:22 UTC 2021

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

Log Message:
Print target addresses similar to aarch64 as "address "
instead of " [addr:address]".  Uses less columns, a bit
easier on the eyes.


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

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.41 src/sys/arch/mips/mips/db_disasm.c:1.42
--- src/sys/arch/mips/mips/db_disasm.c:1.41	Wed Apr  7 14:27:39 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr 12 11:35:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.42 2021/04/12 11:35:22 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.42 2021/04/12 11:35:22 simonb Exp $");
 
 #include 
 #include 
@@ -910,13 +910,11 @@ print_addr(db_addr_t loc)
 	sym = db_search_symbol(loc, DB_STGY_ANY, );
 	db_symbol_values(sym, , 0);
 
+	db_printf("%#"PRIxVADDR, loc);
 	if (symname) {
-		if (diff == 0)
-			db_printf("%s", symname);
-		else
-			db_printf("<%s+%#"DDB_EXPR_FMT"x>", symname, diff);
-		db_printf("\t[addr:%#"PRIxVADDR"]", loc);
-	} else {
-		db_printf("%#"PRIxVADDR, loc);
+		db_printf(" <%s", symname);
+		if (diff != 0)
+			db_printf("+%#"DDB_EXPR_FMT"x", diff);
+		db_printf(">");
 	}
 }



CVS commit: src/sys/modules/dtrace

2021-04-10 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr 10 15:34:05 UTC 2021

Modified Files:
src/sys/modules/dtrace: Makefile

Log Message:
Build the netbsd32_syscall module if mips64.
Don't build the linux_syscall module if mips*


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/modules/dtrace/Makefile

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

Modified files:

Index: src/sys/modules/dtrace/Makefile
diff -u src/sys/modules/dtrace/Makefile:1.8 src/sys/modules/dtrace/Makefile:1.9
--- src/sys/modules/dtrace/Makefile:1.8	Wed Dec  4 10:12:47 2019
+++ src/sys/modules/dtrace/Makefile	Sat Apr 10 15:34:05 2021
@@ -1,16 +1,19 @@
-#	$NetBSD: Makefile,v 1.8 2019/12/04 10:12:47 martin Exp $
+#	$NetBSD: Makefile,v 1.9 2021/04/10 15:34:05 simonb Exp $
 # $FreeBSD: src/sys/modules/dtrace/Makefile,v 1.6.2.1 2009/08/03 08:13:06 kensmith Exp $
 
 .include 
 
 SUBDIR=		dtrace sdt fbt lockstat profile syscall
 
-.if ${MACHINE_ARCH} != "aarch64"
+.if ${MACHINE_ARCH} == "x86_64" || !empty(MACHINE_ARCH:Mmips64*)
+SUBDIR+=	netbsd32_syscall
+.endif
+
+.if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_CPU} != "mips"
 SUBDIR+=	linux_syscall
 .endif
 
 .if ${MACHINE_ARCH} == "x86_64"
-SUBDIR+=	netbsd32_syscall
 SUBDIR+=	linux32_syscall
 .endif
 



CVS commit: src/sys/kern

2021-04-08 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  8 06:20:47 UTC 2021

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

Log Message:
Sort includes.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/kern/kern_tc.c

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

Modified files:

Index: src/sys/kern/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.60 src/sys/kern/kern_tc.c:1.61
--- src/sys/kern/kern_tc.c:1.60	Thu Apr  8 06:06:24 2021
+++ src/sys/kern/kern_tc.c	Thu Apr  8 06:20:47 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.60 2021/04/08 06:06:24 simonb Exp $ */
+/* $NetBSD: kern_tc.c,v 1.61 2021/04/08 06:20:47 simonb Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,14 +40,18 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.60 2021/04/08 06:06:24 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.61 2021/04/08 06:20:47 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
 #endif
 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 	/* XXX just to get AB_VERBOSE */
 #include 
 #include 
@@ -55,10 +59,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
 
 /*



CVS commit: src/sys/kern

2021-04-08 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  8 06:06:24 UTC 2021

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

Log Message:
tc_init(): KASSERT that the timecounter hasn't previously been
initialised by checking the tc_next field.  Prevents nastly endless
loops in the timecounter code.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/kern/kern_tc.c

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

Modified files:

Index: src/sys/kern/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.59 src/sys/kern/kern_tc.c:1.60
--- src/sys/kern/kern_tc.c:1.59	Wed May 27 09:09:50 2020
+++ src/sys/kern/kern_tc.c	Thu Apr  8 06:06:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.59 2020/05/27 09:09:50 rin Exp $ */
+/* $NetBSD: kern_tc.c,v 1.60 2021/04/08 06:06:24 simonb Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.59 2020/05/27 09:09:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.60 2021/04/08 06:06:24 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -551,6 +551,9 @@ tc_init(struct timecounter *tc)
 {
 	u_int u;
 
+	KASSERTMSG(tc->tc_next == NULL, "timecounter %s already initialised",
+	tc->tc_name);
+
 	u = tc->tc_frequency / tc->tc_counter_mask;
 	/* XXX: We need some margin here, 10% is a guess */
 	u *= 11;



CVS commit: src/sbin/modstat

2021-04-07 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Apr  7 14:45:28 UTC 2021

Modified Files:
src/sbin/modstat: main.c

Log Message:
Update usage message to reflect reality.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sbin/modstat/main.c

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

Modified files:

Index: src/sbin/modstat/main.c
diff -u src/sbin/modstat/main.c:1.25 src/sbin/modstat/main.c:1.26
--- src/sbin/modstat/main.c:1.25	Sun Jan 27 02:08:36 2019
+++ src/sbin/modstat/main.c	Wed Apr  7 14:45:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.25 2019/01/27 02:08:36 pgoyette Exp $	*/
+/*	$NetBSD: main.c,v 1.26 2021/04/07 14:45:28 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.25 2019/01/27 02:08:36 pgoyette Exp $");
+__RCSID("$NetBSD: main.c,v 1.26 2021/04/07 14:45:28 simonb Exp $");
 #endif /* !lint */
 
 #include 
@@ -239,7 +239,8 @@ static void
 usage(void)
 {
 
-	(void)fprintf(stderr, "Usage: %s [-Aaen] [name]\n", getprogname());
+	(void)fprintf(stderr, "Usage: %s [-Aaek] [-n name | name]\n",
+	getprogname());
 	exit(EXIT_FAILURE);
 }
 



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

2021-04-07 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Apr  7 14:27:39 UTC 2021

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

Log Message:
Add a # to a %x printf format to get some 0x hex number prefixes.


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

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.40 src/sys/arch/mips/mips/db_disasm.c:1.41
--- src/sys/arch/mips/mips/db_disasm.c:1.40	Mon Apr  5 07:28:19 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Wed Apr  7 14:27:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.40 2021/04/05 07:28:19 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.40 2021/04/05 07:28:19 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $");
 
 #include 
 #include 
@@ -914,7 +914,7 @@ print_addr(db_addr_t loc)
 		if (diff == 0)
 			db_printf("%s", symname);
 		else
-			db_printf("<%s+%"DDB_EXPR_FMT"x>", symname, diff);
+			db_printf("<%s+%#"DDB_EXPR_FMT"x>", symname, diff);
 		db_printf("\t[addr:%#"PRIxVADDR"]", loc);
 	} else {
 		db_printf("%#"PRIxVADDR, loc);



CVS commit: src

2021-04-07 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Apr  7 09:57:02 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: stl.mi
src/external/cddl/osnet/lib: Makefile

Log Message:
Revert the change to not build and install /usr/lib/dtrace/drti.o; this
is used by the ruby30-base package when compiled with the dtrace option
(enabled by default).

Problem found by ryoon@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/sets/lists/comp/stl.mi
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/lib/Makefile

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

Modified files:

Index: src/distrib/sets/lists/comp/stl.mi
diff -u src/distrib/sets/lists/comp/stl.mi:1.8 src/distrib/sets/lists/comp/stl.mi:1.9
--- src/distrib/sets/lists/comp/stl.mi:1.8	Mon Mar 29 01:57:09 2021
+++ src/distrib/sets/lists/comp/stl.mi	Wed Apr  7 09:57:02 2021
@@ -1,7 +1,7 @@
-# $NetBSD: stl.mi,v 1.8 2021/03/29 01:57:09 simonb Exp $
+# $NetBSD: stl.mi,v 1.9 2021/04/07 09:57:02 simonb Exp $
 ./usr/lib/crtbegin.ocomp-c-lib	compatfile
 ./usr/lib/crtend.ocomp-c-lib	compatfile
 ./usr/lib/crti.ocomp-c-lib	compatfile
 ./usr/lib/crtn.ocomp-c-lib	compatfile
-./usr/lib/dtrace/drti.ocomp-c-lib	dtrace,obsolete
+./usr/lib/dtrace/drti.ocomp-c-lib	dtrace
 ./usr/lib/sysident.ocomp-c-lib	compatfile

Index: src/external/cddl/osnet/lib/Makefile
diff -u src/external/cddl/osnet/lib/Makefile:1.10 src/external/cddl/osnet/lib/Makefile:1.11
--- src/external/cddl/osnet/lib/Makefile:1.10	Mon Mar 29 01:57:09 2021
+++ src/external/cddl/osnet/lib/Makefile	Wed Apr  7 09:57:02 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2021/03/29 01:57:09 simonb Exp $
+#	$NetBSD: Makefile,v 1.11 2021/04/07 09:57:02 simonb Exp $
 #
 #
 
@@ -6,8 +6,7 @@
 
 .if (defined(MKDTRACE) && ${MKDTRACE} != "no")
 SUBDIR+=	libdtrace
-# drti.o is not (yet) used
-# SUBDIR+=	drti
+SUBDIR+=	drti
 .endif
 .if ${MKCTF:Uno} != "no"
 SUBDIR+=	libctf



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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Apr  7 02:59:01 UTC 2021

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

Log Message:
Basic dtrace trap support.

Mostly from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/sys/arch/mips/mips/trap.c

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

Modified files:

Index: src/sys/arch/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.260 src/sys/arch/mips/mips/trap.c:1.261
--- src/sys/arch/mips/mips/trap.c:1.260	Mon Mar 29 03:22:17 2021
+++ src/sys/arch/mips/mips/trap.c	Wed Apr  7 02:59:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.260 2021/03/29 03:22:17 simonb Exp $	*/
+/*	$NetBSD: trap.c,v 1.261 2021/04/07 02:59:01 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.260 2021/03/29 03:22:17 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.261 2021/04/07 02:59:01 simonb Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -83,6 +83,16 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.2
 #include 
 #endif
 
+#ifdef KDTRACE_HOOKS
+#include 
+
+/* Not used for now, but needed for dtrace/fbt modules */
+dtrace_doubletrap_func_t	dtrace_doubletrap_func = NULL;
+dtrace_trap_func_t		dtrace_trap_func = NULL;
+
+int(* dtrace_invop_jump_addr)(struct trapframe *);
+#endif /* KDTRACE_HOOKS */
+
 const char * const trap_names[] = {
 	"external interrupt",
 	"TLB modification",
@@ -187,6 +197,30 @@ trap(uint32_t status, uint32_t cause, va
 		LWP_CACHE_CREDS(l, p);
 	}
 
+#ifdef KDTRACE_HOOKS
+	/*
+	 * A trap can occur while DTrace executes a probe. Before
+	 * executing the probe, DTrace blocks re-scheduling and sets
+	 * a flag in its per-cpu flags to indicate that it doesn't
+	 * want to fault. On returning from the probe, the no-fault
+	 * flag is cleared and finally re-scheduling is enabled.
+	 *
+	 * If the DTrace kernel module has registered a trap handler,
+	 * call it and if it returns non-zero, assume that it has
+	 * handled the trap and modified the trap frame so that this
+	 * function can return normally.
+	 */
+	/*
+	 * XXXDTRACE: add pid probe handler here (if ever)
+	 */
+	if (!USERMODE(status)) {
+		if ((dtrace_trap_func != NULL) &&
+		((*dtrace_trap_func)(tf, type) != 0)) {
+			return;
+		}
+	}
+#endif /* KDTRACE_HOOKS */
+
 	switch (type) {
 	default:
 	dopanic:
@@ -518,8 +552,15 @@ trap(uint32_t status, uint32_t cause, va
 		}
 		break; /* SIGNAL */
 
-	case T_WATCH:
 	case T_BREAK:
+#ifdef KDTRACE_HOOKS
+		if ((dtrace_invop_jump_addr != NULL) &&
+		(dtrace_invop_jump_addr(tf) == 0)) {
+			return;
+		}
+#endif /* KDTRACE_HOOKS */
+		/* FALLTHROUGH */
+	case T_WATCH:
 #if defined(DDB)
 		kdb_trap(type, >tf_registers);
 		return;	/* KERN */
@@ -805,16 +846,6 @@ mips_singlestep(struct lwp *l)
 	return 0;
 }
 
-#ifdef KDTRACE_HOOKS
-#include 
-
-/* Not used for now, but needed for dtrace/fbt modules */
-dtrace_doubletrap_func_t	dtrace_doubletrap_func = NULL;
-dtrace_trap_func_t		dtrace_trap_func = NULL;
-
-int(* dtrace_invop_jump_addr)(struct trapframe *);
-#endif /* KDTRACE_HOOKS */
-
 #ifdef TRAP_SIGDEBUG
 static void
 frame_dump(const struct trapframe *tf, struct pcb *pcb)



CVS commit: src/external/cddl/osnet/dev/dtrace/mips

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Apr  7 01:54:32 UTC 2021

Modified Files:
src/external/cddl/osnet/dev/dtrace/mips: dtrace_isa.c

Log Message:
Use NAL (nop-and-link) to get the current PC.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/dev/dtrace/mips/dtrace_isa.c

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

Modified files:

Index: src/external/cddl/osnet/dev/dtrace/mips/dtrace_isa.c
diff -u src/external/cddl/osnet/dev/dtrace/mips/dtrace_isa.c:1.1 src/external/cddl/osnet/dev/dtrace/mips/dtrace_isa.c:1.2
--- src/external/cddl/osnet/dev/dtrace/mips/dtrace_isa.c:1.1	Mon Mar 29 05:17:09 2021
+++ src/external/cddl/osnet/dev/dtrace/mips/dtrace_isa.c	Wed Apr  7 01:54:31 2021
@@ -107,9 +107,8 @@ dtrace_getpcstack(pc_t *pcstack, int pcs
 	ra = (register_t)(intptr_t)__builtin_return_address(0);
 
	__asm __volatile(
-		"jal 99f\n"
-		"nop\n"
-		"99:\n"
+		"nal\n"
+		" nop\n"
 		"move %0, $31\n" /* get ra */
 		"move $31, %1\n" /* restore ra */
 		: "=r" (pc)



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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 16:10:08 UTC 2021

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

Log Message:
The location arg of db_disasm() is a db_addr_t, not a vaddr_t.


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

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

Modified files:

Index: src/sys/arch/sparc/sparc/db_disasm.c
diff -u src/sys/arch/sparc/sparc/db_disasm.c:1.22 src/sys/arch/sparc/sparc/db_disasm.c:1.23
--- src/sys/arch/sparc/sparc/db_disasm.c:1.22	Wed Jan 11 12:14:32 2017
+++ src/sys/arch/sparc/sparc/db_disasm.c	Tue Apr  6 16:10:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.22 2017/01/11 12:14:32 joerg Exp $ */
+/*	$NetBSD: db_disasm.c,v 1.23 2021/04/06 16:10:08 simonb Exp $ */
 
 /*
  * Copyright (c) 1994 David S. Miller, da...@nadzieja.rutgers.edu
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.22 2017/01/11 12:14:32 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.23 2021/04/06 16:10:08 simonb Exp $");
 
 #include 
 #include 
@@ -876,7 +876,7 @@ struct sparc_insn sparc_i[] = {
 };
 
 db_addr_t
-db_disasm(vaddr_t loc, bool altfmt)
+db_disasm(db_addr_t loc, bool altfmt)
 {
 	struct sparc_insn*	i_ptr = (struct sparc_insn *)_i;
 



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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 16:05:17 UTC 2021

Modified Files:
src/sys/arch/m68k/m68k: db_disasm.h

Log Message:
Remove duplicate db_disasm() prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/m68k/m68k/db_disasm.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/m68k/m68k/db_disasm.h
diff -u src/sys/arch/m68k/m68k/db_disasm.h:1.9 src/sys/arch/m68k/m68k/db_disasm.h:1.10
--- src/sys/arch/m68k/m68k/db_disasm.h:1.9	Sat Mar 14 14:46:01 2009
+++ src/sys/arch/m68k/m68k/db_disasm.h	Tue Apr  6 16:05:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.h,v 1.9 2009/03/14 14:46:01 dsl Exp $	*/
+/*	$NetBSD: db_disasm.h,v 1.10 2021/04/06 16:05:17 simonb Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -424,5 +424,3 @@ typedef struct dis_buffer dis_buffer_t;
 #define PRINT_FPREG(dbuf, reg) addstr(dbuf, fpregs[reg])
 #define PRINT_DREG(dbuf, reg) addstr(dbuf, dregs[reg])
 #define PRINT_AREG(dbuf, reg) addstr(dbuf, aregs[reg])
-
-db_addr_t	db_disasm(db_addr_t loc, bool moto_syntax);



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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 16:04:44 UTC 2021

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

Log Message:
Include  to get ddb's db_disasm() prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/m68k/m68k/db_disasm.c

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

Modified files:

Index: src/sys/arch/m68k/m68k/db_disasm.c
diff -u src/sys/arch/m68k/m68k/db_disasm.c:1.44 src/sys/arch/m68k/m68k/db_disasm.c:1.45
--- src/sys/arch/m68k/m68k/db_disasm.c:1.44	Sat Oct 26 17:50:18 2019
+++ src/sys/arch/m68k/m68k/db_disasm.c	Tue Apr  6 16:04:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.44 2019/10/26 17:50:18 christos Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.45 2021/04/06 16:04:44 simonb Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.44 2019/10/26 17:50:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.45 2021/04/06 16:04:44 simonb Exp $");
 
 #include 
 #ifdef _KERNEL
@@ -72,8 +72,9 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,
 
 #include 
 
-#include 
+#include 
 #include 
+#include 
 #include 
 
 static void	get_modregstr(dis_buffer_t *, int, int, int, int);



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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 15:55:26 UTC 2021

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

Log Message:
Fix a typo, remove a useless blank line.


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

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/db_disasm.c
diff -u src/sys/arch/sparc64/sparc64/db_disasm.c:1.18 src/sys/arch/sparc64/sparc64/db_disasm.c:1.19
--- src/sys/arch/sparc64/sparc64/db_disasm.c:1.18	Sun Oct  4 08:16:14 2015
+++ src/sys/arch/sparc64/sparc64/db_disasm.c	Tue Apr  6 15:55:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.18 2015/10/04 08:16:14 joerg Exp $ */
+/*	$NetBSD: db_disasm.c,v 1.19 2021/04/06 15:55:26 simonb Exp $ */
 
 /*
  * Copyright (c) 1994 David S. Miller, da...@nadzieja.rutgers.edu
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.18 2015/10/04 08:16:14 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19 2021/04/06 15:55:26 simonb Exp $");
 
 #include 
 #include 
@@ -223,7 +223,7 @@ struct sparc_insn sparc_i[] = {
 	/* Note: if imm22 is zero then this is actually a "nop" grrr... */
 	{(FORMAT2(0, 0x4)), "sethi", "Cd"},
 
-	/* Branch on Integer Co`ndition Codes "Bicc" */
+	/* Branch on Integer Condition Codes "Bicc" */
 	{(FORMAT2(0, 2) | COND(8)), "ba", "a,m"},
 	{(FORMAT2(0, 2) | COND(0)), "bn", "a,m"},
 	{(FORMAT2(0, 2) | COND(9)), "bne", "a,m"},
@@ -1121,4 +1121,3 @@ db_disasm(db_addr_t loc, bool altfmt)
 
 	return (loc + 4);
 }
-



CVS commit: src/sys/conf

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 15:05:12 UTC 2021

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Revert rev 1.278 which tried to call ctfmerge only once - this has
caused kernels with embedded symbol tables to explode in size.


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/sys/conf/Makefile.kern.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/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.279 src/sys/conf/Makefile.kern.inc:1.280
--- src/sys/conf/Makefile.kern.inc:1.279	Mon Apr  5 22:52:03 2021
+++ src/sys/conf/Makefile.kern.inc	Tue Apr  6 15:05:12 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.279 2021/04/05 22:52:03 christos Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.280 2021/04/06 15:05:12 simonb Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -210,6 +210,11 @@ _MD_OBJS=	${MD_OBJS}
 SYSTEM_LIB=	${MD_LIBS} ${LIBKERN}
 SYSTEM_OBJ?=	${_MD_OBJS} ${OBJS} ${SYSTEM_LIB}
 SYSTEM_DEP+=	Makefile ${SYSTEM_OBJ:O}
+.if defined(CTFMERGE)
+SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
+.else
+SYSTEM_CTFMERGE= ${_MKSHECHO}
+.endif
 
 REMOVE_SWAP=   [@]
 .for k in ${KERNELS}
@@ -237,7 +242,7 @@ LINKFLAGS?=	${LINKFORMAT} ${LINKSCRIPT} 
 LINKFLAGS_DEBUG?=	-X
 
 SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \
-		${SIZE} $@ && chmod 755 $@
+		${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@
 SYSTEM_LD_TAIL_DEBUG?=&& \
 		echo mv -f $@ $@.gdb && mv -f $@ $@.gdb && \
 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb && \
@@ -260,11 +265,6 @@ LINKFLAGS+=	${LINKFLAGS_NORMAL}
 SYSTEM_LD_HEAD+=	${SYSTEM_LD_HEAD_EXTRA}
 SYSTEM_LD_TAIL_STAGE1=	${SYSTEM_LD_TAIL}
 SYSTEM_LD_TAIL_STAGE2=	${SYSTEM_LD_TAIL}
-.if defined(CTFMERGE)
-SYSTEM_LD_TAIL_STAGE2+= && echo ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ... \
-			&& ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} \
-			${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
-.endif
 .if defined(COPY_SYMTAB)
 SYSTEM_LD_TAIL_STAGE2+=	&& echo ${DBSYM} $@ && ${DBSYM} $@
 .if !empty(DEBUG:M-g)



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

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 13:11:22 UTC 2021

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

Log Message:
If we're going to print a number in hex, at least put a 0x in front of
it so we can cut'n'paste it into gdb directly.  This has only annoyed
me for 25 or so years...

Wrap a long long while here.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/mips/mips_stacktrace.c

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

Modified files:

Index: src/sys/arch/mips/mips/mips_stacktrace.c
diff -u src/sys/arch/mips/mips/mips_stacktrace.c:1.8 src/sys/arch/mips/mips/mips_stacktrace.c:1.9
--- src/sys/arch/mips/mips/mips_stacktrace.c:1.8	Mon Mar 29 03:09:42 2021
+++ src/sys/arch/mips/mips/mips_stacktrace.c	Tue Apr  6 13:11:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_stacktrace.c,v 1.8 2021/03/29 03:09:42 simonb Exp $	*/
+/*	$NetBSD: mips_stacktrace.c,v 1.9 2021/04/06 13:11:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.8 2021/03/29 03:09:42 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.9 2021/04/06 13:11:22 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -504,10 +504,12 @@ mips3_eret:
 done:
 	if (mask & (1 << _R_RA))
 		ra = regs[_R_RA];
-	(*printfn)("%#"PRIxVADDR": %s+%"PRIxVADDR" (%"PRIxREGISTER",%"PRIxREGISTER",%"PRIxREGISTER",%"PRIxREGISTER") ra %"PRIxVADDR" sz %d\n",
-		sp, fn_name(subr), pc - subr,
-		regs[_R_A0], regs[_R_A1], regs[_R_A2], regs[_R_A3],
-		ra, stksize);
+	(*printfn)("%#"PRIxVADDR": %s+%#"PRIxVADDR" (%#"PRIxREGISTER","
+	"%#"PRIxREGISTER",%#"PRIxREGISTER",%#"PRIxREGISTER") "
+	"ra %#"PRIxVADDR" sz %d\n",
+	sp, fn_name(subr), pc - subr,
+	regs[_R_A0], regs[_R_A1], regs[_R_A2], regs[_R_A3],
+	ra, stksize);
 
 	if (ra) {
 		if (pc == ra && stksize == 0)



CVS commit: src/external/cddl/osnet/dev/dtrace

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 12:48:59 UTC 2021

Modified Files:
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_subr.c
src/external/cddl/osnet/dev/dtrace/arm: dtrace_subr.c
src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c

Log Message:
sizeof(*var) instead of sizeof(type)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c

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

Modified files:

Index: src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.14 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.15
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.14	Fri Nov  8 11:06:21 2019
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c	Tue Apr  6 12:48:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.14 2019/11/08 11:06:21 hannken Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.15 2021/04/06 12:48:59 simonb Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -78,7 +78,7 @@ dtrace_invop_add(int (*func)(uintptr_t, 
 {
 	dtrace_invop_hdlr_t *hdlr;
 
-	hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP);
+	hdlr = kmem_alloc(sizeof(*hdlr), KM_SLEEP);
 	hdlr->dtih_func = func;
 	hdlr->dtih_next = dtrace_invop_hdlr;
 	dtrace_invop_hdlr = hdlr;
@@ -108,7 +108,7 @@ dtrace_invop_remove(int (*func)(uintptr_
 		prev->dtih_next = hdlr->dtih_next;
 	}
 
-	kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t));
+	kmem_free(hdlr, sizeof(*hdlr));
 }
 
 /*ARGSUSED*/

Index: src/external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c:1.4 src/external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c:1.5
--- src/external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c:1.4	Mon May 28 21:05:03 2018
+++ src/external/cddl/osnet/dev/dtrace/arm/dtrace_subr.c	Tue Apr  6 12:48:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.4 2018/05/28 21:05:03 chs Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.5 2021/04/06 12:48:59 simonb Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -94,7 +94,7 @@ dtrace_invop_add(int (*func)(uintptr_t, 
 {
 	dtrace_invop_hdlr_t *hdlr;
 
-	hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP);
+	hdlr = kmem_alloc(sizeof(*hdlr), KM_SLEEP);
 	hdlr->dtih_func = func;
 	hdlr->dtih_next = dtrace_invop_hdlr;
 	dtrace_invop_hdlr = hdlr;
@@ -124,7 +124,7 @@ dtrace_invop_remove(int (*func)(uintptr_
 		prev->dtih_next = hdlr->dtih_next;
 	}
 
-	kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t));
+	kmem_free(hdlr, sizeof(*hdlr));
 }
 
 /*ARGSUSED*/

Index: src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.12 src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.13
--- src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.12	Wed Feb 13 08:46:40 2019
+++ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c	Tue Apr  6 12:48:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.12 2019/02/13 08:46:40 rin Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.13 2021/04/06 12:48:59 simonb Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -86,7 +86,7 @@ dtrace_invop_add(int (*func)(uintptr_t, 
 {
 	dtrace_invop_hdlr_t *hdlr;
 
-	hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP);
+	hdlr = kmem_alloc(sizeof(*hdlr), KM_SLEEP);
 	hdlr->dtih_func = func;
 	hdlr->dtih_next = dtrace_invop_hdlr;
 	dtrace_invop_hdlr = hdlr;
@@ -116,7 +116,7 @@ dtrace_invop_remove(int (*func)(uintptr_
 		prev->dtih_next = hdlr->dtih_next;
 	}
 
-	kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t));
+	kmem_free(hdlr, sizeof(*hdlr));
 }
 
 void



CVS commit: src/external/cddl/osnet/dev/dtrace/aarch64

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 12:48:36 UTC 2021

Modified Files:
src/external/cddl/osnet/dev/dtrace/aarch64: dtrace_subr.c

Log Message:
sizeof(*var) instead of sizeof(type)
Call kmem_free() with size of data being freed.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c

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

Modified files:

Index: src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.4 src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.5
--- src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c:1.4	Thu Nov 12 02:15:56 2020
+++ src/external/cddl/osnet/dev/dtrace/aarch64/dtrace_subr.c	Tue Apr  6 12:48:36 2021
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dtrace_subr.c,v 1.4 2020/11/12 02:15:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtrace_subr.c,v 1.5 2021/04/06 12:48:36 simonb Exp $");
 
 #include 
 #include 
@@ -87,7 +87,7 @@ dtrace_invop_add(int (*func)(uintptr_t, 
 {
 	dtrace_invop_hdlr_t *hdlr;
 
-	hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP);
+	hdlr = kmem_alloc(sizeof(*hdlr), KM_SLEEP);
 	hdlr->dtih_func = func;
 	hdlr->dtih_next = dtrace_invop_hdlr;
 	dtrace_invop_hdlr = hdlr;
@@ -120,7 +120,7 @@ dtrace_invop_remove(int (*func)(uintptr_
 		prev->dtih_next = hdlr->dtih_next;
 	}
 
-	kmem_free(hdlr, 0);
+	kmem_free(hdlr, sizeof(*hdlr));
 }
 
 /*ARGSUSED*/



CVS commit: src/external/cddl/osnet/dev/dtrace/mips

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 08:19:15 UTC 2021

Modified Files:
src/external/cddl/osnet/dev/dtrace/mips: dtrace_subr.c

Log Message:
Call kmem_free() with the size of the thing we are freeing.  Fixes panic
when unloading the ktrace module on MIPS.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/cddl/osnet/dev/dtrace/mips/dtrace_subr.c

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

Modified files:

Index: src/external/cddl/osnet/dev/dtrace/mips/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/mips/dtrace_subr.c:1.1 src/external/cddl/osnet/dev/dtrace/mips/dtrace_subr.c:1.2
--- src/external/cddl/osnet/dev/dtrace/mips/dtrace_subr.c:1.1	Mon Mar 29 05:17:09 2021
+++ src/external/cddl/osnet/dev/dtrace/mips/dtrace_subr.c	Tue Apr  6 08:19:15 2021
@@ -121,7 +121,7 @@ dtrace_invop_remove(int (*func)(uintptr_
 		prev->dtih_next = hdlr->dtih_next;
 	}
 
-	kmem_free(hdlr, 0);
+	kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t));
 }
 
 /*ARGSUSED*/



CVS commit: src/sys/kern

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 07:57:03 UTC 2021

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

Log Message:
Check the CTF magic number in an endian friendly way (and don't use
magic numbers to check the magic number!).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/kern_ctf.c

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

Modified files:

Index: src/sys/kern/kern_ctf.c
diff -u src/sys/kern/kern_ctf.c:1.7 src/sys/kern/kern_ctf.c:1.8
--- src/sys/kern/kern_ctf.c:1.7	Mon May 28 21:05:00 2018
+++ src/sys/kern/kern_ctf.c	Tue Apr  6 07:57:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ctf.c,v 1.7 2018/05/28 21:05:00 chs Exp $	*/
+/*	$NetBSD: kern_ctf.c,v 1.8 2021/04/06 07:57:03 simonb Exp $	*/
 /*-
  * Copyright (c) 2008 John Birrell 
  * All rights reserved.
@@ -81,6 +81,7 @@ mod_ctf_get(struct module *mod, mod_ctf_
 
 	void *ctfbuf = NULL;
 	uint8_t *ctfaddr;
+	uint16_t ctfmagic;
 	size_t ctfsize;
 
 	/*
@@ -137,8 +138,9 @@ mod_ctf_get(struct module *mod, mod_ctf_
 		goto out;
 	}
 
-	/* Check the CTF magic number. (XXX check for big endian!) */
-	if (ctfaddr[0] != 0xf1 || ctfaddr[1] != 0xcf) {
+	/* Check the CTF magic number. */
+	memcpy(, ctfaddr, sizeof ctfmagic);
+	if (ctfmagic != CTF_MAGIC) {
 		error = EINVAL;
 		goto out;
 	}



CVS commit: src/sys/sys

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 07:56:10 UTC 2021

Modified Files:
src/sys/sys: kern_ctf.h

Log Message:
Define the CTF ELF section header magic number.


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

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

Modified files:

Index: src/sys/sys/kern_ctf.h
diff -u src/sys/sys/kern_ctf.h:1.2 src/sys/sys/kern_ctf.h:1.3
--- src/sys/sys/kern_ctf.h:1.2	Mon May 28 21:05:02 2018
+++ src/sys/sys/kern_ctf.h	Tue Apr  6 07:56:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ctf.h,v 1.2 2018/05/28 21:05:02 chs Exp $	*/
+/*	$NetBSD: kern_ctf.h,v 1.3 2021/04/06 07:56:10 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
 #ifndef _SYS_CTF_H_
 #define	_SYS_CTF_H_
 
+#define	CTF_MAGIC	0xcff1	/* magic number identifying header */
+
 /*
  * Modules CTF section
  */



CVS commit: src/bin/ps

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 05:13:24 UTC 2021

Modified Files:
src/bin/ps: print.c

Log Message:
Fix the column width calculation for the lstart column if an empty
column header is specified.

Fixes bug pointed out by Ted Spradley in
https://mail-index.netbsd.org/netbsd-users/2021/04/05/msg026808.html .


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/bin/ps/print.c

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

Modified files:

Index: src/bin/ps/print.c
diff -u src/bin/ps/print.c:1.132 src/bin/ps/print.c:1.133
--- src/bin/ps/print.c:1.132	Wed Jun 19 21:25:50 2019
+++ src/bin/ps/print.c	Tue Apr  6 05:13:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.132 2019/06/19 21:25:50 kamil Exp $	*/
+/*	$NetBSD: print.c,v 1.133 2021/04/06 05:13:24 simonb Exp $	*/
 
 /*
  * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)print.c	8.6 (Berkeley) 4/16/94";
 #else
-__RCSID("$NetBSD: print.c,v 1.132 2019/06/19 21:25:50 kamil Exp $");
+__RCSID("$NetBSD: print.c,v 1.133 2021/04/06 05:13:24 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -815,22 +815,33 @@ lstarted(struct pinfo *pi, VARENT *ve, e
 	char buf[100];
 
 	v = ve->var;
-	if (!k->p_uvalid) {
+	startt = k->p_ustart_sec;
+
+	if (mode == WIDTHMODE) {
 		/*
-		 * Minimum width is less than header - we don't
-		 * need to check it every time.
+		 * We only need to set the width once, as we assume
+		 * that all times are the same length.  We do need to
+		 * check against the header length as well, as "no
+		 * header" mode for this variable will set the field
+		 * width to the length of the header anyway (ref: the
+		 * P1003.1-2004 comment in findvar()).
+		 *
+		 * XXX: The hardcoded "STARTED" string.  Better or
+		 * worse than a "<= 7" or some other arbitary number?
 		 */
-		if (mode == PRINTMODE)
+		if (v->width <= (int)strlen("STARTED")) {
+			(void)strftime(buf, sizeof(buf) -1, "%c",
+			localtime());
+			strprintorsetwidth(v, buf, mode);
+		}
+	} else {
+		if (!k->p_uvalid) {
 			(void)printf("%*s", v->width, "-");
-		return;
-	}
-	startt = k->p_ustart_sec;
-
-	/* assume all times are the same length */
-	if (mode != WIDTHMODE || v->width == 0) {
-		(void)strftime(buf, sizeof(buf) -1, "%c",
-		localtime());
-		strprintorsetwidth(v, buf, mode);
+		} else {
+			(void)strftime(buf, sizeof(buf) -1, "%c",
+			localtime());
+			strprintorsetwidth(v, buf, mode);
+		}
 	}
 }
 



CVS commit: src/bin/ps

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 04:49:41 UTC 2021

Modified Files:
src/bin/ps: Makefile

Log Message:
We only need -Wno-format-y2k for print.c .


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/ps/Makefile

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

Modified files:

Index: src/bin/ps/Makefile
diff -u src/bin/ps/Makefile:1.29 src/bin/ps/Makefile:1.30
--- src/bin/ps/Makefile:1.29	Sun Aug 14 10:53:17 2011
+++ src/bin/ps/Makefile	Tue Apr  6 04:49:41 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.29 2011/08/14 10:53:17 christos Exp $
+#	$NetBSD: Makefile,v 1.30 2021/04/06 04:49:41 simonb Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/2/93
 
 PROG=		ps
@@ -6,7 +6,6 @@ SRCS=		fmt.c keyword.c nlist.c print.c p
 DPADD=		${LIBM} ${LIBKVM}
 LDADD=		-lm -lkvm
 
-CWARNFLAGS+=	-Wno-format-y2k
-COPTS.print.c = -Wno-format-nonliteral
+COPTS.print.c = -Wno-format-nonliteral -Wno-format-y2k
 
 .include 



CVS commit: src/sys/arch/mips

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 07:28:19 UTC 2021

Modified Files:
src/sys/arch/mips/include: mips_opcode.h
src/sys/arch/mips/mips: db_disasm.c

Log Message:
Some QED instructions are included in MIPS32 and MIPS64 instruction sets.
Update a few comments.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/include/mips_opcode.h
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/include/mips_opcode.h
diff -u src/sys/arch/mips/include/mips_opcode.h:1.25 src/sys/arch/mips/include/mips_opcode.h:1.26
--- src/sys/arch/mips/include/mips_opcode.h:1.25	Mon Apr  5 07:00:06 2021
+++ src/sys/arch/mips/include/mips_opcode.h	Mon Apr  5 07:28:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_opcode.h,v 1.25 2021/04/05 07:00:06 simonb Exp $	*/
+/*	$NetBSD: mips_opcode.h,v 1.26 2021/04/05 07:28:19 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -169,7 +169,7 @@ typedef union {
 #define	OP_LDL		032		/* MIPS-II, for r4000 port */
 #define	OP_LDR		033		/* MIPS-II, for r4000 port */
 
-#define	OP_SPECIAL2	034		/* QED opcodes */
+#define	OP_SPECIAL2	034		/* QED and MIPS32/MIPS64 opcodes */
 #define	OP_JALX		035
 #define	OP_MDMX		036
 #define	OP_SPECIAL3	037
@@ -303,9 +303,9 @@ typedef union {
 /*
  * Values for the 'func' field when 'op' == OP_SPECIAL2.
  */
-#define	OP_MADD		000		/* QED */
-#define	OP_MADDU	001		/* QED */
-#define	OP_MUL		002		/* QED */
+#define	OP_MADD		000		/* QED, MIPS32/64 */
+#define	OP_MADDU	001		/* QED, MIPS32/64 */
+#define	OP_MUL		002		/* QED, MIPS32/64 */
 #define	OP_CVM_DMUL	003		/* OCTEON */
 #define	OP_MSUB		004		/* MIPS32/64 */
 #define	OP_MSUBU	005		/* MIPS32/64 */

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.39 src/sys/arch/mips/mips/db_disasm.c:1.40
--- src/sys/arch/mips/mips/db_disasm.c:1.39	Mon Apr  5 07:27:11 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 07:28:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.39 2021/04/05 07:27:11 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.40 2021/04/05 07:28:19 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.39 2021/04/05 07:27:11 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.40 2021/04/05 07:28:19 simonb Exp $");
 
 #include 
 #include 
@@ -80,7 +80,7 @@ static const char * const spec_name[64] 
 /*56 */ "dsll","spec71","dsrl","dsra","dsll32","spec75","dsrl32","dsra32"
 };
 
-static const char * const spec2_name[64] = {	/* QED RM4650, R5000, etc. */
+static const char * const spec2_name[64] = {	/* QED, MIPS32/64, etc. */
 	[OP_MADD] = "madd",
 	[OP_MADDU] = "maddu",
 	[OP_MUL] = "mul",



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

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 07:27:11 UTC 2021

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

Log Message:
Fix cut'n'paste typo - OP_CVM_DMUL is dmul, not baddu.


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

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.38 src/sys/arch/mips/mips/db_disasm.c:1.39
--- src/sys/arch/mips/mips/db_disasm.c:1.38	Mon Apr  5 07:00:06 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 07:27:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.38 2021/04/05 07:00:06 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.39 2021/04/05 07:27:11 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.38 2021/04/05 07:00:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.39 2021/04/05 07:27:11 simonb Exp $");
 
 #include 
 #include 
@@ -85,7 +85,7 @@ static const char * const spec2_name[64]
 	[OP_MADDU] = "maddu",
 	[OP_MUL] = "mul",
 #ifdef __OCTEON__
-	[OP_CVM_DMUL] = "baddu",
+	[OP_CVM_DMUL] = "dmul",
 #endif
 	[OP_MSUB] = "msub",
 	[OP_MSUBU] = "msubu",



CVS commit: src/sys/arch/mips

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 07:00:06 UTC 2021

Modified Files:
src/sys/arch/mips/include: mips_opcode.h
src/sys/arch/mips/mips: db_disasm.c

Log Message:
Tidy up NOP disassembly, handle "pause" as well.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mips/include/mips_opcode.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/include/mips_opcode.h
diff -u src/sys/arch/mips/include/mips_opcode.h:1.24 src/sys/arch/mips/include/mips_opcode.h:1.25
--- src/sys/arch/mips/include/mips_opcode.h:1.24	Mon Aug 17 03:14:08 2020
+++ src/sys/arch/mips/include/mips_opcode.h	Mon Apr  5 07:00:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_opcode.h,v 1.24 2020/08/17 03:14:08 mrg Exp $	*/
+/*	$NetBSD: mips_opcode.h,v 1.25 2021/04/05 07:00:06 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -292,6 +292,15 @@ typedef union {
 #define	OP_DSRA32	077		/* MIPS-II, for r4000 port */
 
 /*
+ * Subvalues for SLL where the source and destination registers
+ * are both zero.
+ */
+#define	OP_SLL_NOP	0
+#define	OP_SLL_SSNOP	1
+#define	OP_SLL_EHB	3
+#define	OP_SLL_PAUSE	5
+
+/*
  * Values for the 'func' field when 'op' == OP_SPECIAL2.
  */
 #define	OP_MADD		000		/* QED */

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.37 src/sys/arch/mips/mips/db_disasm.c:1.38
--- src/sys/arch/mips/mips/db_disasm.c:1.37	Mon Apr  5 06:38:01 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 07:00:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.38 2021/04/05 07:00:06 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.38 2021/04/05 07:00:06 simonb Exp $");
 
 #include 
 #include 
@@ -265,18 +265,32 @@ db_disasm_insn(int insn, db_addr_t loc, 
 	switch (i.JType.op) {
 	case OP_SPECIAL: {
 		const char *name = spec_name[i.RType.func];
-		if (i.word == 0) {
-			db_printf("nop");
-			break;
-		}
-		if (i.word == (1 << 6)) {
-			db_printf("ssnop");
-			break;
-		}
-		if (i.word == (3 << 6)) {
-			db_printf("ehb");
+
+		/* Handle varations of NOPs */
+		if ((i.RType.func == OP_SLL) &&
+		(i.RType.rs == 0) &&
+		(i.RType.rt == 0) &&
+		(i.RType.rd == 0)) {
+			switch (i.RType.shamt) {
+			case OP_SLL_NOP:
+db_printf("nop");
+break;
+			case OP_SLL_SSNOP:
+db_printf("ssnop");
+break;
+			case OP_SLL_EHB:
+db_printf("ehb");
+break;
+			case OP_SLL_PAUSE:
+db_printf("pause");
+break;
+			default:
+db_printf("nop *");	/* "undefined" NOP */
+break;
+			}
 			break;
 		}
+
 		/*
 		 * The following are equivalents of a "move dst,src":
 		 *	addu	dst,src,zero	(in 32-bit mode)
@@ -296,6 +310,7 @@ db_disasm_insn(int insn, db_addr_t loc, 
 			reg_name[i.RType.rs]);
 			break;
 		}
+
 		if ((i.RType.func == OP_SRL || i.RType.func == OP_SRLV)
 		&& i.RType.rs == 1) {
 			name = (i.RType.func == OP_SRL) ? "rotr" : "rotrv";



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

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 06:38:01 UTC 2021

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

Log Message:
gcc/gas also emits "or ...,zero" as well as "addu/daddu ...,zero" for a
"move" pseudo instruction.  Disassemble the "or" case as a "move" too.


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

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.36 src/sys/arch/mips/mips/db_disasm.c:1.37
--- src/sys/arch/mips/mips/db_disasm.c:1.36	Mon Apr  5 06:35:04 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 06:38:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $");
 
 #include 
 #include 
@@ -277,16 +277,19 @@ db_disasm_insn(int insn, db_addr_t loc, 
 			db_printf("ehb");
 			break;
 		}
-		/* XXX
-		 * "addu" is a "move" only in 32-bit mode.  What's the correct
-		 * answer - never decode addu/daddu as "move"?
+		/*
+		 * The following are equivalents of a "move dst,src":
+		 *	addu	dst,src,zero	(in 32-bit mode)
+		 *	daddu	dst,src,zero	(in 64-bit mode)
+		 *	or	dst,src,zero	(in 32- and 64-bit modes)
 		 */
-		if (true
 #ifdef __mips_o32
-		&& i.RType.func == OP_ADDU
+#define	OP_MOVE_ADDU	OP_ADDU
 #else
-		&& i.RType.func == OP_DADDU
+#define	OP_MOVE_ADDU	OP_DADDU
 #endif
+		if (true &&
+		((i.RType.func == OP_OR) || (i.RType.func == OP_MOVE_ADDU))
 		&& i.RType.rt == 0) {
 			db_printf("move\t%s,%s",
 			reg_name[i.RType.rd],



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

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 06:35:04 UTC 2021

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

Log Message:
Allow disassembly in XKSEG for LP64 kernels.  Can now x/i on modules
with an N64 kernel.


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

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.35 src/sys/arch/mips/mips/db_disasm.c:1.36
--- src/sys/arch/mips/mips/db_disasm.c:1.35	Mon Apr  5 06:28:31 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 06:35:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.35 2021/04/05 06:28:31 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.35 2021/04/05 06:28:31 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $");
 
 #include 
 #include 
@@ -218,6 +218,11 @@ static void print_addr(db_addr_t);
  * "next instruction" does NOT mean the next instruction to
  * be executed but the 'linear' next instruction.
  */
+#ifdef _LP64
+#define	DISASM_KERN_START	MIPS_XKSEG_START
+#else
+#define	DISASM_KERN_START	MIPS_KSEG0_START
+#endif
 db_addr_t
 db_disasm(db_addr_t loc, bool altfmt)
 {
@@ -225,9 +230,10 @@ db_disasm(db_addr_t loc, bool altfmt)
 
 	/*
 	 * Take some care with addresses to not UTLB here as it
-	 * loses the current debugging context.  KSEG2 not checked.
+	 * loses the current debugging context.  KSEG2 and XKSEG
+	 * are not checked.
 	 */
-	if (loc < (db_addr_t)MIPS_KSEG0_START) {
+	if (loc < (db_addr_t)DISASM_KERN_START) {
 #ifdef _KERNEL
 		if (ufetch_32((void *)loc, ) != 0) {
 			db_printf("invalid address.\n");



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

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 06:28:31 UTC 2021

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

Log Message:
For bc{0,1,2}{t,f} check for the TRUE value not the MASK value (even
though they're the same).


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

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.34 src/sys/arch/mips/mips/db_disasm.c:1.35
--- src/sys/arch/mips/mips/db_disasm.c:1.34	Tue Mar 16 07:34:44 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 06:28:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.34 2021/03/16 07:34:44 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.35 2021/04/05 06:28:31 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.34 2021/03/16 07:34:44 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.35 2021/04/05 06:28:31 simonb Exp $");
 
 #include 
 #include 
@@ -593,7 +593,7 @@ db_disasm_insn(int insn, db_addr_t loc, 
 		case OP_BCy:
 
 			db_printf("bc0%c\t",
-			"ft"[i.RType.rt & COPz_BC_TF_MASK]);
+			"ft"[i.RType.rt & COPz_BC_TRUE]);
 			goto pr_displ;
 
 		case OP_MT:
@@ -644,7 +644,7 @@ db_disasm_insn(int insn, db_addr_t loc, 
 		case OP_BCx:
 		case OP_BCy:
 			db_printf("bc1%c\t",
-			"ft"[i.RType.rt & COPz_BC_TF_MASK]);
+			"ft"[i.RType.rt & COPz_BC_TRUE]);
 			goto pr_displ;
 
 		case OP_MT:
@@ -708,7 +708,7 @@ db_disasm_insn(int insn, db_addr_t loc, 
 		case OP_BCx:
 		case OP_BCy:
 			db_printf("bc2%c\t",
-			"ft"[i.RType.rt & COPz_BC_TF_MASK]);
+			"ft"[i.RType.rt & COPz_BC_TRUE]);
 			goto pr_displ;
 
 		case OP_MT:



CVS commit: src/sys/conf

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 06:22:00 UTC 2021

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Move the ctfmerge call from SYSTEM_LD_TAIL (used by both STAGE1 and STAGE2)
to SYSTEM_LD_TAIL_STAGE2 only.  ctfmerge is slow enough that just calling
it once is enough.


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/sys/conf/Makefile.kern.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/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.277 src/sys/conf/Makefile.kern.inc:1.278
--- src/sys/conf/Makefile.kern.inc:1.277	Sun Jan 31 23:17:21 2021
+++ src/sys/conf/Makefile.kern.inc	Mon Apr  5 06:22:00 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.277 2021/01/31 23:17:21 rillig Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.278 2021/04/05 06:22:00 simonb Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -210,11 +210,6 @@ _MD_OBJS=	${MD_OBJS}
 SYSTEM_LIB=	${MD_LIBS} ${LIBKERN}
 SYSTEM_OBJ?=	${_MD_OBJS} ${OBJS} ${SYSTEM_LIB}
 SYSTEM_DEP+=	Makefile ${SYSTEM_OBJ:O}
-.if defined(CTFMERGE)
-SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
-.else
-SYSTEM_CTFMERGE= ${_MKSHECHO}
-.endif
 
 REMOVE_SWAP=   [@]
 .for k in ${KERNELS}
@@ -242,7 +237,7 @@ LINKFLAGS?=	${LINKFORMAT} ${LINKSCRIPT} 
 LINKFLAGS_DEBUG?=	-X
 
 SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \
-		${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@
+		${SIZE} $@ && chmod 755 $@
 SYSTEM_LD_TAIL_DEBUG?=&& \
 		echo mv -f $@ $@.gdb && mv -f $@ $@.gdb && \
 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb && \
@@ -265,6 +260,11 @@ LINKFLAGS+=	${LINKFLAGS_NORMAL}
 SYSTEM_LD_HEAD+=	${SYSTEM_LD_HEAD_EXTRA}
 SYSTEM_LD_TAIL_STAGE1=	${SYSTEM_LD_TAIL}
 SYSTEM_LD_TAIL_STAGE2=	${SYSTEM_LD_TAIL}
+.if defined(CTFMERGE)
+SYSTEM_LD_TAIL_STAGE2+= && echo ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ... \
+			&& time -t ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} \
+			${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
+.endif
 .if defined(COPY_SYMTAB)
 SYSTEM_LD_TAIL_STAGE2+=	&& echo ${DBSYM} $@ && ${DBSYM} $@
 .if !empty(DEBUG:M-g)



CVS commit: src/sys/kern

2021-04-04 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 05:47:32 UTC 2021

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

Log Message:
Don't call strncmp() where the length arg is the size of a pointer
instead of the max string length.  Switch to strcmp() - both strings
are known nul-terminated.

Thanks tnn@ (and clang!).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_hash.c

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

Modified files:

Index: src/sys/kern/subr_hash.c
diff -u src/sys/kern/subr_hash.c:1.8 src/sys/kern/subr_hash.c:1.9
--- src/sys/kern/subr_hash.c:1.8	Thu Apr  1 06:22:09 2021
+++ src/sys/kern/subr_hash.c	Mon Apr  5 05:47:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_hash.c,v 1.8 2021/04/01 06:22:09 simonb Exp $	*/
+/*	$NetBSD: subr_hash.c,v 1.9 2021/04/05 05:47:31 simonb Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.8 2021/04/01 06:22:09 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.9 2021/04/05 05:47:31 simonb Exp $");
 
 #include 
 #include 
@@ -222,8 +222,7 @@ hashstat_sysctl(SYSCTLFN_ARGS)
 	sysctl_unlock();
 	rw_enter(_lock, RW_READER);
 	TAILQ_FOREACH(hash, _list, hs_next) {
-		if (query &&
-		(strncmp(hash->hs_name, queryname, sizeof(hash->hs_name)) != 0)) {
+		if (query && (strcmp(hash->hs_name, queryname) != 0)) {
 			continue;
 		}
 



CVS commit: src/usr.sbin/makefs

2021-04-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 14:10:56 UTC 2021

Modified Files:
src/usr.sbin/makefs: makefs.8 makefs.c makefs.h walk.c

Log Message:
Add a -L option to follow all symbolic links.  Useful if you have symlinks
in a makefs directory tree but want to refer to the actual file.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/walk.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.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.66 src/usr.sbin/makefs/makefs.8:1.67
--- src/usr.sbin/makefs/makefs.8:1.66	Sun Nov 15 00:18:48 2020
+++ src/usr.sbin/makefs/makefs.8	Sat Apr  3 14:10:56 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: makefs.8,v 1.66 2020/11/15 00:18:48 jmcneill Exp $
+.\"	$NetBSD: makefs.8,v 1.67 2021/04/03 14:10:56 simonb Exp $
 .\"
 .\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 14, 2020
+.Dd April 4, 2021
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .Nd create a file system image from a directory tree
 .Sh SYNOPSIS
 .Nm
-.Op Fl rxZ
+.Op Fl LrxZ
 .Op Fl B Ar endian
 .Op Fl b Ar free-blocks
 .Op Fl d Ar debug-mask
@@ -158,6 +158,8 @@ An optional
 suffix may be provided to indicate that
 .Ar free-files
 indicates a percentage of the calculated image size.
+.It Fl L
+All symbolic links are followed.
 .It Fl M Ar minimum-size
 Set the minimum size of the file system image to
 .Ar minimum-size .

Index: src/usr.sbin/makefs/makefs.c
diff -u src/usr.sbin/makefs/makefs.c:1.53 src/usr.sbin/makefs/makefs.c:1.54
--- src/usr.sbin/makefs/makefs.c:1.53	Fri Nov 27 15:10:32 2015
+++ src/usr.sbin/makefs/makefs.c	Sat Apr  3 14:10:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.c,v 1.53 2015/11/27 15:10:32 joerg Exp $	*/
+/*	$NetBSD: makefs.c,v 1.54 2021/04/03 14:10:56 simonb Exp $	*/
 
 /*
  * Copyright (c) 2001-2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: makefs.c,v 1.53 2015/11/27 15:10:32 joerg Exp $");
+__RCSID("$NetBSD: makefs.c,v 1.54 2021/04/03 14:10:56 simonb Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -129,7 +129,7 @@ main(int argc, char *argv[])
 		err(1, "Unable to get system time");
 
 
-	while ((ch = getopt(argc, argv, "B:b:d:f:F:M:m:N:O:o:rs:S:t:T:xZ")) != -1) {
+	while ((ch = getopt(argc, argv, "B:b:d:f:F:LM:m:N:O:o:rs:S:t:T:xZ")) != -1) {
 		switch (ch) {
 
 		case 'B':
@@ -187,6 +187,10 @@ main(int argc, char *argv[])
 			specfile = optarg;
 			break;
 
+		case 'L':
+			fsoptions.follow = true;
+			break;
+
 		case 'M':
 			fsoptions.minsize =
 			strsuftoll("minimum size", optarg, 1LL, LLONG_MAX);
@@ -286,7 +290,8 @@ main(int argc, char *argv[])
 
 /* walk the tree */
 	TIMER_START(start);
-	root = walk_dir(argv[1], ".", NULL, NULL, fsoptions.replace);
+	root = walk_dir(argv[1], ".", NULL, NULL, fsoptions.replace,
+	fsoptions.follow);
 	TIMER_RESULTS(start, "walk_dir");
 
 	/* append extra directory */
@@ -297,7 +302,8 @@ main(int argc, char *argv[])
 		if (!S_ISDIR(sb.st_mode))
 			errx(1, "%s: not a directory", argv[i]);
 		TIMER_START(start);
-		root = walk_dir(argv[i], ".", NULL, root, fsoptions.replace);
+		root = walk_dir(argv[i], ".", NULL, root, fsoptions.replace,
+		fsoptions.follow);
 		TIMER_RESULTS(start, "walk_dir2");
 	}
 

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.36 src/usr.sbin/makefs/makefs.h:1.37
--- src/usr.sbin/makefs/makefs.h:1.36	Wed Nov 25 00:48:49 2015
+++ src/usr.sbin/makefs/makefs.h	Sat Apr  3 14:10:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.h,v 1.36 2015/11/25 00:48:49 christos Exp $	*/
+/*	$NetBSD: makefs.h,v 1.37 2021/04/03 14:10:56 simonb Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -166,6 +166,7 @@ typedef struct makefs_fsinfo {
 	int	sectorsize;	/* sector size */
 	int	sparse;		/* sparse image, don't fill it with zeros */
 	int	replace;	/* replace files when merging */
+	int	follow;		/* follow symlinks */
 
 	void	*fs_specific;	/* File system specific additions. */
 	option_t *fs_options;	/* File system specific options */
@@ -180,7 +181,8 @@ const char *	inode_type(mode_t);
 int		set_option(const option_t *, const char *, char *, size_t);
 int		set_option_var(const option_t *, const char *, const char *,
 char *, size_t);
-fsnode *	walk_dir(const char *, const char *, fsnode *, fsnode *, int);
+fsnode *	walk_dir(const char *, const char *, fsnode *, fsnode *, int,
+int);
 void		free_fsnodes(fsnode *);
 option_t *	copy_opts(const option_t *);
 

Index: src/usr.sbin/makefs/walk.c
diff -u 

CVS commit: src/usr.sbin/mtree

2021-04-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 13:37:18 UTC 2021

Modified Files:
src/usr.sbin/mtree: compare.c

Log Message:
Deal with the case when a device gets recreated (eg when mtree is called by
MAKEDEV) and the stat buffer contains information about the original device
before checking/setting the owner/group/mode of the new device file.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/mtree/compare.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.sbin/mtree/compare.c
diff -u src/usr.sbin/mtree/compare.c:1.59 src/usr.sbin/mtree/compare.c:1.60
--- src/usr.sbin/mtree/compare.c:1.59	Thu Mar 18 20:02:18 2021
+++ src/usr.sbin/mtree/compare.c	Sat Apr  3 13:37:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: compare.c,v 1.59 2021/03/18 20:02:18 cheusov Exp $	*/
+/*	$NetBSD: compare.c,v 1.60 2021/04/03 13:37:18 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)compare.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: compare.c,v 1.59 2021/03/18 20:02:18 cheusov Exp $");
+__RCSID("$NetBSD: compare.c,v 1.60 2021/04/03 13:37:18 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -137,6 +137,7 @@ compare(NODE *s, FTSENT *p)
 {
 	uint32_t len, val, flags;
 	int fd, label;
+	bool was_unlinked;
 	const char *cp, *tab;
 #if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2)
 	char *digestbuf;
@@ -144,6 +145,7 @@ compare(NODE *s, FTSENT *p)
 
 	tab = NULL;
 	label = 0;
+	was_unlinked = false;
 	switch(s->type) {
 	case F_BLOCK:
 		if (!S_ISBLK(p->fts_statp->st_mode))
@@ -210,19 +212,22 @@ typeerr:		LABEL;
 			  s->st_mode | nodetoino(s->type),
 			  s->st_rdev) == -1) ||
 			(lchown(p->fts_accpath, p->fts_statp->st_uid,
-			  p->fts_statp->st_gid) == -1) )
+			  p->fts_statp->st_gid) == -1) ) {
 printf(", not modified: %s%s\n",
 strerror(errno),
 flavor == F_FREEBSD9 ? "" : ")");
-			 else
+			} else {
 printf(", modified%s\n",
 flavor == F_FREEBSD9 ? "" : ")");
+was_unlinked = true;
+			}
 		} else
 			printf(")\n");
 		tab = "\t";
 	}
 	/* Set the uid/gid first, then set the mode. */
-	if (s->flags & (F_UID | F_UNAME) && s->st_uid != p->fts_statp->st_uid) {
+	if (s->flags & (F_UID | F_UNAME) &&
+	(was_unlinked || s->st_uid != p->fts_statp->st_uid)) {
 		LABEL;
 		printf(flavor == F_FREEBSD9 ?
 		"%suser expected %lu found %lu" : "%suser (%lu, %lu",
@@ -233,13 +238,15 @@ typeerr:		LABEL;
 strerror(errno),
 flavor == F_FREEBSD9 ? "" : ")");
 			else
-printf(", modified%s\n",
+printf(", modified%s%s\n",
+was_unlinked ? " by unlink" : "",
 flavor == F_FREEBSD9 ? "" : ")");
 		} else
 			printf(")\n");
 		tab = "\t";
 	}
-	if (s->flags & (F_GID | F_GNAME) && s->st_gid != p->fts_statp->st_gid) {
+	if (s->flags & (F_GID | F_GNAME) &&
+	(was_unlinked || s->st_gid != p->fts_statp->st_gid)) {
 		LABEL;
 		printf(flavor == F_FREEBSD9 ?
 		"%sgid expected %lu found %lu" : "%sgid (%lu, %lu",
@@ -250,7 +257,8 @@ typeerr:		LABEL;
 strerror(errno),
 flavor == F_FREEBSD9 ? "" : ")");
 			else
-printf(", modified%s\n",
+printf(", modified%s%s\n",
+was_unlinked ? " by unlink" : "",
 flavor == F_FREEBSD9 ? "" : ")");
 		}
 		else
@@ -258,8 +266,8 @@ typeerr:		LABEL;
 		tab = "\t";
 	}
 	if (s->flags & F_MODE &&
-	s->st_mode != (p->fts_statp->st_mode & MBITS)) {
-		if (lflag) {
+	(was_unlinked || s->st_mode != (p->fts_statp->st_mode & MBITS))) {
+		if (lflag && !was_unlinked) {
 			mode_t tmode, mode;
 
 			tmode = s->st_mode;
@@ -287,7 +295,8 @@ typeerr:		LABEL;
 strerror(errno),
 flavor == F_FREEBSD9 ? "" : ")");
 			else
-printf(", modified%s\n",
+printf(", modified%s%s\n",
+was_unlinked ? " by unlink" : "",
 flavor == F_FREEBSD9 ? "" : ")");
 		}
 		else



CVS commit: src/sys

2021-04-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 12:57:21 UTC 2021

Modified Files:
src/sys/compat/common: kern_time_50.c
src/sys/kern: kern_time.c

Log Message:
Centralise the setitimer() timer type validation in dosetitimer() as is
done with dogetitimer().


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.210 -r1.211 src/sys/kern/kern_time.c

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

Modified files:

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.35 src/sys/compat/common/kern_time_50.c:1.36
--- src/sys/compat/common/kern_time_50.c:1.35	Thu Feb 27 16:41:59 2020
+++ src/sys/compat/common/kern_time_50.c	Sat Apr  3 12:57:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.35 2020/02/27 16:41:59 pgoyette Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.36 2021/04/03 12:57:21 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.35 2020/02/27 16:41:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.36 2021/04/03 12:57:21 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -324,8 +324,6 @@ compat_50_sys_setitimer(struct lwp *l,
 	struct itimerval aitv;
 	int error;
 
-	if ((u_int)which > ITIMER_PROF)
-		return (EINVAL);
 	itvp = SCARG(uap, itv);
 	if (itvp &&
 	(error = copyin(itvp, , sizeof(aitv50))) != 0)

Index: src/sys/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.210 src/sys/kern/kern_time.c:1.211
--- src/sys/kern/kern_time.c:1.210	Tue Dec  8 04:09:38 2020
+++ src/sys/kern/kern_time.c	Sat Apr  3 12:57:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.210 2020/12/08 04:09:38 thorpej Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.211 2021/04/03 12:57:21 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009, 2020
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.210 2020/12/08 04:09:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.211 2021/04/03 12:57:21 simonb Exp $");
 
 #include 
 #include 
@@ -1576,8 +1576,6 @@ sys___setitimer50(struct lwp *l, const s
 	struct itimerval aitv;
 	int error;
 
-	if ((u_int)which > ITIMER_MONOTONIC)
-		return (EINVAL);
 	itvp = SCARG(uap, itv);
 	if (itvp &&
 	(error = copyin(itvp, , sizeof(struct itimerval))) != 0)
@@ -1604,7 +1602,8 @@ dosetitimer(struct proc *p, int which, s
 	struct itlist *itl;
 	int error;
 
-	KASSERT((u_int)which <= CLOCK_MONOTONIC);
+	if ((u_int)which > ITIMER_MONOTONIC)
+		return (EINVAL);
 	if (itimerfix(>it_value) || itimerfix(>it_interval))
 		return (EINVAL);
 



CVS commit: src/sys/kern

2021-04-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 12:06:53 UTC 2021

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

Log Message:
Print the "preposterous TOD clock time" message only if the RTC is
before very late 2020 (1/1/2021 minus a few leap days) instead of
late 1994.  Someone(TM) should remember to adjust this in somewhat
less than 26 years.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/kern/kern_todr.c

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

Modified files:

Index: src/sys/kern/kern_todr.c
diff -u src/sys/kern/kern_todr.c:1.46 src/sys/kern/kern_todr.c:1.47
--- src/sys/kern/kern_todr.c:1.46	Fri Jan  3 01:24:48 2020
+++ src/sys/kern/kern_todr.c	Sat Apr  3 12:06:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_todr.c,v 1.46 2020/01/03 01:24:48 thorpej Exp $	*/
+/*	$NetBSD: kern_todr.c,v 1.47 2021/04/03 12:06:53 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
 #include "opt_todr.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.46 2020/01/03 01:24:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.47 2021/04/03 12:06:53 simonb Exp $");
 
 #include 
 #include 
@@ -90,6 +90,9 @@ static kmutex_t todr_mutex;
 static todr_chip_handle_t todr_handle;
 static bool todr_initialized;
 
+/* The minimum reasonable RTC date before preposterousness */
+#define	PREPOSTEROUS_YEARS	(2021 - POSIX_BASE_YEAR)
+
 /*
  * todr_init:
  *	Initialize TOD clock data.
@@ -213,7 +216,7 @@ todr_set_systime(time_t base)
 
 	if ((todr_handle == NULL) ||
 	(todr_gettime(todr_handle, ) != 0) ||
-	(tv.tv_sec < (25 * SECS_PER_COMMON_YEAR))) {
+	(tv.tv_sec < (PREPOSTEROUS_YEARS * SECS_PER_COMMON_YEAR))) {
 
 		if (todr_handle != NULL)
 			printf("WARNING: preposterous TOD clock time\n");



CVS commit: src/sys/kern

2021-04-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 11:19:11 UTC 2021

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

Log Message:
CTASSERT that NSIG <= 128.  There are many hard-coded assumptions that
there are <= 4 x 32bit signal mask bits.


To generate a diff of this commit:
cvs rdiff -u -r1.396 -r1.397 src/sys/kern/kern_sig.c

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

Modified files:

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.396 src/sys/kern/kern_sig.c:1.397
--- src/sys/kern/kern_sig.c:1.396	Mon Jan 11 17:18:51 2021
+++ src/sys/kern/kern_sig.c	Sat Apr  3 11:19:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.396 2021/01/11 17:18:51 skrll Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.397 2021/04/03 11:19:11 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.396 2021/01/11 17:18:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.397 2021/04/03 11:19:11 simonb Exp $");
 
 #include "opt_execfmt.h"
 #include "opt_ptrace.h"
@@ -110,6 +110,9 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v
 
 #include 
 
+/* Many hard-coded assumptions that there are <= 4 x 32bit signal mask bits */
+__CTASSERT(NSIG <= 128);
+
 #define	SIGQUEUE_MAX	32
 static pool_cache_t	sigacts_cache	__read_mostly;
 static pool_cache_t	ksiginfo_cache	__read_mostly;



CVS commit: src/lib/librumpuser

2021-04-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 07:38:11 UTC 2021

Modified Files:
src/lib/librumpuser: rumpuser_port.h

Log Message:
For MIPS N32, register_t needs to be uint64_t as "long" isn't
big enough.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/librumpuser/rumpuser_port.h

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

Modified files:

Index: src/lib/librumpuser/rumpuser_port.h
diff -u src/lib/librumpuser/rumpuser_port.h:1.50 src/lib/librumpuser/rumpuser_port.h:1.51
--- src/lib/librumpuser/rumpuser_port.h:1.50	Thu May 11 10:21:55 2017
+++ src/lib/librumpuser/rumpuser_port.h	Sat Apr  3 07:38:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_port.h,v 1.50 2017/05/11 10:21:55 martin Exp $	*/
+/*	$NetBSD: rumpuser_port.h,v 1.51 2021/04/03 07:38:11 simonb Exp $	*/
 
 #ifndef _LIB_LIBRUMPUSER_RUMPUSER_PORT_H_
 #define _LIB_LIBRUMPUSER_RUMPUSER_PORT_H_
@@ -297,6 +297,13 @@ aligned_alloc(size_t alignment, size_t s
 #define MSG_NOSIGNAL 0
 #endif
 
+#if defined(__NetBSD__) && defined(__mips_n32)	/* XXX */
+/* The MIPS N32 ABI has 4 byte longs but uses 8 byte registers */
+#define	HAVE_REGISTER_T	1
+#define	RUMP_REGISTER_T uint64_t
+typedef RUMP_REGISTER_T register_t;
+#define	PRIxREGISTER	PRIx64
+#endif /* __NetBSD__ && __mips_n32 */		/* XXX */
 #if !defined(HAVE_REGISTER_T) && !defined(RUMP_REGISTER_T)
 #define RUMP_REGISTER_T long
 typedef RUMP_REGISTER_T register_t;



CVS commit: src/usr.bin/at

2021-04-02 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 04:33:08 UTC 2021

Modified Files:
src/usr.bin/at: at.c

Log Message:
Revert parsedate(3) XXX as per discussion with kre@.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/at/at.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/at/at.c
diff -u src/usr.bin/at/at.c:1.32 src/usr.bin/at/at.c:1.33
--- src/usr.bin/at/at.c:1.32	Fri Apr  2 06:31:53 2021
+++ src/usr.bin/at/at.c	Sat Apr  3 04:33:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: at.c,v 1.32 2021/04/02 06:31:53 simonb Exp $	*/
+/*	$NetBSD: at.c,v 1.33 2021/04/03 04:33:08 simonb Exp $	*/
 
 /*
  *  at.c : Put file into atrun queue
@@ -53,7 +53,7 @@
 /* Local headers */
 #include "at.h"
 #include "panic.h"
-#include "parsetime.h"		/* XXX should use parsedate(3) in  */
+#include "parsetime.h"
 #include "perm.h"
 #include "pathnames.h"
 #include "stime.h"
@@ -71,7 +71,7 @@ enum { ATQ, ATRM, AT, BATCH, CAT };	/* w
 #if 0
 static char rcsid[] = "$OpenBSD: at.c,v 1.15 1998/06/03 16:20:26 deraadt Exp $";
 #else
-__RCSID("$NetBSD: at.c,v 1.32 2021/04/02 06:31:53 simonb Exp $");
+__RCSID("$NetBSD: at.c,v 1.33 2021/04/03 04:33:08 simonb Exp $");
 #endif
 #endif
 



CVS commit: src/sys/kern

2021-04-02 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  2 10:39:22 UTC 2021

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

Log Message:
Make extern declaration of intrcnt a u_int instead of a long.  Matches
some declartions in some ports.  Fixes build on news68k (and probably
newsmips).


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

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

Modified files:

Index: src/sys/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.14 src/sys/kern/subr_evcnt.c:1.15
--- src/sys/kern/subr_evcnt.c:1.14	Thu Apr  1 04:41:38 2021
+++ src/sys/kern/subr_evcnt.c	Fri Apr  2 10:39:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.14 2021/04/01 04:41:38 simonb Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.15 2021/04/02 10:39:22 simonb Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.14 2021/04/01 04:41:38 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.15 2021/04/02 10:39:22 simonb Exp $");
 
 #include 
 #include 
@@ -380,7 +380,7 @@ SYSCTL_SETUP(sysctl_evcnt_setup, "sysctl
 }
 
 #ifdef __HAVE_LEGACY_INTRCNT
-extern long intrcnt[], eintrcnt[];
+extern u_int intrcnt[], eintrcnt[];
 extern char intrnames[];
 static size_t nintr;
 struct evcnt *intr_evcnts;



CVS commit: src/usr.bin/at

2021-04-02 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  2 06:31:53 UTC 2021

Modified Files:
src/usr.bin/at: at.c

Log Message:
Add an XXX reminder to convert at(1) to use parsedate(3) in .


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/at/at.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/at/at.c
diff -u src/usr.bin/at/at.c:1.31 src/usr.bin/at/at.c:1.32
--- src/usr.bin/at/at.c:1.31	Sun Mar 13 00:32:09 2016
+++ src/usr.bin/at/at.c	Fri Apr  2 06:31:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: at.c,v 1.31 2016/03/13 00:32:09 dholland Exp $	*/
+/*	$NetBSD: at.c,v 1.32 2021/04/02 06:31:53 simonb Exp $	*/
 
 /*
  *  at.c : Put file into atrun queue
@@ -53,7 +53,7 @@
 /* Local headers */
 #include "at.h"
 #include "panic.h"
-#include "parsetime.h"
+#include "parsetime.h"		/* XXX should use parsedate(3) in  */
 #include "perm.h"
 #include "pathnames.h"
 #include "stime.h"
@@ -71,7 +71,7 @@ enum { ATQ, ATRM, AT, BATCH, CAT };	/* w
 #if 0
 static char rcsid[] = "$OpenBSD: at.c,v 1.15 1998/06/03 16:20:26 deraadt Exp $";
 #else
-__RCSID("$NetBSD: at.c,v 1.31 2016/03/13 00:32:09 dholland Exp $");
+__RCSID("$NetBSD: at.c,v 1.32 2021/04/02 06:31:53 simonb Exp $");
 #endif
 #endif
 



CVS commit: src/usr.bin/vmstat

2021-04-02 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  2 06:28:55 UTC 2021

Modified Files:
src/usr.bin/vmstat: Makefile vmstat.c

Log Message:
Drop setgid kmem, simplify nlist setup.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/vmstat/Makefile
cvs rdiff -u -r1.245 -r1.246 src/usr.bin/vmstat/vmstat.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/vmstat/Makefile
diff -u src/usr.bin/vmstat/Makefile:1.34 src/usr.bin/vmstat/Makefile:1.35
--- src/usr.bin/vmstat/Makefile:1.34	Thu Dec 29 23:42:39 2016
+++ src/usr.bin/vmstat/Makefile	Fri Apr  2 06:28:55 2021
@@ -1,8 +1,7 @@
-#	$NetBSD: Makefile,v 1.34 2016/12/29 23:42:39 mrg Exp $
+#	$NetBSD: Makefile,v 1.35 2021/04/02 06:28:55 simonb Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include 
-USE_FORT?= yes	# setgid
 PROG=	vmstat
 
 CPPFLAGS+=-D_KMEMUSER -I${NETBSDSRCDIR}/sys
@@ -10,8 +9,6 @@ SRCS=	drvstats.c vmstat.c
 MAN=	vmstat.1
 DPADD=	${LIBKVM}
 LDADD=	-lkvm
-BINGRP=	kmem
-BINMODE=2555
 
 CWARNFLAGS.clang+=	-Wno-format-extra-args
 COPTS.vmstat.c += -Wno-format-nonliteral
@@ -19,6 +16,4 @@ COPTS.vmstat.c += -Wno-format-nonliteral
 # sparc64 is broken!
 COPTS.vmstat.c += -Wno-error=stack-protector
 
-.include "../../compat/exec.mk"
-
 .include 

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.245 src/usr.bin/vmstat/vmstat.c:1.246
--- src/usr.bin/vmstat/vmstat.c:1.245	Thu Apr  1 06:23:14 2021
+++ src/usr.bin/vmstat/vmstat.c	Fri Apr  2 06:28:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.245 2021/04/01 06:23:14 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.246 2021/04/02 06:28:55 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.245 2021/04/01 06:23:14 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.246 2021/04/02 06:28:55 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -328,7 +328,6 @@ static const int clockrate_mib[] = { CTL
 static const int vmmeter_mib[] = { CTL_VM, VM_METER };
 static const int uvmexp2_mib[] = { CTL_VM, VM_UVMEXP2 };
 static const int boottime_mib[] = { CTL_KERN, KERN_BOOTTIME };
-static char kvm_errbuf[_POSIX2_LINE_MAX];
 
 int
 main(int argc, char *argv[])
@@ -336,11 +335,10 @@ main(int argc, char *argv[])
 	int c, todo, verbose, wide;
 	struct timespec interval;
 	int reps;
-	gid_t egid = getegid();
 	const char *histname, *hashname;
+	char errbuf[_POSIX2_LINE_MAX];
 
 	histname = hashname = NULL;
-	(void)setegid(getgid());
 	memf = nlistf = NULL;
 	reps = todo = verbose = wide = 0;
 	interval.tv_sec = 0;
@@ -415,35 +413,21 @@ main(int argc, char *argv[])
 	if (todo == 0)
 		todo = VMSTAT;
 
-	/*
-	 * Discard setgid privileges.  If not the running kernel, we toss
-	 * them away totally so that bad guys can't print interesting stuff
-	 * from kernel memory, otherwise switch back to kmem for the
-	 * duration of the kvm_openfiles() call.
-	 */
-	if (nlistf != NULL || memf != NULL)
-		(void)setgid(getgid());
-	else
-		(void)setegid(egid);
-
-	kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, kvm_errbuf);
-	if (kd == NULL) {
-		if (nlistf != NULL || memf != NULL) {
-			errx(1, "kvm_openfiles: %s", kvm_errbuf);
-		}
+	if (memf == NULL) {
+		kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
+	} else {
+		kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
+		getnlist(todo);
 	}
 
-	if (nlistf == NULL && memf == NULL)
-		(void)setgid(getgid());
-
+	if (kd == NULL)
+		errx(EXIT_FAILURE, "%s", errbuf);
 
 	if (todo & VMSTAT) {
 		struct winsize winsize;
 
 		(void)drvinit(0);/* Initialize disk stats, no disks selected. */
 
-		(void)setgid(getgid()); /* don't need privs anymore */
-
 		argv = choosedrives(argv);	/* Select disks. */
 		winsize.ws_row = 0;
 		(void)ioctl(STDOUT_FILENO, TIOCGWINSZ, );
@@ -466,8 +450,6 @@ main(int argc, char *argv[])
 	} else if (reps)
 		interval.tv_sec = 1;
 
-
-	getnlist(todo);
 	/*
 	 * Statistics dumping is incompatible with the default
 	 * VMSTAT/dovmstat() output. So perform the interval/reps handling
@@ -539,36 +521,30 @@ main(int argc, char *argv[])
 void
 getnlist(int todo)
 {
-	static int namelist_done = 0;
 	static int done = 0;
 	int c;
 	size_t i;
 
-	if (kd == NULL)
-		errx(1, "kvm_openfiles: %s", kvm_errbuf);
-
-	if (!namelist_done) {
-		namelist_done = 1;
-		if ((c = kvm_nlist(kd, namelist)) != 0) {
-			int doexit = 0;
-			if (c == -1)
-errx(1, "kvm_nlist: %s %s",
-"namelist", kvm_geterr(kd));
-			for (i = 0; i < __arraycount(namelist)-1; i++)
-if (namelist[i].n_type == 0) {
-	if (doexit++ == 0)
-		(void)fprintf(stderr,
-		"%s: undefined symbols:",
-		getprogname());
-	(void)fprintf(stderr, " %s",
-	namelist[i].n_name);
-}
-			if (doexit) {
-

CVS commit: src/sys/uvm

2021-04-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 06:26:26 UTC 2021

Modified Files:
src/sys/uvm: uvm_bio.c

Log Message:
Add a sysctl hashstat collector for ubchash.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/uvm/uvm_bio.c

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

Modified files:

Index: src/sys/uvm/uvm_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.125 src/sys/uvm/uvm_bio.c:1.126
--- src/sys/uvm/uvm_bio.c:1.125	Sat Mar 13 15:29:55 2021
+++ src/sys/uvm/uvm_bio.c	Thu Apr  1 06:26:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.125 2021/03/13 15:29:55 skrll Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.126 2021/04/01 06:26:26 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.125 2021/03/13 15:29:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.126 2021/04/01 06:26:26 simonb Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 		/* for ilog2() */
 
@@ -61,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 
 static int	ubc_fault(struct uvm_faultinfo *, vaddr_t, struct vm_page **,
 			  int, int, vm_prot_t, int);
 static struct ubc_map *ubc_find_mapping(struct uvm_object *, voff_t);
+static int	ubchash_stats(struct hashstat_sysctl *hs, bool fill);
 #ifdef UBC_USE_PMAP_DIRECT
 static int __noinline ubc_uiomove_direct(struct uvm_object *, struct uio *, vsize_t,
 			  int, int);
@@ -215,6 +217,8 @@ ubc_init(void)
 UVM_ADV_RANDOM, UVM_FLAG_NOMERGE)) != 0) {
 		panic("ubc_init: failed to map ubc_object");
 	}
+
+	hashstat_register("ubchash", ubchash_stats);
 }
 
 void
@@ -1104,3 +1108,35 @@ ubc_purge(struct uvm_object *uobj)
 	}
 	rw_exit(ubc_object.uobj.vmobjlock);
 }
+
+static int
+ubchash_stats(struct hashstat_sysctl *hs, bool fill)
+{
+	struct ubc_map *umap;
+	uint64_t chain;
+
+	strlcpy(hs->hash_name, "ubchash", sizeof(hs->hash_name));
+	strlcpy(hs->hash_desc, "ubc object hash", sizeof(hs->hash_desc));
+	if (!fill)
+		return 0;
+
+	hs->hash_size = ubc_object.hashmask + 1;
+
+	for (size_t i = 0; i < hs->hash_size; i++) {
+		chain = 0;
+		rw_enter(ubc_object.uobj.vmobjlock, RW_READER);
+		LIST_FOREACH(umap, _object.hash[i], hash) {
+			chain++;
+		}
+		rw_exit(ubc_object.uobj.vmobjlock);
+		if (chain > 0) {
+			hs->hash_used++;
+			hs->hash_items += chain;
+			if (chain > hs->hash_maxchain)
+hs->hash_maxchain = chain;
+		}
+		preempt_point();
+	}
+
+	return 0;
+}



CVS commit: src/sys/kern

2021-04-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 06:26:14 UTC 2021

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

Log Message:
Add a sysctl hashstat collector for vcache.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/kern/vfs_vnode.c

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

Modified files:

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.126 src/sys/kern/vfs_vnode.c:1.127
--- src/sys/kern/vfs_vnode.c:1.126	Tue Aug  4 03:00:10 2020
+++ src/sys/kern/vfs_vnode.c	Thu Apr  1 06:26:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.126 2020/08/04 03:00:10 riastradh Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.127 2021/04/01 06:26:14 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.126 2020/08/04 03:00:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.127 2021/04/01 06:26:14 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -1194,6 +1194,38 @@ vcache_hash(const struct vcache_key *key
 	return hash;
 }
 
+static int
+vcache_stats(struct hashstat_sysctl *hs, bool fill)
+{
+	vnode_impl_t *vip;
+	uint64_t chain;
+
+	strlcpy(hs->hash_name, "vcache", sizeof(hs->hash_name));
+	strlcpy(hs->hash_desc, "vnode cache hash", sizeof(hs->hash_desc));
+	if (!fill)
+		return 0;
+
+	hs->hash_size = vcache_hashmask + 1;
+
+	for (size_t i = 0; i < hs->hash_size; i++) {
+		chain = 0;
+		mutex_enter(_lock);
+		SLIST_FOREACH(vip, _hashtab[i], vi_hash) {
+			chain++;
+		}
+		mutex_exit(_lock);
+		if (chain > 0) {
+			hs->hash_used++;
+			hs->hash_items += chain;
+			if (chain > hs->hash_maxchain)
+hs->hash_maxchain = chain;
+		}
+		preempt_point();
+	}
+
+	return 0;
+}
+
 static void
 vcache_init(void)
 {
@@ -1206,6 +1238,7 @@ vcache_init(void)
 	vcache_hashsize = desiredvnodes;
 	vcache_hashtab = hashinit(desiredvnodes, HASH_SLIST, true,
 	_hashmask);
+	hashstat_register("vcache", vcache_stats);
 }
 
 static void



CVS commit: src/sys/kern

2021-04-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 06:26:00 UTC 2021

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

Log Message:
Add a sysctl hashstat collector for bufhash.


To generate a diff of this commit:
cvs rdiff -u -r1.297 -r1.298 src/sys/kern/vfs_bio.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.297 src/sys/kern/vfs_bio.c:1.298
--- src/sys/kern/vfs_bio.c:1.297	Fri Jul 31 04:07:30 2020
+++ src/sys/kern/vfs_bio.c	Thu Apr  1 06:25:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.297 2020/07/31 04:07:30 chs Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.298 2021/04/01 06:25:59 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.297 2020/07/31 04:07:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.298 2021/04/01 06:25:59 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -252,6 +252,8 @@ biohist_init(void)
 LIST_HEAD(bufhashhdr, buf) *bufhashtbl, invalhash;
 u_long	bufhash;
 
+static int bufhash_stats(struct hashstat_sysctl *, bool);
+
 static kcondvar_t needbuffer_cv;
 
 /*
@@ -536,6 +538,7 @@ bufinit(void)
 
 	sysctl_kern_buf_setup();
 	sysctl_vm_buf_setup();
+	hashstat_register("bufhash", bufhash_stats);
 }
 
 void
@@ -1953,6 +1956,40 @@ sysctl_vm_buf_setup(void)
 		   CTL_VM, CTL_CREATE, CTL_EOL);
 }
 
+static int
+bufhash_stats(struct hashstat_sysctl *hs, bool fill)
+{
+	buf_t *bp;
+	uint64_t chain;
+
+	strlcpy(hs->hash_name, "bufhash", sizeof(hs->hash_name));
+	strlcpy(hs->hash_desc, "buffer hash", sizeof(hs->hash_desc));
+	if (!fill)
+		return 0;
+
+	hs->hash_size = bufhash + 1;
+
+	for (size_t i = 0; i < hs->hash_size; i++) {
+		chain = 0;
+
+		mutex_enter(_lock);
+		LIST_FOREACH(bp, [i], b_hash) {
+			chain++;
+		}
+		mutex_exit(_lock);
+
+		if (chain > 0) {
+			hs->hash_used++;
+			hs->hash_items += chain;
+			if (chain > hs->hash_maxchain)
+hs->hash_maxchain = chain;
+		}
+		preempt_point();
+	}
+
+	return 0;
+}
+
 #ifdef DEBUG
 /*
  * Print out statistics on the current allocation of the buffer pool.



CVS commit: src/sys/kern

2021-04-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 06:25:46 UTC 2021

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

Log Message:
Add a sysctl hashstat collector for uihash.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/kern_uidinfo.c

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

Modified files:

Index: src/sys/kern/kern_uidinfo.c
diff -u src/sys/kern/kern_uidinfo.c:1.11 src/sys/kern/kern_uidinfo.c:1.12
--- src/sys/kern/kern_uidinfo.c:1.11	Fri Mar  1 03:03:19 2019
+++ src/sys/kern/kern_uidinfo.c	Thu Apr  1 06:25:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_uidinfo.c,v 1.11 2019/03/01 03:03:19 christos Exp $	*/
+/*	$NetBSD: kern_uidinfo.c,v 1.12 2021/04/01 06:25:45 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_uidinfo.c,v 1.11 2019/03/01 03:03:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_uidinfo.c,v 1.12 2021/04/01 06:25:45 simonb Exp $");
 
 #include 
 #include 
@@ -132,6 +132,37 @@ sysctl_kern_uidinfo_setup(void)
 		   CTL_CREATE, CTL_EOL);
 }
 
+static int
+uid_stats(struct hashstat_sysctl *hs, bool fill)
+{
+	struct uidinfo *uip;
+	uint64_t chain;
+
+	strlcpy(hs->hash_name, "uihash", sizeof(hs->hash_name));
+	strlcpy(hs->hash_desc, "user info (uid->used proc) hash",
+	sizeof(hs->hash_desc));
+	if (!fill)
+		return 0;
+
+	hs->hash_size = uihash + 1;
+
+	for (size_t i = 0; i < hs->hash_size; i++) {
+		chain = 0;
+		SLIST_FOREACH(uip, [i], ui_hash) {
+			membar_datadep_consumer();
+			chain++;
+		}
+		if (chain > 0) {
+			hs->hash_used++;
+			hs->hash_items += chain;
+			if (chain > hs->hash_maxchain)
+hs->hash_maxchain = chain;
+		}
+	}
+
+	return 0;
+}
+
 void
 uid_init(void)
 {
@@ -151,6 +182,7 @@ uid_init(void)
 	 */
 	(void)uid_find(0);
 	sysctl_kern_uidinfo_setup();
+	hashstat_register("uihash", uid_stats);
 }
 
 struct uidinfo *



CVS commit: src/usr.bin/vmstat

2021-04-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 06:23:15 UTC 2021

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Use kernel sysctl hashstat collection instead of kmem grovelling
directly.  Also GC a few old hash nlist entries that no longer exist.


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/usr.bin/vmstat/vmstat.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/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.244 src/usr.bin/vmstat/vmstat.c:1.245
--- src/usr.bin/vmstat/vmstat.c:1.244	Thu Apr  1 05:33:50 2021
+++ src/usr.bin/vmstat/vmstat.c	Thu Apr  1 06:23:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.244 2021/04/01 05:33:50 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.245 2021/04/01 06:23:14 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.244 2021/04/01 05:33:50 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.245 2021/04/01 06:23:14 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -113,6 +113,7 @@ __RCSID("$NetBSD: vmstat.c,v 1.244 2021/
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -207,31 +208,23 @@ struct nlist intrnl[] =
  */
 struct nlist hashnl[] =
 {
-#define	X_NFSNODE	0
-	{ .n_name = "_nfsnodehash" },
-#define	X_NFSNODETBL	1
-	{ .n_name = "_nfsnodehashtbl" },
-#define	X_IHASH		2
-	{ .n_name = "_ihash" },
-#define	X_IHASHTBL	3
-	{ .n_name = "_ihashtbl" },
-#define	X_BUFHASH	4
+#define	X_BUFHASH	0
 	{ .n_name = "_bufhash" },
-#define	X_BUFHASHTBL	5
+#define	X_BUFHASHTBL	1
 	{ .n_name = "_bufhashtbl" },
-#define	X_UIHASH	6
+#define	X_UIHASH	2
 	{ .n_name = "_uihash" },
-#define	X_UIHASHTBL	7
+#define	X_UIHASHTBL	3
 	{ .n_name = "_uihashtbl" },
-#define	X_IFADDRHASH	8
+#define	X_IFADDRHASH	4
 	{ .n_name = "_in_ifaddrhash" },
-#define	X_IFADDRHASHTBL	9
+#define	X_IFADDRHASHTBL	5
 	{ .n_name = "_in_ifaddrhashtbl" },
-#define	X_VCACHEHASH	10
+#define	X_VCACHEHASH	6
 	{ .n_name = "_vcache_hashmask" },
-#define	X_VCACHETBL	11
+#define	X_VCACHETBL	7
 	{ .n_name = "_vcache_hashtab" },
-#define X_HASHNL_SIZE	12	/* must be last */
+#define X_HASHNL_SIZE	8	/* must be last */
 	{ .n_name = NULL },
 };
 
@@ -300,6 +293,7 @@ void	deref_kptr(const void *, void *, si
 void	drvstats(int *);
 void	doevcnt(int verbose, int type);
 void	dohashstat(int, int, const char *);
+void	dohashstat_sysctl(int, int, const char *);
 void	dointr(int verbose);
 void	dopool(int, int);
 void	dopoolcache(int);
@@ -1925,6 +1919,9 @@ dohashstat(int verbose, int todo, const 
 	u_long	hashsize, i;
 	int	used, items, chain, maxchain;
 
+	if (memf == NULL)
+		return dohashstat_sysctl(verbose, todo, hashname);
+
 	hashbuf = NULL;
 	hashbufsize = 0;
 
@@ -2057,6 +2054,75 @@ dohashstat(int verbose, int todo, const 
 	}
 }
 
+void
+dohashstat_sysctl(int verbose, int todo, const char *hashname)
+{
+	struct hashstat_sysctl hash, *data, *hs;
+	int mib[3];
+	int error;
+	size_t i, len, miblen;
+
+
+	miblen = __arraycount(mib);
+	error = sysctlnametomib("kern.hashstat", mib, );
+	if (error)
+		err(EXIT_FAILURE, "nametomib kern.hashstat failed");
+	assert(miblen < 3);
+
+	if (todo & HASHLIST) {
+		mib[miblen] = CTL_DESCRIBE;
+		miblen++;
+	};
+
+	if (hashname) {
+		mib[miblen] = CTL_QUERY;
+		miblen++;
+		memset(, 0, sizeof(hash));
+		strlcpy(hash.hash_name, hashname, sizeof(hash.hash_name));
+		len = sizeof(hash);
+		error = sysctl(mib, miblen, , , , len);
+		if (error == ENOENT) {
+			err(1, "hash '%s' not found", hashname);
+			return;
+		} else if (error) {
+			err(1, "sysctl kern.hashstat query failed");
+			return;
+		}
+
+		data = 
+		len = 1;
+	} else {
+		data = asysctl(mib, miblen, );
+		if (data == NULL)
+			err(1, "failed to read kern.hashstat");
+		len /= sizeof(*data);
+	}
+
+	if (todo & HASHLIST) {
+		printf("Supported hashes:\n");
+		for (i = 0, hs = data; i < len; i++, hs++) {
+			printf("\t%-16s%s\n", hs->hash_name, hs->hash_desc);
+		}
+	} else {
+		printf("%-16s %8s %8s %8s %8s %8s %8s\n"
+		"%-16s %8s %8s %8s %8s %8s %8s\n",
+		"", "total", "used", "util", "num", "average", "maximum",
+		"hash table", "buckets", "buckets", "%", "items", "chain",
+		"chain");
+		for (i = 0, hs = data; i < len; i++, hs++) {
+			printf("%-16s %8"PRId64" %8"PRId64" %8.2f %8"PRId64
+			" %8.2f %8"PRId64"\n",
+			hs->hash_name, hs->hash_size, hs->hash_used,
+			hs->hash_used * 100.0 / hs->hash_size, hs->hash_items,
+			hs->hash_used ? (double)hs->hash_items / hs->hash_used : 0.0,
+			hs->hash_maxchain);
+		}
+	}
+
+	if (!hashname && (data != NULL))
+		free(data);
+}
+
 /*
  * kreadc like kread but returns 1 if successful, 0 otherwise
  */
@@ -2254,7 +2320,7 @@ hist_traverse_sysctl(int todo, const cha
  			warnx("kernel history 

CVS commit: src/sys

2021-04-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 06:22:10 UTC 2021

Modified Files:
src/sys/kern: subr_hash.c
src/sys/sys: sysctl.h

Log Message:
Add support for kernel hash statistics generation for vmstat -h/-H.  As
well as not needing any kmem grovelling, also much faster as it doesn't
need a kmem read for hash bucket and for each item in the hash bucket
chains.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_hash.c
cvs rdiff -u -r1.231 -r1.232 src/sys/sys/sysctl.h

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

Modified files:

Index: src/sys/kern/subr_hash.c
diff -u src/sys/kern/subr_hash.c:1.7 src/sys/kern/subr_hash.c:1.8
--- src/sys/kern/subr_hash.c:1.7	Wed Jul  6 05:20:48 2016
+++ src/sys/kern/subr_hash.c	Thu Apr  1 06:22:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_hash.c,v 1.7 2016/07/06 05:20:48 ozaki-r Exp $	*/
+/*	$NetBSD: subr_hash.c,v 1.8 2021/04/01 06:22:09 simonb Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -37,13 +37,17 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.7 2016/07/06 05:20:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.8 2021/04/01 06:22:09 simonb Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
+
+static int hashstat_sysctl(SYSCTLFN_PROTO);
 
 static size_t
 hash_list_size(enum hashtype htype)
@@ -138,3 +142,119 @@ hashdone(void *hashtbl, enum hashtype ht
 	const size_t esize = hash_list_size(htype);
 	kmem_free(hashtbl, esize * (hashmask + 1));
 }
+
+/*
+ * Support for hash statistics (vmstat -H / vmstat -h hashname).
+ */
+
+struct hashstat {
+	const char *hs_name;
+	hashstat_func_t hs_func;
+	TAILQ_ENTRY(hashstat) hs_next;
+};
+TAILQ_HEAD(, hashstat) hashstat_list =
+TAILQ_HEAD_INITIALIZER(hashstat_list);
+static krwlock_t hashstat_lock;
+
+void
+hashstat_register(const char *name, hashstat_func_t func)
+{
+	struct hashstat *hs;
+
+	hs = kmem_alloc(sizeof(*hs), KM_SLEEP);
+
+	hs->hs_name = name;
+	hs->hs_func = func;
+
+	rw_enter(_lock, RW_WRITER);
+	TAILQ_INSERT_TAIL(_list, hs, hs_next);
+	rw_exit(_lock);
+}
+
+/*
+ * sysctl support for returning kernel hash statistics.
+ *
+ * We (ab)use CTL_DESCRIBE and CTL_QUERY:
+ * When passed an OID of CTL_DESCRIBE, return a list and description
+ * of the available hashes.
+ * When passed an OID of CTL_QUERY, use the hash name passed in the
+ * "new" hash input as the name of a single hash to return stats on.
+ */
+static int
+hashstat_sysctl(SYSCTLFN_ARGS)
+{
+	struct hashstat_sysctl hs;
+	struct hashstat *hash;
+	char queryname[SYSCTL_NAMELEN];
+	size_t written;
+	bool fill, query;
+	int error;
+
+	if (oldp == NULL) {
+		*oldlenp = 0;
+		TAILQ_FOREACH(hash, _list, hs_next)
+			*oldlenp += sizeof(hs);
+		return 0;
+	}
+
+	error = 0;
+	written = 0;
+
+	if (namelen > 0 && name[0] == CTL_DESCRIBE)
+		fill = false;
+	else
+		fill = true;
+
+	if (namelen > 0 && name[0] == CTL_QUERY) {
+		const struct hashstat_sysctl *h = newp;
+
+		if (h == NULL) {
+			/* Can't QUERY one hash without supplying the hash name. */
+			return EINVAL;
+		}
+		query = true;
+		h = newp;
+		strlcpy(queryname, h->hash_name, sizeof(queryname));
+	} else {
+		query = false;
+	}
+
+	sysctl_unlock();
+	rw_enter(_lock, RW_READER);
+	TAILQ_FOREACH(hash, _list, hs_next) {
+		if (query &&
+		(strncmp(hash->hs_name, queryname, sizeof(hash->hs_name)) != 0)) {
+			continue;
+		}
+
+		memset(, 0, sizeof(hs));
+		error = hash->hs_func(, fill);
+		if (error)
+			break;
+
+		error = sysctl_copyout(l, , oldp, sizeof(hs));
+		if (error)
+			break;
+		written += sizeof(hs);
+		oldp = (char *)oldp + sizeof(hs);
+	}
+	rw_exit(_lock);
+	sysctl_relock();
+
+	*oldlenp = written;
+	return error;
+}
+
+
+SYSCTL_SETUP(sysctl_hash_setup, "sysctl hash stats setup")
+{
+
+	rw_init(_lock);	/* as good a place as any for this */
+
+	sysctl_createv(NULL, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_STRUCT,
+		   "hashstat", SYSCTL_DESCR("kernel hash statistics"),
+		   hashstat_sysctl, 0, NULL, 0,
+		   CTL_KERN, CTL_CREATE, CTL_EOL);
+}

Index: src/sys/sys/sysctl.h
diff -u src/sys/sys/sysctl.h:1.231 src/sys/sys/sysctl.h:1.232
--- src/sys/sys/sysctl.h:1.231	Sat Oct 17 09:06:15 2020
+++ src/sys/sys/sysctl.h	Thu Apr  1 06:22:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.h,v 1.231 2020/10/17 09:06:15 mlelstv Exp $	*/
+/*	$NetBSD: sysctl.h,v 1.232 2021/04/01 06:22:10 simonb Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -727,6 +727,28 @@ struct evcnt_sysctl {
 #define	KERN_EVCNT_COUNT_ANY		0
 #define	KERN_EVCNT_COUNT_NONZERO	1
 
+
+/*
+ * kern.hashstat returns an array of these structures, which are designed
+ * to be immune to 32/64 bit emulation issues.
+ *
+ * Hash users can register a filler function to fill the hashstat_sysctl
+ * which can then be exposed via vmstat(1).
+ *
+ * See comments for hashstat_sysctl() in 

CVS commit: src/usr.bin/vmstat

2021-03-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 05:33:51 UTC 2021

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
Now that ports that use legacy intrcnt interrupt accounting have event
counters to show that data, for the live kernel case just show INTR
events for "vmstat -i".


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/usr.bin/vmstat/vmstat.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/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.243 src/usr.bin/vmstat/vmstat.c:1.244
--- src/usr.bin/vmstat/vmstat.c:1.243	Wed Mar  3 08:25:16 2021
+++ src/usr.bin/vmstat/vmstat.c	Thu Apr  1 05:33:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.243 2021/03/03 08:25:16 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.244 2021/04/01 05:33:50 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.243 2021/03/03 08:25:16 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.244 2021/04/01 05:33:50 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -1259,6 +1259,11 @@ dointr(int verbose)
 	int nintr, inamlen;
 	char *intrname, *ointrname;
 
+	if (memf == NULL) {
+		doevcnt(verbose, EVCNT_TYPE_INTR);
+		return;
+	}
+
 	inttotal = 0;
 	uptime = getuptime();
 	nintr = intrnl[X_EINTRCNT].n_value - intrnl[X_INTRCNT].n_value;



CVS commit: src/sys/arch

2021-03-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 04:43:01 UTC 2021

Modified Files:
src/sys/arch/amiga/include: types.h
src/sys/arch/atari/include: types.h
src/sys/arch/bebox/include: types.h
src/sys/arch/cesfic/include: types.h
src/sys/arch/luna68k/include: types.h
src/sys/arch/mac68k/include: types.h
src/sys/arch/mvme68k/include: types.h
src/sys/arch/mvmeppc/include: types.h
src/sys/arch/news68k/include: types.h
src/sys/arch/newsmips/include: types.h
src/sys/arch/next68k/include: types.h
src/sys/arch/sun2/include: types.h
src/sys/arch/sun3/include: types.h
src/sys/arch/x68k/include: types.h

Log Message:
Define __HAVE_LEGACY_INTRCNT to indicate this port uses legacy intrcnt
interrupt accounting.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amiga/include/types.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/atari/include/types.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/bebox/include/types.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/cesfic/include/types.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/include/types.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mac68k/include/types.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mvme68k/include/types.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mvmeppc/include/types.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/news68k/include/types.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/newsmips/include/types.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/include/types.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sun2/include/types.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sun3/include/types.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x68k/include/types.h

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

Modified files:

Index: src/sys/arch/amiga/include/types.h
diff -u src/sys/arch/amiga/include/types.h:1.23 src/sys/arch/amiga/include/types.h:1.24
--- src/sys/arch/amiga/include/types.h:1.23	Sun Jun 12 03:35:39 2011
+++ src/sys/arch/amiga/include/types.h	Thu Apr  1 04:42:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.23 2011/06/12 03:35:39 rmind Exp $	*/
+/*	$NetBSD: types.h,v 1.24 2021/04/01 04:42:59 simonb Exp $	*/
 
 #ifndef _MACHINE_TYPES_H_
 #define	_MACHINE_TYPES_H_
@@ -6,6 +6,7 @@
 #include 
 
 #define	__GENERIC_SOFT_INTERRUPTS_ALL_LEVELS
+#define	__HAVE_LEGACY_INTRCNT
 #define	__HAVE_MM_MD_READWRITE
 
 #endif

Index: src/sys/arch/atari/include/types.h
diff -u src/sys/arch/atari/include/types.h:1.18 src/sys/arch/atari/include/types.h:1.19
--- src/sys/arch/atari/include/types.h:1.18	Thu Apr  1 04:35:45 2021
+++ src/sys/arch/atari/include/types.h	Thu Apr  1 04:42:59 2021
@@ -1,12 +1,13 @@
-/*	$NetBSD: types.h,v 1.18 2021/04/01 04:35:45 simonb Exp $	*/
+/*	$NetBSD: types.h,v 1.19 2021/04/01 04:42:59 simonb Exp $	*/
 
 #ifndef _MACHINE_TYPES_H_
 #define	_MACHINE_TYPES_H_
 
 #include 
 
+#define	__HAVE_BUS_SPACE_8
+#define	__HAVE_LEGACY_INTRCNT
 #define	__HAVE_MM_MD_READWRITE
 #define	__HAVE_NEW_STYLE_BUS_H
-#define	__HAVE_BUS_SPACE_8
 
 #endif

Index: src/sys/arch/bebox/include/types.h
diff -u src/sys/arch/bebox/include/types.h:1.13 src/sys/arch/bebox/include/types.h:1.14
--- src/sys/arch/bebox/include/types.h:1.13	Thu Apr  1 04:35:45 2021
+++ src/sys/arch/bebox/include/types.h	Thu Apr  1 04:43:00 2021
@@ -1,5 +1,7 @@
-/*	$NetBSD: types.h,v 1.13 2021/04/01 04:35:45 simonb Exp $	*/
+/*	$NetBSD: types.h,v 1.14 2021/04/01 04:43:00 simonb Exp $	*/
 
 #define	__HAVE_NEW_STYLE_BUS_H
 
 #include 
+
+#define	__HAVE_LEGACY_INTRCNT

Index: src/sys/arch/cesfic/include/types.h
diff -u src/sys/arch/cesfic/include/types.h:1.6 src/sys/arch/cesfic/include/types.h:1.7
--- src/sys/arch/cesfic/include/types.h:1.6	Sun Jan 20 18:09:05 2008
+++ src/sys/arch/cesfic/include/types.h	Thu Apr  1 04:43:00 2021
@@ -1,3 +1,5 @@
-/* $NetBSD: types.h,v 1.6 2008/01/20 18:09:05 joerg Exp $ */
+/* $NetBSD: types.h,v 1.7 2021/04/01 04:43:00 simonb Exp $ */
 
 #include 
+
+#define	__HAVE_LEGACY_INTRCNT

Index: src/sys/arch/luna68k/include/types.h
diff -u src/sys/arch/luna68k/include/types.h:1.7 src/sys/arch/luna68k/include/types.h:1.8
--- src/sys/arch/luna68k/include/types.h:1.7	Sun Jan 20 18:09:07 2008
+++ src/sys/arch/luna68k/include/types.h	Thu Apr  1 04:43:00 2021
@@ -1,8 +1,10 @@
-/*	$NetBSD: types.h,v 1.7 2008/01/20 18:09:07 joerg Exp $	*/
+/*	$NetBSD: types.h,v 1.8 2021/04/01 04:43:00 simonb Exp $	*/
 
 #ifndef _MACHINE_TYPES_H_
 #define	_MACHINE_TYPES_H_
 
 #include 
 
+#define	__HAVE_LEGACY_INTRCNT
+
 #endif

Index: src/sys/arch/mac68k/include/types.h
diff -u src/sys/arch/mac68k/include/types.h:1.20 src/sys/arch/mac68k/include/types.h:1.21
--- src/sys/arch/mac68k/include/types.h:1.20	Sun Jan 20 18:09:07 2008
+++ src/sys/arch/mac68k/include/types.h	Thu Apr  1 04:43:00 2021
@@ -1,8 +1,10 @@
-/*	$NetBSD: types.h,v 1.20 2008/01/20 18:09:07 joerg Exp $	*/
+/*	$NetBSD: types.h,v 1.21 2021/04/01 04:43:00 

CVS commit: src/sys

2021-03-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 04:41:38 UTC 2021

Modified Files:
src/sys/kern: init_main.c subr_evcnt.c
src/sys/sys: evcnt.h

Log Message:
Expose olde style intrcnt interrupt accounting via event counters.
This code will be garbage collected once our last legacy intrcnt
user is update to native evcnts.


To generate a diff of this commit:
cvs rdiff -u -r1.534 -r1.535 src/sys/kern/init_main.c
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/subr_evcnt.c
cvs rdiff -u -r1.8 -r1.9 src/sys/sys/evcnt.h

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

Modified files:

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.534 src/sys/kern/init_main.c:1.535
--- src/sys/kern/init_main.c:1.534	Sat Dec  5 18:17:01 2020
+++ src/sys/kern/init_main.c	Thu Apr  1 04:41:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.534 2020/12/05 18:17:01 thorpej Exp $	*/
+/*	$NetBSD: init_main.c,v 1.535 2021/04/01 04:41:38 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.534 2020/12/05 18:17:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.535 2021/04/01 04:41:38 simonb Exp $");
 
 #include "opt_cnmagic.h"
 #include "opt_ddb.h"
@@ -548,6 +548,9 @@ main(void)
 
 	/* Configure the system hardware.  This will enable interrupts. */
 	configure();
+#ifdef __HAVE_LEGACY_INTRCNT
+	evcnt_attach_legacy_intrcnt();
+#endif
 
 	/* Once all CPUs are detected, initialize the per-CPU cprng_fast.  */
 	cprng_fast_init();

Index: src/sys/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.13 src/sys/kern/subr_evcnt.c:1.14
--- src/sys/kern/subr_evcnt.c:1.13	Sat Nov 24 17:40:37 2018
+++ src/sys/kern/subr_evcnt.c	Thu Apr  1 04:41:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.13 2018/11/24 17:40:37 maxv Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.14 2021/04/01 04:41:38 simonb Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.13 2018/11/24 17:40:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.14 2021/04/01 04:41:38 simonb Exp $");
 
 #include 
 #include 
@@ -86,6 +86,25 @@ __KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c
 #include 
 #include 
 
+/*
+ * Everything related to __HAVE_LEGACY_INTRCNT can disappear once
+ * no more ports are using old-style intrcnt/intrnames interrupt
+ * accounting.  The follow files have __HAVE_LEGACY_INTRCNT code:
+ *
+ *   sys/kern/init_main.c
+ *   sys/kern/subr_evcnt.c
+ *   sys/sys/evcnt.h
+ *   sys/arch//include/types.h
+ */
+#ifdef _RUMPKERNEL
+/* RUMP doesn't need/want to know about intrcnts */
+#undef __HAVE_LEGACY_INTRCNT
+#endif
+
+#ifdef __HAVE_LEGACY_INTRCNT
+static void evcnt_update_intrcnt(void);
+#endif
+
 /* list of all events */
 struct evcntlist allevents = TAILQ_HEAD_INITIALIZER(allevents);
 static kmutex_t evcnt_lock __cacheline_aligned;
@@ -271,6 +290,9 @@ sysctl_doevcnt(SYSCTLFN_ARGS)
 	needed = 0;
 
 	mutex_enter(_lock);
+#ifdef __HAVE_LEGACY_INTRCNT
+	evcnt_update_intrcnt();
+#endif
 	TAILQ_FOREACH(ev, , ev_list) {
 		if (filter != EVCNT_TYPE_ANY && filter != ev->ev_type)
 			continue;
@@ -356,3 +378,40 @@ SYSCTL_SETUP(sysctl_evcnt_setup, "sysctl
 		   sysctl_doevcnt, 0, NULL, 0,
 		   CTL_KERN, KERN_EVCNT, CTL_EOL);
 }
+
+#ifdef __HAVE_LEGACY_INTRCNT
+extern long intrcnt[], eintrcnt[];
+extern char intrnames[];
+static size_t nintr;
+struct evcnt *intr_evcnts;
+/*
+ * Remove the following when the last intrcnt/intrnames user is cleaned up.
+ */
+void
+evcnt_attach_legacy_intrcnt(void)
+{
+	size_t i;
+	const char *cp;
+
+	nintr = ((intptr_t)eintrcnt - (intptr_t)intrcnt) / sizeof(long);
+	intr_evcnts = kmem_alloc(sizeof(struct evcnt) * nintr, KM_SLEEP);
+	for (cp = intrnames, i = 0; i < nintr; i++) {
+		evcnt_attach_dynamic(_evcnts[i], EVCNT_TYPE_INTR,
+		NULL, "cpu", cp);
+		cp += strlen(cp) + 1;
+	}
+}
+
+static void
+evcnt_update_intrcnt(void)
+{
+	size_t i;
+
+	KASSERT(nintr > 0);
+	KASSERT(intr_evcnts != NULL);
+
+	for (i = 0; i < nintr; i++) {
+		intr_evcnts[i].ev_count = intrcnt[i];
+	}
+}
+#endif

Index: src/sys/sys/evcnt.h
diff -u src/sys/sys/evcnt.h:1.8 src/sys/sys/evcnt.h:1.9
--- src/sys/sys/evcnt.h:1.8	Sat Jan 29 18:21:22 2011
+++ src/sys/sys/evcnt.h	Thu Apr  1 04:41:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: evcnt.h,v 1.8 2011/01/29 18:21:22 matt Exp $	*/
+/*	$NetBSD: evcnt.h,v 1.9 2021/04/01 04:41:38 simonb Exp $	*/
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -104,6 +104,10 @@ TAILQ_HEAD(evcntlist, evcnt);
 #define	EVCNT_TYPE_INTR		1	/* interrupt; count with vmstat -i */
 #define	EVCNT_TYPE_TRAP		2	/* processor trap/execption */
 
+#ifdef __HAVE_LEGACY_INTRCNT
+void evcnt_attach_legacy_intrcnt(void);
+#endif
+
 /*
  * initializer for an event count structure.  the lengths are initted and
  * it is 

CVS commit: src/sys/arch

2021-03-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr  1 04:35:48 UTC 2021

Modified Files:
src/sys/arch/amd64/include: types.h
src/sys/arch/atari/include: types.h
src/sys/arch/bebox/include: types.h
src/sys/arch/cats/include: types.h
src/sys/arch/emips/include: types.h
src/sys/arch/evbarm/include: types.h
src/sys/arch/hpcsh/include: types.h
src/sys/arch/hppa/include: types.h
src/sys/arch/i386/include: types.h
src/sys/arch/ia64/include: types.h
src/sys/arch/landisk/include: types.h
src/sys/arch/mvmeppc/include: types.h
src/sys/arch/netwinder/include: types.h
src/sys/arch/or1k/include: types.h
src/sys/arch/powerpc/include: types.h
src/sys/arch/prep/include: types.h
src/sys/arch/riscv/include: types.h
src/sys/arch/rs6000/include: types.h
src/sys/arch/sandpoint/include: types.h
src/sys/arch/sgimips/include: types.h
src/sys/arch/sun2/include: types.h
src/sys/arch/sun3/include: types.h
src/sys/arch/usermode/include: types.h
src/sys/arch/vax/include: types.h

Log Message:
Whitespace: #define


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/atari/include/types.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/bebox/include/types.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/cats/include/types.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/emips/include/types.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/include/types.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hpcsh/include/types.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/hppa/include/types.h
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/i386/include/types.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/ia64/include/types.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/landisk/include/types.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mvmeppc/include/types.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/netwinder/include/types.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/or1k/include/types.h
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/powerpc/include/types.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/prep/include/types.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/riscv/include/types.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/rs6000/include/types.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/include/types.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sgimips/include/types.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sun2/include/types.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sun3/include/types.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/usermode/include/types.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/vax/include/types.h

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

Modified files:

Index: src/sys/arch/amd64/include/types.h
diff -u src/sys/arch/amd64/include/types.h:1.70 src/sys/arch/amd64/include/types.h:1.71
--- src/sys/arch/amd64/include/types.h:1.70	Sat Jan 23 19:38:52 2021
+++ src/sys/arch/amd64/include/types.h	Thu Apr  1 04:35:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.70 2021/01/23 19:38:52 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.71 2021/04/01 04:35:45 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@ typedef	unsigned char		__cpu_simple_lock
 #define	__HAVE_NEW_STYLE_BUS_H
 #define	__HAVE_CPU_COUNTER
 #define	__HAVE_CPU_DATA_FIRST
-#define __HAVE_CPU_BOOTCONF
+#define	__HAVE_CPU_BOOTCONF
 #define	__HAVE_MD_CPU_OFFLINE
 #define	__HAVE_SYSCALL_INTERN
 #define	__HAVE_MINIMAL_EMUL
@@ -109,7 +109,7 @@ typedef	unsigned char		__cpu_simple_lock
 #include "opt_kasan.h"
 #include "opt_kmsan.h"
 #ifdef KASAN
-#define __HAVE_KASAN_INSTR_BUS
+#define	__HAVE_KASAN_INSTR_BUS
 #endif
 #if defined(__x86_64__) && !defined(XENPV)
 #if !defined(KASAN) && !defined(KMSAN)

Index: src/sys/arch/atari/include/types.h
diff -u src/sys/arch/atari/include/types.h:1.17 src/sys/arch/atari/include/types.h:1.18
--- src/sys/arch/atari/include/types.h:1.17	Sat Jan 23 19:38:52 2021
+++ src/sys/arch/atari/include/types.h	Thu Apr  1 04:35:45 2021
@@ -1,12 +1,12 @@
-/*	$NetBSD: types.h,v 1.17 2021/01/23 19:38:52 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.18 2021/04/01 04:35:45 simonb Exp $	*/
 
 #ifndef _MACHINE_TYPES_H_
 #define	_MACHINE_TYPES_H_
 
 #include 
 
-#define __HAVE_MM_MD_READWRITE
-#define __HAVE_NEW_STYLE_BUS_H
+#define	__HAVE_MM_MD_READWRITE
+#define	__HAVE_NEW_STYLE_BUS_H
 #define	__HAVE_BUS_SPACE_8
 
 #endif

Index: src/sys/arch/bebox/include/types.h
diff -u src/sys/arch/bebox/include/types.h:1.12 src/sys/arch/bebox/include/types.h:1.13
--- src/sys/arch/bebox/include/types.h:1.12	Sun Jul 17 23:27:02 2011
+++ src/sys/arch/bebox/include/types.h	Thu Apr  1 04:35:45 2021
@@ -1,5 +1,5 @@
-/*	$NetBSD: types.h,v 1.12 2011/07/17 23:27:02 dyoung Exp $	*/
+/*	$NetBSD: types.h,v 1.13 2021/04/01 04:35:45 simonb Exp $	*/
 
-#define 

CVS commit: src/sys/arch

2021-03-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Mar 31 09:48:15 UTC 2021

Modified Files:
src/sys/arch/luna68k/luna68k: locore.s
src/sys/arch/mvme68k/mvme68k: locore.s
src/sys/arch/sun2/sun2: locore.s
src/sys/arch/sun3/sun3: locore.s
src/sys/arch/sun3/sun3x: locore.s

Log Message:
Adjust the number of entries in the intrcnt array to match the number
of names in the intrnames list.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/mvme68k/mvme68k/locore.s
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sun2/sun2/locore.s
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/sun3/sun3/locore.s
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/sun3/sun3x/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/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.65 src/sys/arch/luna68k/luna68k/locore.s:1.66
--- src/sys/arch/luna68k/luna68k/locore.s:1.65	Mon Jan 25 13:08:04 2021
+++ src/sys/arch/luna68k/luna68k/locore.s	Wed Mar 31 09:48:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.65 2021/01/25 13:08:04 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.66 2021/03/31 09:48:14 simonb Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -967,5 +967,5 @@ GLOBAL(intrnames)
 GLOBAL(eintrnames)
 	.even
 GLOBAL(intrcnt)
-	.long	0,0,0,0,0,0,0,0,0,0
+	.long	0,0,0,0,0,0,0,0,0
 GLOBAL(eintrcnt)

Index: src/sys/arch/mvme68k/mvme68k/locore.s
diff -u src/sys/arch/mvme68k/mvme68k/locore.s:1.116 src/sys/arch/mvme68k/mvme68k/locore.s:1.117
--- src/sys/arch/mvme68k/mvme68k/locore.s:1.116	Mon Jan 25 13:08:05 2021
+++ src/sys/arch/mvme68k/mvme68k/locore.s	Wed Mar 31 09:48:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.116 2021/01/25 13:08:05 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.117 2021/03/31 09:48:14 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1296,5 +1296,5 @@ GLOBAL(eintrnames)
 	.even
 
 GLOBAL(intrcnt)
-	.long	0,0,0,0,0,0,0,0,0,0
+	.long	0,0,0,0,0,0,0,0,0
 GLOBAL(eintrcnt)

Index: src/sys/arch/sun2/sun2/locore.s
diff -u src/sys/arch/sun2/sun2/locore.s:1.27 src/sys/arch/sun2/sun2/locore.s:1.28
--- src/sys/arch/sun2/sun2/locore.s:1.27	Tue Aug  6 05:37:30 2019
+++ src/sys/arch/sun2/sun2/locore.s	Wed Mar 31 09:48:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.27 2019/08/06 05:37:30 msaitoh Exp $	*/
+/*	$NetBSD: locore.s,v 1.28 2021/03/31 09:48:15 simonb Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -454,7 +454,7 @@ GLOBAL(eintrnames)
 	.data
 	.even
 GLOBAL(intrcnt)
-	.long	0,0,0,0,0,0,0,0,0,0
+	.long	0,0,0,0,0,0,0,0
 GLOBAL(eintrcnt)
 	.text
 

Index: src/sys/arch/sun3/sun3/locore.s
diff -u src/sys/arch/sun3/sun3/locore.s:1.99 src/sys/arch/sun3/sun3/locore.s:1.100
--- src/sys/arch/sun3/sun3/locore.s:1.99	Tue Aug  6 05:37:30 2019
+++ src/sys/arch/sun3/sun3/locore.s	Wed Mar 31 09:48:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.99 2019/08/06 05:37:30 msaitoh Exp $	*/
+/*	$NetBSD: locore.s,v 1.100 2021/03/31 09:48:15 simonb Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -500,7 +500,7 @@ GLOBAL(eintrnames)
 	.data
 	.even
 GLOBAL(intrcnt)
-	.long	0,0,0,0,0,0,0,0,0,0
+	.long	0,0,0,0,0,0,0,0
 GLOBAL(eintrcnt)
 	.text
 

Index: src/sys/arch/sun3/sun3x/locore.s
diff -u src/sys/arch/sun3/sun3x/locore.s:1.67 src/sys/arch/sun3/sun3x/locore.s:1.68
--- src/sys/arch/sun3/sun3x/locore.s:1.67	Mon Jan 25 13:08:05 2021
+++ src/sys/arch/sun3/sun3x/locore.s	Wed Mar 31 09:48:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.67 2021/01/25 13:08:05 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.68 2021/03/31 09:48:15 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -485,7 +485,7 @@ GLOBAL(eintrnames)
 	.data
 	.even
 GLOBAL(intrcnt)
-	.long	0,0,0,0,0,0,0,0,0,0
+	.long	0,0,0,0,0,0,0,0
 GLOBAL(eintrcnt)
 	.text
 



  1   2   3   4   5   >