CVS commit: src/sys/dev/ic

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  8 05:20:14 UTC 2023

Modified Files:
src/sys/dev/ic: apple_smc.c apple_smc_temp.c

Log Message:
fix array vs pointer function declaration.

also, in some callers, and make sure to provide all the accessed
backing for a string array.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/apple_smc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/apple_smc_temp.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/ic/apple_smc.c
diff -u src/sys/dev/ic/apple_smc.c:1.8 src/sys/dev/ic/apple_smc.c:1.9
--- src/sys/dev/ic/apple_smc.c:1.8	Sat Aug  7 16:19:12 2021
+++ src/sys/dev/ic/apple_smc.c	Tue Aug  8 05:20:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: apple_smc.c,v 1.8 2021/08/07 16:19:12 thorpej Exp $	*/
+/*	$NetBSD: apple_smc.c,v 1.9 2023/08/08 05:20:14 mrg Exp $	*/
 
 /*
  * Apple System Management Controller
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apple_smc.c,v 1.8 2021/08/07 16:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apple_smc.c,v 1.9 2023/08/08 05:20:14 mrg Exp $");
 
 #include 
 #include 
@@ -476,7 +476,7 @@ apple_smc_release_key(struct apple_smc_t
 }
 
 int
-apple_smc_key_search(struct apple_smc_tag *smc, const char *name,
+apple_smc_key_search(struct apple_smc_tag *smc, const char name[4 + 1],
 uint32_t *result)
 {
 	struct apple_smc_key *key;

Index: src/sys/dev/ic/apple_smc_temp.c
diff -u src/sys/dev/ic/apple_smc_temp.c:1.6 src/sys/dev/ic/apple_smc_temp.c:1.7
--- src/sys/dev/ic/apple_smc_temp.c:1.6	Wed Jun 29 15:58:12 2022
+++ src/sys/dev/ic/apple_smc_temp.c	Tue Aug  8 05:20:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: apple_smc_temp.c,v 1.6 2022/06/29 15:58:12 mlelstv Exp $	*/
+/*	$NetBSD: apple_smc_temp.c,v 1.7 2023/08/08 05:20:14 mrg Exp $	*/
 
 /*
  * Apple System Management Controller: Temperature Sensors
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apple_smc_temp.c,v 1.6 2022/06/29 15:58:12 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apple_smc_temp.c,v 1.7 2023/08/08 05:20:14 mrg Exp $");
 
 #include 
 #include 
@@ -425,12 +425,12 @@ apple_smc_bound_temp_sensors(struct appl
 	int error;
 
 	/* Find the first `T...' key.  */
-	error = apple_smc_key_search(smc, "T", tstart);
+	error = apple_smc_key_search(smc, "T\0\0\0", tstart);
 	if (error)
 		return error;
 
 	/* Find the first `U...' key.  */
-	error = apple_smc_key_search(smc, "U", ustart);
+	error = apple_smc_key_search(smc, "U\0\0\0", ustart);
 	if (error)
 		return error;
 



CVS commit: src/sys/dev/ic

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  8 05:20:14 UTC 2023

Modified Files:
src/sys/dev/ic: apple_smc.c apple_smc_temp.c

Log Message:
fix array vs pointer function declaration.

also, in some callers, and make sure to provide all the accessed
backing for a string array.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/apple_smc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/apple_smc_temp.c

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



CVS commit: src/share/mk

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  8 03:44:12 UTC 2023

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
put amd64 back to GDB 11.  it doesn't build for me, or others.

the first problem is that this rule:

GDBvn.texi: ${DIST}/gdb/version.in
echo "@set GDBVN $$(${TOOL_CAT} ${.ALLSRC})" > ${.TARGET}

conflicts with the "GDBvn.texi" in the source tree and fail to write
this file with r/o source trees.

the second problem is that gdbserver fails to link because it compiles
the wrong file to create target.o.  this seems like a very bad make or
bsd.*.mk bug -- "SRCS= .. target.cc ...", and yet, make manages to
compile the file "target.c" to create target.o, and then the required
symbols the rest of gdbserver needs are missing.

the third problem is that when you make it build the right target.cc,
it wants bfd.h, and gmp.h, and even after solving those issues, i'm
still getting a fourth issue linking gdbserver and thus reverting.


To generate a diff of this commit:
cvs rdiff -u -r1.1350 -r1.1351 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1350 src/share/mk/bsd.own.mk:1.1351
--- src/share/mk/bsd.own.mk:1.1350	Sun Aug  6 20:44:49 2023
+++ src/share/mk/bsd.own.mk	Tue Aug  8 03:44:12 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1350 2023/08/06 20:44:49 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1351 2023/08/08 03:44:12 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -119,7 +119,7 @@ EXTERNAL_BINUTILS_SUBDIR=	/does/not/exis
 #
 # What GDB is used?
 #
-.if ${MACHINE_ARCH} == "x86_64"
+.if ${MACHINE_ARCH} == "x86_64" && 0
 HAVE_GDB?=	1320
 .else
 HAVE_GDB?=	1100



CVS commit: src/share/mk

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  8 03:44:12 UTC 2023

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
put amd64 back to GDB 11.  it doesn't build for me, or others.

the first problem is that this rule:

GDBvn.texi: ${DIST}/gdb/version.in
echo "@set GDBVN $$(${TOOL_CAT} ${.ALLSRC})" > ${.TARGET}

conflicts with the "GDBvn.texi" in the source tree and fail to write
this file with r/o source trees.

the second problem is that gdbserver fails to link because it compiles
the wrong file to create target.o.  this seems like a very bad make or
bsd.*.mk bug -- "SRCS= .. target.cc ...", and yet, make manages to
compile the file "target.c" to create target.o, and then the required
symbols the rest of gdbserver needs are missing.

the third problem is that when you make it build the right target.cc,
it wants bfd.h, and gmp.h, and even after solving those issues, i'm
still getting a fourth issue linking gdbserver and thus reverting.


To generate a diff of this commit:
cvs rdiff -u -r1.1350 -r1.1351 src/share/mk/bsd.own.mk

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



CVS commit: src/lib/libm

2023-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug  8 02:09:43 UTC 2023

Modified Files:
src/lib/libm: Makefile

Log Message:
libm: Add fma(3) and friends to m68k


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/lib/libm/Makefile

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

Modified files:

Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.220 src/lib/libm/Makefile:1.221
--- src/lib/libm/Makefile:1.220	Sun Jul  9 03:57:09 2023
+++ src/lib/libm/Makefile	Tue Aug  8 02:09:42 2023
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.220 2023/07/09 03:57:09 rin Exp $
+#  $NetBSD: Makefile,v 1.221 2023/08/08 02:09:42 rin Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -161,6 +161,7 @@ ARCH_SRCS = e_acos.S e_asin.S e_atanh.S 
 COMMON_SRCS += fenv.c s_nexttoward.c s_rintl.c
 .endif
 .endif
+COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
 # end of m68k
 
 .elif (${LIBC_MACHINE_ARCH} == "vax")



CVS commit: src/lib/libm

2023-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Aug  8 02:09:43 UTC 2023

Modified Files:
src/lib/libm: Makefile

Log Message:
libm: Add fma(3) and friends to m68k


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/lib/libm/Makefile

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



re: CVS commit: src/share/mk

2023-08-07 Thread matthew green
Valery Ushakov writes:
> On Mon, Aug 07, 2023 at 23:58:50 +0200, Tobias Nygren wrote:
>
> > Is this sort of fix acceptable for the above cases?
> [...]
> > +   ptrdiff_t offset = pos - buf;
> [...]
> > -   pos = new_buf + (pos - buf);
> > +   pos = new_buf + offset;
>
> I think so.  But e.g. in this particular case I don't see why pos
> pointer is needed at all.  If pos is made into a size_t pos; index
> into the buf instead of a separate pointer, one avoids the whole thing
> and "end" can be g/c'ed too, b/c you can just compare the index to the
> "buf_size".  But the above kind of fix has the advantage of being more
> or less mechanical.

yup, i agree.  if we can fix it better, please do, but i'm all for
making it "less bad" if not properly fixed like the above.

i've used this idiom in a couple of places, but didn't quite get it
working in several others.

these are the problematic files i've see:

lib/libc/net/gethnamaddr.c
lib/libedit/chartype.c
lib/libkvm/kvm_proc.c
usr.bin/find/misc.c
usr.bin/mail/fio.c
external/bsd/pdisk/dist/io.c
usr.bin/rs/rs.c
usr.bin/sort/files.c

the first 3 i worked around, eg below, but i think i only tested
the gethnamaddr.c portion so far.


.mrg.


Index: lib/libc/net/gethnamaddr.c
===
RCS file: /cvsroot/src/lib/libc/net/gethnamaddr.c,v
retrieving revision 1.94
diff -p -u -r1.94 gethnamaddr.c
--- lib/libc/net/gethnamaddr.c  19 Apr 2022 20:32:15 -  1.94
+++ lib/libc/net/gethnamaddr.c  7 Aug 2023 23:41:44 -
@@ -110,10 +110,11 @@ __weak_alias(gethostent,_gethostent)
 
 #define addalias(d, s, arr, siz) do {  \
if (d >= [siz]) {   \
+   size_t _off = d - arr;  \
char **xptr = realloc(arr, (siz + 10) * sizeof(*arr)); \
if (xptr == NULL)   \
goto nospc; \
-   d = xptr + (d - arr);   \
+   d = xptr + _off;\
arr = xptr; \
siz += 10;  \
}   \
Index: lib/libedit/chartype.c
===
RCS file: /cvsroot/src/lib/libedit/chartype.c,v
retrieving revision 1.36
diff -p -u -r1.36 chartype.c
--- lib/libedit/chartype.c  30 Oct 2022 19:11:31 -  1.36
+++ lib/libedit/chartype.c  7 Aug 2023 23:41:44 -
@@ -235,17 +235,17 @@ ct_visual_string(const wchar_t *s, ct_bu
}
 
/* failed to encode, need more buffer space */
-   used = dst - conv->wbuff;
+   size_t sused = (uintptr_t)dst - (uintptr_t)conv->wbuff;
if (ct_conv_wbuff_resize(conv, conv->wsize + CT_BUFSIZ) == -1)
return NULL;
-   dst = conv->wbuff + used;
+   dst = conv->wbuff + sused;
}
 
if (dst >= (conv->wbuff + conv->wsize)) { /* sigh */
-   used = dst - conv->wbuff;
+   size_t sused = (uintptr_t)dst - (uintptr_t)conv->wbuff;
if (ct_conv_wbuff_resize(conv, conv->wsize + CT_BUFSIZ) == -1)
return NULL;
-   dst = conv->wbuff + used;
+   dst = conv->wbuff + sused;
}
 
*dst = L'\0';
Index: lib/libkvm/kvm_proc.c
===
RCS file: /cvsroot/src/lib/libkvm/kvm_proc.c,v
retrieving revision 1.98
diff -p -u -r1.98 kvm_proc.c
--- lib/libkvm/kvm_proc.c   19 Apr 2022 20:32:16 -  1.98
+++ lib/libkvm/kvm_proc.c   7 Aug 2023 23:41:44 -
@@ -980,7 +980,7 @@ kvm_argv(kvm_t *kd, const struct minipro
if (len + cc > kd->argspc_len) {
ptrdiff_t off;
char **pp;
-   char *op = kd->argspc;
+   uintptr_t op = (uintptr_t)kd->argspc;
 
kd->argspc_len *= 2;
kd->argspc = _kvm_realloc(kd, kd->argspc,
@@ -991,7 +991,7 @@ kvm_argv(kvm_t *kd, const struct minipro
 * Adjust argv pointers in case realloc moved
 * the string space.
 */
-   off = kd->argspc - op;
+   off = (uintptr_t)kd->argspc - op;
for (pp = kd->argv; pp < argv; pp++)
*pp += off;
ap += off;


Re: Restoring pointers after realloc (was: Re: CVS commit: src/share/mk)

2023-08-07 Thread Valery Ushakov
On Tue, Aug 08, 2023 at 00:44:41 +0200, Roland Illig wrote:

> Am 07.08.2023 um 23:58 schrieb Tobias Nygren:
> > Is this sort of fix acceptable for the above cases?
> >
> > +   ptrdiff_t offset = pos - buf;
> > new_buf = realloc(buf, buf_size);
> > -   pos = new_buf + (pos - buf);
> > +   pos = new_buf + offset;
> 
> Yes.
> 
> Instead of ptrdiff_t, I prefer to use size_t to avoid having to include
> , even if that means an additional type cast at WARNS=6 level:
> 
> > +   size_t offset = (size_t)(pos - buf);

I just had a massive cognitive dissonance moment... :)


-uwe


CVS commit: src/usr.bin/telnet

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:31:11 UTC 2023

Modified Files:
src/usr.bin/telnet: ring.c

Log Message:
remove always-true part of condition.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/telnet/ring.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/telnet/ring.c
diff -u src/usr.bin/telnet/ring.c:1.15 src/usr.bin/telnet/ring.c:1.16
--- src/usr.bin/telnet/ring.c:1.15	Fri Dec 14 23:40:17 2018
+++ src/usr.bin/telnet/ring.c	Mon Aug  7 23:31:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ring.c,v 1.15 2018/12/14 23:40:17 christos Exp $	*/
+/*	$NetBSD: ring.c,v 1.16 2023/08/07 23:31:11 mrg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)ring.c	8.2 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: ring.c,v 1.15 2018/12/14 23:40:17 christos Exp $");
+__RCSID("$NetBSD: ring.c,v 1.16 2023/08/07 23:31:11 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -179,8 +179,7 @@ ring_consumed(Ring *ring, int count)
 		ring->clearto <= ring->consume + count)
 	ring->clearto = 0;
 else if (ring->consume + count > ring->top &&
-		ring->bottom <= ring->clearto &&
-		ring->bottom + ((ring->consume + count) - ring->top))
+		ring->bottom <= ring->clearto)
 	ring->clearto = 0;
 #endif	/* ENCRYPTION */
 ring->consume = ring_increment(ring, ring->consume, count);



CVS commit: src/usr.bin/telnet

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:31:11 UTC 2023

Modified Files:
src/usr.bin/telnet: ring.c

Log Message:
remove always-true part of condition.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/telnet/ring.c

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



CVS commit: src/tests/lib/libbpfjit

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:29:58 UTC 2023

Modified Files:
src/tests/lib/libbpfjit: t_bpfjit.c

Log Message:
avoid uninitialised variable.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libbpfjit/t_bpfjit.c

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

Modified files:

Index: src/tests/lib/libbpfjit/t_bpfjit.c
diff -u src/tests/lib/libbpfjit/t_bpfjit.c:1.14 src/tests/lib/libbpfjit/t_bpfjit.c:1.15
--- src/tests/lib/libbpfjit/t_bpfjit.c:1.14	Sat Feb 14 22:40:18 2015
+++ src/tests/lib/libbpfjit/t_bpfjit.c	Mon Aug  7 23:29:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_bpfjit.c,v 1.14 2015/02/14 22:40:18 alnsn Exp $ */
+/*	$NetBSD: t_bpfjit.c,v 1.15 2023/08/07 23:29:58 mrg Exp $ */
 
 /*-
  * Copyright (c) 2011-2012, 2014-2015 Alexander Nasonov.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_bpfjit.c,v 1.14 2015/02/14 22:40:18 alnsn Exp $");
+__RCSID("$NetBSD: t_bpfjit.c,v 1.15 2023/08/07 23:29:58 mrg Exp $");
 
 #include 
 #include 
@@ -65,7 +65,7 @@ ATF_TC_HEAD(libbpfjit_empty, tc)
 
 ATF_TC_BODY(libbpfjit_empty, tc)
 {
-	struct bpf_insn dummy;
+	struct bpf_insn dummy = { 0 };
 
 	ATF_CHECK(!bpf_validate(, 0));
 	ATF_CHECK(bpfjit_generate_code(NULL, , 0) == NULL);



CVS commit: src/tests/lib/libbpfjit

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:29:58 UTC 2023

Modified Files:
src/tests/lib/libbpfjit: t_bpfjit.c

Log Message:
avoid uninitialised variable.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libbpfjit/t_bpfjit.c

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



CVS commit: src/sys/arch/hpcmips/vr

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:29:23 UTC 2023

Modified Files:
src/sys/arch/hpcmips/vr: vrc4172gpio.c

Log Message:
fix mis-matched function prototype and definitions.

found by GCC 12.


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

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



CVS commit: src/sys/arch/hpcmips/vr

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:29:23 UTC 2023

Modified Files:
src/sys/arch/hpcmips/vr: vrc4172gpio.c

Log Message:
fix mis-matched function prototype and definitions.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hpcmips/vr/vrc4172gpio.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/vr/vrc4172gpio.c
diff -u src/sys/arch/hpcmips/vr/vrc4172gpio.c:1.18 src/sys/arch/hpcmips/vr/vrc4172gpio.c:1.19
--- src/sys/arch/hpcmips/vr/vrc4172gpio.c:1.18	Sat May  6 21:34:40 2023
+++ src/sys/arch/hpcmips/vr/vrc4172gpio.c	Mon Aug  7 23:29:22 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vrc4172gpio.c,v 1.18 2023/05/06 21:34:40 andvar Exp $	*/
+/*	$NetBSD: vrc4172gpio.c,v 1.19 2023/08/07 23:29:22 mrg Exp $	*/
 /*-
  * Copyright (c) 2001 TAKEMRUA Shin. All rights reserved.
  *
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vrc4172gpio.c,v 1.18 2023/05/06 21:34:40 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vrc4172gpio.c,v 1.19 2023/08/07 23:29:22 mrg Exp $");
 
 #include 
 #include 
@@ -118,7 +118,7 @@ static u_int16_t read_2(struct vrc4172gp
 static void write_2(struct vrc4172gpio_softc *, bus_addr_t, u_int16_t);
 static u_int32_t read_4(struct vrc4172gpio_softc *, bus_addr_t);
 static void write_4(struct vrc4172gpio_softc *, bus_addr_t, u_int32_t);
-static void dumpbits(u_int32_t*, int, int, int, const char[2]);
+static void dumpbits(u_int32_t*, int, int, int, const char *);
 
 static struct hpcio_chip vrc4172gpio_iochip = {
 	.hc_portread =		vrc4172gpio_port_read,



CVS commit: src/sys

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:28:58 UTC 2023

Modified Files:
src/sys/arch/atari/dev: ncr5380var.h
src/sys/arch/hp300/dev: intiovar.h
src/sys/dist/pf/net: pf_norm.c
src/sys/netinet: dccp_tfrc.c

Log Message:
fix indentation issues.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/atari/dev/ncr5380var.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/dev/intiovar.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dist/pf/net/pf_norm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/netinet/dccp_tfrc.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/atari/dev/ncr5380var.h
diff -u src/sys/arch/atari/dev/ncr5380var.h:1.9 src/sys/arch/atari/dev/ncr5380var.h:1.10
--- src/sys/arch/atari/dev/ncr5380var.h:1.9	Fri Jan  6 10:28:28 2023
+++ src/sys/arch/atari/dev/ncr5380var.h	Mon Aug  7 23:28:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr5380var.h,v 1.9 2023/01/06 10:28:28 tsutsui Exp $	*/
+/*	$NetBSD: ncr5380var.h,v 1.10 2023/08/07 23:28:58 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -63,7 +63,7 @@ static const char *last_hit[DBG_PID];
 		int i;			\
 		for (i = 0; i < DBG_PID - 1; i++)			\
 			last_hit[i] = last_hit[i + 1];			\
-			last_hit[DBG_PID - 1] = a;			\
+		last_hit[DBG_PID - 1] = a;\
 	}\
 	/* olast_hit = last_hit; last_hit = a; */
 #else

Index: src/sys/arch/hp300/dev/intiovar.h
diff -u src/sys/arch/hp300/dev/intiovar.h:1.13 src/sys/arch/hp300/dev/intiovar.h:1.14
--- src/sys/arch/hp300/dev/intiovar.h:1.13	Mon Apr 28 20:23:19 2008
+++ src/sys/arch/hp300/dev/intiovar.h	Mon Aug  7 23:28:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intiovar.h,v 1.13 2008/04/28 20:23:19 martin Exp $	*/
+/*	$NetBSD: intiovar.h,v 1.14 2023/08/07 23:28:58 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1998, 2001 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@ intio_device_writecmd(bus_space_tag_t bs
 	WAIT(bst, bsh);
 	bus_space_write_1(bst, bsh, INTIO_DEV_3xx_CMD, cmd);
 	while (len--) {
-	WAIT(bst, bsh);
+		WAIT(bst, bsh);
 		bus_space_write_1(bst, bsh, INTIO_DEV_3xx_DATA, *datap++);
 	}
 	return (0);

Index: src/sys/dist/pf/net/pf_norm.c
diff -u src/sys/dist/pf/net/pf_norm.c:1.29 src/sys/dist/pf/net/pf_norm.c:1.30
--- src/sys/dist/pf/net/pf_norm.c:1.29	Mon Mar  8 23:34:58 2021
+++ src/sys/dist/pf/net/pf_norm.c	Mon Aug  7 23:28:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pf_norm.c,v 1.29 2021/03/08 23:34:58 christos Exp $	*/
+/*	$NetBSD: pf_norm.c,v 1.30 2023/08/07 23:28:58 mrg Exp $	*/
 /*	$OpenBSD: pf_norm.c,v 1.109 2007/05/28 17:16:39 henning Exp $ */
 
 /*
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pf_norm.c,v 1.29 2021/03/08 23:34:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf_norm.c,v 1.30 2023/08/07 23:28:58 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1011,10 +1011,12 @@ pf_normalize_ip(struct mbuf **m0, int di
 
 		if (dir == PF_IN)
 #ifdef __NetBSD__
+		{
 			pf_mtag = pf_find_mtag(m);
 			KASSERT(pf_mtag != NULL);
 
 			pf_mtag->flags |= PF_TAG_FRAGCACHE;
+		}
 #else
 			m->m_pkthdr.pf.flags |= PF_TAG_FRAGCACHE;
 #endif /* !__NetBSD__ */

Index: src/sys/netinet/dccp_tfrc.c
diff -u src/sys/netinet/dccp_tfrc.c:1.9 src/sys/netinet/dccp_tfrc.c:1.10
--- src/sys/netinet/dccp_tfrc.c:1.9	Fri Dec 10 20:36:04 2021
+++ src/sys/netinet/dccp_tfrc.c	Mon Aug  7 23:28:58 2023
@@ -1,5 +1,5 @@
 /*	$KAME: dccp_tfrc.c,v 1.16 2006/03/01 17:34:08 nishida Exp $	*/
-/*	$NetBSD: dccp_tfrc.c,v 1.9 2021/12/10 20:36:04 andvar Exp $ */
+/*	$NetBSD: dccp_tfrc.c,v 1.10 2023/08/07 23:28:58 mrg Exp $ */
 
 /*
  * Copyright (c) 2003  Nils-Erik Mattsson
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dccp_tfrc.c,v 1.9 2021/12/10 20:36:04 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dccp_tfrc.c,v 1.10 2023/08/07 23:28:58 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dccp.h"
@@ -128,10 +128,10 @@ const struct timeval delta_half = {0, TF
  */
 #define HALFTIMEVAL(tvp) \
 do { \
-		if ((tvp)->tv_sec & 1)			\
-			(tvp)->tv_usec += 100;	\
-			(tvp)->tv_sec = (tvp)->tv_sec >> 1;			\
-			(tvp)->tv_usec = (tvp)->tv_usec >> 1;		\
+		if ((tvp)->tv_sec & 1)\
+			(tvp)->tv_usec += 100;		\
+		(tvp)->tv_sec = (tvp)->tv_sec >> 1;		\
+		(tvp)->tv_usec = (tvp)->tv_usec >> 1;		\
 } while (0)
 
 /* Sender side */



CVS commit: src/sys

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:28:58 UTC 2023

Modified Files:
src/sys/arch/atari/dev: ncr5380var.h
src/sys/arch/hp300/dev: intiovar.h
src/sys/dist/pf/net: pf_norm.c
src/sys/netinet: dccp_tfrc.c

Log Message:
fix indentation issues.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/atari/dev/ncr5380var.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/dev/intiovar.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dist/pf/net/pf_norm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/netinet/dccp_tfrc.c

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



CVS commit: src/sbin/resize_lfs

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:27:07 UTC 2023

Modified Files:
src/sbin/resize_lfs: resize_lfs.c

Log Message:
fix potentially uninitialised data being used.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/resize_lfs/resize_lfs.c

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



CVS commit: src/sbin/resize_lfs

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:27:07 UTC 2023

Modified Files:
src/sbin/resize_lfs: resize_lfs.c

Log Message:
fix potentially uninitialised data being used.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/resize_lfs/resize_lfs.c

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

Modified files:

Index: src/sbin/resize_lfs/resize_lfs.c
diff -u src/sbin/resize_lfs/resize_lfs.c:1.15 src/sbin/resize_lfs/resize_lfs.c:1.16
--- src/sbin/resize_lfs/resize_lfs.c:1.15	Thu Aug 22 20:26:07 2019
+++ src/sbin/resize_lfs/resize_lfs.c	Mon Aug  7 23:27:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_lfs.c,v 1.15 2019/08/22 20:26:07 brad Exp $	*/
+/*	$NetBSD: resize_lfs.c,v 1.16 2023/08/07 23:27:07 mrg Exp $	*/
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -124,7 +124,7 @@ main(int argc, char **argv)
 		err(1, "open filesystem root");
 
 	/* Read the superblock, finding alternates if necessary */
-	fs = (struct lfs *)malloc(sizeof(*fs));
+	fs = (struct lfs *)calloc(sizeof(*fs), 1);
 	for (sboff = LFS_LABELPAD;;) {
 		pread(devfd, buf, sboff, LFS_SBPAD);
 		__CTASSERT(sizeof(struct dlfs) == sizeof(struct dlfs64));



CVS commit: src/sbin/dump

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:26:40 UTC 2023

Modified Files:
src/sbin/dump: traverse.c

Log Message:
fix always true conditional by removing the address-of operator.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sbin/dump/traverse.c

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

Modified files:

Index: src/sbin/dump/traverse.c
diff -u src/sbin/dump/traverse.c:1.55 src/sbin/dump/traverse.c:1.56
--- src/sbin/dump/traverse.c:1.55	Wed Jan 26 20:22:14 2022
+++ src/sbin/dump/traverse.c	Mon Aug  7 23:26:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: traverse.c,v 1.55 2022/01/26 20:22:14 christos Exp $	*/
+/*	$NetBSD: traverse.c,v 1.56 2023/08/07 23:26:40 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1988, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)traverse.c	8.7 (Berkeley) 6/15/95";
 #else
-__RCSID("$NetBSD: traverse.c,v 1.55 2022/01/26 20:22:14 christos Exp $");
+__RCSID("$NetBSD: traverse.c,v 1.56 2023/08/07 23:26:40 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -780,7 +780,7 @@ appendextdata(union dinode *dp)
 	tbperdb = ufsib->ufs_bsize >> tp_bshift;
 	assert(count + blks < TP_NINDIR);
 	for (i = 0; i < blks; i++)
-		if (>dp2.di_extb[i / tbperdb] != 0)
+		if (dp->dp2.di_extb[i / tbperdb] != 0)
 spcl.c_addr[count + i] = 1;
 			else
 spcl.c_addr[count + i] = 0;



CVS commit: src/sbin/dump

2023-08-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Aug  7 23:26:40 UTC 2023

Modified Files:
src/sbin/dump: traverse.c

Log Message:
fix always true conditional by removing the address-of operator.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sbin/dump/traverse.c

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



Re: CVS commit: src/share/mk

2023-08-07 Thread Valery Ushakov
On Mon, Aug 07, 2023 at 23:58:50 +0200, Tobias Nygren wrote:

> Is this sort of fix acceptable for the above cases?
[...]
> + ptrdiff_t offset = pos - buf;
[...]
> - pos = new_buf + (pos - buf);
> + pos = new_buf + offset;

I think so.  But e.g. in this particular case I don't see why pos
pointer is needed at all.  If pos is made into a size_t pos; index
into the buf instead of a separate pointer, one avoids the whole thing
and "end" can be g/c'ed too, b/c you can just compare the index to the
"buf_size".  But the above kind of fix has the advantage of being more
or less mechanical.

-uwe


Restoring pointers after realloc (was: Re: CVS commit: src/share/mk)

2023-08-07 Thread Roland Illig
Am 07.08.2023 um 23:58 schrieb Tobias Nygren:
> Is this sort of fix acceptable for the above cases?
>
> + ptrdiff_t offset = pos - buf;
>   new_buf = realloc(buf, buf_size);
> - pos = new_buf + (pos - buf);
> + pos = new_buf + offset;

Yes.

Instead of ptrdiff_t, I prefer to use size_t to avoid having to include
, even if that means an additional type cast at WARNS=6 level:

> + size_t offset = (size_t)(pos - buf);

Roland



CVS commit: src

2023-08-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug  7 22:30:39 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: msg_247.c msg_247_ilp32_ldbl64.c
msg_247_lp64_ldbl128.c msg_247_portable.c
Added Files:
src/tests/usr.bin/xlint/lint1: msg_247_portable_int.c

Log Message:
tests/lint: show that portable mode depends on PTRDIFF_TSPEC

Since 2023.07.08.12.45.43, lint warns in lib/libkvm on i386.


To generate a diff of this commit:
cvs rdiff -u -r1.1286 -r1.1287 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.32 -r1.33 src/tests/usr.bin/xlint/lint1/msg_247.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_247_ilp32_ldbl64.c \
src/tests/usr.bin/xlint/lint1/msg_247_lp64_ldbl128.c \
src/tests/usr.bin/xlint/lint1/msg_247_portable.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_247_portable_int.c

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.1286 src/distrib/sets/lists/tests/mi:1.1287
--- src/distrib/sets/lists/tests/mi:1.1286	Sun Aug  6 19:31:06 2023
+++ src/distrib/sets/lists/tests/mi	Mon Aug  7 22:30:38 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1286 2023/08/06 19:31:06 rillig Exp $
+# $NetBSD: mi,v 1.1287 2023/08/07 22:30:38 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7229,6 +7229,7 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_247_ilp32_ldbl64.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_247_lp64_ldbl128.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_247_portable.c		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_247_portable_int.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_248.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_248.exp			tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_249.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/msg_247.c
diff -u src/tests/usr.bin/xlint/lint1/msg_247.c:1.32 src/tests/usr.bin/xlint/lint1/msg_247.c:1.33
--- src/tests/usr.bin/xlint/lint1/msg_247.c:1.32	Fri Jul 14 08:53:52 2023
+++ src/tests/usr.bin/xlint/lint1/msg_247.c	Mon Aug  7 22:30:39 2023
@@ -1,16 +1,17 @@
-/*	$NetBSD: msg_247.c,v 1.32 2023/07/14 08:53:52 rillig Exp $	*/
+/*	$NetBSD: msg_247.c,v 1.33 2023/08/07 22:30:39 rillig Exp $	*/
 # 3 "msg_247.c"
 
 // Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
 
-/*
- * The word 'may' in the message text means that the trouble is not necessarily
- * on this platform with its specific type sizes, but on other platforms.
- *
- * See also:
- *	msg_247_portable.c
- *	msg_247_lp64.c
- */
+//
+// The word 'may' in the message text means that the trouble is not necessarily
+// on this platform with its specific type sizes, but on other platforms.
+//
+// See also:
+//	msg_247_ilp32_ldbl64.c
+//	msg_247_lp64_ldbl128.c
+//	msg_247_portable.c
+//	msg_247_portable_int.c
 
 /* lint1-extra-flags: -c -X 351 */
 
@@ -175,7 +176,7 @@ lh_OPENSSL_STRING_new(void)
 	 */
 	return (struct lhash_st_OPENSSL_STRING *)OPENSSL_LH_new();
 }
-# 179 "msg_247.c" 2
+# 180 "msg_247.c" 2
 
 void sink(const void *);
 

Index: src/tests/usr.bin/xlint/lint1/msg_247_ilp32_ldbl64.c
diff -u src/tests/usr.bin/xlint/lint1/msg_247_ilp32_ldbl64.c:1.4 src/tests/usr.bin/xlint/lint1/msg_247_ilp32_ldbl64.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_247_ilp32_ldbl64.c:1.4	Sat Jul  8 16:13:00 2023
+++ src/tests/usr.bin/xlint/lint1/msg_247_ilp32_ldbl64.c	Mon Aug  7 22:30:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_247_ilp32_ldbl64.c,v 1.4 2023/07/08 16:13:00 rillig Exp $	*/
+/*	$NetBSD: msg_247_ilp32_ldbl64.c,v 1.5 2023/08/07 22:30:39 rillig Exp $	*/
 # 3 "msg_247_ilp32_ldbl64.c"
 
 // Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
@@ -6,8 +6,10 @@
 // In non-portable mode, lint warns based on the actual type sizes.
 //
 // See also:
+//	msg_247.c
 //	msg_247_lp64_ldbl128.c
 //	msg_247_portable.c
+//	msg_247_portable_int.c
 
 /* lint1-only-if: ilp32 ldbl64 */
 /* lint1-extra-flags: -c -X 351 */
Index: src/tests/usr.bin/xlint/lint1/msg_247_lp64_ldbl128.c
diff -u src/tests/usr.bin/xlint/lint1/msg_247_lp64_ldbl128.c:1.4 src/tests/usr.bin/xlint/lint1/msg_247_lp64_ldbl128.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_247_lp64_ldbl128.c:1.4	Sat Jul  8 16:13:00 2023
+++ src/tests/usr.bin/xlint/lint1/msg_247_lp64_ldbl128.c	Mon Aug  7 22:30:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_247_lp64_ldbl128.c,v 1.4 2023/07/08 16:13:00 rillig Exp $	*/
+/*	$NetBSD: msg_247_lp64_ldbl128.c,v 1.5 2023/08/07 22:30:39 rillig Exp $	*/
 # 3 "msg_247_lp64_ldbl128.c"
 
 // Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
@@ -6,8 +6,10 @@
 // In 

CVS commit: src

2023-08-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug  7 22:30:39 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: msg_247.c msg_247_ilp32_ldbl64.c
msg_247_lp64_ldbl128.c msg_247_portable.c
Added Files:
src/tests/usr.bin/xlint/lint1: msg_247_portable_int.c

Log Message:
tests/lint: show that portable mode depends on PTRDIFF_TSPEC

Since 2023.07.08.12.45.43, lint warns in lib/libkvm on i386.


To generate a diff of this commit:
cvs rdiff -u -r1.1286 -r1.1287 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.32 -r1.33 src/tests/usr.bin/xlint/lint1/msg_247.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_247_ilp32_ldbl64.c \
src/tests/usr.bin/xlint/lint1/msg_247_lp64_ldbl128.c \
src/tests/usr.bin/xlint/lint1/msg_247_portable.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_247_portable_int.c

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



Re: CVS commit: src/share/mk

2023-08-07 Thread Tobias Nygren
On Thu, 3 Aug 2023 23:30:31 +0900
Rin Okuyama  wrote:

> On 2023/08/03 23:23, Valery Ushakov wrote:
> > On Thu, Aug 03, 2023 at 13:33:27 +, Rin Okuyama wrote:
> > 
> >> -Wuse-after-free for GCC 12 is premature. It fires on a common idiom:
> >>
> >>newbuf = realloc(buf, size);
> >>p = newbuf + (p - buf);
> >>
> >> Let shut this up for GCC 12 (with hoping it gets improved for 13!).
> > 
> > C99 says
> > 
> > J.2  Undefined behavior
> > 
> > [#1]   The   behavior   is   undefined   in   the  following
> > circumstances:
> > [...]
> >   -- The  value of a pointer to an object whose lifetime has
> >  ended is used (6.2.4).
> > 
> > 
> > Yes, for the "obvious" implementation of pointers as addresses the
> > above idiom happens to work, but it doesn't make that idiom any less
> > UB.
> 
> Ah, I only thought about "obvious" impl. Thank you for kind
> explanation! I will revert them for now.

Hi,

Is this sort of fix acceptable for the above cases?

-Tobias

RCS file: /cvsroot/src/usr.bin/sort/files.c,v
retrieving revision 1.42
diff -p -u -r1.42 files.c
--- files.c 5 Aug 2015 07:10:03 -   1.42
+++ files.c 7 Aug 2023 21:53:45 -
@@ -199,13 +199,14 @@ seq(FILE *fp, u_char **line)
/* Long line - double size of buffer */
/* XXX: Check here for stupidly long lines */
buf_size *= 2;
+   ptrdiff_t offset = pos - buf;
new_buf = realloc(buf, buf_size);
if (!new_buf)
err(2, "realloc of linebuf to %zu bytes failed",
buf_size);
-   
+
end = new_buf + buf_size;
-   pos = new_buf + (pos - buf);
+   pos = new_buf + offset;
buf = new_buf;
}
}


CVS commit: src/usr.bin/rpcgen

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 21:12:02 UTC 2023

Modified Files:
src/usr.bin/rpcgen: rpc_cout.c

Log Message:
rpcgen: don't pass length of source to string copy operation

Altough the prior code can't fail, GCC complains about the practice.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/rpcgen/rpc_cout.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/rpcgen/rpc_cout.c
diff -u src/usr.bin/rpcgen/rpc_cout.c:1.38 src/usr.bin/rpcgen/rpc_cout.c:1.39
--- src/usr.bin/rpcgen/rpc_cout.c:1.38	Sat Jan 23 02:33:09 2016
+++ src/usr.bin/rpcgen/rpc_cout.c	Mon Aug  7 21:12:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpc_cout.c,v 1.38 2016/01/23 02:33:09 dholland Exp $	*/
+/*	$NetBSD: rpc_cout.c,v 1.39 2023/08/07 21:12:02 tnn Exp $	*/
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_cout.c,v 1.38 2016/01/23 02:33:09 dholland Exp $");
+__RCSID("$NetBSD: rpc_cout.c,v 1.39 2023/08/07 21:12:02 tnn Exp $");
 #endif
 #endif
 
@@ -186,7 +186,9 @@ print_ifopen(int indent, const char *nam
 	if (!strcmp(name, "rpcprog_t") || !strcmp(name, "rpcvers_t") ||
 	!strcmp(name, "rpcproc_t") || !strcmp(name, "rpcprot_t") ||
 	!strcmp(name, "rpcport_t") || !strcmp(name, "rpcpinline_t")) {
-		strncpy(_t_kludge, name, strlen(name) - 2);
+		strlcpy(_t_kludge, name, sizeof(_t_kludge));
+		char *underscore = strchr(_t_kludge, '_');
+		*underscore = 0;
 		name = _t_kludge;
 	}
 	tabify(fout, indent);



CVS commit: src/usr.bin/rpcgen

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 21:12:02 UTC 2023

Modified Files:
src/usr.bin/rpcgen: rpc_cout.c

Log Message:
rpcgen: don't pass length of source to string copy operation

Altough the prior code can't fail, GCC complains about the practice.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/rpcgen/rpc_cout.c

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



CVS commit: src/usr.sbin/makemandb

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 20:35:21 UTC 2023

Modified Files:
src/usr.sbin/makemandb: custom_apropos_tokenizer.c

Log Message:
makemakedb: don't return uninitialized token length if stemming fails


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makemandb/custom_apropos_tokenizer.c

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

Modified files:

Index: src/usr.sbin/makemandb/custom_apropos_tokenizer.c
diff -u src/usr.sbin/makemandb/custom_apropos_tokenizer.c:1.5 src/usr.sbin/makemandb/custom_apropos_tokenizer.c:1.6
--- src/usr.sbin/makemandb/custom_apropos_tokenizer.c:1.5	Thu Aug  3 07:49:23 2023
+++ src/usr.sbin/makemandb/custom_apropos_tokenizer.c	Mon Aug  7 20:35:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: custom_apropos_tokenizer.c,v 1.5 2023/08/03 07:49:23 rin Exp $	*/
+/*	$NetBSD: custom_apropos_tokenizer.c,v 1.6 2023/08/07 20:35:21 tnn Exp $	*/
 /*
 ** 2006 September 30
 **
@@ -719,9 +719,9 @@ aproposPorterNext(
 
 			size_t temp;
 			int stemStatus = do_stem([iStartOffset], n, c->zToken, );
-			*pnBytes = temp;
 			if (stemStatus != SQLITE_OK)
 return stemStatus;
+			*pnBytes = temp;
 
 			*pzToken = c->zToken;
 			*piStartOffset = iStartOffset;



CVS commit: src/usr.sbin/makemandb

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 20:35:21 UTC 2023

Modified Files:
src/usr.sbin/makemandb: custom_apropos_tokenizer.c

Log Message:
makemakedb: don't return uninitialized token length if stemming fails


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makemandb/custom_apropos_tokenizer.c

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



CVS commit: src/usr.sbin/services_mkdb

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 20:21:08 UTC 2023

Modified Files:
src/usr.sbin/services_mkdb: output_cdb.c

Log Message:
services_mkdb: pad argument to cdbw_output(3) to match it's prototype


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/services_mkdb/output_cdb.c

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

Modified files:

Index: src/usr.sbin/services_mkdb/output_cdb.c
diff -u src/usr.sbin/services_mkdb/output_cdb.c:1.1 src/usr.sbin/services_mkdb/output_cdb.c:1.2
--- src/usr.sbin/services_mkdb/output_cdb.c:1.1	Sun Apr 25 00:54:46 2010
+++ src/usr.sbin/services_mkdb/output_cdb.c	Mon Aug  7 20:21:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: output_cdb.c,v 1.1 2010/04/25 00:54:46 joerg Exp $	*/
+/*	$NetBSD: output_cdb.c,v 1.2 2023/08/07 20:21:08 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -143,7 +143,7 @@ cdb_close(void)
 	rv = 0;
 	serrno = errno;
 
-	if (cdbw_output(cdbw, cdbw_fd, "services(5)", NULL)) {
+	if (cdbw_output(cdbw, cdbw_fd, "services(5)\0\0\0\0", NULL)) {
 		rv = -1;
 		serrno = errno;
 	}



CVS commit: src/usr.sbin/services_mkdb

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 20:21:08 UTC 2023

Modified Files:
src/usr.sbin/services_mkdb: output_cdb.c

Log Message:
services_mkdb: pad argument to cdbw_output(3) to match it's prototype


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/services_mkdb/output_cdb.c

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



CVS commit: src/usr.bin/tail

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 19:11:25 UTC 2023

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

Log Message:
tail: adjust misleading indentation in macro. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tail/tail.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/tail/tail.c
diff -u src/usr.bin/tail/tail.c:1.20 src/usr.bin/tail/tail.c:1.21
--- src/usr.bin/tail/tail.c:1.20	Tue Mar  6 03:33:26 2018
+++ src/usr.bin/tail/tail.c	Mon Aug  7 19:11:25 2023
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)tail.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: tail.c,v 1.20 2018/03/06 03:33:26 eadler Exp $");
+__RCSID("$NetBSD: tail.c,v 1.21 2023/08/07 19:11:25 tnn Exp $");
 #endif /* not lint */
 
 #include 
@@ -94,7 +94,7 @@ main(int argc, char *argv[])
 	case '+':			\
 		if (off)		\
 			off -= (units);	\
-			style = (forward);\
+		style = (forward);	\
 		break;			\
 	case '-':			\
 		off = -off;		\



CVS commit: src/usr.bin/tail

2023-08-07 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  7 19:11:25 UTC 2023

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

Log Message:
tail: adjust misleading indentation in macro. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tail/tail.c

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



CVS commit: src/share/misc

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 18:01:42 UTC 2023

Modified Files:
src/share/misc: style

Log Message:
style(5): Advise against new struct typedefs and explain why.

Proposed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/07/11/msg028950.html

Positive feedback to general concept, negative feedback to specifics
and phrasing of the first iteration but no objections to latest
iteration after several weeks at:
https://mail-index.netbsd.org/tech-kern/2023/07/16/msg028994.html


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/share/misc/style

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



CVS commit: src/share/misc

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 18:01:42 UTC 2023

Modified Files:
src/share/misc: style

Log Message:
style(5): Advise against new struct typedefs and explain why.

Proposed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/07/11/msg028950.html

Positive feedback to general concept, negative feedback to specifics
and phrasing of the first iteration but no objections to latest
iteration after several weeks at:
https://mail-index.netbsd.org/tech-kern/2023/07/16/msg028994.html


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/share/misc/style

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

Modified files:

Index: src/share/misc/style
diff -u src/share/misc/style:1.74 src/share/misc/style:1.75
--- src/share/misc/style:1.74	Fri Apr 21 16:12:53 2023
+++ src/share/misc/style	Mon Aug  7 18:01:42 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.74 2023/04/21 16:12:53 rillig Exp $ */
+/* $NetBSD: style,v 1.75 2023/08/07 18:01:42 riastradh Exp $ */
 
 /*
  * The revision control tag appears first, with a blank line after it.
@@ -30,7 +30,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: style,v 1.74 2023/04/21 16:12:53 rillig Exp $");
+__RCSID("$NetBSD: style,v 1.75 2023/08/07 18:01:42 riastradh Exp $");
 
 /*
  * VERY important single-line comments look like this.
@@ -58,6 +58,76 @@ __RCSID("$NetBSD: style,v 1.74 2023/04/2
 #define _SYS_SOCKET_H_
 
 /*
+ * Include other header files only as necessary, mainly for type
+ * definitions or macros that are necessary to use in this header file.
+ *
+ * Avoid relying on transitive inclusions.
+ *
+ * Avoid header files dependencies just for struct and union types that
+ * are used in pointer types, which don't require type defintions.
+ * Instead, use forward declarations of the struct or union tag.
+ */
+#include 
+
+/*
+ * Forward declarations for struct and union tags that don't need
+ * definitions go next.
+ */
+struct dirent;
+
+/*
+ * Define public structs and unions, only if they are user-allocated or
+ * otherwise exposed to users for a good reason; otherwise keep them
+ * private to .c files or `_impl.h' or `_private.h' files.
+ *
+ * Do not create a typedef like `typedef struct example example_t;' or
+ * `typedef struct example *example_t;'.  Use `struct example' or
+ * `struct example *' in the public API; that way, other header files
+ * which declare functions or define struct or union types that involve
+ * only pointers to `struct example' need not pull in unnecessary
+ * header files.
+ */
+struct example {
+	struct data *p;
+	int x;
+	char y;
+};
+
+/*
+ * Use typedefs judiciously.
+ *
+ * Function or function pointer types:
+ */
+typedef void sighandler_t(int);
+
+/*
+ * Aliases for arithmetic types:
+ */
+typedef uint16_t nlink_t;
+
+/*
+ * Types that might be defined differently in some contexts, like
+ * uint8_t on one port, a pointer to a struct on another port, and an
+ * in-line struct larger than a pointer on a third port:
+ */
+typedef uint8_t foo_t;		/* Hypothetical leg26 definition */
+typedef struct foo *foo_t;	/* Hypothetical i786 definition */
+typedef struct {		/* Hypothetical risc72 definition */
+	uint32_t p;
+	uint32_t q;
+	uint8_t t;
+} foo_t;
+
+/*
+ * For opaque data structures that are always represented by a pointer
+ * when stored in other data structures or passed to functions, don't
+ * use a type `foo_t' with `typedef void *foo_t'.  Use `struct foo *'
+ * with no public definition for `struct foo', so the compiler can
+ * detect type errors, and other header files can use `struct foo *'
+ * without creating header file dependencies.
+ */
+
+/*
  * extern declarations must only appear in header files, not in .c
  * files, so the same declaration is used by the .c file defining it
  * and the .c file using it, giving the compiler the opportunity to
@@ -71,7 +141,7 @@ __RCSID("$NetBSD: style,v 1.74 2023/04/2
  */
 extern int frotz;
 
-int frobnicate(const char *);
+int frobnicate(const char *, struct dirent *, foobar_t);
 
 /*
  * Contents of #include file go between the #ifndef and the #endif at the end.
@@ -195,6 +265,10 @@ enum enumtype {
  *
  * It may be useful to use a meaningful prefix for each member name.
  * E.g, for ``struct softc'' the prefix could be ``sc_''.
+ *
+ * Don't create typedef aliases for struct or union types.  That way,
+ * other header files can use pointer types to them without the header
+ * file defining the typedef.
  */
 struct foo {
 	struct foo *next;	/* List of active foo */
@@ -207,11 +281,6 @@ struct foo {
 };
 struct foo *foohead;		/* Head of global foo list */
 
-/* Make the structure name match the typedef. */
-typedef struct BAR {
-	int level;
-} BAR;
-
 /* C99 uintN_t is preferred over u_intN_t. */
 uint32_t zero;
 



CVS commit: src/external/gpl3/gdb/lib/libgdb

2023-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  7 16:52:53 UTC 2023

Modified Files:
src/external/gpl3/gdb/lib/libgdb: Makefile

Log Message:
Prevent us from using the phony_iconv_open(). Our iconv_open does not take
"wchar_t" as an argument, so define __STDC_ISO_10646__


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/external/gpl3/gdb/lib/libgdb/Makefile

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



CVS commit: src/external/gpl3/gdb/lib/libgdb

2023-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  7 16:52:53 UTC 2023

Modified Files:
src/external/gpl3/gdb/lib/libgdb: Makefile

Log Message:
Prevent us from using the phony_iconv_open(). Our iconv_open does not take
"wchar_t" as an argument, so define __STDC_ISO_10646__


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/external/gpl3/gdb/lib/libgdb/Makefile

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

Modified files:

Index: src/external/gpl3/gdb/lib/libgdb/Makefile
diff -u src/external/gpl3/gdb/lib/libgdb/Makefile:1.33 src/external/gpl3/gdb/lib/libgdb/Makefile:1.34
--- src/external/gpl3/gdb/lib/libgdb/Makefile:1.33	Mon Jul 31 13:02:08 2023
+++ src/external/gpl3/gdb/lib/libgdb/Makefile	Mon Aug  7 12:52:52 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2023/07/31 17:02:08 christos Exp $
+#	$NetBSD: Makefile,v 1.34 2023/08/07 16:52:52 christos Exp $
 
 NOCTF=
 HOSTPROG_CXX=   1
@@ -40,7 +40,7 @@ CPPFLAGS+=	-I${.CURDIR} \
 		-DTARGET_SYSTEM_ROOT=\"\" \
 		-DTARGET_SYSTEM_ROOT_RELOCATABLE=0 \
 		-DBINDIR=\"${BINDIR}\" \
-		${GCPPFLAGS:M-D*}
+		${GCPPFLAGS:M-D*} -D__STDC_ISO_10646__
 
 CWARNFLAGS.clang+=	-Wno-switch
 



CVS commit: src/external/gpl3/gdb/lib/libgdb/arch/x86_64

2023-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  7 16:51:40 UTC 2023

Modified Files:
src/external/gpl3/gdb/lib/libgdb/arch/x86_64: defs.mk init.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk
cvs rdiff -u -r1.20 -r1.21 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/init.c

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

Modified files:

Index: src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk
diff -u src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk:1.21 src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk:1.22
--- src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk:1.21	Sun Aug  6 16:27:14 2023
+++ src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk	Mon Aug  7 12:51:40 2023
@@ -3,5 +3,5 @@
 # Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp 
 #
 G_INTERNAL_CFLAGS=  -I. -I${GNUHOSTDIST}/gdb -I${GNUHOSTDIST}/gdb/config -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I${GNUHOSTDIST}/gdb/../include/opcode -I../bfd -I${GNUHOSTDIST}/gdb/../bfd -I${GNUHOSTDIST}/gdb/../include -I${GNUHOSTDIST}/gdb/../readline/readline/.. -I${GNUHOSTDIST}/gdb/../zlib  -I../libdecnumber -I${GNUHOSTDIST}/gdb/../libdecnumber -I./../intl -I${GNUHOSTDIST}/gdb/../gnulib/import -I../gnulib/import -I${GNUHOSTDIST}/gdb/.. -I.. -I${GNUHOSTDIST}/gdb/../libbacktrace/ -I../libbacktrace/  -DTUI=1 -I/usr/obj/amd64-x86_64/tools/include   -I${GNUHOSTDIST}/gdb/.. -pthread  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing
 -declarations -Wstrict-null-sentinel -Wformat -Wformat-nonliteral 
-G_LIBGDB_OBS=ada-exp.o ada-lang.o ada-tasks.o ada-typeprint.o ada-valprint.o ada-varobj.o addrmap.o agent.o alloc.o amd64-bsd-nat.o amd64-nat.o amd64-netbsd-nat.o amd64-netbsd-tdep.o amd64-ravenscar-thread.o amd64-tdep.o annotate.o arch-utils.o amd64.o i386.o async-event.o auto-load.o auxv.o ax-gdb.o ax-general.o bcache.o bfd-target.o block.o blockframe.o break-catch-exec.o break-catch-fork.o break-catch-load.o break-catch-sig.o break-catch-syscall.o break-catch-throw.o breakpoint.o bsd-kvm.o bt-utils.o btrace.o build-id.o buildsym-legacy.o buildsym.o c-exp.o c-lang.o c-typeprint.o c-valprint.o c-varobj.o charset.o cli-out.o cli-cmds.o cli-decode.o cli-dump.o cli-interp.o cli-logging.o cli-option.o cli-script.o cli-setshow.o cli-style.o cli-utils.o coff-pe-read.o coffread.o compile-c-support.o compile-c-symbols.o compile-c-types.o compile-cplus-symbols.o compile-cplus-types.o compile-loc2c.o compile-object-load.o compile-object-run.o compile.o complaints.o completer.o copying.o core
 file.o corelow.o cp-abi.o cp-name-parser.o cp-namespace.o cp-support.o cp-valprint.o ctfread.o d-exp.o d-lang.o d-namespace.o d-valprint.o dbxread.o dcache.o debug.o debuginfod-support.o dictionary.o disasm.o displaced-stepping.o dtrace-probe.o dummy-frame.o abbrev-cache.o abbrev.o attribute.o comp-unit-head.o cooked-index.o cu.o dwz.o expr.o frame-tailcall.o frame.o index-cache.o index-common.o index-write.o leb.o line-header.o loc.o macro.o read.o section.o stringify.o elf-none-tdep.o elfread.o eval.o event-top.o exceptions.o exec.o expprint.o extension.o f-exp.o f-lang.o f-typeprint.o f-valprint.o filename-seen-cache.o filesystem.o findcmd.o findvar.o fork-child.o frame-base.o frame-info.o frame-unwind.o frame.o gcore-elf.o gcore.o gdb-demangle.o gdb_bfd.o gdbtypes.o gmp-utils.o gnu-v2-abi.o gnu-v3-abi.o go-exp.o go-lang.o go-typeprint.o go-valprint.o guile.o i386-tdep.o i387-tdep.o inf-child.o inf-loop.o inf-ptrace.o infcall.o infcmd.o inferior.o inflow.o infrun.o inline-frame.o
  interps.o jit.o language.o linespec.o location.o m2-exp.o m2-lang.o m2-typeprint.o m2-valprint.o macrocmd.o macroexp.o macroscope.o macrotab.o main.o maint-test-options.o maint-test-settings.o maint.o mdebugread.o mem-break.o memattr.o memory-map.o memrange.o memtag.o mi-cmd-break.o mi-cmd-catch.o mi-cmd-disas.o mi-cmd-env.o mi-cmd-file.o mi-cmd-info.o mi-cmd-stack.o mi-cmd-target.o mi-cmd-var.o mi-cmds.o mi-common.o mi-console.o mi-getopt.o mi-interp.o mi-main.o mi-out.o mi-parse.o mi-symbol-cmds.o minidebug.o minsyms.o mipsread.o namespace.o fork-inferior.o netbsd-nat.o x86-dregs.o netbsd-nat.o netbsd-tdep.o objc-lang.o objfiles.o observable.o opencl-lang.o osabi.o osdata.o p-exp.o p-lang.o p-typeprint.o p-valprint.o parse.o posix-hdep.o printcmd.o probe.o process-stratum-target.o producer.o progspace-and-thread.o progspace.o prologue-value.o psymtab.o python.o ravenscar-thread.o record-btrace.o record-full.o record.o 

CVS commit: src/external/gpl3/gdb/lib/libgdb/arch/x86_64

2023-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  7 16:51:40 UTC 2023

Modified Files:
src/external/gpl3/gdb/lib/libgdb/arch/x86_64: defs.mk init.c

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/defs.mk
cvs rdiff -u -r1.20 -r1.21 \
src/external/gpl3/gdb/lib/libgdb/arch/x86_64/init.c

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



CVS commit: src/external/gpl3/gdb/dist/gdb

2023-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  7 16:51:24 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb: configure.tgt

Log Message:
Add missing i386 tdeps


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/gpl3/gdb/dist/gdb/configure.tgt

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/configure.tgt
diff -u src/external/gpl3/gdb/dist/gdb/configure.tgt:1.28 src/external/gpl3/gdb/dist/gdb/configure.tgt:1.29
--- src/external/gpl3/gdb/dist/gdb/configure.tgt:1.28	Mon Jul 31 13:00:49 2023
+++ src/external/gpl3/gdb/dist/gdb/configure.tgt	Mon Aug  7 12:51:24 2023
@@ -729,7 +729,8 @@ x86_64-*-mingw* | x86_64-*-cygwin*)
 ;;
 x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
 	# Target: NetBSD/amd64
-	gdb_target_obs="amd64-netbsd-tdep.o ${i386_tobjs}"
+	gdb_target_obs="amd64-netbsd-tdep.o ${i386_tobjs}
+			i386-bsd-tdep.o i386-netbsd-tdep.o"
 	;;
 x86_64-*-openbsd*)
 	# Target: OpenBSD/amd64



CVS commit: src/external/gpl3/gdb/dist/gdb

2023-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  7 16:51:24 UTC 2023

Modified Files:
src/external/gpl3/gdb/dist/gdb: configure.tgt

Log Message:
Add missing i386 tdeps


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/gpl3/gdb/dist/gdb/configure.tgt

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



CVS commit: src/sys/external/bsd/drm2/radeon

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:35:06 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/radeon: radeon_pci.c

Log Message:
radeon: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/drm2/radeon/radeon_pci.c

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



CVS commit: src/sys/external/bsd/drm2/radeon

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:35:06 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/radeon: radeon_pci.c

Log Message:
radeon: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/drm2/radeon/radeon_pci.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/external/bsd/drm2/radeon/radeon_pci.c
diff -u src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.23 src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.24
--- src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.23	Tue Mar  7 20:23:00 2023
+++ src/sys/external/bsd/drm2/radeon/radeon_pci.c	Mon Aug  7 16:35:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_pci.c,v 1.23 2023/03/07 20:23:00 mrg Exp $	*/
+/*	$NetBSD: radeon_pci.c,v 1.24 2023/08/07 16:35:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.23 2023/03/07 20:23:00 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.24 2023/08/07 16:35:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "genfb.h"
@@ -72,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_pci.c
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #if NGENFB > 0
@@ -366,6 +367,8 @@ radeon_do_suspend(device_t self, const p
 	int ret;
 	bool is_console = true; /* XXX */
 
+	drm_suspend_ioctl(dev);
+
 	ret = radeon_suspend_kms(dev, true, is_console, false);
 	if (ret)
 		return false;
@@ -383,9 +386,10 @@ radeon_do_resume(device_t self, const pm
 
 	ret = radeon_resume_kms(dev, true, is_console);
 	if (ret)
-		return false;
+		goto out;
 
-	return true;
+out:	drm_resume_ioctl(dev);
+	return ret == 0;
 }
 
 static void



CVS commit: src/sys/external/bsd/drm2/nouveau

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:34:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/drm2/nouveau/nouveau_pci.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/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.37 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.38
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.37	Wed Mar  1 08:42:34 2023
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Mon Aug  7 16:34:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.37 2023/03/01 08:42:34 riastradh Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.38 2023/08/07 16:34:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.37 2023/03/01 08:42:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.38 2023/08/07 16:34:57 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "genfb.h"
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_pci.
 #include 
 #endif
 
+#include 
 #include 
 
 #include 
@@ -316,16 +317,31 @@ static bool
 nouveau_pci_suspend(device_t self, const pmf_qual_t *qual __unused)
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc->sc_drm_dev;
+	int ret;
+
+	drm_suspend_ioctl(dev);
+
+	ret = nouveau_pmops_suspend(dev);
+	if (ret)
+		return false;
 
-	return nouveau_pmops_suspend(sc->sc_drm_dev) == 0;
+	return true;
 }
 
 static bool
 nouveau_pci_resume(device_t self, const pmf_qual_t *qual)
 {
 	struct nouveau_pci_softc *const sc = device_private(self);
+	struct drm_device *const dev = sc->sc_drm_dev;
+	int ret;
+
+	ret = nouveau_pmops_resume(sc->sc_drm_dev);
+	if (ret)
+		goto out;
 
-	return nouveau_pmops_resume(sc->sc_drm_dev) == 0;
+out:	drm_resume_ioctl(dev);
+	return ret == 0;
 }
 
 static void



CVS commit: src/sys/external/bsd/drm2/nouveau

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:34:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

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



CVS commit: src/sys/external/bsd/drm2/amdgpu

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:34:47 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/amdgpu: amdgpu_pci.c

Log Message:
amdgpu: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.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/external/bsd/drm2/amdgpu/amdgpu_pci.c
diff -u src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c:1.11 src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c:1.12
--- src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c:1.11	Mon Jul 18 23:34:02 2022
+++ src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c	Mon Aug  7 16:34:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_pci.c,v 1.11 2022/07/18 23:34:02 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_pci.c,v 1.12 2023/08/07 16:34:47 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_pci.c,v 1.11 2022/07/18 23:34:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_pci.c,v 1.12 2023/08/07 16:34:47 riastradh Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdgpu_pci.c
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -260,6 +261,8 @@ amdgpu_do_suspend(device_t self, const p
 	struct drm_device *const dev = sc->sc_drm_dev;
 	int ret;
 
+	drm_suspend_ioctl(dev);
+
 	ret = amdgpu_device_suspend(dev, /*fbcon*/true);
 	if (ret)
 		return false;
@@ -276,9 +279,10 @@ amdgpu_do_resume(device_t self, const pm
 
 	ret = amdgpu_device_resume(dev, /*fbcon*/true);
 	if (ret)
-		return false;
+		goto out;
 
-	return true;
+out:	drm_resume_ioctl(dev);
+	return ret == 0;
 }
 
 static void



CVS commit: src/sys/external/bsd/drm2/amdgpu

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:34:47 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/amdgpu: amdgpu_pci.c

Log Message:
amdgpu: Suspend ioctls while device is suspended.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/amdgpu/amdgpu_pci.c

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



CVS commit: src/distrib/sets/lists

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:14:32 UTC 2023

Modified Files:
src/distrib/sets/lists/base: md.amd64
src/distrib/sets/lists/debug: ad.aarch64 md.amd64

Log Message:
distrib/sets/lists: Fix libtsan entries.

- No obsolete .so.N or .so.N.M entries.
- libtsan.so for gcc.
- libtsan.so.1* for gcc=10.
- libtsan.so.2* for gcc=12.
- No libtsan.so.1* on aarch64, libtsan on aarch64 is new in gcc12.


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.35 -r1.36 src/distrib/sets/lists/debug/ad.aarch64
cvs rdiff -u -r1.118 -r1.119 src/distrib/sets/lists/debug/md.amd64

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



CVS commit: src/distrib/sets/lists

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 16:14:32 UTC 2023

Modified Files:
src/distrib/sets/lists/base: md.amd64
src/distrib/sets/lists/debug: ad.aarch64 md.amd64

Log Message:
distrib/sets/lists: Fix libtsan entries.

- No obsolete .so.N or .so.N.M entries.
- libtsan.so for gcc.
- libtsan.so.1* for gcc=10.
- libtsan.so.2* for gcc=12.
- No libtsan.so.1* on aarch64, libtsan on aarch64 is new in gcc12.


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.35 -r1.36 src/distrib/sets/lists/debug/ad.aarch64
cvs rdiff -u -r1.118 -r1.119 src/distrib/sets/lists/debug/md.amd64

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/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.295 src/distrib/sets/lists/base/md.amd64:1.296
--- src/distrib/sets/lists/base/md.amd64:1.295	Sat Aug  5 08:55:48 2023
+++ src/distrib/sets/lists/base/md.amd64	Mon Aug  7 16:14:31 2023
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.295 2023/08/05 08:55:48 riastradh Exp $
+# $NetBSD: md.amd64,v 1.296 2023/08/07 16:14:31 riastradh Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib		compat,pic
@@ -23,8 +23,6 @@
 ./usr/lib/libtsan.sobase-sys-shlib		cxx,gcc
 ./usr/lib/libtsan.so.1base-sys-shlib		cxx,gcc=10
 ./usr/lib/libtsan.so.1.0			base-sys-shlib		cxx,gcc=10
-./usr/lib/libtsan.so.1base-sys-shlib		cxx,obsolete,gcc=12
-./usr/lib/libtsan.so.1.0			base-sys-shlib		cxx,obsolete,gcc=12
 ./usr/lib/libtsan.so.2base-sys-shlib		cxx,gcc=12
 ./usr/lib/libtsan.so.2.0			base-sys-shlib		cxx,gcc=12
 ./usr/lib/libx86_64.sobase-sys-shlib		pic

Index: src/distrib/sets/lists/debug/ad.aarch64
diff -u src/distrib/sets/lists/debug/ad.aarch64:1.35 src/distrib/sets/lists/debug/ad.aarch64:1.36
--- src/distrib/sets/lists/debug/ad.aarch64:1.35	Sat Aug  5 03:13:57 2023
+++ src/distrib/sets/lists/debug/ad.aarch64	Mon Aug  7 16:14:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64,v 1.35 2023/08/05 03:13:57 pgoyette Exp $
+# $NetBSD: ad.aarch64,v 1.36 2023/08/07 16:14:32 riastradh Exp $
 ./usr/lib/eabi/libarm_g.a	comp-sys-debug	debuglib,compat,llvm
 ./usr/lib/eabi/libc_vfp_g.a	comp-sys-debug	debuglib,compat,llvm
 ./usr/lib/eabihf/libarm_g.a	comp-sys-debug	debuglib,compat,llvm
@@ -20,7 +20,7 @@
 ./usr/libdata/debug/usr/lib/eabi/libc_vfp.so.0.0.debug		comp-sys-debug	debug,compat,pic,llvm
 ./usr/libdata/debug/usr/lib/eabi/libproc.so.1.0.debug		comp-sys-debug	debug,compat,pic,llvm,dtrace
 ./usr/libdata/debug/usr/lib/eabi/librtld_db.so.0.0.debug	comp-sys-debug	debug,compat,pic,llvm,dtrace
-./usr/libdata/debug/usr/lib/libtsan.so.1.0.debug		comp-sys-debug	debug,cxx,gcc=12
+./usr/libdata/debug/usr/lib/libtsan.so.2.0.debug		comp-sys-debug	debug,cxx,gcc=12
 ./usr/libdata/debug/usr/lib/eabihfcomp-sys-debug	compat,llvm
 ./usr/libdata/debug/usr/lib/eabihf/i18ncomp-sys-debug	compat,llvm
 ./usr/libdata/debug/usr/lib/eabihf/libarm.so.0.0.debug		comp-sys-debug	debug,compat,pic,llvm

Index: src/distrib/sets/lists/debug/md.amd64
diff -u src/distrib/sets/lists/debug/md.amd64:1.118 src/distrib/sets/lists/debug/md.amd64:1.119
--- src/distrib/sets/lists/debug/md.amd64:1.118	Sat Aug  5 03:13:57 2023
+++ src/distrib/sets/lists/debug/md.amd64	Mon Aug  7 16:14:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.118 2023/08/05 03:13:57 pgoyette Exp $
+# $NetBSD: md.amd64,v 1.119 2023/08/07 16:14:32 riastradh Exp $
 ./usr/libdata/debug/usr/bin/gdbserver.debug	base-util-debug		gdb,debug
 ./usr/lib/i386/12.202++_g.a			comp-c-debuglib		debuglib,compat,12.202xx
 ./usr/lib/i386/libi386_g.a			comp-c-debuglib		debuglib,compat
@@ -12,7 +12,8 @@
 ./usr/libdata/debug/usr/lib/i386/libpam.so.4.1.debug	comp-compat-shlib	compat,pic,debug,pam
 ./usr/libdata/debug/usr/lib/i386/libproc.so.1.0.debug	comp-compat-shlib	compat,pic,debug,dtrace
 ./usr/libdata/debug/usr/lib/i386/librtld_db.so.0.0.debug	comp-compat-shlib	compat,pic,debug,dtrace
-./usr/libdata/debug/usr/lib/libtsan.so.1.0.debug		comp-sys-debug	debug,cxx,gcc
+./usr/libdata/debug/usr/lib/libtsan.so.1.0.debug		comp-sys-debug	debug,cxx,gcc=10
+./usr/libdata/debug/usr/lib/libtsan.so.2.0.debug		comp-sys-debug	debug,cxx,gcc=12
 ./usr/libdata/debug/usr/lib/libx86_64.so.0.0.debug	comp-sys-shlib		pic,debug
 ./usr/libdata/debug/usr/libexec/ld.elf_so-i386	comp-obsolete	obsolete
 ./usr/libdata/debug/usr/libexec/ld.elf_so-i386.debug	comp-sys-debug		debug,compat



CVS commit: src/external/gpl3/gdb/bin/gdb

2023-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  7 14:30:48 UTC 2023

Modified Files:
src/external/gpl3/gdb/bin/gdb: Makefile

Log Message:
fix config.h confusion


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/gpl3/gdb/bin/gdb/Makefile

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



CVS commit: src/external/gpl3/gdb/bin/gdb

2023-08-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  7 14:30:48 UTC 2023

Modified Files:
src/external/gpl3/gdb/bin/gdb: Makefile

Log Message:
fix config.h confusion


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/gpl3/gdb/bin/gdb/Makefile

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

Modified files:

Index: src/external/gpl3/gdb/bin/gdb/Makefile
diff -u src/external/gpl3/gdb/bin/gdb/Makefile:1.23 src/external/gpl3/gdb/bin/gdb/Makefile:1.24
--- src/external/gpl3/gdb/bin/gdb/Makefile:1.23	Sun Aug  6 16:24:54 2023
+++ src/external/gpl3/gdb/bin/gdb/Makefile	Mon Aug  7 10:30:48 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2023/08/06 20:24:54 christos Exp $
+#	$NetBSD: Makefile,v 1.24 2023/08/07 14:30:48 christos Exp $
 
 NOCTF=
 .include 
@@ -21,14 +21,16 @@ CPPFLAGS+=	-I${.CURDIR} \
 		-I${DIST}/readline \
 		-I${DIST}/libdecnumber \
 		-I${DIST} \
-		-I${GDBLIBDIR}/libbfd/arch/${GDB_MACHINE_ARCH} \
 		-I${GDBLIBDIR}/libgdbsupport/arch/${GDB_MACHINE_ARCH} \
+		-I${GDBLIBDIR}/libgdbsupport/arch/${GDB_MACHINE_ARCH}/gdbsupport \
+		-I${GDBLIBDIR}/libbfd/arch/${GDB_MACHINE_ARCH} \
 		-I${GDBLIBDIR}/libgnulib/arch/${GDB_MACHINE_ARCH} \
 		-I${GDBLIBDIR}/libgnulib/arch/${GDB_MACHINE_ARCH}/gnulib/import \
 		-I${DIST}/bfd \
 		-I${DIST}/include \
 		${GCPPFLAGS:M-D*}
 
+
 TEXINFO=	gdb.texinfo stabs.texinfo
 INFOFLAGS=	-I${DIST}/gdb/doc -I${DIST}/gdb/mi \
 		-I${DIST}/readline/readline/doc -I${.CURDIR}/.. -DGDBN=${GDBN}



CVS commit: src/sys/netbt

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 13:31:54 UTC 2023

Modified Files:
src/sys/netbt: bt_proto.c

Log Message:
netbt(4): Initialize bt_lock earlier.

Use a driver-class module modcmd init function, instead of a socket
domain init function; the socket-domain ones don't run until after
configure, but we need this to be initialized before configure so
that Bluetooth HCI drivers like ubt(4) can use it.

This is suboptimal but it's the least intrusive way I've thought of
to get this working, even if it's a little grody to make netbt a
`driver-class' (builtin) module.  Note that this doesn't mean netbt
becomes dynamically loadable or unloadable; we're just using a module
for initialization ordering.

PR kern/56988

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/netbt/bt_proto.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/netbt/bt_proto.c
diff -u src/sys/netbt/bt_proto.c:1.16 src/sys/netbt/bt_proto.c:1.17
--- src/sys/netbt/bt_proto.c:1.16	Thu Jan 21 15:41:30 2016
+++ src/sys/netbt/bt_proto.c	Mon Aug  7 13:31:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bt_proto.c,v 1.16 2016/01/21 15:41:30 riastradh Exp $	*/
+/*	$NetBSD: bt_proto.c,v 1.17 2023/08/07 13:31:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,11 +31,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.16 2016/01/21 15:41:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.17 2023/08/07 13:31:54 riastradh Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -113,6 +114,21 @@ kmutex_t *bt_lock;
 static void
 bt_init(void)
 {
+}
+
+MODULE(MODULE_CLASS_DRIVER, netbt, NULL);
+
+static int
+netbt_modcmd(modcmd_t cmd, void *aux)
+{
 
-	bt_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+		bt_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
+		return 0;
+	case MODULE_CMD_FINI:
+		return EBUSY;	/* XXX */
+	default:
+		return ENOTTY;
+	}
 }



CVS commit: src/sys/netbt

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 13:31:54 UTC 2023

Modified Files:
src/sys/netbt: bt_proto.c

Log Message:
netbt(4): Initialize bt_lock earlier.

Use a driver-class module modcmd init function, instead of a socket
domain init function; the socket-domain ones don't run until after
configure, but we need this to be initialized before configure so
that Bluetooth HCI drivers like ubt(4) can use it.

This is suboptimal but it's the least intrusive way I've thought of
to get this working, even if it's a little grody to make netbt a
`driver-class' (builtin) module.  Note that this doesn't mean netbt
becomes dynamically loadable or unloadable; we're just using a module
for initialization ordering.

PR kern/56988

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/netbt/bt_proto.c

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



CVS commit: src/sys/sys

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 10:31:42 UTC 2023

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

Log Message:
sys/lwp.h: Slightly more paranoia re curlwp in PR port-evbarm/57564.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/sys/lwp.h

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

Modified files:

Index: src/sys/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.218 src/sys/sys/lwp.h:1.219
--- src/sys/sys/lwp.h:1.218	Mon Aug  7 09:41:56 2023
+++ src/sys/sys/lwp.h	Mon Aug  7 10:31:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.218 2023/08/07 09:41:56 riastradh Exp $	*/
+/*	$NetBSD: lwp.h,v 1.219 2023/08/07 10:31:42 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010, 2019, 2020
@@ -539,8 +539,9 @@ CURCPU_IDLE_P(void)
 static __inline void
 KPREEMPT_DISABLE(lwp_t *l)
 {
+	struct lwp *l1 __diagused;
 
-	KASSERTMSG(l == curlwp, "l=%p curlwp=%p", l, curlwp);
+	KASSERTMSG(l == (l1 = curlwp), "l=%p curlwp=%p", l, l1);
 	l->l_nopreempt++;
 	__insn_barrier();
 }
@@ -548,8 +549,9 @@ KPREEMPT_DISABLE(lwp_t *l)
 static __inline void
 KPREEMPT_ENABLE(lwp_t *l)
 {
+	struct lwp *l1 __diagused;
 
-	KASSERTMSG(l == curlwp, "l=%p curlwp=%p", l, curlwp);
+	KASSERTMSG(l == (l1 = curlwp), "l=%p curlwp=%p", l, l1);
 	KASSERT(l->l_nopreempt > 0);
 	__insn_barrier();
 	if (--l->l_nopreempt != 0)



CVS commit: src/sys/sys

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 10:31:42 UTC 2023

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

Log Message:
sys/lwp.h: Slightly more paranoia re curlwp in PR port-evbarm/57564.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/sys/lwp.h

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



CVS commit: src/sys/sys

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 09:41:56 UTC 2023

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

Log Message:
sys/lwp.h: KASSERT -> KASSERTMSG

Might help diagnose PR port-evbarm/57564.


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/sys/lwp.h

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

Modified files:

Index: src/sys/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.217 src/sys/sys/lwp.h:1.218
--- src/sys/sys/lwp.h:1.217	Sat Jul 23 19:15:29 2022
+++ src/sys/sys/lwp.h	Mon Aug  7 09:41:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.217 2022/07/23 19:15:29 mrg Exp $	*/
+/*	$NetBSD: lwp.h,v 1.218 2023/08/07 09:41:56 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010, 2019, 2020
@@ -540,7 +540,7 @@ static __inline void
 KPREEMPT_DISABLE(lwp_t *l)
 {
 
-	KASSERT(l == curlwp);
+	KASSERTMSG(l == curlwp, "l=%p curlwp=%p", l, curlwp);
 	l->l_nopreempt++;
 	__insn_barrier();
 }
@@ -549,7 +549,7 @@ static __inline void
 KPREEMPT_ENABLE(lwp_t *l)
 {
 
-	KASSERT(l == curlwp);
+	KASSERTMSG(l == curlwp, "l=%p curlwp=%p", l, curlwp);
 	KASSERT(l->l_nopreempt > 0);
 	__insn_barrier();
 	if (--l->l_nopreempt != 0)



CVS commit: src/sys/sys

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 09:41:56 UTC 2023

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

Log Message:
sys/lwp.h: KASSERT -> KASSERTMSG

Might help diagnose PR port-evbarm/57564.


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/sys/lwp.h

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



CVS commit: src/sys/arch/x86/x86

2023-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  7 09:27:14 UTC 2023

Modified Files:
src/sys/arch/x86/x86: procfs_machdep.c

Log Message:
Update /proc/cpuinfo.

 - Move "ssbd" to an unused Linux mapping.
 - Update unused Linux mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/x86/procfs_machdep.c

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



CVS commit: src/sys/arch/x86/x86

2023-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  7 09:27:14 UTC 2023

Modified Files:
src/sys/arch/x86/x86: procfs_machdep.c

Log Message:
Update /proc/cpuinfo.

 - Move "ssbd" to an unused Linux mapping.
 - Update unused Linux mappings.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/x86/procfs_machdep.c

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.47 src/sys/arch/x86/x86/procfs_machdep.c:1.48
--- src/sys/arch/x86/x86/procfs_machdep.c:1.47	Tue Apr 11 02:42:15 2023
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Aug  7 09:27:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.47 2023/04/11 02:42:15 msaitoh Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.48 2023/08/07 09:27:14 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.47 2023/04/11 02:42:15 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.48 2023/08/07 09:27:14 msaitoh Exp $");
 
 #include 
 #include 
@@ -113,14 +113,15 @@ static const char * const x86_features[]
 	"perfctr_llc", "mwaitx", NULL, NULL},
 
 	{ /* (7) Linux mapping */
-	NULL, NULL, "cpb", "ebp", NULL, "pln", "pts", "dtherm",
-	"hw_pstate", "proc_feedback", NULL, NULL,
-	NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, "ibrs", "ibpb", "stibp", NULL, NULL, NULL, NULL},
+	"ring3mwait", "cpuid_fault", "cpb", "epb",
+	"cat_l3", "cat_l2", "cdp_l3", "invpcid_single",
+	"hw_pstate", "proc_feedback", NULL, "pti",
+	NULL, NULL, "intel_ppin", "cdp_l2",
+	NULL, "ssbd", "mba", NULL, "perfmon_v2", NULL, NULL, NULL,
+	NULL, "ibrs", "ibpb", "stibp", NULL, NULL, "ibrs_enhanced", NULL},
 
 	{ /* (8) Linux mapping */
-	"tpr_shadow", "vnmi", "flexpriority", "ept", "vpid", NULL, NULL, NULL,
+	"tpr_shadow", "flexpriority", "ept", "vpid", NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "vmmcall",
 	NULL, "ept_ad", NULL, NULL, NULL, NULL, "tdx_guest", NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
@@ -195,7 +196,7 @@ static const char * const x86_features[]
 	"tsxldtrk", NULL, "pconfig", "arch_lbr",
 	"ibt", NULL, "amx_bf16", "avx512_fp16",
 	"amx_tile", "amx_int8", NULL, NULL,
-	"flush_l1d", "arch_capabilities", NULL, "ssbd"},
+	"flush_l1d", "arch_capabilities", NULL, NULL},
 
 	{ /* (19) AMD 0x801f eax */
 	"sme", "sev", NULL, "sev_es", NULL, NULL, NULL, NULL,



CVS commit: src/lib/libm/src

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 08:54:40 UTC 2023

Modified Files:
src/lib/libm/src: ldbl_dummy.c

Log Message:
libm: Add dummy remainderl and remquol.

These are pretty bad -- these aren't transcendental functions; not
rocket science to make them correctly rounded -- but let's just make
sure they're available in libm for netbsd-10.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/ldbl_dummy.c

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

Modified files:

Index: src/lib/libm/src/ldbl_dummy.c
diff -u src/lib/libm/src/ldbl_dummy.c:1.3 src/lib/libm/src/ldbl_dummy.c:1.4
--- src/lib/libm/src/ldbl_dummy.c:1.3	Mon Mar 13 18:18:36 2023
+++ src/lib/libm/src/ldbl_dummy.c	Mon Aug  7 08:54:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ldbl_dummy.c,v 1.3 2023/03/13 18:18:36 riastradh Exp $ */
+/* $NetBSD: ldbl_dummy.c,v 1.4 2023/08/07 08:54:40 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ldbl_dummy.c,v 1.3 2023/03/13 18:18:36 riastradh Exp $");
+__RCSID("$NetBSD: ldbl_dummy.c,v 1.4 2023/08/07 08:54:40 riastradh Exp $");
 
 #include "namespace.h"
 #include 
@@ -222,3 +222,15 @@ tgammal(long double x)
 {
 	return tgamma(x);
 }
+
+long double
+remainderl(long double x, long double y)
+{
+	return remainder(x, y);
+}
+
+long double
+remquol(long double x, long double y, int *quo)
+{
+	return remquo(x, y, quo);
+}



CVS commit: src/lib/libm/src

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 08:54:40 UTC 2023

Modified Files:
src/lib/libm/src: ldbl_dummy.c

Log Message:
libm: Add dummy remainderl and remquol.

These are pretty bad -- these aren't transcendental functions; not
rocket science to make them correctly rounded -- but let's just make
sure they're available in libm for netbsd-10.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/ldbl_dummy.c

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



CVS commit: src/share/man/man4

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 06:27:38 UTC 2023

Modified Files:
src/share/man/man4: rnd.4

Log Message:
rnd(4): Document `entropy: best effort' in random(4).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/share/man/man4/rnd.4

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/man4/rnd.4
diff -u src/share/man/man4/rnd.4:1.40 src/share/man/man4/rnd.4:1.41
--- src/share/man/man4/rnd.4:1.40	Sun Mar 20 18:19:57 2022
+++ src/share/man/man4/rnd.4	Mon Aug  7 06:27:37 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rnd.4,v 1.40 2022/03/20 18:19:57 riastradh Exp $
+.\"	$NetBSD: rnd.4,v 1.41 2023/08/07 06:27:37 riastradh Exp $
 .\"
 .\" Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 1, 2020
+.Dd August 7, 2023
 .Dt RND 4
 .Os
 .\"
@@ -613,6 +613,12 @@ A buggy bootloader tried to provide an e
 the kernel.
 Subsequent seeds will be entered into the entropy pool, but they will
 be considered to contribute no entropy.
+.It entropy: best effort
+The system has gathered enough samples from interrupt timings and other
+non-confident sources of entropy for the first time to unblock
+.Pa /dev/random ,
+but it may not have full entropy from a seed or hardware random number
+generator.
 .It entropy: ready
 The system has full entropy for the first time.
 .El



CVS commit: src/share/man/man4

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 06:27:38 UTC 2023

Modified Files:
src/share/man/man4: rnd.4

Log Message:
rnd(4): Document `entropy: best effort' in random(4).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/share/man/man4/rnd.4

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



CVS commit: src/sys/dev/pci

2023-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  7 06:24:35 UTC 2023

Modified Files:
src/sys/dev/pci: ichsmb.c ismt.c

Log Message:
ichsmb(4),ismt(4): Add Snow Ridge support.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ismt.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/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.84 src/sys/dev/pci/ichsmb.c:1.85
--- src/sys/dev/pci/ichsmb.c:1.84	Sun Jul 23 05:54:25 2023
+++ src/sys/dev/pci/ichsmb.c	Mon Aug  7 06:24:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.84 2023/07/23 05:54:25 msaitoh Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.85 2023/08/07 06:24:35 msaitoh Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.84 2023/07/23 05:54:25 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.85 2023/08/07 06:24:35 msaitoh Exp $");
 
 #include 
 #include 
@@ -155,6 +155,7 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_GLK_SMB:
 		case PCI_PRODUCT_INTEL_EHL_SMB:
 		case PCI_PRODUCT_INTEL_JSL_SMB:
+		case PCI_PRODUCT_INTEL_SNR_SMB_LEGACY:
 		case PCI_PRODUCT_INTEL_ADL_N_SMB:
 		case PCI_PRODUCT_INTEL_C600_SMBUS:
 		case PCI_PRODUCT_INTEL_C600_SMB_0:

Index: src/sys/dev/pci/ismt.c
diff -u src/sys/dev/pci/ismt.c:1.10 src/sys/dev/pci/ismt.c:1.11
--- src/sys/dev/pci/ismt.c:1.10	Wed May 10 00:11:57 2023
+++ src/sys/dev/pci/ismt.c	Mon Aug  7 06:24:35 2023
@@ -60,7 +60,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ismt/ismt.c 266474 2014-05-20 19:55:06Z jimharris $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ismt.c,v 1.10 2023/05/10 00:11:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ismt.c,v 1.11 2023/08/07 06:24:35 msaitoh Exp $");
 
 #include 
 #include 
@@ -776,6 +776,7 @@ ismt_match(device_t parent, cfdata_t mat
 	case PCI_PRODUCT_INTEL_S1200_SMBUS_1:
 	case PCI_PRODUCT_INTEL_C2000_SMBUS:
 	case PCI_PRODUCT_INTEL_C3K_SMBUS:
+	case PCI_PRODUCT_INTEL_SNR_SMB_HOST:
 		break;
 	default:
 		return 0;



CVS commit: src/sys/dev/pci

2023-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  7 06:24:35 UTC 2023

Modified Files:
src/sys/dev/pci: ichsmb.c ismt.c

Log Message:
ichsmb(4),ismt(4): Add Snow Ridge support.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ismt.c

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



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

2023-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  7 06:23:40 UTC 2023

Modified Files:
src/sys/arch/x86/pci: pci_machdep.c

Log Message:
Fix detection of availability of MSI/MSI-X on some systems.

Try to find all functions on bus 0, device 0 to find a PCI host bridge.
Some CPU's host bridge is at 0:0.4. Tested by Intel Snow Ridge.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x86/pci/pci_machdep.c

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



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

2023-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  7 06:23:40 UTC 2023

Modified Files:
src/sys/arch/x86/pci: pci_machdep.c

Log Message:
Fix detection of availability of MSI/MSI-X on some systems.

Try to find all functions on bus 0, device 0 to find a PCI host bridge.
Some CPU's host bridge is at 0:0.4. Tested by Intel Snow Ridge.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x86/pci/pci_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.93 src/sys/arch/x86/pci/pci_machdep.c:1.94
--- src/sys/arch/x86/pci/pci_machdep.c:1.93	Tue Sep  6 01:44:24 2022
+++ src/sys/arch/x86/pci/pci_machdep.c	Mon Aug  7 06:23:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.93 2022/09/06 01:44:24 msaitoh Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.94 2023/08/07 06:23:39 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.93 2022/09/06 01:44:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.94 2023/08/07 06:23:39 msaitoh Exp $");
 
 #include 
 #include 
@@ -485,6 +485,8 @@ pci_attach_hook(device_t parent, device_
 	pci_chipset_tag_t pc = pba->pba_pc;
 	pcitag_t tag;
 	pcireg_t id, class;
+	int i;
+	bool havehb = false;
 #endif
 
 	if (pba->pba_bus == 0)
@@ -502,19 +504,25 @@ pci_attach_hook(device_t parent, device_
 #ifdef __HAVE_PCI_MSI_MSIX
 	/*
 	 * In order to decide whether the system supports MSI we look
-	 * at the host bridge, which should be device 0 function 0 on
-	 * bus 0.  It is better to not enable MSI on systems that
+	 * at the host bridge, which should be device 0 on bus 0.
+	 * It is better to not enable MSI on systems that
 	 * support it than the other way around, so be conservative
 	 * here.  So we don't enable MSI if we don't find a host
 	 * bridge there.  We also deliberately don't enable MSI on
 	 * chipsets from low-end manifacturers like VIA and SiS.
 	 */
-	tag = pci_make_tag(pc, 0, 0, 0);
-	id = pci_conf_read(pc, tag, PCI_ID_REG);
-	class = pci_conf_read(pc, tag, PCI_CLASS_REG);
-
-	if (PCI_CLASS(class) != PCI_CLASS_BRIDGE ||
-	PCI_SUBCLASS(class) != PCI_SUBCLASS_BRIDGE_HOST)
+	for (i = 0; i <= 7; i++) {
+		tag = pci_make_tag(pc, 0, 0, i);
+		id = pci_conf_read(pc, tag, PCI_ID_REG);
+		class = pci_conf_read(pc, tag, PCI_CLASS_REG);
+
+		if (PCI_CLASS(class) == PCI_CLASS_BRIDGE &&
+		PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_HOST) {
+			havehb = true;
+			break;
+		}
+	}
+	if (havehb == false)
 		return;
 
 	/* VMware and KVM use old chipset, but they can use MSI/MSI-X */