CVS commit: src/sys/arch
Module Name:src Committed By: andvar Date: Tue Feb 20 23:36:02 UTC 2024 Modified Files: src/sys/arch/arm/at91: at91bus.c src/sys/arch/evbarm/adi_brh: brh_machdep.c src/sys/arch/evbarm/armadillo: armadillo9_machdep.c src/sys/arch/evbarm/g42xxeb: g42xxeb_machdep.c src/sys/arch/evbarm/iq80310: iq80310_machdep.c src/sys/arch/evbarm/iyonix: iyonix_machdep.c src/sys/arch/evbarm/lubbock: lubbock_machdep.c src/sys/arch/evbarm/mini2440: mini2440_machdep.c src/sys/arch/evbarm/npwr_fc: npwr_fc_machdep.c src/sys/arch/evbarm/smdk2xx0: smdk2410_machdep.c smdk2800_machdep.c src/sys/arch/evbarm/tsarm: tsarm_machdep.c src/sys/arch/evbarm/viper: viper_machdep.c Log Message: Fix format specifier for physmem from %d to 0x%"PRIxPSIZE" in multiple places. Should fix VERBOSE_INIT_ARM for various evbarm kernel configs. Also add 0x prefix in few previously fixed places to improve readability. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/at91/at91bus.c cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/adi_brh/brh_machdep.c cvs rdiff -u -r1.40 -r1.41 src/sys/arch/evbarm/armadillo/armadillo9_machdep.c cvs rdiff -u -r1.41 -r1.42 src/sys/arch/evbarm/g42xxeb/g42xxeb_machdep.c cvs rdiff -u -r1.96 -r1.97 src/sys/arch/evbarm/iq80310/iq80310_machdep.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/iyonix/iyonix_machdep.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/evbarm/lubbock/lubbock_machdep.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/mini2440/mini2440_machdep.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbarm/npwr_fc/npwr_fc_machdep.c cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbarm/smdk2xx0/smdk2410_machdep.c cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbarm/smdk2xx0/smdk2800_machdep.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbarm/tsarm/tsarm_machdep.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/viper/viper_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/arm/at91/at91bus.c diff -u src/sys/arch/arm/at91/at91bus.c:1.29 src/sys/arch/arm/at91/at91bus.c:1.30 --- src/sys/arch/arm/at91/at91bus.c:1.29 Sat Aug 7 16:18:43 2021 +++ src/sys/arch/arm/at91/at91bus.c Tue Feb 20 23:36:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: at91bus.c,v 1.29 2021/08/07 16:18:43 thorpej Exp $ */ +/* $NetBSD: at91bus.c,v 1.30 2024/02/20 23:36:01 andvar Exp $ */ /* * Copyright (c) 2007 Embedtronics Oy @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: at91bus.c,v 1.29 2021/08/07 16:18:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at91bus.c,v 1.30 2024/02/20 23:36:01 andvar Exp $"); #include "opt_arm_debug.h" #include "opt_console.h" @@ -260,7 +260,7 @@ at91bus_setup(BootConfig *mem) physmem = (physical_end - physical_start) / PAGE_SIZE; #ifdef VERBOSE_INIT_ARM - printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem, + printf("physmemory: 0x%"PRIxPSIZE" pages at 0x%08lx -> 0x%08lx\n", physmem, physical_start, physical_end - 1); #endif Index: src/sys/arch/evbarm/adi_brh/brh_machdep.c diff -u src/sys/arch/evbarm/adi_brh/brh_machdep.c:1.55 src/sys/arch/evbarm/adi_brh/brh_machdep.c:1.56 --- src/sys/arch/evbarm/adi_brh/brh_machdep.c:1.55 Tue Dec 26 09:56:45 2023 +++ src/sys/arch/evbarm/adi_brh/brh_machdep.c Tue Feb 20 23:36:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: brh_machdep.c,v 1.55 2023/12/26 09:56:45 andvar Exp $ */ +/* $NetBSD: brh_machdep.c,v 1.56 2024/02/20 23:36:02 andvar Exp $ */ /* * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: brh_machdep.c,v 1.55 2023/12/26 09:56:45 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: brh_machdep.c,v 1.56 2024/02/20 23:36:02 andvar Exp $"); #include "opt_arm_debug.h" #include "opt_console.h" @@ -407,7 +407,7 @@ initarm(void *arg) #ifdef VERBOSE_INIT_ARM /* Tell the user about the memory */ - printf("physmemory: %"PRIxPSIZE" pages at " + printf("physmemory: 0x%"PRIxPSIZE" pages at " "0x%08"PRIxPADDR" -> 0x%08"PRIxPADDR"\n", physmem, physical_start, physical_end - 1); #endif Index: src/sys/arch/evbarm/armadillo/armadillo9_machdep.c diff -u src/sys/arch/evbarm/armadillo/armadillo9_machdep.c:1.40 src/sys/arch/evbarm/armadillo/armadillo9_machdep.c:1.41 --- src/sys/arch/evbarm/armadillo/armadillo9_machdep.c:1.40 Tue Dec 26 09:56:44 2023 +++ src/sys/arch/evbarm/armadillo/armadillo9_machdep.c Tue Feb 20 23:36:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: armadillo9_machdep.c,v 1.40 2023/12/26 09:56:44 andvar Exp $ */ +/* $NetBSD: armadillo9_machdep.c,v 1.41 2024/02/20 23:36:02 andvar Exp $ */ /* * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. @@ -110,7 +110,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: armadillo9_machdep.c,v 1.40 2023/12/26 09:56:44 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: armadillo9_machdep.c,v 1.41 2024/02/20 23:36:02
CVS commit: src/sys/arch
Module Name:src Committed By: andvar Date: Tue Feb 20 23:36:02 UTC 2024 Modified Files: src/sys/arch/arm/at91: at91bus.c src/sys/arch/evbarm/adi_brh: brh_machdep.c src/sys/arch/evbarm/armadillo: armadillo9_machdep.c src/sys/arch/evbarm/g42xxeb: g42xxeb_machdep.c src/sys/arch/evbarm/iq80310: iq80310_machdep.c src/sys/arch/evbarm/iyonix: iyonix_machdep.c src/sys/arch/evbarm/lubbock: lubbock_machdep.c src/sys/arch/evbarm/mini2440: mini2440_machdep.c src/sys/arch/evbarm/npwr_fc: npwr_fc_machdep.c src/sys/arch/evbarm/smdk2xx0: smdk2410_machdep.c smdk2800_machdep.c src/sys/arch/evbarm/tsarm: tsarm_machdep.c src/sys/arch/evbarm/viper: viper_machdep.c Log Message: Fix format specifier for physmem from %d to 0x%"PRIxPSIZE" in multiple places. Should fix VERBOSE_INIT_ARM for various evbarm kernel configs. Also add 0x prefix in few previously fixed places to improve readability. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/at91/at91bus.c cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/adi_brh/brh_machdep.c cvs rdiff -u -r1.40 -r1.41 src/sys/arch/evbarm/armadillo/armadillo9_machdep.c cvs rdiff -u -r1.41 -r1.42 src/sys/arch/evbarm/g42xxeb/g42xxeb_machdep.c cvs rdiff -u -r1.96 -r1.97 src/sys/arch/evbarm/iq80310/iq80310_machdep.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/iyonix/iyonix_machdep.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/evbarm/lubbock/lubbock_machdep.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/mini2440/mini2440_machdep.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbarm/npwr_fc/npwr_fc_machdep.c cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbarm/smdk2xx0/smdk2410_machdep.c cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbarm/smdk2xx0/smdk2800_machdep.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbarm/tsarm/tsarm_machdep.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/viper/viper_machdep.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/libutil
Module Name:src Committed By: rillig Date: Tue Feb 20 21:45:36 UTC 2024 Modified Files: src/tests/lib/libutil: t_snprintb.c Log Message: tests/snprintb: test '=' and '*' directives that can never match To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/tests/lib/libutil/t_snprintb.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/libutil/t_snprintb.c diff -u src/tests/lib/libutil/t_snprintb.c:1.24 src/tests/lib/libutil/t_snprintb.c:1.25 --- src/tests/lib/libutil/t_snprintb.c:1.24 Tue Feb 20 20:31:56 2024 +++ src/tests/lib/libutil/t_snprintb.c Tue Feb 20 21:45:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: t_snprintb.c,v 1.24 2024/02/20 20:31:56 rillig Exp $ */ +/* $NetBSD: t_snprintb.c,v 1.25 2024/02/20 21:45:36 rillig Exp $ */ /* * Copyright (c) 2002, 2004, 2008, 2010, 2024 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008, 2010, 2024\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_snprintb.c,v 1.24 2024/02/20 20:31:56 rillig Exp $"); +__RCSID("$NetBSD: t_snprintb.c,v 1.25 2024/02/20 21:45:36 rillig Exp $"); #include #include @@ -75,7 +75,9 @@ h_snprintb_loc(const char *file, size_t memset(buf, 'Z', sizeof(buf)); int rv = snprintb(buf, bufsize, bitfmt, val); - ATF_REQUIRE(rv >= 0); + ATF_CHECK_MSG(rv >= 0, "%s:%zu: unexpected rv %d", file, line, rv); + if (rv < 0) + return; size_t have_bufsize = sizeof(buf); while (have_bufsize > 0 && buf[have_bufsize - 1] == 'Z') have_bufsize--; @@ -681,6 +683,15 @@ ATF_TC_BODY(snprintb, tc) 0x3, "0x3"); + // new style bit-field, '=', can never match + h_snprintb( + "\177\020" + "f\000\007f\0" + "=\200never\0" + "=\377never\0", + 0xff, + "0xff"); + // new style, two separate bit-fields h_snprintb( "\177\020" @@ -763,6 +774,18 @@ ATF_TC_BODY(snprintb, tc) 0x1122, "0x1122"); + // new style bit-field default, can never match + h_snprintb( + "\177\020" + "f\010\002f\0" + "=\000zero\0" + "=\001one\0" + "=\002two\0" + "=\003three\0" + "*other\0", + 0xff00, + "0xff00"); + // new style bit-field default, invalid conversion specifier // // There is no reliable way to make snprintf return an error, as such
CVS commit: src/tests/lib/libutil
Module Name:src Committed By: rillig Date: Tue Feb 20 21:45:36 UTC 2024 Modified Files: src/tests/lib/libutil: t_snprintb.c Log Message: tests/snprintb: test '=' and '*' directives that can never match To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/tests/lib/libutil/t_snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libutil
Module Name:src Committed By: rillig Date: Tue Feb 20 20:38:54 UTC 2024 Modified Files: src/lib/libutil: snprintb.3 Log Message: snprintb.3: sync examples with reality To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/lib/libutil/snprintb.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libutil/snprintb.3 diff -u src/lib/libutil/snprintb.3:1.32 src/lib/libutil/snprintb.3:1.33 --- src/lib/libutil/snprintb.3:1.32 Sun Feb 18 16:55:02 2024 +++ src/lib/libutil/snprintb.3 Tue Feb 20 20:38:54 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: snprintb.3,v 1.32 2024/02/18 16:55:02 rillig Exp $ +.\" $NetBSD: snprintb.3,v 1.33 2024/02/20 20:38:54 rillig Exp $ .\" .\" Copyright (c) 1998 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 February 18, 2024 +.Dd February 20, 2024 .Dt SNPRINTB 3 .Os .Sh NAME @@ -305,7 +305,7 @@ snprintb(buf, bufsize, "f\ex10\e4BURST\e0" "=\e4FOUR\e0" "=\exf""FIFTEEN\e0" "b\ex1fMSB\e0", 0x800f0701) -\(rA "0x800f0701" +\(rA "0x800f0701" .Ed .Pp The same example using snprintb_m: @@ -316,7 +316,7 @@ snprintb_m(buf, bufsize, "f\ex10\e4BURST\e0" "=\e4FOUR\e0" "=\exf""FIFTEEN\e0" "b\ex1fMSB\e0", 0x800f0701, 34) -\(rA "0x800f0701\e0" +\(rA "0x800f0701\e0" "0x800f0701\e0" "" .Ed @@ -377,7 +377,7 @@ snprintb(buf, bufsize, MAP_FMT, 0x0d0012 \(rA "0xd001234" snprintb(buf, bufsize, MAP_FMT, 0x2e00) -\(rA "0xd001234<0x2e00" +\(rA "0x2e00" .Ed .Sh ERRORS .Fn snprintb
CVS commit: src/lib/libutil
Module Name:src Committed By: rillig Date: Tue Feb 20 20:38:54 UTC 2024 Modified Files: src/lib/libutil: snprintb.3 Log Message: snprintb.3: sync examples with reality To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/lib/libutil/snprintb.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Feb 20 20:31:56 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c src/tests/lib/libutil: t_snprintb.c Log Message: snprintb_m: limit length of generated strings The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/common/lib/libutil/snprintb.c cvs rdiff -u -r1.23 -r1.24 src/tests/lib/libutil/t_snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Feb 20 20:31:56 UTC 2024 Modified Files: src/common/lib/libutil: snprintb.c src/tests/lib/libutil: t_snprintb.c Log Message: snprintb_m: limit length of generated strings The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/common/lib/libutil/snprintb.c cvs rdiff -u -r1.23 -r1.24 src/tests/lib/libutil/t_snprintb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/snprintb.c diff -u src/common/lib/libutil/snprintb.c:1.36 src/common/lib/libutil/snprintb.c:1.37 --- src/common/lib/libutil/snprintb.c:1.36 Mon Feb 19 23:30:56 2024 +++ src/common/lib/libutil/snprintb.c Tue Feb 20 20:31:56 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: snprintb.c,v 1.36 2024/02/19 23:30:56 rillig Exp $ */ +/* $NetBSD: snprintb.c,v 1.37 2024/02/20 20:31:56 rillig Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ # include # if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.36 2024/02/19 23:30:56 rillig Exp $"); +__RCSID("$NetBSD: snprintb.c,v 1.37 2024/02/20 20:31:56 rillig Exp $"); # endif # include @@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.36 2024 # include # else /* ! _KERNEL */ # include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.36 2024/02/19 23:30:56 rillig Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.37 2024/02/20 20:31:56 rillig Exp $"); # include # include # include @@ -69,13 +69,8 @@ typedef struct { const char *const num_fmt; unsigned const val_len; unsigned total_len; - unsigned line_len; - - const char *cur_bitfmt; - int restart; - - const char *sep_bitfmt; - unsigned sep_line_len; + unsigned line_pos; + unsigned comma_pos; char sep; } state; @@ -85,100 +80,77 @@ store(state *s, char c) if (s->total_len < s->bufsize) s->buf[s->total_len] = c; s->total_len++; - s->line_len++; } -static void -backup(state *s) +static int +store_num(state *s, const char *fmt, uintmax_t num) { - if (s->sep_line_len > 0) { - s->total_len -= s->line_len - s->sep_line_len; - s->sep_line_len = 0; - s->restart = 1; - s->bitfmt = s->sep_bitfmt; - } - store(s, '>'); - store(s, '\0'); - if (s->total_len < s->bufsize) - snprintf(s->buf + s->total_len, s->bufsize - s->total_len, - s->num_fmt, (uintmax_t)s->val); - s->total_len += s->val_len; - s->line_len = s->val_len; + int num_len = s->total_len < s->bufsize + ? snprintf(s->buf + s->total_len, s->bufsize - s->total_len, + fmt, num) + : snprintf(NULL, 0, fmt, num); + if (num_len > 0) + s->total_len += num_len; + return num_len; } static void -put_sep(state *s) +put_eol(state *s) { - if (s->line_max > 0 && s->line_len >= s->line_max) { - backup(s); - store(s, '<'); - } else { - if (s->line_max > 0 && s->sep != '<') { - s->sep_line_len = s->line_len; - s->sep_bitfmt = s->cur_bitfmt; - } - store(s, s->sep); - s->restart = 0; + if (s->total_len - s->line_pos > s->line_max) { + s->total_len = (unsigned)(s->line_pos + s->line_max - 1); + store(s, '#'); } + store(s, '\0'); + s->line_pos = s->total_len; + s->comma_pos = 0; + s->sep = '<'; } static void -put_chr(state *s, char c) +put_sep(state *s) { - if (s->line_max > 0 && s->line_len >= s->line_max - 1) { - backup(s); - if (s->restart == 0) - store(s, c); - else - s->sep = '<'; + if (s->sep == ',') { + s->comma_pos = s->total_len; + store(s, ','); } else { - store(s, c); - s->restart = 0; + store(s, '<'); + s->sep = ','; } } static void -put_bitfmt(state *s) +wrap_if_necessary(state *s, const char *bitfmt) { - while (*s->bitfmt++ != 0) { - put_chr(s, s->bitfmt[-1]); - if (s->restart) - break; + if (s->line_max > 0 + && s->comma_pos > 0 + && s->total_len - s->line_pos >= s->line_max) { + s->total_len = s->comma_pos; + store(s, '>'); + put_eol(s); + store_num(s, s->num_fmt, s->val); + s->bitfmt = bitfmt; } } static int -put_num(state *s, const char *fmt, uintmax_t v) -{ - char *bp = s->total_len < s->bufsize ? s->buf + s->total_len : NULL; - size_t n = s->total_len < s->bufsize ? s->bufsize - s->total_len : 0; - int fmt_len = snprintf(bp, n, fmt, v); - if (fmt_len >= 0) { - s->total_len += fmt_len; - s->line_len += fmt_len; - } - return fmt_len; -} - -static void old_style(state *s) { - for (uint8_t bit; (bit = *s->bitfmt) != 0;) { - s->cur_bitfmt = s->bitfmt++; + while (*s->bitfmt != '\0') { + const char *cur_bitfmt = s->bitfmt; + uint8_t bit = *s->bitfmt; + if (bit > ' ') + return -1; if (s->val & (1U << (bit - 1))) { put_sep(s); - if (s->restart) -continue; - s->sep = ','; - for (; *s->bitfmt
CVS commit: src/tests/lib/libutil
Module Name:src Committed By: rillig Date: Tue Feb 20 19:49:10 UTC 2024 Modified Files: src/tests/lib/libutil: t_snprintb.c Log Message: tests/snprintb: fix out-of-bounds memory read (since 2024-02-16) Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't. Fixes PR lib/57951. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/tests/lib/libutil/t_snprintb.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/libutil/t_snprintb.c diff -u src/tests/lib/libutil/t_snprintb.c:1.22 src/tests/lib/libutil/t_snprintb.c:1.23 --- src/tests/lib/libutil/t_snprintb.c:1.22 Mon Feb 19 23:30:56 2024 +++ src/tests/lib/libutil/t_snprintb.c Tue Feb 20 19:49:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: t_snprintb.c,v 1.22 2024/02/19 23:30:56 rillig Exp $ */ +/* $NetBSD: t_snprintb.c,v 1.23 2024/02/20 19:49:10 rillig Exp $ */ /* * Copyright (c) 2002, 2004, 2008, 2010, 2024 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008, 2010, 2024\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_snprintb.c,v 1.22 2024/02/19 23:30:56 rillig Exp $"); +__RCSID("$NetBSD: t_snprintb.c,v 1.23 2024/02/20 19:49:10 rillig Exp $"); #include #include @@ -48,9 +48,11 @@ vis_arr(const char *arr, size_t arrsize) static size_t i; i = (i + 1) % (sizeof(buf) / sizeof(buf[0])); - int rv = strnvisx(buf[i], sizeof(buf[i]), arr, arrsize, + buf[i][0] = '"'; + int rv = strnvisx(buf[i] + 1, sizeof(buf[i]) - 2, arr, arrsize, VIS_WHITE | VIS_OCTAL); ATF_REQUIRE_MSG(rv >= 0, "strnvisx failed for size %zu", arrsize); + strcpy(buf[i] + 1 + rv, "\""); return buf[i]; } @@ -95,7 +97,8 @@ h_snprintb_loc(const char *file, size_t ATF_CHECK_MSG( rv == want_rv && memcmp(buf, want_buf, want_bufsize) == 0 - && buf[rlen < bufsize ? rlen : bufsize - 1] == '\0', + && (bufsize < 1 + || buf[rlen < bufsize ? rlen : bufsize - 1] == '\0'), "failed:\n" "\ttest case: %s:%zu\n" "\tformat: %s\n" @@ -1110,7 +1113,12 @@ h_snprintb_m_loc(const char *file, size_ size_t total = rv; ATF_CHECK_MSG( - total == want_rv && memcmp(buf, want_buf, want_bufsize) == 0, + total == want_rv + && memcmp(buf, want_buf, want_bufsize) == 0 + && (bufsize < 1 + || buf[total < bufsize ? total : bufsize - 1] == '\0') + && (bufsize < 2 + || buf[total < bufsize ? total - 1 : bufsize - 2] == '\0'), "failed:\n" "\ttest case: %s:%zu\n" "\tformat: %s\n"
CVS commit: src/tests/lib/libutil
Module Name:src Committed By: rillig Date: Tue Feb 20 19:49:10 UTC 2024 Modified Files: src/tests/lib/libutil: t_snprintb.c Log Message: tests/snprintb: fix out-of-bounds memory read (since 2024-02-16) Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't. Fixes PR lib/57951. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/tests/lib/libutil/t_snprintb.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/hp300/stand/mkboot
Module Name:src Committed By: christos Date: Tue Feb 20 16:53:22 UTC 2024 Modified Files: src/sys/arch/hp300/stand/mkboot: Makefile mkboot.c Log Message: add missing chunk for repro-build. fix gcc warnings. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/mkboot/Makefile cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot
Module Name:src Committed By: christos Date: Tue Feb 20 16:53:22 UTC 2024 Modified Files: src/sys/arch/hp300/stand/mkboot: Makefile mkboot.c Log Message: add missing chunk for repro-build. fix gcc warnings. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/mkboot/Makefile cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/mkboot/mkboot.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/hp300/stand/mkboot/Makefile diff -u src/sys/arch/hp300/stand/mkboot/Makefile:1.11 src/sys/arch/hp300/stand/mkboot/Makefile:1.12 --- src/sys/arch/hp300/stand/mkboot/Makefile:1.11 Sun Dec 11 07:17:23 2005 +++ src/sys/arch/hp300/stand/mkboot/Makefile Tue Feb 20 11:53:22 2024 @@ -1,8 +1,11 @@ -# $NetBSD: Makefile,v 1.11 2005/12/11 12:17:23 christos Exp $ +# $NetBSD: Makefile,v 1.12 2024/02/20 16:53:22 christos Exp $ +WARNS=5 NOMAN= # defined PROG= mkboot SRCS= mkboot.c +COPTS.mkboot.c += -Wno-error=stringop-truncation + .include Index: src/sys/arch/hp300/stand/mkboot/mkboot.c diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.13 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.14 --- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.13 Fri Feb 9 11:18:12 2024 +++ src/sys/arch/hp300/stand/mkboot/mkboot.c Tue Feb 20 11:53:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: mkboot.c,v 1.13 2024/02/09 16:18:12 christos Exp $ */ +/* $NetBSD: mkboot.c,v 1.14 2024/02/20 16:53:22 christos Exp $ */ /* * Copyright (c) 1990, 1993 @@ -47,7 +47,7 @@ __COPYRIGHT( #ifdef notdef static char sccsid[] = "@(#)mkboot.c 7.2 (Berkeley) 12/16/90"; #endif -__RCSID("$NetBSD: mkboot.c,v 1.13 2024/02/09 16:18:12 christos Exp $"); +__RCSID("$NetBSD: mkboot.c,v 1.14 2024/02/20 16:53:22 christos Exp $"); #endif /* not lint */ #include @@ -152,7 +152,7 @@ main(int argc, char **argv) if ((to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1) err(1, "Can't open `%s'", argv[0]); /* clear possibly unused directory entries */ - strncpy(lifd[1].dir_name, " ", 10); + strncpy(lifd[1].dir_name, " ", sizeof(lifd[1].dir_name)); lifd[1].dir_type = htobe16(-1); lifd[1].dir_addr = htobe32(0); lifd[1].dir_length = htobe32(0); @@ -161,7 +161,7 @@ main(int argc, char **argv) lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1]; /* record volume info */ lifv.vol_id = htobe16(VOL_ID); - strncpy(lifv.vol_label, "BOOT43", 6); + strncpy(lifv.vol_label, "BOOT43", sizeof(lifv.vol_label)); lifv.vol_addr = htobe32(btolifs(LIF_DIRSTART)); lifv.vol_oct = htobe16(VOL_OCT); lifv.vol_dirsize = htobe32(btolifs(LIF_DIRSIZE)); @@ -223,7 +223,6 @@ putfile(char *from, int to) { int fd; struct stat statb; - ssize_t nr; void *bp; if ((fd = open(from, 0)) < 0) @@ -261,9 +260,9 @@ lifname(char *str) if ((cp = strrchr(str, '/')) != NULL) str = ++cp; for (i = 4; i < 9; i++) { - if (islower(*str)) - lname[i] = toupper(*str); - else if (isalnum(*str) || *str == '_') + if (islower((unsigned char)*str)) + lname[i] = toupper((unsigned char)*str); + else if (isalnum((unsigned char)*str) || *str == '_') lname[i] = *str; else break; @@ -280,8 +279,12 @@ bcddate(char *name, char *toc) struct stat statb; struct tm *tm; - stat(name, ); - tm = localtime(_ctime); + if (repro_epoch) + tm = gmtime(_epoch); + else { + stat(name, ); + tm = localtime(_ctime); + } *toc = ((tm->tm_mon+1) / 10) << 4; *toc++ |= (tm->tm_mon+1) % 10; *toc = (tm->tm_mday / 10) << 4;
CVS commit: src/sys/arch/hppa/dev
Module Name:src Committed By: macallan Date: Tue Feb 20 15:54:44 UTC 2024 Modified Files: src/sys/arch/hppa/dev: gftfb.c Log Message: play the same lazy cursor (un)draw trick as cgsix and friends visible speedup in things like systat To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/gftfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/dev/gftfb.c diff -u src/sys/arch/hppa/dev/gftfb.c:1.3 src/sys/arch/hppa/dev/gftfb.c:1.4 --- src/sys/arch/hppa/dev/gftfb.c:1.3 Tue Feb 20 11:37:43 2024 +++ src/sys/arch/hppa/dev/gftfb.c Tue Feb 20 15:54:44 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gftfb.c,v 1.3 2024/02/20 11:37:43 macallan Exp $ */ +/* $NetBSD: gftfb.c,v 1.4 2024/02/20 15:54:44 macallan Exp $ */ /* $OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $ */ @@ -973,6 +973,23 @@ gftfb_bitblt(void *cookie, int xs, int y } static void +gftfb_nuke_cursor(struct rasops_info *ri) +{ + struct vcons_screen *scr = ri->ri_hw; + struct gftfb_softc *sc = scr->scr_cookie; + int wi, he, x, y; + + if (ri->ri_flg & RI_CURSOR) { + wi = ri->ri_font->fontwidth; + he = ri->ri_font->fontheight; + x = ri->ri_ccol * wi + ri->ri_xorigin; + y = ri->ri_crow * he + ri->ri_yorigin; + gftfb_bitblt(sc, x, y, x, y, wi, he, RopInv); + ri->ri_flg &= ~RI_CURSOR; + } +} + +static void gftfb_cursor(void *cookie, int on, int row, int col) { struct rasops_info *ri = cookie; @@ -984,24 +1001,22 @@ gftfb_cursor(void *cookie, int on, int r he = ri->ri_font->fontheight; if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) { - if (ri->ri_flg & RI_CURSOR) { - x = ri->ri_ccol * wi + ri->ri_xorigin; - y = ri->ri_crow * he + ri->ri_yorigin; - gftfb_bitblt(sc, x, y, x, y, wi, he, RopInv); - ri->ri_flg &= ~RI_CURSOR; - } - ri->ri_crow = row; - ri->ri_ccol = col; if (on) { - x = ri->ri_ccol * wi + ri->ri_xorigin; - y = ri->ri_crow * he + ri->ri_yorigin; + if (ri->ri_flg & RI_CURSOR) { +gftfb_nuke_cursor(ri); + } + x = col * wi + ri->ri_xorigin; + y = row * he + ri->ri_yorigin; gftfb_bitblt(sc, x, y, x, y, wi, he, RopInv); ri->ri_flg |= RI_CURSOR; } - } else { - scr->scr_ri.ri_crow = row; - scr->scr_ri.ri_ccol = col; - scr->scr_ri.ri_flg &= ~RI_CURSOR; + ri->ri_crow = row; + ri->ri_ccol = col; + } else + { + ri->ri_crow = row; + ri->ri_ccol = col; + ri->ri_flg &= ~RI_CURSOR; } } @@ -1023,6 +1038,10 @@ gftfb_putchar(void *cookie, int row, int if (!CHAR_IN_FONT(c, font)) return; + if (row == ri->ri_crow && col == ri->ri_ccol) { + ri->ri_flg &= ~RI_CURSOR; + } + wi = font->fontwidth; he = font->fontheight; @@ -1062,12 +1081,21 @@ gftfb_copycols(void *cookie, int row, in int32_t xs, xd, y, width, height; if ((sc->sc_locked == 0) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) { + if (ri->ri_crow == row && + (ri->ri_ccol >= srccol && ri->ri_ccol < (srccol + ncols)) && + (ri->ri_flg & RI_CURSOR)) { + gftfb_nuke_cursor(ri); + } + xs = ri->ri_xorigin + ri->ri_font->fontwidth * srccol; xd = ri->ri_xorigin + ri->ri_font->fontwidth * dstcol; y = ri->ri_yorigin + ri->ri_font->fontheight * row; width = ri->ri_font->fontwidth * ncols; height = ri->ri_font->fontheight; gftfb_bitblt(sc, xs, y, xd, y, width, height, RopSrc); + if (ri->ri_crow == row && + (ri->ri_ccol >= dstcol && ri->ri_ccol < (dstcol + ncols))) + ri->ri_flg &= ~RI_CURSOR; } } @@ -1087,6 +1115,9 @@ gftfb_erasecols(void *cookie, int row, i rasops_unpack_attr(fillattr, , , ); gftfb_rectfill(sc, x, y, width, height, ri->ri_devcmap[bg]); + if (ri->ri_crow == row && + (ri->ri_ccol >= startcol && ri->ri_ccol < (startcol + ncols))) + ri->ri_flg &= ~RI_CURSOR; } } @@ -1099,12 +1130,18 @@ gftfb_copyrows(void *cookie, int srcrow, int32_t x, ys, yd, width, height; if ((sc->sc_locked == 0) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) { + if ((ri->ri_crow >= srcrow && ri->ri_crow < (srcrow + nrows)) && + (ri->ri_flg & RI_CURSOR)) { + gftfb_nuke_cursor(ri); + } x = ri->ri_xorigin; ys = ri->ri_yorigin + ri->ri_font->fontheight * srcrow; yd = ri->ri_yorigin + ri->ri_font->fontheight * dstrow; width = ri->ri_emuwidth; height = ri->ri_font->fontheight * nrows; gftfb_bitblt(sc, x, ys, x, yd, width, height, RopSrc); + if (ri->ri_crow >= dstrow && ri->ri_crow < (dstrow + nrows)) + ri->ri_flg &= ~RI_CURSOR; } } @@ -1124,5 +1161,8 @@ gftfb_eraserows(void *cookie, int row, i rasops_unpack_attr(fillattr, , , ); gftfb_rectfill(sc, x, y, width, height, ri->ri_devcmap[bg]); + + if (ri->ri_crow >= row && ri->ri_crow < (row + nrows)) + ri->ri_flg &= ~RI_CURSOR; } }
CVS commit: src/sys/arch/hppa/dev
Module Name:src Committed By: macallan Date: Tue Feb 20 15:54:44 UTC 2024 Modified Files: src/sys/arch/hppa/dev: gftfb.c Log Message: play the same lazy cursor (un)draw trick as cgsix and friends visible speedup in things like systat To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/gftfb.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/debug
Module Name:src Committed By: christos Date: Tue Feb 20 14:13:45 UTC 2024 Modified Files: src/distrib/sets/lists/debug: mi shl.mi Log Message: fix debug sets for sun2 (libgcc_s_g.a and libgcc_eh_g.a should be in shl.mi) To generate a diff of this commit: cvs rdiff -u -r1.425 -r1.426 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.336 -r1.337 src/distrib/sets/lists/debug/shl.mi 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/debug
Module Name:src Committed By: christos Date: Tue Feb 20 14:13:45 UTC 2024 Modified Files: src/distrib/sets/lists/debug: mi shl.mi Log Message: fix debug sets for sun2 (libgcc_s_g.a and libgcc_eh_g.a should be in shl.mi) To generate a diff of this commit: cvs rdiff -u -r1.425 -r1.426 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.336 -r1.337 src/distrib/sets/lists/debug/shl.mi 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/debug/mi diff -u src/distrib/sets/lists/debug/mi:1.425 src/distrib/sets/lists/debug/mi:1.426 --- src/distrib/sets/lists/debug/mi:1.425 Sun Feb 18 23:30:38 2024 +++ src/distrib/sets/lists/debug/mi Tue Feb 20 09:13:45 2024 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.425 2024/02/19 04:30:38 riastradh Exp $ +# $NetBSD: mi,v 1.426 2024/02/20 14:13:45 christos Exp $ ./etc/mtree/set.debug comp-sys-root ./usr/lib comp-sys-usr compatdir ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile @@ -68,9 +68,7 @@ ./usr/lib/libfido2_g.acomp-c-debuglib debuglib,compatfile ./usr/lib/libfl_g.acomp-c-debuglib debuglib,compatfile ./usr/lib/libform_g.acomp-c-debuglib debuglib,compatfile -./usr/lib/libgcc_eh_g.acomp-c-debuglib debuglib,compatfile,gcc ./usr/lib/libgcc_g.acomp-c-debuglib debuglib,compatfile,gcc -./usr/lib/libgcc_s_g.acomp-c-debuglib debuglib,compatfile,gcc ./usr/lib/libgcov_g.acomp-c-debuglib debuglib,compatfile,gcc ./usr/lib/libgnuctf_g.acomp-c-debuglib debuglib,compatfile,binutils ./usr/lib/libgnumalloc_g.a comp-c-debuglib debuglib,compatfile Index: src/distrib/sets/lists/debug/shl.mi diff -u src/distrib/sets/lists/debug/shl.mi:1.336 src/distrib/sets/lists/debug/shl.mi:1.337 --- src/distrib/sets/lists/debug/shl.mi:1.336 Sat Feb 17 13:32:19 2024 +++ src/distrib/sets/lists/debug/shl.mi Tue Feb 20 09:13:45 2024 @@ -1,5 +1,7 @@ -# $NetBSD: shl.mi,v 1.336 2024/02/17 18:32:19 christos Exp $ +# $NetBSD: shl.mi,v 1.337 2024/02/20 14:13:45 christos Exp $ ./usr/lib/libbfd_g.a comp-c-debuglib debuglib,compatfile,binutils +./usr/lib/libgcc_eh_g.acomp-c-debuglib debuglib,compatfile,gcc +./usr/lib/libgcc_s_g.acomp-c-debuglib debuglib,compatfile,gcc ./usr/libdata/debug/lib base-sys-usr debug,dynamicroot,compatdir ./usr/libdata/debug/lib/libavl.so.0.0.debug comp-zfs-debug debug,dynamicroot,zfs ./usr/libdata/debug/lib/libblocklist.so.0.0.debug comp-sys-debug debug,dynamicroot
CVS commit: src/doc
Module Name:src Committed By: simonb Date: Tue Feb 20 12:42:58 UTC 2024 Modified Files: src/doc: 3RDPARTY Log Message: Updates for less - add me as co-maintainer, update to latest version. To generate a diff of this commit: cvs rdiff -u -r1.1987 -r1.1988 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1987 src/doc/3RDPARTY:1.1988 --- src/doc/3RDPARTY:1.1987 Sat Feb 17 18:33:25 2024 +++ src/doc/3RDPARTY Tue Feb 20 12:42:57 2024 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1987 2024/02/17 18:33:25 christos Exp $ +# $NetBSD: 3RDPARTY,v 1.1988 2024/02/20 12:42:57 simonb Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -698,14 +698,14 @@ Use external/bsd/kyua-testers/prepare-im directory. Package: less -Version: less-458 -Current Vers: less-608 +Version: less-643 +Current Vers: less-643 Maintainer: Mark Nudelman Archive Site: http://www.greenwoodsoftware.com/less/download.html Home Page: http://www.greenwoodsoftware.com/less/ -Date: 2023-02-07 +Date: 2023-10-06 Mailing List: less-announce-requ...@greenwoodsoftware.com -Responsible: mrg +Responsible: mrg, simonb License: Less License (BSD 2-clause) or GPLv3 (v2 prior to less-418) Location: external/bsd/less/dist Notes:
CVS commit: src/doc
Module Name:src Committed By: simonb Date: Tue Feb 20 12:42:58 UTC 2024 Modified Files: src/doc: 3RDPARTY Log Message: Updates for less - add me as co-maintainer, update to latest version. To generate a diff of this commit: cvs rdiff -u -r1.1987 -r1.1988 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hppa/dev
Module Name:src Committed By: macallan Date: Tue Feb 20 11:37:43 UTC 2024 Modified Files: src/sys/arch/hppa/dev: gftfb.c Log Message: enable glyph cache, anti-aliased fonts etc. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/gftfb.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/hppa/dev
Module Name:src Committed By: macallan Date: Tue Feb 20 11:37:43 UTC 2024 Modified Files: src/sys/arch/hppa/dev: gftfb.c Log Message: enable glyph cache, anti-aliased fonts etc. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/gftfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/dev/gftfb.c diff -u src/sys/arch/hppa/dev/gftfb.c:1.2 src/sys/arch/hppa/dev/gftfb.c:1.3 --- src/sys/arch/hppa/dev/gftfb.c:1.2 Thu Feb 15 16:17:32 2024 +++ src/sys/arch/hppa/dev/gftfb.c Tue Feb 20 11:37:43 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gftfb.c,v 1.2 2024/02/15 16:17:32 macallan Exp $ */ +/* $NetBSD: gftfb.c,v 1.3 2024/02/20 11:37:43 macallan Exp $ */ /* $OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $ */ @@ -76,6 +76,7 @@ struct gftfb_softc { u_char sc_cmap_red[256]; u_char sc_cmap_green[256]; u_char sc_cmap_blue[256]; + uint32_t sc_reg10; glyphcache sc_gc; }; @@ -90,15 +91,12 @@ void gftfb_enable_rom_internal(struct gf void gftfb_disable_rom_internal(struct gftfb_softc *); void gftfb_setup(struct gftfb_softc *); -void gftfb_wait(struct gftfb_softc *); -void gftfb_wait_fifo(struct gftfb_softc *, uint32_t); #define ngle_bt458_write(memt, memh, r, v) \ bus_space_write_stream_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24) -void gftfb_setup_fb(struct gftfb_softc *); -/* XXX these really need o go into their own header */ +/* XXX these really need to go into their own header */ int sti_pci_is_console(struct pci_attach_args *, bus_addr_t *); int sti_rom_setup(struct sti_rom *, bus_space_tag_t, bus_space_tag_t, bus_space_handle_t, bus_addr_t *, u_int); @@ -143,6 +141,31 @@ struct wsdisplay_accessops gftfb_accesso NULL /* scroll */ }; +#define BA(F,C,S,A,J,B,I) \ + (((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I)) + +#define IBOvals(R,M,X,S,D,L,B,F) \ + (((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F)) + +#define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */ +#define Otc04 2 /* Pixels in each longword transfer (4) */ +#define Otc32 5 /* Pixels in each longword transfer (32) */ +#define Ots08 3 /* Each pixel is size (8)d transfer (1) */ +#define OtsIndirect 6 /* Each bit goes through FG/BG color(8) */ +#define AddrLong 5 /* FB address is Long aligned (pixel) */ +#define BINovly 0x2 /* 8 bit overlay */ +#define BINapp0I 0x0 /* Application Buffer 0, Indexed */ +#define BINapp1I 0x1 /* Application Buffer 1, Indexed */ +#define BINapp0F8 0xa /* Application Buffer 0, Fractional 8-8-8 */ +#define BINattr 0xd /* Attribute Bitmap */ +#define RopSrc 0x3 +#define RopInv 0xc +#define BitmapExtent08 3 /* Each write hits ( 8) bits in depth */ +#define BitmapExtent32 5 /* Each write hits (32) bits in depth */ +#define DataDynamic 0 /* Data register reloaded by direct access */ +#define MaskDynamic 1 /* Mask register reloaded by direct access */ +#define MaskOtc 0 /* Mask contains Object Count valid bits */ + int gftfb_match(device_t parent, cfdata_t cf, void *aux) { @@ -165,7 +188,7 @@ gftfb_attach(device_t parent, device_t s struct sti_rom *rom; struct rasops_info *ri; struct wsemuldisplaydev_attach_args aa; - unsigned long defattr; + unsigned long defattr = 0; int ret, is_console = 0, i, j; uint8_t cmap[768]; @@ -230,11 +253,10 @@ gftfb_attach(device_t parent, device_t s ri = >sc_console_screen.scr_ri; -#if 0 sc->sc_gc.gc_bitblt = gftfb_bitblt; sc->sc_gc.gc_blitcookie = sc; - sc->sc_gc.gc_rop = 0x0c; -#endif + sc->sc_gc.gc_rop = RopSrc; + if (is_console) { vcons_init_screen(>vd, >sc_console_screen, 1, ); @@ -244,14 +266,14 @@ gftfb_attach(device_t parent, device_t s sc->sc_defaultscreen_descr.capabilities = ri->ri_caps; sc->sc_defaultscreen_descr.nrows = ri->ri_rows; sc->sc_defaultscreen_descr.ncols = ri->ri_cols; -#if 0 + glyphcache_init(>sc_gc, sc->sc_height + 5, -(0x80 / sc->sc_stride) - sc->sc_height - 5, +sc->sc_scr.fbheight - sc->sc_height - 5, sc->sc_width, ri->ri_font->fontwidth, ri->ri_font->fontheight, defattr); -#endif + wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0, defattr); @@ -270,14 +292,13 @@ gftfb_attach(device_t parent, device_t s ); } else (*ri->ri_ops.allocattr)(ri, 0, 0, 0, ); -#if 0 + glyphcache_init(>sc_gc, sc->sc_height + 5, -(0x80 / sc->sc_stride) - sc->sc_height - 5, +sc->sc_scr.fbheight - sc->sc_height - 5, sc->sc_width, ri->ri_font->fontwidth, ri->ri_font->fontheight, defattr); -#endif } j = 0; @@ -597,7 +618,7 @@ gftfb_disable_rom(struct sti_softc *sc) CLR(sc->sc_flags, STI_ROM_ENABLED); } -void +static inline void gftfb_wait(struct gftfb_softc *sc) { struct sti_rom *rom =
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Tue Feb 20 09:53:16 UTC 2024 Modified Files: src/sys/dev/wscons: wsdisplay_glyphcache.c Log Message: remove check for unused bits in attr2idx() - this really wasn't helpful To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/wscons/wsdisplay_glyphcache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_glyphcache.c diff -u src/sys/dev/wscons/wsdisplay_glyphcache.c:1.12 src/sys/dev/wscons/wsdisplay_glyphcache.c:1.13 --- src/sys/dev/wscons/wsdisplay_glyphcache.c:1.12 Thu Jun 8 05:48:41 2023 +++ src/sys/dev/wscons/wsdisplay_glyphcache.c Tue Feb 20 09:53:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_glyphcache.c,v 1.12 2023/06/08 05:48:41 macallan Exp $ */ +/* $NetBSD: wsdisplay_glyphcache.c,v 1.13 2024/02/20 09:53:16 macallan Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -53,9 +53,6 @@ static inline int attr2idx(long attr) { - if ((attr & 0xf0f00ff8) != 0) - return -1; - return (((attr >> 16) & 0x0f) | ((attr >> 20) & 0xf0)); }
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Tue Feb 20 09:53:16 UTC 2024 Modified Files: src/sys/dev/wscons: wsdisplay_glyphcache.c Log Message: remove check for unused bits in attr2idx() - this really wasn't helpful To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/wscons/wsdisplay_glyphcache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.