CVS commit: src/sys/arch/shark

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Nov 22 03:57:19 UTC 2020

Modified Files:
src/sys/arch/shark/isa: isa_irqhandler.c isa_shark_machdep.c
src/sys/arch/shark/ofw: if_cs_ofisa_machdep.c igsfb_ofbus.c

Log Message:
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/shark/isa/isa_irqhandler.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/shark/isa/isa_shark_machdep.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/shark/ofw/if_cs_ofisa_machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/shark/ofw/igsfb_ofbus.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/shark/isa/isa_irqhandler.c
diff -u src/sys/arch/shark/isa/isa_irqhandler.c:1.28 src/sys/arch/shark/isa/isa_irqhandler.c:1.29
--- src/sys/arch/shark/isa/isa_irqhandler.c:1.28	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/shark/isa/isa_irqhandler.c	Sun Nov 22 03:57:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_irqhandler.c,v 1.28 2019/11/10 21:16:32 chs Exp $	*/
+/*	$NetBSD: isa_irqhandler.c,v 1.29 2020/11/22 03:57:19 thorpej Exp $	*/
 
 /*
  * Copyright 1997
@@ -75,12 +75,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_irqhandler.c,v 1.28 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_irqhandler.c,v 1.29 2020/11/22 03:57:19 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -311,14 +311,14 @@ intr_claim(int irq, int level, int (*ih_
 {
 	irqhandler_t *ih;
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK | M_ZERO);
+	ih = kmem_zalloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_level = level;
 	ih->ih_func = ih_func;
 	ih->ih_arg = ih_arg;
 	ih->ih_flags = 0;
 
 	if (irq_claim(irq, ih, group, name) != 0) {
-		free(ih, M_DEVBUF);
+		kmem_free(ih, sizeof(*ih));
 		return(NULL);
 	}
 
@@ -331,7 +331,7 @@ intr_release(void *arg)
 	irqhandler_t *ih = (irqhandler_t *)arg;
 
 	if (irq_release(ih->ih_num, ih) == 0) {
-		free(ih, M_DEVBUF);
+		kmem_free(ih, sizeof(*ih));
 		return(0);
 	}
 	return(1);

Index: src/sys/arch/shark/isa/isa_shark_machdep.c
diff -u src/sys/arch/shark/isa/isa_shark_machdep.c:1.17 src/sys/arch/shark/isa/isa_shark_machdep.c:1.18
--- src/sys/arch/shark/isa/isa_shark_machdep.c:1.17	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/shark/isa/isa_shark_machdep.c	Sun Nov 22 03:57:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_shark_machdep.c,v 1.17 2019/11/10 21:16:32 chs Exp $	*/
+/*	$NetBSD: isa_shark_machdep.c,v 1.18 2020/11/22 03:57:19 thorpej Exp $	*/
 
 /*
  * Copyright 1997
@@ -34,14 +34,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_shark_machdep.c,v 1.17 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_shark_machdep.c,v 1.18 2020/11/22 03:57:19 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -167,7 +167,7 @@ isa_intr_establish(isa_chipset_tag_t ic,
 {
 	irqhandler_t *ih;
 
-	ih = malloc(sizeof *ih, M_DEVBUF, M_ZERO | M_WAITOK);
+	ih = kmem_zalloc(sizeof *ih, KM_SLEEP);
 
 	if (!LEGAL_IRQ(irq) || type == IST_NONE)
 		panic("intr_establish: bogus irq or type");

Index: src/sys/arch/shark/ofw/if_cs_ofisa_machdep.c
diff -u src/sys/arch/shark/ofw/if_cs_ofisa_machdep.c:1.13 src/sys/arch/shark/ofw/if_cs_ofisa_machdep.c:1.14
--- src/sys/arch/shark/ofw/if_cs_ofisa_machdep.c:1.13	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/shark/ofw/if_cs_ofisa_machdep.c	Sun Nov 22 03:57:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cs_ofisa_machdep.c,v 1.13 2019/11/10 21:16:32 chs Exp $	*/
+/*	$NetBSD: if_cs_ofisa_machdep.c,v 1.14 2020/11/22 03:57:19 thorpej Exp $	*/
 
 /*
  * Copyright 1998
@@ -38,14 +38,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cs_ofisa_machdep.c,v 1.13 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cs_ofisa_machdep.c,v 1.14 2020/11/22 03:57:19 thorpej Exp $");
 
 #include "opt_compat_old_ofw.h"
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -141,7 +141,7 @@ cs_ofisa_md_media_fixup(device_t parent,
 
 	if (1) {		/* XXX old firmware compat enabled */
 		if (media == NULL) {
-			media = malloc(2 * sizeof(int), M_TEMP, M_WAITOK);
+			media = kmem_alloc(2 * sizeof(int), KM_SLEEP);
 			media[0] = IFM_ETHER | IFM_10_T;
 			media[1] = IFM_ETHER | IFM_10_T | IFM_FDX;
 			*nmediap = 2;

Index: src/sys/arch/shark/ofw/igsfb_ofbus.c
diff -u src/sys/arch/shark/ofw/igsfb_ofbus.c:1.18 src/sys/arch/shark/ofw/igsfb_ofbus.c:1.19
--- src/sys/arch/shark/ofw/igsfb_ofbus.c:1.18	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/shark/ofw/igsfb_ofbus.c	Sun Nov 22 03:57:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: igsfb_ofbus.c,v 1.18 2019/11/10 21:16:32 chs Exp $ */
+/*	$NetBSD: igsfb_ofbus.c,v 1.19 2020/11/22 03:57:19 thorpej Exp $ */
 
 /*
  * Copyright (c) 2006 Michael Lorenz
@@ -31,13 +31,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/sys/arch/sparc

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Nov 22 03:55:33 UTC 2020

Modified Files:
src/sys/arch/sparc/dev: bootbus.c ebus.c fd.c pckbc_js.c sbus.c sw.c
vme_machdep.c
src/sys/arch/sparc/sparc: clock.c cpuunit.c intr.c machdep.c msiiep.c

Log Message:
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/dev/bootbus.c \
src/sys/arch/sparc/dev/pckbc_js.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sparc/dev/ebus.c
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/sparc/dev/fd.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/sparc/dev/sbus.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc/dev/sw.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sparc/dev/vme_machdep.c
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sparc/sparc/clock.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/sparc/cpuunit.c
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/sparc/sparc/intr.c
cvs rdiff -u -r1.334 -r1.335 src/sys/arch/sparc/sparc/machdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sparc/sparc/msiiep.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/dev/bootbus.c
diff -u src/sys/arch/sparc/dev/bootbus.c:1.19 src/sys/arch/sparc/dev/bootbus.c:1.20
--- src/sys/arch/sparc/dev/bootbus.c:1.19	Mon Jul 18 00:31:13 2011
+++ src/sys/arch/sparc/dev/bootbus.c	Sun Nov 22 03:55:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $	*/
+/*	$NetBSD: bootbus.c,v 1.20 2020/11/22 03:55:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,10 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.20 2020/11/22 03:55:33 thorpej Exp $");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -95,8 +96,7 @@ bootbus_attach(device_t parent, device_t
 	/*
 	 * Initialize the bus space tag we pass on to our children.
 	 */
-	sc->sc_bustag = malloc(sizeof(*sc->sc_bustag), M_DEVBUF,
-	M_WAITOK|M_ZERO);
+	sc->sc_bustag = kmem_zalloc(sizeof(*sc->sc_bustag), KM_SLEEP);
 	sc->sc_bustag->cookie = sc;
 	sc->sc_bustag->parent = sc->sc_st;
 	sc->sc_bustag->sparc_bus_map = sc->sc_st->sparc_bus_map;
Index: src/sys/arch/sparc/dev/pckbc_js.c
diff -u src/sys/arch/sparc/dev/pckbc_js.c:1.19 src/sys/arch/sparc/dev/pckbc_js.c:1.20
--- src/sys/arch/sparc/dev/pckbc_js.c:1.19	Sat Oct 13 17:58:54 2012
+++ src/sys/arch/sparc/dev/pckbc_js.c	Sun Nov 22 03:55:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pckbc_js.c,v 1.19 2012/10/13 17:58:54 jdc Exp $ */
+/*	$NetBSD: pckbc_js.c,v 1.20 2020/11/22 03:55:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -28,13 +28,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pckbc_js.c,v 1.19 2012/10/13 17:58:54 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_js.c,v 1.20 2020/11/22 03:55:33 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -194,8 +194,7 @@ pckbc_js_attach_common(struct pckbc_js_s
 			return;
 		}
 
-		t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
-		memset(t, 0, sizeof(struct pckbc_internal));
+		t = kmem_zalloc(sizeof(struct pckbc_internal), KM_SLEEP);
 		t->t_iot = iot;
 		t->t_ioh_d = ioh_d;
 		t->t_ioh_c = ioh_c;

Index: src/sys/arch/sparc/dev/ebus.c
diff -u src/sys/arch/sparc/dev/ebus.c:1.37 src/sys/arch/sparc/dev/ebus.c:1.38
--- src/sys/arch/sparc/dev/ebus.c:1.37	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/sparc/dev/ebus.c	Sun Nov 22 03:55:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebus.c,v 1.37 2019/11/10 21:16:32 chs Exp $ */
+/*	$NetBSD: ebus.c,v 1.38 2020/11/22 03:55:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.37 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.38 2020/11/22 03:55:33 thorpej Exp $");
 
 #if defined(DEBUG) && !defined(EBUS_DEBUG)
 #define EBUS_DEBUG
@@ -56,6 +56,7 @@ int ebus_debug = 0;
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -421,8 +422,7 @@ ebus_alloc_dma_tag(struct ebus_softc *sc
 {
 	bus_dma_tag_t dt;
 
-	dt = (bus_dma_tag_t)
-		malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_WAITOK | M_ZERO);
+	dt = kmem_zalloc(sizeof(*dt), KM_SLEEP);
 	dt->_cookie = sc;
 #define PCOPY(x)	dt->x = pdt->x
 	PCOPY(_dmamap_create);

Index: src/sys/arch/sparc/dev/fd.c
diff -u src/sys/arch/sparc/dev/fd.c:1.160 src/sys/arch/sparc/dev/fd.c:1.161
--- src/sys/arch/sparc/dev/fd.c:1.160	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/sparc/dev/fd.c	Sun Nov 22 03:55:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.160 2019/11/10 21:16:32 chs Exp $	*/
+/*	$NetBSD: fd.c,v 1.161 2020/11/22 03:55:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include 

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 23:51:28 UTC 2020

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

Log Message:
make(1): remove module name from local functions in Suff module

The module name doesn't provide any useful information.  More often than
not, it creates a wrong impression of a very specific function name; the
function name has to be expressive enough even without the module name.
The word Suff may have even be misleading since not all of the functions
in this module affect suffixes, some also simply work on strings.

Module boundaries are marked by function names of the form Module_Func.
Therefore, local function names don't need to start with the module
name.

Rename the FindDeps functions to list their hierarchical position in the
function name, from broad to narrow.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.280 src/usr.bin/make/suff.c:1.281
--- src/usr.bin/make/suff.c:1.280	Sat Nov 21 23:25:29 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 23:51:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.280 2020/11/21 23:25:29 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.281 2020/11/21 23:51:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.280 2020/11/21 23:25:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.281 2020/11/21 23:51:28 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -238,7 +238,7 @@ Suffix_Unassign(Suffix **var)
  * Return NULL if it ain't, pointer to character in str after prefix if so.
  */
 static const char *
-SuffStrIsPrefix(const char *pref, const char *str)
+StrIsPrefix(const char *pref, const char *str)
 {
 while (*str && *pref == *str) {
 	pref++;
@@ -392,7 +392,7 @@ SuffixList_Insert(SuffixList *list, Suff
 }
 
 static void
-SuffRelate(Suffix *srcSuff, Suffix *targSuff)
+Relate(Suffix *srcSuff, Suffix *targSuff)
 {
 SuffixList_Insert(targSuff->children, srcSuff);
 SuffixList_Insert(srcSuff->parents, targSuff);
@@ -447,7 +447,7 @@ Suff_ClearSuffixes(void)
  * Return TRUE if the string is a valid transformation.
  */
 static Boolean
-SuffParseTransform(const char *str, Suffix **out_src, Suffix **out_targ)
+ParseTransform(const char *str, Suffix **out_src, Suffix **out_targ)
 {
 SuffixListNode *ln;
 Suffix *singleSrc = NULL;
@@ -461,7 +461,7 @@ SuffParseTransform(const char *str, Suff
 for (ln = sufflist->first; ln != NULL; ln = ln->next) {
 	Suffix *src = ln->datum;
 
-	if (SuffStrIsPrefix(src->name, str) == NULL)
+	if (StrIsPrefix(src->name, str) == NULL)
 	continue;
 
 	if (str[src->nameLen] == '\0') {
@@ -501,7 +501,7 @@ Suff_IsTransform(const char *str)
 {
 Suffix *src, *targ;
 
-return SuffParseTransform(str, , );
+return ParseTransform(str, , );
 }
 
 /* Add the transformation rule to the list of rules and place the
@@ -545,7 +545,7 @@ Suff_AddTransform(const char *name)
 gn->type = OP_TRANSFORM;
 
 {
-	Boolean ok = SuffParseTransform(name, , );
+	Boolean ok = ParseTransform(name, , );
 	assert(ok);
 	(void)ok;
 }
@@ -555,7 +555,7 @@ Suff_AddTransform(const char *name)
  */
 SUFF_DEBUG2("defining transformation from `%s' to `%s'\n",
 		srcSuff->name, targSuff->name);
-SuffRelate(srcSuff, targSuff);
+Relate(srcSuff, targSuff);
 
 return gn;
 }
@@ -590,7 +590,7 @@ Suff_EndTransform(GNode *gn)
  * SuffParseTransform() may fail for special rules which are not
  * actual transformation rules. (e.g. .DEFAULT)
  */
-if (!SuffParseTransform(gn->name, , ))
+if (!ParseTransform(gn->name, , ))
 	return;
 
 SUFF_DEBUG2("deleting incomplete transformation from `%s' to `%s'\n",
@@ -616,7 +616,7 @@ Suff_EndTransform(GNode *gn)
  *	suff		Suffix to rebuild
  */
 static void
-SuffRebuildGraph(GNode *transform, Suffix *suff)
+RebuildGraph(GNode *transform, Suffix *suff)
 {
 const char *name = transform->name;
 size_t nameLen = strlen(name);
@@ -625,12 +625,12 @@ SuffRebuildGraph(GNode *transform, Suffi
 /*
  * First see if it is a transformation from this suffix.
  */
-toName = SuffStrIsPrefix(suff->name, name);
+toName = StrIsPrefix(suff->name, name);
 if (toName != NULL) {
 	Suffix *to = FindSuffixByName(toName);
 	if (to != NULL) {
 	/* Link in and return, since it can't be anything else. */
-	SuffRelate(suff, to);
+	Relate(suff, to);
 	return;
 	}
 }
@@ -642,7 +642,7 @@ SuffRebuildGraph(GNode *transform, Suffi
 if (toName != NULL) {
 	Suffix *from = FindSuffixByNameLen(name, (size_t)(toName - name));
 	if (from != NULL)
-	SuffRelate(from, suff);
+	

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 23:25:30 UTC 2020

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

Log Message:
make(1): remove redundant null check in SuffFindCmds

Src.suff is never null.  It is initialized in the constructor and then
never modified again.  It cannot be marked as const though because memory
allocation and initialization are separated in SrcNew.


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.279 src/usr.bin/make/suff.c:1.280
--- src/usr.bin/make/suff.c:1.279	Sat Nov 21 23:09:07 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 23:25:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.279 2020/11/21 23:09:07 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.280 2020/11/21 23:25:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.279 2020/11/21 23:09:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.280 2020/11/21 23:25:29 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1087,9 +1087,7 @@ SuffFindCmds(Src *targ, SrcList *slst)
 	 * XXX: Handle multi-stage transformations here, too.
 	 */
 
-	/* XXX: Can targ->suff be NULL here? */
-	if (targ->suff != NULL &&
-	Lst_FindDatum(suff->parents, targ->suff) != NULL)
+	if (Lst_FindDatum(suff->parents, targ->suff) != NULL)
 	break;
 }
 



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 23:09:07 UTC 2020

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

Log Message:
make(1): clean up Suffix_GetSuffix

This eliminates the unspecific variable names p1 and p2 and furthermore
ensures that there is never a pointer that points out of bounds.

The code could have used memcmp or strncmp as well, but since the
suffixes are usuall very short, there is no benefit over a direct loop
comparing individual characters.


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.278 src/usr.bin/make/suff.c:1.279
--- src/usr.bin/make/suff.c:1.278	Sat Nov 21 22:00:34 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 23:09:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.278 2020/11/21 22:00:34 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.279 2020/11/21 23:09:07 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.278 2020/11/21 22:00:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.279 2020/11/21 23:09:07 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -255,22 +255,18 @@ SuffStrIsPrefix(const char *pref, const 
 static const char *
 Suffix_GetSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)
 {
-const char *p1;		/* Pointer into suffix name */
-const char *p2;		/* Pointer into string being examined */
+size_t suffLen = suff->nameLen;
+const char *suffInName;
 
-if (nameLen < suff->nameLen)
-	return NULL;		/* this string is shorter than the suffix */
-
-p1 = suff->name + suff->nameLen;
-p2 = nameEnd;
+if (nameLen < suffLen)
+	return NULL;
 
-while (p1 >= suff->name && *p1 == *p2) {
-	p1--;
-	p2--;
+suffInName = nameEnd - suffLen;
+for (size_t i = 0; i < suffLen; i++) {
+	if (suff->name[i] != suffInName[i])
+	return NULL;
 }
-
-/* XXX: s->name - 1 invokes undefined behavior */
-return p1 == suff->name - 1 ? p2 + 1 : NULL;
+return suffInName;
 }
 
 static Boolean



CVS commit: src/sys/dev/wsfont

2020-11-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Nov 21 23:00:02 UTC 2020

Modified Files:
src/sys/dev/wsfont: files.wsfont

Log Message:
Add missing FONT_SPLEEN6x12 option.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/wsfont/files.wsfont

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

Modified files:

Index: src/sys/dev/wsfont/files.wsfont
diff -u src/sys/dev/wsfont/files.wsfont:1.27 src/sys/dev/wsfont/files.wsfont:1.28
--- src/sys/dev/wsfont/files.wsfont:1.27	Sat Nov 21 22:59:18 2020
+++ src/sys/dev/wsfont/files.wsfont	Sat Nov 21 23:00:02 2020
@@ -1,4 +1,4 @@
-# 	$NetBSD: files.wsfont,v 1.27 2020/11/21 22:59:18 rin Exp $
+# 	$NetBSD: files.wsfont,v 1.28 2020/11/21 23:00:02 rin Exp $
 
 defpseudo wsfont
 
@@ -30,6 +30,7 @@ defflag	opt_wsfont.h		FONT_BOLD8x16
 FONT_DROID_SANS_MONO19x36
 FONT_GO_MONO12x23
 FONT_SPLEEN5x8
+FONT_SPLEEN6x12
 FONT_SPLEEN8x16
 FONT_SPLEEN12x24
 FONT_SPLEEN16x32



CVS commit: src/sys/dev/wsfont

2020-11-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Nov 21 22:59:19 UTC 2020

Modified Files:
src/sys/dev/wsfont: files.wsfont wsfont.c

Log Message:
Sort spleen by size, instead of character code.
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/wsfont/files.wsfont
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/wsfont/wsfont.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/dev/wsfont/files.wsfont
diff -u src/sys/dev/wsfont/files.wsfont:1.26 src/sys/dev/wsfont/files.wsfont:1.27
--- src/sys/dev/wsfont/files.wsfont:1.26	Fri Nov 13 01:03:39 2020
+++ src/sys/dev/wsfont/files.wsfont	Sat Nov 21 22:59:18 2020
@@ -1,4 +1,4 @@
-# 	$NetBSD: files.wsfont,v 1.26 2020/11/13 01:03:39 macallan Exp $
+# 	$NetBSD: files.wsfont,v 1.27 2020/11/21 22:59:18 rin Exp $
 
 defpseudo wsfont
 
@@ -29,11 +29,11 @@ defflag	opt_wsfont.h		FONT_BOLD8x16
 FONT_DROID_SANS_MONO9x18
 FONT_DROID_SANS_MONO19x36
 FONT_GO_MONO12x23
+FONT_SPLEEN5x8
+FONT_SPLEEN8x16
 FONT_SPLEEN12x24
 FONT_SPLEEN16x32
 FONT_SPLEEN32x64
-FONT_SPLEEN5x8
-FONT_SPLEEN8x16
 FONT_LIBERATION_MONO12x21
 
 file	dev/wsfont/wsfontdev.c	wsfont needs-flag

Index: src/sys/dev/wsfont/wsfont.c
diff -u src/sys/dev/wsfont/wsfont.c:1.69 src/sys/dev/wsfont/wsfont.c:1.70
--- src/sys/dev/wsfont/wsfont.c:1.69	Fri Nov 13 01:03:39 2020
+++ src/sys/dev/wsfont/wsfont.c	Sat Nov 21 22:59:18 2020
@@ -1,4 +1,4 @@
-/* 	$NetBSD: wsfont.c,v 1.69 2020/11/13 01:03:39 macallan Exp $	*/
+/* 	$NetBSD: wsfont.c,v 1.70 2020/11/21 22:59:18 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.69 2020/11/13 01:03:39 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.70 2020/11/21 22:59:18 rin Exp $");
 
 #include "opt_wsfont.h"
 
@@ -150,34 +150,34 @@ __KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1
 #include 
 #endif
 
-#ifdef FONT_SPLEEN12x24
+#ifdef FONT_SPLEEN5x8
 #define HAVE_FONT 1
-#include 
+#include 
 #endif
 
-#ifdef FONT_SPLEEN16x32
+#ifdef FONT_SPLEEN6x12
 #define HAVE_FONT 1
-#include 
+#include 
 #endif
 
-#ifdef FONT_SPLEEN32x64
+#ifdef FONT_SPLEEN8x16
 #define HAVE_FONT 1
-#include 
+#include 
 #endif
 
-#ifdef FONT_SPLEEN5x8
+#ifdef FONT_SPLEEN12x24
 #define HAVE_FONT 1
-#include 
+#include 
 #endif
 
-#ifdef FONT_SPLEEN6x12
+#ifdef FONT_SPLEEN16x32
 #define HAVE_FONT 1
-#include 
+#include 
 #endif
 
-#ifdef FONT_SPLEEN8x16
+#ifdef FONT_SPLEEN32x64
 #define HAVE_FONT 1
-#include 
+#include 
 #endif
 
 #ifdef FONT_LIBERATION_MONO12x21



CVS commit: src/sys/arch/vax

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 22:37:11 UTC 2020

Modified Files:
src/sys/arch/vax/uba: qv.c qvkbd.c
src/sys/arch/vax/vax: bus_dma.c multicpu.c
src/sys/arch/vax/vsa: lcg.c smg.c spx.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/vax/uba/qv.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/vax/uba/qvkbd.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/vax/vax/bus_dma.c \
src/sys/arch/vax/vax/multicpu.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/vax/vsa/lcg.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/vax/vsa/smg.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/vax/vsa/spx.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/vax/uba/qv.c
diff -u src/sys/arch/vax/uba/qv.c:1.35 src/sys/arch/vax/uba/qv.c:1.36
--- src/sys/arch/vax/uba/qv.c:1.35	Sun Jun 14 01:40:06 2020
+++ src/sys/arch/vax/uba/qv.c	Sat Nov 21 22:37:11 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: qv.c,v 1.35 2020/06/14 01:40:06 chs Exp $ */
+/* $NetBSD: qv.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $ */
 /*
  * Copyright (c) 2015 Charles H. Dickman. All rights reserved.
  * Derived from smg.c
@@ -31,7 +31,7 @@
 /*3456789012345678901234567890123456789012345678901234567890123456789012345678*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.35 2020/06/14 01:40:06 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $");
 
 #include 
 #include 
@@ -40,7 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.35 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 		/***/
 #include 
 #include 
@@ -900,7 +900,7 @@ qv_alloc_screen(void *v, const struct ws
 struct qv_softc *sc = device_private(v);
 struct qv_screen *ss;
 
-	ss = malloc(sizeof(struct qv_screen), M_DEVBUF, M_WAITOK|M_ZERO);
+	ss = kmem_zalloc(sizeof(struct qv_screen), KM_SLEEP);
 	ss->ss_sc = sc;
 	ss->ss_type = type;
 	*cookiep = ss;
@@ -916,7 +916,7 @@ void
 qv_free_screen(void *v, void *cookie)
 {
 printf("qv_free_screen: %p\n", cookie);
-free(cookie, M_DEVBUF);
+kmem_free(cookie, sizeof(struct qv_screen));
 }
 
 /*

Index: src/sys/arch/vax/uba/qvkbd.c
diff -u src/sys/arch/vax/uba/qvkbd.c:1.2 src/sys/arch/vax/uba/qvkbd.c:1.3
--- src/sys/arch/vax/uba/qvkbd.c:1.2	Sun Nov 10 21:16:33 2019
+++ src/sys/arch/vax/uba/qvkbd.c	Sat Nov 21 22:37:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: qvkbd.c,v 1.2 2019/11/10 21:16:33 chs Exp $	*/
+/*	$NetBSD: qvkbd.c,v 1.3 2020/11/21 22:37:11 thorpej Exp $	*/
 
 /* Copyright (c) 2015 Charles H. Dickman. All rights reserved.
  * Derived from dzkbd.c
@@ -54,7 +54,7 @@ __KERNEL_RCSID(0, "$$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -171,8 +171,7 @@ qvkbd_attach(device_t parent, device_t s
 	if (isconsole) {
 		qvi = _console_internal;
 	} else {
-		qvi = malloc(sizeof(struct qvkbd_internal),
-   M_DEVBUF, M_WAITOK);
+		qvi = kmem_alloc(sizeof(struct qvkbd_internal), KM_SLEEP);
 		qvi->qvi_ks.attmt.sendchar = qvkbd_sendchar;
 		qvi->qvi_ks.attmt.cookie = ls;
 	}

Index: src/sys/arch/vax/vax/bus_dma.c
diff -u src/sys/arch/vax/vax/bus_dma.c:1.35 src/sys/arch/vax/vax/bus_dma.c:1.36
--- src/sys/arch/vax/vax/bus_dma.c:1.35	Fri Apr 27 07:53:07 2018
+++ src/sys/arch/vax/vax/bus_dma.c	Sat Nov 21 22:37:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.35 2018/04/27 07:53:07 maxv Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2018/04/27 07:53:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $");
 
 #include 
 #include 
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -66,6 +66,15 @@ int	_bus_dmamap_load_buffer(bus_dma_tag_
 int	_bus_dma_inrange(bus_dma_segment_t *, int, bus_addr_t);
 int	_bus_dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t,
 	bus_size_t, bus_dma_segment_t*, int, int *, int, vaddr_t, vaddr_t);
+
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct vax_bus_dmamap) +
+	(sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -77,7 +86,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct vax_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 #ifdef DEBUG_DMA
 	printf("dmamap_create: t=%p size=%lx nseg=%x msegsz=%lx boundary=%lx flags=%x\n",
@@ -96,13 +104,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct vax_bus_dmamap) +
-	

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 22:00:34 UTC 2020

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

Log Message:
make(1): fix indentation in SuffixList_Insert


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.277 src/usr.bin/make/suff.c:1.278
--- src/usr.bin/make/suff.c:1.277	Sat Nov 21 20:55:45 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 22:00:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.277 2020/11/21 20:55:45 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.278 2020/11/21 22:00:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.277 2020/11/21 20:55:45 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.278 2020/11/21 22:00:34 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -386,8 +386,8 @@ SuffixList_Insert(SuffixList *list, Suff
 	Lst_Append(list, Suffix_Ref(suff));
 	Lst_Append(suff->ref, list);
 } else if (listSuff->sNum != suff->sNum) {
-	DEBUG4(SUFF, "inserting \"%s\" (%d) before \"%s\" (%d)\n",
-		   suff->name, suff->sNum, listSuff->name, listSuff->sNum);
+	DEBUG4(SUFF, "inserting \"%s\" (%d) before \"%s\" (%d)\n",
+	   suff->name, suff->sNum, listSuff->name, listSuff->sNum);
 	Lst_InsertBefore(list, ln, Suffix_Ref(suff));
 	Lst_Append(suff->ref, list);
 } else {



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

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 21:54:42 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: deptgt-suffixes.exp deptgt-suffixes.mk

Log Message:
make(1): test that suffixes can be listed in any order


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/deptgt-suffixes.exp \
src/usr.bin/make/unit-tests/deptgt-suffixes.mk

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/deptgt-suffixes.exp
diff -u src/usr.bin/make/unit-tests/deptgt-suffixes.exp:1.3 src/usr.bin/make/unit-tests/deptgt-suffixes.exp:1.4
--- src/usr.bin/make/unit-tests/deptgt-suffixes.exp:1.3	Wed Oct 21 08:20:13 2020
+++ src/usr.bin/make/unit-tests/deptgt-suffixes.exp	Sat Nov 21 21:54:42 2020
@@ -3,5 +3,31 @@
 #	To: 
 #	From: 
 #	Search Path: . .. 
+# ".src-left" (num 2, ref 2)
+#	To: .tgt-right 
+#	From: 
+#	Search Path: 
+# ".tgt-right" (num 3, ref 2)
+#	To: 
+#	From: .src-left 
+#	Search Path: 
+# ".tgt-left" (num 4, ref 2)
+#	To: 
+#	From: .src-right 
+#	Search Path: 
+# ".src-right" (num 5, ref 2)
+#	To: .tgt-left 
+#	From: 
+#	Search Path: 
 #*** Transformations:
+.src-left.tgt-right:
+	: Making ${.TARGET} from ${.IMPSRC}.
+
+.src-right.tgt-left:
+	: Making ${.TARGET} from ${.IMPSRC}.
+
+: Making deptgt-suffixes.src-left out of nothing.
+: Making deptgt-suffixes.tgt-right from deptgt-suffixes.src-left.
+: Making deptgt-suffixes.src-right out of nothing.
+: Making deptgt-suffixes.tgt-left from deptgt-suffixes.src-right.
 exit status 0
Index: src/usr.bin/make/unit-tests/deptgt-suffixes.mk
diff -u src/usr.bin/make/unit-tests/deptgt-suffixes.mk:1.3 src/usr.bin/make/unit-tests/deptgt-suffixes.mk:1.4
--- src/usr.bin/make/unit-tests/deptgt-suffixes.mk:1.3	Fri Aug 28 04:05:35 2020
+++ src/usr.bin/make/unit-tests/deptgt-suffixes.mk	Sat Nov 21 21:54:42 2020
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-suffixes.mk,v 1.3 2020/08/28 04:05:35 rillig Exp $
+# $NetBSD: deptgt-suffixes.mk,v 1.4 2020/11/21 21:54:42 rillig Exp $
 #
 # Tests for the special target .SUFFIXES in dependency declarations.
 #
@@ -8,11 +8,28 @@
 
 .MAKEFLAGS: -dg1
 
+.MAIN: all
+
 .SUFFIXES: .custom-null
 
 # TODO: What is the effect of this? How is it useful?
 .NULL: .custom-null
 .PATH.custom-null: . ..
 
-all:
-	@:;
+# The order in which the suffixes are listed doesn't matter.
+# Here, they are listed from source to target, just like in the transformation
+# rule below it.
+.SUFFIXES: .src-left .tgt-right
+deptgt-suffixes.src-left:
+	: Making ${.TARGET} out of nothing.
+.src-left.tgt-right:
+	: Making ${.TARGET} from ${.IMPSRC}.
+all: deptgt-suffixes.tgt-right
+
+# Here, the target is listed earlier than the source.
+.SUFFIXES: .tgt-left .src-right
+deptgt-suffixes.src-right:
+	: Making ${.TARGET} out of nothing.
+.src-right.tgt-left:
+	: Making ${.TARGET} from ${.IMPSRC}.
+all: deptgt-suffixes.tgt-left



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

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 21:41:27 UTC 2020

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

Log Message:
make(1): capture more output from test deptgt-suffixes

This will have an effect with the next commit.


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 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.213 src/usr.bin/make/unit-tests/Makefile:1.214
--- src/usr.bin/make/unit-tests/Makefile:1.213	Sat Nov 21 17:44:40 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sat Nov 21 21:41:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.213 2020/11/21 17:44:40 rillig Exp $
+# $NetBSD: Makefile,v 1.214 2020/11/21 21:41:27 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -472,8 +472,7 @@ SED_CMDS.varname-dot-shell+=	-e 's,"/[^"
 SED_CMDS.varname-dot-shell+=	-e 's,\[/[^] ]*\],[(details omitted)],g'
 
 # Some tests need an additional round of postprocessing.
-POSTPROC.deptgt-suffixes= \
-			${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p'
+POSTPROC.deptgt-suffixes= awk '/^\#\*\*\* Suffixes/,/^never-stop/'
 POSTPROC.gnode-submake=	awk '/Input graph/, /^$$/'
 POSTPROC.varname-empty=	${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p'
 



CVS commit: src/sys/arch/hpcarm/hpcarm

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 21:27:09 UTC 2020

Modified Files:
src/sys/arch/hpcarm/hpcarm: softintr.c

Log Message:
Fix paste-o in last.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hpcarm/hpcarm/softintr.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/hpcarm/hpcarm/softintr.c
diff -u src/sys/arch/hpcarm/hpcarm/softintr.c:1.17 src/sys/arch/hpcarm/hpcarm/softintr.c:1.18
--- src/sys/arch/hpcarm/hpcarm/softintr.c:1.17	Sat Nov 21 21:25:33 2020
+++ src/sys/arch/hpcarm/hpcarm/softintr.c	Sat Nov 21 21:27:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: softintr.c,v 1.17 2020/11/21 21:25:33 thorpej Exp $	*/
+/*	$NetBSD: softintr.c,v 1.18 2020/11/21 21:27:09 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.17 2020/11/21 21:25:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.18 2020/11/21 21:27:09 thorpej Exp $");
 
 #include 
 #include 
@@ -94,7 +94,7 @@ softintr_free(void *arg)
 {
 	struct softintr_handler *sh = arg;
 
-	free(sh, sizeof(*sh));
+	kmem_free(sh, sizeof(*sh));
 }
 
 void



CVS commit: src/sys/arch/hpcarm

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 21:25:34 UTC 2020

Modified Files:
src/sys/arch/hpcarm/dev: wzero3_kbd.c
src/sys/arch/hpcarm/hpcarm: softintr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hpcarm/dev/wzero3_kbd.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hpcarm/hpcarm/softintr.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/hpcarm/dev/wzero3_kbd.c
diff -u src/sys/arch/hpcarm/dev/wzero3_kbd.c:1.9 src/sys/arch/hpcarm/dev/wzero3_kbd.c:1.10
--- src/sys/arch/hpcarm/dev/wzero3_kbd.c:1.9	Sun Nov 10 21:16:27 2019
+++ src/sys/arch/hpcarm/dev/wzero3_kbd.c	Sat Nov 21 21:25:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wzero3_kbd.c,v 1.9 2019/11/10 21:16:27 chs Exp $	*/
+/*	$NetBSD: wzero3_kbd.c,v 1.10 2020/11/21 21:25:33 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 2008, 2009, 2010 NONAKA Kimihiro 
@@ -26,13 +26,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wzero3_kbd.c,v 1.9 2019/11/10 21:16:27 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wzero3_kbd.c,v 1.10 2020/11/21 21:25:33 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -288,10 +288,8 @@ wzero3kbd_attach(device_t parent, device
 		return;
 	}
 
-	sc->sc_okeystat = malloc(sc->sc_nrow * sc->sc_ncolumn, M_DEVBUF,
-	M_WAITOK | M_ZERO);
-	sc->sc_keystat = malloc(sc->sc_nrow * sc->sc_ncolumn, M_DEVBUF,
-	M_WAITOK | M_ZERO);
+	sc->sc_okeystat = kmem_zalloc(sc->sc_nrow * sc->sc_ncolumn, KM_SLEEP);
+	sc->sc_keystat = kmem_zalloc(sc->sc_nrow * sc->sc_ncolumn, KM_SLEEP);
 
 	sc->sc_if.hii_ctx = sc;
 	sc->sc_if.hii_establish = wzero3kbd_input_establish;

Index: src/sys/arch/hpcarm/hpcarm/softintr.c
diff -u src/sys/arch/hpcarm/hpcarm/softintr.c:1.16 src/sys/arch/hpcarm/hpcarm/softintr.c:1.17
--- src/sys/arch/hpcarm/hpcarm/softintr.c:1.16	Sun Nov 10 21:16:27 2019
+++ src/sys/arch/hpcarm/hpcarm/softintr.c	Sat Nov 21 21:25:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: softintr.c,v 1.16 2019/11/10 21:16:27 chs Exp $	*/
+/*	$NetBSD: softintr.c,v 1.17 2020/11/21 21:25:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.16 2019/11/10 21:16:27 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.17 2020/11/21 21:25:33 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -63,7 +63,7 @@ softintr_establish(int level, void (*fun
 {
 	struct softintr_handler *sh;
 
-	sh = malloc(sizeof(*sh), M_DEVBUF, M_WAITOK);
+	sh = kmem_alloc(sizeof(*sh), KM_SLEEP);
 	sh->sh_fun = fun;
 	sh->sh_level = ipl_to_spl(level);
 	sh->sh_arg = arg;
@@ -85,15 +85,16 @@ softintr_disestablish(void *cookie)
 		SetCPSR(I32_bit, I32_bit & saved_cpsr);
 	} else {
 		SetCPSR(I32_bit, I32_bit & saved_cpsr);
-		free(sh, M_DEVBUF);
+		kmem_free(sh, sizeof(*sh));
 	}
 }
 
 void
 softintr_free(void *arg)
 {
+	struct softintr_handler *sh = arg;
 
-	free(arg, M_DEVBUF);
+	free(sh, sizeof(*sh));
 }
 
 void



CVS commit: src/sys/arch/hpcmips

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 21:23:49 UTC 2020

Modified Files:
src/sys/arch/hpcmips/dev: plum.c plumiobus.c plumohci.c ucbsnd.c
src/sys/arch/hpcmips/hpcmips: bus_dma.c
src/sys/arch/hpcmips/tx: tx39icu.c txcom.c
src/sys/arch/hpcmips/vr: flash_vrip.c vr4181giu.c vrc4172gpio.c vrgiu.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hpcmips/dev/plum.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hpcmips/dev/plumiobus.c \
src/sys/arch/hpcmips/dev/plumohci.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hpcmips/dev/ucbsnd.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/hpcmips/hpcmips/bus_dma.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/hpcmips/tx/tx39icu.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/hpcmips/tx/txcom.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hpcmips/vr/flash_vrip.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hpcmips/vr/vr4181giu.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hpcmips/vr/vrc4172gpio.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/hpcmips/vr/vrgiu.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/hpcmips/dev/plum.c
diff -u src/sys/arch/hpcmips/dev/plum.c:1.17 src/sys/arch/hpcmips/dev/plum.c:1.18
--- src/sys/arch/hpcmips/dev/plum.c:1.17	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/dev/plum.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: plum.c,v 1.17 2019/11/10 21:16:28 chs Exp $ */
+/*	$NetBSD: plum.c,v 1.18 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.17 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.18 2020/11/21 21:23:48 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -103,8 +103,7 @@ plum_attach(device_t parent, device_t se
 		printf(": Plum2 #2\n");
 		break;
 	}
-	sc->sc_pc = malloc(sizeof(struct plum_chipset_tag),
-	M_DEVBUF, M_WAITOK | M_ZERO);
+	sc->sc_pc = kmem_zalloc(sizeof(struct plum_chipset_tag), KM_SLEEP);
 	sc->sc_pc->pc_tc = ca->ca_tc;
 	
 	/* Attach Plum devices */

Index: src/sys/arch/hpcmips/dev/plumiobus.c
diff -u src/sys/arch/hpcmips/dev/plumiobus.c:1.15 src/sys/arch/hpcmips/dev/plumiobus.c:1.16
--- src/sys/arch/hpcmips/dev/plumiobus.c:1.15	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/dev/plumiobus.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: plumiobus.c,v 1.15 2019/11/10 21:16:28 chs Exp $ */
+/*	$NetBSD: plumiobus.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -30,14 +30,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plumiobus.c,v 1.15 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plumiobus.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $");
 
 #define PLUMIOBUSDEBUG
 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -172,7 +172,7 @@ __plumiobus_subregion(bus_space_tag_t t,
 {
 	struct hpcmips_bus_space *hbs;
 	
-	hbs = malloc(sizeof(*hbs), M_DEVBUF, M_WAITOK);
+	hbs = kmem_alloc(sizeof(*hbs), KM_SLEEP);
 	*hbs = *t;
 	hbs->t_base += ofs;
 	hbs->t_size = size;
Index: src/sys/arch/hpcmips/dev/plumohci.c
diff -u src/sys/arch/hpcmips/dev/plumohci.c:1.15 src/sys/arch/hpcmips/dev/plumohci.c:1.16
--- src/sys/arch/hpcmips/dev/plumohci.c:1.15	Sat Apr 23 10:15:29 2016
+++ src/sys/arch/hpcmips/dev/plumohci.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: plumohci.c,v 1.15 2016/04/23 10:15:29 skrll Exp $ */
+/*	$NetBSD: plumohci.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 UCHIYAMA Yasushi
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plumohci.c,v 1.15 2016/04/23 10:15:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plumohci.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: plumohci.c,v
 #include 
 #include 
 #include 
+#include 
 
 /* busdma */
 #include 
@@ -247,7 +248,7 @@ __plumohci_dmamem_alloc(bus_dma_tag_t tx
 
 	pmap_extract(pmap_kernel(), (vaddr_t)caddr, );
 
-	ps = malloc(sizeof(struct plumohci_shm), M_DEVBUF, M_NOWAIT);
+	ps = kmem_intr_alloc(sizeof(struct plumohci_shm), KM_NOSLEEP);
 	if (ps == 0)
 		return 1;
 
@@ -276,7 +277,7 @@ __plumohci_dmamem_free(bus_dma_tag_t tx,
 		if (ps->ps_paddr == segs[0].ds_addr) {
 			bus_space_free(sc->sc.iot, ps->ps_bsh, ps->ps_size);
 			LIST_REMOVE(ps, ps_link);
-			free(ps, M_DEVBUF);
+			kmem_intr_free(ps, sizeof(*ps));
 
 			return;
 		}

Index: src/sys/arch/hpcmips/dev/ucbsnd.c
diff -u src/sys/arch/hpcmips/dev/ucbsnd.c:1.25 src/sys/arch/hpcmips/dev/ucbsnd.c:1.26
--- src/sys/arch/hpcmips/dev/ucbsnd.c:1.25	Sat Dec 17 03:46:52 2016
+++ src/sys/arch/hpcmips/dev/ucbsnd.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucbsnd.c,v 1.25 2016/12/17 

CVS commit: src/sys/arch/hpc/hpc

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 21:08:33 UTC 2020

Modified Files:
src/sys/arch/hpc/hpc: config_hook.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hpc/hpc/config_hook.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/hpc/hpc/config_hook.c
diff -u src/sys/arch/hpc/hpc/config_hook.c:1.11 src/sys/arch/hpc/hpc/config_hook.c:1.12
--- src/sys/arch/hpc/hpc/config_hook.c:1.11	Sun Nov 10 21:16:27 2019
+++ src/sys/arch/hpc/hpc/config_hook.c	Sat Nov 21 21:08:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: config_hook.c,v 1.11 2019/11/10 21:16:27 chs Exp $	*/
+/*	$NetBSD: config_hook.c,v 1.12 2020/11/21 21:08:32 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -35,11 +35,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: config_hook.c,v 1.11 2019/11/10 21:16:27 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: config_hook.c,v 1.12 2020/11/21 21:08:32 thorpej Exp $");
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -118,7 +118,7 @@ config_hook(int type, long id, enum conf
 	}
 
 	/* allocate new record */
-	hr = malloc(sizeof(*hr), M_DEVBUF, M_WAITOK);
+	hr = kmem_alloc(sizeof(*hr), KM_SLEEP);
 	hr->hr_ctx = ctx;
 	hr->hr_type = type;
 	hr->hr_id = id;
@@ -165,7 +165,7 @@ config_unhook(config_hook_tag hrx)
 		}
 		splx(s);
 	}
-	free(hr, M_DEVBUF);
+	kmem_free(hr, sizeof(*hr));
 }
 
 int
@@ -208,7 +208,7 @@ config_connect(int type, long id)
 	}
 
 	/* allocate new record */
-	cr = malloc(sizeof(*hr), M_DEVBUF, M_WAITOK);
+	cr = kmem_alloc(sizeof(*hr), KM_SLEEP);
 	cr->hr_func = NULL;
 	cr->hr_type = type;
 	cr->hr_id = id;
@@ -243,7 +243,7 @@ config_disconnect(config_call_tag crx)
 	TAILQ_REMOVE(_list, cr, hr_link);
 	splx(s);
 
-	free(cr, M_DEVBUF);
+	kmem_free(cr, sizeof(*cr));
 }
 
 int



CVS commit: src/sys/arch/hpcsh

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 21:07:38 UTC 2020

Modified Files:
src/sys/arch/hpcsh/dev/hd64461: hd64461pcmcia.c
src/sys/arch/hpcsh/dev/hd64465: hd64465pcmcia.c
src/sys/arch/hpcsh/hpcsh: bus_space.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hpcsh/hpcsh/bus_space.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/hpcsh/dev/hd64461/hd64461pcmcia.c
diff -u src/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c:1.51 src/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c:1.52
--- src/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c:1.51	Sat Nov  9 02:54:11 2013
+++ src/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c	Sat Nov 21 21:07:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hd64461pcmcia.c,v 1.51 2013/11/09 02:54:11 christos Exp $	*/
+/*	$NetBSD: hd64461pcmcia.c,v 1.52 2020/11/21 21:07:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2004 The NetBSD Foundation, Inc.
@@ -30,14 +30,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hd64461pcmcia.c,v 1.51 2013/11/09 02:54:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hd64461pcmcia.c,v 1.52 2020/11/21 21:07:38 thorpej Exp $");
 
 #include "opt_hd64461pcmcia.h"
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -615,10 +615,9 @@ hd64461pcmcia_chip_mem_map(pcmcia_chipse
 	struct hd64461pcmcia_window_cookie *cookie;
 	bus_addr_t ofs;
 
-	cookie = malloc(sizeof(struct hd64461pcmcia_window_cookie),
-	M_DEVBUF, M_NOWAIT);
-	KASSERT(cookie);
-	memset(cookie, 0, sizeof(struct hd64461pcmcia_window_cookie));
+	cookie = kmem_zalloc(sizeof(struct hd64461pcmcia_window_cookie),
+	KM_SLEEP);
+	KASSERT(cookie != NULL);
 
 	/* Address */
 	if ((kind & ~PCMCIA_WIDTH_MEM_MASK) == PCMCIA_MEM_ATTR) {
@@ -654,7 +653,7 @@ hd64461pcmcia_chip_mem_map(pcmcia_chipse
 	return (0);
  bad:
 	DPRINTF("%#lx-%#lx map failed.\n", card_addr, size);
-	free(cookie, M_DEVBUF);
+	kmem_free(cookie, sizeof(*cookie));
 
 	return (1);
 }
@@ -668,7 +667,7 @@ hd64461pcmcia_chip_mem_unmap(pcmcia_chip
 		bus_space_unmap(cookie->wc_tag, cookie->wc_handle,
 		cookie->wc_size);
 	DPRINTF("%#lx-%#x\n", cookie->wc_handle, cookie->wc_size);
-	free(cookie, M_DEVBUF);
+	kmem_free(cookie, sizeof(*cookie));
 }
 
 STATIC int

Index: src/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c
diff -u src/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c:1.32 src/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c:1.33
--- src/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c:1.32	Mon Oct 29 13:46:26 2012
+++ src/sys/arch/hpcsh/dev/hd64465/hd64465pcmcia.c	Sat Nov 21 21:07:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hd64465pcmcia.c,v 1.32 2012/10/29 13:46:26 chs Exp $	*/
+/*	$NetBSD: hd64465pcmcia.c,v 1.33 2020/11/21 21:07:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hd64465pcmcia.c,v 1.32 2012/10/29 13:46:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hd64465pcmcia.c,v 1.33 2020/11/21 21:07:38 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -536,10 +536,9 @@ hd64465pcmcia_chip_mem_map(pcmcia_chipse
 	struct hd64465pcmcia_window_cookie *cookie;
 	bus_addr_t ofs;
 
-	cookie = malloc(sizeof(struct hd64465pcmcia_window_cookie),
-	M_DEVBUF, M_NOWAIT);
+	cookie = kmem_zalloc(sizeof(struct hd64465pcmcia_window_cookie),
+	KM_SLEEP);
 	KASSERT(cookie);
-	memset(cookie, 0, sizeof(struct hd64465pcmcia_window_cookie));
 
 	/* Address */
 	if ((kind & ~PCMCIA_WIDTH_MEM_MASK) == PCMCIA_MEM_ATTR) {
@@ -574,7 +573,7 @@ hd64465pcmcia_chip_mem_map(pcmcia_chipse
 	return (0);
  bad:
 	DPRINTF("%#lx-%#lx map failed.\n", card_addr, size);
-	free(cookie, M_DEVBUF);
+	kmem_free(cookie, sizeof(*cookie));
 
 	return (1);
 }
@@ -588,7 +587,7 @@ hd64465pcmcia_chip_mem_unmap(pcmcia_chip
 		bus_space_unmap(cookie->wc_tag, cookie->wc_handle,
 		cookie->wc_size);
 	DPRINTF("%#lx-%#x\n", cookie->wc_handle, cookie->wc_size);
-	free(cookie, M_DEVBUF);
+	kmem_free(cookie, sizeof(*cookie));
 }
 
 int

Index: src/sys/arch/hpcsh/hpcsh/bus_space.c
diff -u src/sys/arch/hpcsh/hpcsh/bus_space.c:1.19 src/sys/arch/hpcsh/hpcsh/bus_space.c:1.20
--- src/sys/arch/hpcsh/hpcsh/bus_space.c:1.19	Fri Jan 27 18:52:57 2012
+++ src/sys/arch/hpcsh/hpcsh/bus_space.c	Sat Nov 21 21:07:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.19 2012/01/27 18:52:57 para Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.20 2020/11/21 21:07:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -27,13 +27,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.19 2012/01/27 18:52:57 para Exp $");

CVS commit: src/external/bsd/elftoolchain/dist/common

2020-11-21 Thread Joseph Koshy
Module Name:src
Committed By:   jkoshy
Date:   Sat Nov 21 21:04:25 UTC 2020

Modified Files:
src/external/bsd/elftoolchain/dist/common: _elftc.h

Log Message:
Sync '_elftc.h' with the upstream elftoolchain project.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/elftoolchain/dist/common/_elftc.h

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

Modified files:

Index: src/external/bsd/elftoolchain/dist/common/_elftc.h
diff -u src/external/bsd/elftoolchain/dist/common/_elftc.h:1.5 src/external/bsd/elftoolchain/dist/common/_elftc.h:1.6
--- src/external/bsd/elftoolchain/dist/common/_elftc.h:1.5	Sun Mar 13 03:47:41 2016
+++ src/external/bsd/elftoolchain/dist/common/_elftc.h	Sat Nov 21 21:04:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: _elftc.h,v 1.5 2016/03/13 03:47:41 christos Exp $	*/
+/*	$NetBSD: _elftc.h,v 1.6 2020/11/21 21:04:25 jkoshy Exp $	*/
 
 /*-
  * Copyright (c) 2009 Joseph Koshy
@@ -25,11 +25,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * Id: _elftc.h 3244 2015-08-31 19:53:08Z emaste 
+ * $Id: _elftc.h,v 1.6 2020/11/21 21:04:25 jkoshy Exp $
  */
 
 /**
- ** Miscellanous definitions needed by multiple components.
+ ** Miscellaneous definitions needed by multiple components.
  **/
 
 #ifndef	_ELFTC_H
@@ -284,49 +284,34 @@ struct name {			\
 
 /*
  * VCS Ids.
+ *
+ * The marker below is intended to be replaced with a project-specific
+ * definition of the ELFTC_VCSID macro.
  */
 
+#ifndef ELFTC_VCSID
+#define	ELFTC_VCSID(ID)		/**/
+#endif
+
 #ifndef	ELFTC_VCSID
 
-#if defined(__DragonFly__)
-#define	ELFTC_VCSID(ID)		__RCSID(ID)
-#endif
+#if defined(__DragonFly__) || defined(__NetBSD__)
 
-#if defined(__FreeBSD__)
-#define	ELFTC_VCSID(ID)		__FBSDID(ID)
-#endif
+#define	ELFTC_VCSID(ID)		__RCSID(ID)
 
-#if defined(__APPLE__) || defined(__GLIBC__) || defined(__GNU__) || \
-defined(__linux__)
-#if defined(__GNUC__)
-#define	ELFTC_VCSID(ID)		__asm__(".ident\t\"" ID "\"")
-#else
-#define	ELFTC_VCSID(ID)		/**/
-#endif
-#endif
+#elif defined(__FreeBSD__)
 
-#if defined(__minix)
-#if defined(__GNUC__)
-#define	ELFTC_VCSID(ID)		__asm__(".ident\t\"" ID "\"")
-#else
-#define	ELFTC_VCSID(ID)		/**/
-#endif	/* __GNU__ */
-#endif
+#define	ELFTC_VCSID(ID)		__FBSDID(ID)
 
-#if defined(__NetBSD__)
-#define	ELFTC_VCSID(ID)		__RCSID(ID)
-#endif
+#elif defined(__APPLE__) || defined(__OpenBSD__) || defined(__GLIBC__) || \
+defined(__GNU__) || defined(__linux__) || defined(__minix)
 
-#if defined(__OpenBSD__)
 #if defined(__GNUC__)
 #define	ELFTC_VCSID(ID)		__asm__(".ident\t\"" ID "\"")
 #else
 #define	ELFTC_VCSID(ID)		/**/
-#endif	/* __GNUC__ */
 #endif
 
-#ifndef ELFTC_VCSID
-#define	ELFTC_VCSID(ID)		/**/
 #endif
 
 #endif	/* ELFTC_VCSID */
@@ -344,7 +329,7 @@ struct name {			\
 
 #define	ELFTC_GETPROGNAME()	getprogname()
 
-#endif	/* __DragonFly__ || __FreeBSD__ || __minix || __NetBSD__ */
+#endif	/* __APPLE__ || __DragonFly__ || __FreeBSD__ || __minix || __NetBSD__ */
 
 
 #if defined(__GLIBC__) || defined(__linux__)
@@ -372,12 +357,41 @@ extern const char *__progname;
 #endif	/* ELFTC_GETPROGNAME */
 
 
-#ifndef HAVE_NBTOOL_CONFIG_H
-/**
- ** Per-OS configuration.
- **/
+/*
+ * Per-OS configuration.
+ *
+ * The following symbols are supported by this configuration fragment,
+ * although not all the OSes so referenced are fully supported.
+ *
+ * Cross-compilation:
+ *
+ * HAVE_NBTOOL_CONFIG_H : cross-compiling NetBSD tools on various OSes.
+ *
+ * Native compilation:
+ *
+ * __APPLE__ : compiling under Mac OS X.
+ * __DragonFly__ : compiling under DragonFlyBSD.
+ * __GLIBC__ : compiling under GNU based systems, such as GNU/kFreeBSD.
+ * __linux__ : compiling under GNU/Linux systems.
+ * __FreeBSD__   : compiling under FreeBSD.
+ * __minix   : compiling under Minix3.
+ * __NetBSD__: compiling (native) under NetBSD.
+ * __OpenBSD__   : compiling under OpenBSD.
+ */
 
-#if defined(__APPLE__)
+#if defined(HAVE_NBTOOL_CONFIG_H)
+
+#include 
+#include 
+
+#define	ELFTC_BYTE_ORDER			_BYTE_ORDER
+#define	ELFTC_BYTE_ORDER_LITTLE_ENDIAN		_LITTLE_ENDIAN
+#define	ELFTC_BYTE_ORDER_BIG_ENDIAN		_BIG_ENDIAN
+
+#define	ELFTC_HAVE_MMAP1
+#define	ELFTC_HAVE_STRMODE			1
+
+#elif defined(__APPLE__)
 
 #include 
 #define	htobe32(x)	OSSwapHostToBigInt32(x)
@@ -391,10 +405,8 @@ extern const char *__progname;
 #define	ELFTC_HAVE_STRMODE			1
 
 #define ELFTC_NEED_BYTEORDER_EXTENSIONS		1
-#endif /* __APPLE__ */
-
 
-#if defined(__DragonFly__)
+#elif defined(__DragonFly__)
 
 #include 
 #include 
@@ -405,9 +417,7 @@ extern const char *__progname;
 
 #define	ELFTC_HAVE_MMAP1
 
-#endif
-
-#if defined(__GLIBC__) || defined(__linux__)
+#elif defined(__GLIBC__) || defined(__linux__)
 
 #include 
 
@@ -427,10 +437,7 @@ extern const char *__progname;
 
 #define	roundup2	roundup
 
-#endif	/* __GLIBC__ || __linux__ */
-
-
-#if defined(__FreeBSD__)

CVS commit: src/sys/arch/hppa

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 21:01:16 UTC 2020

Modified Files:
src/sys/arch/hppa/dev: apic.c
src/sys/arch/hppa/hppa: mainbus.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/apic.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/hppa/mainbus.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/hppa/dev/apic.c
diff -u src/sys/arch/hppa/dev/apic.c:1.3 src/sys/arch/hppa/dev/apic.c:1.4
--- src/sys/arch/hppa/dev/apic.c:1.3	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hppa/dev/apic.c	Sat Nov 21 21:01:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: apic.c,v 1.3 2019/11/10 21:16:28 chs Exp $	*/
+/*	$NetBSD: apic.c,v 1.4 2020/11/21 21:01:16 thorpej Exp $	*/
 
 /*	$OpenBSD: apic.c,v 1.14 2011/05/01 21:59:39 kettenis Exp $	*/
 
@@ -22,7 +22,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -109,8 +109,7 @@ apic_attach(struct elroy_softc *sc)
 	aprint_normal(" APIC ver %x, %d pins",
 	data & APIC_VERSION_MASK, sc->sc_nints);
 
-	sc->sc_irq = malloc(sc->sc_nints * sizeof(int), M_DEVBUF,
-	M_WAITOK | M_ZERO);
+	sc->sc_irq = kmem_zalloc(sc->sc_nints * sizeof(int), KM_SLEEP);
 
 	apic_get_int_tbl(sc);
 
@@ -171,8 +170,8 @@ apic_intr_establish(void *v, pci_intr_ha
 	if (irq <= 0 || irq > 31)
 		return NULL;
 
-	aiv = malloc(sizeof(struct apic_iv), M_DEVBUF, M_WAITOK);
-	cnt = malloc(sizeof(struct evcnt), M_DEVBUF, M_WAITOK);
+	aiv = kmem_alloc(sizeof(struct apic_iv), KM_SLEEP);
+	cnt = kmem_alloc(sizeof(struct evcnt), KM_SLEEP);
 	aiv->sc = sc;
 	aiv->ih = ih;
 	aiv->handler = handler;
@@ -184,8 +183,8 @@ apic_intr_establish(void *v, pci_intr_ha
 	if (biv == NULL) {
 		iv = hppa_intr_establish(pri, apic_intr, aiv, >ci_ir, irq);
 		if (iv == NULL) {
-			free(aiv, M_DEVBUF);
-			free(cnt, M_DEVBUF);
+			kmem_free(aiv, sizeof(*aiv));
+			kmem_free(cnt, sizeof(*cnt));
 
 			return NULL;
 		}
@@ -267,7 +266,7 @@ apic_get_int_tbl(struct elroy_softc *sc)
 
 	size = nentries * sizeof(struct pdc_pat_pci_rt);
 	sc->sc_int_tbl_sz = nentries;
-	sc->sc_int_tbl = malloc(size, M_DEVBUF, M_WAITOK);
+	sc->sc_int_tbl = kmem_alloc(size, KM_SLEEP);
 
 	pdcproc_pci_gettable(nentries, size, sc->sc_int_tbl);
 }

Index: src/sys/arch/hppa/hppa/mainbus.c
diff -u src/sys/arch/hppa/hppa/mainbus.c:1.5 src/sys/arch/hppa/hppa/mainbus.c:1.6
--- src/sys/arch/hppa/hppa/mainbus.c:1.5	Fri Oct 16 17:50:44 2020
+++ src/sys/arch/hppa/hppa/mainbus.c	Sat Nov 21 21:01:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.5 2020/10/16 17:50:44 macallan Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.6 2020/11/21 21:01:16 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.5 2020/10/16 17:50:44 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.6 2020/11/21 21:01:16 thorpej Exp $");
 
 #include "locators.h"
 #include "power.h"
@@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -729,6 +730,14 @@ const struct hppa_bus_space_tag hppa_bus
 	mbus_cp_1,  mbus_cp_2, mbus_cp_4, mbus_cp_8
 };
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct hppa_bus_dmamap) +
+	(sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific DMA map
  * creation functions.
@@ -738,7 +747,6 @@ mbus_dmamap_create(void *v, bus_size_t s
 bus_size_t boundary, int flags, bus_dmamap_t *dmamp)
 {
 	struct hppa_bus_dmamap *map;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map is a
@@ -752,14 +760,11 @@ mbus_dmamap_create(void *v, bus_size_t s
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence the
 	 * (nsegments - 1).
 	 */
-	mapsize = sizeof(struct hppa_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	map = malloc(mapsize, M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
+	map = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP);
 	if (!map)
 		return ENOMEM;
 
-	memset(map, 0, mapsize);
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
 	map->_dm_maxsegsz = maxsegsz;
@@ -786,7 +791,7 @@ mbus_dmamap_destroy(void *v, bus_dmamap_
 	if (map->dm_mapsize != 0)
 		mbus_dmamap_unload(v, map);
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*
@@ -1067,8 +1072,8 @@ mbus_dmamem_alloc(void *v, bus_size_t si
 	low = 0;
 	high = ((flags & BUS_DMA_24BIT) ? (1 << 24) : 0) - 1;
 
-	if ((mlist = malloc(sizeof(*mlist), M_DEVBUF,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mlist = kmem_alloc(sizeof(*mlist),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : 

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 20:55:45 UTC 2020

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

Log Message:
make(1): make srclist a local variable

In all current unit tests, the variable srclist was empty both when
entering Suff_FindDeps and when leaving it.  Since that's the only
function that used this variable, it has been converted to a local
variable instead, to limit its scope.

To protect against accidental implementation mistakes, an assertion has
been added to ensure that at the end, everything could be cleaned up
properly.  This assertion was missing before, and if there had really
been a case where the list were non-empty, make would have resolved
completely wrong candidates for the implied sources.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.276 src/usr.bin/make/suff.c:1.277
--- src/usr.bin/make/suff.c:1.276	Sat Nov 21 20:20:31 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 20:55:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.276 2020/11/21 20:20:31 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.277 2020/11/21 20:55:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.276 2020/11/21 20:20:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.277 2020/11/21 20:55:45 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -131,10 +131,6 @@ static SuffixList *sufflist;	/* List of 
 static SuffixList *suffClean;	/* List of suffixes to be cleaned */
 #endif
 
-/* XXX: What exactly is this variable used for? */
-/* XXX: Does it really have to be a global variable? */
-static SrcList *srclist;
-
 /* List of transformation rules, such as ".c.o" */
 static GNodeList *transforms;
 
@@ -1894,11 +1890,15 @@ sfnd_return:
 void
 Suff_FindDeps(GNode *gn)
 {
+SrcList *srcs = Lst_New();
 
-SuffFindDeps(gn, srclist);
+SuffFindDeps(gn, srcs);
 
-while (SuffRemoveSrc(srclist))
+while (SuffRemoveSrc(srcs))
 	continue;
+
+assert(Lst_IsEmpty(srcs));
+Lst_Free(srcs);
 }
 
 static void
@@ -1981,7 +1981,6 @@ Suff_Init(void)
 suffClean = Lst_New();
 sufflist = Lst_New();
 #endif
-srclist = Lst_New();
 transforms = Lst_New();
 
 /*
@@ -2002,7 +2001,6 @@ Suff_End(void)
 Lst_Destroy(suffClean, SuffFree);
 if (nullSuff != NULL)
 	SuffFree(nullSuff);
-Lst_Free(srclist);
 Lst_Free(transforms);
 #endif
 }



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

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 20:50:08 UTC 2020

Modified Files:
src/sys/arch/ia64/ia64: interrupt.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/ia64/interrupt.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/ia64/ia64/interrupt.c
diff -u src/sys/arch/ia64/ia64/interrupt.c:1.10 src/sys/arch/ia64/ia64/interrupt.c:1.11
--- src/sys/arch/ia64/ia64/interrupt.c:1.10	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/ia64/ia64/interrupt.c	Sat Nov 21 20:50:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:28 chs Exp $ */
+/* $NetBSD: interrupt.c,v 1.11 2020/11/21 20:50:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.11 2020/11/21 20:50:08 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -41,7 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: interrupt.c,
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -293,7 +293,7 @@ intr_establish(int irq, int type, int le
 
 	i = ia64_intrs[vector];
 	if (i == NULL) {
-		i = malloc(sizeof(struct ia64_intr), M_DEVBUF, M_WAITOK);
+		i = kmem_alloc(sizeof(struct ia64_intr), KM_SLEEP);
 		i->irq = irq;
 		i->sapic = sa;
 		i->type = type;
@@ -309,7 +309,7 @@ intr_establish(int irq, int type, int le
 		if (i->type != type)
 			return NULL;
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_level = level;
@@ -334,10 +334,10 @@ intr_disestablish(void *cookie)
 
 		ia64_intrs[vector] = NULL;
 		evcnt_detach(>evcnt);
-		free(i, M_DEVBUF);
+		kmem_free(i, sizeof(*i));
 	}
 
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 static int



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 20:20:32 UTC 2020

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

Log Message:
make(1): improve local variable name in SuffRemoveSrc


To generate a diff of this commit:
cvs rdiff -u -r1.275 -r1.276 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.275 src/usr.bin/make/suff.c:1.276
--- src/usr.bin/make/suff.c:1.275	Sat Nov 21 20:16:14 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 20:20:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.275 2020/11/21 20:16:14 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.276 2020/11/21 20:20:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.275 2020/11/21 20:16:14 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.276 2020/11/21 20:20:31 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -945,16 +945,16 @@ SuffAddLevel(SrcList *srcs, Src *targ)
 /* Free the first Src in the list that is not referenced anymore.
  * Return whether a Src was removed. */
 static Boolean
-SuffRemoveSrc(SrcList *l)
+SuffRemoveSrc(SrcList *srcs)
 {
 SrcListNode *ln;
 
 #ifdef DEBUG_SRC
-debug_printf("cleaning list %p:", l);
-SrcList_PrintAddrs(l);
+debug_printf("cleaning list %p:", srcs);
+SrcList_PrintAddrs(srcs);
 #endif
 
-for (ln = l->first; ln != NULL; ln = ln->next) {
+for (ln = srcs->first; ln != NULL; ln = ln->next) {
 	Src *src = ln->datum;
 
 	if (src->numChildren == 0) {
@@ -971,17 +971,17 @@ SuffRemoveSrc(SrcList *l)
 	}
 #ifdef DEBUG_SRC
 	debug_printf("free: list %p src %p children %d\n",
-			 l, src, src->numChildren);
+			 srcs, src, src->numChildren);
 	Lst_Free(src->childrenList);
 #endif
-	Lst_Remove(l, ln);
+	Lst_Remove(srcs, ln);
 	free(src);
 	return TRUE;
 	}
 #ifdef DEBUG_SRC
 	else {
 	debug_printf("keep: list %p src %p children %d:",
-			 l, src, src->numChildren);
+			 srcs, src, src->numChildren);
 	SrcList_PrintAddrs(src->childrenList);
 	}
 #endif
@@ -1896,6 +1896,7 @@ Suff_FindDeps(GNode *gn)
 {
 
 SuffFindDeps(gn, srclist);
+
 while (SuffRemoveSrc(srclist))
 	continue;
 }



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 20:16:14 UTC 2020

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

Log Message:
make(1): move prototype of SuffFindDeps further down

Just to limit its scope.


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.274 src/usr.bin/make/suff.c:1.275
--- src/usr.bin/make/suff.c:1.274	Sat Nov 21 20:12:08 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 20:16:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.274 2020/11/21 20:12:08 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.275 2020/11/21 20:16:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.274 2020/11/21 20:12:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.275 2020/11/21 20:16:14 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -211,8 +211,6 @@ static Suffix *nullSuff;
 static Suffix *emptySuff;
 
 
-static void SuffFindDeps(GNode *, SrcList *);
-
 static Suffix *
 Suffix_Ref(Suffix *suff)
 {
@@ -1424,6 +1422,8 @@ SuffApplyTransform(GNode *tgn, GNode *sg
 }
 
 
+static void SuffFindDeps(GNode *, SrcList *);
+
 /* Locate dependencies for an OP_ARCHV node.
  *
  * Input:



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 20:12:08 UTC 2020

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

Log Message:
make(1): move SuffExpandWildcards further up

This avoids an unnecessary forward declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.273 src/usr.bin/make/suff.c:1.274
--- src/usr.bin/make/suff.c:1.273	Sat Nov 21 20:04:10 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 20:12:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.273 2020/11/21 20:04:10 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.274 2020/11/21 20:12:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.273 2020/11/21 20:04:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.274 2020/11/21 20:12:08 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -212,7 +212,6 @@ static Suffix *emptySuff;
 
 
 static void SuffFindDeps(GNode *, SrcList *);
-static void SuffExpandWildcards(GNodeListNode *, GNode *);
 
 static Suffix *
 Suffix_Ref(Suffix *suff)
@@ -1124,6 +1123,50 @@ SuffFindCmds(Src *targ, SrcList *slst)
 return ret;
 }
 
+static void
+SuffExpandWildcards(GNodeListNode *cln, GNode *pgn)
+{
+GNode *cgn = cln->datum;
+StringList *expansions;
+
+if (!Dir_HasWildcards(cgn->name))
+	return;
+
+/*
+ * Expand the word along the chosen path
+ */
+expansions = Lst_New();
+Dir_Expand(cgn->name, Suff_FindPath(cgn), expansions);
+
+while (!Lst_IsEmpty(expansions)) {
+	GNode	*gn;
+	/*
+	 * Fetch next expansion off the list and find its GNode
+	 */
+	char *cp = Lst_Dequeue(expansions);
+
+	SUFF_DEBUG1("%s...", cp);
+	gn = Targ_GetNode(cp);
+
+	/* Add gn to the parents child list before the original child */
+	Lst_InsertBefore(pgn->children, cln, gn);
+	Lst_Append(gn->parents, pgn);
+	pgn->unmade++;
+}
+
+Lst_Free(expansions);
+
+SUFF_DEBUG0("\n");
+
+/*
+ * Now the source is expanded, remove it from the list of children to
+ * keep it from being processed.
+ */
+pgn->unmade--;
+Lst_Remove(pgn->children, cln);
+Lst_Remove(cgn->parents, Lst_FindDatum(cgn->parents, pgn));
+}
+
 /* Expand the names of any children of a given node that contain variable
  * expressions or file wildcards into actual targets.
  *
@@ -1279,50 +1322,6 @@ SuffExpandChildren(GNodeListNode *cln, G
 Lst_Remove(cgn->parents, Lst_FindDatum(cgn->parents, pgn));
 }
 
-static void
-SuffExpandWildcards(GNodeListNode *cln, GNode *pgn)
-{
-GNode *cgn = cln->datum;
-StringList *expansions;
-
-if (!Dir_HasWildcards(cgn->name))
-	return;
-
-/*
- * Expand the word along the chosen path
- */
-expansions = Lst_New();
-Dir_Expand(cgn->name, Suff_FindPath(cgn), expansions);
-
-while (!Lst_IsEmpty(expansions)) {
-	GNode	*gn;
-	/*
-	 * Fetch next expansion off the list and find its GNode
-	 */
-	char *cp = Lst_Dequeue(expansions);
-
-	SUFF_DEBUG1("%s...", cp);
-	gn = Targ_GetNode(cp);
-
-	/* Add gn to the parents child list before the original child */
-	Lst_InsertBefore(pgn->children, cln, gn);
-	Lst_Append(gn->parents, pgn);
-	pgn->unmade++;
-}
-
-Lst_Free(expansions);
-
-SUFF_DEBUG0("\n");
-
-/*
- * Now the source is expanded, remove it from the list of children to
- * keep it from being processed.
- */
-pgn->unmade--;
-Lst_Remove(pgn->children, cln);
-Lst_Remove(cgn->parents, Lst_FindDatum(cgn->parents, pgn));
-}
-
 /* Find a path along which to expand the node.
  *
  * If the node has a known suffix, use that path.



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 20:04:10 UTC 2020

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

Log Message:
make(1): document Suffix and Src


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.272 src/usr.bin/make/suff.c:1.273
--- src/usr.bin/make/suff.c:1.272	Sat Nov 21 19:40:19 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 20:04:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.272 2020/11/21 19:40:19 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.273 2020/11/21 20:04:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.272 2020/11/21 19:40:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.273 2020/11/21 20:04:10 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -152,6 +152,10 @@ ENUM_FLAGS_RTTI_3(SuffixFlags,
 
 typedef List SuffixListList;
 
+/*
+ * A suffix such as ".c" or ".o" that is used in suffix transformation rules
+ * such as ".c.o:".
+ */
 typedef struct Suffix {
 /* The suffix itself, such as ".c" */
 char *name;
@@ -178,7 +182,13 @@ typedef struct Suffix {
 } Suffix;
 
 /*
- * Structure used in the search for implied sources.
+ * A candidate when searching for implied sources.
+ *
+ * For example, when "src.o" is to be made, a typical candidate is "src.c"
+ * via the transformation rule ".c.o".  If that doesn't exist, maybe there is
+ * another transformation rule ".pas.c" that would make "src.pas" an indirect
+ * candidate as well.  The first such chain that leads to an existing file or
+ * node is finally made.
  */
 typedef struct Src {
 char *file;			/* The file to look for */
@@ -193,6 +203,7 @@ typedef struct Src {
 #endif
 } Src;
 
+
 /* TODO: Document the difference between nullSuff and emptySuff. */
 /* The NULL suffix for this run */
 static Suffix *nullSuff;



CVS commit: src/sys/arch/arm/sa11x0

2020-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 19:59:10 UTC 2020

Modified Files:
src/sys/arch/arm/sa11x0: sa11x0_irq.S

Log Message:
Adjust egister usage so that r4 and r5 are preserved as cur{cpu,lwp}
respectively as required by the change to make ASTs operate per-LWP
rather than per-CPU.  DO_AST_AND_RESTORE_ALIGNMENT_FAULTS expects this.

Remove the call to dosoftints while I'm here as it's dont in DO_AST...

XXX untested


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/sa11x0/sa11x0_irq.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/arm/sa11x0/sa11x0_irq.S
diff -u src/sys/arch/arm/sa11x0/sa11x0_irq.S:1.19 src/sys/arch/arm/sa11x0/sa11x0_irq.S:1.20
--- src/sys/arch/arm/sa11x0/sa11x0_irq.S:1.19	Sat Nov 21 09:36:27 2020
+++ src/sys/arch/arm/sa11x0/sa11x0_irq.S	Sat Nov 21 19:59:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sa11x0_irq.S,v 1.19 2020/11/21 09:36:27 skrll Exp $	*/
+/*	$NetBSD: sa11x0_irq.S,v 1.20 2020/11/21 19:59:10 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 Mark Brinicombe.
@@ -72,20 +72,21 @@ AST_ALIGNMENT_FAULT_LOCALS
 /*
  * Register usage
  *
- *  r4  - Pointer to cpu_info
- *  r5  - Pointer to handler pointer list
+ *  r4  - Pointer to curcpu
+ *  r5  - pointer to curlwp
  *  r6  - Address of current handler
  *  r7	- pspr mode
  *  r8  - Current IRQ requests.
  *  r9  - Used to count through possible IRQ bits.
  *  r10 - Base address of SAIP
+ *  r11 - Pointer to handler pointer list
  */
 
 ASENTRY_NP(irq_entry)
 	sub	lr, lr, #0x0004	/* Adjust the lr */
 
 	PUSHFRAMEINSVC			/* Push an interrupt frame */
-	ENABLE_ALIGNMENT_FAULTS
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	/* Load r8 with the SAIPIC interrupt requests */
 
@@ -123,17 +124,17 @@ ASENTRY_NP(irq_entry)
 	 */
 
 	mov	r9, #(NIPL - 1)
-	ldr	r5, Lspl_masks
+	ldr	r11, Lspl_masks
 
 Lfind_highest_ipl:
-	ldr	r2, [r5, r9, lsl #2]
+	ldr	r2, [r11, r9, lsl #2]
 	tst	r8, r2
 	subeq	r9, r9, #1
 	beq	Lfind_highest_ipl
 
 	/* r9 = SPL level of highest priority interrupt */
 	add	r9, r9, #1
-	ldr	r2, [r5, r9, lsl #2]
+	ldr	r2, [r11, r9, lsl #2]
 
 	ldr	r1, [r4, #CI_CPL]
 	str	r9, [r4, #CI_CPL]
@@ -154,7 +155,7 @@ Lfind_highest_ipl:
 	bic	r0, r0, #I32_bit
 	msr	cpsr_all, r0
 
-	ldr	r5, Lirqhandlers
+	ldr	r11, Lirqhandlers
 mov	r9, #0x0001
 
 irqloop:
@@ -162,7 +163,7 @@ irqloop:
 	tst	r8, r9			/* Is a bit set ? */
 	beq	nextirq			/* No ? try next bit */
 
-	ldr	r6, [r5]		/* Get address of first handler structure */
+	ldr	r6, [r11]		/* Get address of first handler structure */
 
 	teq	r6, #0x		/* Do we have a handler */
 	moveq	r0, r8			/* IRQ requests as arg 0 */
@@ -218,7 +219,7 @@ irqchainloop:
 
 irqdone:
 nextirq:
-	add	r5, r5, #0x0004	/* update pointer to handlers */
+	add	r11, r11, #0x0004	/* update pointer to handlers */
 	mov	r9, r9, lsl #1		/* move on to next bit */
 	teq	r9, #(1 << 31)		/* done the last bit ? */
 	bne	irqloop			/* no - loop back. */
@@ -229,10 +230,6 @@ nextirq:
 	/* Restore previous disabled mask */
 	bl	_C_LABEL(irq_setmasks)
 
-#ifdef __HAVE_FAST_SOFTINTS
-	bl	_C_LABEL(dosoftints)	/* Handle the soft interrupts */
-#endif
-
 	/* Kill IRQ's in preparation for exit */
 mrs r0, cpsr
 orr r0, r0, #(I32_bit)



CVS commit: src/sys/arch/shark/isa

2020-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 19:58:11 UTC 2020

Modified Files:
src/sys/arch/shark/isa: isa_irq.S

Log Message:
Adjust egister usage so that r4 and r5 are preserved as cur{cpu,lwp}
respectively as required by the change to make ASTs operate per-LWP
rather than per-CPU.  DO_AST_AND_RESTORE_ALIGNMENT_FAULTS expects this.

Remove the call to dosoftints while I'm here as it's dont in DO_AST...

XXX untested


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/shark/isa/isa_irq.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/shark/isa/isa_irq.S
diff -u src/sys/arch/shark/isa/isa_irq.S:1.17 src/sys/arch/shark/isa/isa_irq.S:1.18
--- src/sys/arch/shark/isa/isa_irq.S:1.17	Tue Jan 30 19:22:28 2018
+++ src/sys/arch/shark/isa/isa_irq.S	Sat Nov 21 19:58:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_irq.S,v 1.17 2018/01/30 19:22:28 skrll Exp $	*/
+/*	$NetBSD: isa_irq.S,v 1.18 2020/11/21 19:58:11 skrll Exp $	*/
 
 /*
  * Copyright 1997
@@ -113,8 +113,8 @@
 /*
  * Register usage
  *
- *  r5  - Pointer to handler pointer list
  *  r6  - Address of current handler
+ *  r7  - Pointer to handler pointer list
  *  r8  - Current IRQ requests.
  *  r9  - Used to count through possible IRQ bits.
  *  r10 - Base address of IOMD
@@ -125,7 +125,7 @@ ASENTRY_NP(irq_entry)
 	sub	lr, lr, #0x0004	/* Adjust the lr */
 
 	PUSHFRAMEINSVC			/* Push an interrupt frame */
-	ENABLE_ALIGNMENT_FAULTS		/* cpuinfo is in r4 after execution */
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	/* Load r8 with the ISA 8259 irqs */
 	/* r8 <- irq's pending [15:0] */
@@ -183,17 +183,17 @@ ASENTRY_NP(irq_entry)
 	 */
 
 	mov	r9, #(NIPL - 1)
-	ldr	r5, .Lspl_masks
+	ldr	r7, .Lspl_masks
 
 .Lfind_highest_ipl:
-	ldr	r2, [r5, r9, lsl #2]
+	ldr	r2, [r7, r9, lsl #2]
 	tst	r8, r2
 	subeq	r9, r9, #1
 	beq	.Lfind_highest_ipl
 
 	/* r9 = SPL level of highest priority interrupt */
 	add	r9, r9, #1
-	ldr	r2, [r5, r9, lsl #2]
+	ldr	r2, [r7, r9, lsl #2]
 	mvn	r2, r2
 	orr	r0, r0, r2
 
@@ -210,7 +210,7 @@ ASENTRY_NP(irq_entry)
 	bic	r0, r0, #I32_bit
 	msr	cpsr_all, r0
 
-	ldr	r5, .Lirqhandlers
+	ldr	r7, .Lirqhandlers
 	mov	r9, #0x0001
 
 irqloop:
@@ -218,7 +218,7 @@ irqloop:
 	tst	r8, r9			/* Is a bit set ? */
 	beq	nextirq			/* No ? try next bit */
 
-	ldr	r6, [r5]		/* Get address of first handler structure */
+	ldr	r6, [r7]		/* Get address of first handler structure */
 
 	teq	r6, #0x		/* Do we have a handler */
 	moveq	r0, r8			/* IRQ requests as arg 0 */
@@ -255,7 +255,7 @@ irqdone:
 	stmia   r3, {r1-r2}		/* store ev_count */
 
 nextirq:
-	add	r5, r5, #0x0004	/* update pointer to handlers */
+	add	r7, r7, #0x0004	/* update pointer to handlers */
 	mov	r9, r9, lsl #1		/* move on to next bit */
 	teq	r9, #(1 << 16)		/* done the last bit ? */
 	bne	irqloop			/* no - loop back. */
@@ -269,10 +269,6 @@ nextirq:
 	str	r2, [r1]
 	bl	_C_LABEL(irq_setmasks)
 
-#ifdef __HAVE_FAST_SOFTINTS
-	bl	_C_LABEL(dosoftints)	/* Handle the soft interrupts */
-#endif
-
 	/* Kill IRQ's in preparation for exit */
 	mrs r0, cpsr
 	orr r0, r0, #(I32_bit)



CVS commit: src/sys/arch/arm/ofw

2020-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 19:57:35 UTC 2020

Modified Files:
src/sys/arch/arm/ofw: ofw_irq.S

Log Message:
Adjust egister usage so that r4 and r5 are preserved as cur{cpu,lwp}
respectively as required by the change to make ASTs operate per-LWP
rather than per-CPU.  DO_AST_AND_RESTORE_ALIGNMENT_FAULTS expects this.

Remove the call to dosoftints while I'm here as it's dont in DO_AST...

XXX untested


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/ofw/ofw_irq.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/arm/ofw/ofw_irq.S
diff -u src/sys/arch/arm/ofw/ofw_irq.S:1.16 src/sys/arch/arm/ofw/ofw_irq.S:1.17
--- src/sys/arch/arm/ofw/ofw_irq.S:1.16	Sat Nov 21 09:36:27 2020
+++ src/sys/arch/arm/ofw/ofw_irq.S	Sat Nov 21 19:57:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_irq.S,v 1.16 2020/11/21 09:36:27 skrll Exp $	*/
+/*	$NetBSD: ofw_irq.S,v 1.17 2020/11/21 19:57:35 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -95,12 +95,13 @@ AST_ALIGNMENT_FAULT_LOCALS
  * Regsister usage
  *
  *  r4	- Address of cpu_info (on entry)
- *  r5  - Pointer to handler pointer list
+ *  r5  - Address of curlwp
  *  r6  - Address of current handler
  *  r7  - pspr mode (must be preserved)
  *  r8  - Current IRQ requests.
  *  r9  - Used to count through possible IRQ bits.
  *  r10 - Base address of IOMD
+ *  r11  - Pointer to handler pointer list
  */
 
 ASENTRY_NP(irq_entry)
@@ -188,7 +189,7 @@ ofwtakeint:
 #ifdef EXEC_AOUT
 	ldr	r0, [sp]		/* Fetch SPSR */
 #endif
-	ENABLE_ALIGNMENT_FAULTS
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	mov	r8, #0x0001		/* timer interrupt pending! */
 	mov	r8, r8, lsl #IRQ_TIMER0
@@ -224,17 +225,17 @@ ofwtakeint:
 	 */
 
 	mov	r9, #(NIPL - 1)
-	ldr	r5, Lspl_masks
+	ldr	r11, Lspl_masks
 
 Lfind_highest_ipl:
-	ldr	r2, [r5, r9, lsl #2]
+	ldr	r2, [r11, r9, lsl #2]
 	tst	r8, r2
 	subeq	r9, r9, #1
 	beq	Lfind_highest_ipl
 
 	/* r9 = SPL level of highest priority interrupt */
 	add	r9, r9, #1
-	ldr	r2, [r5, r9, lsl #2]
+	ldr	r2, [r11, r9, lsl #2]
 	mvn	r2, r2
 	orr	r0, r0, r2
 
@@ -252,7 +253,7 @@ Lfind_highest_ipl:
 	bic	r0, r0, #I32_bit
 	msr	cpsr_all, r0
 
-	ldr	r5, Lirqhandlers
+	ldr	r11, Lirqhandlers
 	mov	r9, #0x0001
 
 irqloop:
@@ -260,7 +261,7 @@ irqloop:
 	tst	r8, r9			/* Is a bit set ? */
 	beq	nextirq			/* No ? try next bit */
 
-	ldr	r6, [r5]		/* Get address of first handler structure */
+	ldr	r6, [r11]		/* Get address of first handler structure */
 
 	teq	r6, #0x		/* Do we have a handler */
 	moveq	r0, r8			/* IRQ requests as arg 0 */
@@ -301,7 +302,7 @@ irqdone:
 	stmia   r3, {r1-r2}		/* store ev_count */
 
 nextirq:
-	add	r5, r5, #0x0004	/* update pointer to handlers */
+	add	r11, r11, #0x0004	/* update pointer to handlers */
 	mov	r9, r9, lsl #1		/* move on to next bit */
 	teq	r9, #(1 << 24)		/* done the last bit ? */
 	bne	irqloop			/* no - loop back. */
@@ -315,8 +316,6 @@ nextirq:
 	str	r2, [r1]
 	bl	_C_LABEL(irq_setmasks)
 
-	bl	_C_LABEL(dosoftints)	/* Handle the soft interrupts */
-
 	/* Kill IRQ's in preparation for exit */
 	mrs r0, cpsr
 	orr r0, r0, #(I32_bit)



CVS commit: src/sys/arch/arm/xscale

2020-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 19:55:49 UTC 2020

Modified Files:
src/sys/arch/arm/xscale: i80200_irq.S

Log Message:
Adjust egister usage so that r4 and r5 are preserved as cur{cpu,lwp}
respectively as required by the change to make ASTs operate per-LWP
rather than per-CPU.  DO_AST_AND_RESTORE_ALIGNMENT_FAULTS expects this.

XXX untested


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/xscale/i80200_irq.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/arm/xscale/i80200_irq.S
diff -u src/sys/arch/arm/xscale/i80200_irq.S:1.18 src/sys/arch/arm/xscale/i80200_irq.S:1.19
--- src/sys/arch/arm/xscale/i80200_irq.S:1.18	Thu Jul 12 10:46:42 2018
+++ src/sys/arch/arm/xscale/i80200_irq.S	Sat Nov 21 19:55:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80200_irq.S,v 1.18 2018/07/12 10:46:42 maxv Exp $	*/
+/*	$NetBSD: i80200_irq.S,v 1.19 2020/11/21 19:55:49 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -63,7 +63,7 @@ ASENTRY_NP(irq_entry)
 	sub	lr, lr, #0x0004	/* Adjust the lr */
 
 	PUSHFRAMEINSVC			/* Push an interrupt frame */
-	ENABLE_ALIGNMENT_FAULTS
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	/*
 	 * Note that we have entered the IRQ handler.  We are
@@ -78,7 +78,7 @@ ASENTRY_NP(irq_entry)
 	/*
 	 * Get the interrupt status into a callee-save register.
 	 */
-	mrc	p13, 0, r5, c4, c0, 0
+	mrc	p13, 0, r6, c4, c0, 0
 
 	/*
 	 * XXX - any need to handle BMU interrupts?
@@ -91,7 +91,7 @@ ASENTRY_NP(irq_entry)
 	 * interrupts disabled, and will return with interrupts
 	 * disabled.
 	 */
-	tst	r5, #(INTSRC_II)
+	tst	r6, #(INTSRC_II)
 	beq	.Lextirq_return		/* no external IRQ pending */
 	ldr	r1, .Lintr_dispatch
 	mov	r0, sp



CVS commit: src/sys/arch/arm/iomd

2020-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 19:52:56 UTC 2020

Modified Files:
src/sys/arch/arm/iomd: iomd_irq.S

Log Message:
Adjust code and register usage so that r4 and r5 are preserved as
cur{cpu,lwp} respectively as required by the change to make ASTs
operate per-LWP rather than per-CPU.  These registers are used by
DO_AST_AND_RESTORE_ALIGNMENT_FAULTS expecting this usage.

XXX untested


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/iomd/iomd_irq.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/arm/iomd/iomd_irq.S
diff -u src/sys/arch/arm/iomd/iomd_irq.S:1.17 src/sys/arch/arm/iomd/iomd_irq.S:1.18
--- src/sys/arch/arm/iomd/iomd_irq.S:1.17	Sat Nov 21 09:36:26 2020
+++ src/sys/arch/arm/iomd/iomd_irq.S	Sat Nov 21 19:52:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: iomd_irq.S,v 1.17 2020/11/21 09:36:26 skrll Exp $	*/
+/*	$NetBSD: iomd_irq.S,v 1.18 2020/11/21 19:52:56 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -100,10 +100,11 @@ AST_ALIGNMENT_FAULT_LOCALS
  * Register usage
  *
  *  r4  - Address of cpu_info
- *  r5  - Address of ffs table
+ *  r5  - Address of curlwp
  *  r6  - Address of current handler
  *  r7  - Pointer to handler pointer list
  *  r8  - Current IRQ requests.
+ *  r9  - scratch
  *  r10 - Base address of IOMD
  *  r11 - IRQ requests still to service.
  */
@@ -118,7 +119,7 @@ ASENTRY_NP(irq_entry)
 	sub	lr, lr, #0x0004	/* Adjust the lr */
 
 	PUSHFRAMEINSVC			/* Push an interrupt frame */
-	ENABLE_ALIGNMENT_FAULTS
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	str	r7, [sp, #TF_FILL]	/* save r7 */
 
@@ -212,22 +213,20 @@ Lfind_highest_ipl:
 	bic	r0, r0, #I32_bit
 	msr	cpsr_all, r0
 
-	ldr	r7, Lirqhandlers
-
 	/*
 	 * take a copy of the IRQ request so that we can strip bits out of it
 	 * note that we only use 24 bits with iomd2 chips
 	 */
-	ldr	r5, Larm7500_ioc_found
-	ldr	r5, [r5]			/* get the flag  */
-	cmp	r5, #0
+	ldr	r7, Larm7500_ioc_found
+	ldr	r7, [r7]			/* get the flag  */
+	cmp	r7, #0
 	movne	r11, r8/* ARM7500  -> copy all bits   */
 	biceq	r11, r8, #0xff00		/* !ARM7500 -> only use 24 bit */
 
 	/* ffs routine to find first irq to service */
 	/* standard trick to isolate bottom bit in a0 or 0 if a0 = 0 on entry */
-	rsb	r5, r11, #0
-	ands	r10, r11, r5
+	rsb	r7, r11, #0
+	ands	r10, r11, r7
 
 	/*
 	 * now r10 has at most 1 set bit, call this X
@@ -235,22 +234,22 @@ Lfind_highest_ipl:
 	 */
 	beq	exitirq
 irqloop:
-	adr	r5, Lirq_ffs_table
+	ldr	r6, Lirqhandlers
+	adr	r7, Lirq_ffs_table
 	/*
 	 * at this point:
-	 *	r5 = address of ffs table
-	 *	r7 = address of irq handlers table
+	 * 	r6 = address of irq handlers table
+	 *	r7 = address of ffs table
 	 *	r8 = irq request
 	 *	r10 = bit of irq to be serviced
 	 *	r11 = bitmask of IRQ's to service
 	 */
-
 	/* find the set bit */
 	orr	r9, r10, r10, lsl #4	/* X * 0x11 */
 	orr	r9, r9, r9, lsl #6	/* X * 0x451 */
 	rsb	r9, r9, r9, lsl #16	/* X * 0x0450fbaf */
 	/* fetch the bit number */
-	ldrb	r9, [r5, r9, lsr #26 ]
+	ldrb	r9, [r7, r9, lsr #26 ]
 
 	/*
 	 * r9 = irq to service
@@ -265,7 +264,7 @@ irqloop:
 	 *	- unsetting of the irq bit in r11
 	 *	- irq stats (if enabled) also get put in the mix
 	 */
-	ldr	r6, [r7, r9, lsl #2]	/* Get address of first handler structure */
+	ldr	r6, [r6, r9, lsl #2]	/* Get address of first handler structure */
 
 	teq	r6, #0x		/* Do we have a handler */
 	moveq	r0, r8			/* IRQ requests as arg 0 */
@@ -301,6 +300,7 @@ irqchainloop:
 	ldr	r0, [r6, #(IH_ARG)]	/* Get argument pointer */
 	teq	r0, #0x		/* If arg is zero pass stack frame */
 	addeq	r0, sp, #8		/* ... stack frame [XXX needs care] */
+
 	mov	lr, pc			/* return address */
 	ldr	pc, [r6, #(IH_FUNC)]	/* Call handler */
 
@@ -313,8 +313,8 @@ irqchainloop:
 	bne	irqchainloop
 nextirq:
 	/* Check for next irq */
-	rsb	r5, r11, #0
-	ands	r10, r11, r5
+	rsb	r7, r11, #0
+	ands	r10, r11, r7
 	/* check if there are anymore irq's to service */
 	bne 	irqloop
 
@@ -326,10 +326,6 @@ exitirq:
 
 	bl	_C_LABEL(irq_setmasks)
 
-#if __HAVE_FAST_SOFTINTS
-	bl	_C_LABEL(dosoftints)	/* Handle the soft interrupts */
-#endif
-
 	/* Kill IRQ's in preparation for exit */
 mrs r0, cpsr
 orr r0, r0, #(I32_bit)



CVS commit: src/sys/arch/arm/arm32

2020-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 19:46:13 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: exception.S irq_dispatch.S

Log Message:
Sprinkle some comments about ENABLE_ALIGNMENT_FAULTS leaving curcpu in r4
and curlwp in r5


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/arm32/exception.S
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/arm32/irq_dispatch.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/arm/arm32/exception.S
diff -u src/sys/arch/arm/arm32/exception.S:1.25 src/sys/arch/arm/arm32/exception.S:1.26
--- src/sys/arch/arm/arm32/exception.S:1.25	Sun Aug 11 06:49:31 2019
+++ src/sys/arch/arm/arm32/exception.S	Sat Nov 21 19:46:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.S,v 1.25 2019/08/11 06:49:31 skrll Exp $	*/
+/*	$NetBSD: exception.S,v 1.26 2020/11/21 19:46:13 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -51,7 +51,7 @@
 
 #include 
 
-	RCSID("$NetBSD: exception.S,v 1.25 2019/08/11 06:49:31 skrll Exp $")
+	RCSID("$NetBSD: exception.S,v 1.26 2020/11/21 19:46:13 skrll Exp $")
 
 	.text
 	.align	0
@@ -80,7 +80,7 @@ ASEND(reset_entry)
  */
 ARM_ASENTRY_NP(swi_entry)
 	PUSHFRAME
-	ENABLE_ALIGNMENT_FAULTS
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	mov	r0, sp			/* Pass the frame to any function */
 	bl	_C_LABEL(swi_handler)	/* It's a SWI ! */
@@ -111,7 +111,7 @@ ARM_ASENTRY_NP(prefetch_abort_entry)
 	clrex
 #endif
 	PUSHFRAMEINSVC
-	ENABLE_ALIGNMENT_FAULTS
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	ldr	r1, .Lprefetch_abort_handler_address
 	adr	lr, .Lexception_exit
@@ -158,7 +158,7 @@ ASENTRY_NP(data_abort_entry)
 #endif
 	PUSHFRAMEINSVC			/* Push trap frame and switch */
 	/* to SVC32 mode */
-	ENABLE_ALIGNMENT_FAULTS
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	ldr	r1, .Ldata_abort_handler_address
 	adr	lr, .Lexception_exit
@@ -261,7 +261,7 @@ ENTRY_NP(undefinedinstruction_bounce)
 	PUSHXXXREGSANDSWITCH
 	PUSHDTRACEGAP
 	PUSHTRAPFRAME(r2)
-	ENABLE_ALIGNMENT_FAULTS
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 	mov	r0, sp
 	adr	lr, .Lexception_exit

Index: src/sys/arch/arm/arm32/irq_dispatch.S
diff -u src/sys/arch/arm/arm32/irq_dispatch.S:1.16 src/sys/arch/arm/arm32/irq_dispatch.S:1.17
--- src/sys/arch/arm/arm32/irq_dispatch.S:1.16	Tue Jun  2 14:06:16 2015
+++ src/sys/arch/arm/arm32/irq_dispatch.S	Sat Nov 21 19:46:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: irq_dispatch.S,v 1.16 2015/06/02 14:06:16 matt Exp $	*/
+/*	$NetBSD: irq_dispatch.S,v 1.17 2020/11/21 19:46:13 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 Fujitsu Component Limited
@@ -95,7 +95,7 @@ ARM_ASENTRY_NP(irq_entry)
 	sub	lr, lr, #0x0004	/* Adjust the lr */
 
 	PUSHFRAMEINSVC			/* Push an interrupt frame */
-	ENABLE_ALIGNMENT_FAULTS		/* finishes with curcpu() in r4 */
+	ENABLE_ALIGNMENT_FAULTS		/* puts cur{cpu,lwp} in r4/r5 */
 
 #ifdef _ARM_ARCH_7
 	clrex/* force all strex to fail */
@@ -108,7 +108,8 @@ ARM_ASENTRY_NP(irq_entry)
 	 * callee-saved regs here.  We use the following registers, which
 	 * we expect to persist:
 	 *
-	 *	r4	address of current cpu_info
+	 *	r4	address of current cpu_info (curcpu)
+	 *  r5	address of current lwp (curlwp)
 	 *	r6	old value of `ci_intr_depth'
 	 */
 	ldr	r6, [r4, #CI_INTR_DEPTH]



CVS commit: src/sys/arch/arm/arm32

2020-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 19:44:52 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
Ensure that r5 contains curlwp before DO_AST_AND_RESTORE_ALIGNMENT_FAULTS
in lwp_trampoline as required by the move to make ASTs operate per-LWP
rather than per-CPU.

Thanks to martin@ for bisecting the amap corruption he was seeing and
testing this fix.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/arm/arm32/cpuswitch.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/arm/arm32/cpuswitch.S
diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.103 src/sys/arch/arm/arm32/cpuswitch.S:1.104
--- src/sys/arch/arm/arm32/cpuswitch.S:1.103	Sat Aug 15 13:33:54 2020
+++ src/sys/arch/arm/arm32/cpuswitch.S	Sat Nov 21 19:44:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuswitch.S,v 1.103 2020/08/15 13:33:54 skrll Exp $	*/
+/*	$NetBSD: cpuswitch.S,v 1.104 2020/11/21 19:44:52 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-	RCSID("$NetBSD: cpuswitch.S,v 1.103 2020/08/15 13:33:54 skrll Exp $")
+	RCSID("$NetBSD: cpuswitch.S,v 1.104 2020/11/21 19:44:52 skrll Exp $")
 
 /* LINTSTUB: include  */
 
@@ -324,7 +324,8 @@ ENTRY_NP(lwp_trampoline)
 	GET_CPSR(r0)
 	CPSID_I(r0, r0)			/* Kill irq's */
 
-	GET_CURCPU(r4)			/* for DO_AST */
+	/* for DO_AST */
+	GET_CURX(r4, r5)		/* r4 = curcpu, r5 = curlwp */
 	DO_AST_AND_RESTORE_ALIGNMENT_FAULTS
 	PULLFRAME
 



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 19:40:19 UTC 2020

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

Log Message:
make(1): improve comment for Suffix_GetSuffix


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.271 src/usr.bin/make/suff.c:1.272
--- src/usr.bin/make/suff.c:1.271	Sat Nov 21 19:33:38 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 19:40:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.271 2020/11/21 19:33:38 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.272 2020/11/21 19:40:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.271 2020/11/21 19:33:38 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.272 2020/11/21 19:40:19 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -183,7 +183,7 @@ typedef struct Suffix {
 typedef struct Src {
 char *file;			/* The file to look for */
 char *pref;			/* Prefix from which file was formed */
-Suffix *suff;			/* The suffix on the file */
+Suffix *suff;		/* The suffix on the file */
 struct Src *parent;		/* The Src for which this is a source */
 GNode *node;		/* The node describing the file */
 int numChildren;		/* Count of existing children (so we don't free
@@ -245,8 +245,8 @@ SuffStrIsPrefix(const char *pref, const 
 }
 
 /*
- * See if suff is a suffix of name.
- * Return NULL if it ain't, pointer to the start of suffix in name if it is.
+ * See if suff is a suffix of name, and if so, return a pointer to the suffix
+ * in the given name, thereby marking the point where the prefix ends.
  */
 static const char *
 Suffix_GetSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 19:33:38 UTC 2020

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

Log Message:
make(1): rename Suff functions whose subject is a single suffix

The naming scheme Suffix_Func makes these functions easily
distinguishable from those that merely happen to be in the Suff module
but have nothing to do with suffixes, such as SuffStrIsPrefix.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.270 src/usr.bin/make/suff.c:1.271
--- src/usr.bin/make/suff.c:1.270	Sat Nov 21 19:21:49 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 19:33:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.270 2020/11/21 19:21:49 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.271 2020/11/21 19:33:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.270 2020/11/21 19:21:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.271 2020/11/21 19:33:38 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -204,7 +204,7 @@ static void SuffFindDeps(GNode *, SrcLis
 static void SuffExpandWildcards(GNodeListNode *, GNode *);
 
 static Suffix *
-SuffRef(Suffix *suff)
+Suffix_Ref(Suffix *suff)
 {
 suff->refCount++;
 return suff;
@@ -212,7 +212,7 @@ SuffRef(Suffix *suff)
 
 /* Change the value of a Suffix variable, adjusting the reference counts. */
 static void
-SuffReassign(Suffix **var, Suffix *suff)
+Suffix_Reassign(Suffix **var, Suffix *suff)
 {
 if (*var != NULL)
 	(*var)->refCount--;
@@ -222,7 +222,7 @@ SuffReassign(Suffix **var, Suffix *suff)
 
 /* Set a Suffix variable to NULL, adjusting the reference count. */
 static void
-SuffUnassign(Suffix **var)
+Suffix_Unassign(Suffix **var)
 {
 if (*var != NULL)
 	(*var)->refCount--;
@@ -249,7 +249,7 @@ SuffStrIsPrefix(const char *pref, const 
  * Return NULL if it ain't, pointer to the start of suffix in name if it is.
  */
 static const char *
-SuffSuffGetSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)
+Suffix_GetSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)
 {
 const char *p1;		/* Pointer into suffix name */
 const char *p2;		/* Pointer into string being examined */
@@ -270,13 +270,13 @@ SuffSuffGetSuffix(const Suffix *suff, si
 }
 
 static Boolean
-SuffSuffIsSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)
+Suffix_IsSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)
 {
-return SuffSuffGetSuffix(suff, nameLen, nameEnd) != NULL;
+return Suffix_GetSuffix(suff, nameLen, nameEnd) != NULL;
 }
 
 static Suffix *
-FindSuffByNameLen(const char *name, size_t nameLen)
+FindSuffixByNameLen(const char *name, size_t nameLen)
 {
 SuffixListNode *ln;
 
@@ -289,9 +289,9 @@ FindSuffByNameLen(const char *name, size
 }
 
 static Suffix *
-FindSuffByName(const char *name)
+FindSuffixByName(const char *name)
 {
-return FindSuffByNameLen(name, strlen(name));
+return FindSuffixByNameLen(name, strlen(name));
 }
 
 static GNode *
@@ -318,9 +318,8 @@ SuffixList_Unref(SuffixList *list, Suffi
 
 /* Free up all memory associated with the given suffix structure. */
 static void
-SuffFree(void *sp)
+Suffix_Free(Suffix *suff)
 {
-Suffix *suff = sp;
 
 if (suff == nullSuff)
 	nullSuff = NULL;
@@ -344,6 +343,12 @@ SuffFree(void *sp)
 free(suff);
 }
 
+static void
+SuffFree(void *p)
+{
+Suffix_Free(p);
+}
+
 /* Remove the suffix from the list, and free if it is otherwise unused. */
 static void
 SuffixList_Remove(SuffixList *list, Suffix *suff)
@@ -374,12 +379,12 @@ SuffixList_Insert(SuffixList *list, Suff
 if (ln == NULL) {
 	SUFF_DEBUG2("inserting \"%s\" (%d) at end of list\n",
 		suff->name, suff->sNum);
-	Lst_Append(list, SuffRef(suff));
+	Lst_Append(list, Suffix_Ref(suff));
 	Lst_Append(suff->ref, list);
 } else if (listSuff->sNum != suff->sNum) {
 	DEBUG4(SUFF, "inserting \"%s\" (%d) before \"%s\" (%d)\n",
 		   suff->name, suff->sNum, listSuff->name, listSuff->sNum);
-	Lst_InsertBefore(list, ln, SuffRef(suff));
+	Lst_InsertBefore(list, ln, Suffix_Ref(suff));
 	Lst_Append(suff->ref, list);
 } else {
 	SUFF_DEBUG2("\"%s\" (%d) is already there\n", suff->name, suff->sNum);
@@ -394,7 +399,7 @@ SuffRelate(Suffix *srcSuff, Suffix *targ
 }
 
 static Suffix *
-SuffNew(const char *name)
+Suffix_New(const char *name)
 {
 Suffix *suff = bmake_malloc(sizeof *suff);
 
@@ -429,7 +434,7 @@ Suff_ClearSuffixes(void)
 sNum = 0;
 if (nullSuff != NULL)
 	SuffFree(nullSuff);
-emptySuff = nullSuff = SuffNew("");
+emptySuff = nullSuff = Suffix_New("");
 
 Dir_Concat(nullSuff->searchPath, dirSearchPath);
   

CVS commit: src/sys/arch/emips/emips

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 19:24:17 UTC 2020

Modified Files:
src/sys/arch/emips/emips: bus_dma.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/emips/emips/bus_dma.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/emips/emips/bus_dma.c
diff -u src/sys/arch/emips/emips/bus_dma.c:1.4 src/sys/arch/emips/emips/bus_dma.c:1.5
--- src/sys/arch/emips/emips/bus_dma.c:1.4	Thu Jun 11 08:22:08 2015
+++ src/sys/arch/emips/emips/bus_dma.c	Sat Nov 21 19:24:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.4 2015/06/11 08:22:08 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.5 2020/11/21 19:24:17 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.4 2015/06/11 08:22:08 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.5 2020/11/21 19:24:17 thorpej Exp $");
 
 #include "opt_cputype.h"
 
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -87,6 +88,14 @@ emips_bus_dma_init(void)
 #endif
 }
 
+static size_t 
+_bus_dmamap_mapsize(int const nsegments)
+{   
+	KASSERT(nsegments > 0);
+	return sizeof(struct emips_bus_dmamap) +
+	(sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -97,7 +106,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct emips_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map
@@ -111,13 +119,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct emips_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	if ((mapstore = malloc(mapsize, M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return (ENOMEM);
 
-	memset(mapstore, 0, mapsize);
 	map = (struct emips_bus_dmamap *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -141,7 +146,7 @@ void
 _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
 {
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 19:21:50 UTC 2020

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

Log Message:
make(1): rename type SuffFlags to SuffixFlags


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.269 src/usr.bin/make/suff.c:1.270
--- src/usr.bin/make/suff.c:1.269	Sat Nov 21 19:18:24 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 19:21:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.269 2020/11/21 19:18:24 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.270 2020/11/21 19:21:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.269 2020/11/21 19:18:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.270 2020/11/21 19:21:49 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -140,14 +140,14 @@ static GNodeList *transforms;
 
 static int sNum = 0;		/* Counter for assigning suffix numbers */
 
-typedef enum SuffFlags {
+typedef enum SuffixFlags {
 SUFF_INCLUDE	= 0x01,	/* One which is #include'd */
 SUFF_LIBRARY	= 0x02,	/* One which contains a library */
 SUFF_NULL		= 0x04	/* The empty suffix */
 /* XXX: Why is SUFF_NULL needed? Wouldn't nameLen == 0 mean the same? */
-} SuffFlags;
+} SuffixFlags;
 
-ENUM_FLAGS_RTTI_3(SuffFlags,
+ENUM_FLAGS_RTTI_3(SuffixFlags,
 		  SUFF_INCLUDE, SUFF_LIBRARY, SUFF_NULL);
 
 typedef List SuffixListList;
@@ -158,7 +158,7 @@ typedef struct Suffix {
 /* Length of the name, to avoid strlen calls */
 size_t nameLen;
 /* Type of suffix */
-SuffFlags flags;
+SuffixFlags flags;
 /* The path along which files of this suffix may be found */
 SearchPath *searchPath;
 /* The suffix number; TODO: document the purpose of this number */
@@ -2011,11 +2011,12 @@ PrintSuff(Suffix *suff)
 debug_printf("# \"%s\" (num %d, ref %d)",
 		 suff->name, suff->sNum, suff->refCount);
 if (suff->flags != 0) {
-	char flags_buf[SuffFlags_ToStringSize];
+	char flags_buf[SuffixFlags_ToStringSize];
 
 	debug_printf(" (%s)",
 		 Enum_FlagsToString(flags_buf, sizeof flags_buf,
-	suff->flags, SuffFlags_ToStringSpecs));
+	suff->flags,
+	SuffixFlags_ToStringSpecs));
 }
 debug_printf("\n");
 



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 19:18:24 UTC 2020

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

Log Message:
make(1): rename SuffList to SuffixList


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.268 src/usr.bin/make/suff.c:1.269
--- src/usr.bin/make/suff.c:1.268	Sat Nov 21 19:15:06 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 19:18:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.268 2020/11/21 19:15:06 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.269 2020/11/21 19:18:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,21 +114,21 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.268 2020/11/21 19:15:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.269 2020/11/21 19:18:24 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
 #define SUFF_DEBUG2(fmt, arg1, arg2) DEBUG2(SUFF, fmt, arg1, arg2)
 
-typedef List SuffList;
-typedef ListNode SuffListNode;
+typedef List SuffixList;
+typedef ListNode SuffixListNode;
 
 typedef List SrcList;
 typedef ListNode SrcListNode;
 
-static SuffList *sufflist;	/* List of suffixes */
+static SuffixList *sufflist;	/* List of suffixes */
 #ifdef CLEANUP
-static SuffList *suffClean;	/* List of suffixes to be cleaned */
+static SuffixList *suffClean;	/* List of suffixes to be cleaned */
 #endif
 
 /* XXX: What exactly is this variable used for? */
@@ -150,7 +150,7 @@ typedef enum SuffFlags {
 ENUM_FLAGS_RTTI_3(SuffFlags,
 		  SUFF_INCLUDE, SUFF_LIBRARY, SUFF_NULL);
 
-typedef List SuffListList;
+typedef List SuffixListList;
 
 typedef struct Suffix {
 /* The suffix itself, such as ".c" */
@@ -166,15 +166,15 @@ typedef struct Suffix {
 /* Reference count of list membership and several other places */
 int refCount;
 /* Suffixes we have a transformation to */
-SuffList *parents;
+SuffixList *parents;
 /* Suffixes we have a transformation from */
-SuffList *children;
+SuffixList *children;
 
 /* Lists in which this suffix is referenced.
  * XXX: These lists are used nowhere, they are just appended to, for no
  * apparent reason.  They do have the side effect of increasing refCount
  * though. */
-SuffListList *ref;
+SuffixListList *ref;
 } Suffix;
 
 /*
@@ -278,7 +278,7 @@ SuffSuffIsSuffix(const Suffix *suff, siz
 static Suffix *
 FindSuffByNameLen(const char *name, size_t nameLen)
 {
-SuffListNode *ln;
+SuffixListNode *ln;
 
 for (ln = sufflist->first; ln != NULL; ln = ln->next) {
 	Suffix *suff = ln->datum;
@@ -307,9 +307,9 @@ FindTransformByName(const char *name)
 }
 
 static void
-SuffList_Unref(SuffList *list, Suffix *suff)
+SuffixList_Unref(SuffixList *list, Suffix *suff)
 {
-SuffListNode *ln = Lst_FindDatum(list, suff);
+SuffixListNode *ln = Lst_FindDatum(list, suff);
 if (ln != NULL) {
 	Lst_Remove(list, ln);
 	suff->refCount--;
@@ -346,12 +346,12 @@ SuffFree(void *sp)
 
 /* Remove the suffix from the list, and free if it is otherwise unused. */
 static void
-SuffList_Remove(SuffList *list, Suffix *suff)
+SuffixList_Remove(SuffixList *list, Suffix *suff)
 {
-SuffList_Unref(list, suff);
+SuffixList_Unref(list, suff);
 if (suff->refCount == 0) {
 	/* XXX: can lead to suff->refCount == -1 */
-	SuffList_Unref(sufflist, suff);
+	SuffixList_Unref(sufflist, suff);
 	DEBUG1(SUFF, "Removing suffix \"%s\"\n", suff->name);
 	SuffFree(suff);
 }
@@ -360,9 +360,9 @@ SuffList_Remove(SuffList *list, Suffix *
 /* Insert the suffix into the list, keeping the list ordered by suffix
  * number. */
 static void
-SuffList_Insert(SuffList *list, Suffix *suff)
+SuffixList_Insert(SuffixList *list, Suffix *suff)
 {
-SuffListNode *ln;
+SuffixListNode *ln;
 Suffix *listSuff = NULL;
 
 for (ln = list->first; ln != NULL; ln = ln->next) {
@@ -389,8 +389,8 @@ SuffList_Insert(SuffList *list, Suffix *
 static void
 SuffRelate(Suffix *srcSuff, Suffix *targSuff)
 {
-SuffList_Insert(targSuff->children, srcSuff);
-SuffList_Insert(srcSuff->parents, targSuff);
+SuffixList_Insert(targSuff->children, srcSuff);
+SuffixList_Insert(srcSuff->parents, targSuff);
 }
 
 static Suffix *
@@ -444,7 +444,7 @@ Suff_ClearSuffixes(void)
 static Boolean
 SuffParseTransform(const char *str, Suffix **out_src, Suffix **out_targ)
 {
-SuffListNode *ln;
+SuffixListNode *ln;
 Suffix *singleSrc = NULL;
 
 /*
@@ -568,7 +568,7 @@ void
 Suff_EndTransform(GNode *gn)
 {
 Suffix *srcSuff, *targSuff;
-SuffList *srcSuffParents;
+SuffixList *srcSuffParents;
 
 if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
 	gn = gn->cohorts->last->datum;
@@ -591,10 +591,10 @@ 

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 19:15:06 UTC 2020

Modified Files:
src/usr.bin/make: make.h suff.c

Log Message:
make(1): rename type Suff to Suffix

This avoids confusion with the module suff.c of the same name.

The existing naming convention is that the module's public functions are
named Suff_Func and its private functions are named SuffFunc.  This
collides with the naming convention that a the functions of the type Suff
are called Suff_Func as well.

To resolve this collision, rename Suff to Suffix.  The related types like
SuffList and the affected functions like SuffRef will be renamed in a
follow-up commit.


To generate a diff of this commit:
cvs rdiff -u -r1.211 -r1.212 src/usr.bin/make/make.h
cvs rdiff -u -r1.267 -r1.268 src/usr.bin/make/suff.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/make.h
diff -u src/usr.bin/make/make.h:1.211 src/usr.bin/make/make.h:1.212
--- src/usr.bin/make/make.h:1.211	Sat Nov 21 18:41:57 2020
+++ src/usr.bin/make/make.h	Sat Nov 21 19:15:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.211 2020/11/21 18:41:57 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.212 2020/11/21 19:15:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -378,7 +378,7 @@ typedef struct GNode {
 
 /* Suffix for the node (determined by Suff_FindDeps and opaque to everyone
  * but the Suff module) */
-struct Suff *suffix;
+struct Suffix *suffix;
 
 /* Filename where the GNode got defined */
 /* XXX: What is the lifetime of this string? */

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.267 src/usr.bin/make/suff.c:1.268
--- src/usr.bin/make/suff.c:1.267	Sat Nov 21 19:02:58 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 19:15:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.267 2020/11/21 19:02:58 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.268 2020/11/21 19:15:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.267 2020/11/21 19:02:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.268 2020/11/21 19:15:06 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -152,7 +152,7 @@ ENUM_FLAGS_RTTI_3(SuffFlags,
 
 typedef List SuffListList;
 
-typedef struct Suff {
+typedef struct Suffix {
 /* The suffix itself, such as ".c" */
 char *name;
 /* Length of the name, to avoid strlen calls */
@@ -175,7 +175,7 @@ typedef struct Suff {
  * apparent reason.  They do have the side effect of increasing refCount
  * though. */
 SuffListList *ref;
-} Suff;
+} Suffix;
 
 /*
  * Structure used in the search for implied sources.
@@ -183,7 +183,7 @@ typedef struct Suff {
 typedef struct Src {
 char *file;			/* The file to look for */
 char *pref;			/* Prefix from which file was formed */
-Suff *suff;			/* The suffix on the file */
+Suffix *suff;			/* The suffix on the file */
 struct Src *parent;		/* The Src for which this is a source */
 GNode *node;		/* The node describing the file */
 int numChildren;		/* Count of existing children (so we don't free
@@ -195,24 +195,24 @@ typedef struct Src {
 
 /* TODO: Document the difference between nullSuff and emptySuff. */
 /* The NULL suffix for this run */
-static Suff *nullSuff;
+static Suffix *nullSuff;
 /* The empty suffix required for POSIX single-suffix transformation rules */
-static Suff *emptySuff;
+static Suffix *emptySuff;
 
 
 static void SuffFindDeps(GNode *, SrcList *);
 static void SuffExpandWildcards(GNodeListNode *, GNode *);
 
-static Suff *
-SuffRef(Suff *suff)
+static Suffix *
+SuffRef(Suffix *suff)
 {
 suff->refCount++;
 return suff;
 }
 
-/* Change the value of a Suff variable, adjusting the reference counts. */
+/* Change the value of a Suffix variable, adjusting the reference counts. */
 static void
-SuffReassign(Suff **var, Suff *suff)
+SuffReassign(Suffix **var, Suffix *suff)
 {
 if (*var != NULL)
 	(*var)->refCount--;
@@ -220,9 +220,9 @@ SuffReassign(Suff **var, Suff *suff)
 suff->refCount++;
 }
 
-/* Set a Suff variable to NULL, adjusting the reference count. */
+/* Set a Suffix variable to NULL, adjusting the reference count. */
 static void
-SuffUnassign(Suff **var)
+SuffUnassign(Suffix **var)
 {
 if (*var != NULL)
 	(*var)->refCount--;
@@ -249,7 +249,7 @@ SuffStrIsPrefix(const char *pref, const 
  * Return NULL if it ain't, pointer to the start of suffix in name if it is.
  */
 static const char *
-SuffSuffGetSuffix(const Suff *suff, size_t nameLen, const char *nameEnd)
+SuffSuffGetSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd)
 {
 const char *p1;		/* Pointer into suffix name */
 const char *p2;		/* Pointer into string being examined */
@@ -270,25 +270,25 @@ 

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 19:02:59 UTC 2020

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

Log Message:
make(1): rename suffNull to nullSuff

This variable is internal to the suff.c module, therefore there is no
need to prefix it with the module name.  The new name follows the naming
convention established by emptySuff.


To generate a diff of this commit:
cvs rdiff -u -r1.266 -r1.267 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.266 src/usr.bin/make/suff.c:1.267
--- src/usr.bin/make/suff.c:1.266	Sat Nov 21 18:28:34 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 19:02:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.266 2020/11/21 18:28:34 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.267 2020/11/21 19:02:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.266 2020/11/21 18:28:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.267 2020/11/21 19:02:58 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -193,9 +193,9 @@ typedef struct Src {
 #endif
 } Src;
 
-/* TODO: Document the difference between suffNull and emptySuff. */
+/* TODO: Document the difference between nullSuff and emptySuff. */
 /* The NULL suffix for this run */
-static Suff *suffNull;
+static Suff *nullSuff;
 /* The empty suffix required for POSIX single-suffix transformation rules */
 static Suff *emptySuff;
 
@@ -322,8 +322,8 @@ SuffFree(void *sp)
 {
 Suff *suff = sp;
 
-if (suff == suffNull)
-	suffNull = NULL;
+if (suff == nullSuff)
+	nullSuff = NULL;
 
 if (suff == emptySuff)
 	emptySuff = NULL;
@@ -427,12 +427,12 @@ Suff_ClearSuffixes(void)
 DEBUG0(SUFF, "Clearing all suffixes\n");
 sufflist = Lst_New();
 sNum = 0;
-if (suffNull != NULL)
-	SuffFree(suffNull);
-emptySuff = suffNull = SuffNew("");
+if (nullSuff != NULL)
+	SuffFree(nullSuff);
+emptySuff = nullSuff = SuffNew("");
 
-Dir_Concat(suffNull->searchPath, dirSearchPath);
-suffNull->flags = SUFF_NULL;
+Dir_Concat(nullSuff->searchPath, dirSearchPath);
+nullSuff->flags = SUFF_NULL;
 }
 
 /* Parse a transformation string such as ".c.o" to find its two component
@@ -479,10 +479,10 @@ SuffParseTransform(const char *str, Suff
 	 * find a double rule over a singleton, hence we leave this
 	 * check until the end.
 	 *
-	 * XXX: Use emptySuff over suffNull?
+	 * XXX: Use emptySuff over nullSuff?
 	 */
 	*out_src = singleSrc;
-	*out_targ = suffNull;
+	*out_targ = nullSuff;
 	return TRUE;
 }
 return FALSE;
@@ -1472,7 +1472,7 @@ SuffFindArchiveDeps(GNode *gn, SrcList *
 ms = mem->suffix;
 if (ms == NULL) {		/* Didn't know what it was. */
 	SUFF_DEBUG0("using null suffix\n");
-	ms = suffNull;
+	ms = nullSuff;
 }
 
 
@@ -1579,13 +1579,13 @@ SuffFindNormalDepsUnknown(GNode *gn, con
 {
 Src *targ;
 
-if (!Lst_IsEmpty(targs) || suffNull == NULL)
+if (!Lst_IsEmpty(targs) || nullSuff == NULL)
 	return;
 
 SUFF_DEBUG1("\tNo known suffix on %s. Using .NULL suffix\n", gn->name);
 
 targ = SrcNew(bmake_strdup(gn->name), bmake_strdup(sopref),
-		  suffNull, NULL, gn);
+		  nullSuff, NULL, gn);
 
 /*
  * Only use the default suffix rules if we don't have commands
@@ -1948,13 +1948,13 @@ Suff_SetNull(const char *name)
 	return;
 }
 
-if (suffNull != NULL)
-	suffNull->flags &= ~(unsigned)SUFF_NULL;
+if (nullSuff != NULL)
+	nullSuff->flags &= ~(unsigned)SUFF_NULL;
 suff->flags |= SUFF_NULL;
 /*
  * XXX: Here's where the transformation mangling would take place
  */
-suffNull = suff;
+nullSuff = suff;
 }
 
 /* Initialize the suffixes module. */
@@ -1984,8 +1984,8 @@ Suff_End(void)
 #ifdef CLEANUP
 Lst_Destroy(sufflist, SuffFree);
 Lst_Destroy(suffClean, SuffFree);
-if (suffNull != NULL)
-	SuffFree(suffNull);
+if (nullSuff != NULL)
+	SuffFree(nullSuff);
 Lst_Free(srclist);
 Lst_Free(transforms);
 #endif



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 18:41:57 UTC 2020

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

Log Message:
make(1): rename GNode.context to vars

Especially in the variables module, the expression 'ctxt->context' looked
redundant.  Having a GNode as a context sounds ok, but a context of a
context just doesn't make sense.


To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 src/usr.bin/make/make.h
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/make/targ.c
cvs rdiff -u -r1.692 -r1.693 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/make.h
diff -u src/usr.bin/make/make.h:1.210 src/usr.bin/make/make.h:1.211
--- src/usr.bin/make/make.h:1.210	Mon Nov 16 21:53:10 2020
+++ src/usr.bin/make/make.h	Sat Nov 21 18:41:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.210 2020/11/16 21:53:10 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.211 2020/11/21 18:41:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -371,7 +371,7 @@ typedef struct GNode {
  *
  * Also used for the global variable scopes VAR_GLOBAL, VAR_CMDLINE,
  * VAR_INTERNAL, which contain variables with arbitrary names. */
-HashTable /* of Var pointer */ context;
+HashTable /* of Var pointer */ vars;
 
 /* The commands to be given to a shell to create this target. */
 StringList *commands;

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.138 src/usr.bin/make/targ.c:1.139
--- src/usr.bin/make/targ.c:1.138	Sat Nov 21 11:59:22 2020
+++ src/usr.bin/make/targ.c	Sat Nov 21 18:41:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.138 2020/11/21 11:59:22 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.139 2020/11/21 18:41:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -119,7 +119,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.138 2020/11/21 11:59:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.139 2020/11/21 18:41:57 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -211,7 +211,7 @@ GNode_New(const char *name)
 gn->unmade_cohorts = 0;
 gn->centurion = NULL;
 gn->checked_seqno = 0;
-HashTable_Init(>context);
+HashTable_Init(>vars);
 gn->commands = Lst_New();
 gn->suffix = NULL;
 gn->fname = NULL;
@@ -240,7 +240,7 @@ GNode_Free(void *gnp)
 Lst_Free(gn->order_pred);	/* likewise */
 Lst_Free(gn->order_succ);	/* likewise */
 Lst_Free(gn->cohorts);	/* likewise */
-HashTable_Done(>context); /* Do not free the variables themselves,
+HashTable_Done(>vars);	/* Do not free the variables themselves,
  * even though they are owned by this node.
  * XXX: they should probably be freed. */
 Lst_Free(gn->commands);	/* Do not free the commands themselves,

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.692 src/usr.bin/make/var.c:1.693
--- src/usr.bin/make/var.c:1.692	Sat Nov 21 15:32:52 2020
+++ src/usr.bin/make/var.c	Sat Nov 21 18:41:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.692 2020/11/21 15:32:52 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.693 2020/11/21 18:41:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.692 2020/11/21 15:32:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.693 2020/11/21 18:41:57 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -342,7 +342,7 @@ CanonicalVarname(const char *name)
 static Var *
 GNode_FindVar(GNode *ctxt, const char *varname, unsigned int hash)
 {
-return HashTable_FindValueHash(>context, varname, hash);
+return HashTable_FindValueHash(>vars, varname, hash);
 }
 
 /* Find the variable in the context, and maybe in other contexts as well.
@@ -437,7 +437,7 @@ VarFreeEnv(Var *v, Boolean freeValue)
 static void
 VarAdd(const char *name, const char *val, GNode *ctxt, VarSetFlags flags)
 {
-HashEntry *he = HashTable_CreateEntry(>context, name, NULL);
+HashEntry *he = HashTable_CreateEntry(>vars, name, NULL);
 Var *v = VarNew(he->key /* aliased */, NULL, val,
 		flags & VAR_SET_READONLY ? VAR_READONLY : 0);
 HashEntry_Set(he, v);
@@ -459,7 +459,7 @@ Var_Delete(const char *name, GNode *ctxt
 	/* TODO: handle errors */
 	name = name_freeIt;
 }
-he = HashTable_FindEntry(>context, name);
+he = HashTable_FindEntry(>vars, name);
 VAR_DEBUG3("%s:delete %s%s\n",
 	   ctxt->name, name, he != NULL ? "" : " (not found)");
 free(name_freeIt);
@@ -471,7 +471,7 @@ Var_Delete(const char *name, GNode *ctxt
 	if (strcmp(v->name, MAKE_EXPORTED) == 0)
 	var_exportedVars = VAR_EXPORTED_NONE;
 	assert(v->name_freeIt == NULL);
-	

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 18:28:35 UTC 2020

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

Log Message:
make(1): improve name of local variable in SrcList_Add

Now that nothing in suff.c is named 's' anymore, there is no need for
's2' either.


To generate a diff of this commit:
cvs rdiff -u -r1.265 -r1.266 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.265 src/usr.bin/make/suff.c:1.266
--- src/usr.bin/make/suff.c:1.265	Sat Nov 21 18:12:55 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 18:28:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.265 2020/11/21 18:12:55 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.266 2020/11/21 18:28:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.265 2020/11/21 18:12:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.266 2020/11/21 18:28:34 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -884,13 +884,13 @@ static void
 SrcList_Add(SrcList *srcList, char *srcName, Src *targ, Suff *suff,
 	const char *debug_tag)
 {
-Src *s2 = SrcNew(srcName, targ->pref, suff, targ, NULL);
+Src *src = SrcNew(srcName, targ->pref, suff, targ, NULL);
 targ->numChildren++;
-Lst_Append(srcList, s2);
+Lst_Append(srcList, src);
 #ifdef DEBUG_SRC
-Lst_Append(targ->childrenList, s2);
+Lst_Append(targ->childrenList, src);
 debug_printf("%s add suff %p src %p to list %p:",
-		 debug_tag, targ, s2, srcList);
+		 debug_tag, targ, src, srcList);
 SrcList_PrintAddrs(srcList);
 #endif
 }



CVS commit: src/sys/arch/mipsco

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 18:28:33 UTC 2020

Modified Files:
src/sys/arch/mipsco/isa: isa_machdep.c
src/sys/arch/mipsco/mipsco: bus_dma.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mipsco/isa/isa_machdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mipsco/mipsco/bus_dma.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/mipsco/isa/isa_machdep.c
diff -u src/sys/arch/mipsco/isa/isa_machdep.c:1.16 src/sys/arch/mipsco/isa/isa_machdep.c:1.17
--- src/sys/arch/mipsco/isa/isa_machdep.c:1.16	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/mipsco/isa/isa_machdep.c	Sat Nov 21 18:28:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.16 2019/11/10 21:16:30 chs Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.17 2020/11/21 18:28:32 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.16 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.17 2020/11/21 18:28:32 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -179,7 +179,7 @@ isa_intr_establish(isa_chipset_tag_t ic,
 {
 	struct mipsco_intrhand *ih;
 
-	ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof *ih, KM_SLEEP);
 	ih->ih_fun = ih_fun;
 	ih->ih_arg  = ih_arg;
 	LIST_INSERT_HEAD(>intr_q, ih, ih_q);
@@ -192,7 +192,7 @@ isa_intr_disestablish(isa_chipset_tag_t 
 	struct mipsco_intrhand *ih = cookie;
 
 	LIST_REMOVE(ih, ih_q);
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 int

Index: src/sys/arch/mipsco/mipsco/bus_dma.c
diff -u src/sys/arch/mipsco/mipsco/bus_dma.c:1.29 src/sys/arch/mipsco/mipsco/bus_dma.c:1.30
--- src/sys/arch/mipsco/mipsco/bus_dma.c:1.29	Thu Jun 11 08:22:09 2015
+++ src/sys/arch/mipsco/mipsco/bus_dma.c	Sat Nov 21 18:28:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.29 2015/06/11 08:22:09 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.30 2020/11/21 18:28:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,13 +31,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.29 2015/06/11 08:22:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.30 2020/11/21 18:28:33 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -74,6 +75,14 @@ _bus_dma_tag_init(bus_dma_tag_t t)
 	t->_dmamem_mmap = _bus_dmamem_mmap;
 }
 
+static size_t 
+_bus_dmamap_mapsize(int const nsegments)
+{ 
+	KASSERT(nsegments > 0);
+	return sizeof(struct mipsco_bus_dmamap) +
+	(sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -83,7 +92,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct mipsco_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map
@@ -97,13 +105,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct mipsco_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	if ((mapstore = malloc(mapsize, M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return (ENOMEM);
 
-	memset(mapstore, 0, mapsize);
 	map = (struct mipsco_bus_dmamap *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -126,7 +131,7 @@ void
 _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
 {
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*



CVS commit: src/sys/arch/mmeye/dev

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 18:23:36 UTC 2020

Modified Files:
src/sys/arch/mmeye/dev: mmeyepcmcia.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/mmeye/dev/mmeyepcmcia.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/mmeye/dev/mmeyepcmcia.c
diff -u src/sys/arch/mmeye/dev/mmeyepcmcia.c:1.22 src/sys/arch/mmeye/dev/mmeyepcmcia.c:1.23
--- src/sys/arch/mmeye/dev/mmeyepcmcia.c:1.22	Sat Oct 27 17:18:03 2012
+++ src/sys/arch/mmeye/dev/mmeyepcmcia.c	Sat Nov 21 18:23:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mmeyepcmcia.c,v 1.22 2012/10/27 17:18:03 chs Exp $	*/
+/*	$NetBSD: mmeyepcmcia.c,v 1.23 2020/11/21 18:23:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mmeyepcmcia.c,v 1.22 2012/10/27 17:18:03 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mmeyepcmcia.c,v 1.23 2020/11/21 18:23:36 thorpej Exp $");
 
 #include 
 #include 
@@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: mmeyepcmcia.
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -408,9 +408,9 @@ mmeyepcmcia_event_thread(void *arg)
 	break;
 if (pe2->pe_type == MMEYEPCMCIA_EVENT_INSERTION) {
 	SIMPLEQ_REMOVE_HEAD(>events, pe_q);
-	free(pe1, M_TEMP);
+	kmem_free(pe1, sizeof(*pe1));
 	SIMPLEQ_REMOVE_HEAD(>events, pe_q);
-	free(pe2, M_TEMP);
+	kmem_free(pe2, sizeof(*pe2));
 }
 			}
 			splx(s);
@@ -432,9 +432,9 @@ mmeyepcmcia_event_thread(void *arg)
 	break;
 if (pe2->pe_type == MMEYEPCMCIA_EVENT_REMOVAL) {
 	SIMPLEQ_REMOVE_HEAD(>events, pe_q);
-	free(pe1, M_TEMP);
+	kmem_free(pe1, sizeof(*pe1));
 	SIMPLEQ_REMOVE_HEAD(>events, pe_q);
-	free(pe2, M_TEMP);
+	kmem_free(pe2, sizeof(*pe2));
 }
 			}
 			splx(s);
@@ -447,7 +447,7 @@ mmeyepcmcia_event_thread(void *arg)
 			panic("mmeyepcmcia_event_thread: unknown event %d",
 			pe->pe_type);
 		}
-		free(pe, M_TEMP);
+		kmem_free(pe, sizeof(*pe));
 	}
 
 	h->event_thread = NULL;
@@ -590,7 +590,7 @@ mmeyepcmcia_queue_event(struct mmeyepcmc
 	struct mmeyepcmcia_event *pe;
 	int s;
 
-	pe = malloc(sizeof(*pe), M_TEMP, M_NOWAIT);
+	pe = kmem_intr_alloc(sizeof(*pe), KM_NOSLEEP);
 	if (pe == NULL)
 		panic("mmeyepcmcia_queue_event: can't allocate event");
 



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 18:12:55 UTC 2020

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

Log Message:
make(1): rename SuffAddSrc to SrcList_Add

The main character in this function is the list of sources, therefore
make it the subject.


To generate a diff of this commit:
cvs rdiff -u -r1.264 -r1.265 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.264 src/usr.bin/make/suff.c:1.265
--- src/usr.bin/make/suff.c:1.264	Sat Nov 21 18:09:13 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 18:12:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.264 2020/11/21 18:09:13 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.265 2020/11/21 18:12:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.264 2020/11/21 18:09:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.265 2020/11/21 18:12:55 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -881,8 +881,8 @@ SrcNew(char *name, char *pref, Suff *suf
 }
 
 static void
-SuffAddSrc(Suff *suff, SrcList *srcList, Src *targ, char *srcName,
-	   const char *debug_tag MAKE_ATTR_UNUSED)
+SrcList_Add(SrcList *srcList, char *srcName, Src *targ, Suff *suff,
+	const char *debug_tag)
 {
 Src *s2 = SrcNew(srcName, targ->pref, suff, targ, NULL);
 targ->numChildren++;
@@ -913,9 +913,9 @@ SuffAddSources(Suff *suff, SrcList *srcL
 	 * structure for a file with no suffix attached. Two birds, and all
 	 * that...
 	 */
-	SuffAddSrc(suff, srcList, targ, bmake_strdup(targ->pref), "1");
+	SrcList_Add(srcList, bmake_strdup(targ->pref), targ, suff, "1");
 }
-SuffAddSrc(suff, srcList, targ, str_concat2(targ->pref, suff->name), "2");
+SrcList_Add(srcList, str_concat2(targ->pref, suff->name), targ, suff, "2");
 }
 
 /* Add all the children of targ to the list. */



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 18:09:13 UTC 2020

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

Log Message:
make(1): improve parameter name in SuffUpdateTarget


To generate a diff of this commit:
cvs rdiff -u -r1.263 -r1.264 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.263 src/usr.bin/make/suff.c:1.264
--- src/usr.bin/make/suff.c:1.263	Sat Nov 21 18:06:09 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 18:09:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.263 2020/11/21 18:06:09 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.264 2020/11/21 18:09:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.263 2020/11/21 18:06:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.264 2020/11/21 18:09:13 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -652,12 +652,14 @@ SuffRebuildGraph(GNode *transform, Suff 
  *	TRUE iff a new main target has been selected.
  */
 static Boolean
-SuffUpdateTarget(GNode *target, GNode **inout_main, Suff *suff, Boolean *r)
+SuffUpdateTarget(GNode *target, GNode **inout_main, Suff *suff,
+		 Boolean *inout_removedMain)
 {
 Suff *srcSuff, *targSuff;
 char *ptr;
 
-if (*inout_main == NULL && *r && !(target->type & OP_NOTARGET)) {
+if (*inout_main == NULL && *inout_removedMain &&
+	!(target->type & OP_NOTARGET)) {
 	*inout_main = target;
 	Targ_SetMain(target);
 	return TRUE;
@@ -688,7 +690,7 @@ SuffUpdateTarget(GNode *target, GNode **
 
 if (SuffParseTransform(target->name, , )) {
 	if (*inout_main == target) {
-	*r = TRUE;
+	*inout_removedMain = TRUE;
 	*inout_main = NULL;
 	Targ_SetMain(NULL);
 	}



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 18:06:09 UTC 2020

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

Log Message:
make(1): document necessary condition in SuffUpdateTarget


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.262 src/usr.bin/make/suff.c:1.263
--- src/usr.bin/make/suff.c:1.262	Sat Nov 21 17:18:36 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 18:06:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.262 2020/11/21 17:18:36 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.263 2020/11/21 18:06:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.262 2020/11/21 17:18:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.263 2020/11/21 18:06:09 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -667,17 +667,23 @@ SuffUpdateTarget(GNode *target, GNode **
 	return FALSE;
 
 /*
- * XXX: What is the purpose of the 'ptr == target->name' condition here?
- * In suff-rebuild.mk in the line '.SUFFIXES: .c .b .a', it prevents the
- * rule '.b.c' from being added again during Suff_AddSuffix(".b").
- */
-/*
  * XXX: What about a transformation ".cpp.c"?  If ".c" is added as a new
  * suffix, it seems wrong that this transformation would be skipped just
  * because ".c" happens to be a prefix of ".cpp".
  */
-if ((ptr = strstr(target->name, suff->name)) == NULL ||
-	ptr == target->name)
+ptr = strstr(target->name, suff->name);
+if (ptr == NULL)
+	return FALSE;
+
+/*
+ * XXX: In suff-rebuild.mk, in the line '.SUFFIXES: .c .b .a', this
+ * condition prevents the rule '.b.c' from being added again during
+ * Suff_AddSuffix(".b").
+ *
+ * XXX: Removing this paragraph makes suff-add-later.mk use massive
+ * amounts of memory.
+ */
+if (ptr == target->name)
 	return FALSE;
 
 if (SuffParseTransform(target->name, , )) {



CVS commit: src/sys/arch/mvme68k/mvme68k

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:59:13 UTC 2020

Modified Files:
src/sys/arch/mvme68k/mvme68k: bus_dma.c isr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mvme68k/mvme68k/bus_dma.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mvme68k/mvme68k/isr.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/mvme68k/mvme68k/bus_dma.c
diff -u src/sys/arch/mvme68k/mvme68k/bus_dma.c:1.37 src/sys/arch/mvme68k/mvme68k/bus_dma.c:1.38
--- src/sys/arch/mvme68k/mvme68k/bus_dma.c:1.37	Fri Nov 12 13:18:58 2010
+++ src/sys/arch/mvme68k/mvme68k/bus_dma.c	Sat Nov 21 17:59:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.37 2010/11/12 13:18:58 uebayasi Exp $	*/
+/* $NetBSD: bus_dma.c,v 1.38 2020/11/21 17:59:13 thorpej Exp $	*/
 
 /*
  * This file was taken from from next68k/dev/bus_dma.c, which was originally
@@ -39,13 +39,13 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.37 2010/11/12 13:18:58 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.38 2020/11/21 17:59:13 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -64,6 +64,14 @@ int	_bus_dmamap_load_buffer_direct_commo
 	bus_dmamap_t, void *, bus_size_t, struct vmspace *, int,
 	paddr_t *, int *, int);
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct mvme68k_bus_dmamap) +
+	   (sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -74,7 +82,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct mvme68k_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map
@@ -88,13 +95,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct mvme68k_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	if ((mapstore = malloc(mapsize, M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return ENOMEM;
 
-	memset(mapstore, 0, mapsize);
 	map = (struct mvme68k_bus_dmamap *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -117,7 +121,7 @@ void
 _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
 {
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*

Index: src/sys/arch/mvme68k/mvme68k/isr.c
diff -u src/sys/arch/mvme68k/mvme68k/isr.c:1.34 src/sys/arch/mvme68k/mvme68k/isr.c:1.35
--- src/sys/arch/mvme68k/mvme68k/isr.c:1.34	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/mvme68k/mvme68k/isr.c	Sat Nov 21 17:59:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.34 2019/11/10 21:16:30 chs Exp $	*/
+/*	$NetBSD: isr.c,v 1.35 2020/11/21 17:59:13 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,11 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.34 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.35 2020/11/21 17:59:13 thorpej Exp $");
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -105,7 +105,7 @@ isrlink_autovec(int (*func)(void *), voi
 		panic("%s: bad ipl %d", __func__, ipl);
 #endif
 
-	newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_WAITOK);
+	newisr = kmem_alloc(sizeof(*newisr), KM_SLEEP);
 	newisr->isr_func = func;
 	newisr->isr_arg = arg;
 	newisr->isr_ipl = ipl;



CVS commit: src/sys/arch/mvmeppc/mvmeppc

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:57:40 UTC 2020

Modified Files:
src/sys/arch/mvmeppc/mvmeppc: mainbus.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mvmeppc/mvmeppc/mainbus.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/mvmeppc/mvmeppc/mainbus.c
diff -u src/sys/arch/mvmeppc/mvmeppc/mainbus.c:1.19 src/sys/arch/mvmeppc/mvmeppc/mainbus.c:1.20
--- src/sys/arch/mvmeppc/mvmeppc/mainbus.c:1.19	Tue Jul  7 03:38:47 2020
+++ src/sys/arch/mvmeppc/mvmeppc/mainbus.c	Sat Nov 21 17:57:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.19 2020/07/07 03:38:47 thorpej Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.20 2020/11/21 17:57:40 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,12 +31,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.19 2020/07/07 03:38:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2020/11/21 17:57:40 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -107,12 +107,10 @@ mainbus_attach(device_t parent, device_t
 	 * XXX that's not currently possible.
 	 */
 #if NPCI > 0
-	genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF,
-	M_WAITOK);
+	genppc_pct = kmem_alloc(sizeof(struct genppc_pci_chipset), KM_SLEEP);
 	mvmeppc_pci_get_chipset_tag(genppc_pct);
 
-	pbi = malloc(sizeof(struct genppc_pci_chipset_businfo),
-	M_DEVBUF, M_WAITOK);
+	pbi = kmem_alloc(sizeof(struct genppc_pci_chipset_businfo), KM_SLEEP);
 	pbi->pbi_properties = prop_dictionary_create();
 	KASSERT(pbi->pbi_properties != NULL);
 



CVS commit: src/sys/arch/news68k/news68k

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:55:38 UTC 2020

Modified Files:
src/sys/arch/news68k/news68k: isr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/news68k/news68k/isr.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/news68k/news68k/isr.c
diff -u src/sys/arch/news68k/news68k/isr.c:1.22 src/sys/arch/news68k/news68k/isr.c:1.23
--- src/sys/arch/news68k/news68k/isr.c:1.22	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/news68k/news68k/isr.c	Sat Nov 21 17:55:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.22 2019/11/10 21:16:30 chs Exp $	*/
+/*	$NetBSD: isr.c,v 1.23 2020/11/21 17:55:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -39,11 +39,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.22 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.23 2020/11/21 17:55:38 thorpej Exp $");
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -82,7 +82,7 @@ isrlink_autovec(int (*func)(void *), voi
 	if ((ipl < 0) || (ipl >= NISRAUTOVEC))
 		panic("isrlink_autovec: bad ipl %d", ipl);
 
-	newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_WAITOK);
+	newisr = kmem_alloc(sizeof(*newisr), KM_SLEEP);
 	newisr->isr_func = func;
 	newisr->isr_arg = arg;
 	newisr->isr_ipl = ipl;



CVS commit: src/sys/arch/newsmips

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:54:48 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: apbus.c xafb.c
src/sys/arch/newsmips/dev: fb.c hb.c
src/sys/arch/newsmips/newsmips: bus.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/newsmips/apbus/apbus.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/newsmips/apbus/xafb.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/newsmips/dev/fb.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/newsmips/dev/hb.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/newsmips/newsmips/bus.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/newsmips/apbus/apbus.c
diff -u src/sys/arch/newsmips/apbus/apbus.c:1.26 src/sys/arch/newsmips/apbus/apbus.c:1.27
--- src/sys/arch/newsmips/apbus/apbus.c:1.26	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/newsmips/apbus/apbus.c	Sat Nov 21 17:54:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: apbus.c,v 1.26 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: apbus.c,v 1.27 2020/11/21 17:54:47 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -27,13 +27,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.26 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.27 2020/11/21 17:54:47 thorpej Exp $");
 
 #define __INTR_PRIVATE
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -230,7 +230,7 @@ apbus_intr_establish(int level, int mask
 
 	ip = _tab[level];
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_mask = mask;
 	ih->ih_priority = priority;
 	ih->ih_func = func;
@@ -501,7 +501,7 @@ apbus_dmatag_init(struct apbus_attach_ar
 {
 	struct newsmips_bus_dma_tag *dmat;
 
-	dmat = malloc(sizeof(*dmat), M_DEVBUF, M_WAITOK);
+	dmat = kmem_alloc(sizeof(*dmat), KM_SLEEP);
 	memcpy(dmat, _dma_tag, sizeof(*dmat));
 	dmat->_slotno = apa->apa_slotno;
 	dmat->_slotbaset = 0;

Index: src/sys/arch/newsmips/apbus/xafb.c
diff -u src/sys/arch/newsmips/apbus/xafb.c:1.18 src/sys/arch/newsmips/apbus/xafb.c:1.19
--- src/sys/arch/newsmips/apbus/xafb.c:1.18	Thu Jul 21 19:49:58 2016
+++ src/sys/arch/newsmips/apbus/xafb.c	Sat Nov 21 17:54:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xafb.c,v 1.18 2016/07/21 19:49:58 christos Exp $	*/
+/*	$NetBSD: xafb.c,v 1.19 2020/11/21 17:54:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -29,13 +29,13 @@
 /* "xa" frame buffer driver.  Currently supports 1280x1024x8 only. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.18 2016/07/21 19:49:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.19 2020/11/21 17:54:47 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -157,8 +157,7 @@ xafb_attach(device_t parent, device_t se
 		ri->ri_flg &= ~RI_NO_AUTO;
 		sc->sc_nscreens = 1;
 	} else {
-		dc = malloc(sizeof(struct xafb_devconfig), M_DEVBUF,
-		M_WAITOK|M_ZERO);
+		dc = kmem_zalloc(sizeof(struct xafb_devconfig), KM_SLEEP);
 		dc->dc_fbpaddr = (paddr_t)0x1000;
 		dc->dc_fbbase = (void *)MIPS_PHYS_TO_KSEG1(dc->dc_fbpaddr);
 		dc->dc_reg = (void *)(apa->apa_hwbase + 0x3000);

Index: src/sys/arch/newsmips/dev/fb.c
diff -u src/sys/arch/newsmips/dev/fb.c:1.26 src/sys/arch/newsmips/dev/fb.c:1.27
--- src/sys/arch/newsmips/dev/fb.c:1.26	Fri Jan 31 15:43:06 2014
+++ src/sys/arch/newsmips/dev/fb.c	Sat Nov 21 17:54:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb.c,v 1.26 2014/01/31 15:43:06 tsutsui Exp $	*/
+/*	$NetBSD: fb.c,v 1.27 2020/11/21 17:54:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,12 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.26 2014/01/31 15:43:06 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.27 2020/11/21 17:54:47 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -146,8 +146,7 @@ fb_attach(device_t parent, device_t self
 		ri->ri_flg &= ~RI_NO_AUTO;
 		sc->sc_nscreens = 1;
 	} else {
-		dc = malloc(sizeof(struct fb_devconfig), M_DEVBUF,
-		M_WAITOK|M_ZERO);
+		dc = kmem_zalloc(sizeof(struct fb_devconfig), KM_SLEEP);
 
 		dc->dc_fbbase = NWB253_VRAM;
 		fb_common_init(dc);

Index: src/sys/arch/newsmips/dev/hb.c
diff -u src/sys/arch/newsmips/dev/hb.c:1.20 src/sys/arch/newsmips/dev/hb.c:1.21
--- src/sys/arch/newsmips/dev/hb.c:1.20	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/newsmips/dev/hb.c	Sat Nov 21 17:54:47 2020
@@ -1,13 +1,13 @@
-/*	$NetBSD: hb.c,v 1.20 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: hb.c,v 1.21 2020/11/21 17:54:47 thorpej Exp $	*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.20 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.21 2020/11/21 17:54:47 thorpej Exp $");
 
 #define __INTR_PRIVATE
 #include 
 #include 
 #include 

CVS commit: src/sys/arch/next68k

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:49:20 UTC 2020

Modified Files:
src/sys/arch/next68k/dev: if_xe.c nextdisplay.c nextkbd.c
src/sys/arch/next68k/next68k: isr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/dev/if_xe.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/nextkbd.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/next68k/isr.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/next68k/dev/if_xe.c
diff -u src/sys/arch/next68k/dev/if_xe.c:1.26 src/sys/arch/next68k/dev/if_xe.c:1.27
--- src/sys/arch/next68k/dev/if_xe.c:1.26	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/next68k/dev/if_xe.c	Sat Nov 21 17:49:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_xe.c,v 1.26 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.26 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -205,7 +206,7 @@ findchannel_defer(device_t self)
 	 * the  2000 covers at least a 1500 mtu + headers
 	 * + DMA_BEGINALIGNMENT+ DMA_ENDALIGNMENT
 	 */
-	xsc->sc_txbuf = malloc(2000, M_DEVBUF, M_WAITOK);
+	xsc->sc_txbuf = kmem_alloc(2000, KM_SLEEP);
 	xsc->sc_tx_mb_head = NULL;
 	xsc->sc_tx_loaded = 0;
 	

Index: src/sys/arch/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.22 src/sys/arch/next68k/dev/nextdisplay.c:1.23
--- src/sys/arch/next68k/dev/nextdisplay.c:1.22	Tue Nov 12 13:17:44 2019
+++ src/sys/arch/next68k/dev/nextdisplay.c	Sat Nov 21 17:49:20 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.22 2019/11/12 13:17:44 msaitoh Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.23 2020/11/21 17:49:20 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.22 2019/11/12 13:17:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.23 2020/11/21 17:49:20 thorpej Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: nextdisplay.
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -251,8 +251,8 @@ nextdisplay_attach(device_t parent, devi
 		sc->sc_dc = _console_dc;
 		sc->nscreens = 1;
 	} else {
-		sc->sc_dc = (struct nextdisplay_config *)
-malloc(sizeof(struct nextdisplay_config), M_DEVBUF, M_WAITOK);
+		sc->sc_dc = kmem_alloc(sizeof(struct nextdisplay_config),
+		KM_SLEEP);
 		nextdisplay_init(sc->sc_dc, iscolor);
 	}
 

Index: src/sys/arch/next68k/dev/nextkbd.c
diff -u src/sys/arch/next68k/dev/nextkbd.c:1.15 src/sys/arch/next68k/dev/nextkbd.c:1.16
--- src/sys/arch/next68k/dev/nextkbd.c:1.15	Mon Mar 24 20:01:03 2014
+++ src/sys/arch/next68k/dev/nextkbd.c	Sat Nov 21 17:49:20 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: nextkbd.c,v 1.15 2014/03/24 20:01:03 christos Exp $ */
+/* $NetBSD: nextkbd.c,v 1.16 2020/11/21 17:49:20 thorpej Exp $ */
 /*
  * Copyright (c) 1998 Matt DeBergalis
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextkbd.c,v 1.15 2014/03/24 20:01:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextkbd.c,v 1.16 2020/11/21 17:49:20 thorpej Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: nextkbd.c,v 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -152,10 +152,9 @@ nextkbd_attach(device_t parent, device_t
 	if (isconsole) {
 		sc->id = _consdata;
 	} else {
-		sc->id = malloc(sizeof(struct nextkbd_internal), 
-M_DEVBUF, M_WAITOK);
+		sc->id = kmem_zalloc(sizeof(struct nextkbd_internal), 
+KM_SLEEP);
 
-		memset(sc->id, 0, sizeof(struct nextkbd_internal));
 		sc->id->iot = ia->ia_bst;
 		if (bus_space_map(sc->id->iot, NEXT_P_MON,
 sizeof(struct mon_regs),

Index: src/sys/arch/next68k/next68k/isr.c
diff -u src/sys/arch/next68k/next68k/isr.c:1.30 src/sys/arch/next68k/next68k/isr.c:1.31
--- src/sys/arch/next68k/next68k/isr.c:1.30	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/next68k/next68k/isr.c	Sat Nov 21 17:49:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.30 2019/11/10 21:16:31 chs Exp $ */
+/*	$NetBSD: isr.c,v 1.31 2020/11/21 17:49:20 thorpej Exp $ */
 
 /*
  * This file was taken from mvme68k/mvme68k/isr.c
@@ -41,11 +41,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.30 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.31 2020/11/21 17:49:20 thorpej 

CVS commit: src/sys/arch/ofppc/pci

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:48:26 UTC 2020

Modified Files:
src/sys/arch/ofppc/pci: gt_mainbus.c ofwpci.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ofppc/pci/gt_mainbus.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/ofppc/pci/ofwpci.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/ofppc/pci/gt_mainbus.c
diff -u src/sys/arch/ofppc/pci/gt_mainbus.c:1.5 src/sys/arch/ofppc/pci/gt_mainbus.c:1.6
--- src/sys/arch/ofppc/pci/gt_mainbus.c:1.5	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/ofppc/pci/gt_mainbus.c	Sat Nov 21 17:48:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gt_mainbus.c,v 1.5 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: gt_mainbus.c,v 1.6 2020/11/21 17:48:26 thorpej Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gt_mainbus.c,v 1.5 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gt_mainbus.c,v 1.6 2020/11/21 17:48:26 thorpej Exp $");
 
 #include "opt_pci.h"
 #include "opt_marvell.h"
@@ -40,7 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: gt_mainbus.c
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -275,8 +275,8 @@ gtpci_md_attach_hook(device_t parent, de
 		/* Setup interrupts for PCI bus */
 		struct genppc_pci_chipset_businfo *pbi;
 
-		pbi = malloc(sizeof(struct genppc_pci_chipset_businfo),
-		M_DEVBUF, M_WAITOK);
+		pbi = kmem_alloc(sizeof(struct genppc_pci_chipset_businfo),
+		KM_SLEEP);
 		pbi->pbi_properties = prop_dictionary_create();
 		KASSERT(pbi->pbi_properties != NULL);
 		SIMPLEQ_INIT(_gtpci1_chipset.pc_pbi);

Index: src/sys/arch/ofppc/pci/ofwpci.c
diff -u src/sys/arch/ofppc/pci/ofwpci.c:1.17 src/sys/arch/ofppc/pci/ofwpci.c:1.18
--- src/sys/arch/ofppc/pci/ofwpci.c:1.17	Tue Jul  7 03:38:47 2020
+++ src/sys/arch/ofppc/pci/ofwpci.c	Sat Nov 21 17:48:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwpci.c,v 1.17 2020/07/07 03:38:47 thorpej Exp $ */
+/* $NetBSD: ofwpci.c,v 1.18 2020/11/21 17:48:26 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,13 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwpci.c,v 1.17 2020/07/07 03:38:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwpci.c,v 1.18 2020/11/21 17:48:26 thorpej Exp $");
 
 #include "opt_pci.h"
 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -195,8 +195,7 @@ ofwpci_attach(device_t parent, device_t 
 	pc->pc_iot = >sc_iot;
 	pc->pc_memt = >sc_memt;
 
-	pbi = malloc(sizeof(struct genppc_pci_chipset_businfo),
-	M_DEVBUF, M_WAITOK);
+	pbi = kmem_alloc(sizeof(struct genppc_pci_chipset_businfo), KM_SLEEP);
 	pbi->pbi_properties = prop_dictionary_create();
 	KASSERT(pbi->pbi_properties != NULL);
 	SIMPLEQ_INIT(>pc_pbi);



CVS commit: src/sys/arch/playstation2

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:46:09 UTC 2020

Modified Files:
src/sys/arch/playstation2/dev: if_smap.c ohci_sbus.c
src/sys/arch/playstation2/playstation2: bus_dma.c bus_space.c

Log Message:
malloc(9) -> kmem(9)

XXX Audit use of KM_NOSLEEP here.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/playstation2/dev/if_smap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/playstation2/dev/ohci_sbus.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/playstation2/playstation2/bus_dma.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/playstation2/playstation2/bus_space.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/playstation2/dev/if_smap.c
diff -u src/sys/arch/playstation2/dev/if_smap.c:1.32 src/sys/arch/playstation2/dev/if_smap.c:1.33
--- src/sys/arch/playstation2/dev/if_smap.c:1.32	Wed Jan 29 05:32:04 2020
+++ src/sys/arch/playstation2/dev/if_smap.c	Sat Nov 21 17:46:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smap.c,v 1.32 2020/01/29 05:32:04 thorpej Exp $	*/
+/*	$NetBSD: if_smap.c,v 1.33 2020/11/21 17:46:08 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.32 2020/01/29 05:32:04 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.33 2020/11/21 17:46:08 thorpej Exp $");
 
 #include "debug_playstation2.h"
 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -192,10 +193,9 @@ smap_attach(struct device *parent, struc
 	smap_desc_init(sc);
 
 	/* allocate temporary buffer */
-	txbuf = malloc(ETHER_MAX_LEN - ETHER_CRC_LEN + SMAP_FIFO_ALIGN + 16,
-	M_DEVBUF, M_WAITOK);
-	rxbuf = malloc(ETHER_MAX_LEN + SMAP_FIFO_ALIGN + 16,
-	M_DEVBUF, M_WAITOK);
+	txbuf = kmem_alloc(ETHER_MAX_LEN - ETHER_CRC_LEN + SMAP_FIFO_ALIGN + 16,
+	KM_SLEEP);
+	rxbuf = kmem_alloc(ETHER_MAX_LEN + SMAP_FIFO_ALIGN + 16, KM_SLEEP);
 	sc->tx_buf = (u_int32_t *)ROUND16((vaddr_t)txbuf);
 	sc->rx_buf = (u_int32_t *)ROUND16((vaddr_t)rxbuf);
 

Index: src/sys/arch/playstation2/dev/ohci_sbus.c
diff -u src/sys/arch/playstation2/dev/ohci_sbus.c:1.13 src/sys/arch/playstation2/dev/ohci_sbus.c:1.14
--- src/sys/arch/playstation2/dev/ohci_sbus.c:1.13	Mon Jul 18 22:17:09 2016
+++ src/sys/arch/playstation2/dev/ohci_sbus.c	Sat Nov 21 17:46:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci_sbus.c,v 1.13 2016/07/18 22:17:09 maya Exp $	*/
+/*	$NetBSD: ohci_sbus.c,v 1.14 2020/11/21 17:46:08 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci_sbus.c,v 1.13 2016/07/18 22:17:09 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci_sbus.c,v 1.14 2020/11/21 17:46:08 thorpej Exp $");
 
 #include 
+#include 
 
 /* bus_dma */
 #include 
@@ -171,7 +172,7 @@ _ohci_sbus_mem_alloc(bus_dma_tag_t t, bu
 	int error;
 
 	KDASSERT(sc);
-	ds = malloc(sizeof(struct ohci_dma_segment), M_DEVBUF, M_NOWAIT);
+	ds = kmem_intr_alloc(sizeof(struct ohci_dma_segment), KM_NOSLEEP);
 	if (ds == NULL)
 		return 1;
 	/*
@@ -181,7 +182,7 @@ _ohci_sbus_mem_alloc(bus_dma_tag_t t, bu
 	error = iopdma_allocate_buffer(iopdma_seg, size);
 
 	if (error) {
-		free(ds, M_DEVBUF);
+		kmem_intr_free(ds, sizeof(*ds));
 		return 1;
 	}
 
@@ -209,7 +210,7 @@ _ohci_sbus_mem_free(bus_dma_tag_t t, bus
 			iopdma_free_buffer(>ds_iopdma_seg);
 
 			LIST_REMOVE(ds, ds_link);
-			free(ds, M_DEVBUF);
+			kmem_intr_free(ds, sizeof(*ds));
 			return;
 		}
 	}

Index: src/sys/arch/playstation2/playstation2/bus_dma.c
diff -u src/sys/arch/playstation2/playstation2/bus_dma.c:1.22 src/sys/arch/playstation2/playstation2/bus_dma.c:1.23
--- src/sys/arch/playstation2/playstation2/bus_dma.c:1.22	Mon Mar 31 11:42:17 2014
+++ src/sys/arch/playstation2/playstation2/bus_dma.c	Sat Nov 21 17:46:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.22 2014/03/31 11:42:17 martin Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.23 2020/11/21 17:46:09 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,10 +31,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.22 2014/03/31 11:42:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.23 2020/11/21 17:46:09 thorpej Exp $");
 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -69,6 +69,14 @@ struct playstation2_bus_dma_tag playstat
 	_bus_dmamem_mmap,
 };
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct playstation2_bus_dmamap) +
+	(sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -79,7 +87,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct playstation2_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and 

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

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 17:44:40 UTC 2020

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

Log Message:
make(1): limit memory usage in tests

There is a suspicious condition in SuffUpdateTarget code that looks wrong
on the first sight.  When removing it though, make allocates huge amounts
of memory.  To stop freezing the whole machine in this situation, limit
the total memory.

The limit of 20 has been determined experimentally on NetBSD 8.0
x86_64.  With a limit of 10, make wouldn't even start.  100 MB of
memory is really a lot for such a simple program that according to top(1)
only needs 8 MB.  But 200 MB is still better than 5 GB.

Since the Makefile is used on other platforms as well, via the bmake
distribution, and since every operating system has its own list of ulimit
options, make this configurable.


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 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.212 src/usr.bin/make/unit-tests/Makefile:1.213
--- src/usr.bin/make/unit-tests/Makefile:1.212	Sat Nov 21 10:32:42 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sat Nov 21 17:44:40 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.212 2020/11/21 10:32:42 rillig Exp $
+# $NetBSD: Makefile,v 1.213 2020/11/21 17:44:40 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -516,6 +516,11 @@ LANG=		C
 
 MAKE_TEST_ENV?=	MALLOC_OPTIONS="JA"	# for jemalloc
 
+.if ${:!uname -s!} == "NetBSD"
+LIMIT_RESOURCES?=	ulimit -v 20
+.endif
+LIMIT_RESOURCES?=	:
+
 # Each test is run in a sub-make, to keep the tests for interfering with
 # each other, and because they use different environment variables and
 # command line options.
@@ -523,6 +528,7 @@ MAKE_TEST_ENV?=	MALLOC_OPTIONS="JA"	# fo
 .mk.rawout:
 	@${_MKMSG_TEST:Uecho '#  test '} ${.PREFIX}
 	@set -eu; \
+	${LIMIT_RESOURCES}; \
 	cd ${.OBJDIR}; \
 	env -i PATH="$$PATH" ${MAKE_TEST_ENV} ${ENV.${.PREFIX:T}} \
 	  ${TEST_MAKE} \



CVS commit: src/sys/arch/sh3/dev

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:25:52 UTC 2020

Modified Files:
src/sys/arch/sh3/dev: sci.c scif.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/sh3/dev/sci.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/sh3/dev/scif.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/sh3/dev/sci.c
diff -u src/sys/arch/sh3/dev/sci.c:1.62 src/sys/arch/sh3/dev/sci.c:1.63
--- src/sys/arch/sh3/dev/sci.c:1.62	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/sh3/dev/sci.c	Sat Nov 21 17:25:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sci.c,v 1.62 2019/11/10 21:16:32 chs Exp $ */
+/* $NetBSD: sci.c,v 1.63 2020/11/21 17:25:52 thorpej Exp $ */
 
 /*-
  * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu.  All rights reserved.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.62 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.63 2020/11/21 17:25:52 thorpej Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_sci.h"
@@ -107,7 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.62
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -416,7 +416,7 @@ sci_attach(device_t parent, device_t sel
 	tp->t_hwiflow = NULL;
 
 	sc->sc_tty = tp;
-	sc->sc_rbuf = malloc(sci_rbuf_size << 1, M_DEVBUF, M_WAITOK);
+	sc->sc_rbuf = kmem_alloc(sci_rbuf_size << 1, KM_SLEEP);
 	sc->sc_ebuf = sc->sc_rbuf + (sci_rbuf_size << 1);
 
 	tty_attach(tp);

Index: src/sys/arch/sh3/dev/scif.c
diff -u src/sys/arch/sh3/dev/scif.c:1.67 src/sys/arch/sh3/dev/scif.c:1.68
--- src/sys/arch/sh3/dev/scif.c:1.67	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/sh3/dev/scif.c	Sat Nov 21 17:25:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: scif.c,v 1.67 2019/11/10 21:16:32 chs Exp $ */
+/*	$NetBSD: scif.c,v 1.68 2020/11/21 17:25:52 thorpej Exp $ */
 
 /*-
  * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu.  All rights reserved.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.67 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.68 2020/11/21 17:25:52 thorpej Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_scif.h"
@@ -107,7 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.6
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -497,7 +497,7 @@ scif_attach(device_t parent, device_t se
 	tp->t_hwiflow = NULL;
 
 	sc->sc_tty = tp;
-	sc->sc_rbuf = malloc(scif_rbuf_size << 1, M_DEVBUF, M_WAITOK);
+	sc->sc_rbuf = kmem_alloc(scif_rbuf_size << 1, KM_SLEEP);
 	sc->sc_ebuf = sc->sc_rbuf + (scif_rbuf_size << 1);
 
 	tty_attach(tp);



CVS commit: src/sys/arch/zaurus/dev

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:22:03 UTC 2020

Modified Files:
src/sys/arch/zaurus/dev: w100.c zkbd.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/zaurus/dev/w100.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/zaurus/dev/zkbd.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/zaurus/dev/w100.c
diff -u src/sys/arch/zaurus/dev/w100.c:1.2 src/sys/arch/zaurus/dev/w100.c:1.3
--- src/sys/arch/zaurus/dev/w100.c:1.2	Sun Nov 10 21:16:34 2019
+++ src/sys/arch/zaurus/dev/w100.c	Sat Nov 21 17:22:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: w100.c,v 1.2 2019/11/10 21:16:34 chs Exp $ */
+/* $NetBSD: w100.c,v 1.3 2020/11/21 17:22:03 thorpej Exp $ */
 /*
  * Copyright (c) 2002, 2003  Genetec Corporation.  All rights reserved.
  * Written by Hiroyuki Bessho for Genetec Corporation.
@@ -28,13 +28,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: w100.c,v 1.2 2019/11/10 21:16:34 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: w100.c,v 1.3 2020/11/21 17:22:03 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 			/* for cold */
 
 #include 
@@ -235,7 +235,7 @@ w100_new_screen(struct w100_softc *sc, i
 	struct w100_screen *scr = NULL;
 	int error = 0;
 
-	scr = malloc(sizeof(*scr), M_DEVBUF, M_WAITOK | M_ZERO);
+	scr = kmem_zalloc(sizeof(*scr), KM_SLEEP);
 	scr->buf_va = (u_char *)bus_space_vaddr(sc->iot, sc->ioh_vram);
 	scr->depth = depth;
 

Index: src/sys/arch/zaurus/dev/zkbd.c
diff -u src/sys/arch/zaurus/dev/zkbd.c:1.19 src/sys/arch/zaurus/dev/zkbd.c:1.20
--- src/sys/arch/zaurus/dev/zkbd.c:1.19	Sun Nov 10 21:16:34 2019
+++ src/sys/arch/zaurus/dev/zkbd.c	Sat Nov 21 17:22:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: zkbd.c,v 1.19 2019/11/10 21:16:34 chs Exp $	*/
+/*	$NetBSD: zkbd.c,v 1.20 2020/11/21 17:22:03 thorpej Exp $	*/
 /* $OpenBSD: zaurus_kbd.c,v 1.28 2005/12/21 20:36:03 deraadt Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zkbd.c,v 1.19 2019/11/10 21:16:34 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zkbd.c,v 1.20 2020/11/21 17:22:03 thorpej Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #if 0	/* XXX */
@@ -29,7 +29,7 @@ __KERNEL_RCSID(0, "$NetBSD: zkbd.c,v 1.1
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -283,10 +283,10 @@ zkbd_attach(device_t parent, device_t se
 		aprint_error_dev(sc->sc_dev,
 		"couldn't establish power handler\n");
 
-	sc->sc_okeystate = malloc(sc->sc_nsense * sc->sc_nstrobe,
-	M_DEVBUF, M_WAITOK | M_ZERO);
-	sc->sc_keystate = malloc(sc->sc_nsense * sc->sc_nstrobe,
-	M_DEVBUF, M_WAITOK | M_ZERO);
+	sc->sc_okeystate = kmem_zalloc(sc->sc_nsense * sc->sc_nstrobe,
+	KM_SLEEP);
+	sc->sc_keystate = kmem_zalloc(sc->sc_nsense * sc->sc_nstrobe,
+	KM_SLEEP);
 
 	/* set all the strobe bits */
 	for (i = 0; i < sc->sc_nstrobe; i++) {



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 17:18:36 UTC 2020

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

Log Message:
make(1): in SuffExpandChildren, only expand ${VAr} if needed


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.261 src/usr.bin/make/suff.c:1.262
--- src/usr.bin/make/suff.c:1.261	Sat Nov 21 13:20:12 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 17:18:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.261 2020/11/21 13:20:12 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.262 2020/11/21 17:18:36 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.261 2020/11/21 13:20:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.262 2020/11/21 17:18:36 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1178,18 +1178,12 @@ SuffExpandChildren(GNodeListNode *cln, G
 		pp_skip_hspace();
 		start = cp;		/* Continue at the next non-space. */
 		} else if (*cp == '$') {
-		/*
-		 * Start of a variable spec -- contact variable module
-		 * to find the end so we can skip over it.
-		 */
+		/* Skip over the variable expression. */
 		const char *nested_p = cp;
 		const char	*junk;
 		void	*freeIt;
 
-		/* XXX: Why VARE_WANTRES when the result is not used? */
-		(void)Var_Parse(_p, pgn,
-VARE_WANTRES | VARE_UNDEFERR,
-, );
+		(void)Var_Parse(_p, pgn, VARE_NONE, , );
 		/* TODO: handle errors */
 		if (junk == var_Error) {
 			Parse_Error(PARSE_FATAL,



CVS commit: src/sys/arch/sgimips

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:18:31 UTC 2020

Modified Files:
src/sys/arch/sgimips/dev: int.c zs_kbd.c
src/sys/arch/sgimips/gio: grtwo.c light.c newport.c
src/sys/arch/sgimips/hpc: pckbc_hpc.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sgimips/dev/int.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sgimips/dev/zs_kbd.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sgimips/gio/grtwo.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/gio/light.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sgimips/gio/newport.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sgimips/hpc/pckbc_hpc.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/sgimips/dev/int.c
diff -u src/sys/arch/sgimips/dev/int.c:1.31 src/sys/arch/sgimips/dev/int.c:1.32
--- src/sys/arch/sgimips/dev/int.c:1.31	Fri May 29 12:30:40 2020
+++ src/sys/arch/sgimips/dev/int.c	Sat Nov 21 17:18:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: int.c,v 1.31 2020/05/29 12:30:40 rin Exp $	*/
+/*	$NetBSD: int.c,v 1.32 2020/11/21 17:18:31 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2009 Stephen M. Rumble 
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: int.c,v 1.31 2020/05/29 12:30:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: int.c,v 1.32 2020/11/21 17:18:31 thorpej Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: int.c,v 1.31
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -368,7 +368,7 @@ int1_intr_establish(int level, int ipl, 
 	} else {
 		struct sgimips_intrhand *n, *ih;
 
-		ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);
+		ih = kmem_alloc(sizeof *ih, KM_SLEEP);
 		ih->ih_fun = handler;
 		ih->ih_arg = arg;
 		ih->ih_next = NULL;
@@ -407,7 +407,7 @@ int2_intr_establish(int level, int ipl, 
 	} else {
 		struct sgimips_intrhand *n, *ih;
 
-		ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);
+		ih = kmem_alloc(sizeof *ih, KM_SLEEP);
 		ih->ih_fun = handler;
 		ih->ih_arg = arg;
 		ih->ih_next = NULL;

Index: src/sys/arch/sgimips/dev/zs_kbd.c
diff -u src/sys/arch/sgimips/dev/zs_kbd.c:1.10 src/sys/arch/sgimips/dev/zs_kbd.c:1.11
--- src/sys/arch/sgimips/dev/zs_kbd.c:1.10	Mon Oct 29 12:51:38 2012
+++ src/sys/arch/sgimips/dev/zs_kbd.c	Sat Nov 21 17:18:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs_kbd.c,v 1.10 2012/10/29 12:51:38 chs Exp $	*/
+/*	$NetBSD: zs_kbd.c,v 1.11 2020/11/21 17:18:31 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2004 Steve Rumble
@@ -33,10 +33,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs_kbd.c,v 1.10 2012/10/29 12:51:38 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs_kbd.c,v 1.11 2020/11/21 17:18:31 thorpej Exp $");
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -213,10 +213,8 @@ zskbd_attach(device_t parent, device_t s
 	} else {
 		wskaa.console = 0;
 
-		sc->sc_dc = malloc(sizeof(struct zskbd_devconfig), M_DEVBUF,
-		M_WAITOK);
-		if (sc->sc_dc == NULL)
-			panic("zskbd out of memory");
+		sc->sc_dc = kmem_alloc(sizeof(struct zskbd_devconfig),
+		KM_SLEEP);
 
 		sc->sc_dc->enabled = 0;
 	}

Index: src/sys/arch/sgimips/gio/grtwo.c
diff -u src/sys/arch/sgimips/gio/grtwo.c:1.15 src/sys/arch/sgimips/gio/grtwo.c:1.16
--- src/sys/arch/sgimips/gio/grtwo.c:1.15	Mon Sep  3 16:29:27 2018
+++ src/sys/arch/sgimips/gio/grtwo.c	Sat Nov 21 17:18:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: grtwo.c,v 1.15 2018/09/03 16:29:27 riastradh Exp $	 */
+/* $NetBSD: grtwo.c,v 1.16 2020/11/21 17:18:31 thorpej Exp $	 */
 
 /*
  * Copyright (c) 2004 Christopher SEKIYA
@@ -35,12 +35,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: grtwo.c,v 1.15 2018/09/03 16:29:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grtwo.c,v 1.16 2020/11/21 17:18:31 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -507,10 +507,8 @@ grtwo_attach(device_t parent, device_t s
 		sc->sc_dc = _console_dc;
 	} else {
 		wa.console = 0;
-		sc->sc_dc = malloc(sizeof(struct grtwo_devconfig),
-   M_DEVBUF, M_WAITOK | M_ZERO);
-		if (sc->sc_dc == NULL)
-			panic("grtwo_attach: out of memory");
+		sc->sc_dc = kmem_zalloc(sizeof(struct grtwo_devconfig),
+   KM_SLEEP);
 
 		grtwo_attach_common(sc->sc_dc, ga);
 	}

Index: src/sys/arch/sgimips/gio/light.c
diff -u src/sys/arch/sgimips/gio/light.c:1.7 src/sys/arch/sgimips/gio/light.c:1.8
--- src/sys/arch/sgimips/gio/light.c:1.7	Sat Oct 27 17:18:09 2012
+++ src/sys/arch/sgimips/gio/light.c	Sat Nov 21 17:18:31 2020
@@ -1,4 +1,4 @@
-/*	$Id: light.c,v 1.7 2012/10/27 17:18:09 chs Exp $	*/
+/*	$Id: light.c,v 1.8 2020/11/21 17:18:31 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2006 Stephen M. Rumble
@@ -43,12 +43,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: light.c,v 1.7 2012/10/27 17:18:09 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: light.c,v 1.8 2020/11/21 17:18:31 thorpej Exp $");
 
 #include 
 

CVS commit: src/sys/arch/ews4800mips

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:09:34 UTC 2020

Modified Files:
src/sys/arch/ews4800mips/dev: ewskbd.c
src/sys/arch/ews4800mips/ews4800mips: bus_dma.c
src/sys/arch/ews4800mips/sbd: fb_sbdio.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ews4800mips/dev/ewskbd.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/ews4800mips/ews4800mips/bus_dma.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/ews4800mips/sbd/fb_sbdio.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/ews4800mips/dev/ewskbd.c
diff -u src/sys/arch/ews4800mips/dev/ewskbd.c:1.10 src/sys/arch/ews4800mips/dev/ewskbd.c:1.11
--- src/sys/arch/ews4800mips/dev/ewskbd.c:1.10	Sat Oct 13 06:08:30 2012
+++ src/sys/arch/ews4800mips/dev/ewskbd.c	Sat Nov 21 17:09:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ewskbd.c,v 1.10 2012/10/13 06:08:30 tsutsui Exp $	*/
+/*	$NetBSD: ewskbd.c,v 1.11 2020/11/21 17:09:34 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2005 Izumi Tsutsui.  All rights reserved.
@@ -59,10 +59,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ewskbd.c,v 1.10 2012/10/13 06:08:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ewskbd.c,v 1.11 2020/11/21 17:09:34 thorpej Exp $");
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -220,8 +220,8 @@ ewskbd_zsc_attach(device_t parent, devic
 	} else {
 		wskaa.console = 0;
 
-		sc->sc_dc = malloc(sizeof(struct ewskbd_devconfig), M_DEVBUF,
-		M_WAITOK | M_ZERO);
+		sc->sc_dc = kmem_zalloc(sizeof(struct ewskbd_devconfig),
+		KM_SLEEP);
 		if (sc->sc_dc == NULL) {
 			printf(": can't allocate memory\n");
 			return;

Index: src/sys/arch/ews4800mips/ews4800mips/bus_dma.c
diff -u src/sys/arch/ews4800mips/ews4800mips/bus_dma.c:1.15 src/sys/arch/ews4800mips/ews4800mips/bus_dma.c:1.16
--- src/sys/arch/ews4800mips/ews4800mips/bus_dma.c:1.15	Tue Jun 23 21:00:23 2015
+++ src/sys/arch/ews4800mips/ews4800mips/bus_dma.c	Sat Nov 21 17:09:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.15 2015/06/23 21:00:23 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.16 2020/11/21 17:09:34 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,13 +31,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.15 2015/06/23 21:00:23 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.16 2020/11/21 17:09:34 thorpej Exp $");
 
 #define	_EWS4800MIPS_BUS_DMA_PRIVATE
 /* #define	BUS_DMA_DEBUG */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -71,6 +71,14 @@ struct ews4800mips_bus_dma_tag ews4800mi
 	_bus_dmamem_mmap,
 };
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct ews4800mips_bus_dmamap) +
+	(sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -81,7 +89,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct ews4800mips_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allcoate and initialize the DMA map.  The end of the map
@@ -95,13 +102,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct ews4800mips_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	if ((mapstore = malloc(mapsize, M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return ENOMEM;
 
-	memset(mapstore, 0, mapsize);
 	map = (struct ews4800mips_bus_dmamap *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -125,7 +129,7 @@ void
 _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
 {
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 

Index: src/sys/arch/ews4800mips/sbd/fb_sbdio.c
diff -u src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.17 src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.18
--- src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.17	Sun Nov 10 21:16:27 2019
+++ src/sys/arch/ews4800mips/sbd/fb_sbdio.c	Sat Nov 21 17:09:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb_sbdio.c,v 1.17 2019/11/10 21:16:27 chs Exp $	*/
+/*	$NetBSD: fb_sbdio.c,v 1.18 2020/11/21 17:09:34 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@@ -32,11 +32,11 @@
 #define WIRED_FB_TLB
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.17 2019/11/10 21:16:27 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.18 2020/11/21 17:09:34 thorpej Exp $");
 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include  /* pmap function to remap FB */
@@ -145,9 +145,8 @@ fb_sbdio_attach(device_t parent, device_
 		sc->sc_ga = _console_ga;
 		sc->sc_nscreens = 1;

CVS commit: src/sys/arch/evbsh3

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 16:21:24 UTC 2020

Modified Files:
src/sys/arch/evbsh3/ap_ms104_sh4: ap_ms104_sh4_intr.c shpcmcia.c
src/sys/arch/evbsh3/evbsh3: bus_dma.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbsh3/evbsh3/bus_dma.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/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c
diff -u src/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c:1.3 src/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c:1.4
--- src/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c:1.3	Sun Nov 10 21:16:27 2019
+++ src/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c	Sat Nov 21 16:21:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ap_ms104_sh4_intr.c,v 1.3 2019/11/10 21:16:27 chs Exp $	*/
+/*	$NetBSD: ap_ms104_sh4_intr.c,v 1.4 2020/11/21 16:21:24 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 2009 NONAKA Kimihiro 
@@ -26,12 +26,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ap_ms104_sh4_intr.c,v 1.3 2019/11/10 21:16:27 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ap_ms104_sh4_intr.c,v 1.4 2020/11/21 16:21:24 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -102,7 +102,7 @@ extintr_establish(int irq, int trigger, 
 
 	KDASSERT(irq >= 1 && irq <= 14);
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 
 	s = _cpu_intr_suspend();
 
@@ -223,7 +223,7 @@ extintr_disestablish(void *cookie)
 
 	evcnt_detach(>ih_evcnt);
 
-	free((void *)ih, M_DEVBUF);
+	kmem_free((void *)ih, sizeof(*ih));
 
 	if (--eih->eih_nih == 0) {
 		uint8_t reg;

Index: src/sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c
diff -u src/sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c:1.4 src/sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c:1.5
--- src/sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c:1.4	Sat Oct 27 17:17:51 2012
+++ src/sys/arch/evbsh3/ap_ms104_sh4/shpcmcia.c	Sat Nov 21 16:21:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: shpcmcia.c,v 1.4 2012/10/27 17:17:51 chs Exp $	*/
+/*	$NetBSD: shpcmcia.c,v 1.5 2020/11/21 16:21:24 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 2009 NONAKA Kimihiro 
@@ -26,13 +26,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: shpcmcia.c,v 1.4 2012/10/27 17:17:51 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shpcmcia.c,v 1.5 2020/11/21 16:21:24 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -400,9 +400,9 @@ shpcmcia_event_thread(void *arg)
 	break;
 if (pe2->pe_type == SHPCMCIA_EVENT_INSERT) {
 	SIMPLEQ_REMOVE_HEAD(>events, pe_q);
-	free(pe1, M_TEMP);
+	kmem_free(pe1, sizeof(*pe1));
 	SIMPLEQ_REMOVE_HEAD(>events, pe_q);
-	free(pe2, M_TEMP);
+	kmem_free(pe2, sizeof(*pe2));
 }
 			}
 			splx(s);
@@ -425,9 +425,9 @@ shpcmcia_event_thread(void *arg)
 	break;
 if (pe2->pe_type == SHPCMCIA_EVENT_REMOVE) {
 	SIMPLEQ_REMOVE_HEAD(>events, pe_q);
-	free(pe1, M_TEMP);
+	kmem_free(pe1, sizeof(*pe1));
 	SIMPLEQ_REMOVE_HEAD(>events, pe_q);
-	free(pe2, M_TEMP);
+	kmem_free(pe2, sizeof(*pe2));
 }
 			}
 			splx(s);
@@ -441,7 +441,7 @@ shpcmcia_event_thread(void *arg)
 			panic("shpcmcia_event_thread: unknown event %d",
 			pe->pe_type);
 		}
-		free(pe, M_TEMP);
+		kmem_free(pe, sizeof(*pe));
 	}
 
 	h->event_thread = NULL;
@@ -458,7 +458,7 @@ shpcmcia_queue_event(struct shpcmcia_han
 	struct shpcmcia_event *pe;
 	int s;
 
-	pe = malloc(sizeof(*pe), M_TEMP, M_NOWAIT);
+	pe = kmem_intr_alloc(sizeof(*pe), KM_NOSLEEP);
 	if (pe == NULL)
 		panic("shpcmcia_queue_event: can't allocate event");
 

Index: src/sys/arch/evbsh3/evbsh3/bus_dma.c
diff -u src/sys/arch/evbsh3/evbsh3/bus_dma.c:1.4 src/sys/arch/evbsh3/evbsh3/bus_dma.c:1.5
--- src/sys/arch/evbsh3/evbsh3/bus_dma.c:1.4	Thu Jan 22 03:43:24 2015
+++ src/sys/arch/evbsh3/evbsh3/bus_dma.c	Sat Nov 21 16:21:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.4 2015/01/22 03:43:24 nonaka Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.5 2020/11/21 16:21:24 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2005 NONAKA Kimihiro 
@@ -26,13 +26,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.4 2015/01/22 03:43:24 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.5 2020/11/21 16:21:24 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #define	_EVBSH3_BUS_DMA_PRIVATE
 #include 
@@ -69,6 +69,14 @@ struct _bus_dma_tag evbsh3_bus_dma = {
 	._dmamem_mmap = _bus_dmamem_mmap,
 };
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct _bus_dmamap)
+		+ (sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Create a DMA map.
  

CVS commit: src/sys/arch/pmax

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 16:07:18 UTC 2020

Modified Files:
src/sys/arch/pmax/pmax: bus_dma.c
src/sys/arch/pmax/tc: dt.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/pmax/pmax/bus_dma.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/pmax/tc/dt.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/pmax/pmax/bus_dma.c
diff -u src/sys/arch/pmax/pmax/bus_dma.c:1.59 src/sys/arch/pmax/pmax/bus_dma.c:1.60
--- src/sys/arch/pmax/pmax/bus_dma.c:1.59	Thu May 18 16:34:56 2017
+++ src/sys/arch/pmax/pmax/bus_dma.c	Sat Nov 21 16:07:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.59 2017/05/18 16:34:56 christos Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.60 2020/11/21 16:07:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.59 2017/05/18 16:34:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.60 2020/11/21 16:07:18 thorpej Exp $");
 
 #include "opt_cputype.h"
 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -87,6 +88,14 @@ pmax_bus_dma_init(void)
 #endif
 }
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct pmax_bus_dmamap) +
+	(sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -97,7 +106,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct pmax_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map
@@ -111,13 +119,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct pmax_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	if ((mapstore = malloc(mapsize, M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return (ENOMEM);
 
-	memset(mapstore, 0, mapsize);
 	map = (struct pmax_bus_dmamap *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -141,7 +146,7 @@ void
 _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
 {
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*

Index: src/sys/arch/pmax/tc/dt.c
diff -u src/sys/arch/pmax/tc/dt.c:1.13 src/sys/arch/pmax/tc/dt.c:1.14
--- src/sys/arch/pmax/tc/dt.c:1.13	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/pmax/tc/dt.c	Sat Nov 21 16:07:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dt.c,v 1.13 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: dt.c,v 1.14 2020/11/21 16:07:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@ SOFTWARE.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dt.c,v 1.13 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dt.c,v 1.14 2020/11/21 16:07:18 thorpej Exp $");
 
 #include 
 #include 
@@ -143,7 +143,7 @@ __KERNEL_RCSID(0, "$NetBSD: dt.c,v 1.13 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -215,11 +215,11 @@ dt_attach(device_t parent, device_t self
 
 	dt_cninit();
 
-	msg = malloc(sizeof(*msg) * DT_BUF_CNT, M_DEVBUF, M_WAITOK);
+	msg = kmem_alloc(sizeof(*msg) * DT_BUF_CNT, KM_SLEEP);
 	sc->sc_sih = softint_establish(SOFTINT_SERIAL, dt_dispatch, sc);
 	if (sc->sc_sih == NULL) {
 		printf("%s: memory exhausted\n", device_xname(self));
-		free(msg, M_DEVBUF);
+		kmem_free(msg, sizeof(*msg) * DT_BUF_CNT);
 		return;
 	}
 



CVS commit: src/sys/arch/prep

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 15:59:53 UTC 2020

Modified Files:
src/sys/arch/prep/pci: gten.c pci_machdep.c
src/sys/arch/prep/pnpbus: pnpbus.c
src/sys/arch/prep/prep: mainbus.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/prep/pci/gten.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/prep/pci/pci_machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/prep/pnpbus/pnpbus.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/prep/prep/mainbus.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/prep/pci/gten.c
diff -u src/sys/arch/prep/pci/gten.c:1.21 src/sys/arch/prep/pci/gten.c:1.22
--- src/sys/arch/prep/pci/gten.c:1.21	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/prep/pci/gten.c	Sat Nov 21 15:59:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gten.c,v 1.21 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: gten.c,v 1.22 2020/11/21 15:59:53 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gten.c,v 1.21 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gten.c,v 1.22 2020/11/21 15:59:53 thorpej Exp $");
 
 #include 
 #include 
@@ -38,7 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: gten.c,v 1.2
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -139,8 +139,8 @@ gten_attach(device_t parent, device_t se
 		gt->gt_ri = _console_ri;
 		gt->gt_nscreens = 1;
 	} else {
-		gt->gt_ri = malloc(sizeof(*gt->gt_ri),
-			M_DEVBUF, M_WAITOK|M_ZERO);
+		gt->gt_ri = kmem_zalloc(sizeof(*gt->gt_ri),
+			KM_SLEEP);
 #if 0
 		error = pci_mapreg_map(pa, 0x14, 
 			PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT,

Index: src/sys/arch/prep/pci/pci_machdep.c
diff -u src/sys/arch/prep/pci/pci_machdep.c:1.43 src/sys/arch/prep/pci/pci_machdep.c:1.44
--- src/sys/arch/prep/pci/pci_machdep.c:1.43	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/prep/pci/pci_machdep.c	Sat Nov 21 15:59:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.43 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.44 2020/11/21 15:59:53 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.43 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.44 2020/11/21 15:59:53 thorpej Exp $");
 
 #include 
 #include 
@@ -48,7 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -323,8 +323,8 @@ prep_pci_conf_hook(void *v, int bus, int
 	 */
 	if (PCI_CLASS(class) == PCI_CLASS_BRIDGE &&
 	PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_PCI) {
-		pbi = malloc(sizeof(struct genppc_pci_chipset_businfo),
-		M_DEVBUF, M_WAITOK);
+		pbi = kmem_alloc(sizeof(struct genppc_pci_chipset_businfo),
+		KM_SLEEP);
 		pbi->pbi_properties = prop_dictionary_create();
 		KASSERT(pbi->pbi_properties != NULL);
 		setup_pciintr_map(pbi, bus, dev, func);

Index: src/sys/arch/prep/pnpbus/pnpbus.c
diff -u src/sys/arch/prep/pnpbus/pnpbus.c:1.12 src/sys/arch/prep/pnpbus/pnpbus.c:1.13
--- src/sys/arch/prep/pnpbus/pnpbus.c:1.12	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/prep/pnpbus/pnpbus.c	Sat Nov 21 15:59:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pnpbus.c,v 1.12 2019/11/10 21:16:32 chs Exp $	*/
+/*	$NetBSD: pnpbus.c,v 1.13 2020/11/21 15:59:53 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,13 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pnpbus.c,v 1.12 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pnpbus.c,v 1.13 2020/11/21 15:59:53 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -102,7 +102,7 @@ pnp_newirq(void *v, struct pnpresources 
 	struct _S4_Pack *p = v;
 	struct pnpbus_irq *irq;
 
-	irq = malloc(sizeof(struct pnpbus_irq), M_DEVBUF, M_WAITOK);
+	irq = kmem_alloc(sizeof(struct pnpbus_irq), KM_SLEEP);
 
 	irq->mask = le16dec(>IRQMask[0]);
 
@@ -123,7 +123,7 @@ pnp_newdma(void *v, struct pnpresources 
 	struct _S5_Pack *p = v;
 	struct pnpbus_dma *dma;
 
-	dma = malloc(sizeof(struct pnpbus_dma), M_DEVBUF, M_WAITOK);
+	dma = kmem_alloc(sizeof(struct pnpbus_dma), KM_SLEEP);
 
 	dma->mask = le16dec(>DMAMask);
 	if (size > 2)
@@ -144,7 +144,7 @@ pnp_newioport(void *v, struct pnpresourc
 	struct pnpbus_io *io;
 	uint16_t mask;
 
-	io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_WAITOK);
+	io = kmem_alloc(sizeof(struct pnpbus_io), KM_SLEEP);
 	mask = p->IOInfo & ISAAddr16bit ? 0x : 0x03ff;
 	io->minbase = (p->RangeMin[0] | (p->RangeMin[1] << 8)) & mask;
 	io->maxbase = (p->RangeMax[0] | (p->RangeMax[1] << 8)) & mask;
@@ -164,7 +164,7 @@ pnp_newfixedioport(void *v, struct pnpre
 	struct _S9_Pack *p = v;
 	struct pnpbus_io *io;
 
-	io = 

CVS commit: src/sys/arch/rs6000

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 15:52:32 UTC 2020

Modified Files:
src/sys/arch/rs6000/mca: mca_machdep.c mcadma_machdep.c
src/sys/arch/rs6000/rs6000: pic_iocc.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/rs6000/mca/mca_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/rs6000/mca/mcadma_machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/rs6000/rs6000/pic_iocc.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/rs6000/mca/mca_machdep.c
diff -u src/sys/arch/rs6000/mca/mca_machdep.c:1.4 src/sys/arch/rs6000/mca/mca_machdep.c:1.5
--- src/sys/arch/rs6000/mca/mca_machdep.c:1.4	Mon Jul 18 17:26:56 2011
+++ src/sys/arch/rs6000/mca/mca_machdep.c	Sat Nov 21 15:52:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mca_machdep.c,v 1.4 2011/07/18 17:26:56 dyoung Exp $	*/
+/*	$NetBSD: mca_machdep.c,v 1.5 2020/11/21 15:52:32 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -36,12 +36,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mca_machdep.c,v 1.4 2011/07/18 17:26:56 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mca_machdep.c,v 1.5 2020/11/21 15:52:32 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -381,8 +381,8 @@ mca_dmamap_create(bus_dma_tag_t t, bus_s
 		/*
 		 * Allocate our cookie if not yet done.
 		 */
-		cookie = malloc(sizeof(struct rs6000_dma_cookie), M_DMAMAP,
-		((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK) | M_ZERO);
+		cookie = kmem_zalloc(sizeof(struct rs6000_dma_cookie),
+		((flags & BUS_DMA_NOWAIT) ? KM_SLEEP : KM_NOSLEEP));
 		if (cookie == NULL) {
 			
 			return ENOMEM;

Index: src/sys/arch/rs6000/mca/mcadma_machdep.c
diff -u src/sys/arch/rs6000/mca/mcadma_machdep.c:1.3 src/sys/arch/rs6000/mca/mcadma_machdep.c:1.4
--- src/sys/arch/rs6000/mca/mcadma_machdep.c:1.3	Mon Jul 18 17:26:56 2011
+++ src/sys/arch/rs6000/mca/mcadma_machdep.c	Sat Nov 21 15:52:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: mcadma_machdep.c,v 1.3 2011/07/18 17:26:56 dyoung Exp $ */
+/* $NetBSD: mcadma_machdep.c,v 1.4 2020/11/21 15:52:32 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,13 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mcadma_machdep.c,v 1.3 2011/07/18 17:26:56 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcadma_machdep.c,v 1.4 2020/11/21 15:52:32 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -116,8 +116,8 @@ _mca_bus_dmamap_create(bus_dma_tag_t t, 
 		/*
  		 * Allocate our cookie if not yet done.
 		 */
-		cookie = malloc(sizeof(struct rs6000_dma_cookie), M_DMAMAP,
-		((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK) | M_ZERO);
+		cookie = kmem_zalloc(sizeof(struct rs6000_dma_cookie),
+		((flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP));
 		if (cookie == NULL) {
 
 			return ENOMEM;
@@ -143,7 +143,7 @@ _mca_bus_dmamap_destroy(bus_dma_tag_t t,
 {
 	struct rs6000_dma_cookie *cookie = map->_dm_cookie;
 
-	free(cookie, M_DMAMAP);
+	kmem_free(cookie, sizeof(struct rs6000_dma_cookie));
 	_bus_dmamap_destroy(t, map);
 }
 

Index: src/sys/arch/rs6000/rs6000/pic_iocc.c
diff -u src/sys/arch/rs6000/rs6000/pic_iocc.c:1.5 src/sys/arch/rs6000/rs6000/pic_iocc.c:1.6
--- src/sys/arch/rs6000/rs6000/pic_iocc.c:1.5	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/rs6000/rs6000/pic_iocc.c	Sat Nov 21 15:52:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic_iocc.c,v 1.5 2019/11/10 21:16:32 chs Exp $	*/
+/*	$NetBSD: pic_iocc.c,v 1.6 2020/11/21 15:52:32 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,10 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic_iocc.c,v 1.5 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_iocc.c,v 1.6 2020/11/21 15:52:32 thorpej Exp $");
 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -59,7 +59,7 @@ setup_iocc(void)
 	struct pic_ops *pic;
 	int i;
 
-	pic = malloc(sizeof(struct pic_ops), M_DEVBUF, M_WAITOK);
+	pic = kmem_alloc(sizeof(struct pic_ops), KM_SLEEP);
 	pic->pic_numintrs = 16;
 	pic->pic_cookie = (void *)NULL;
 	pic->pic_enable_irq = iocc_enable_irq;



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

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 15:48:05 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varparse-dynamic.mk

Log Message:
make(1): add test for dynamic variable with modifiers in global context


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varparse-dynamic.mk

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/varparse-dynamic.mk
diff -u src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.2 src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.3
--- src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.2	Sun Sep 13 21:00:34 2020
+++ src/usr.bin/make/unit-tests/varparse-dynamic.mk	Sat Nov 21 15:48:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varparse-dynamic.mk,v 1.2 2020/09/13 21:00:34 rillig Exp $
+# $NetBSD: varparse-dynamic.mk,v 1.3 2020/11/21 15:48:05 rillig Exp $
 
 # Before 2020-07-27, there was an off-by-one error in Var_Parse that skipped
 # the last character in the variable name.
@@ -21,5 +21,15 @@
 .  error
 .endif
 
+# If a dynamic variable is expanded in a non-local context, the expression
+# based on this variable is not expanded.  But there may be nested variable
+# expressions in the modifiers, and these are kept unexpanded as well.
+.if ${.TARGET:M${:Ufallback}} != "\${.TARGET:M\${:Ufallback}}"
+.  error
+.endif
+.if ${.TARGET:M${UNDEF}} != "\${.TARGET:M\${UNDEF}}"
+.  error
+.endif
+
 all:
 	@:



CVS commit: src/sys/arch/evbppc

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 15:42:21 UTC 2020

Modified Files:
src/sys/arch/evbppc/explora/dev: fb_elb.c pckbc_elb.c
src/sys/arch/evbppc/pmppc: pic_cpc700.c
src/sys/arch/evbppc/pmppc/dev: cpc_mainbus.c
src/sys/arch/evbppc/virtex: design_gsrd1.c
src/sys/arch/evbppc/walnut/dev: pckbc_pbus.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbppc/explora/dev/fb_elb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbppc/explora/dev/pckbc_elb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbppc/pmppc/pic_cpc700.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbppc/virtex/design_gsrd1.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbppc/walnut/dev/pckbc_pbus.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/evbppc/explora/dev/fb_elb.c
diff -u src/sys/arch/evbppc/explora/dev/fb_elb.c:1.13 src/sys/arch/evbppc/explora/dev/fb_elb.c:1.14
--- src/sys/arch/evbppc/explora/dev/fb_elb.c:1.13	Fri Jul  1 19:02:32 2011
+++ src/sys/arch/evbppc/explora/dev/fb_elb.c	Sat Nov 21 15:42:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb_elb.c,v 1.13 2011/07/01 19:02:32 dyoung Exp $	*/
+/*	$NetBSD: fb_elb.c,v 1.14 2020/11/21 15:42:20 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,13 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fb_elb.c,v 1.13 2011/07/01 19:02:32 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb_elb.c,v 1.14 2020/11/21 15:42:20 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -143,8 +143,7 @@ fb_elb_attach(device_t parent, device_t 
 		sc->sc_fb = _dev;
 		sc->sc_fb->fb_ri.ri_flg &= ~RI_NO_AUTO;
 	} else {
-		sc->sc_fb = malloc(sizeof(struct fb_dev), M_DEVBUF, M_WAITOK);
-		memset(sc->sc_fb, 0, sizeof(struct fb_dev));
+		sc->sc_fb = kmem_zalloc(sizeof(struct fb_dev), KM_SLEEP);
 	}
 
 	sc->sc_fb->fb_iot = eaa->elb_bt;

Index: src/sys/arch/evbppc/explora/dev/pckbc_elb.c
diff -u src/sys/arch/evbppc/explora/dev/pckbc_elb.c:1.7 src/sys/arch/evbppc/explora/dev/pckbc_elb.c:1.8
--- src/sys/arch/evbppc/explora/dev/pckbc_elb.c:1.7	Fri Jul  1 19:02:32 2011
+++ src/sys/arch/evbppc/explora/dev/pckbc_elb.c	Sat Nov 21 15:42:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pckbc_elb.c,v 1.7 2011/07/01 19:02:32 dyoung Exp $	*/
+/*	$NetBSD: pckbc_elb.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,13 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pckbc_elb.c,v 1.7 2011/07/01 19:02:32 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_elb.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -88,8 +88,7 @@ pckbc_elb_attach(device_t parent, device
 		t = _consdata;
 		pckbc_console_attached = 1;
 	} else {
-		t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
-		memset(t, 0, sizeof(struct pckbc_internal));
+		t = kmem_zalloc(sizeof(struct pckbc_internal), KM_SLEEP);
 	}
 
 	t->t_iot = eaa->elb_bt;

Index: src/sys/arch/evbppc/pmppc/pic_cpc700.c
diff -u src/sys/arch/evbppc/pmppc/pic_cpc700.c:1.7 src/sys/arch/evbppc/pmppc/pic_cpc700.c:1.8
--- src/sys/arch/evbppc/pmppc/pic_cpc700.c:1.7	Sun Nov 10 21:16:26 2019
+++ src/sys/arch/evbppc/pmppc/pic_cpc700.c	Sat Nov 21 15:42:20 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_cpc700.c,v 1.7 2019/11/10 21:16:26 chs Exp $ */
+/* $NetBSD: pic_cpc700.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,10 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic_cpc700.c,v 1.7 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_cpc700.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $");
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -60,7 +60,7 @@ setup_cpc700(void)
 	struct cpc700_ops *cpc700;
 	struct pic_ops *pic;
 
-	cpc700 = malloc(sizeof(struct cpc700_ops), M_DEVBUF, M_WAITOK);
+	cpc700 = kmem_alloc(sizeof(struct cpc700_ops), KM_SLEEP);
 	pic = >pic;
 
 	pic->pic_numintrs = 32;

Index: src/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c
diff -u src/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c:1.7 src/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c:1.8
--- src/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c:1.7	Sun Nov 10 21:16:26 2019
+++ src/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c	Sat Nov 21 15:42:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpc_mainbus.c,v 1.7 2019/11/10 21:16:26 chs Exp $	*/
+/*	$NetBSD: cpc_mainbus.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpc_mainbus.c,v 1.7 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpc_mainbus.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $");
 
 #include 
 

CVS commit: src/sys/arch/evbmips

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 15:36:36 UTC 2020

Modified Files:
src/sys/arch/evbmips/gdium: gdium_intr.c
src/sys/arch/evbmips/loongson: loongson_intr.c
src/sys/arch/evbmips/malta: malta_intr.c
src/sys/arch/evbmips/malta/pci: pcib.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbmips/gdium/gdium_intr.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbmips/loongson/loongson_intr.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbmips/malta/malta_intr.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbmips/malta/pci/pcib.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/gdium/gdium_intr.c
diff -u src/sys/arch/evbmips/gdium/gdium_intr.c:1.9 src/sys/arch/evbmips/gdium/gdium_intr.c:1.10
--- src/sys/arch/evbmips/gdium/gdium_intr.c:1.9	Sun Nov 10 21:16:26 2019
+++ src/sys/arch/evbmips/gdium/gdium_intr.c	Sat Nov 21 15:36:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdium_intr.c,v 1.9 2019/11/10 21:16:26 chs Exp $	*/
+/*	$NetBSD: gdium_intr.c,v 1.10 2020/11/21 15:36:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdium_intr.c,v 1.9 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdium_intr.c,v 1.10 2020/11/21 15:36:36 thorpej Exp $");
 
 #define __INTR_PRIVATE
 
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: gdium_intr.c
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -239,7 +239,7 @@ evbmips_intr_establish(int irq, int (*fu
 
 	KASSERT(irq == irqmap->irqidx);
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK|M_ZERO);
+	ih = kmem_zalloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = irq;
@@ -290,7 +290,7 @@ evbmips_intr_disestablish(void *cookie)
 
 	splx(s);
 
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 void

Index: src/sys/arch/evbmips/loongson/loongson_intr.c
diff -u src/sys/arch/evbmips/loongson/loongson_intr.c:1.7 src/sys/arch/evbmips/loongson/loongson_intr.c:1.8
--- src/sys/arch/evbmips/loongson/loongson_intr.c:1.7	Sun Nov 10 21:16:26 2019
+++ src/sys/arch/evbmips/loongson/loongson_intr.c	Sat Nov 21 15:36:36 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: loongson_intr.c,v 1.7 2019/11/10 21:16:26 chs Exp $  */
+/*  $NetBSD: loongson_intr.c,v 1.8 2020/11/21 15:36:36 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: loongson_intr.c,v 1.7 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: loongson_intr.c,v 1.8 2020/11/21 15:36:36 thorpej Exp $");
 
 #define __INTR_PRIVATE
 
@@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: loongson_int
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -295,7 +295,7 @@ evbmips_intr_establish(int irq, int (*fu
 	KASSERT(irq < BONITO_NINTS);
 	DPRINTF(("loongson_intr_establish %d %p", irq, func));
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK|M_ZERO);
+	ih = kmem_zalloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = irq;
@@ -327,7 +327,7 @@ evbmips_intr_disestablish(void *cookie)
 	!BONITO_IRQ_IS_ISA(ih->ih_irq))
 		REGVAL(BONITO_INTENCLR) = (1 << ih->ih_irq);
 	splx(s);
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 const char *

Index: src/sys/arch/evbmips/malta/malta_intr.c
diff -u src/sys/arch/evbmips/malta/malta_intr.c:1.26 src/sys/arch/evbmips/malta/malta_intr.c:1.27
--- src/sys/arch/evbmips/malta/malta_intr.c:1.26	Sun Nov 10 21:16:26 2019
+++ src/sys/arch/evbmips/malta/malta_intr.c	Sat Nov 21 15:36:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: malta_intr.c,v 1.26 2019/11/10 21:16:26 chs Exp $	*/
+/*	$NetBSD: malta_intr.c,v 1.27 2020/11/21 15:36:36 thorpej Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -40,14 +40,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: malta_intr.c,v 1.26 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: malta_intr.c,v 1.27 2020/11/21 15:36:36 thorpej Exp $");
 
 #define	__INTR_PRIVATE
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -206,7 +206,7 @@ evbmips_intr_establish(int irq, int (*fu
 	struct evbmips_intrhand *ih;
 	int s;
 	
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 
@@ -241,7 +241,7 @@ evbmips_intr_disestablish(void *arg)
 	
 	splx(s);
 
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 void

Index: src/sys/arch/evbmips/malta/pci/pcib.c
diff -u src/sys/arch/evbmips/malta/pci/pcib.c:1.19 src/sys/arch/evbmips/malta/pci/pcib.c:1.20
--- src/sys/arch/evbmips/malta/pci/pcib.c:1.19	Sun Nov 10 21:16:26 2019
+++ src/sys/arch/evbmips/malta/pci/pcib.c	Sat Nov 21 15:36:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcib.c,v 

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 15:32:52 UTC 2020

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

Log Message:
make(1): clean up freeing of environment variables in Var_Parse

The previous code with the extra boolean variable was a brain-twister
since the responsibility of freeing the memory was distributed over 3
different functions.


To generate a diff of this commit:
cvs rdiff -u -r1.691 -r1.692 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.691 src/usr.bin/make/var.c:1.692
--- src/usr.bin/make/var.c:1.691	Sat Nov 21 15:28:44 2020
+++ src/usr.bin/make/var.c	Sat Nov 21 15:32:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.691 2020/11/21 15:28:44 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.692 2020/11/21 15:32:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.691 2020/11/21 15:28:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.692 2020/11/21 15:32:52 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3925,12 +3925,17 @@ Var_Parse(const char **pp, GNode *ctxt, 
 *pp = p;
 
 if (v->flags & VAR_FROM_ENV) {
-	/* Free the environment variable now since we own it,
-	 * but don't free the variable value if it will be returned. */
-	Boolean keepValue = value == Buf_GetAll(>val, NULL);
-	if (keepValue)
-	*out_val_freeIt = value;
-	(void)VarFreeEnv(v, !keepValue);
+	/* Free the environment variable now since we own it. */
+
+	char *varValue = Buf_Destroy(>val, FALSE);
+	if (value == varValue) {
+	/* Don't free the variable value since it will be returned. */
+	*out_val_freeIt = varValue;
+	} else
+	free(varValue);
+
+	free(v->name_freeIt);
+	free(v);
 
 } else if (exprFlags & VEF_UNDEF) {
 	if (!(exprFlags & VEF_DEF)) {



CVS commit: src/sys/arch/evbarm

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 15:30:07 UTC 2020

Modified Files:
src/sys/arch/evbarm/ifpga: ifpga_intr.c
src/sys/arch/evbarm/iq80310: iq80310_intr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/ifpga/ifpga_intr.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/iq80310/iq80310_intr.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/evbarm/ifpga/ifpga_intr.c
diff -u src/sys/arch/evbarm/ifpga/ifpga_intr.c:1.11 src/sys/arch/evbarm/ifpga/ifpga_intr.c:1.12
--- src/sys/arch/evbarm/ifpga/ifpga_intr.c:1.11	Sun Nov 10 21:16:25 2019
+++ src/sys/arch/evbarm/ifpga/ifpga_intr.c	Sat Nov 21 15:30:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ifpga_intr.c,v 1.11 2019/11/10 21:16:25 chs Exp $	*/
+/*	$NetBSD: ifpga_intr.c,v 1.12 2020/11/21 15:30:06 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -45,7 +45,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -255,7 +255,7 @@ ifpga_intr_establish(int irq, int ipl, i
 	if (irq < 0 || irq > NIRQ)
 		panic("ifpga_intr_establish: IRQ %d out of range", irq);
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_ipl = ipl;

Index: src/sys/arch/evbarm/iq80310/iq80310_intr.c
diff -u src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.35 src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.36
--- src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.35	Sun Nov 10 21:16:26 2019
+++ src/sys/arch/evbarm/iq80310/iq80310_intr.c	Sat Nov 21 15:30:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: iq80310_intr.c,v 1.35 2019/11/10 21:16:26 chs Exp $	*/
+/*	$NetBSD: iq80310_intr.c,v 1.36 2020/11/21 15:30:07 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: iq80310_intr.c,v 1.35 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iq80310_intr.c,v 1.36 2020/11/21 15:30:07 thorpej Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define	EVBARM_SPL_NOINLINE
@@ -48,7 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: iq80310_intr
 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -373,7 +373,7 @@ iq80310_intr_establish(int irq, int ipl,
 	if (irq < 0 || irq > NIRQ)
 		panic("iq80310_intr_establish: IRQ %d out of range", irq);
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_ipl = ipl;



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 15:28:44 UTC 2020

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

Log Message:
make(1): clean up parameter order in EvalUndefined


To generate a diff of this commit:
cvs rdiff -u -r1.690 -r1.691 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.690 src/usr.bin/make/var.c:1.691
--- src/usr.bin/make/var.c:1.690	Sat Nov 21 15:02:52 2020
+++ src/usr.bin/make/var.c	Sat Nov 21 15:28:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.690 2020/11/21 15:02:52 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.691 2020/11/21 15:28:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.690 2020/11/21 15:02:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.691 2020/11/21 15:28:44 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3661,13 +3661,13 @@ FindLocalLegacyVar(const char *varname, 
 static VarParseResult
 EvalUndefined(Boolean dynamic, const char *start, const char *p, char *varname,
 	  VarEvalFlags eflags,
-	  void **out_freeIt, const char **out_val)
+	  const char **out_val, void **out_freeIt)
 {
 if (dynamic) {
 	char *pstr = bmake_strsedup(start, p);
 	free(varname);
-	*out_freeIt = pstr;
 	*out_val = pstr;
+	*out_freeIt = pstr;
 	return VPR_OK;
 }
 
@@ -3756,7 +3756,7 @@ ParseVarnameLong(
 	p++;		/* skip endc */
 	*out_FALSE_pp = p;
 	*out_FALSE_res = EvalUndefined(dynamic, start, p, varname, eflags,
-	   out_FALSE_freeIt, out_FALSE_val);
+	   out_FALSE_val, out_FALSE_freeIt);
 	return FALSE;
 	}
 



CVS commit: src/sys/arch/cobalt/cobalt

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 15:26:54 UTC 2020

Modified Files:
src/sys/arch/cobalt/cobalt: interrupt.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/cobalt/cobalt/interrupt.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/cobalt/cobalt/interrupt.c
diff -u src/sys/arch/cobalt/cobalt/interrupt.c:1.10 src/sys/arch/cobalt/cobalt/interrupt.c:1.11
--- src/sys/arch/cobalt/cobalt/interrupt.c:1.10	Sun Nov 10 21:16:25 2019
+++ src/sys/arch/cobalt/cobalt/interrupt.c	Sat Nov 21 15:26:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:25 chs Exp $	*/
+/*	$NetBSD: interrupt.c,v 1.11 2020/11/21 15:26:53 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Izumi Tsutsui.  All rights reserved.
@@ -79,12 +79,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:25 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.11 2020/11/21 15:26:53 thorpej Exp $");
 
 #define __INTR_PRIVATE
 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -265,7 +265,7 @@ icu_intr_establish(int irq, int type, in
 		return NULL;
 	}
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = irq;
@@ -306,7 +306,7 @@ icu_intr_disestablish(void *cookie)
 			icu_set();
 		}
 		splx(s);
-		free(ih, M_DEVBUF);
+		kmem_free(ih, sizeof(*ih));
 	}
 }
 



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 15:02:52 UTC 2020

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

Log Message:
make(1): rename local variable in Var_Subst


To generate a diff of this commit:
cvs rdiff -u -r1.689 -r1.690 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.689 src/usr.bin/make/var.c:1.690
--- src/usr.bin/make/var.c:1.689	Tue Nov 17 20:11:02 2020
+++ src/usr.bin/make/var.c	Sat Nov 21 15:02:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.689 2020/11/17 20:11:02 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.690 2020/11/21 15:02:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.689 2020/11/17 20:11:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.690 2020/11/21 15:02:52 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -4022,26 +4022,26 @@ VarParseResult
 Var_Subst(const char *str, GNode *ctxt, VarEvalFlags eflags, char **out_res)
 {
 const char *p = str;
-Buffer buf;			/* Buffer for forming things */
+Buffer res;
 
 /* Set true if an error has already been reported,
  * to prevent a plethora of messages when recursing */
 /* XXX: Why is the 'static' necessary here? */
 static Boolean errorReported;
 
-Buf_Init();
+Buf_Init();
 errorReported = FALSE;
 
 while (*p != '\0') {
 	if (p[0] == '$' && p[1] == '$') {
 	/* A dollar sign may be escaped with another dollar sign. */
 	if (save_dollars && (eflags & VARE_KEEP_DOLLAR))
-		Buf_AddByte(, '$');
-	Buf_AddByte(, '$');
+		Buf_AddByte(, '$');
+	Buf_AddByte(, '$');
 	p += 2;
 
 	} else if (p[0] == '$') {
-	VarSubstNested(, , ctxt, eflags, );
+	VarSubstNested(, , ctxt, eflags, );
 
 	} else {
 	/*
@@ -4052,11 +4052,11 @@ Var_Subst(const char *str, GNode *ctxt, 
 
 	for (p++; *p != '$' && *p != '\0'; p++)
 		continue;
-	Buf_AddBytesBetween(, plainStart, p);
+	Buf_AddBytesBetween(, plainStart, p);
 	}
 }
 
-*out_res = Buf_DestroyCompact();
+*out_res = Buf_DestroyCompact();
 return VPR_OK;
 }
 



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

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 14:59:11 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directive-include.mk

Log Message:
make(1): add test for .include with trailing garbage in the line


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-include.mk

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/directive-include.mk
diff -u src/usr.bin/make/unit-tests/directive-include.mk:1.4 src/usr.bin/make/unit-tests/directive-include.mk:1.5
--- src/usr.bin/make/unit-tests/directive-include.mk:1.4	Tue Nov  3 17:17:31 2020
+++ src/usr.bin/make/unit-tests/directive-include.mk	Sat Nov 21 14:59:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-include.mk,v 1.4 2020/11/03 17:17:31 rillig Exp $
+# $NetBSD: directive-include.mk,v 1.5 2020/11/21 14:59:11 rillig Exp $
 #
 # Tests for the .include directive, which includes another file.
 
@@ -27,5 +27,8 @@
 # including a directory technically succeeds, but shouldn't.
 #.include "."			# directory
 
+# As of 2020-11-21, anything after the delimiter '"' is ignored.
+.include "/dev/null" and ignore anything in the rest of the line.
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 13:20:12 UTC 2020

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

Log Message:
make(1): clean up reference counting in SuffList_Insert


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.260 src/usr.bin/make/suff.c:1.261
--- src/usr.bin/make/suff.c:1.260	Sat Nov 21 13:16:37 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 13:20:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.260 2020/11/21 13:16:37 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.261 2020/11/21 13:20:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.260 2020/11/21 13:16:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.261 2020/11/21 13:20:12 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -374,14 +374,12 @@ SuffList_Insert(SuffList *list, Suff *su
 if (ln == NULL) {
 	SUFF_DEBUG2("inserting \"%s\" (%d) at end of list\n",
 		suff->name, suff->sNum);
-	Lst_Append(list, suff);
-	suff->refCount++;
+	Lst_Append(list, SuffRef(suff));
 	Lst_Append(suff->ref, list);
 } else if (listSuff->sNum != suff->sNum) {
 	DEBUG4(SUFF, "inserting \"%s\" (%d) before \"%s\" (%d)\n",
 		   suff->name, suff->sNum, listSuff->name, listSuff->sNum);
-	Lst_InsertBefore(list, ln, suff);
-	suff->refCount++;
+	Lst_InsertBefore(list, ln, SuffRef(suff));
 	Lst_Append(suff->ref, list);
 } else {
 	SUFF_DEBUG2("\"%s\" (%d) is already there\n", suff->name, suff->sNum);



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 13:16:37 UTC 2020

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

Log Message:
make(1): move reference counting for suffixes to SrcNew


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.259 src/usr.bin/make/suff.c:1.260
--- src/usr.bin/make/suff.c:1.259	Sat Nov 21 13:11:13 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 13:16:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.259 2020/11/21 13:11:13 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.260 2020/11/21 13:16:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.259 2020/11/21 13:11:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.260 2020/11/21 13:16:37 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -203,6 +203,13 @@ static Suff *emptySuff;
 static void SuffFindDeps(GNode *, SrcList *);
 static void SuffExpandWildcards(GNodeListNode *, GNode *);
 
+static Suff *
+SuffRef(Suff *suff)
+{
+suff->refCount++;
+return suff;
+}
+
 /* Change the value of a Suff variable, adjusting the reference counts. */
 static void
 SuffReassign(Suff **var, Suff *suff)
@@ -856,7 +863,7 @@ SrcNew(char *name, char *pref, Suff *suf
 
 src->file = name;
 src->pref = pref;
-src->suff = suff;
+src->suff = SuffRef(suff);
 src->parent = parent;
 src->node = gn;
 src->numChildren = 0;
@@ -872,7 +879,6 @@ SuffAddSrc(Suff *suff, SrcList *srcList,
 	   const char *debug_tag MAKE_ATTR_UNUSED)
 {
 Src *s2 = SrcNew(srcName, targ->pref, suff, targ, NULL);
-suff->refCount++;
 targ->numChildren++;
 Lst_Append(srcList, s2);
 #ifdef DEBUG_SRC
@@ -1086,7 +1092,6 @@ SuffFindCmds(Src *targ, SrcList *slst)
  * again (ick)), and return the new structure.
  */
 ret = SrcNew(bmake_strdup(sgn->name), targ->pref, suff, targ, sgn);
-suff->refCount++;
 targ->numChildren++;
 #ifdef DEBUG_SRC
 debug_printf("3 add targ %p ret %p\n", targ, ret);
@@ -1555,7 +1560,6 @@ SuffFindNormalDepsKnown(const char *name
 
 	pref = bmake_strldup(name, (size_t)(nameLen - suff->nameLen));
 	targ = SrcNew(bmake_strdup(gn->name), pref, suff, NULL, gn);
-	suff->refCount++;
 
 	/*
 	 * Add nodes from which the target can be made
@@ -1582,7 +1586,6 @@ SuffFindNormalDepsUnknown(GNode *gn, con
 
 targ = SrcNew(bmake_strdup(gn->name), bmake_strdup(sopref),
 		  suffNull, NULL, gn);
-targ->suff->refCount++;
 
 /*
  * Only use the default suffix rules if we don't have commands



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 13:11:13 UTC 2020

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

Log Message:
make(1): clean up reference counting for suffixes


To generate a diff of this commit:
cvs rdiff -u -r1.258 -r1.259 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.258 src/usr.bin/make/suff.c:1.259
--- src/usr.bin/make/suff.c:1.258	Sat Nov 21 12:01:16 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 13:11:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.258 2020/11/21 12:01:16 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.259 2020/11/21 13:11:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.258 2020/11/21 12:01:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.259 2020/11/21 13:11:13 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -203,6 +203,25 @@ static Suff *emptySuff;
 static void SuffFindDeps(GNode *, SrcList *);
 static void SuffExpandWildcards(GNodeListNode *, GNode *);
 
+/* Change the value of a Suff variable, adjusting the reference counts. */
+static void
+SuffReassign(Suff **var, Suff *suff)
+{
+if (*var != NULL)
+	(*var)->refCount--;
+*var = suff;
+suff->refCount++;
+}
+
+/* Set a Suff variable to NULL, adjusting the reference count. */
+static void
+SuffUnassign(Suff **var)
+{
+if (*var != NULL)
+	(*var)->refCount--;
+*var = NULL;
+}
+
 /*
  * See if pref is a prefix of str.
  * Return NULL if it ain't, pointer to character in str after prefix if so.
@@ -1612,10 +1631,7 @@ SuffFindNormalDepsPath(GNode *gn, Src *t
 	char savec;
 	char *ptr;
 
-	if (gn->suffix)
-	gn->suffix->refCount--;
-	gn->suffix = targ->suff;
-	gn->suffix->refCount++;
+	SuffReassign(>suffix, targ->suff);
 
 	savec = gn->path[savep];
 	gn->path[savep] = '\0';
@@ -1632,9 +1648,7 @@ SuffFindNormalDepsPath(GNode *gn, Src *t
 	char *ptr;
 
 	/* The .PREFIX gets the full path if the target has no known suffix. */
-	if (gn->suffix)
-	gn->suffix->refCount--;
-	gn->suffix = NULL;
+	SuffUnassign(>suffix);
 
 	if ((ptr = strrchr(gn->path, '/')) != NULL)
 	ptr++;
@@ -1804,10 +1818,7 @@ sfnd_abort:
 for (src = bottom; src->parent != NULL; src = src->parent) {
 	targ = src->parent;
 
-	if (src->node->suffix)
-	src->node->suffix->refCount--;
-	src->node->suffix = src->suff;
-	src->node->suffix->refCount++;
+	SuffReassign(>node->suffix, src->suff);
 
 	if (targ->node == NULL)
 	targ->node = Targ_GetNode(targ->file);
@@ -1830,10 +1841,7 @@ sfnd_abort:
 	}
 }
 
-if (gn->suffix != NULL)
-	gn->suffix->refCount--;
-gn->suffix = src->suff;
-gn->suffix->refCount++;
+SuffReassign(>suffix, src->suff);
 
 /*
  * Nuke the transformation path and the Src structures left over in the
@@ -1901,14 +1909,11 @@ SuffFindDeps(GNode *gn, SrcList *slst)
 	 * value).
 	 */
 	Suff *suff = FindSuffByName(LIBSUFF);
-	if (gn->suffix)
-	gn->suffix->refCount--;
 	if (suff != NULL) {
-	gn->suffix = suff;
-	gn->suffix->refCount++;
+	SuffReassign(>suffix, suff);
 	Arch_FindLib(gn, suff->searchPath);
 	} else {
-	gn->suffix = NULL;
+	SuffUnassign(>suffix);
 	Var_Set(TARGET, gn->name, gn);
 	}
 	/*



CVS commit: src/share/man/man5

2020-11-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Nov 21 12:26:41 UTC 2020

Modified Files:
src/share/man/man5: boot.cfg.5

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/share/man/man5/boot.cfg.5

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/man5/boot.cfg.5
diff -u src/share/man/man5/boot.cfg.5:1.29 src/share/man/man5/boot.cfg.5:1.30
--- src/share/man/man5/boot.cfg.5:1.29	Sat Nov 21 11:41:54 2020
+++ src/share/man/man5/boot.cfg.5	Sat Nov 21 12:26:41 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: boot.cfg.5,v 1.29 2020/11/21 11:41:54 kim Exp $
+.\"	$NetBSD: boot.cfg.5,v 1.30 2020/11/21 12:26:41 wiz Exp $
 .\"
 .\" Copyright (c) 2007 Stephen Borrill
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 25, 2014
+.Dd November 21, 2020
 .Dt BOOT.CFG 5
 .Os
 .Sh NAME



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 12:01:17 UTC 2020

Modified Files:
src/usr.bin/make: suff.c
src/usr.bin/make/unit-tests: suff-rebuild.exp suff-rebuild.mk

Log Message:
make(1): add explanation for test suff-rebuild


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/usr.bin/make/suff.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/suff-rebuild.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/suff-rebuild.mk

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/suff.c
diff -u src/usr.bin/make/suff.c:1.257 src/usr.bin/make/suff.c:1.258
--- src/usr.bin/make/suff.c:1.257	Sat Nov 21 10:36:01 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 12:01:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.257 2020/11/21 10:36:01 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.258 2020/11/21 12:01:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.257 2020/11/21 10:36:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.258 2020/11/21 12:01:16 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -642,6 +642,16 @@ SuffUpdateTarget(GNode *target, GNode **
 if (target->type == OP_TRANSFORM)
 	return FALSE;
 
+/*
+ * XXX: What is the purpose of the 'ptr == target->name' condition here?
+ * In suff-rebuild.mk in the line '.SUFFIXES: .c .b .a', it prevents the
+ * rule '.b.c' from being added again during Suff_AddSuffix(".b").
+ */
+/*
+ * XXX: What about a transformation ".cpp.c"?  If ".c" is added as a new
+ * suffix, it seems wrong that this transformation would be skipped just
+ * because ".c" happens to be a prefix of ".cpp".
+ */
 if ((ptr = strstr(target->name, suff->name)) == NULL ||
 	ptr == target->name)
 	return FALSE;

Index: src/usr.bin/make/unit-tests/suff-rebuild.exp
diff -u src/usr.bin/make/unit-tests/suff-rebuild.exp:1.4 src/usr.bin/make/unit-tests/suff-rebuild.exp:1.5
--- src/usr.bin/make/unit-tests/suff-rebuild.exp:1.4	Sat Nov 21 11:59:22 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.exp	Sat Nov 21 12:01:16 2020
@@ -30,7 +30,7 @@ defining transformation from `.c' to `'
 inserting ".c" (3) at end of list
 inserting "" (0) at end of list
 ParseReadLine (22): '	: Making ${.TARGET} from ${.IMPSRC}.'
-ParseReadLine (35): '.SUFFIXES: .c .b .a'
+ParseReadLine (44): '.SUFFIXES: .c .b .a'
 transformation .c complete
 ParseDoDependency(.SUFFIXES: .c .b .a)
 Adding ".END" to all targets.

Index: src/usr.bin/make/unit-tests/suff-rebuild.mk
diff -u src/usr.bin/make/unit-tests/suff-rebuild.mk:1.5 src/usr.bin/make/unit-tests/suff-rebuild.mk:1.6
--- src/usr.bin/make/unit-tests/suff-rebuild.mk:1.5	Sat Nov 21 11:55:57 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.mk	Sat Nov 21 12:01:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: suff-rebuild.mk,v 1.5 2020/11/21 11:55:57 rillig Exp $
+# $NetBSD: suff-rebuild.mk,v 1.6 2020/11/21 12:01:16 rillig Exp $
 #
 # Demonstrates what happens to transformation rules (called inference rules
 # by POSIX) when all suffixes are deleted.
@@ -28,6 +28,15 @@ suff-rebuild-example.a:
 # As of 2020-09-25, uncommenting the following line results in the error
 # message "don't know how to make suff-rebuild-example" though.
 #
+# If this is a bug, the actual cause is probably that when a suffix
+# transformation rule is defined, it is not added to the global list of
+# targets, see Suff_EndTransform.  Later, UpdateTargets iterates over exactly
+# this global list of targets though.
+#
+# If UpdateTargets were to iterate over 'transforms' as well, it still
+# wouldn't work because the condition 'ptr == target->name' skips these
+# transformation rules.
+
 #.SUFFIXES:
 
 # Add the suffixes back.  It should not matter that the order of the suffixes



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 11:59:22 UTC 2020

Modified Files:
src/usr.bin/make: targ.c
src/usr.bin/make/unit-tests: suff-rebuild.exp

Log Message:
make(1): add more debug logging for suffix handling

One notable thing is that there is no debug output when adding a
transformation rule like ".c.o",  which means that these rules don't end
up in the global allTargets variable.

This may or may not be intentional.  It seems not intentional since this
is one of the causes for the suff-rebuild test to behave unexpectedly.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/make/targ.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/suff-rebuild.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/targ.c
diff -u src/usr.bin/make/targ.c:1.137 src/usr.bin/make/targ.c:1.138
--- src/usr.bin/make/targ.c:1.137	Sat Nov 21 10:56:17 2020
+++ src/usr.bin/make/targ.c	Sat Nov 21 11:59:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.137 2020/11/21 10:56:17 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.138 2020/11/21 11:59:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -119,7 +119,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.137 2020/11/21 10:56:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.138 2020/11/21 11:59:22 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -289,6 +289,7 @@ Targ_NewInternalNode(const char *name)
 GNode *gn = GNode_New(name);
 Var_Append(".ALLTARGETS", name, VAR_GLOBAL);
 Lst_Append(allTargets, gn);
+DEBUG1(TARG, "Adding \"%s\" to all targets.\n", gn->name);
 if (doing_depend)
 	gn->flags |= FROM_DEPEND;
 return gn;

Index: src/usr.bin/make/unit-tests/suff-rebuild.exp
diff -u src/usr.bin/make/unit-tests/suff-rebuild.exp:1.3 src/usr.bin/make/unit-tests/suff-rebuild.exp:1.4
--- src/usr.bin/make/unit-tests/suff-rebuild.exp:1.3	Sat Nov 21 11:55:57 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.exp	Sat Nov 21 11:59:22 2020
@@ -8,6 +8,7 @@ Adding suffix ".b"
 Adding suffix ".c"
 ParseReadLine (14): 'suff-rebuild-example.a:'
 ParseDoDependency(suff-rebuild-example.a:)
+Adding "suff-rebuild-example.a" to all targets.
 ParseReadLine (15): '	: Making ${.TARGET} out of nothing.'
 ParseReadLine (17): '.a.b:'
 ParseDoDependency(.a.b:)
@@ -32,6 +33,7 @@ ParseReadLine (22): '	: Making ${.TARGET
 ParseReadLine (35): '.SUFFIXES: .c .b .a'
 transformation .c complete
 ParseDoDependency(.SUFFIXES: .c .b .a)
+Adding ".END" to all targets.
 Wildcard expanding "all"...
 SuffFindDeps (all)
 	No known suffix on all. Using .NULL suffix
@@ -46,7 +48,9 @@ adding suffix rules
 	trying suff-rebuild-example.c...not there
 	trying suff-rebuild-example.b...not there
 	trying suff-rebuild-example.a...got it
+Adding "suff-rebuild-example.b" to all targets.
 	applying .a -> .b to "suff-rebuild-example.b"
+Adding "suff-rebuild-example.c" to all targets.
 	applying .b -> .c to "suff-rebuild-example.c"
 	applying .c ->  to "suff-rebuild-example"
 suffix is ".c"...



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

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 11:55:57 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: suff-rebuild.exp suff-rebuild.mk

Log Message:
make(1): enable debug logging for test suff-rebuild

As long as it is not clear why this test fails, it's better to have the
debug log available, both for reading it and for getting notified if
any behavior in this area changes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/suff-rebuild.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/suff-rebuild.mk

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/suff-rebuild.exp
diff -u src/usr.bin/make/unit-tests/suff-rebuild.exp:1.2 src/usr.bin/make/unit-tests/suff-rebuild.exp:1.3
--- src/usr.bin/make/unit-tests/suff-rebuild.exp:1.2	Sat Nov 21 08:51:57 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.exp	Sat Nov 21 11:55:57 2020
@@ -1,5 +1,69 @@
+ParseReadLine (10): '.SUFFIXES:'
+ParseDoDependency(.SUFFIXES:)
+Clearing all suffixes
+ParseReadLine (12): '.SUFFIXES: .a .b .c'
+ParseDoDependency(.SUFFIXES: .a .b .c)
+Adding suffix ".a"
+Adding suffix ".b"
+Adding suffix ".c"
+ParseReadLine (14): 'suff-rebuild-example.a:'
+ParseDoDependency(suff-rebuild-example.a:)
+ParseReadLine (15): '	: Making ${.TARGET} out of nothing.'
+ParseReadLine (17): '.a.b:'
+ParseDoDependency(.a.b:)
+defining transformation from `.a' to `.b'
+inserting ".a" (1) at end of list
+inserting ".b" (2) at end of list
+ParseReadLine (18): '	: Making ${.TARGET} from ${.IMPSRC}.'
+ParseReadLine (19): '.b.c:'
+transformation .a.b complete
+ParseDoDependency(.b.c:)
+defining transformation from `.b' to `.c'
+inserting ".b" (2) at end of list
+inserting ".c" (3) at end of list
+ParseReadLine (20): '	: Making ${.TARGET} from ${.IMPSRC}.'
+ParseReadLine (21): '.c:'
+transformation .b.c complete
+ParseDoDependency(.c:)
+defining transformation from `.c' to `'
+inserting ".c" (3) at end of list
+inserting "" (0) at end of list
+ParseReadLine (22): '	: Making ${.TARGET} from ${.IMPSRC}.'
+ParseReadLine (35): '.SUFFIXES: .c .b .a'
+transformation .c complete
+ParseDoDependency(.SUFFIXES: .c .b .a)
+Wildcard expanding "all"...
+SuffFindDeps (all)
+	No known suffix on all. Using .NULL suffix
+adding suffix rules
+	trying all.c...not there
+	trying all.b...not there
+	trying all.a...not there
+Wildcard expanding "suff-rebuild-example"...
+SuffFindDeps (suff-rebuild-example)
+	No known suffix on suff-rebuild-example. Using .NULL suffix
+adding suffix rules
+	trying suff-rebuild-example.c...not there
+	trying suff-rebuild-example.b...not there
+	trying suff-rebuild-example.a...got it
+	applying .a -> .b to "suff-rebuild-example.b"
+	applying .b -> .c to "suff-rebuild-example.c"
+	applying .c ->  to "suff-rebuild-example"
+suffix is ".c"...
+suffix is ".b"...
+suffix is ".a"...
+SuffFindDeps (suff-rebuild-example.a)
+suffix is ".a"...
 : Making suff-rebuild-example.a out of nothing.
 : Making suff-rebuild-example.b from suff-rebuild-example.a.
 : Making suff-rebuild-example.c from suff-rebuild-example.b.
 : Making suff-rebuild-example from suff-rebuild-example.c.
+Wildcard expanding "all"...
+SuffFindDeps (.END)
+	No known suffix on .END. Using .NULL suffix
+adding suffix rules
+	trying .END.c...not there
+	trying .END.b...not there
+	trying .END.a...not there
+Wildcard expanding ".END"...
 exit status 0

Index: src/usr.bin/make/unit-tests/suff-rebuild.mk
diff -u src/usr.bin/make/unit-tests/suff-rebuild.mk:1.4 src/usr.bin/make/unit-tests/suff-rebuild.mk:1.5
--- src/usr.bin/make/unit-tests/suff-rebuild.mk:1.4	Sat Nov 21 08:51:57 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.mk	Sat Nov 21 11:55:57 2020
@@ -1,10 +1,12 @@
-# $NetBSD: suff-rebuild.mk,v 1.4 2020/11/21 08:51:57 rillig Exp $
+# $NetBSD: suff-rebuild.mk,v 1.5 2020/11/21 11:55:57 rillig Exp $
 #
 # Demonstrates what happens to transformation rules (called inference rules
 # by POSIX) when all suffixes are deleted.
 
 all: suff-rebuild-example
 
+.MAKEFLAGS: -dpst
+
 .SUFFIXES:
 
 .SUFFIXES: .a .b .c



CVS commit: src/sys/arch

2020-11-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 21 11:44:00 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: cpu.h
src/sys/arch/arm/cortex: gicv3.c

Log Message:
Add a per-CPU event counter that counts every time an interrupt handler is
preempted by a higher priority interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/aarch64/include/cpu.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/cortex/gicv3.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/include/cpu.h
diff -u src/sys/arch/aarch64/include/cpu.h:1.28 src/sys/arch/aarch64/include/cpu.h:1.29
--- src/sys/arch/aarch64/include/cpu.h:1.28	Thu Oct  1 06:40:16 2020
+++ src/sys/arch/aarch64/include/cpu.h	Sat Nov 21 11:43:59 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.28 2020/10/01 06:40:16 ryo Exp $ */
+/* $NetBSD: cpu.h,v 1.29 2020/11/21 11:43:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -112,6 +112,7 @@ struct cpu_info {
 	struct evcnt ci_vfp_save;
 	struct evcnt ci_vfp_release;
 	struct evcnt ci_uct_trap;
+	struct evcnt ci_intr_preempt;
 
 	/* FDT or similar supplied "cpu capacity" */
 	uint32_t ci_capacity_dmips_mhz;

Index: src/sys/arch/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.32 src/sys/arch/arm/cortex/gicv3.c:1.33
--- src/sys/arch/arm/cortex/gicv3.c:1.32	Sun Nov  1 14:30:12 2020
+++ src/sys/arch/arm/cortex/gicv3.c	Sat Nov 21 11:44:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.32 2020/11/01 14:30:12 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.33 2020/11/21 11:44:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.32 2020/11/01 14:30:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.33 2020/11/21 11:44:00 jmcneill Exp $");
 
 #include 
 #include 
@@ -368,6 +368,9 @@ gicv3_cpu_init(struct pic_softc *pic, st
 	struct gicv3_softc * const sc = PICTOSOFTC(pic);
 	uint32_t icc_sre, icc_ctlr, gicr_waker;
 
+	evcnt_attach_dynamic(>ci_intr_preempt, EVCNT_TYPE_MISC, NULL,
+	ci->ci_cpuname, "intr preempt");
+
 	ci->ci_gic_redist = gicv3_find_redist(sc);
 	ci->ci_gic_sgir = gicv3_sgir(sc);
 
@@ -734,10 +737,15 @@ gicv3_irq_handler(void *frame)
 			isb();
 		}
 
+		const int64_t nintr = ci->ci_data.cpu_nintr;
+
 		cpsie(I32_bit);
 		pic_dispatch(is, frame);
 		cpsid(I32_bit);
 
+		if (nintr != ci->ci_data.cpu_nintr)
+			ci->ci_intr_preempt.ev_count++;
+
 		if (!early_eoi) {
 			icc_eoi1r_write(iar);
 			isb();



CVS commit: src/share/man/man5

2020-11-21 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Sat Nov 21 11:41:54 UTC 2020

Modified Files:
src/share/man/man5: boot.cfg.5

Log Message:
boot.cfg.5: Note that userconf can be used multiple times

Additionally:
- Make it easier for the reader to learn which keywords can be used
  multiple times
- Use multiple "userconf" lines in the EXAMPLES section, conveniently
  listing the current DRM drivers that a user might need to disable to
  troubleshoot "blank screen after boot" issues.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/share/man/man5/boot.cfg.5

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/man5/boot.cfg.5
diff -u src/share/man/man5/boot.cfg.5:1.28 src/share/man/man5/boot.cfg.5:1.29
--- src/share/man/man5/boot.cfg.5:1.28	Mon Jul  3 21:30:59 2017
+++ src/share/man/man5/boot.cfg.5	Sat Nov 21 11:41:54 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: boot.cfg.5,v 1.28 2017/07/03 21:30:59 wiz Exp $
+.\"	$NetBSD: boot.cfg.5,v 1.29 2020/11/21 11:41:54 kim Exp $
 .\"
 .\" Copyright (c) 2007 Stephen Borrill
 .\" All rights reserved.
@@ -51,12 +51,18 @@ Lines beginning with a hash
 .Pq Sq #
 are comments and will be ignored.
 .Pp
-Some keywords can be present multiple times in the file to define additional
+The
+.Dq Ic banner ,
+.Dq Ic load ,
+.Dq Ic menu ,
+and
+.Dq Ic userconf
+keywords can be present multiple times in the file to define additional
 items.
-Such keywords are noted below.
+See the description for each keyword for guidance and limitations on
+using multiple entries.
 .Bl -tag -width timeout
 .It Sy banner
-(may be present multiple times)
 The text from banner lines is displayed instead of the standard welcome text
 by the boot loader.
 Up to 10 lines can be defined.
@@ -101,7 +107,6 @@ If that file does not exist, it will the
 .Pa / .
 May be used as many times as needed.
 .It Sy menu
-(may be present multiple times)
 Used to define a menu item to be displayed to the end-user at boot time
 which allows a series of boot commands to be run without further typing.
 The value consists of the required menu text, followed by a colon
@@ -160,6 +165,7 @@ time limit for the user to choose an opt
 Passes a
 .Xr userconf 4
 command to the kernel at boot time.
+May be used as many times as needed.
 .El
 .Sh EXAMPLES
 Here is an example
@@ -182,7 +188,9 @@ menu=Go to command line (advanced users 
 clear=1
 timeout=-1
 default=1
-userconf=disable ehci*
+userconf=disable i915drmkms*
+userconf=disable nouveau*
+userconf=disable radeon*
 # Always load ramdisk module
 load=/miniroot.kmod
 .Ed



CVS commit: src/sys/dev/wscons

2020-11-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 21 11:26:55 UTC 2020

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
Fix previous and tag the right callout...


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/wscons/wsdisplay_vcons.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/dev/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.41 src/sys/dev/wscons/wsdisplay_vcons.c:1.42
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.41	Sat Nov 21 11:23:22 2020
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sat Nov 21 11:26:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.41 2020/11/21 11:23:22 mlelstv Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.42 2020/11/21 11:26:55 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.41 2020/11/21 11:23:22 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.42 2020/11/21 11:26:55 mlelstv Exp $");
 
 #include 
 #include 
@@ -156,7 +156,7 @@ vcons_init(struct vcons_data *vd, void *
 	vd->wanted = NULL;
 	vd->currenttype = def;
 	vd->defaulttype = def;
-	callout_init(>switch_callout, CALLOUT_MPSAFE);
+	callout_init(>switch_callout, 0);
 	callout_setfunc(>switch_callout, vcons_do_switch, vd);
 #ifdef VCONS_DRAW_INTR
 	vd->cells = 0;
@@ -176,7 +176,7 @@ vcons_init(struct vcons_data *vd, void *
 #ifdef VCONS_DRAW_INTR
 	vd->intr_softint = softint_establish(SOFTINT_SERIAL,
 	vcons_softintr, vd);
-	callout_init(>intr, 0);
+	callout_init(>intr, CALLOUT_MPSAFE);
 	callout_setfunc(>intr, vcons_intr, vd);
 	vd->intr_valid = 1;
 



CVS commit: src/sys/dev/wscons

2020-11-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 21 11:23:23 UTC 2020

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
Run callout without kernel lock, the softint itself is still protected.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/wscons/wsdisplay_vcons.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/dev/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.40 src/sys/dev/wscons/wsdisplay_vcons.c:1.41
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.40	Wed Jul 31 14:29:54 2019
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sat Nov 21 11:23:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.40 2019/07/31 14:29:54 rin Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.41 2020/11/21 11:23:22 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.40 2019/07/31 14:29:54 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.41 2020/11/21 11:23:22 mlelstv Exp $");
 
 #include 
 #include 
@@ -156,7 +156,7 @@ vcons_init(struct vcons_data *vd, void *
 	vd->wanted = NULL;
 	vd->currenttype = def;
 	vd->defaulttype = def;
-	callout_init(>switch_callout, 0);
+	callout_init(>switch_callout, CALLOUT_MPSAFE);
 	callout_setfunc(>switch_callout, vcons_do_switch, vd);
 #ifdef VCONS_DRAW_INTR
 	vd->cells = 0;



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 10:56:17 UTC 2020

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

Log Message:
make(1): improve comment style in GNode_Free

It was unclear what the ellipsis referred to.  It was meant to refer to
the function call Lst_Free, but that was not necessarily obvious to a
casual reader.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/usr.bin/make/targ.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/targ.c
diff -u src/usr.bin/make/targ.c:1.136 src/usr.bin/make/targ.c:1.137
--- src/usr.bin/make/targ.c:1.136	Sat Nov 21 10:50:39 2020
+++ src/usr.bin/make/targ.c	Sat Nov 21 10:56:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.136 2020/11/21 10:50:39 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.137 2020/11/21 10:56:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -119,7 +119,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.136 2020/11/21 10:50:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.137 2020/11/21 10:56:17 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -234,16 +234,16 @@ GNode_Free(void *gnp)
 free(gn->uname);
 free(gn->path);
 /* gn->youngestChild is not owned by this node. */
-Lst_Free(gn->implicitParents); /* ... but not the nodes themselves, */
+Lst_Free(gn->implicitParents); /* Do not free the nodes themselves, */
 Lst_Free(gn->parents);	/* as they are not owned by this node. */
 Lst_Free(gn->children);	/* likewise */
 Lst_Free(gn->order_pred);	/* likewise */
 Lst_Free(gn->order_succ);	/* likewise */
 Lst_Free(gn->cohorts);	/* likewise */
-HashTable_Done(>context); /* ... but not the variables themselves,
+HashTable_Done(>context); /* Do not free the variables themselves,
  * even though they are owned by this node.
  * XXX: they should probably be freed. */
-Lst_Free(gn->commands);	/* ... but not the commands themselves,
+Lst_Free(gn->commands);	/* Do not free the commands themselves,
  * as they may be shared with other nodes. */
 /* gn->suffix is not owned by this node. */
 /* XXX: gn->suffix should be unreferenced here.  This requires a thorough



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 10:51:26 UTC 2020

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

Log Message:
make(1): fix indentation in Make_HandleUse


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.209 src/usr.bin/make/make.c:1.210
--- src/usr.bin/make/make.c:1.209	Mon Nov 16 22:31:42 2020
+++ src/usr.bin/make/make.c	Sat Nov 21 10:51:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.209 2020/11/16 22:31:42 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.210 2020/11/21 10:51:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -102,7 +102,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.209 2020/11/16 22:31:42 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.210 2020/11/21 10:51:26 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -373,14 +373,14 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
 }
 #endif
 
-if ((cgn->type & (OP_USE|OP_USEBEFORE)) || Lst_IsEmpty(pgn->commands)) {
-	if (cgn->type & OP_USEBEFORE) {
-		/* .USEBEFORE */
-		Lst_PrependAll(pgn->commands, cgn->commands);
-	} else {
-		/* .USE, or target has no commands */
-		Lst_AppendAll(pgn->commands, cgn->commands);
-	}
+if ((cgn->type & (OP_USE | OP_USEBEFORE)) || Lst_IsEmpty(pgn->commands)) {
+	if (cgn->type & OP_USEBEFORE) {
+	/* .USEBEFORE */
+	Lst_PrependAll(pgn->commands, cgn->commands);
+	} else {
+	/* .USE, or target has no commands */
+	Lst_AppendAll(pgn->commands, cgn->commands);
+	}
 }
 
 for (ln = cgn->children->first; ln != NULL; ln = ln->next) {



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 10:50:39 UTC 2020

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

Log Message:
make(1): fix comment for allTargets

Source nodes are also included in this list.  What's not includes is
nodes that are _only_ source nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.bin/make/targ.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/targ.c
diff -u src/usr.bin/make/targ.c:1.135 src/usr.bin/make/targ.c:1.136
--- src/usr.bin/make/targ.c:1.135	Mon Nov 16 22:28:44 2020
+++ src/usr.bin/make/targ.c	Sat Nov 21 10:50:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.135 2020/11/16 22:28:44 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.136 2020/11/21 10:50:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -119,9 +119,12 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.135 2020/11/16 22:28:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.136 2020/11/21 10:50:39 rillig Exp $");
 
-/* All target nodes found so far, but not the source nodes. */
+/*
+ * All target nodes that appeared on the left-hand side of one of the
+ * dependency operators ':', '::', '!'.
+ */
 static GNodeList *allTargets;
 static HashTable allTargetsByName;
 



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 10:36:01 UTC 2020

Modified Files:
src/usr.bin/make: suff.c
src/usr.bin/make/unit-tests: suff-incomplete.exp suff-lookup.exp

Log Message:
make(1): add more debug logging for suffixes

The "Removing suffix" is not covered by the current tests.  It would be
best if that code were unreachable at all, since a reference count of -1
doesn't make sense.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/usr.bin/make/suff.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/suff-incomplete.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/suff-lookup.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/suff.c
diff -u src/usr.bin/make/suff.c:1.256 src/usr.bin/make/suff.c:1.257
--- src/usr.bin/make/suff.c:1.256	Sat Nov 21 09:53:40 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 10:36:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.256 2020/11/21 09:53:40 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.257 2020/11/21 10:36:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.256 2020/11/21 09:53:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.257 2020/11/21 10:36:01 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -326,6 +326,7 @@ SuffList_Remove(SuffList *list, Suff *su
 if (suff->refCount == 0) {
 	/* XXX: can lead to suff->refCount == -1 */
 	SuffList_Unref(sufflist, suff);
+	DEBUG1(SUFF, "Removing suffix \"%s\"\n", suff->name);
 	SuffFree(suff);
 }
 }
@@ -399,6 +400,7 @@ Suff_ClearSuffixes(void)
 #ifdef CLEANUP
 Lst_MoveAll(suffClean, sufflist);
 #endif
+DEBUG0(SUFF, "Clearing all suffixes\n");
 sufflist = Lst_New();
 sNum = 0;
 if (suffNull != NULL)

Index: src/usr.bin/make/unit-tests/suff-incomplete.exp
diff -u src/usr.bin/make/unit-tests/suff-incomplete.exp:1.1 src/usr.bin/make/unit-tests/suff-incomplete.exp:1.2
--- src/usr.bin/make/unit-tests/suff-incomplete.exp:1.1	Sat Nov 21 10:32:42 2020
+++ src/usr.bin/make/unit-tests/suff-incomplete.exp	Sat Nov 21 10:36:01 2020
@@ -1,5 +1,6 @@
 ParseReadLine (9): '.SUFFIXES:'
 ParseDoDependency(.SUFFIXES:)
+Clearing all suffixes
 ParseReadLine (11): '.SUFFIXES: .a .b .c'
 ParseDoDependency(.SUFFIXES: .a .b .c)
 Adding suffix ".a"

Index: src/usr.bin/make/unit-tests/suff-lookup.exp
diff -u src/usr.bin/make/unit-tests/suff-lookup.exp:1.4 src/usr.bin/make/unit-tests/suff-lookup.exp:1.5
--- src/usr.bin/make/unit-tests/suff-lookup.exp:1.4	Sat Nov 21 09:53:40 2020
+++ src/usr.bin/make/unit-tests/suff-lookup.exp	Sat Nov 21 10:36:01 2020
@@ -24,6 +24,7 @@ defining transformation from `.dead-end'
 inserting ".dead-end" (6) at end of list
 inserting ".short" (4) at end of list
 transformation .dead-end.short complete
+Clearing all suffixes
 Adding suffix ".c"
 Adding suffix ".cc"
 Adding suffix ".ccc"



CVS commit: src

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 10:32:42 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: suff-incomplete.exp suff-incomplete.mk

Log Message:
make(1): add test for incomplete transformation rule


To generate a diff of this commit:
cvs rdiff -u -r1.970 -r1.971 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.211 -r1.212 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-incomplete.exp \
src/usr.bin/make/unit-tests/suff-incomplete.mk

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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.970 src/distrib/sets/lists/tests/mi:1.971
--- src/distrib/sets/lists/tests/mi:1.970	Mon Nov 16 15:12:16 2020
+++ src/distrib/sets/lists/tests/mi	Sat Nov 21 10:32:42 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.970 2020/11/16 15:12:16 rillig Exp $
+# $NetBSD: mi,v 1.971 2020/11/21 10:32:42 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5279,6 +5279,8 @@
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-regular.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-single.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-single.mk			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-incomplete.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-incomplete.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-lookup.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-lookup.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-main.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.211 src/usr.bin/make/unit-tests/Makefile:1.212
--- src/usr.bin/make/unit-tests/Makefile:1.211	Thu Nov 19 23:50:26 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sat Nov 21 10:32:42 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.211 2020/11/19 23:50:26 rillig Exp $
+# $NetBSD: Makefile,v 1.212 2020/11/21 10:32:42 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -263,6 +263,7 @@ TESTS+=		shell-sh
 TESTS+=		suff-add-later
 TESTS+=		suff-clear-regular
 TESTS+=		suff-clear-single
+TESTS+=		suff-incomplete
 TESTS+=		suff-lookup
 TESTS+=		suff-main
 TESTS+=		suff-rebuild

Added files:

Index: src/usr.bin/make/unit-tests/suff-incomplete.exp
diff -u /dev/null src/usr.bin/make/unit-tests/suff-incomplete.exp:1.1
--- /dev/null	Sat Nov 21 10:32:42 2020
+++ src/usr.bin/make/unit-tests/suff-incomplete.exp	Sat Nov 21 10:32:42 2020
@@ -0,0 +1,41 @@
+ParseReadLine (9): '.SUFFIXES:'
+ParseDoDependency(.SUFFIXES:)
+ParseReadLine (11): '.SUFFIXES: .a .b .c'
+ParseDoDependency(.SUFFIXES: .a .b .c)
+Adding suffix ".a"
+Adding suffix ".b"
+Adding suffix ".c"
+ParseReadLine (17): '.a.b:'
+ParseDoDependency(.a.b:)
+defining transformation from `.a' to `.b'
+inserting ".a" (1) at end of list
+inserting ".b" (2) at end of list
+ParseReadLine (21): '.a.c: ${.PREFIX}.dependency'
+deleting incomplete transformation from `.a' to `.b'
+ParseDoDependency(.a.c: ${.PREFIX}.dependency)
+defining transformation from `.a' to `.c'
+inserting ".a" (1) at end of list
+inserting ".c" (3) at end of list
+# LinkSource: added child .a.c - ${.PREFIX}.dependency
+# .a.c, made UNMADE, type OP_DEPENDS|OP_TRANSFORM, flags none
+# ${.PREFIX}.dependency, made UNMADE, type none, flags none
+ParseReadLine (23): '.DEFAULT:'
+transformation .a.c complete
+ParseDoDependency(.DEFAULT:)
+ParseReadLine (24): '	: Making ${.TARGET} from ${.IMPSRC} all ${.ALLSRC} by default.'
+transformation .DEFAULT complete
+Wildcard expanding "all"...
+SuffFindDeps (all)
+	No known suffix on all. Using .NULL suffix
+adding suffix rules
+Wildcard expanding "suff-incomplete.c"...suffix is ".c"...
+SuffFindDeps (suff-incomplete.c)
+	trying suff-incomplete.a...not there
+Wildcard expanding "suff-incomplete.c"...suffix is ".c"...
+: Making suff-incomplete.c from suff-incomplete.c all  by default.
+Wildcard expanding "all"...
+SuffFindDeps (.END)
+	No known suffix on .END. Using .NULL suffix
+adding suffix rules
+Wildcard expanding ".END"...
+exit status 0
Index: src/usr.bin/make/unit-tests/suff-incomplete.mk
diff -u /dev/null src/usr.bin/make/unit-tests/suff-incomplete.mk:1.1
--- /dev/null	Sat Nov 21 10:32:42 2020
+++ src/usr.bin/make/unit-tests/suff-incomplete.mk	Sat Nov 21 10:32:42 2020
@@ -0,0 +1,30 @@
+# $NetBSD: suff-incomplete.mk,v 1.1 2020/11/21 10:32:42 rillig Exp $
+#
+# Tests incomplete transformation rules, which are ignored.
+
+all: suff-incomplete.c
+
+.MAKEFLAGS: -dps
+
+.SUFFIXES:
+
+.SUFFIXES: .a 

CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 09:53:40 UTC 2020

Modified Files:
src/usr.bin/make: suff.c
src/usr.bin/make/unit-tests: suff-add-later.exp suff-lookup.exp

Log Message:
make(1): add debug logging when adding a suffix to the global list


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/usr.bin/make/suff.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/suff-add-later.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/suff-lookup.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/suff.c
diff -u src/usr.bin/make/suff.c:1.255 src/usr.bin/make/suff.c:1.256
--- src/usr.bin/make/suff.c:1.255	Sat Nov 21 09:51:00 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 09:53:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.255 2020/11/21 09:51:00 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.256 2020/11/21 09:53:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.255 2020/11/21 09:51:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.256 2020/11/21 09:53:40 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -702,6 +702,7 @@ Suff_AddSuffix(const char *name, GNode *
 
 suff = SuffNew(name);
 Lst_Append(sufflist, suff);
+DEBUG1(SUFF, "Adding suffix \"%s\"\n", suff->name);
 
 UpdateTargets(inout_main, suff);
 

Index: src/usr.bin/make/unit-tests/suff-add-later.exp
diff -u src/usr.bin/make/unit-tests/suff-add-later.exp:1.2 src/usr.bin/make/unit-tests/suff-add-later.exp:1.3
--- src/usr.bin/make/unit-tests/suff-add-later.exp:1.2	Wed Oct 21 08:18:24 2020
+++ src/usr.bin/make/unit-tests/suff-add-later.exp	Sat Nov 21 09:53:40 2020
@@ -1,6 +1,9 @@
+Adding suffix ".c"
+Adding suffix ".d"
 defining transformation from `.c' to `.d'
 inserting ".c" (1) at end of list
 inserting ".d" (2) at end of list
+Adding suffix ".e"
 defining transformation from `.d' to `.e'
 inserting ".d" (2) at end of list
 inserting ".e" (3) at end of list

Index: src/usr.bin/make/unit-tests/suff-lookup.exp
diff -u src/usr.bin/make/unit-tests/suff-lookup.exp:1.3 src/usr.bin/make/unit-tests/suff-lookup.exp:1.4
--- src/usr.bin/make/unit-tests/suff-lookup.exp:1.3	Sun Oct 25 22:13:53 2020
+++ src/usr.bin/make/unit-tests/suff-lookup.exp	Sat Nov 21 09:53:40 2020
@@ -1,3 +1,9 @@
+Adding suffix ".c"
+Adding suffix ".cc"
+Adding suffix ".ccc"
+Adding suffix ".short"
+Adding suffix ".sho"
+Adding suffix ".dead-end"
 defining transformation from `.ccc' to `.cc'
 inserting ".ccc" (3) at end of list
 inserting ".cc" (2) at end of list
@@ -18,14 +24,20 @@ defining transformation from `.dead-end'
 inserting ".dead-end" (6) at end of list
 inserting ".short" (4) at end of list
 transformation .dead-end.short complete
+Adding suffix ".c"
+Adding suffix ".cc"
+Adding suffix ".ccc"
 inserting ".ccc" (3) at end of list
 inserting ".cc" (2) at end of list
 inserting ".c" (1) at end of list
 inserting ".ccc" (3) at end of list
+Adding suffix ".short"
 inserting ".short" (4) at end of list
 inserting ".c" (1) at end of list
+Adding suffix ".sho"
 inserting ".sho" (5) at end of list
 inserting ".c" (1) at end of list
+Adding suffix ".dead-end"
 inserting ".dead-end" (6) at end of list
 inserting ".short" (4) at end of list
 Wildcard expanding "all"...



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 09:51:00 UTC 2020

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

Log Message:
make(1): rename local variable s to suff

The name s was ambiguous.  It could have meant suffix, src, str, and
probably more.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.254 src/usr.bin/make/suff.c:1.255
--- src/usr.bin/make/suff.c:1.254	Sat Nov 21 09:19:46 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 09:51:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.254 2020/11/21 09:19:46 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.255 2020/11/21 09:51:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.254 2020/11/21 09:19:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.255 2020/11/21 09:51:00 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -223,24 +223,24 @@ SuffStrIsPrefix(const char *pref, const 
  * Return NULL if it ain't, pointer to the start of suffix in name if it is.
  */
 static const char *
-SuffSuffGetSuffix(const Suff *s, size_t nameLen, const char *nameEnd)
+SuffSuffGetSuffix(const Suff *suff, size_t nameLen, const char *nameEnd)
 {
 const char *p1;		/* Pointer into suffix name */
 const char *p2;		/* Pointer into string being examined */
 
-if (nameLen < s->nameLen)
+if (nameLen < suff->nameLen)
 	return NULL;		/* this string is shorter than the suffix */
 
-p1 = s->name + s->nameLen;
+p1 = suff->name + suff->nameLen;
 p2 = nameEnd;
 
-while (p1 >= s->name && *p1 == *p2) {
+while (p1 >= suff->name && *p1 == *p2) {
 	p1--;
 	p2--;
 }
 
 /* XXX: s->name - 1 invokes undefined behavior */
-return p1 == s->name - 1 ? p2 + 1 : NULL;
+return p1 == suff->name - 1 ? p2 + 1 : NULL;
 }
 
 static Boolean
@@ -669,13 +669,13 @@ SuffUpdateTarget(GNode *target, GNode **
  * This is ugly, but other makes treat all targets that start with a '.' as
  * suffix rules. */
 static void
-UpdateTargets(GNode **inout_main, Suff *s)
+UpdateTargets(GNode **inout_main, Suff *suff)
 {
 Boolean r = FALSE;
 GNodeListNode *ln;
 for (ln = Targ_List()->first; ln != NULL; ln = ln->next) {
 	GNode *gn = ln->datum;
-	if (SuffUpdateTarget(gn, inout_main, s, ))
+	if (SuffUpdateTarget(gn, inout_main, suff, ))
 	break;
 }
 }
@@ -696,29 +696,29 @@ Suff_AddSuffix(const char *name, GNode *
 {
 GNodeListNode *ln;
 
-Suff *s = FindSuffByName(name);
-if (s != NULL)
+Suff *suff = FindSuffByName(name);
+if (suff != NULL)
 	return;
 
-s = SuffNew(name);
-Lst_Append(sufflist, s);
+suff = SuffNew(name);
+Lst_Append(sufflist, suff);
 
-UpdateTargets(inout_main, s);
+UpdateTargets(inout_main, suff);
 
 /*
  * Look for any existing transformations from or to this suffix.
  * XXX: Only do this after a Suff_ClearSuffixes?
  */
 for (ln = transforms->first; ln != NULL; ln = ln->next)
-	SuffRebuildGraph(ln->datum, s);
+	SuffRebuildGraph(ln->datum, suff);
 }
 
 /* Return the search path for the given suffix, or NULL. */
 SearchPath *
 Suff_GetPath(const char *sname)
 {
-Suff *s = FindSuffByName(sname);
-return s != NULL ? s->searchPath : NULL;
+Suff *suff = FindSuffByName(sname);
+return suff != NULL ? suff->searchPath : NULL;
 }
 
 /*
@@ -746,20 +746,20 @@ Suff_DoPaths(void)
 inLibs = Lst_New();
 
 for (ln = sufflist->first; ln != NULL; ln = ln->next) {
-	Suff *s = ln->datum;
-	if (!Lst_IsEmpty(s->searchPath)) {
+	Suff *suff = ln->datum;
+	if (!Lst_IsEmpty(suff->searchPath)) {
 #ifdef INCLUDES
-	if (s->flags & SUFF_INCLUDE)
-		Dir_Concat(inIncludes, s->searchPath);
+	if (suff->flags & SUFF_INCLUDE)
+		Dir_Concat(inIncludes, suff->searchPath);
 #endif
 #ifdef LIBRARIES
-	if (s->flags & SUFF_LIBRARY)
-		Dir_Concat(inLibs, s->searchPath);
+	if (suff->flags & SUFF_LIBRARY)
+		Dir_Concat(inLibs, suff->searchPath);
 #endif
-	Dir_Concat(s->searchPath, dirSearchPath);
+	Dir_Concat(suff->searchPath, dirSearchPath);
 	} else {
-	Lst_Destroy(s->searchPath, Dir_Destroy);
-	s->searchPath = Dir_CopyDirSearchPath();
+	Lst_Destroy(suff->searchPath, Dir_Destroy);
+	suff->searchPath = Dir_CopyDirSearchPath();
 	}
 }
 
@@ -1887,13 +1887,13 @@ SuffFindDeps(GNode *gn, SrcList *slst)
 	 * set the TARGET variable to the node's name in order to give it a
 	 * value).
 	 */
-	Suff *s = FindSuffByName(LIBSUFF);
+	Suff *suff = FindSuffByName(LIBSUFF);
 	if (gn->suffix)
 	gn->suffix->refCount--;
-	if (s != NULL) {
-	gn->suffix = s;
+	if (suff != NULL) {
+	gn->suffix = suff;
 	

CVS commit: src/sys/arch/arm

2020-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 09:36:27 UTC 2020

Modified Files:
src/sys/arch/arm/iomd: iomd_irq.S
src/sys/arch/arm/ofw: ofw_irq.S
src/sys/arch/arm/sa11x0: sa11x0_irq.S

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/iomd/iomd_irq.S
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/ofw/ofw_irq.S
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/sa11x0/sa11x0_irq.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/arm/iomd/iomd_irq.S
diff -u src/sys/arch/arm/iomd/iomd_irq.S:1.16 src/sys/arch/arm/iomd/iomd_irq.S:1.17
--- src/sys/arch/arm/iomd/iomd_irq.S:1.16	Mon Dec  2 18:36:10 2013
+++ src/sys/arch/arm/iomd/iomd_irq.S	Sat Nov 21 09:36:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: iomd_irq.S,v 1.16 2013/12/02 18:36:10 joerg Exp $	*/
+/*	$NetBSD: iomd_irq.S,v 1.17 2020/11/21 09:36:26 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -199,7 +199,7 @@ Lfind_highest_ipl:
 	mvn	r2, r2
 	orr	r0, r0, r2
 
-	str	r0, [r1]	
+	str	r0, [r1]
 
 	ldr	r0, [r4, #CI_CPL]
 	str	r9, [r4, #CI_CPL]
@@ -214,7 +214,7 @@ Lfind_highest_ipl:
 
 	ldr	r7, Lirqhandlers
 
-	/* 
+	/*
 	 * take a copy of the IRQ request so that we can strip bits out of it
 	 * note that we only use 24 bits with iomd2 chips
 	 */
@@ -229,7 +229,7 @@ Lfind_highest_ipl:
 	rsb	r5, r11, #0
 	ands	r10, r11, r5
 
-	/* 
+	/*
 	 * now r10 has at most 1 set bit, call this X
 	 * if X = 0, branch to exit code
 	 */
@@ -252,7 +252,7 @@ irqloop:
 	/* fetch the bit number */
 	ldrb	r9, [r5, r9, lsr #26 ]
 
-	/* 
+	/*
 	 * r9 = irq to service
 	 */
 
@@ -271,7 +271,7 @@ irqloop:
 	moveq	r0, r8			/* IRQ requests as arg 0 */
 	adreq	lr, nextirq		/* return Address */
 	beq	_C_LABEL(stray_irqhandler) /* call special handler */
-	
+
 	/* stat info C */
 	ldr	r1, [r4, #(CI_CC_NINTR)] /* Stat info B */
 	ldr	r2, [r4, #(CI_CC_NINTR+4)]
@@ -305,9 +305,9 @@ irqchainloop:
 	ldr	pc, [r6, #(IH_FUNC)]	/* Call handler */
 
 	ldr	r6, [r6, #(IH_NEXT)]	/* fetch next handler */
-	
+
 	teq	r0, #0x0001		/* Was the irq serviced ? */
-	
+
 	/* if it was it'll just fall through this: */
 	teqne	r6, #0x
 	bne	irqchainloop

Index: src/sys/arch/arm/ofw/ofw_irq.S
diff -u src/sys/arch/arm/ofw/ofw_irq.S:1.15 src/sys/arch/arm/ofw/ofw_irq.S:1.16
--- src/sys/arch/arm/ofw/ofw_irq.S:1.15	Mon Dec  2 18:36:10 2013
+++ src/sys/arch/arm/ofw/ofw_irq.S	Sat Nov 21 09:36:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_irq.S,v 1.15 2013/12/02 18:36:10 joerg Exp $	*/
+/*	$NetBSD: ofw_irq.S,v 1.16 2020/11/21 09:36:27 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -56,11 +56,11 @@
  *
  * This function is called only on timer ticks, passed on to the
  * kernel from the OFW tick handler.
- * 
+ *
  * For now, I am trying to re-use as much of the code from the
  * IOMD interrupt-handler as possible.  In time, I will strip this
  * down to something OFW-specific.
- * 
+ *
  * Here's the original, IOMD-specific description:
  * This function reads the irq request bits in the IOMD registers
  * IRQRQA, IRQRQB and DMARQ
@@ -106,21 +106,21 @@ AST_ALIGNMENT_FAULT_LOCALS
 ASENTRY_NP(irq_entry)
 	/*
 	 *  We come here following an OFW-handled timer tick.
-	 *  
+	 *
  	 *  We are in the SVC frame, and interrupts are disabled.
  	 *  The state of the interrupted context is partially in
  	 *  the registers and partially in the global storage area
  	 *  labeled ofw_ticktmp.  ofw_ticktmp is filled-in by the
  	 *  tick callback that is invoked by OFW on the way out of
  	 *  its interrupt handler.  ofw_ticktmp contains the following:
- 	 *  
+ 	 *
  	 *  pc			// interrupted instruction
  	 *  lr_usr
  	 *  sp_usr
  	 *  r1			// makes r1 available for scratch
  	 *  r0			// makes r0 available for scratch
  	 *  spsr_svc		// cpsr of interrupted context
- 	 *  
+ 	 *
  	 *  The prologue of this routine must re-construct the
  	 *  machine state that existed at the time OFW's interrupt-
  	 *  handler fielded the interrupt.  That allows us to use
@@ -177,7 +177,7 @@ ASENTRY_NP(irq_entry)
 	PULLFRAMEFROMSVCANDEXIT
 	movs	pc, lr			/* Exit */
 
- 	/*  
+ 	/*
  	 *  Stuff a bit-mask into r8 indicating which interrupts
  	 *  are pending.  In our case, that is just the timer0
  	 *  interrupt:  (1 << TIMER0).  The existing code will take
@@ -238,7 +238,7 @@ Lfind_highest_ipl:
 	mvn	r2, r2
 	orr	r0, r0, r2
 
-	str	r0, [r1]	
+	str	r0, [r1]
 
 	ldr	r0, Lcurrent_spl_level
 	ldr	r1, [r4, #CI_CPL]
@@ -348,7 +348,7 @@ Lirqhandlers:
 	.text
 	.global	_C_LABEL(dotickgrovelling)
 
-/* 
+/*
  *  Do magic to cause OFW to call our irq_entry
  *  routine when it returns from its tick-handling.
  *
@@ -362,16 +362,16 @@ Lirqhandlers:
  *
  *  r0 - base of saved OFW interrupt frame, which
  *   has the following format:
- *  
+ *
  * pc			// interrupted instruction
  

CVS commit: src/games/warp

2020-11-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Nov 21 09:24:02 UTC 2020

Modified Files:
src/games/warp: util.h

Log Message:
roundsleep(): Too many zeros; tv_nsec should be compared with
500 msec, not 5000. Raised by clang for ILP32 archs.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/games/warp/util.h

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

Modified files:

Index: src/games/warp/util.h
diff -u src/games/warp/util.h:1.6 src/games/warp/util.h:1.7
--- src/games/warp/util.h:1.6	Thu Nov 12 22:23:16 2020
+++ src/games/warp/util.h	Sat Nov 21 09:24:02 2020
@@ -18,7 +18,7 @@
 /* we get fractions of seconds from calling ftime on timebuf */
 
 extern struct timespec timebuf;
-#define roundsleep(x) (clock_gettime(CLOCK_REALTIME, ),sleep(timebuf.tv_nsec > 50 ?x+1:x))
+#define roundsleep(x) (clock_gettime(CLOCK_REALTIME, ),sleep(timebuf.tv_nsec > (500 * 1000 * 1000) ?x+1:x))
 
 #define waiting 0
 



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 09:19:46 UTC 2020

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

Log Message:
make(1): make debug logging more precise in Suff_EndTransform


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.253 src/usr.bin/make/suff.c:1.254
--- src/usr.bin/make/suff.c:1.253	Sat Nov 21 09:16:44 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 09:19:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.253 2020/11/21 09:16:44 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.254 2020/11/21 09:19:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.253 2020/11/21 09:16:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.254 2020/11/21 09:19:46 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -562,12 +562,11 @@ Suff_EndTransform(GNode *gn)
 if (!SuffParseTransform(gn->name, , ))
 	return;
 
-/* Remember parents since srcSuff could be deleted in SuffList_Remove. */
-srcSuffParents = srcSuff->parents;
-
-SUFF_DEBUG2("deleting transformation from `%s' to `%s'\n",
+SUFF_DEBUG2("deleting incomplete transformation from `%s' to `%s'\n",
 		srcSuff->name, targSuff->name);
 
+/* Remember parents since srcSuff could be deleted in SuffList_Remove. */
+srcSuffParents = srcSuff->parents;
 SuffList_Remove(targSuff->children, srcSuff);
 SuffList_Remove(srcSuffParents, targSuff);
 }



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 09:16:44 UTC 2020

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

Log Message:
make(1): flatten Suff_EndTransform

This avoids the duplicate code for testing OP_TRANSFORM.


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.252 src/usr.bin/make/suff.c:1.253
--- src/usr.bin/make/suff.c:1.252	Sat Nov 21 08:23:36 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 09:16:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.252 2020/11/21 08:23:36 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.253 2020/11/21 09:16:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.252 2020/11/21 08:23:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.253 2020/11/21 09:16:44 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -541,35 +541,35 @@ Suff_AddTransform(const char *name)
 void
 Suff_EndTransform(GNode *gn)
 {
+Suff *srcSuff, *targSuff;
+SuffList *srcSuffParents;
+
 if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
 	gn = gn->cohorts->last->datum;
 
-if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
-	Lst_IsEmpty(gn->children))
-{
-	Suff *srcSuff, *targSuff;
+if (!(gn->type & OP_TRANSFORM))
+	return;
 
-	/*
-	 * SuffParseTransform() may fail for special rules which are not
-	 * actual transformation rules. (e.g. .DEFAULT)
-	 */
-	if (SuffParseTransform(gn->name, , )) {
+if (!Lst_IsEmpty(gn->commands) || !Lst_IsEmpty(gn->children)) {
+	SUFF_DEBUG1("transformation %s complete\n", gn->name);
+	return;
+}
 
-	/*
-	 * Remember parents since srcSuff could be deleted in
-	 * SuffList_Remove
-	 */
-	SuffList *srcSuffParents = srcSuff->parents;
+/*
+ * SuffParseTransform() may fail for special rules which are not
+ * actual transformation rules. (e.g. .DEFAULT)
+ */
+if (!SuffParseTransform(gn->name, , ))
+	return;
 
-	SUFF_DEBUG2("deleting transformation from `%s' to `%s'\n",
-			srcSuff->name, targSuff->name);
+/* Remember parents since srcSuff could be deleted in SuffList_Remove. */
+srcSuffParents = srcSuff->parents;
 
-	SuffList_Remove(targSuff->children, srcSuff);
-	SuffList_Remove(srcSuffParents, targSuff);
-	}
-} else if (gn->type & OP_TRANSFORM) {
-	SUFF_DEBUG1("transformation %s complete\n", gn->name);
-}
+SUFF_DEBUG2("deleting transformation from `%s' to `%s'\n",
+		srcSuff->name, targSuff->name);
+
+SuffList_Remove(targSuff->children, srcSuff);
+SuffList_Remove(srcSuffParents, targSuff);
 }
 
 /* Called from Suff_AddSuffix to search through the list of



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

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 08:51:57 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: suff-rebuild.exp suff-rebuild.mk

Log Message:
make(1): make output of test suff-rebuild more verbose


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

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/suff-rebuild.exp
diff -u src/usr.bin/make/unit-tests/suff-rebuild.exp:1.1 src/usr.bin/make/unit-tests/suff-rebuild.exp:1.2
--- src/usr.bin/make/unit-tests/suff-rebuild.exp:1.1	Fri Sep 25 18:18:25 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.exp	Sat Nov 21 08:51:57 2020
@@ -1,5 +1,5 @@
-: from nothing to a
-: from a to b
-: from b to c
-: from c to nothing
+: Making suff-rebuild-example.a out of nothing.
+: Making suff-rebuild-example.b from suff-rebuild-example.a.
+: Making suff-rebuild-example.c from suff-rebuild-example.b.
+: Making suff-rebuild-example from suff-rebuild-example.c.
 exit status 0

Index: src/usr.bin/make/unit-tests/suff-rebuild.mk
diff -u src/usr.bin/make/unit-tests/suff-rebuild.mk:1.3 src/usr.bin/make/unit-tests/suff-rebuild.mk:1.4
--- src/usr.bin/make/unit-tests/suff-rebuild.mk:1.3	Sat Nov 21 08:23:36 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.mk	Sat Nov 21 08:51:57 2020
@@ -1,4 +1,4 @@
-# $NetBSD: suff-rebuild.mk,v 1.3 2020/11/21 08:23:36 rillig Exp $
+# $NetBSD: suff-rebuild.mk,v 1.4 2020/11/21 08:51:57 rillig Exp $
 #
 # Demonstrates what happens to transformation rules (called inference rules
 # by POSIX) when all suffixes are deleted.
@@ -10,14 +10,14 @@ all: suff-rebuild-example
 .SUFFIXES: .a .b .c
 
 suff-rebuild-example.a:
-	: from nothing to a
+	: Making ${.TARGET} out of nothing.
 
 .a.b:
-	: from a to b
+	: Making ${.TARGET} from ${.IMPSRC}.
 .b.c:
-	: from b to c
+	: Making ${.TARGET} from ${.IMPSRC}.
 .c:
-	: from c to nothing
+	: Making ${.TARGET} from ${.IMPSRC}.
 
 # XXX: At a quick glance, the code in SuffUpdateTarget looks as if it were
 # possible to delete the suffixes in the middle of the makefile, add back



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 08:23:36 UTC 2020

Modified Files:
src/usr.bin/make: suff.c
src/usr.bin/make/unit-tests: suff-rebuild.mk

Log Message:
make(1): rename SuffScanTargets to SuffUpdateTarget

The word "scan" no longer applies to this function since that is done by
SuffUpdateTargets instead.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/usr.bin/make/suff.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/suff-rebuild.mk

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/suff.c
diff -u src/usr.bin/make/suff.c:1.251 src/usr.bin/make/suff.c:1.252
--- src/usr.bin/make/suff.c:1.251	Sat Nov 21 08:01:20 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 08:23:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.251 2020/11/21 08:01:20 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.252 2020/11/21 08:23:36 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.251 2020/11/21 08:01:20 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.252 2020/11/21 08:23:36 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -627,7 +627,7 @@ SuffRebuildGraph(GNode *transform, Suff 
  *	TRUE iff a new main target has been selected.
  */
 static Boolean
-SuffScanTargets(GNode *target, GNode **inout_main, Suff *suff, Boolean *r)
+SuffUpdateTarget(GNode *target, GNode **inout_main, Suff *suff, Boolean *r)
 {
 Suff *srcSuff, *targSuff;
 char *ptr;
@@ -676,7 +676,7 @@ UpdateTargets(GNode **inout_main, Suff *
 GNodeListNode *ln;
 for (ln = Targ_List()->first; ln != NULL; ln = ln->next) {
 	GNode *gn = ln->datum;
-	if (SuffScanTargets(gn, inout_main, s, ))
+	if (SuffUpdateTarget(gn, inout_main, s, ))
 	break;
 }
 }

Index: src/usr.bin/make/unit-tests/suff-rebuild.mk
diff -u src/usr.bin/make/unit-tests/suff-rebuild.mk:1.2 src/usr.bin/make/unit-tests/suff-rebuild.mk:1.3
--- src/usr.bin/make/unit-tests/suff-rebuild.mk:1.2	Sun Oct 18 16:12:39 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.mk	Sat Nov 21 08:23:36 2020
@@ -1,4 +1,4 @@
-# $NetBSD: suff-rebuild.mk,v 1.2 2020/10/18 16:12:39 rillig Exp $
+# $NetBSD: suff-rebuild.mk,v 1.3 2020/11/21 08:23:36 rillig Exp $
 #
 # Demonstrates what happens to transformation rules (called inference rules
 # by POSIX) when all suffixes are deleted.
@@ -19,7 +19,7 @@ suff-rebuild-example.a:
 .c:
 	: from c to nothing
 
-# XXX: At a quick glance, the code in SuffScanTargets looks as if it were
+# XXX: At a quick glance, the code in SuffUpdateTarget looks as if it were
 # possible to delete the suffixes in the middle of the makefile, add back
 # the suffixes from before, and have the transformation rules preserved.
 #



CVS commit: src/sys/kern

2020-11-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 21 08:10:27 UTC 2020

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

Log Message:
Restore missing message for RB_ASKNAME.
Cleanups.


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/sys/kern/kern_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/sys/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.228 src/sys/kern/kern_subr.c:1.229
--- src/sys/kern/kern_subr.c:1.228	Wed Jan  1 22:57:17 2020
+++ src/sys/kern/kern_subr.c	Sat Nov 21 08:10:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_subr.c,v 1.228 2020/01/01 22:57:17 thorpej Exp $	*/
+/*	$NetBSD: kern_subr.c,v 1.229 2020/11/21 08:10:27 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.228 2020/01/01 22:57:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.229 2020/11/21 08:10:27 mlelstv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -445,8 +445,20 @@ setroot_ask(device_t bootdv, int bootpar
 		}
 	}
 
+	switch (device_class(rootdv)) {
+	case DV_IFNET:
+	case DV_DISK:
+		aprint_normal("root on %s", device_xname(rootdv));
+		if (DEV_USES_PARTITIONS(rootdv))
+			aprint_normal("%c", (int)DISKPART(rootdev) + 'a');
+		break;
+	default:
+		printf("can't determine root device\n");
+		return;
+	}
+
 	root_device = rootdv;
-	setroot_dump(root_device, dumpdv);
+	setroot_dump(rootdv, dumpdv);
 }
 
 /*



CVS commit: src/sys/crypto/aes/arch/arm

2020-11-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Nov 21 08:09:21 UTC 2020

Modified Files:
src/sys/crypto/aes/arch/arm: aes_neon.c

Log Message:
Fix build with clang for earmv7hf; loadroundkey() is used only for __aarch64__.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/crypto/aes/arch/arm/aes_neon.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/crypto/aes/arch/arm/aes_neon.c
diff -u src/sys/crypto/aes/arch/arm/aes_neon.c:1.5 src/sys/crypto/aes/arch/arm/aes_neon.c:1.6
--- src/sys/crypto/aes/arch/arm/aes_neon.c:1.5	Sat Aug  8 14:47:01 2020
+++ src/sys/crypto/aes/arch/arm/aes_neon.c	Sat Nov 21 08:09:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aes_neon.c,v 1.5 2020/08/08 14:47:01 riastradh Exp $	*/
+/*	$NetBSD: aes_neon.c,v 1.6 2020/11/21 08:09:21 rin Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aes_neon.c,v 1.5 2020/08/08 14:47:01 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aes_neon.c,v 1.6 2020/11/21 08:09:21 rin Exp $");
 
 #include 
 
@@ -196,11 +196,13 @@ inv	= VQ_N_U8(0x80,0x01,0x08,0x0D,0x0F,0
 inva	= VQ_N_U8(0x80,0x07,0x0B,0x0F,0x06,0x0A,0x04,0x01,
 	0x09,0x08,0x05,0x02,0x0C,0x0E,0x0D,0x03);
 
+#ifdef __aarch64__
 static inline uint8x16_t
 loadroundkey(const void *rkp)
 {
 	return vld1q_u8(rkp);
 }
+#endif
 
 static inline void
 storeroundkey(void *rkp, uint8x16_t rk)



CVS commit: src/usr.bin/make

2020-11-21 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov 21 08:01:20 UTC 2020

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

Log Message:
make(1): clean up parameter names for SuffScanTargets

The prefix "gs" came from a time when SuffScanTargets was called via
Lst_ForEach, passing it a struct GNodeSuff.  The "gs" had just been the
abbreviation for "GNode + Suff", which was already non-expressive.  On
top of that, the struct had a third field "r", also with an unclear name,
which was not even mentioned in the name of the struct.

For now, just remove the needless prefix since it has absolutely no
meaning anymore.  Maybe it will become clear what the "r" was supposed to
mean, it could be some kind of "result".


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.250 src/usr.bin/make/suff.c:1.251
--- src/usr.bin/make/suff.c:1.250	Thu Nov 19 21:27:29 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 08:01:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.250 2020/11/19 21:27:29 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.251 2020/11/21 08:01:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.250 2020/11/19 21:27:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.251 2020/11/21 08:01:20 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -627,12 +627,12 @@ SuffRebuildGraph(GNode *transform, Suff 
  *	TRUE iff a new main target has been selected.
  */
 static Boolean
-SuffScanTargets(GNode *target, GNode **inout_main, Suff *gs_s, Boolean *gs_r)
+SuffScanTargets(GNode *target, GNode **inout_main, Suff *suff, Boolean *r)
 {
 Suff *srcSuff, *targSuff;
 char *ptr;
 
-if (*inout_main == NULL && *gs_r && !(target->type & OP_NOTARGET)) {
+if (*inout_main == NULL && *r && !(target->type & OP_NOTARGET)) {
 	*inout_main = target;
 	Targ_SetMain(target);
 	return TRUE;
@@ -641,13 +641,13 @@ SuffScanTargets(GNode *target, GNode **i
 if (target->type == OP_TRANSFORM)
 	return FALSE;
 
-if ((ptr = strstr(target->name, gs_s->name)) == NULL ||
+if ((ptr = strstr(target->name, suff->name)) == NULL ||
 	ptr == target->name)
 	return FALSE;
 
 if (SuffParseTransform(target->name, , )) {
 	if (*inout_main == target) {
-	*gs_r = TRUE;
+	*r = TRUE;
 	*inout_main = NULL;
 	Targ_SetMain(NULL);
 	}