CVS commit: src
Module Name:src Committed By: rillig Date: Tue May 31 00:35:18 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: d_gcc_compound_statements1.c d_gcc_compound_statements1.exp msg_249.c msg_249.exp src/usr.bin/xlint/lint1: decl.c Log Message: lint: fix null pointer dereference after syntax error Found by afl, starting with the malformed input '/**/f=({;/**/};}' that no longer crashes. This input led to 'f=({L:;}', which is at least a syntactically valid prefix of a translation unit, containing a GCC statement expression with an unused label. The error message for this unused label assumed that it would always be inside a function definition. While here, document incomplete recovery after syntax errors, in msg_249.c. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c \ src/tests/usr.bin/xlint/lint1/msg_249.c cvs rdiff -u -r1.4 -r1.5 \ src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_249.exp cvs rdiff -u -r1.282 -r1.283 src/usr.bin/xlint/lint1/decl.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/usr.bin/xlint/lint1/d_gcc_compound_statements1.c diff -u src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c:1.9 src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c:1.10 --- src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c:1.9 Sun Apr 24 20:08:23 2022 +++ src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c Tue May 31 00:35:18 2022 @@ -1,8 +1,21 @@ -/* $NetBSD: d_gcc_compound_statements1.c,v 1.9 2022/04/24 20:08:23 rillig Exp $ */ +/* $NetBSD: d_gcc_compound_statements1.c,v 1.10 2022/05/31 00:35:18 rillig Exp $ */ # 3 "d_gcc_compound_statements1.c" /* GCC compound statement with expression */ +/* + * Compound statements are only allowed in functions, not at file scope. + * + * Before decl.c 1.283 from 2022-05-21, lint crashed with a segmentation + * fault due to the unused label. + */ +int invalid_gcc_statement_expression = ({ +unused_label: + 3; +/* expect+2: error: syntax error 'labels are only valid inside a function' [249] */ +/* expect+1: error: cannot initialize 'int' from 'void' [185] */ +}); + void foo(unsigned long z) { z = ({ Index: src/tests/usr.bin/xlint/lint1/msg_249.c diff -u src/tests/usr.bin/xlint/lint1/msg_249.c:1.9 src/tests/usr.bin/xlint/lint1/msg_249.c:1.10 --- src/tests/usr.bin/xlint/lint1/msg_249.c:1.9 Sat Jan 15 23:21:34 2022 +++ src/tests/usr.bin/xlint/lint1/msg_249.c Tue May 31 00:35:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_249.c,v 1.9 2022/01/15 23:21:34 rillig Exp $ */ +/* $NetBSD: msg_249.c,v 1.10 2022/05/31 00:35:18 rillig Exp $ */ # 3 "msg_249.c" // Test for message: syntax error '%s' [249] @@ -58,3 +58,30 @@ struct cover_member_declaration { /* expect+1: error: syntax error 'member without type' [249] */ const; }; + +/* + * At this point, lint assumes that the following code is still in the + * function 'access_declaration_after_syntax_error'. + */ + +int gcc_statement_expression_1 = ({ +/* expect+1: warning: label 'unused_label' unused in function 'access_declaration_after_syntax_error' [232] */ +unused_label: + 1; + 1; +}); +/* expect-1: error: non-constant initializer [177] */ + +/* Even another function definition does not help. */ +void +try_to_recover(void) +{ +} + +int gcc_statement_expression_2 = ({ +/* expect+1: warning: label 'unused_label' unused in function 'try_to_recover' [232] */ +unused_label: + 1; + 1; +}); +/* expect-1: error: non-constant initializer [177] */ Index: src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp diff -u src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp:1.4 src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp:1.5 --- src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp:1.4 Sun Apr 3 00:39:32 2022 +++ src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp Tue May 31 00:35:18 2022 @@ -1,4 +1,6 @@ -d_gcc_compound_statements1.c(24): error: syntax error 'return outside function' [249] -d_gcc_compound_statements1.c(25): error: cannot initialize 'int' from 'void' [185] -d_gcc_compound_statements1.c(37): error: type 'int' does not have member 'e' [101] -d_gcc_compound_statements1.c(50): error: syntax error ';' [249] +d_gcc_compound_statements1.c(17): error: syntax error 'labels are only valid inside a function' [249] +d_gcc_compound_statements1.c(17): error: cannot initialize 'int' from 'void' [185] +d_gcc_compound_statements1.c(37): error: syntax error 'return outside function' [249] +d_gcc_compound_statements1.c(38): error: cannot initialize 'int' from 'void' [185] +d_gcc_compound_statements1.c(50): error: type 'int' does not have member 'e' [101] +d_gcc_compound_statements1.c(63): error: syntax error ';' [249] Index:
CVS commit: src
Module Name:src Committed By: rillig Date: Tue May 31 00:35:18 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: d_gcc_compound_statements1.c d_gcc_compound_statements1.exp msg_249.c msg_249.exp src/usr.bin/xlint/lint1: decl.c Log Message: lint: fix null pointer dereference after syntax error Found by afl, starting with the malformed input '/**/f=({;/**/};}' that no longer crashes. This input led to 'f=({L:;}', which is at least a syntactically valid prefix of a translation unit, containing a GCC statement expression with an unused label. The error message for this unused label assumed that it would always be inside a function definition. While here, document incomplete recovery after syntax errors, in msg_249.c. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c \ src/tests/usr.bin/xlint/lint1/msg_249.c cvs rdiff -u -r1.4 -r1.5 \ src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.exp cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_249.exp cvs rdiff -u -r1.282 -r1.283 src/usr.bin/xlint/lint1/decl.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/dist/drm/nouveau
Module Name:src Committed By: riastradh Date: Tue May 31 00:17:10 UTC 2022 Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_gem.c Log Message: nouveau(4): Fix error branches in nouveau_gem_new. PR kern/56804 To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.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/dist/drm/nouveau/nouveau_gem.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.13 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.14 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.13 Sun Dec 19 10:50:13 2021 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c Tue May 31 00:17:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_gem.c,v 1.13 2021/12/19 10:50:13 riastradh Exp $ */ +/* $NetBSD: nouveau_gem.c,v 1.14 2022/05/31 00:17:10 riastradh Exp $ */ /* * Copyright (C) 2008 Ben Skeggs. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nouveau_gem.c,v 1.13 2021/12/19 10:50:13 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_gem.c,v 1.14 2022/05/31 00:17:10 riastradh Exp $"); #include @@ -202,13 +202,13 @@ nouveau_gem_new(struct nouveau_cli *cli, * to the caller, instead of a normal nouveau_bo ttm reference. */ ret = drm_gem_object_init(drm->dev, >bo.base, size); if (ret) { - nouveau_bo_ref(NULL, ); + kfree(nvbo); return ret; } ret = nouveau_bo_init(nvbo, size, align, flags, NULL, NULL); if (ret) { - nouveau_bo_ref(NULL, ); + /* XXX note: if this fails it kfrees nvbo */ return ret; }
CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau
Module Name:src Committed By: riastradh Date: Tue May 31 00:17:10 UTC 2022 Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_gem.c Log Message: nouveau(4): Fix error branches in nouveau_gem_new. PR kern/56804 To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.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/xlint/lint1
Module Name:src Committed By: rillig Date: Tue May 31 00:01:35 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: err.c Log Message: lint: prevent assertion failure after parse error from grammar Instead of running into an assertion failure, the malformed input 'f=({;};}' now generates: malformed.c(1): error: syntax error ';' [249] malformed.c(1): warning: ({ }) is a GCC extension [320] malformed.c(1): warning: ({ }) is a GCC extension [320] malformed.c(1): error: cannot recover from previous errors [224] To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 src/usr.bin/xlint/lint1/err.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/xlint/lint1
Module Name:src Committed By: rillig Date: Tue May 31 00:01:35 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: err.c Log Message: lint: prevent assertion failure after parse error from grammar Instead of running into an assertion failure, the malformed input 'f=({;};}' now generates: malformed.c(1): error: syntax error ';' [249] malformed.c(1): warning: ({ }) is a GCC extension [320] malformed.c(1): warning: ({ }) is a GCC extension [320] malformed.c(1): error: cannot recover from previous errors [224] To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 src/usr.bin/xlint/lint1/err.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/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.166 src/usr.bin/xlint/lint1/err.c:1.167 --- src/usr.bin/xlint/lint1/err.c:1.166 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint1/err.c Tue May 31 00:01:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.166 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: err.c,v 1.167 2022/05/31 00:01:35 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: err.c,v 1.166 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.167 2022/05/31 00:01:35 rillig Exp $"); #endif #include @@ -591,6 +591,19 @@ assert_failed(const char *file, int line { const char *fn; + /* + * After encountering a parse error in the grammar, lint often does + * not properly clean up its data structures, especially in 'dcs', + * the stack of declaration levels. This often leads to assertion + * failures. These cases are not interesting though, as the purpose + * of lint is to check syntactically valid code. In such a case, + * exit gracefully. This allows a fuzzer like afl to focus on more + * interesting cases instead of reporting nonsense translation units + * like 'f=({e:;}' or 'v(const(char););e(v){'. + */ + if (sytxerr > 0) + norecover(); + fn = lbasename(curr_pos.p_file); (void)fflush(stdout); (void)fprintf(stderr,
CVS commit: src/sys/kern
Module Name:src Committed By: mrg Date: Mon May 30 23:36:26 UTC 2022 Modified Files: src/sys/kern: subr_kmem.c Log Message: re-do previous - it likely broke kmem cache init. use {0} for zero sentinel. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/kern/subr_kmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: mrg Date: Mon May 30 23:36:26 UTC 2022 Modified Files: src/sys/kern: subr_kmem.c Log Message: re-do previous - it likely broke kmem cache init. use {0} for zero sentinel. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/kern/subr_kmem.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/subr_kmem.c diff -u src/sys/kern/subr_kmem.c:1.86 src/sys/kern/subr_kmem.c:1.87 --- src/sys/kern/subr_kmem.c:1.86 Mon May 30 21:42:02 2022 +++ src/sys/kern/subr_kmem.c Mon May 30 23:36:26 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kmem.c,v 1.86 2022/05/30 21:42:02 mrg Exp $ */ +/* $NetBSD: subr_kmem.c,v 1.87 2022/05/30 23:36:26 mrg Exp $ */ /* * Copyright (c) 2009-2020 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.86 2022/05/30 21:42:02 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.87 2022/05/30 23:36:26 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_kmem.h" @@ -184,16 +184,12 @@ SDT_PROBE_DEFINE3(sdt, kmem, free, large static const struct kmem_cache_info kmem_cache_sizes[] = { KMEM_CACHE_SIZES(F) -#ifndef KDTRACE_HOOKS - { 0, NULL } -#endif + { 0 } }; static const struct kmem_cache_info kmem_cache_big_sizes[] = { KMEM_CACHE_BIG_SIZES(F) -#ifndef KDTRACE_HOOKS - { 0, NULL } -#endif + { 0 } }; #undef F
CVS commit: src
Module Name:src Committed By: rillig Date: Mon May 30 23:27:45 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint2: msg_000.ln src/usr.bin/xlint/lint2: chk.c Log Message: lint: clean up comments No binary change. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint2/msg_000.ln cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint2/chk.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/usr.bin/xlint/lint2/msg_000.ln diff -u src/tests/usr.bin/xlint/lint2/msg_000.ln:1.3 src/tests/usr.bin/xlint/lint2/msg_000.ln:1.4 --- src/tests/usr.bin/xlint/lint2/msg_000.ln:1.3 Sun Sep 12 16:07:16 2021 +++ src/tests/usr.bin/xlint/lint2/msg_000.ln Mon May 30 23:27:45 2022 @@ -1,4 +1,4 @@ -# $NetBSD: msg_000.ln,v 1.3 2021/09/12 16:07:16 rillig Exp $ +# $NetBSD: msg_000.ln,v 1.4 2022/05/30 23:27:45 rillig Exp $ # # Test data for message 0 of lint2: # %s used( %s ), but not defined @@ -24,7 +24,7 @@ S msg_000.c # 'p1' argument 1 is a positive constant # 'i' the return value of the function call is ignored # '16...' the name of the called function -# 'f2' it's a function with 2 arguments +# 'f2' the function is called with 2 arguments # 'I' the first argument has type 'int' # 'D' the first argument has type 'double' # 'I' the return type of the function is (implicitly) 'int' Index: src/usr.bin/xlint/lint2/chk.c diff -u src/usr.bin/xlint/lint2/chk.c:1.48 src/usr.bin/xlint/lint2/chk.c:1.49 --- src/usr.bin/xlint/lint2/chk.c:1.48 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint2/chk.c Mon May 30 23:27:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: chk.c,v 1.48 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: chk.c,v 1.49 2022/05/30 23:27:45 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: chk.c,v 1.48 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: chk.c,v 1.49 2022/05/30 23:27:45 rillig Exp $"); #endif #include @@ -264,12 +264,13 @@ chkvtui(const hte_t *hte, sym_t *def, sy * union, also if the return value is ignored. * This is necessary because the caller must * allocate stack space for the return value. - * If it does not, the return value would over- - * write other data. - * XXX Following massage may be confusing + * If it does not, the return value would + * overwrite other data. + * + * XXX Following message may be confusing * because it appears also if the return value * was declared inconsistently. But this - * behavior matches pcc based lint, so it is + * behavior matches pcc-based lint, so it is * accepted for now. */ pos1 = xstrdup(mkpos(>s_pos));
CVS commit: src
Module Name:src Committed By: rillig Date: Mon May 30 23:27:45 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint2: msg_000.ln src/usr.bin/xlint/lint2: chk.c Log Message: lint: clean up comments No binary change. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint2/msg_000.ln cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint2/chk.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/xlint/xlint
Module Name:src Committed By: rillig Date: Mon May 30 23:02:02 UTC 2022 Modified Files: src/usr.bin/xlint/xlint: lint.1 xlint.c Log Message: lint: clean up usage messages The two synopsis forms differed in the spelling of 'file ...'. The options string for getopt does not start with ':', which led to a duplicate message 'unknown option -- ?' followed by 'Unknown flag ?'. Be more specific when calling 'lint file.c -u'; the message 'Unknown argument' was not helpful as it didn't pinpoint that there are two different phases for parsing options. In the second phase, only the options '-L' and '-l' are recognized. In the manual page, mention the difference between the two synopsis forms as early as possible. The two synopsis forms are very similar and both have far to many options to see the difference at a glance. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.bin/xlint/xlint/lint.1 cvs rdiff -u -r1.92 -r1.93 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint/lint.1 diff -u src/usr.bin/xlint/xlint/lint.1:1.52 src/usr.bin/xlint/xlint/lint.1:1.53 --- src/usr.bin/xlint/xlint/lint.1:1.52 Fri Apr 15 23:25:04 2022 +++ src/usr.bin/xlint/xlint/lint.1 Mon May 30 23:02:02 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: lint.1,v 1.52 2022/04/15 23:25:04 rillig Exp $ +.\" $NetBSD: lint.1,v 1.53 2022/05/30 23:02:02 rillig Exp $ .\" .\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. .\" Copyright (c) 1994, 1995 Jochen Pohl @@ -30,7 +30,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 15, 2022 +.Dd May 31, 2022 .Dt LINT 1 .Os .Sh NAME @@ -80,6 +80,14 @@ The list of errors and warnings that produces are enumerated in .Xr lint 7 . .Pp +In the first synopsis form, +.Nm +checks each given file as a separate translation unit. +In the second synopsis form, +.Nm +cross-checks the results of the first synopsis form for inconsistencies +between translation units. +.Pp .Nm runs the C preprocessor as its first phase, with the following preprocessor symbols Index: src/usr.bin/xlint/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.92 src/usr.bin/xlint/xlint/xlint.c:1.93 --- src/usr.bin/xlint/xlint/xlint.c:1.92 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/xlint/xlint.c Mon May 30 23:02:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.92 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.93 2022/05/30 23:02:02 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.92 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.93 2022/05/30 23:02:02 rillig Exp $"); #endif #include @@ -322,14 +322,15 @@ usage(const char *fmt, ...) va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - fprintf(stderr, "\n"); + if (fmt[0] != '\0') + fprintf(stderr, "\n"); indent = (int)(strlen("usage: ") + strlen(name)); (void)fprintf(stderr, "usage: %s [-abceghprvwxzHFST] [-s|-t] [-i|-nu]\n" "%*s [-Dname[=def]] [-Uname] [-Idirectory] [-Z ]\n" "%*s [-Ldirectory] [-llibrary] [-ooutputfile]\n" - "%*s [-X [,]...] [-Ac11] file...\n", + "%*s [-X [,]...] [-Ac11] file ...\n", name, indent, "", indent, "", indent, ""); (void)fprintf(stderr, " %s [-abceghprvwzHFST] [-s|-t] -Clibrary\n" @@ -556,7 +557,7 @@ main(int argc, char *argv[]) break; default: - usage("Unknown flag %c", c); + usage(""); /* NOTREACHED */ } } @@ -582,7 +583,7 @@ main(int argc, char *argv[]) else if (arg[1] == 'L') list = else { -usage("Unknown argument %s", arg); +usage("Unknown late option '%s'", arg); /* NOTREACHED */ }
CVS commit: src/sys/kern
Module Name:src Committed By: mrg Date: Mon May 30 21:42:02 UTC 2022 Modified Files: src/sys/kern: subr_kmem.c Log Message: apply some missing #ifn?def KDTRACE_HOOKS from the previous. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/kern/subr_kmem.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/aarch64/include
Module Name:src Committed By: jkoshy Date: Mon May 30 21:18:37 UTC 2022 Modified Files: src/sys/arch/aarch64/include: elf_machdep.h Log Message: Use the ABI value for 'R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC'. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/include/elf_machdep.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/aarch64/include
Module Name:src Committed By: jkoshy Date: Mon May 30 21:18:37 UTC 2022 Modified Files: src/sys/arch/aarch64/include: elf_machdep.h Log Message: Use the ABI value for 'R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC'. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/include/elf_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/include/elf_machdep.h diff -u src/sys/arch/aarch64/include/elf_machdep.h:1.4 src/sys/arch/aarch64/include/elf_machdep.h:1.5 --- src/sys/arch/aarch64/include/elf_machdep.h:1.4 Fri Oct 12 01:28:58 2018 +++ src/sys/arch/aarch64/include/elf_machdep.h Mon May 30 21:18:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_machdep.h,v 1.4 2018/10/12 01:28:58 ryo Exp $ */ +/* $NetBSD: elf_machdep.h,v 1.5 2022/05/30 21:18:37 jkoshy Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -198,7 +198,7 @@ #define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 /* TPREL(S+A) */ #define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 /* TPREL(S+A) */ #define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 572 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 /* DTPREL(S+A) */ /* Dynamic Relocations */ #define R_AARCH64_P32_COPY 180
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Mon May 30 20:28:30 UTC 2022 Modified Files: src/sys/kern: subr_kmem.c Log Message: kmem(9): Create dtrace sdt probes for each kmem cache size. The names of the probes correspond to the names shown in vmstat -m. This should make it much easier to track down who's allocating memory when there's a leak, e.g. by getting a histogram of stack traces for the matching kmem cache pool: # vmstat -m Memory resource pool statistics NameSize Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle ... kmem-00128 2566224200 3891 0 3891 3891 0 inf 0 ... # dtrace -n 'sdt:kmem:*:kmem-00128 { @[probefunc, stack()] = count() }' ^C When there's no leak, the allocs and frees (probefunc) will be roughly matched; when there's a leak, the allocs will far outnumber the frees. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/kern/subr_kmem.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/subr_kmem.c diff -u src/sys/kern/subr_kmem.c:1.84 src/sys/kern/subr_kmem.c:1.85 --- src/sys/kern/subr_kmem.c:1.84 Sat Mar 12 22:20:34 2022 +++ src/sys/kern/subr_kmem.c Mon May 30 20:28:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kmem.c,v 1.84 2022/03/12 22:20:34 riastradh Exp $ */ +/* $NetBSD: subr_kmem.c,v 1.85 2022/05/30 20:28:30 riastradh Exp $ */ /* * Copyright (c) 2009-2020 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.84 2022/03/12 22:20:34 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.85 2022/05/30 20:28:30 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_kmem.h" @@ -93,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_kmem.c, #include #include #include +#include #include #include @@ -102,42 +103,97 @@ __KERNEL_RCSID(0, "$NetBSD: subr_kmem.c, struct kmem_cache_info { size_t kc_size; const char * kc_name; +#ifdef KDTRACE_HOOKS + const id_t *kc_alloc_probe_id; + const id_t *kc_free_probe_id; +#endif }; +#define KMEM_CACHE_SIZES(F) \ + F(8, kmem-8, kmem__8) \ + F(16, kmem-00016, kmem__00016) \ + F(24, kmem-00024, kmem__00024) \ + F(32, kmem-00032, kmem__00032) \ + F(40, kmem-00040, kmem__00040) \ + F(48, kmem-00048, kmem__00048) \ + F(56, kmem-00056, kmem__00056) \ + F(64, kmem-00064, kmem__00064) \ + F(80, kmem-00080, kmem__00080) \ + F(96, kmem-00096, kmem__00096) \ + F(112, kmem-00112, kmem__00112) \ + F(128, kmem-00128, kmem__00128) \ + F(160, kmem-00160, kmem__00160) \ + F(192, kmem-00192, kmem__00192) \ + F(224, kmem-00224, kmem__00224) \ + F(256, kmem-00256, kmem__00256) \ + F(320, kmem-00320, kmem__00320) \ + F(384, kmem-00384, kmem__00384) \ + F(448, kmem-00448, kmem__00448) \ + F(512, kmem-00512, kmem__00512) \ + F(768, kmem-00768, kmem__00768) \ + F(1024, kmem-01024, kmem__01024) \ + /* end of KMEM_CACHE_SIZES */ + +#define KMEM_CACHE_BIG_SIZES(F) \ + F(2048, kmem-02048, kmem__02048) \ + F(4096, kmem-04096, kmem__04096) \ + F(8192, kmem-08192, kmem__08192) \ + F(16384, kmem-16384, kmem__16384) \ + /* end of KMEM_CACHE_BIG_SIZES */ + +/* sdt:kmem:alloc:kmem-* probes */ +#define F(SZ, NAME, PROBENAME) \ + SDT_PROBE_DEFINE4(sdt, kmem, alloc, PROBENAME, \ + "void *"/*ptr*/, \ + "size_t"/*requested_size*/, \ + "size_t"/*allocated_size*/, \ + "km_flag_t"/*kmflags*/); +KMEM_CACHE_SIZES(F); +KMEM_CACHE_BIG_SIZES(F); +#undef F + +/* sdt:kmem:free:kmem-* probes */ +#define F(SZ, NAME, PROBENAME) \ + SDT_PROBE_DEFINE3(sdt, kmem, free, PROBENAME, \ + "void *"/*ptr*/, \ + "size_t"/*requested_size*/, \ + "size_t"/*allocated_size*/); +KMEM_CACHE_SIZES(F); +KMEM_CACHE_BIG_SIZES(F); +#undef F + +/* sdt:kmem:alloc:large, sdt:kmem:free:large probes */ +SDT_PROBE_DEFINE4(sdt, kmem, alloc, large, +"void *"/*ptr*/, +"size_t"/*requested_size*/, +"size_t"/*allocated_size*/, +"km_flag_t"/*kmflags*/); +SDT_PROBE_DEFINE3(sdt, kmem, free, large, +"void *"/*ptr*/, +"size_t"/*requested_size*/, +"size_t"/*allocated_size*/); + +#ifdef KDTRACE_HOOKS +#define F(SZ, NAME, PROBENAME) \ + { SZ, #NAME, \ + _sdt_kmem_alloc_##PROBENAME->id, \ + _sdt_kmem_free_##PROBENAME->id }, +#else +#define F(SZ, NAME, PROBENAME) { SZ, #NAME }, +#endif + static const struct kmem_cache_info kmem_cache_sizes[] = { - { 8, "kmem-8" }, - { 16, "kmem-00016" }, - { 24, "kmem-00024" }, - { 32, "kmem-00032" }, - { 40, "kmem-00040" }, - { 48, "kmem-00048"
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Mon May 30 20:28:30 UTC 2022 Modified Files: src/sys/kern: subr_kmem.c Log Message: kmem(9): Create dtrace sdt probes for each kmem cache size. The names of the probes correspond to the names shown in vmstat -m. This should make it much easier to track down who's allocating memory when there's a leak, e.g. by getting a histogram of stack traces for the matching kmem cache pool: # vmstat -m Memory resource pool statistics NameSize Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle ... kmem-00128 2566224200 3891 0 3891 3891 0 inf 0 ... # dtrace -n 'sdt:kmem:*:kmem-00128 { @[probefunc, stack()] = count() }' ^C When there's no leak, the allocs and frees (probefunc) will be roughly matched; when there's a leak, the allocs will far outnumber the frees. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/kern/subr_kmem.c 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
Module Name:src Committed By: riastradh Date: Mon May 30 20:28:18 UTC 2022 Modified Files: src/sys/dev/pci: virtio_pci.c Log Message: virtio at pci: Provide attribution in debug message. Also make it only happen in the error case so success doesn't clutter up the console output. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/virtio_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/dev/pci/virtio_pci.c diff -u src/sys/dev/pci/virtio_pci.c:1.37 src/sys/dev/pci/virtio_pci.c:1.38 --- src/sys/dev/pci/virtio_pci.c:1.37 Wed Apr 13 22:41:17 2022 +++ src/sys/dev/pci/virtio_pci.c Mon May 30 20:28:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio_pci.c,v 1.37 2022/04/13 22:41:17 uwe Exp $ */ +/* $NetBSD: virtio_pci.c,v 1.38 2022/05/30 20:28:18 riastradh Exp $ */ /* * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.37 2022/04/13 22:41:17 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.38 2022/05/30 20:28:18 riastradh Exp $"); #include #include @@ -880,9 +880,9 @@ virtio_pci_setup_interrupts_09(struct vi bus_space_write_2(psc->sc_iot, psc->sc_ioh, offset, vector); ret = bus_space_read_2(psc->sc_iot, psc->sc_ioh, offset); - aprint_debug_dev(sc->sc_dev, "expected=%d, actual=%d\n", - vector, ret); if (ret != vector) { + aprint_debug_dev(sc->sc_dev, "%s: expected=%d, actual=%d\n", + __func__, vector, ret); VIRTIO_PCI_LOG(sc, reinit, "can't set config msix vector\n"); return -1; @@ -900,9 +900,10 @@ virtio_pci_setup_interrupts_09(struct vi bus_space_write_2(psc->sc_iot, psc->sc_ioh, offset, vector); ret = bus_space_read_2(psc->sc_iot, psc->sc_ioh, offset); - aprint_debug_dev(sc->sc_dev, "expected=%d, actual=%d\n", - vector, ret); if (ret != vector) { + aprint_debug_dev(sc->sc_dev, "%s[qid=%d]:" + " expected=%d, actual=%d\n", + __func__, qid, vector, ret); VIRTIO_PCI_LOG(sc, reinit, "can't set queue %d " "msix vector\n", qid); return -1;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: riastradh Date: Mon May 30 20:28:18 UTC 2022 Modified Files: src/sys/dev/pci: virtio_pci.c Log Message: virtio at pci: Provide attribution in debug message. Also make it only happen in the error case so success doesn't clutter up the console output. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/virtio_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Mon May 30 17:08:06 UTC 2022 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1744 To generate a diff of this commit: cvs rdiff -u -r1.1.2.130 -r1.1.2.131 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.3 diff -u src/doc/CHANGES-8.3:1.1.2.130 src/doc/CHANGES-8.3:1.1.2.131 --- src/doc/CHANGES-8.3:1.1.2.130 Tue May 17 12:12:38 2022 +++ src/doc/CHANGES-8.3 Mon May 30 17:08:06 2022 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.3,v 1.1.2.130 2022/05/17 12:12:38 bouyer Exp $ +# $NetBSD: CHANGES-8.3,v 1.1.2.131 2022/05/30 17:08:06 martin Exp $ A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3 release: @@ -2610,3 +2610,25 @@ libexec/mail.local/mail.local.c 1.29 Thanks to Jan Schaumann for bringing this to our attention. [kre, ticket #1743] +sys/dev/pci/ixgbe/ixgbe.c 1.270,1.280,1.307-1.311, + 1.313-1.314 via patch +sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97 +sys/dev/pci/ixgbe/ixv.c1.179-1.180 via patch + + + - ixg(4): Print Printed Board Assembly (PBA) number. + - ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might + fix small race but it's not so dangerous. + - Add value check for {tx,rx}_process_limit sysctl to avoid setting + wrong value. + - Add missing num_tx_desc sysctl. + - No functional change: + - KNF a bit. + - Simplify setting of EIAC register. + - Move the definition of eicr_mask variable. + - Enclose flow director stuff in ixgbe_intr_admin_common() with + IXGBE_FIR which is not defined in NetBSD. + - Modify comment for consistency. + - Use cached rx_copy_len in ixgbe_rxeof(). + [msaitoh, ticket #1744] +
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Mon May 30 17:08:06 UTC 2022 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1744 To generate a diff of this commit: cvs rdiff -u -r1.1.2.130 -r1.1.2.131 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/libexec/ld.elf_so/arch/hppa
Module Name:src Committed By: skrll Date: Mon May 30 17:06:34 UTC 2022 Modified Files: src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c rtld_start.S Log Message: Set DP early so that any binary functions that override others get the right value if they're called before _start. This is true of bash where it provides its own getenv. Part of port-hppa/56118: sporadic app crashes in HPPA -current To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c cvs rdiff -u -r1.13 -r1.14 src/libexec/ld.elf_so/arch/hppa/rtld_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.48 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.49 --- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.48 Sat Dec 4 14:39:08 2021 +++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c Mon May 30 17:06:34 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: hppa_reloc.c,v 1.48 2021/12/04 14:39:08 skrll Exp $ */ +/* $NetBSD: hppa_reloc.c,v 1.49 2022/05/30 17:06:34 skrll Exp $ */ /*- * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hppa_reloc.c,v 1.48 2021/12/04 14:39:08 skrll Exp $"); +__RCSID("$NetBSD: hppa_reloc.c,v 1.49 2022/05/30 17:06:34 skrll Exp $"); #endif /* not lint */ #include @@ -52,6 +52,7 @@ __RCSID("$NetBSD: hppa_reloc.c,v 1.48 20 caddr_t _rtld_bind(const Obj_Entry *, const Elf_Addr); void _rtld_bind_start(void); void __rtld_setup_hppa_pltgot(const Obj_Entry *, Elf_Addr *); +void _rtld_set_dp(Elf_Addr *); /* * It is possible for the compiler to emit relocations for unaligned data. @@ -417,6 +418,16 @@ _rtld_relocate_nonplt_objects(Obj_Entry const Obj_Entry *defobj = NULL; unsigned long last_symnum = ULONG_MAX; + /* + * This will be done by the crt0 code, but make sure it's set + * early so that symbols overridden by the non-pic binary + * get the right DP value. + */ + if (obj->mainprog) { + hdbg(("setting DP to %p", obj->pltgot)); + _rtld_set_dp(obj->pltgot); + } + for (rela = obj->rela; rela < obj->relalim; rela++) { Elf_Addr*where; Elf_Addr tmp; Index: src/libexec/ld.elf_so/arch/hppa/rtld_start.S diff -u src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.13 src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.14 --- src/libexec/ld.elf_so/arch/hppa/rtld_start.S:1.13 Sun May 10 06:42:38 2020 +++ src/libexec/ld.elf_so/arch/hppa/rtld_start.S Mon May 30 17:06:34 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rtld_start.S,v 1.13 2020/05/10 06:42:38 skrll Exp $ */ +/* $NetBSD: rtld_start.S,v 1.14 2022/05/30 17:06:34 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -231,3 +231,9 @@ ENTRY(_rtld_bind_start,HPPA_FRAME_SIZE) bv %r0(%r21) nop EXIT(_rtld_bind_start) + + +LEAF_ENTRY_NOPROFILE(_rtld_set_dp) + bv %r0(%rp) + copy %arg0, %dp +EXIT(_rtld_set_dp)
CVS commit: src/libexec/ld.elf_so/arch/hppa
Module Name:src Committed By: skrll Date: Mon May 30 17:06:34 UTC 2022 Modified Files: src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c rtld_start.S Log Message: Set DP early so that any binary functions that override others get the right value if they're called before _start. This is true of bash where it provides its own getenv. Part of port-hppa/56118: sporadic app crashes in HPPA -current To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c cvs rdiff -u -r1.13 -r1.14 src/libexec/ld.elf_so/arch/hppa/rtld_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-8] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Mon May 30 17:05:52 UTC 2022 Modified Files: src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixv.c Log Message: Pull up the following revisions, requested by msaitoh in ticket #1744: sys/dev/pci/ixgbe/ixgbe.c 1.270,1.280,1.307-1.311, 1.313-1.314 via patch sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97 sys/dev/pci/ixgbe/ixv.c 1.179-1.180 via patch - ixg(4): Print Printed Board Assembly (PBA) number. - ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might fix small race but it's not so dangerous. - Add value check for {tx,rx}_process_limit sysctl to avoid setting wrong value. - Add missing num_tx_desc sysctl. - No functional change: - KNF a bit. - Simplify setting of EIAC register. - Move the definition of eicr_mask variable. - Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR which is not defined in NetBSD. - Modify comment for consistency. - Use cached rx_copy_len in ixgbe_rxeof(). To generate a diff of this commit: cvs rdiff -u -r1.24.2.23 -r1.24.2.24 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.88.2.49 -r1.88.2.50 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.56.2.36 -r1.56.2.37 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.23 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.24 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.23 Sat Nov 20 15:21:31 2021 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Mon May 30 17:05:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -1819,6 +1819,7 @@ ixgbe_rxeof(struct ix_queue *que) u32 staterr = 0; u32 loopcount = 0, numdesc; u32 limit = adapter->rx_process_limit; + u32 rx_copy_len = adapter->rx_copy_len; bool discard_multidesc = rxr->discard_multidesc; bool wraparound = false; unsigned int syncremain; @@ -1929,7 +1930,7 @@ ixgbe_rxeof(struct ix_queue *que) /* Pre-alloc new mbuf. */ if ((rbuf->fmp == NULL) && - eop && (len <= adapter->rx_copy_len)) { + eop && (len <= rx_copy_len)) { /* For short packet. See below. */ sendmp = m_gethdr(M_NOWAIT, MT_DATA); if (__predict_false(sendmp == NULL)) { @@ -2035,7 +2036,7 @@ ixgbe_rxeof(struct ix_queue *que) * packet. */ - if (eop && (len <= adapter->rx_copy_len)) { + if (eop && (len <= rx_copy_len)) { /* * Optimize. This might be a small packet, may * be just a TCP ACK. Copy into a new mbuf, and @@ -2047,7 +2048,7 @@ ixgbe_rxeof(struct ix_queue *que) rxr->rx_copies.ev_count++; rbuf->flags |= IXGBE_RX_COPY; } else { -/* Non short packet */ +/* For long packet */ /* Update new (used in future) mbuf */ newmp->m_pkthdr.len = newmp->m_len Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.49 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.50 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.49 Tue Feb 1 11:38:29 2022 +++ src/sys/dev/pci/ixgbe/ixgbe.c Mon May 30 17:05:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -233,8 +233,6 @@ static int ixgbe_set_advertise(struct ad static int ixgbe_get_default_advertise(struct adapter *); /* Sysctl handlers */ -static void ixgbe_set_sysctl_value(struct adapter *, const char *, - const char *, int *, int); static int ixgbe_sysctl_flowcntl(SYSCTLFN_PROTO); static int ixgbe_sysctl_advertise(SYSCTLFN_PROTO); static int ixgbe_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO); @@ -254,6 +252,8 @@ static int ixgbe_sysctl_tdh_handler(SYSC static int ixgbe_sysctl_eee_state(SYSCTLFN_PROTO); static int ixgbe_sysctl_debug(SYSCTLFN_PROTO); static int ixgbe_sysctl_rx_copy_len(SYSCTLFN_PROTO); +static int ixgbe_sysctl_tx_process_limit(SYSCTLFN_PROTO); +static int ixgbe_sysctl_rx_process_limit(SYSCTLFN_PROTO); static
CVS commit: [netbsd-8] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Mon May 30 17:05:52 UTC 2022 Modified Files: src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixv.c Log Message: Pull up the following revisions, requested by msaitoh in ticket #1744: sys/dev/pci/ixgbe/ixgbe.c 1.270,1.280,1.307-1.311, 1.313-1.314 via patch sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97 sys/dev/pci/ixgbe/ixv.c 1.179-1.180 via patch - ixg(4): Print Printed Board Assembly (PBA) number. - ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might fix small race but it's not so dangerous. - Add value check for {tx,rx}_process_limit sysctl to avoid setting wrong value. - Add missing num_tx_desc sysctl. - No functional change: - KNF a bit. - Simplify setting of EIAC register. - Move the definition of eicr_mask variable. - Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR which is not defined in NetBSD. - Modify comment for consistency. - Use cached rx_copy_len in ixgbe_rxeof(). To generate a diff of this commit: cvs rdiff -u -r1.24.2.23 -r1.24.2.24 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.88.2.49 -r1.88.2.50 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.56.2.36 -r1.56.2.37 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Mon May 30 17:03:55 UTC 2022 Modified Files: src/doc [netbsd-9]: CHANGES-9.3 Log Message: Ticket #1457 To generate a diff of this commit: cvs rdiff -u -r1.1.2.96 -r1.1.2.97 src/doc/CHANGES-9.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.3 diff -u src/doc/CHANGES-9.3:1.1.2.96 src/doc/CHANGES-9.3:1.1.2.97 --- src/doc/CHANGES-9.3:1.1.2.96 Thu May 19 16:25:11 2022 +++ src/doc/CHANGES-9.3 Mon May 30 17:03:54 2022 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.3,v 1.1.2.96 2022/05/19 16:25:11 martin Exp $ +# $NetBSD: CHANGES-9.3,v 1.1.2.97 2022/05/30 17:03:54 martin Exp $ A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3 release: @@ -1674,3 +1674,24 @@ sys/dev/pci/if_bge.c1.353 PR 56848: improve handling of bge(4) chips with ASF/IPMI firmware. [buhrow, ticket #1456] +sys/dev/pci/ixgbe/ixgbe.c 1.270,1.280,1.307-1.311, + 1.313-1.314 via patch +sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97 +sys/dev/pci/ixgbe/ixv.c1.158,1.179-1.180 via patch + + + - ixg(4): Print Printed Board Assembly (PBA) number. + - ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might + fix small race but it's not so dangerous. + - Add value check for {tx,rx}_process_limit sysctl to avoid setting + wrong value. + - Add missing num_tx_desc sysctl. + - No functional change: + - KNF a bit. + - Simplify setting of EIAC register. + - Move the definition of eicr_mask variable. + - Enclose flow director stuff in ixgbe_intr_admin_common() with + IXGBE_FIR which is not defined in NetBSD. + - Modify comment for consistency. + - Use cached rx_copy_len in ixgbe_rxeof(). + [msaitoh, ticket #1457]
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Mon May 30 17:03:55 UTC 2022 Modified Files: src/doc [netbsd-9]: CHANGES-9.3 Log Message: Ticket #1457 To generate a diff of this commit: cvs rdiff -u -r1.1.2.96 -r1.1.2.97 src/doc/CHANGES-9.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Mon May 30 17:01:06 UTC 2022 Modified Files: src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixv.c Log Message: Pull up the following revisions, requested by msaitoh: sys/dev/pci/ixgbe/ixgbe.c 1.270,1.280,1.307-1.311, 1.313-1.314 via patch sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97 sys/dev/pci/ixgbe/ixv.c 1.158,1.179-1.180 via patch - ixg(4): Print Printed Board Assembly (PBA) number. - ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might fix small race but it's not so dangerous. - Add value check for {tx,rx}_process_limit sysctl to avoid setting wrong value. - Add missing num_tx_desc sysctl. - No functional change: - KNF a bit. - Simplify setting of EIAC register. - Move the definition of eicr_mask variable. - Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR which is not defined in NetBSD. - Modify comment for consistency. - Use cached rx_copy_len in ixgbe_rxeof(). To generate a diff of this commit: cvs rdiff -u -r1.54.2.9 -r1.54.2.10 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.199.2.20 -r1.199.2.21 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.125.2.17 -r1.125.2.18 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.9 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.10 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.9 Fri May 13 11:18:40 2022 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Mon May 30 17:01:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.54.2.9 2022/05/13 11:18:40 martin Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.54.2.10 2022/05/30 17:01:06 martin Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.9 2022/05/13 11:18:40 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.10 2022/05/30 17:01:06 martin Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -1819,6 +1819,7 @@ ixgbe_rxeof(struct ix_queue *que) u32 staterr = 0; u32 loopcount = 0, numdesc; u32 limit = adapter->rx_process_limit; + u32 rx_copy_len = adapter->rx_copy_len; bool discard_multidesc = rxr->discard_multidesc; bool wraparound = false; unsigned int syncremain; @@ -1929,7 +1930,7 @@ ixgbe_rxeof(struct ix_queue *que) /* Pre-alloc new mbuf. */ if ((rbuf->fmp == NULL) && - eop && (len <= adapter->rx_copy_len)) { + eop && (len <= rx_copy_len)) { /* For short packet. See below. */ sendmp = m_gethdr(M_NOWAIT, MT_DATA); if (__predict_false(sendmp == NULL)) { @@ -2035,7 +2036,7 @@ ixgbe_rxeof(struct ix_queue *que) * packet. */ - if (eop && (len <= adapter->rx_copy_len)) { + if (eop && (len <= rx_copy_len)) { /* * Optimize. This might be a small packet, may * be just a TCP ACK. Copy into a new mbuf, and @@ -2047,7 +2048,7 @@ ixgbe_rxeof(struct ix_queue *que) IXGBE_EVC_ADD(>rx_copies, 1); rbuf->flags |= IXGBE_RX_COPY; } else { -/* Non short packet */ +/* For long packet */ /* Update new (used in future) mbuf */ newmp->m_pkthdr.len = newmp->m_len Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.20 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.21 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.20 Wed Feb 2 14:25:49 2022 +++ src/sys/dev/pci/ixgbe/ixgbe.c Mon May 30 17:01:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.199.2.20 2022/02/02 14:25:49 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.199.2.21 2022/05/30 17:01:06 martin Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.20 2022/02/02 14:25:49 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.21 2022/05/30 17:01:06 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -235,8 +235,6 @@ static int ixgbe_set_advertise(struct ad static int ixgbe_get_default_advertise(struct adapter *); /* Sysctl handlers */ -static void ixgbe_set_sysctl_value(struct adapter *, const char *, - const char *, int *, int); static int ixgbe_sysctl_flowcntl(SYSCTLFN_PROTO); static int ixgbe_sysctl_advertise(SYSCTLFN_PROTO); static int ixgbe_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO); @@ -256,6 +254,8 @@ static int ixgbe_sysctl_tdh_handler(SYSC static int ixgbe_sysctl_eee_state(SYSCTLFN_PROTO); static int ixgbe_sysctl_debug(SYSCTLFN_PROTO); static int ixgbe_sysctl_rx_copy_len(SYSCTLFN_PROTO); +static int ixgbe_sysctl_tx_process_limit(SYSCTLFN_PROTO); +static int ixgbe_sysctl_rx_process_limit(SYSCTLFN_PROTO); static int ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO); static int
CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe
Module Name:src Committed By: martin Date: Mon May 30 17:01:06 UTC 2022 Modified Files: src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixv.c Log Message: Pull up the following revisions, requested by msaitoh: sys/dev/pci/ixgbe/ixgbe.c 1.270,1.280,1.307-1.311, 1.313-1.314 via patch sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97 sys/dev/pci/ixgbe/ixv.c 1.158,1.179-1.180 via patch - ixg(4): Print Printed Board Assembly (PBA) number. - ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might fix small race but it's not so dangerous. - Add value check for {tx,rx}_process_limit sysctl to avoid setting wrong value. - Add missing num_tx_desc sysctl. - No functional change: - KNF a bit. - Simplify setting of EIAC register. - Move the definition of eicr_mask variable. - Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR which is not defined in NetBSD. - Modify comment for consistency. - Use cached rx_copy_len in ixgbe_rxeof(). To generate a diff of this commit: cvs rdiff -u -r1.54.2.9 -r1.54.2.10 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.199.2.20 -r1.199.2.21 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.125.2.17 -r1.125.2.18 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: rin Date: Mon May 30 15:22:44 UTC 2022 Modified Files: src/doc: CHANGES Log Message: Fix dates for previous; it is still 20220530 for UTC ;) To generate a diff of this commit: cvs rdiff -u -r1.2884 -r1.2885 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2884 src/doc/CHANGES:1.2885 --- src/doc/CHANGES:1.2884 Mon May 30 15:11:45 2022 +++ src/doc/CHANGES Mon May 30 15:22:44 2022 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2884 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2885 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -585,6 +585,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0: gomoku(6): Add highlighting, fix input handling, announce tie early, prevent overly long thinking. [rillig 20220528] powerpc: Add routines to fix userland unaligned memory access for 403. - [rin 20220531] + [rin 20220530] powerpc: Unify libc binary among all 32-bit powerpc ports. - [rin 20220531] + [rin 20220530]
CVS commit: src/doc
Module Name:src Committed By: rin Date: Mon May 30 15:22:44 UTC 2022 Modified Files: src/doc: CHANGES Log Message: Fix dates for previous; it is still 20220530 for UTC ;) To generate a diff of this commit: cvs rdiff -u -r1.2884 -r1.2885 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc_aligned/arch/powerpc
Module Name:src Committed By: rin Date: Mon May 30 15:18:32 UTC 2022 Modified Files: src/lib/libc_aligned/arch/powerpc: Makefile.inc Log Message: Remove comment-outed garbage. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc_aligned/arch/powerpc/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc_aligned/arch/powerpc/Makefile.inc diff -u src/lib/libc_aligned/arch/powerpc/Makefile.inc:1.1 src/lib/libc_aligned/arch/powerpc/Makefile.inc:1.2 --- src/lib/libc_aligned/arch/powerpc/Makefile.inc:1.1 Mon May 30 15:06:55 2022 +++ src/lib/libc_aligned/arch/powerpc/Makefile.inc Mon May 30 15:18:32 2022 @@ -1,15 +1,7 @@ -# $NetBSD: Makefile.inc,v 1.1 2022/05/30 15:06:55 rin Exp $ +# $NetBSD: Makefile.inc,v 1.2 2022/05/30 15:18:32 rin Exp $ # Disable asm versions that use unaligned memory access. .PATH: ${NETBSDSRCDIR}/common/lib/libc/string SRCS+= memcmp.c bcopy.c memcpy.c memmove.c - -.if 0 -. for name in bcopy memcmp memcpy memmove -.for suffix in o po pico go d -${name}.${suffix}: ${name}.c -.endfor -. endfor -.endif
CVS commit: src/lib/libc_aligned/arch/powerpc
Module Name:src Committed By: rin Date: Mon May 30 15:18:32 UTC 2022 Modified Files: src/lib/libc_aligned/arch/powerpc: Makefile.inc Log Message: Remove comment-outed garbage. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc_aligned/arch/powerpc/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon May 30 15:13:25 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: main1.c Log Message: lint: report proper file name in assertion failures When given the (obviously malformed) translation unit 'f=({;};}', lint runs into an assertion failure. It reported this as occurring near ':1'. This location was missing a filename since the input didn't contain a GCC line number directive such as '# 2 "input.c"'. In GCC mode, the GCC builtins are loaded first, in which case the reported location was ':9'. Fix this by providing proper location information, even for input that does not come from the GCC C preprocessor. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint1/main1.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/xlint/lint1/main1.c diff -u src/usr.bin/xlint/lint1/main1.c:1.62 src/usr.bin/xlint/lint1/main1.c:1.63 --- src/usr.bin/xlint/lint1/main1.c:1.62 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint1/main1.c Mon May 30 15:13:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main1.c,v 1.62 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: main1.c,v 1.63 2022/05/30 15:13:25 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: main1.c,v 1.62 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: main1.c,v 1.63 2022/05/30 15:13:25 rillig Exp $"); #endif #include @@ -288,6 +288,9 @@ main(int argc, char *argv[]) if (allow_gcc && allow_c90) { if ((yyin = gcc_builtins()) == NULL) err(1, "cannot open builtins"); + curr_pos.p_file = ""; + curr_pos.p_line = 0; + lex_next_line(); yyparse(); (void)fclose(yyin); } @@ -295,6 +298,9 @@ main(int argc, char *argv[]) /* open the input file */ if ((yyin = fopen(argv[0], "r")) == NULL) err(1, "cannot open '%s'", argv[0]); + curr_pos.p_file = argv[0]; + curr_pos.p_line = 0; + lex_next_line(); yyparse(); (void)fclose(yyin);
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon May 30 15:13:25 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: main1.c Log Message: lint: report proper file name in assertion failures When given the (obviously malformed) translation unit 'f=({;};}', lint runs into an assertion failure. It reported this as occurring near ':1'. This location was missing a filename since the input didn't contain a GCC line number directive such as '# 2 "input.c"'. In GCC mode, the GCC builtins are loaded first, in which case the reported location was ':9'. Fix this by providing proper location information, even for input that does not come from the GCC C preprocessor. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint1/main1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: rin Date: Mon May 30 15:11:45 UTC 2022 Modified Files: src/doc: CHANGES Log Message: Document changes for powerpc: - Fix userland unaligned memory access for 403. - Unify libc binaries among all 32-bit ppc ports. To generate a diff of this commit: cvs rdiff -u -r1.2883 -r1.2884 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2883 src/doc/CHANGES:1.2884 --- src/doc/CHANGES:1.2883 Sun May 29 01:45:56 2022 +++ src/doc/CHANGES Mon May 30 15:11:45 2022 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2883 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2884 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -584,3 +584,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0: [rillig 20220507] gomoku(6): Add highlighting, fix input handling, announce tie early, prevent overly long thinking. [rillig 20220528] + powerpc: Add routines to fix userland unaligned memory access for 403. + [rin 20220531] + powerpc: Unify libc binary among all 32-bit powerpc ports. + [rin 20220531]
CVS commit: src/doc
Module Name:src Committed By: rin Date: Mon May 30 15:11:45 UTC 2022 Modified Files: src/doc: CHANGES Log Message: Document changes for powerpc: - Fix userland unaligned memory access for 403. - Unify libc binaries among all 32-bit ppc ports. To generate a diff of this commit: cvs rdiff -u -r1.2883 -r1.2884 src/doc/CHANGES 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: rin Date: Mon May 30 15:06:55 UTC 2022 Modified Files: src/distrib/sets/lists/base: md.evbppc src/distrib/sets/lists/comp: md.evbppc src/distrib/sets/lists/debug: md.evbppc src/etc: Makefile src/lib: Makefile Added Files: src/distrib/sets/lists/etc: md.evbppc src/etc/etc.evbppc: ld.so.conf src/lib/libc_aligned: Makefile shlib_version src/lib/libc_aligned/arch/powerpc: Makefile.inc Log Message: Introduce libc_aligned.so for evbppc-powerpc32, which provides strictly-aligned versions of memcmp(3), bcopy(3), memcpy(3), and memmove(3). This is used for 403 by ld.so.conf with machdep.no_unaligned variable. With this library, unaligned memory accesses are significantly reduced for 403 (from several hundreds to few tens per sec under heavy load); only ld.elf_so (typically few times per fork) and statically-linked binaries do such access. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/base/md.evbppc cvs rdiff -u -r1.17 -r1.18 src/distrib/sets/lists/comp/md.evbppc cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/debug/md.evbppc cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/etc/md.evbppc cvs rdiff -u -r1.463 -r1.464 src/etc/Makefile cvs rdiff -u -r0 -r1.1 src/etc/etc.evbppc/ld.so.conf cvs rdiff -u -r1.293 -r1.294 src/lib/Makefile cvs rdiff -u -r0 -r1.1 src/lib/libc_aligned/Makefile \ src/lib/libc_aligned/shlib_version cvs rdiff -u -r0 -r1.1 src/lib/libc_aligned/arch/powerpc/Makefile.inc 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.evbppc diff -u src/distrib/sets/lists/base/md.evbppc:1.1 src/distrib/sets/lists/base/md.evbppc:1.2 --- src/distrib/sets/lists/base/md.evbppc:1.1 Wed Jan 12 15:35:51 2022 +++ src/distrib/sets/lists/base/md.evbppc Mon May 30 15:06:54 2022 @@ -1,4 +1,10 @@ -# $NetBSD: md.evbppc,v 1.1 2022/01/12 15:35:51 martin Exp $ +# $NetBSD: md.evbppc,v 1.2 2022/05/30 15:06:54 rin Exp $ +./lib/libc_aligned.so base-sys-shlib dynamicroot,!machine_arch=powerpc64 +./lib/libc_aligned.so.0 base-sys-shlib dynamicroot,!machine_arch=powerpc64 +./lib/libc_aligned.so.0.0 base-sys-shlib dynamicroot,!machine_arch=powerpc64 +./usr/lib/libc_aligned.so base-sys-shlib pic,!machine_arch=powerpc64 +./usr/lib/libc_aligned.so.0 base-sys-shlib pic,!machine_arch=powerpc64 +./usr/lib/libc_aligned.so.0.0 base-sys-shlib pic,!machine_arch=powerpc64 ./usr/share/sysinst/catalog/sysinstmsgs.de base-util-share ./usr/share/sysinst/catalog/sysinstmsgs.es base-util-share ./usr/share/sysinst/catalog/sysinstmsgs.fr base-util-share Index: src/distrib/sets/lists/comp/md.evbppc diff -u src/distrib/sets/lists/comp/md.evbppc:1.17 src/distrib/sets/lists/comp/md.evbppc:1.18 --- src/distrib/sets/lists/comp/md.evbppc:1.17 Thu Jul 12 10:46:40 2018 +++ src/distrib/sets/lists/comp/md.evbppc Mon May 30 15:06:54 2022 @@ -1,4 +1,4 @@ -# $NetBSD: md.evbppc,v 1.17 2018/07/12 10:46:40 maxv Exp $ +# $NetBSD: md.evbppc,v 1.18 2022/05/30 15:06:54 rin Exp $ ./usr/include/evbppccomp-c-include ./usr/include/evbppc/_G_config.h comp-obsolete obsolete ./usr/include/evbppc/ansi.h comp-c-include @@ -59,3 +59,5 @@ ./usr/include/evbppc/vmparam.h comp-c-include ./usr/include/evbppc/wchar_limits.h comp-c-include ./usr/include/ieeefp.hcomp-c-include +./usr/lib/libc_aligned.a comp-c-lib !machine_arch=powerpc64 +./usr/lib/libc_aligned_p.a comp-c-lib !machine_arch=powerpc64 Index: src/distrib/sets/lists/debug/md.evbppc diff -u src/distrib/sets/lists/debug/md.evbppc:1.1 src/distrib/sets/lists/debug/md.evbppc:1.2 --- src/distrib/sets/lists/debug/md.evbppc:1.1 Fri Dec 31 16:15:58 2021 +++ src/distrib/sets/lists/debug/md.evbppc Mon May 30 15:06:54 2022 @@ -1,4 +1,5 @@ -# $NetBSD: md.evbppc,v 1.1 2021/12/31 16:15:58 christos Exp $ +# $NetBSD: md.evbppc,v 1.2 2022/05/30 15:06:54 rin Exp $ +./usr/lib/libc_aligned_g.a comp-c-debuglib debuglib,!machine_arch=powerpc64 ./usr/libdata/debug/netbsd-esata-P2020DS.debug comp-sysutil-debug debug ./usr/libdata/debug/netbsd-ld0a-INSTALL_TWRP1025.debug comp-sysutil-debug debug ./usr/libdata/debug/netbsd-ld0a-TWRP1025.debug comp-sysutil-debug debug @@ -11,3 +12,5 @@ ./usr/libdata/debug/nfsnetbsd-P2020RDB.debug comp-sysutil-debug debug ./usr/libdata/debug/nfsnetbsd-RB800.debug comp-sysutil-debug debug ./usr/libdata/debug/nfsnetbsd-TWRP1025.debug comp-sysutil-debug debug +./usr/libdata/debug/lib/libc_aligned.so.0.0.debug comp-sys-debug debug,pic,!machine_arch=powerpc64 +./usr/libdata/debug/usr/lib/libc_aligned.so.0.0.debug comp-sys-debug debug,pic,!machine_arch=powerpc64 Index: src/etc/Makefile diff -u src/etc/Makefile:1.463 src/etc/Makefile:1.464 --- src/etc/Makefile:1.463 Sat May 28 14:31:11 2022 +++ src/etc/Makefile Mon May 30 15:06:55 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.463 2022/05/28 14:31:11 nia Exp $ +# $NetBSD:
CVS commit: src
Module Name:src Committed By: rin Date: Mon May 30 15:06:55 UTC 2022 Modified Files: src/distrib/sets/lists/base: md.evbppc src/distrib/sets/lists/comp: md.evbppc src/distrib/sets/lists/debug: md.evbppc src/etc: Makefile src/lib: Makefile Added Files: src/distrib/sets/lists/etc: md.evbppc src/etc/etc.evbppc: ld.so.conf src/lib/libc_aligned: Makefile shlib_version src/lib/libc_aligned/arch/powerpc: Makefile.inc Log Message: Introduce libc_aligned.so for evbppc-powerpc32, which provides strictly-aligned versions of memcmp(3), bcopy(3), memcpy(3), and memmove(3). This is used for 403 by ld.so.conf with machdep.no_unaligned variable. With this library, unaligned memory accesses are significantly reduced for 403 (from several hundreds to few tens per sec under heavy load); only ld.elf_so (typically few times per fork) and statically-linked binaries do such access. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/base/md.evbppc cvs rdiff -u -r1.17 -r1.18 src/distrib/sets/lists/comp/md.evbppc cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/debug/md.evbppc cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/etc/md.evbppc cvs rdiff -u -r1.463 -r1.464 src/etc/Makefile cvs rdiff -u -r0 -r1.1 src/etc/etc.evbppc/ld.so.conf cvs rdiff -u -r1.293 -r1.294 src/lib/Makefile cvs rdiff -u -r0 -r1.1 src/lib/libc_aligned/Makefile \ src/lib/libc_aligned/shlib_version cvs rdiff -u -r0 -r1.1 src/lib/libc_aligned/arch/powerpc/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc
Module Name:src Committed By: rin Date: Mon May 30 14:48:09 UTC 2022 Modified Files: src/sys/arch/powerpc/include: cpu.h src/sys/arch/powerpc/powerpc: powerpc_machdep.c Log Message: Export CPU capability of unaligned memory access to userland as machdep.no_unaligned sysctl(7) variable. This will be used for ld.so.conf in order to provide strictly- aligned versions of libc routines. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/arch/powerpc/include/cpu.h cvs rdiff -u -r1.85 -r1.86 src/sys/arch/powerpc/powerpc/powerpc_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/powerpc/include/cpu.h diff -u src/sys/arch/powerpc/include/cpu.h:1.121 src/sys/arch/powerpc/include/cpu.h:1.122 --- src/sys/arch/powerpc/include/cpu.h:1.121 Mon May 30 14:05:36 2022 +++ src/sys/arch/powerpc/include/cpu.h Mon May 30 14:48:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.121 2022/05/30 14:05:36 rin Exp $ */ +/* $NetBSD: cpu.h,v 1.122 2022/05/30 14:48:08 rin Exp $ */ /* * Copyright (C) 1999 Wolfgang Solfrank. @@ -511,5 +511,6 @@ void __syncicache(void *, size_t); #define CPU_BOOTED_KERNEL 10 /* string: kernel we booted */ #define CPU_EXECPROT 11 /* bool: PROT_EXEC works */ #define CPU_FPU 12 +#define CPU_NO_UNALIGNED 13 /* No HW support for unaligned access */ #endif /* _POWERPC_CPU_H_ */ Index: src/sys/arch/powerpc/powerpc/powerpc_machdep.c diff -u src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.85 src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.86 --- src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.85 Fri May 20 19:34:22 2022 +++ src/sys/arch/powerpc/powerpc/powerpc_machdep.c Mon May 30 14:48:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: powerpc_machdep.c,v 1.85 2022/05/20 19:34:22 andvar Exp $ */ +/* $NetBSD: powerpc_machdep.c,v 1.86 2022/05/30 14:48:08 rin Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.85 2022/05/20 19:34:22 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.86 2022/05/30 14:48:08 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_altivec.h" @@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: powerpc_mach #include "opt_modular.h" #include "opt_multiprocessor.h" #include "opt_ppcarch.h" +#include "opt_ppcopts.h" #endif #include @@ -301,6 +302,17 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc #endif NULL, 0, CTL_MACHDEP, CPU_FPU, CTL_EOL); + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, + CTLTYPE_INT, "no_unaligned", NULL, + NULL, +#if defined(PPC_NO_UNALIGNED) + 1, +#else + 0, +#endif + NULL, 0, + CTL_MACHDEP, CPU_NO_UNALIGNED, CTL_EOL); } /*
CVS commit: src/sys/arch/powerpc
Module Name:src Committed By: rin Date: Mon May 30 14:48:09 UTC 2022 Modified Files: src/sys/arch/powerpc/include: cpu.h src/sys/arch/powerpc/powerpc: powerpc_machdep.c Log Message: Export CPU capability of unaligned memory access to userland as machdep.no_unaligned sysctl(7) variable. This will be used for ld.so.conf in order to provide strictly- aligned versions of libc routines. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/arch/powerpc/include/cpu.h cvs rdiff -u -r1.85 -r1.86 src/sys/arch/powerpc/powerpc/powerpc_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/arch/powerpc/string
Module Name:src Committed By: rin Date: Mon May 30 14:43:37 UTC 2022 Modified Files: src/lib/libc/arch/powerpc/string: Makefile.inc Log Message: Obsolete hack for evbppc to replace memcmp(9), memcpy(9), and memmove(9) with strictly-aligned versions. Now all 32-bit powerpc ports share the same libc binary. This change together with the preceding similar change in libkern slightly improve performance for DHT (ibm4xx/405GP) and RB800 (MPC8533E). See changes in bytebench scores: - DHT https://gist.github.com/rokuyama/301063355de9733bea515b84ef574c0a - RB800 https://gist.github.com/rokuyama/60ad665d367d6d110b79ec44707f39ff Improvements may be negligible, but this does not cause performance regressions at least. This hack was for 403, but unaligned memory access is now emulated by kernel. This should result in serious performance regression for 403. We will provide strictly-aligned versions by ld.so.conf. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/lib/libc/arch/powerpc/string/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/arch/powerpc/string
Module Name:src Committed By: rin Date: Mon May 30 14:43:37 UTC 2022 Modified Files: src/lib/libc/arch/powerpc/string: Makefile.inc Log Message: Obsolete hack for evbppc to replace memcmp(9), memcpy(9), and memmove(9) with strictly-aligned versions. Now all 32-bit powerpc ports share the same libc binary. This change together with the preceding similar change in libkern slightly improve performance for DHT (ibm4xx/405GP) and RB800 (MPC8533E). See changes in bytebench scores: - DHT https://gist.github.com/rokuyama/301063355de9733bea515b84ef574c0a - RB800 https://gist.github.com/rokuyama/60ad665d367d6d110b79ec44707f39ff Improvements may be negligible, but this does not cause performance regressions at least. This hack was for 403, but unaligned memory access is now emulated by kernel. This should result in serious performance regression for 403. We will provide strictly-aligned versions by ld.so.conf. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/lib/libc/arch/powerpc/string/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/powerpc/string/Makefile.inc diff -u src/lib/libc/arch/powerpc/string/Makefile.inc:1.15 src/lib/libc/arch/powerpc/string/Makefile.inc:1.16 --- src/lib/libc/arch/powerpc/string/Makefile.inc:1.15 Mon Jul 26 12:49:13 2021 +++ src/lib/libc/arch/powerpc/string/Makefile.inc Mon May 30 14:43:37 2022 @@ -1,16 +1,7 @@ -# $NetBSD: Makefile.inc,v 1.15 2021/07/26 12:49:13 rin Exp $ +# $NetBSD: Makefile.inc,v 1.16 2022/05/30 14:43:37 rin Exp $ SRCS+= bzero.S ffs.S strlen.S NO_SRCS+= memset.S -# XXX -# Disable asm versions that use unaligned memory access and thus break 403. -.if ${MACHINE} == "evbppc" -. for name in bcopy memcmp memcpy memmove -.for suffix in o po pico go d -${name}.${suffix}: ${name}.c -.endfor -. endfor -.else +# with unaligned memory access SRCS+= memcmp.S bcopy.S memcpy.S memmove.S -.endif
CVS commit: src/tests/lib/libc/kevent_nullmnt
Module Name:src Committed By: pgoyette Date: Mon May 30 14:28:31 UTC 2022 Modified Files: src/tests/lib/libc/kevent_nullmnt: t_nullmnt.sh Log Message: More factoring of common code. NFCI To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh 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/libc/kevent_nullmnt/t_nullmnt.sh diff -u src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh:1.3 src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh:1.4 --- src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh:1.3 Mon May 30 03:33:07 2022 +++ src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh Mon May 30 14:28:31 2022 @@ -1,12 +1,14 @@ +# find where everything lives + +curdir=$(pwd) +helper=$(atf_get_srcdir)/h_nullmnt + # common test body -#$1 = pathname of file to monitor -#$2 = pathname of file to update/modify +#$1 = directory of file to monitor +#$2 = directory of file to update/modify nullmnt_common() { - curdir=$(pwd) - helper=$(atf_get_srcdir)/h_nullmnt - mkdir ${curdir}/lower_dir mkdir ${curdir}/upper_dir mount -t null ${curdir}/lower_dir ${curdir}/upper_dir @@ -14,7 +16,7 @@ nullmnt_common() touch ${curdir}/lower_dir/afile atf_check -e ignore -o ignore -s exit:0 \ - ${helper} ${curdir}/${1} ${curdir}/${2} + ${helper} ${curdir}/${1}/afile ${curdir}/${2}/afile } nullmnt_common_cleanup() @@ -32,7 +34,7 @@ nullmnt_upper_lower_head() nullmnt_upper_lower_body() { atf_expect_fail "PR kern/56713" - nullmnt_common lower_dir/afile upper_dir/afile + nullmnt_common lower_dir upper_dir } nullmnt_upper_lower_cleanup() { @@ -47,7 +49,7 @@ nullmnt_upper_upper_head() nullmnt_upper_upper_body() { atf_expect_fail "PR kern/56713" - nullmnt_common upper_dir/afile upper_dir/afile + nullmnt_common upper_dir upper_dir } nullmnt_upper_upper_cleanup() { @@ -60,7 +62,7 @@ nullmnt_lower_upper_head() } nullmnt_lower_upper_body() { - nullmnt_common upper_dir/afile lower_dir/afile + nullmnt_common upper_dir lower_dir } nullmnt_lower_upper_cleanup() { @@ -74,7 +76,7 @@ nullmnt_lower_lower_head() } nullmnt_lower_lower_body() { - nullmnt_common lower_dir/afile lower_dir/afile + nullmnt_common lower_dir lower_dir } nullmnt_lower_lower_cleanup {
CVS commit: src/tests/lib/libc/kevent_nullmnt
Module Name:src Committed By: pgoyette Date: Mon May 30 14:28:31 UTC 2022 Modified Files: src/tests/lib/libc/kevent_nullmnt: t_nullmnt.sh Log Message: More factoring of common code. NFCI To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: rin Date: Mon May 30 14:18:10 UTC 2022 Modified Files: src/sys/arch/evbppc/conf: std.explora src/sys/lib/libkern/arch/powerpc: Makefile.inc Log Message: Restrict strictly-aligned versions of memcmp(9), memcpy(9), and memmove(9) to 403, instead of all evbppc machines. Introduce strict-align LIBKERN_MD_FLAGS for this purpose. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbppc/conf/std.explora cvs rdiff -u -r1.33 -r1.34 src/sys/lib/libkern/arch/powerpc/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbppc/conf/std.explora diff -u src/sys/arch/evbppc/conf/std.explora:1.10 src/sys/arch/evbppc/conf/std.explora:1.11 --- src/sys/arch/evbppc/conf/std.explora:1.10 Mon May 30 14:09:01 2022 +++ src/sys/arch/evbppc/conf/std.explora Mon May 30 14:18:10 2022 @@ -1,4 +1,4 @@ -# $NetBSD: std.explora,v 1.10 2022/05/30 14:09:01 rin Exp $ +# $NetBSD: std.explora,v 1.11 2022/05/30 14:18:10 rin Exp $ # # Standard/required options for NetBSD/explora. @@ -11,6 +11,7 @@ options PPC_IBM403 # IBM 403GCX # 403 does not support unaligned memory access. options PPC_NO_UNALIGNED +makeoptions LIBKERN_MD_FLAGS+="strict-align" options VMSWAP_DEFAULT_PLAINTEXT # do not encrypt swap by # default (slow cpu) Index: src/sys/lib/libkern/arch/powerpc/Makefile.inc diff -u src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.33 src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.34 --- src/sys/lib/libkern/arch/powerpc/Makefile.inc:1.33 Mon Jul 26 12:49:13 2021 +++ src/sys/lib/libkern/arch/powerpc/Makefile.inc Mon May 30 14:18:10 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.33 2021/07/26 12:49:13 rin Exp $ +# $NetBSD: Makefile.inc,v 1.34 2022/05/30 14:18:10 rin Exp $ SRCS+= bswap16.c bswap32.c SRCS+= htonl.c htons.c ntohl.c ntohs.c @@ -7,9 +7,8 @@ SRCS+= syncicache.c SRCS+= ffs.S memset.S strlen.S SRCS+= gprsavrest.S -# XXX +.if !empty(LIBKERN_MD_FLAGS:M*strict-align*) # Disable asm versions that use unaligned memory access and thus break 403. -.if ${MACHINE} == "evbppc" . for name in memcmp memcpy memmove .for suffix in o po pico go d ${name}.${suffix}: ${name}.c
CVS commit: src/sys
Module Name:src Committed By: rin Date: Mon May 30 14:18:10 UTC 2022 Modified Files: src/sys/arch/evbppc/conf: std.explora src/sys/lib/libkern/arch/powerpc: Makefile.inc Log Message: Restrict strictly-aligned versions of memcmp(9), memcpy(9), and memmove(9) to 403, instead of all evbppc machines. Introduce strict-align LIBKERN_MD_FLAGS for this purpose. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbppc/conf/std.explora cvs rdiff -u -r1.33 -r1.34 src/sys/lib/libkern/arch/powerpc/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/lib/libkern
Module Name:src Committed By: rin Date: Mon May 30 14:13:59 UTC 2022 Modified Files: src/sys/lib/libkern: Makefile.inc Log Message: Introduce LIBKERN_MD_FLAGS to pass some MD flags for libkern. This is necessary since libkern is built by coprocess, and threfore subsets of make(1) variables are passed. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/lib/libkern/Makefile.inc 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.inc diff -u src/sys/lib/libkern/Makefile.inc:1.46 src/sys/lib/libkern/Makefile.inc:1.47 --- src/sys/lib/libkern/Makefile.inc:1.46 Sat Sep 22 12:24:04 2018 +++ src/sys/lib/libkern/Makefile.inc Mon May 30 14:13:59 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.46 2018/09/22 12:24:04 rin Exp $ +# $NetBSD: Makefile.inc,v 1.47 2022/05/30 14:13:59 rin Exp $ # # Configuration variables (default values are below): # @@ -38,6 +38,8 @@ KERNLIB_PROF= ${KERNDST}/libkern_p.a LIBKERNLNBN= llib-lkern.ln KERNLIBLN= ${KERNDST}/${LIBKERNLNBN} +LIBKERN_MD_FLAGS?= none + KERNMAKE= \ cd ${KERNDST} && ${MAKE} -f ${KERNDIR:q}/Makefile \ KERNDIR=${KERNDIR:q} \ @@ -54,6 +56,7 @@ KERNMAKE= \ LINTFLAGS=${KERNLINTFLAGS:q} \ LIBKERN_ARCH=${LIBKERN_ARCH:q} \ COMMON_MACHINE_ARCH=${COMMON_MACHINE_ARCH:q} \ + LIBKERN_MD_FLAGS=${LIBKERN_MD_FLAGS:q} \ ${KERNMISCMAKEFLAGS} ${KERNLIB}: .NOTMAIN .MAKE __always_make_kernlib
CVS commit: src/sys/lib/libkern
Module Name:src Committed By: rin Date: Mon May 30 14:13:59 UTC 2022 Modified Files: src/sys/lib/libkern: Makefile.inc Log Message: Introduce LIBKERN_MD_FLAGS to pass some MD flags for libkern. This is necessary since libkern is built by coprocess, and threfore subsets of make(1) variables are passed. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/lib/libkern/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: rin Date: Mon May 30 14:09:01 UTC 2022 Modified Files: src/sys/arch/evbppc/conf: std.explora src/sys/arch/powerpc/ibm4xx: trap.c Log Message: For IBM_PPC403, emulate unaligned memory access for userland process. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbppc/conf/std.explora cvs rdiff -u -r1.86 -r1.87 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbppc/conf/std.explora diff -u src/sys/arch/evbppc/conf/std.explora:1.9 src/sys/arch/evbppc/conf/std.explora:1.10 --- src/sys/arch/evbppc/conf/std.explora:1.9 Sat Jun 26 09:03:46 2021 +++ src/sys/arch/evbppc/conf/std.explora Mon May 30 14:09:01 2022 @@ -1,4 +1,4 @@ -# $NetBSD: std.explora,v 1.9 2021/06/26 09:03:46 rin Exp $ +# $NetBSD: std.explora,v 1.10 2022/05/30 14:09:01 rin Exp $ # # Standard/required options for NetBSD/explora. @@ -9,6 +9,9 @@ include "conf/std" # MI standard option options PPC_IBM4XX # IBM 40x family options PPC_IBM403 # IBM 403GCX +# 403 does not support unaligned memory access. +options PPC_NO_UNALIGNED + options VMSWAP_DEFAULT_PLAINTEXT # do not encrypt swap by # default (slow cpu) Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.86 src/sys/arch/powerpc/ibm4xx/trap.c:1.87 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.86 Sat Mar 6 08:08:19 2021 +++ src/sys/arch/powerpc/ibm4xx/trap.c Mon May 30 14:09:01 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.86 2021/03/06 08:08:19 rin Exp $ */ +/* $NetBSD: trap.c,v 1.87 2022/05/30 14:09:01 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,12 +69,13 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.86 2021/03/06 08:08:19 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.87 2022/05/30 14:09:01 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" #include "opt_kgdb.h" #include "opt_ppcarch.h" +#include "opt_ppcopts.h" #endif #include @@ -116,8 +117,6 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.8 #define NARGREG 8 /* 8 args are in registers */ #define MOREARGS(sp) ((void *)((int)(sp) + 8)) /* more args go here */ -static int fix_unaligned(struct lwp *l, struct trapframe *tf); - void trap(struct trapframe *); /* Called from locore / trap_subr */ #if 0 /* Not currently used nor exposed externally in any header file */ @@ -126,6 +125,10 @@ int badaddr_read(void *, size_t, int *); #endif int ctx_setup(int, int); +#ifndef PPC_NO_UNALIGNED +static bool fix_unaligned(struct trapframe *, ksiginfo_t *); +#endif + #ifdef DEBUG #define TDB_ALL 0x1 int trapdebug = /* TDB_ALL */ 0; @@ -290,14 +293,8 @@ isi: break; case EXC_ALI|EXC_USER: - if (fix_unaligned(l, tf) != 0) { - KSI_INIT_TRAP(); - ksi.ksi_signo = SIGBUS; - ksi.ksi_trap = EXC_ALI; - ksi.ksi_addr = (void *)tf->tf_dear; + if (fix_unaligned(tf, )) trapsignal(l, ); - } else - tf->tf_srr0 += 4; break; case EXC_PGM|EXC_USER: @@ -726,18 +723,18 @@ badaddr_read(void *addr, size_t size, in } #endif -/* - * For now, this only deals with the particular unaligned access case - * that gcc tends to generate. Eventually it should handle all of the - * possibilities that can happen on a 32-bit PowerPC in big-endian mode. - */ - -static int -fix_unaligned(struct lwp *l, struct trapframe *tf) +#ifndef PPC_NO_UNALIGNED +static bool +fix_unaligned(struct trapframe *tf, ksiginfo_t *ksi) { - return -1; + KSI_INIT_TRAP(ksi); + ksi->ksi_signo = SIGBUS; + ksi->ksi_trap = EXC_ALI; + ksi->ksi_addr = (void *)tf->tf_dear; + return true; } +#endif /* * XXX Extremely lame implementations of _ufetch_* / _ustore_*. IBM 4xx
CVS commit: src/sys/arch
Module Name:src Committed By: rin Date: Mon May 30 14:09:01 UTC 2022 Modified Files: src/sys/arch/evbppc/conf: std.explora src/sys/arch/powerpc/ibm4xx: trap.c Log Message: For IBM_PPC403, emulate unaligned memory access for userland process. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbppc/conf/std.explora cvs rdiff -u -r1.86 -r1.87 src/sys/arch/powerpc/ibm4xx/trap.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/powerpc
Module Name:src Committed By: rin Date: Mon May 30 14:05:36 UTC 2022 Modified Files: src/sys/arch/powerpc/conf: files.powerpc src/sys/arch/powerpc/include: cpu.h Log Message: Introduce PPC_NO_UNALIGNED flag to indicate that CPU cannot handle unaligned memory access, and emulation should be provided to userland. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/conf/files.powerpc cvs rdiff -u -r1.120 -r1.121 src/sys/arch/powerpc/include/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/conf/files.powerpc diff -u src/sys/arch/powerpc/conf/files.powerpc:1.101 src/sys/arch/powerpc/conf/files.powerpc:1.102 --- src/sys/arch/powerpc/conf/files.powerpc:1.101 Sat May 7 07:10:46 2022 +++ src/sys/arch/powerpc/conf/files.powerpc Mon May 30 14:05:36 2022 @@ -1,14 +1,16 @@ -# $NetBSD: files.powerpc,v 1.101 2022/05/07 07:10:46 rin Exp $ +# $NetBSD: files.powerpc,v 1.102 2022/05/30 14:05:36 rin Exp $ defflag opt_altivec.h ALTIVEC K_ALTIVEC PPC_HAVE_SPE defflag opt_openpic.h OPENPIC_DISTRIBUTE defparam opt_ppcparam.h L2CR_CONFIG L3CR_CONFIG INTSTK CLOCKBASE VERBOSE_INITPPC PPC_CPU_FREQ defflag opt_ppcarch.h PPC_OEA PPC_OEA601 PPC_OEA64 PPC_OEA64_BRIDGE PPC_MPC8XX PPC_IBM4XX PPC_IBM403 PPC_IBM440 PPC_BOOKE defflag opt_ppccache.h CACHE_PROTO_MEI +defflag opt_ppcopts.h PPC_NO_UNALIGNED defflag opt_pmap.h PMAPDEBUG PMAPCHECK PMAPCOUNTERS PMAP_MINIMALTLB PMAP_TLBDEBUG defparam opt_pmap.h PTEGCOUNT PMAP_MEMLIMIT file arch/powerpc/powerpc/core_machdep.c coredump +file arch/powerpc/powerpc/fix_unaligned.c ppc_no_unaligned file arch/powerpc/powerpc/fixup.c file arch/powerpc/powerpc/kgdb_machdep.c kgdb file arch/powerpc/powerpc/kobj_machdep.c modular Index: src/sys/arch/powerpc/include/cpu.h diff -u src/sys/arch/powerpc/include/cpu.h:1.120 src/sys/arch/powerpc/include/cpu.h:1.121 --- src/sys/arch/powerpc/include/cpu.h:1.120 Tue Nov 2 11:26:04 2021 +++ src/sys/arch/powerpc/include/cpu.h Mon May 30 14:05:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.120 2021/11/02 11:26:04 ryo Exp $ */ +/* $NetBSD: cpu.h,v 1.121 2022/05/30 14:05:36 rin Exp $ */ /* * Copyright (C) 1999 Wolfgang Solfrank. @@ -49,6 +49,7 @@ struct cache_info { #include "opt_modular.h" #include "opt_multiprocessor.h" #include "opt_ppcarch.h" +#include "opt_ppcopts.h" #endif #ifdef _KERNEL @@ -471,6 +472,10 @@ extern paddr_t msgbuf_paddr; extern int cpu_altivec; #endif +#ifdef PPC_NO_UNALIGNED +bool fix_unaligned(struct trapframe *, ksiginfo_t *); +#endif + #endif /* _KERNEL */ /* XXX The below breaks unified pmap on ppc32 */
CVS commit: src/sys/arch/powerpc
Module Name:src Committed By: rin Date: Mon May 30 14:05:36 UTC 2022 Modified Files: src/sys/arch/powerpc/conf: files.powerpc src/sys/arch/powerpc/include: cpu.h Log Message: Introduce PPC_NO_UNALIGNED flag to indicate that CPU cannot handle unaligned memory access, and emulation should be provided to userland. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/conf/files.powerpc cvs rdiff -u -r1.120 -r1.121 src/sys/arch/powerpc/include/cpu.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/powerpc
Module Name:src Committed By: rin Date: Mon May 30 13:58:51 UTC 2022 Modified Files: src/sys/arch/powerpc/include: instr.h Added Files: src/sys/arch/powerpc/powerpc: fix_unaligned.c Log Message: Add routines to fix unaligned memory access for userland process. Mainly intended for 403, which cannot handle unaligned memory access at all (not only ones across page boundaries like 601). For more details, see comments in fix_unaligned.c. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/include/instr.h cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/powerpc/fix_unaligned.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/powerpc/include/instr.h diff -u src/sys/arch/powerpc/include/instr.h:1.10 src/sys/arch/powerpc/include/instr.h:1.11 --- src/sys/arch/powerpc/include/instr.h:1.10 Sun May 29 11:55:05 2022 +++ src/sys/arch/powerpc/include/instr.h Mon May 30 13:58:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: instr.h,v 1.10 2022/05/29 11:55:05 rin Exp $ */ +/* $NetBSD: instr.h,v 1.11 2022/05/30 13:58:51 rin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -318,6 +318,24 @@ union instr { #define OPC31_OR 0x1bc /* + * Opcode 31 sub-types (load/store multiple bytes) + */ +#define OPC31_LWZX 0x017 +#define OPC31_LWZUX 0x037 +#define OPC31_STWX 0x097 +#define OPC31_STWUX 0x0b7 +#define OPC31_LHZX 0x117 +#define OPC31_LHZUX 0x137 +#define OPC31_LHAX 0x157 +#define OPC31_LHAUX 0x177 +#define OPC31_STHX 0x197 +#define OPC31_STHUX 0x1b7 +#define OPC31_LWBRX 0x216 +#define OPC31_STWBRX 0x296 +#define OPC31_LHBRX 0x316 +#define OPC31_STHBRX 0x396 + +/* * Opcode 59 sub-types: */ Added files: Index: src/sys/arch/powerpc/powerpc/fix_unaligned.c diff -u /dev/null src/sys/arch/powerpc/powerpc/fix_unaligned.c:1.1 --- /dev/null Mon May 30 13:58:51 2022 +++ src/sys/arch/powerpc/powerpc/fix_unaligned.c Mon May 30 13:58:51 2022 @@ -0,0 +1,520 @@ +/* $NetBSD: fix_unaligned.c,v 1.1 2022/05/30 13:58:51 rin Exp $ */ + +/* + * Copyright (c) 2022 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Rin Okuyama. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Routines to fix unaligned memory access for userland process. + * + * Intended mainly for PPC_IBM403 at the moment: + * + * - Fetch and decode insn; 403 does not have DSISR. + * + * - Only for integer insn; unaligned floating-point load/store are taken + * care of by FPU emulator. (Support for FPU insn should be trivial.) + * + * Also note: + * + * - For invalid forms, behaviors are undefined and not documented in + * processor manuals. Here, we mimic what described in + * "AIX 7.2 Assembler language reference": + * + * - For "u" variants, ra is not updated if ra == 0 (or rd for load). + * + * - Fix for {l,st}mw is disabled by default. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: fix_unaligned.c,v 1.1 2022/05/30 13:58:51 rin Exp $"); + +#include "opt_ddb.h" +#include "opt_ppcarch.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#define UA_EVCNT_ATTACH(name) \ +static struct evcnt unaligned_ev_##name =\ + EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "unaligned", #name); \ + EVCNT_ATTACH_STATIC(unaligned_ev_##name) + +#define UA_EVCNT_INCR(name) unaligned_ev_##name.ev_count++ + +UA_EVCNT_ATTACH(lwz); +UA_EVCNT_ATTACH(lwzu); +UA_EVCNT_ATTACH(stw); +UA_EVCNT_ATTACH(stwu); +UA_EVCNT_ATTACH(lhz); +UA_EVCNT_ATTACH(lhzu); +UA_EVCNT_ATTACH(lha); +UA_EVCNT_ATTACH(lhau); +UA_EVCNT_ATTACH(sth);
CVS commit: src/sys/arch/powerpc
Module Name:src Committed By: rin Date: Mon May 30 13:58:51 UTC 2022 Modified Files: src/sys/arch/powerpc/include: instr.h Added Files: src/sys/arch/powerpc/powerpc: fix_unaligned.c Log Message: Add routines to fix unaligned memory access for userland process. Mainly intended for 403, which cannot handle unaligned memory access at all (not only ones across page boundaries like 601). For more details, see comments in fix_unaligned.c. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/include/instr.h cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/powerpc/fix_unaligned.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: andvar Date: Mon May 30 09:56:04 UTC 2022 Modified Files: src/sys/arch/acorn32/podulebus: podulebus.c src/sys/arch/alpha/pci: tsreg.h src/sys/arch/amiga/amiga: locore.s src/sys/arch/arm/omap: am335x_prcm.c src/sys/arch/atari/atari: locore.s src/sys/arch/cesfic/cesfic: locore.s src/sys/arch/hp300/hp300: locore.s src/sys/arch/luna68k/luna68k: locore.s src/sys/arch/mac68k/mac68k: locore.s src/sys/arch/mvme68k/mvme68k: locore.s src/sys/arch/news68k/news68k: locore.s src/sys/arch/next68k/next68k: locore.s src/sys/arch/x68k/x68k: locore.s src/sys/dev/i2o: i2o.h src/sys/dev/ic: cd1190reg.h Log Message: s/identifing/identifying/ and s/multipler/multiplier/ in comments. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/acorn32/podulebus/podulebus.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/alpha/pci/tsreg.h cvs rdiff -u -r1.160 -r1.161 src/sys/arch/amiga/amiga/locore.s cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/omap/am335x_prcm.c cvs rdiff -u -r1.115 -r1.116 src/sys/arch/atari/atari/locore.s cvs rdiff -u -r1.33 -r1.34 src/sys/arch/cesfic/cesfic/locore.s cvs rdiff -u -r1.172 -r1.173 src/sys/arch/hp300/hp300/locore.s cvs rdiff -u -r1.66 -r1.67 src/sys/arch/luna68k/luna68k/locore.s cvs rdiff -u -r1.174 -r1.175 src/sys/arch/mac68k/mac68k/locore.s cvs rdiff -u -r1.117 -r1.118 src/sys/arch/mvme68k/mvme68k/locore.s cvs rdiff -u -r1.67 -r1.68 src/sys/arch/news68k/news68k/locore.s cvs rdiff -u -r1.67 -r1.68 src/sys/arch/next68k/next68k/locore.s cvs rdiff -u -r1.120 -r1.121 src/sys/arch/x68k/x68k/locore.s cvs rdiff -u -r1.16 -r1.17 src/sys/dev/i2o/i2o.h cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/cd1190reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/acorn32/podulebus/podulebus.c diff -u src/sys/arch/acorn32/podulebus/podulebus.c:1.33 src/sys/arch/acorn32/podulebus/podulebus.c:1.34 --- src/sys/arch/acorn32/podulebus/podulebus.c:1.33 Sat Sep 11 20:28:03 2021 +++ src/sys/arch/acorn32/podulebus/podulebus.c Mon May 30 09:56:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: podulebus.c,v 1.33 2021/09/11 20:28:03 andvar Exp $ */ +/* $NetBSD: podulebus.c,v 1.34 2022/05/30 09:56:02 andvar Exp $ */ /* * Copyright (c) 1994-1996 Mark Brinicombe. @@ -43,7 +43,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: podulebus.c,v 1.33 2021/09/11 20:28:03 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: podulebus.c,v 1.34 2022/05/30 09:56:02 andvar Exp $"); #include #include @@ -399,7 +399,7 @@ podulescan(device_t dev) * Attach podulebus. * This probes all the podules and sets up the podules array with * information found in the podule headers. - * After identifing all the podules, all the children of the podulebus + * After identifying all the podules, all the children of the podulebus * are probed and attached. */ Index: src/sys/arch/alpha/pci/tsreg.h diff -u src/sys/arch/alpha/pci/tsreg.h:1.10 src/sys/arch/alpha/pci/tsreg.h:1.11 --- src/sys/arch/alpha/pci/tsreg.h:1.10 Sat Jul 17 23:53:02 2021 +++ src/sys/arch/alpha/pci/tsreg.h Mon May 30 09:56:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tsreg.h,v 1.10 2021/07/17 23:53:02 thorpej Exp $ */ +/* $NetBSD: tsreg.h,v 1.11 2022/05/30 09:56:02 andvar Exp $ */ /*- * Copyright (c) 1999 by Ross Harvey. All rights reserved. @@ -198,7 +198,7 @@ #define PCTL_REV __BITS(24,31) /* Pchip revision */ #define PCTL_CRQMAX __BITS(32,35) /* see manual */ #define PCTL_PTPMAX __BITS(36,39) /* see manual */ -#define PCTL_PCLKX __BITS(40,41) /* PCI clock freq multipler */ +#define PCTL_PCLKX __BITS(40,41) /* PCI clock freq multiplier */ #define PCTL_FDSDIS __BIT(42) /* fast DMA start and SGTE disable */ #define PCTL_FDWDIS __BIT(43) /* fast DMA read cache block disable */ #define PCTL_PTEVRFY __BIT(44) /* PTE verify for DMA read */ Index: src/sys/arch/amiga/amiga/locore.s diff -u src/sys/arch/amiga/amiga/locore.s:1.160 src/sys/arch/amiga/amiga/locore.s:1.161 --- src/sys/arch/amiga/amiga/locore.s:1.160 Wed Mar 16 20:31:01 2022 +++ src/sys/arch/amiga/amiga/locore.s Mon May 30 09:56:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.160 2022/03/16 20:31:01 andvar Exp $ */ +/* $NetBSD: locore.s,v 1.161 2022/05/30 09:56:02 andvar Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -695,7 +695,7 @@ ENTRY_NOPROFILE(lev7intr) * (profiling, scheduling) and software interrupts (network, softclock). * We check for ASTs first, just like the VAX. To avoid excess overhead * the T_ASTFLT handling code will also check for software interrupts so we - * do not have to do it here. After identifing that we need an AST we + * do not have to do it here. After identifying that we need an AST we * drop the IPL to allow device interrupts. * * This code is complicated by the fact that sendsig may have been called
CVS commit: src/sys
Module Name:src Committed By: andvar Date: Mon May 30 09:56:04 UTC 2022 Modified Files: src/sys/arch/acorn32/podulebus: podulebus.c src/sys/arch/alpha/pci: tsreg.h src/sys/arch/amiga/amiga: locore.s src/sys/arch/arm/omap: am335x_prcm.c src/sys/arch/atari/atari: locore.s src/sys/arch/cesfic/cesfic: locore.s src/sys/arch/hp300/hp300: locore.s src/sys/arch/luna68k/luna68k: locore.s src/sys/arch/mac68k/mac68k: locore.s src/sys/arch/mvme68k/mvme68k: locore.s src/sys/arch/news68k/news68k: locore.s src/sys/arch/next68k/next68k: locore.s src/sys/arch/x68k/x68k: locore.s src/sys/dev/i2o: i2o.h src/sys/dev/ic: cd1190reg.h Log Message: s/identifing/identifying/ and s/multipler/multiplier/ in comments. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/acorn32/podulebus/podulebus.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/alpha/pci/tsreg.h cvs rdiff -u -r1.160 -r1.161 src/sys/arch/amiga/amiga/locore.s cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/omap/am335x_prcm.c cvs rdiff -u -r1.115 -r1.116 src/sys/arch/atari/atari/locore.s cvs rdiff -u -r1.33 -r1.34 src/sys/arch/cesfic/cesfic/locore.s cvs rdiff -u -r1.172 -r1.173 src/sys/arch/hp300/hp300/locore.s cvs rdiff -u -r1.66 -r1.67 src/sys/arch/luna68k/luna68k/locore.s cvs rdiff -u -r1.174 -r1.175 src/sys/arch/mac68k/mac68k/locore.s cvs rdiff -u -r1.117 -r1.118 src/sys/arch/mvme68k/mvme68k/locore.s cvs rdiff -u -r1.67 -r1.68 src/sys/arch/news68k/news68k/locore.s cvs rdiff -u -r1.67 -r1.68 src/sys/arch/next68k/next68k/locore.s cvs rdiff -u -r1.120 -r1.121 src/sys/arch/x68k/x68k/locore.s cvs rdiff -u -r1.16 -r1.17 src/sys/dev/i2o/i2o.h cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/cd1190reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon May 30 08:51:08 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_168.c Log Message: tests/lint: explain how lint represents pointer addition To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_168.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/usr.bin/xlint/lint1/msg_168.c diff -u src/tests/usr.bin/xlint/lint1/msg_168.c:1.7 src/tests/usr.bin/xlint/lint1/msg_168.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_168.c:1.7 Mon May 30 08:14:53 2022 +++ src/tests/usr.bin/xlint/lint1/msg_168.c Mon May 30 08:51:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_168.c,v 1.7 2022/05/30 08:14:53 rillig Exp $ */ +/* $NetBSD: msg_168.c,v 1.8 2022/05/30 08:51:08 rillig Exp $ */ # 3 "msg_168.c" // Test for message: array subscript cannot be > %d: %ld [168] @@ -42,6 +42,29 @@ array_with_c99_initializer(void) } +/* + * In its expression tree, lint represents pointer addition as 'ptr + off', + * where 'off' is the offset in bytes, regardless of the pointer type. + * + * In the below code, the member 'offset_8' has type 'short', and the + * expression 's->offset_8' is represented as ' + 8', or more verbose: + * + * '+' type 'pointer to short' + * '&' type 'pointer to struct s' + * 'name' 's' with auto 'array[1] of struct s', lvalue + * 'constant' type 'long', value 8 + * + * The constant 8 differs from the usual model of pointer arithmetics. Since + * the type of the '&' expression is 'pointer to struct s', adding a constant + * would rather be interpreted as adding 'constant * sizeof(struct s)', and + * to access a member, the pointer to 'struct s' would need to be converted + * to 'pointer of byte' first, then adding the offset 8, then converting the + * pointer to the target type 'pointer to short'. + * + * Lint uses the simpler representation, saving a few conversions on the way. + * Without this pre-multiplied representation, the below code would generate + * warnings about out-of-bounds array access, starting with offset_1. + */ struct s { char offset_0; char offset_1;
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon May 30 08:51:08 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_168.c Log Message: tests/lint: explain how lint represents pointer addition To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_168.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: Mon May 30 08:14:53 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_168.c msg_168.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: revert 'do not pre-multiply pointer expressions' from 2022-05-26 In tree.c 1.448, removing the pre-multiplication generated wrong warnings about out-of-bounds array access. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_168.c \ src/tests/usr.bin/xlint/lint1/msg_168.exp cvs rdiff -u -r1.451 -r1.452 src/usr.bin/xlint/lint1/tree.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/usr.bin/xlint/lint1/msg_168.c diff -u src/tests/usr.bin/xlint/lint1/msg_168.c:1.6 src/tests/usr.bin/xlint/lint1/msg_168.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_168.c:1.6 Mon May 30 08:04:00 2022 +++ src/tests/usr.bin/xlint/lint1/msg_168.c Mon May 30 08:14:53 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_168.c,v 1.6 2022/05/30 08:04:00 rillig Exp $ */ +/* $NetBSD: msg_168.c,v 1.7 2022/05/30 08:14:53 rillig Exp $ */ # 3 "msg_168.c" // Test for message: array subscript cannot be > %d: %ld [168] @@ -55,13 +55,9 @@ s_init(void) { struct s s[1]; s->offset_0 = 1; - /* expect+1: warning: array subscript cannot be > 0: 1 [168] */ s->offset_1 = 2; - /* expect+1: warning: array subscript cannot be > 0: 4 [168] */ s->offset_4 = 3; - /* expect+1: warning: array subscript cannot be > 0: 8 [168] */ s->offset_8 = 4; - /* expect+1: warning: array subscript cannot be > 0: 10 [168] */ s->offset_10 = 5; return s[0]; } Index: src/tests/usr.bin/xlint/lint1/msg_168.exp diff -u src/tests/usr.bin/xlint/lint1/msg_168.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_168.exp:1.7 --- src/tests/usr.bin/xlint/lint1/msg_168.exp:1.6 Mon May 30 08:04:00 2022 +++ src/tests/usr.bin/xlint/lint1/msg_168.exp Mon May 30 08:14:53 2022 @@ -1,6 +1,2 @@ msg_168.c(28): warning: array subscript cannot be > 19: 20 [168] msg_168.c(41): warning: array subscript cannot be > 57: 58 [168] -msg_168.c(59): warning: array subscript cannot be > 0: 1 [168] -msg_168.c(61): warning: array subscript cannot be > 0: 4 [168] -msg_168.c(63): warning: array subscript cannot be > 0: 8 [168] -msg_168.c(65): warning: array subscript cannot be > 0: 10 [168] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.451 src/usr.bin/xlint/lint1/tree.c:1.452 --- src/usr.bin/xlint/lint1/tree.c:1.451 Mon May 30 07:19:28 2022 +++ src/usr.bin/xlint/lint1/tree.c Mon May 30 08:14:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.451 2022/05/30 07:19:28 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.452 2022/05/30 08:14:52 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.451 2022/05/30 07:19:28 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.452 2022/05/30 08:14:52 rillig Exp $"); #endif #include @@ -3152,7 +3152,12 @@ build_plus_minus(op_t op, bool sys, tnod tnode_t *elsz = subt_size_in_bytes(ln->tn_type); if (rn->tn_type->t_tspec != elsz->tn_type->t_tspec) rn = convert(NOOP, 0, elsz->tn_type, rn); - return new_tnode(op, sys, ln->tn_type, ln, rn); + + tnode_t *prod = new_tnode(MULT, sys, rn->tn_type, rn, elsz); + if (rn->tn_op == CON) + prod = fold(prod); + + return new_tnode(op, sys, ln->tn_type, ln, prod); } /* pointer - pointer */ @@ -3161,10 +3166,14 @@ build_plus_minus(op_t op, bool sys, tnod lint_assert(op == MINUS); type_t *ptrdiff = gettyp(PTRDIFF_TSPEC); - tnode_t *diff = new_tnode(MINUS, sys, ptrdiff, ln, rn); + tnode_t *raw_diff = new_tnode(op, sys, ptrdiff, ln, rn); if (ln->tn_op == CON && rn->tn_op == CON) - diff = fold(diff); - return diff; + raw_diff = fold(raw_diff); + + tnode_t *elsz = subt_size_in_bytes(ln->tn_type); + balance(NOOP, _diff, ); + + return new_tnode(DIV, sys, ptrdiff, raw_diff, elsz); } return new_tnode(op, sys, ln->tn_type, ln, rn); @@ -4432,8 +4441,13 @@ check_expr_misc(const tnode_t *tn, bool static void check_array_index(tnode_t *tn, bool amper) { - tnode_t *ln = tn->tn_left; - tnode_t *rn = tn->tn_right; + int dim; + tnode_t *ln, *rn; + int elsz; + int64_t con; + + ln = tn->tn_left; + rn = tn->tn_right; /* We can only check constant indices. */ if (rn->tn_op != CON) @@ -4454,8 +4468,19 @@ check_array_index(tnode_t *tn, bool ampe if (is_incomplete(ln->tn_left->tn_type) && rn->tn_val->v_quad >= 0) return; - int64_t con = rn->tn_val->v_quad; - int dim = ln->tn_left->tn_type->t_dim + (amper ? 1 : 0); + /* Get the size of one array element */ + if ((elsz = length_in_bits(ln->tn_type->t_subt, NULL)) == 0) + return; + elsz /= CHAR_SIZE; + + /* Change the unit of the index from bytes to element size. */ + if (is_uinteger(rn->tn_type->t_tspec)) { + con = (uint64_t)rn->tn_val->v_quad / elsz; + } else { + con =
CVS commit: src
Module Name:src Committed By: rillig Date: Mon May 30 08:14:53 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_168.c msg_168.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: revert 'do not pre-multiply pointer expressions' from 2022-05-26 In tree.c 1.448, removing the pre-multiplication generated wrong warnings about out-of-bounds array access. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_168.c \ src/tests/usr.bin/xlint/lint1/msg_168.exp cvs rdiff -u -r1.451 -r1.452 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon May 30 08:04:00 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_168.c msg_168.exp Log Message: tests/lint: demonstrate wrong warning 'array subscript cannot be' Since tree.c 1.448 from 2022-05-26. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_168.c \ src/tests/usr.bin/xlint/lint1/msg_168.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon May 30 08:04:00 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_168.c msg_168.exp Log Message: tests/lint: demonstrate wrong warning 'array subscript cannot be' Since tree.c 1.448 from 2022-05-26. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_168.c \ src/tests/usr.bin/xlint/lint1/msg_168.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_168.c diff -u src/tests/usr.bin/xlint/lint1/msg_168.c:1.5 src/tests/usr.bin/xlint/lint1/msg_168.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_168.c:1.5 Thu Mar 25 22:53:05 2021 +++ src/tests/usr.bin/xlint/lint1/msg_168.c Mon May 30 08:04:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_168.c,v 1.5 2021/03/25 22:53:05 rillig Exp $ */ +/* $NetBSD: msg_168.c,v 1.6 2022/05/30 08:04:00 rillig Exp $ */ # 3 "msg_168.c" // Test for message: array subscript cannot be > %d: %ld [168] @@ -40,3 +40,28 @@ array_with_c99_initializer(void) print_string(to_roman['9']); print_string(to_roman[':']); /* expect: 168 */ } + + +struct s { + char offset_0; + char offset_1; + int offset_4; + short offset_8; + char offset_10; +}; + +struct s +s_init(void) +{ + struct s s[1]; + s->offset_0 = 1; + /* expect+1: warning: array subscript cannot be > 0: 1 [168] */ + s->offset_1 = 2; + /* expect+1: warning: array subscript cannot be > 0: 4 [168] */ + s->offset_4 = 3; + /* expect+1: warning: array subscript cannot be > 0: 8 [168] */ + s->offset_8 = 4; + /* expect+1: warning: array subscript cannot be > 0: 10 [168] */ + s->offset_10 = 5; + return s[0]; +} Index: src/tests/usr.bin/xlint/lint1/msg_168.exp diff -u src/tests/usr.bin/xlint/lint1/msg_168.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_168.exp:1.6 --- src/tests/usr.bin/xlint/lint1/msg_168.exp:1.5 Thu Mar 25 22:53:05 2021 +++ src/tests/usr.bin/xlint/lint1/msg_168.exp Mon May 30 08:04:00 2022 @@ -1,2 +1,6 @@ msg_168.c(28): warning: array subscript cannot be > 19: 20 [168] msg_168.c(41): warning: array subscript cannot be > 57: 58 [168] +msg_168.c(59): warning: array subscript cannot be > 0: 1 [168] +msg_168.c(61): warning: array subscript cannot be > 0: 4 [168] +msg_168.c(63): warning: array subscript cannot be > 0: 8 [168] +msg_168.c(65): warning: array subscript cannot be > 0: 10 [168]
CVS commit: src
Module Name:src Committed By: rillig Date: Mon May 30 07:19:28 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: fix assertion failure in '(unsigned long)(ptr) >> 12' Since tree.c 1.449 from 2022-05-26. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/msg_132.exp cvs rdiff -u -r1.450 -r1.451 src/usr.bin/xlint/lint1/tree.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/usr.bin/xlint/lint1/msg_132.c diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.15 src/tests/usr.bin/xlint/lint1/msg_132.c:1.16 --- src/tests/usr.bin/xlint/lint1/msg_132.c:1.15 Sun May 29 23:24:09 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.c Mon May 30 07:19:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_132.c,v 1.15 2022/05/29 23:24:09 rillig Exp $ */ +/* $NetBSD: msg_132.c,v 1.16 2022/05/30 07:19:28 rillig Exp $ */ # 3 "msg_132.c" // Test for message: conversion from '%s' to '%s' may lose accuracy [132] @@ -214,3 +214,11 @@ test_bit_fields(struct bit_fields s, uns /* expect+1: warning: conversion from 'unsigned long' to 'unsigned char' may lose accuracy [132] */ return s.bits_32 & m; } + + +unsigned int +convert_pointer_to_smaller_integer(void *ptr) +{ + /* expect+1: warning: conversion from 'unsigned long' to 'unsigned int' may lose accuracy [132] */ + return (unsigned long)(ptr) >> 12; +} Index: src/tests/usr.bin/xlint/lint1/msg_132.exp diff -u src/tests/usr.bin/xlint/lint1/msg_132.exp:1.14 src/tests/usr.bin/xlint/lint1/msg_132.exp:1.15 --- src/tests/usr.bin/xlint/lint1/msg_132.exp:1.14 Sun May 29 23:24:09 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.exp Mon May 30 07:19:28 2022 @@ -29,3 +29,4 @@ msg_132.c(193): warning: conversion from msg_132.c(195): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] msg_132.c(209): warning: conversion from 'unsigned long' to 'unsigned int' may lose accuracy [132] msg_132.c(215): warning: conversion from 'unsigned long' to 'unsigned char' may lose accuracy [132] +msg_132.c(223): warning: conversion from 'unsigned long' to 'unsigned int' may lose accuracy [132] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.450 src/usr.bin/xlint/lint1/tree.c:1.451 --- src/usr.bin/xlint/lint1/tree.c:1.450 Sun May 29 23:24:09 2022 +++ src/usr.bin/xlint/lint1/tree.c Mon May 30 07:19:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.450 2022/05/29 23:24:09 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.451 2022/05/30 07:19:28 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.450 2022/05/29 23:24:09 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.451 2022/05/30 07:19:28 rillig Exp $"); #endif #include @@ -255,10 +255,14 @@ ic_expr(const tnode_t *tn) { integer_constraints lc, rc; + lint_assert(is_integer(tn->tn_type->t_tspec)); + switch (tn->tn_op) { case CON: return ic_con(tn->tn_type, tn->tn_val); case CVT: + if (!is_integer(tn->tn_left->tn_type->t_tspec)) + return ic_any(tn->tn_type); lc = ic_expr(tn->tn_left); return ic_cvt(tn->tn_type, tn->tn_left->tn_type, lc); case SHL:
CVS commit: src
Module Name:src Committed By: rillig Date: Mon May 30 07:19:28 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: fix assertion failure in '(unsigned long)(ptr) >> 12' Since tree.c 1.449 from 2022-05-26. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/msg_132.exp cvs rdiff -u -r1.450 -r1.451 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.