CVS commit: xsrc/external/mit/xf86-input-ws/dist/src

2024-02-07 Thread Olaf Seibert
Module Name:xsrc
Committed By:   rhialto
Date:   Wed Feb  7 18:01:48 UTC 2024

Modified Files:
xsrc/external/mit/xf86-input-ws/dist/src: ws.c

Log Message:
xf86-input-ws: print log message about touchpad scrolling only once.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 xsrc/external/mit/xf86-input-ws/dist/src/ws.c

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



CVS commit: xsrc/external/mit/xf86-input-ws/dist/src

2024-02-07 Thread Olaf Seibert
Module Name:xsrc
Committed By:   rhialto
Date:   Wed Feb  7 18:01:48 UTC 2024

Modified Files:
xsrc/external/mit/xf86-input-ws/dist/src: ws.c

Log Message:
xf86-input-ws: print log message about touchpad scrolling only once.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 xsrc/external/mit/xf86-input-ws/dist/src/ws.c

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

Modified files:

Index: xsrc/external/mit/xf86-input-ws/dist/src/ws.c
diff -u xsrc/external/mit/xf86-input-ws/dist/src/ws.c:1.16 xsrc/external/mit/xf86-input-ws/dist/src/ws.c:1.17
--- xsrc/external/mit/xf86-input-ws/dist/src/ws.c:1.16	Sat Dec  4 15:21:55 2021
+++ xsrc/external/mit/xf86-input-ws/dist/src/ws.c	Wed Feb  7 18:01:48 2024
@@ -747,7 +747,9 @@ wsReadInput(InputInfoPtr pInfo)
 			dw = 0;
 		}
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
-		if (hscroll || vscroll) {
+		static int warned = 0;
+		if ((hscroll || vscroll) && !warned) {
+			warned = 1;
 			xf86Msg(X_WARNING, "%s: hscroll=%d, vscroll=%d\n",
 			pInfo->name, hscroll, vscroll);
 			valuator_mask_zero(priv->scroll_mask);



CVS commit: src/sys/lib/libkern

2024-01-01 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Mon Jan  1 20:33:34 UTC 2024

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
avoid dependency on NETBSDSRCDIR being set.

(similar to an earlier commit)
due to various things, non-build.sh builds don't have it set already
and it ends up defaulting to /usr/src, so if that doesn't exist or
is the wrong version, building libkern fails.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.53 src/sys/lib/libkern/Makefile.libkern:1.54
--- src/sys/lib/libkern/Makefile.libkern:1.53	Wed Oct 27 03:06:59 2021
+++ src/sys/lib/libkern/Makefile.libkern	Mon Jan  1 20:33:34 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.53 2021/10/27 03:06:59 ryo Exp $
+#	$NetBSD: Makefile.libkern,v 1.54 2024/01/01 20:33:34 rhialto Exp $
 
 #
 # Variable definitions for libkern.
@@ -102,7 +102,7 @@ SRCS+=	entpool.c
 SRCS+=	dkcksum.c
 SRCS+=	disklabel_swap.c
 
-.PATH:	${NETBSDSRCDIR}/common/lib/libc/cdb
+.PATH:	${.PARSEDIR}/../../../common/lib/libc/cdb
 SRCS+=	cdbr.c
 SRCS+=	mi_vector_hash.c
 



CVS commit: src/sys/lib/libkern

2024-01-01 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Mon Jan  1 20:33:34 UTC 2024

Modified Files:
src/sys/lib/libkern: Makefile.libkern

Log Message:
avoid dependency on NETBSDSRCDIR being set.

(similar to an earlier commit)
due to various things, non-build.sh builds don't have it set already
and it ends up defaulting to /usr/src, so if that doesn't exist or
is the wrong version, building libkern fails.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/lib/libkern/Makefile.libkern

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



CVS commit: src/sys/dev/qbus

2021-12-20 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Mon Dec 20 17:12:41 UTC 2021

Modified Files:
src/sys/dev/qbus: if_qt.c if_qtreg.h

Log Message:
Set up multicast (input) filter on qt (DELQA-Turbo).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/qbus/if_qt.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/qbus/if_qtreg.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/dev/qbus/if_qt.c
diff -u src/sys/dev/qbus/if_qt.c:1.25 src/sys/dev/qbus/if_qt.c:1.26
--- src/sys/dev/qbus/if_qt.c:1.25	Wed Jan 29 05:57:21 2020
+++ src/sys/dev/qbus/if_qt.c	Mon Dec 20 17:12:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qt.c,v 1.25 2020/01/29 05:57:21 thorpej Exp $	*/
+/*	$NetBSD: if_qt.c,v 1.26 2021/12/20 17:12:41 rhialto Exp $	*/
 /*
  * Copyright (c) 1992 Steven M. Schultz
  * All rights reserved.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_qt.c,v 1.25 2020/01/29 05:57:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qt.c,v 1.26 2021/12/20 17:12:41 rhialto Exp $");
 
 #include "opt_inet.h"
 
@@ -162,6 +162,7 @@ struct	qt_softc {
 
 static	int qtmatch(device_t, cfdata_t, void *);
 static	void qtattach(device_t, device_t, void *);
+static	void lance_setladrf(struct ethercom *ec, uint16_t *af);
 static	void qtintr(void *);
 static	int qtinit(struct ifnet *);
 static	int qtioctl(struct ifnet *, u_long, void *);
@@ -332,6 +333,67 @@ qtturbo(struct qt_softc *sc)
 	return(1);
 }
 
+#define ETHER_CMP(a,b)	memcmp((a), (b), 6)
+
+/*
+ * Set up the logical address filter.
+ */
+void
+lance_setladrf(struct ethercom *ec, uint16_t *af)
+{
+	struct ifnet *ifp = >ec_if;
+	struct ether_multi *enm;
+	uint32_t crc;
+	struct ether_multistep step;
+
+	/*
+	 * Set up multicast address filter by passing all multicast addresses
+	 * through a crc generator, and then using the high order 6 bits as an
+	 * index into the 64 bit logical address filter.  The high order bit
+	 * selects the word, while the rest of the bits select the bit within
+	 * the word.
+	 */
+
+	if (ifp->if_flags & IFF_PROMISC)
+		goto allmulti;
+
+	af[0] = af[1] = af[2] = af[3] = 0x;
+
+	ETHER_LOCK(ec);
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (ETHER_CMP(enm->enm_addrlo, enm->enm_addrhi)) {
+			/*
+			 * We must listen to a range of multicast addresses.
+			 * For now, just accept all multicasts, rather than
+			 * trying to set only those filter bits needed to match
+			 * the range.  (At this time, the only use of address
+			 * ranges is for IP multicast routing, for which the
+			 * range is big enough to require all bits set.)
+			 */
+			ETHER_UNLOCK(ec);
+			goto allmulti;
+		}
+
+		crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
+
+		/* Just want the 6 most significant bits. */
+		crc >>= 26;
+
+		/* Set the corresponding bit in the filter. */
+		af[crc >> 4] |= 1 << (crc & 0xf);
+
+		ETHER_NEXT_MULTI(step, enm);
+	}
+	ETHER_UNLOCK(ec);
+	ifp->if_flags &= ~IFF_ALLMULTI;
+	return;
+
+allmulti:
+	ifp->if_flags |= IFF_ALLMULTI;
+	af[0] = af[1] = af[2] = af[3] = 0x;
+}
+
 int
 qtinit(struct ifnet *ifp)
 {
@@ -388,7 +450,10 @@ qtinit(struct ifnet *ifp)
 	}
 	iniblk = >sc_ib->qc_init;
 	iniblk->mode = ifp->if_flags & IFF_PROMISC ? INIT_MODE_PRO : 0;
-
+/*
+ * The multicast filter works "like LANCE".
+ */
+	lance_setladrf(>is_ec, iniblk->laddr);
 
 /*
  * Now initialize the receive ring descriptors.  Because this routine can be

Index: src/sys/dev/qbus/if_qtreg.h
diff -u src/sys/dev/qbus/if_qtreg.h:1.5 src/sys/dev/qbus/if_qtreg.h:1.6
--- src/sys/dev/qbus/if_qtreg.h:1.5	Sun Dec 11 12:23:29 2005
+++ src/sys/dev/qbus/if_qtreg.h	Mon Dec 20 17:12:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qtreg.h,v 1.5 2005/12/11 12:23:29 christos Exp $	*/
+/*	$NetBSD: if_qtreg.h,v 1.6 2021/12/20 17:12:41 rhialto Exp $	*/
 /*
  * Copyright (c) 1992 Steven M. Schultz
  * All rights reserved.
@@ -207,18 +207,18 @@
 
 	struct	qt_init
 		{
-		short	mode;
-		u_char	paddr[6];	/* 48 bit physical address */
-		u_char	laddr[8];	/* 64 bit logical address filter */
-		u_short	rx_lo;		/* low 16 bits of receive ring addr */
-		u_short	rx_hi;		/* high 6 bits of receive ring addr */
-		u_short	tx_lo;		/* low 16 bits of transmit ring addr */
-		u_short	tx_hi;		/* high 6 bits of transmit ring addr */
-		u_short	options;
-		u_short	vector;
-		u_short	hit;
-		char	passwd[6];
-		char	pad[4];		/* even on 40 byte for alignment */
+		int16_t		mode;
+		u_char		paddr[6];	/* 48 bit physical address */
+		uint16_t	laddr[4];	/* 64 bit logical address filter */
+		uint16_t	rx_lo;		/* low 16 bits of receive ring addr */
+		uint16_t	rx_hi;		/* high 6 bits of receive ring addr */
+		uint16_t	tx_lo;		/* low 16 bits of transmit ring addr */
+		uint16_t	tx_hi;		/* high 6 bits of transmit ring addr */
+		uint16_t	options;
+		uint16_t	vector;
+		uint16_t	hit;
+		char		passwd[6];
+		char		pad[4];		/* even on 40 byte for alignment */
 		};
 
 

CVS commit: src/sys/dev/qbus

2021-12-20 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Mon Dec 20 17:12:41 UTC 2021

Modified Files:
src/sys/dev/qbus: if_qt.c if_qtreg.h

Log Message:
Set up multicast (input) filter on qt (DELQA-Turbo).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/qbus/if_qt.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/qbus/if_qtreg.h

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



CVS commit: src/distrib/sets

2019-10-24 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Thu Oct 24 16:52:11 UTC 2019

Modified Files:
src/distrib/sets: join.awk regpkg

Log Message:
Solve [ vs. \133 in join.awk which replaces fix in r1.23 of regpkg. Ok uki@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/join.awk
cvs rdiff -u -r1.23 -r1.24 src/distrib/sets/regpkg

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/join.awk
diff -u src/distrib/sets/join.awk:1.6 src/distrib/sets/join.awk:1.7
--- src/distrib/sets/join.awk:1.6	Fri Oct 24 22:19:44 2014
+++ src/distrib/sets/join.awk	Thu Oct 24 16:52:11 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: join.awk,v 1.6 2014/10/24 22:19:44 riz Exp $
+#	$NetBSD: join.awk,v 1.7 2019/10/24 16:52:11 rhialto Exp $
 #
 # Copyright (c) 2002 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -30,7 +30,9 @@
 # join.awk F1 F2
 #	Similar to join(1), this reads a list of words from F1
 #	and outputs lines in F2 with a first word that is in F1.
-#	Neither file needs to be sorted
+#	For purposes of matching the first word, both instances are
+#	canonicalised via unvis(word); the version from F2 is printed.
+#	Neither file needs to be sorted.
 
 function unvis(s) \
 {
@@ -79,17 +81,16 @@ BEGIN \
 		exit 1
 	}
 	while ( (getline < ARGV[1]) > 0) {
-		$1 = unvis($1)
-		words[$1] = $0
+		f1 = unvis($1)
+		words[f1] = $0
 	}
 	delete ARGV[1]
 }
 
-// { $1 = unvis($1) }
+{ f1 = unvis($1) }
 
-$1 in words \
+f1 in words \
 {
-	f1=$1
 	$1=""
 	print words[f1] $0
 }

Index: src/distrib/sets/regpkg
diff -u src/distrib/sets/regpkg:1.23 src/distrib/sets/regpkg:1.24
--- src/distrib/sets/regpkg:1.23	Thu Apr 11 08:34:19 2019
+++ src/distrib/sets/regpkg	Thu Oct 24 16:52:11 2019
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# $NetBSD: regpkg,v 1.23 2019/04/11 08:34:19 uki Exp $
+# $NetBSD: regpkg,v 1.24 2019/10/24 16:52:11 rhialto Exp $
 #
 # Copyright (c) 2003,2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -628,7 +628,7 @@ EOF
 	# "@name" line and a lot of "@comment MD5:" lines.
 	#
 	{
-		rcsid='$NetBSD: regpkg,v 1.23 2019/04/11 08:34:19 uki Exp $'
+		rcsid='$NetBSD: regpkg,v 1.24 2019/10/24 16:52:11 rhialto Exp $'
 		utcdate="$(${ENV_CMD} TZ=UTC LOCALE=C \
 			${DATE} '+%Y-%m-%d %H:%M')"
 		user="${USER:-root}"
@@ -836,11 +836,8 @@ EOF
 		if [ -n "${metalog}" ]; then
 			names1="${SCRATCH}/names1"
 			names2="${SCRATCH}/names2"
-			# There is different format between spec1 and spec2 for test(1).
-			# spec1's format is "./bin/\133" but spec2's format is "./bin/["
-			# XXX filtering for only '[' now
-			${AWK} '{print $1}' <"${spec1}" | ${SORT} | sed -e 's,\\133,\[,g' >"${names1}"
-			${AWK} '{print $1}' <"${spec2}" | ${SORT} | sed -e 's,\[,\\133,g' >"${names2}"
+			${AWK} '{print $1}' <"${spec1}" | ${SORT} >"${names1}"
+			${AWK} '{print $1}' <"${spec2}" | ${SORT} >"${names2}"
 			if ${FGREP} -v -f "${names2}" "${spec1}" >/dev/null
 			then
 cat >&2 <

CVS commit: src/distrib/sets

2019-10-24 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Thu Oct 24 16:52:11 UTC 2019

Modified Files:
src/distrib/sets: join.awk regpkg

Log Message:
Solve [ vs. \133 in join.awk which replaces fix in r1.23 of regpkg. Ok uki@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/join.awk
cvs rdiff -u -r1.23 -r1.24 src/distrib/sets/regpkg

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



CVS commit: src/sys/kern

2019-09-29 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Sun Sep 29 12:07:52 UTC 2019

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

Log Message:
Do all delta calculations strictly using uint32_t.  Avoid integer
overflows in calculating absolute deltas by subtracting the right way
around.

Reported-by: syzbot+68c37d09c833f8ec1...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/kern/kern_rndq.c

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

Modified files:

Index: src/sys/kern/kern_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.94 src/sys/kern/kern_rndq.c:1.95
--- src/sys/kern/kern_rndq.c:1.94	Wed Jul 31 02:21:31 2019
+++ src/sys/kern/kern_rndq.c	Sun Sep 29 12:07:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.94 2019/07/31 02:21:31 msaitoh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.95 2019/09/29 12:07:52 rhialto Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.94 2019/07/31 02:21:31 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.95 2019/09/29 12:07:52 rhialto Exp $");
 
 #include 
 #include 
@@ -324,22 +324,24 @@ rnd_getmore(size_t byteswanted)
  * non-zero.  If any of these are zero, return zero.
  */
 static inline uint32_t
-rnd_delta_estimate(rnd_delta_t *d, uint32_t v, int32_t delta)
+rnd_delta_estimate(rnd_delta_t *d, uint32_t v, uint32_t delta)
 {
-	int32_t delta2, delta3;
+	uint32_t delta2, delta3;
 
 	d->insamples++;
 
 	/*
 	 * Calculate the second and third order differentials
 	 */
-	delta2 = d->dx - delta;
-	if (delta2 < 0)
-		delta2 = -delta2;
-
-	delta3 = d->d2x - delta2;
-	if (delta3 < 0)
-		delta3 = -delta3;
+	if (delta > (uint32_t)d->dx)
+	delta2 = delta - (uint32_t)d->dx;
+	else
+	delta2 = (uint32_t)d->dx - delta;
+
+	if (delta2 > (uint32_t)d->d2x)
+	delta3 = delta2 - (uint32_t)d->d2x;
+	else
+	delta3 = (uint32_t)d->d2x - delta2;
 
 	d->x = v;
 	d->dx = delta;
@@ -357,23 +359,21 @@ rnd_delta_estimate(rnd_delta_t *d, uint3
 }
 
 /*
- * Delta estimator for 32-bit timeestamps.  Must handle wrap.
+ * Delta estimator for 32-bit timestamps.
+ * Timestaps generally increase, but may wrap around to 0.
+ * If t decreases, it is assumed that wrap-around occurred (once).
  */
 static inline uint32_t
 rnd_dt_estimate(krndsource_t *rs, uint32_t t)
 {
-	int32_t delta;
+	uint32_t delta;
 	uint32_t ret;
 	rnd_delta_t *d = >time_delta;
 
-	if (t < d->x) {
-		delta = UINT32_MAX - d->x + t;
+	if (t < (uint32_t)d->x) {
+		delta = UINT32_MAX - (uint32_t)d->x + t;
 	} else {
-		delta = d->x - t;
-	}
-
-	if (delta < 0) {
-		delta = -delta;
+		delta = t - (uint32_t)d->x;
 	}
 
 	ret = rnd_delta_estimate(d, t, delta);
@@ -391,21 +391,22 @@ rnd_dt_estimate(krndsource_t *rs, uint32
 }
 
 /*
- * Delta estimator for 32 or bit values.  "Wrap" isn't.
+ * Delta estimator for arbitrary unsigned 32 bit values.
  */
 static inline uint32_t
 rnd_dv_estimate(krndsource_t *rs, uint32_t v)
 {
-	int32_t delta;
+	uint32_t delta;
 	uint32_t ret;
 	rnd_delta_t *d = >value_delta;
 
-	delta = d->x - v;
-
-	if (delta < 0) {
-		delta = -delta;
+	if (v >= (uint32_t)d->x) {
+		delta = v - (uint32_t)d->x;
+	} else {
+		delta = (uint32_t)d->x - v;
 	}
-	ret = rnd_delta_estimate(d, v, (uint32_t)delta);
+
+	ret = rnd_delta_estimate(d, v, delta);
 
 	KASSERT(d->x == v);
 	KASSERT(d->dx == delta);



CVS commit: src/sys/kern

2019-09-29 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Sun Sep 29 12:07:52 UTC 2019

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

Log Message:
Do all delta calculations strictly using uint32_t.  Avoid integer
overflows in calculating absolute deltas by subtracting the right way
around.

Reported-by: syzbot+68c37d09c833f8ec1...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/kern/kern_rndq.c

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