CVS commit: src/usr.bin/make

2020-08-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Aug  7 05:13:04 UTC 2020

Modified Files:
src/usr.bin/make: Makefile

Log Message:
make(1): one file per line in the Makefile

Suggested by sjg.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/make/Makefile

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/make/Makefile
diff -u src/usr.bin/make/Makefile:1.81 src/usr.bin/make/Makefile:1.82
--- src/usr.bin/make/Makefile:1.81	Thu Aug  6 05:32:26 2020
+++ src/usr.bin/make/Makefile	Fri Aug  7 05:13:04 2020
@@ -1,10 +1,43 @@
-#	$NetBSD: Makefile,v 1.81 2020/08/06 05:32:26 rillig Exp $
+#	$NetBSD: Makefile,v 1.82 2020/08/07 05:13:04 rillig Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
 PROG=	make
-SRCS=	arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c lst.c main.c
-SRCS+=	make.c make_malloc.c metachar.c parse.c
-SRCS+=	str.c strlist.c suff.c targ.c trace.c var.c util.c
+SRCS=	arch.c
+SRCS+=  buf.c
+SRCS+=  compat.c
+SRCS+=  cond.c
+SRCS+=  dir.c
+SRCS+=  for.c
+SRCS+=  hash.c
+SRCS+=  job.c
+SRCS+=  lst.c
+SRCS+=  main.c
+SRCS+=	make.c
+SRCS+=  make_malloc.c
+SRCS+=  metachar.c
+SRCS+=  parse.c
+SRCS+=	str.c
+SRCS+=  strlist.c
+SRCS+=  suff.c
+SRCS+=  targ.c
+SRCS+=  trace.c
+SRCS+=  var.c
+SRCS+=  util.c
+HDRS=   buf.h
+HDRS+=  config.h
+HDRS+=  dir.h
+HDRS+=  hash.h
+HDRS+=  job.h
+HDRS+=  lst.h
+HDRS+=  make.h
+HDRS+=  make_malloc.h
+HDRS+=  meta.h
+HDRS+=  metachar.h
+HDRS+=  nonints.h
+HDRS+=  pathnames.h
+HDRS+=  sprite.h
+HDRS+=  strlist.h
+HDRS+=  trace.h
 
 # Whether to generate a coverage report after running the tests.
 USE_COVERAGE?=	no		# works only with gcc; clang9 fails to link
@@ -50,8 +83,7 @@ SUBDIR.roff+=	PSD.doc
 SUBDIR+=	unit-tests
 .endif
 
-${SRCS:M*.c:.c=.o}: buf.h config.h dir.h hash.h job.h lst.h make.h make_malloc.h
-${SRCS:M*.c:.c=.o}: meta.h metachar.h nonints.h pathnames.h sprite.h strlist.h trace.h
+${SRCS:M*.c:.c=.o}: ${HDRS}
 
 .include 
 .include 



CVS commit: src/distrib/notes

2020-08-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug  7 00:43:52 UTC 2020

Modified Files:
src/distrib/notes/acorn32: contents
src/distrib/notes/alpha: contents
src/distrib/notes/amd64: contents
src/distrib/notes/amiga: contents
src/distrib/notes/arc: contents
src/distrib/notes/atari: contents
src/distrib/notes/bebox: contents
src/distrib/notes/cats: contents
src/distrib/notes/common: contents
src/distrib/notes/emips: contents
src/distrib/notes/evbarm: contents
src/distrib/notes/evbppc: contents
src/distrib/notes/ews4800mips: contents
src/distrib/notes/hp300: contents
src/distrib/notes/hpcarm: contents
src/distrib/notes/hpcmips: contents
src/distrib/notes/hpcsh: contents
src/distrib/notes/hppa: contents
src/distrib/notes/i386: contents
src/distrib/notes/landisk: contents
src/distrib/notes/mac68k: contents
src/distrib/notes/macppc: contents
src/distrib/notes/mmeye: contents
src/distrib/notes/mvme68k: contents
src/distrib/notes/news68k: contents
src/distrib/notes/newsmips: contents
src/distrib/notes/next68k: contents
src/distrib/notes/ofppc: contents
src/distrib/notes/pmax: contents
src/distrib/notes/prep: contents
src/distrib/notes/rs6000: contents
src/distrib/notes/sandpoint: contents
src/distrib/notes/sgimips: contents
src/distrib/notes/shark: contents
src/distrib/notes/sparc: contents
src/distrib/notes/sparc64: contents
src/distrib/notes/sun2: contents
src/distrib/notes/sun3: contents
src/distrib/notes/vax: contents
src/distrib/notes/x68k: contents

Log Message:
s/developement/development/


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/acorn32/contents
cvs rdiff -u -r1.22 -r1.23 src/distrib/notes/alpha/contents
cvs rdiff -u -r1.11 -r1.12 src/distrib/notes/amd64/contents
cvs rdiff -u -r1.24 -r1.25 src/distrib/notes/amiga/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/arc/contents
cvs rdiff -u -r1.24 -r1.25 src/distrib/notes/atari/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/bebox/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/cats/contents
cvs rdiff -u -r1.181 -r1.182 src/distrib/notes/common/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/emips/contents
cvs rdiff -u -r1.12 -r1.13 src/distrib/notes/evbarm/contents
cvs rdiff -u -r1.7 -r1.8 src/distrib/notes/evbppc/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/ews4800mips/contents
cvs rdiff -u -r1.21 -r1.22 src/distrib/notes/hp300/contents
cvs rdiff -u -r1.7 -r1.8 src/distrib/notes/hpcarm/contents
cvs rdiff -u -r1.14 -r1.15 src/distrib/notes/hpcmips/contents
cvs rdiff -u -r1.7 -r1.8 src/distrib/notes/hpcsh/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/hppa/contents
cvs rdiff -u -r1.33 -r1.34 src/distrib/notes/i386/contents
cvs rdiff -u -r1.7 -r1.8 src/distrib/notes/landisk/contents
cvs rdiff -u -r1.24 -r1.25 src/distrib/notes/mac68k/contents
cvs rdiff -u -r1.18 -r1.19 src/distrib/notes/macppc/contents
cvs rdiff -u -r1.7 -r1.8 src/distrib/notes/mmeye/contents
cvs rdiff -u -r1.17 -r1.18 src/distrib/notes/mvme68k/contents
cvs rdiff -u -r1.10 -r1.11 src/distrib/notes/news68k/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/newsmips/contents
cvs rdiff -u -r1.11 -r1.12 src/distrib/notes/next68k/contents
cvs rdiff -u -r1.7 -r1.8 src/distrib/notes/ofppc/contents
cvs rdiff -u -r1.21 -r1.22 src/distrib/notes/pmax/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/prep/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/rs6000/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/sandpoint/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/sgimips/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/shark/contents
cvs rdiff -u -r1.26 -r1.27 src/distrib/notes/sparc/contents
cvs rdiff -u -r1.11 -r1.12 src/distrib/notes/sparc64/contents
cvs rdiff -u -r1.6 -r1.7 src/distrib/notes/sun2/contents
cvs rdiff -u -r1.20 -r1.21 src/distrib/notes/sun3/contents
cvs rdiff -u -r1.15 -r1.16 src/distrib/notes/vax/contents
cvs rdiff -u -r1.21 -r1.22 src/distrib/notes/x68k/contents

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

Modified files:

Index: src/distrib/notes/acorn32/contents
diff -u src/distrib/notes/acorn32/contents:1.6 src/distrib/notes/acorn32/contents:1.7
--- src/distrib/notes/acorn32/contents:1.6	Sun Nov 24 11:15:31 2019
+++ src/distrib/notes/acorn32/contents	Fri Aug  7 00:43:47 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.6 2019/11/24 11:15:31 martin Exp $
+.\"	$NetBSD: contents,v 1.7 2020/08/07 00:43:47 snj Exp $
 .\"
 .\" Copyright (c) 1999-2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -143,7 +143,7 @@ system call and library manual pages.
 This distribution set contains debug information for
 

CVS commit: src/distrib/notes/evbarm

2020-08-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug  7 00:27:11 UTC 2020

Modified Files:
src/distrib/notes/evbarm: install

Log Message:
fix typo.
new sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/distrib/notes/evbarm/install

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

Modified files:

Index: src/distrib/notes/evbarm/install
diff -u src/distrib/notes/evbarm/install:1.15 src/distrib/notes/evbarm/install:1.16
--- src/distrib/notes/evbarm/install:1.15	Sun Jul 26 11:00:28 2020
+++ src/distrib/notes/evbarm/install	Fri Aug  7 00:27:11 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: install,v 1.15 2020/07/26 11:00:28 jmcneill Exp $
+.\"	$NetBSD: install,v 1.16 2020/08/07 00:27:11 snj Exp $
 .\"
 .\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -43,7 +43,8 @@ If you are using Microsoft Windows, you 
 to write SD card images, which can handle decompression too.
 .It
 To replace the vendor U-Boot bootloader with a "mainline" U-Boot,
-obtain a board-specific image. Bootloaders are provided by the
+obtain a board-specific image.
+Bootloaders are provided by the
 .Pa sysutils/u-boot-*
 packages in
 .Lk https://www.pkgsrc.org/ "pkgsrc" .
@@ -58,7 +59,7 @@ existing
 .Lk https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/aarch64/9.0/All/ "NetBSD binary package set".
 .Pp
 Install the board-specific U-Boot to the SD card,
-e.g. for Allwiner devices (PINE H64 in this case):
+e.g. for Allwinner devices (PINE H64 in this case):
 .Bd -literal
 # dd if=/usr/pkg/share/u-boot/pine-h64/u-boot-sunxi-with-spl.bin of=/dev/rld0d bs=1k seek=8 conv=sync
 .Ed



CVS commit: src/usr.bin/make

2020-08-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Aug  6 17:51:21 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): use consistent name for result of Cmd_Exec


To generate a diff of this commit:
cvs rdiff -u -r1.415 -r1.416 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.415 src/usr.bin/make/var.c:1.416
--- src/usr.bin/make/var.c:1.415	Thu Aug  6 17:48:41 2020
+++ src/usr.bin/make/var.c	Thu Aug  6 17:51:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.416 2020/08/06 17:51:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.416 2020/08/06 17:51:21 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.416 2020/08/06 17:51:21 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2136,7 +2136,7 @@ ApplyModifier_Exclam(const char **pp, Ap
 {
 char delim;
 char *cmd;
-const char *emsg;
+const char *errfmt;
 
 (*pp)++;
 delim = '!';
@@ -2147,15 +2147,15 @@ ApplyModifier_Exclam(const char **pp, Ap
 	return AMR_CLEANUP;
 }
 
-emsg = NULL;
+errfmt = NULL;
 if (st->eflags & VARE_WANTRES)
-	st->newVal = Cmd_Exec(cmd, );
+	st->newVal = Cmd_Exec(cmd, );
 else
 	st->newVal = varNoError;
 free(cmd);
 
-if (emsg != NULL)
-	Error(emsg, st->val);	/* XXX: why still return AMR_OK? */
+if (errfmt != NULL)
+	Error(errfmt, st->val);	/* XXX: why still return AMR_OK? */
 
 if (st->v->flags & VAR_JUNK)
 	st->v->flags |= VAR_KEEP;
@@ -2845,10 +2845,10 @@ ApplyModifier_Assign(const char **pp, Ap
 	Var_Append(st->v->name, val, v_ctxt);
 	break;
 	case '!': {
-	const char *emsg;
-	char *cmd_output = Cmd_Exec(val, );
-	if (emsg)
-		Error(emsg, st->val);
+	const char *errfmt;
+	char *cmd_output = Cmd_Exec(val, );
+	if (errfmt)
+		Error(errfmt, st->val);
 	else
 		Var_Set(st->v->name, cmd_output, v_ctxt);
 	free(cmd_output);
@@ -3216,10 +3216,10 @@ ApplyModifiers(
 	case 's':
 	if (p[1] == 'h' && (p[2] == st.endc || p[2] == ':')) {
 		if (st.eflags & VARE_WANTRES) {
-		const char *emsg;
-		st.newVal = Cmd_Exec(st.val, );
-		if (emsg)
-			Error(emsg, st.val);
+		const char *errfmt;
+		st.newVal = Cmd_Exec(st.val, );
+		if (errfmt)
+			Error(errfmt, st.val);
 		} else
 		st.newVal = varNoError;
 		p += 2;



CVS commit: src/usr.bin/make

2020-08-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Aug  6 17:48:41 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): reduce code size in :D and :U modifier

This affects both the source code size and the binary code size, at
least on x86_64.


To generate a diff of this commit:
cvs rdiff -u -r1.414 -r1.415 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.414 src/usr.bin/make/var.c:1.415
--- src/usr.bin/make/var.c:1.414	Thu Aug  6 17:32:40 2020
+++ src/usr.bin/make/var.c	Thu Aug  6 17:48:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.414 2020/08/06 17:32:40 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.414 2020/08/06 17:32:40 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.414 2020/08/06 17:32:40 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1999,18 +1999,11 @@ ApplyModifier_Defined(const char **pp, A
 Buffer buf;			/* Buffer for patterns */
 const char *p;
 
-VarEvalFlags neflags;
+VarEvalFlags eflags = st->eflags & ~VARE_WANTRES;
 if (st->eflags & VARE_WANTRES) {
-	Boolean wantres;
-	if (**pp == 'U')
-	wantres = (st->v->flags & VAR_JUNK) != 0;
-	else
-	wantres = (st->v->flags & VAR_JUNK) == 0;
-	neflags = st->eflags & ~VARE_WANTRES;
-	if (wantres)
-	neflags |= VARE_WANTRES;
-} else
-	neflags = st->eflags;
+	if ((**pp == 'D') == !(st->v->flags & VAR_JUNK))
+	eflags |= VARE_WANTRES;
+}
 
 /*
  * Pass through mod looking for 1) escaped delimiters,
@@ -2035,7 +2028,7 @@ ApplyModifier_Defined(const char **pp, A
 	int	len;
 	void*freeIt;
 
-	cp2 = Var_Parse(p, st->ctxt, neflags, , );
+	cp2 = Var_Parse(p, st->ctxt, eflags, , );
 	Buf_AddStr(, cp2);
 	free(freeIt);
 	p += len;
@@ -2048,7 +2041,7 @@ ApplyModifier_Defined(const char **pp, A
 
 if (st->v->flags & VAR_JUNK)
 	st->v->flags |= VAR_KEEP;
-if (neflags & VARE_WANTRES) {
+if (eflags & VARE_WANTRES) {
 	st->newVal = Buf_Destroy(, FALSE);
 } else {
 	st->newVal = st->val;



CVS commit: src/usr.bin/make

2020-08-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Aug  6 17:32:40 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): clean up code for variable handling

The VarFlags type doesn't need an underscore.  The underscore is
typically only used for exported functions.

Document the memory allocation details for Var.name.

Use consistent names for Hash_Entry variables.  Quite possibly one of
them was a Lst_Node in ancient times, but that's not a reason to keep
this variable name forever.


To generate a diff of this commit:
cvs rdiff -u -r1.413 -r1.414 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.413 src/usr.bin/make/var.c:1.414
--- src/usr.bin/make/var.c:1.413	Mon Aug  3 21:44:43 2020
+++ src/usr.bin/make/var.c	Thu Aug  6 17:32:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.413 2020/08/03 21:44:43 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.414 2020/08/06 17:32:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.413 2020/08/03 21:44:43 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.414 2020/08/06 17:32:40 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.413 2020/08/03 21:44:43 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.414 2020/08/06 17:32:40 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -216,12 +216,15 @@ typedef enum {
 VAR_REEXPORT	= 0x20,	/* Indicate if var needs re-export.
  * This would be true if it contains $'s */
 VAR_FROM_CMD	= 0x40	/* Variable came from command line */
-} Var_Flags;
+} VarFlags;
 
 typedef struct Var {
-char  *name;	/* the variable's name */
+char  *name;	/* the variable's name; it is allocated for
+ * environment variables and aliased to the
+ * Hash_Entry name for all other variables,
+ * and thus must not be modified */
 Buffer	  val;		/* its value */
-Var_Flags	  flags;	/* miscellaneous status flags */
+VarFlags	  flags;	/* miscellaneous status flags */
 }  Var;
 
 /*
@@ -420,16 +423,16 @@ VarAdd(const char *name, const char *val
 Var *v = bmake_malloc(sizeof(Var));
 
 size_t len = val != NULL ? strlen(val) : 0;
-Hash_Entry *h;
+Hash_Entry *he;
 
 Buf_InitZ(>val, len + 1);
 Buf_AddBytesZ(>val, val, len);
 
 v->flags = 0;
 
-h = Hash_CreateEntry(>context, name, NULL);
-Hash_SetValue(h, v);
-v->name = h->name;
+he = Hash_CreateEntry(>context, name, NULL);
+Hash_SetValue(he, v);
+v->name = he->name;
 VAR_DEBUG_IF(!(ctxt->flags & INTERNAL),
 		 "%s:%s = %s\n", ctxt->name, name, val);
 }
@@ -439,24 +442,24 @@ void
 Var_Delete(const char *name, GNode *ctxt)
 {
 char *name_freeIt = NULL;
-Hash_Entry *ln;
+Hash_Entry *he;
 
 if (strchr(name, '$') != NULL)
 	name = name_freeIt = Var_Subst(name, VAR_GLOBAL, VARE_WANTRES);
-ln = Hash_FindEntry(>context, name);
+he = Hash_FindEntry(>context, name);
 VAR_DEBUG("%s:delete %s%s\n",
-	  ctxt->name, name, ln != NULL ? "" : " (not found)");
+	  ctxt->name, name, he != NULL ? "" : " (not found)");
 free(name_freeIt);
 
-if (ln != NULL) {
-	Var *v = (Var *)Hash_GetValue(ln);
+if (he != NULL) {
+	Var *v = (Var *)Hash_GetValue(he);
 	if (v->flags & VAR_EXPORTED)
 	unsetenv(v->name);
 	if (strcmp(MAKE_EXPORTED, v->name) == 0)
 	var_exportedVars = VAR_EXPORTED_NONE;
-	if (v->name != ln->name)
+	if (v->name != he->name)
 	free(v->name);
-	Hash_DeleteEntry(>context, ln);
+	Hash_DeleteEntry(>context, he);
 	Buf_Destroy(>val, TRUE);
 	free(v);
 }



CVS commit: src/usr.bin/make

2020-08-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Aug  6 17:22:16 UTC 2020

Modified Files:
src/usr.bin/make: hash.h

Log Message:
make(1): remove unused macro Hash_Size


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/hash.h

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/make/hash.h
diff -u src/usr.bin/make/hash.h:1.16 src/usr.bin/make/hash.h:1.17
--- src/usr.bin/make/hash.h:1.16	Sat Aug  1 14:47:49 2020
+++ src/usr.bin/make/hash.h	Thu Aug  6 17:22:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.h,v 1.16 2020/08/01 14:47:49 rillig Exp $	*/
+/*	$NetBSD: hash.h,v 1.17 2020/08/06 17:22:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -133,12 +133,6 @@ typedef struct Hash_Search {
 
 #define Hash_SetValue(h, val) ((h)->clientPtr = (val))
 
-/*
- * Hash_Size(n) returns the number of words in an object of n bytes
- */
-
-#define	Hash_Size(n)	(((n) + sizeof (int) - 1) / sizeof (int))
-
 void Hash_InitTable(Hash_Table *, int);
 void Hash_DeleteTable(Hash_Table *);
 Hash_Entry *Hash_FindEntry(Hash_Table *, const char *);



CVS commit: src/usr.bin/make/unit-tests

2020-08-06 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Aug  6 16:23:53 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
Use -r for recursive


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/make/unit-tests/Makefile

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/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.84 src/usr.bin/make/unit-tests/Makefile:1.85
--- src/usr.bin/make/unit-tests/Makefile:1.84	Thu Aug  6 05:36:33 2020
+++ src/usr.bin/make/unit-tests/Makefile	Thu Aug  6 16:23:52 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.84 2020/08/06 05:36:33 rillig Exp $
+# $NetBSD: Makefile,v 1.85 2020/08/06 16:23:52 sjg Exp $
 #
 # Unit tests for make(1)
 #
@@ -103,7 +103,7 @@ FLAGS.envfirst=		-e
 FLAGS.export=		-r
 FLAGS.lint=		-dL -k
 FLAGS.order=		-j1
-FLAGS.recursive=	-dL
+FLAGS.recursive=	-dL -r
 FLAGS.vardebug=		-k -dv FROM_CMDLINE=
 
 # Some tests need extra post-processing.



CVS commit: src/usr.bin/make/unit-tests

2020-08-06 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Aug  6 16:09:33 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: recursive.exp

Log Message:
Update test result


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/recursive.exp

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/make/unit-tests/recursive.exp
diff -u src/usr.bin/make/unit-tests/recursive.exp:1.1 src/usr.bin/make/unit-tests/recursive.exp:1.2
--- src/usr.bin/make/unit-tests/recursive.exp:1.1	Thu Aug  6 05:36:33 2020
+++ src/usr.bin/make/unit-tests/recursive.exp	Thu Aug  6 16:09:33 2020
@@ -1,4 +1,5 @@
-Variable am__v_lt_ is recursive.
-
+make: "recursive.mk" line 34: Unclosed variable "MISSING_PAREN"
+make: "recursive.mk" line 35: Unclosed variable "MISSING_BRACE"
+make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
-exit status 2
+exit status 1



CVS commit: src/usr.bin/make

2020-08-06 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Aug  6 16:03:04 UTC 2020

Modified Files:
src/usr.bin/make: parse.c

Log Message:
Remove VARE_WANTRES for LINT

We need the parsing checked.
I might make sense to add a VARE_LINT flag for corner cases.
Time will tell.

Reviewed by: rillig


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/usr.bin/make/parse.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/make/parse.c
diff -u src/usr.bin/make/parse.c:1.248 src/usr.bin/make/parse.c:1.249
--- src/usr.bin/make/parse.c:1.248	Mon Aug  3 20:43:41 2020
+++ src/usr.bin/make/parse.c	Thu Aug  6 16:03:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.248 2020/08/03 20:43:41 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.249 2020/08/06 16:03:04 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.248 2020/08/03 20:43:41 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.249 2020/08/06 16:03:04 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.248 2020/08/03 20:43:41 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.249 2020/08/06 16:03:04 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1946,7 +1946,7 @@ Parse_DoVar(char *line, GNode *ctxt)
 	/* sanity check now */
 	char *cp2;
 
-	cp2 = Var_Subst(cp, ctxt, VARE_WANTRES|VARE_ASSIGN);
+	cp2 = Var_Subst(cp, ctxt, VARE_ASSIGN);
 	free(cp2);
 	}
 }



CVS commit: src

2020-08-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Aug  6 10:00:21 UTC 2020

Modified Files:
src/common/lib/libc/arch/mips/atomic: atomic_add.S atomic_and.S
atomic_cas.S atomic_dec.S atomic_inc.S atomic_or.S atomic_swap.S
src/sys/arch/mips/include: asm.h
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
Centralise SYNC/BDSYNC in asm.h and introduce a new LLCSCSYNC and use it
before any ll/sc sequences.

Define LLSCSYNC as syncw; syncw for cnMIPS - issue two as early cnMIPS
has errat{um,a} that means the first can fail.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/mips/atomic/atomic_add.S \
src/common/lib/libc/arch/mips/atomic/atomic_dec.S \
src/common/lib/libc/arch/mips/atomic/atomic_inc.S \
src/common/lib/libc/arch/mips/atomic/atomic_swap.S
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/mips/atomic/atomic_and.S \
src/common/lib/libc/arch/mips/atomic/atomic_or.S
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/mips/atomic/atomic_cas.S
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/mips/lock_stubs_llsc.S

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

Modified files:

Index: src/common/lib/libc/arch/mips/atomic/atomic_add.S
diff -u src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.6 src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.7
--- src/common/lib/libc/arch/mips/atomic/atomic_add.S:1.6	Sat Aug  1 09:26:49 2020
+++ src/common/lib/libc/arch/mips/atomic/atomic_add.S	Thu Aug  6 10:00:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_add.S,v 1.6 2020/08/01 09:26:49 skrll Exp $	*/
+/*	$NetBSD: atomic_add.S,v 1.7 2020/08/06 10:00:21 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_add.S,v 1.6 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_add.S,v 1.7 2020/08/06 10:00:21 skrll Exp $")
 
 	.text
 	.set	noreorder
@@ -49,6 +49,7 @@ LEAF(_atomic_add_32)
 #if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
 	saa		a1, (a0)
 #else
+	LLSCSYNC
 1:	INT_LL		t0, 0(a0)
 	 nop
 	INT_ADDU	t0, a1
@@ -62,6 +63,7 @@ END(_atomic_add_32)
 ATOMIC_OP_ALIAS(atomic_add_32, _atomic_add_32)
 
 LEAF(_atomic_add_32_nv)
+	LLSCSYNC
 1:	INT_LL		v0, 0(a0)
 	 nop
 	INT_ADDU	v0, a1
@@ -79,6 +81,7 @@ LEAF(_atomic_add_64)
 #if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
 	saad		a1, (a0)
 #else
+	LLSCSYNC
 1:	REG_LL		t0, 0(a0)
 	 nop
 	REG_ADDU	t0, a1
@@ -92,6 +95,7 @@ END(_atomic_add_64)
 ATOMIC_OP_ALIAS(atomic_add_64, _atomic_add_64)
 
 LEAF(_atomic_add_64_nv)
+	LLSCSYNC
 1:	REG_LL		v0, 0(a0)
 	 nop
 	REG_ADDU	v0, a1
Index: src/common/lib/libc/arch/mips/atomic/atomic_dec.S
diff -u src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.6 src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.7
--- src/common/lib/libc/arch/mips/atomic/atomic_dec.S:1.6	Sat Aug  1 09:26:49 2020
+++ src/common/lib/libc/arch/mips/atomic/atomic_dec.S	Thu Aug  6 10:00:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_dec.S,v 1.6 2020/08/01 09:26:49 skrll Exp $	*/
+/*	$NetBSD: atomic_dec.S,v 1.7 2020/08/06 10:00:21 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_dec.S,v 1.6 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_dec.S,v 1.7 2020/08/06 10:00:21 skrll Exp $")
 
 	.text
 	.set	noreorder
@@ -49,6 +49,7 @@ LEAF(_atomic_dec_32)
 	li		t0, -1
 	saa		t0, (a0)
 #else
+	LLSCSYNC
 1:	INT_LL		t0, 0(a0)
 	 nop
 	INT_ADDU	t0, -1
@@ -62,6 +63,7 @@ END(_atomic_dec_32)
 ATOMIC_OP_ALIAS(atomic_dec_32, _atomic_dec_32)
 
 LEAF(_atomic_dec_32_nv)
+	LLSCSYNC
 1:	INT_LL		v0, 0(a0)
 	 nop
 	INT_ADDU	v0, -1
@@ -80,6 +82,7 @@ LEAF(_atomic_dec_64)
 	li		t0, -1
 	saad		t0, (a0)
 #else
+	LLSCSYNC
 1:	REG_LL		t0, 0(a0)
 	 nop
 	REG_ADDU	t0, -1
@@ -93,6 +96,7 @@ END(_atomic_dec_64)
 ATOMIC_OP_ALIAS(atomic_dec_64, _atomic_dec_64)
 
 LEAF(_atomic_dec_64_nv)
+	LLSCSYNC
 1:	REG_LL		v0, 0(a0)
 	 nop
 	REG_ADDU	v0, -1
Index: src/common/lib/libc/arch/mips/atomic/atomic_inc.S
diff -u src/common/lib/libc/arch/mips/atomic/atomic_inc.S:1.6 src/common/lib/libc/arch/mips/atomic/atomic_inc.S:1.7
--- src/common/lib/libc/arch/mips/atomic/atomic_inc.S:1.6	Sat Aug  1 09:26:49 2020
+++ src/common/lib/libc/arch/mips/atomic/atomic_inc.S	Thu Aug  6 10:00:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_inc.S,v 1.6 2020/08/01 09:26:49 skrll Exp $	*/
+/*	$NetBSD: atomic_inc.S,v 1.7 2020/08/06 10:00:21 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_inc.S,v 1.6 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_inc.S,v 1.7 2020/08/06 10:00:21 skrll Exp $")
 
 	.text
 	.set	noreorder
@@ -50,6 +50,7 @@ LEAF(_atomic_inc_32)
 	li		t0, 1

CVS commit: src/usr.bin/netstat

2020-08-06 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Aug  6 07:38:54 UTC 2020

Modified Files:
src/usr.bin/netstat: inet.c inet6.c

Log Message:
add missing {IP,IP6}_STAT_NOIPSEC to netstat.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/usr.bin/netstat/inet.c
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/netstat/inet6.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/netstat/inet.c
diff -u src/usr.bin/netstat/inet.c:1.110 src/usr.bin/netstat/inet.c:1.111
--- src/usr.bin/netstat/inet.c:1.110	Sun Aug 18 04:14:40 2019
+++ src/usr.bin/netstat/inet.c	Thu Aug  6 07:38:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet.c,v 1.110 2019/08/18 04:14:40 kamil Exp $	*/
+/*	$NetBSD: inet.c,v 1.111 2020/08/06 07:38:54 knakahara Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)inet.c	8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: inet.c,v 1.110 2019/08/18 04:14:40 kamil Exp $");
+__RCSID("$NetBSD: inet.c,v 1.111 2020/08/06 07:38:54 knakahara Exp $");
 #endif
 #endif /* not lint */
 
@@ -622,6 +622,7 @@ ip_stats(u_long off, const char *name)
 	p(IP_STAT_CANTFORWARD, "\t%" PRIu64 " packet%s not forwardable\n");
 	p(IP_STAT_REDIRECTSENT, "\t%" PRIu64 " redirect%s sent\n");
 	p(IP_STAT_NOGIF, "\t%" PRIu64 " packet%s no matching gif found\n");
+	p(IP_STAT_NOIPSEC, "\t%" PRIu64 " packet%s no matching ipsecif found\n");
 	p(IP_STAT_LOCALOUT, "\t%" PRIu64 " packet%s sent from this host\n");
 	p(IP_STAT_RAWOUT, "\t%" PRIu64 " packet%s sent with fabricated ip header\n");
 	p(IP_STAT_ODROPPED, "\t%" PRIu64 " output packet%s dropped due to no bufs, etc.\n");

Index: src/usr.bin/netstat/inet6.c
diff -u src/usr.bin/netstat/inet6.c:1.74 src/usr.bin/netstat/inet6.c:1.75
--- src/usr.bin/netstat/inet6.c:1.74	Thu Apr 23 00:24:16 2020
+++ src/usr.bin/netstat/inet6.c	Thu Aug  6 07:38:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet6.c,v 1.74 2020/04/23 00:24:16 joerg Exp $	*/
+/*	$NetBSD: inet6.c,v 1.75 2020/08/06 07:38:54 knakahara Exp $	*/
 /*	BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp	*/
 
 /*
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inet.c	8.4 (Berkeley) 4/20/94";
 #else
-__RCSID("$NetBSD: inet6.c,v 1.74 2020/04/23 00:24:16 joerg Exp $");
+__RCSID("$NetBSD: inet6.c,v 1.75 2020/08/06 07:38:54 knakahara Exp $");
 #endif
 #endif /* not lint */
 
@@ -724,6 +724,7 @@ ip6_stats(u_long off, const char *name)
 	p(IP6_STAT_EXTHDRTOOLONG,
 	"\t%llu packet%s whose headers are not continuous\n");
 	p(IP6_STAT_NOGIF, "\t%llu tunneling packet%s that can't find gif\n");
+	p(IP6_STAT_NOIPSEC, "\t%llu tunneling packet%s that can't find ipsecif\n");
 	p(IP6_STAT_TOOMANYHDR,
 	"\t%llu packet%s discarded due to too many headers\n");
 



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

2020-08-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Aug  6 06:50:39 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: fault.c

Log Message:
No need to recover from fault from within a hardware interrupt handler.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/aarch64/fault.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/aarch64/aarch64/fault.c
diff -u src/sys/arch/aarch64/aarch64/fault.c:1.17 src/sys/arch/aarch64/aarch64/fault.c:1.18
--- src/sys/arch/aarch64/aarch64/fault.c:1.17	Thu Aug  6 06:49:55 2020
+++ src/sys/arch/aarch64/aarch64/fault.c	Thu Aug  6 06:50:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.17 2020/08/06 06:49:55 ryo Exp $	*/
+/*	$NetBSD: fault.c,v 1.18 2020/08/06 06:50:39 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.17 2020/08/06 06:49:55 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.18 2020/08/06 06:50:39 ryo Exp $");
 
 #include "opt_compat_netbsd32.h"
 #include "opt_ddb.h"
@@ -223,10 +223,12 @@ data_abort_handler(struct trapframe *tf,
 
  do_fault:
 	/* faultbail path? */
-	fb = cpu_disable_onfault();
-	if (fb != NULL) {
-		cpu_jump_onfault(tf, fb, EFAULT);
-		return;
+	if (curcpu()->ci_intr_depth == 0) {
+		fb = cpu_disable_onfault();
+		if (fb != NULL) {
+			cpu_jump_onfault(tf, fb, EFAULT);
+			return;
+		}
 	}
 
  handle_fault:



CVS commit: src/sys/arch/aarch64

2020-08-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Aug  6 06:49:55 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: copyinout.S cpuswitch.S fault.c fusu.S
genassym.cf
src/sys/arch/aarch64/include: frame.h machdep.h

Log Message:
revert the changes of 
http://mail-index.netbsd.org/source-changes/2020/08/03/msg120183.html

This change is overengineered.
bus_space_{peek,poke}_N does not have to be reentrant nor available for 
interrupt context.

requested by skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/aarch64/copyinout.S
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/aarch64/aarch64/cpuswitch.S
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/aarch64/aarch64/fault.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/fusu.S
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/include/frame.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/aarch64/include/machdep.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/aarch64/copyinout.S
diff -u src/sys/arch/aarch64/aarch64/copyinout.S:1.13 src/sys/arch/aarch64/aarch64/copyinout.S:1.14
--- src/sys/arch/aarch64/aarch64/copyinout.S:1.13	Mon Aug  3 06:29:59 2020
+++ src/sys/arch/aarch64/aarch64/copyinout.S	Thu Aug  6 06:49:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: copyinout.S,v 1.13 2020/08/03 06:29:59 ryo Exp $ */
+/* $NetBSD: copyinout.S,v 1.14 2020/08/06 06:49:55 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: copyinout.S,v 1.13 2020/08/03 06:29:59 ryo Exp $");
+RCSID("$NetBSD: copyinout.S,v 1.14 2020/08/06 06:49:55 ryo Exp $");
 
 #ifdef ARMV81_PAN
 #define PAN_ENABLE	\
@@ -63,7 +63,7 @@ RCSID("$NetBSD: copyinout.S,v 1.13 2020/
 	mov	x19, x0			/* x19 = arg0 */
 	mov	x20, x1			/* x20 = arg1 */
 
-	/* if (cpu_set_onfault(fb) != 0) return error */
+	/* if (cpu_set_onfault(fb) != 0) return -1 */
 	sub	sp, sp, #FB_T_SIZE	/* allocate struct faultbuf */
 	mov	x0, sp			/* x0 = faultbuf */
 	stp	x2, x3, [sp, #-16]!	/* save x2, x3 */
@@ -79,8 +79,10 @@ RCSID("$NetBSD: copyinout.S,v 1.13 2020/
 	.endm
 
 	.macro exit_cpu_onfault
-	bl	cpu_unset_onfault
-	mov	x8, xzr
+	/* curlwp->l_md.md_onfault = NULL */
+	mrs	x0, tpidr_el1			/* curcpu */
+	ldr	x0, [x0, #CI_CURLWP]		/* x0 = curlwp */
+	str	xzr, [x0, #L_MD_ONFAULT]	/* lwp->l_md_onfault = NULL */
 9:
 	PAN_ENABLE/* enable PAN */
 	add	sp, sp, #FB_T_SIZE		/* pop stack */

Index: src/sys/arch/aarch64/aarch64/cpuswitch.S
diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.23 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.24
--- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.23	Mon Aug  3 05:56:50 2020
+++ src/sys/arch/aarch64/aarch64/cpuswitch.S	Thu Aug  6 06:49:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.23 2020/08/03 05:56:50 ryo Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.24 2020/08/06 06:49:55 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include "opt_ddb.h"
 #include "opt_kasan.h"
 
-RCSID("$NetBSD: cpuswitch.S,v 1.23 2020/08/03 05:56:50 ryo Exp $")
+RCSID("$NetBSD: cpuswitch.S,v 1.24 2020/08/06 06:49:55 ryo Exp $")
 
 	ARMV8_DEFINE_OPTIONS
 
@@ -447,40 +447,22 @@ END(cpu_Debugger)
  */
 ENTRY_NP(cpu_set_onfault)
 	mrs	x3, tpidr_el1
-	ldr	x2, [x3, #CI_CURLWP]	/* x2 = curcpu()->ci_curlwp */
-	ldr	x1, [x2, #L_MD_ONFAULT]
-	str	x1, [x0, #FB_OLD]	/* fb->fb_old = curlwp->l_md.md_onfault */
-	ldr	w1, [x3, #CI_INTR_DEPTH]
-	str	w1, [x0, #FB_IDEPTH]	/* fb->fb_idepth = curcpu()->ci_intr_depth */
+	ldr	x2, [x3, #CI_CURLWP]	/* curlwp = curcpu()->ci_curlwp */
 	str	x0, [x2, #L_MD_ONFAULT] /* l_md.md_onfault = fb */
 
-	stp	x19, x20, [x0, #FB_REG_X19]
-	stp	x21, x22, [x0, #FB_REG_X21]
-	stp	x23, x24, [x0, #FB_REG_X23]
-	stp	x25, x26, [x0, #FB_REG_X25]
-	stp	x27, x28, [x0, #FB_REG_X27]
-	stp	x29, x30, [x0, #FB_REG_X29]
+	stp	x19, x20, [x0, #(FB_X19 * 8)]
+	stp	x21, x22, [x0, #(FB_X21 * 8)]
+	stp	x23, x24, [x0, #(FB_X23 * 8)]
+	stp	x25, x26, [x0, #(FB_X25 * 8)]
+	stp	x27, x28, [x0, #(FB_X27 * 8)]
+	stp	x29, x30, [x0, #(FB_X29 * 8)]
 	mov	x1, sp
-	str	x1, [x0, #FB_REG_SP]
+	str	x1, [x0, #(FB_SP * 8)]
 	mov	x0, #0
 	ret
 END(cpu_set_onfault)
 
 /*
- * void cpu_unset_onfault(void)
- */
-ENTRY_NP(cpu_unset_onfault)
-	mrs	x3, tpidr_el1
-	ldr	x2, [x3, #CI_CURLWP]	/* curlwp = curcpu()->ci_curlwp */
-	ldr	x0, [x2, #L_MD_ONFAULT]	/* x0 = curlwp->l_md.md_onfault */
-	cbz	x0, 1f
-	ldr	x0, [x0, #FB_OLD]	/* restore old faultbuf */
-	str	x0, [x2, #L_MD_ONFAULT]
-1:
-	ret
-END(cpu_unset_onfault)
-
-/*
  * setjmp(9)
  * int setjmp(label_t *label);
  * void longjmp(label_t *label);

Index: src/sys/arch/aarch64/aarch64/fault.c
diff -u src/sys/arch/aarch64/aarch64/fault.c:1.16 src/sys/arch/aarch64/aarch64/fault.c:1.17
--- src/sys/arch/aarch64/aarch64/fault.c:1.16	Mon Aug  3 05:56:50 2020
+++