Change the trampoline in bootloaders to avoid overwriting msgbuf.
- Previously, both primary and secondary bootloaders used the same
common/exec_image.S to trampoline to the next stage. And the trampoline
routine and the stack was written to the end of phisical page.
There is the msgbuf there!
- To avoid this, I split exec_image into one for the primary and one for the
secondary.
- The primary loaders continue to use common/exec_image.S. However, the
new exec_image.S doesn't include a trampoline. Because all primary
loaders already load the secondary loader into its final position.
This change prevents the primary loaders break msgbuf.
- The secondary loader has a new exec_image2 routine derived from
common/exec_image. This one has a trampoline as before, but the trampoline
and the stack are placed at the next page of the loaded kernel.
This change prevents the secondary loader breaks msgbuf.
libc/time/localtime.c - fix bad tm_wday calc from TZ=<tzstring>
Simplified version of a patch supplied on the tz list, apparently
from FreeBSD, to correct overflow problems introduced by other
recent changes to the way the values are computed.
When using a TZ setting like TZ=UTC0UTC (where specifying the DST
abbreviation is important), and when time_t is 64 bits, the value
calculated for the tm_wday field of struct tm would underflow, and
be truncated when assigned to that int var, before it was reduced
modulo 7 (days/week) - the 64->32 bit truncation modified the
value incorrectly.
sun60i_a733_r_ccu.c ... attempt to fix clang build.
Correct what looks to be a cut&paste & forget to edit bug, which
looks to be preventing this building using clang, and might easily
be generating bad (unintended) results from gcc builds.
Feel free to revert if this was a bad assumption.
fss(4): Fix leak introduced in recent refactoring of configure path.
Add comments explaining what ownership we are transferring in each
path (FSS_PERSISTENT vs !FSS_PERSISTENT), since it's not obvious and
looks like either one is missing a vrele or the other has an extra
vrele.
PR kern/60986: fssconfig panics on bad backing store type
sbin/dmesg/dmesg.c - fix SMALL build
Most of the code for the new -c/-C options was excluded when doing a SMALL
build, but not all of it. Make it all vanish in SMALL mode.
Also, fix the clearbuf() func decl to properly match the prototype.
And, just for fun (and I can't realistically test this) make it possible
to build if the KERN_MSGBUFCLR isn't available from the relevant header
file (updated one not installed, or whatever). If that ever happens,
any attempt to clear the msgbuf will simply error exit.
- Always track our lev1pa and only set the %urp if it's actually changed,
thus saving a user ATC invalidation if we switch back to the same
pmap. Instrumentation shows this happens about 50% of the time during
an ATF run.
- Loosen some overly strict KASSERT-ions that fired during an ATF run,
but put assertions around *those* edge cases.
- Track if an ATC invalidation was due to an "enter", a "remove",
a "protection", or a "cache status change".
- In pmap_remove_all(), we can use the regular pmap garbage-collection
scheme, because uvmspace_exec() follows the pmap_remove_all() call
with a pmap_update() call.
- In pmap_destroy(), perform a pmap_update() before actually destroying
the pmap when the last reference is dropped. This is because
uvmspace_free() calls pmap_remove_all() without following with a
pmap_update(). This is a perfectly reasonable optimization for
uvmspace_free() to do, but yah, we need to take care of it ourselves.
dmesg: Add function to clear the dmesg buffer for debugging purpose
- Add new sysctl "kern.msgbuf_clear" to clear the buffer. Same as FreeBSD.
- Add -C and -c option to dmesg. It clears the dmesg buffer.
-C Clear the dmesg buffer. Same as Linux
-c Print the dmesg buffer and then clear it. Same as Linux and FreeBSD
First written by hikaru@ and modified by me.
/bin/sh -- ${@:-stuff} expansion fix
This comes from the issue described in
https://mail-index.netbsd.org/pkgsrc-users/2026/11/19/msg043805.html
where pkgsrc/sysutils/sysupgrade was shown to behave differently
when using different shells to execute it.
The relevant code line is:
for set_name in "${@:-$(shtk_config_get SETS)}"; do
which intends to use "$@" (command line args, I think) if any are set, and the
results from:
shtk_config_get SETS
otherwise - intending that those results would be split into separate args.
There are a number of issues with this .. first the "${@:-...}" (and $* instead
[67 lines not shown]
tests/bin/sh/t_expand ... add test cases for ${@-word} (etc)
This usage (using the + - (also ? =) modifiers in parameter
expansions when the special parameter '@' (or '*') is being
expanded, is expressly left unspecified in the standard, and
applications should not attempt it - as different shells
produce different results.
Hence these new test case only run their sub-tests when the
shell being tested is the NetBSD shell - and are to verify
that that shell continues to produce sane (in our opinion)
results from these unspecified expansions, even if that might,
in some (or many) cases differ from what other shells do.
There are something around 350 new sub tests added (initially)
across the 4 new test cases -- those being to test the 4
major variations: "${@:-word}" "${@-word}" ${@:-word} ${@-word}
Each test case tests both the - and + operator. Note that it
is whether the $@ is quoted or not that matters, not whether
[13 lines not shown]
/bin/sh - minor DEBUG mode extension
This is a DEBUG mode only change, it does not affect any
shell built normally (nothing built by the NetBSD build
machinery) in any way -- the whole file being changed is
effectively #ifdef DEBUG and (in sh builds) DEBUG is
never defined (except by me, and perhaps, one day, someone
else.)
This adds a (trivial) mechanism to allow sh debug mode trace
files to be placed in some other directory than "." -- mostly
so it is possible to run a DEBUG compiled shell with debug
enabled while running ATF tests, without the trace file being
removed ("cleaned up") by ATF as soon as the test finishes.
NFC for any normal shell. Definitely no pullups.
/bin/sh - source code maintenance
KNF (including kreNF and 80-col police).
One grammar fix in a comment.
Some small DEBUG mode enhancements (more info dumped),
NFC for any normal shell. Definitely no pullups.
tests/bin/sh/t_expand.sh - minor cleanups (NMFC)
These changes make several minor changes to the layout
of the source file, more than anything else.
There are 3 kinds of changes (repeated throughout)
1. Use ' quoting rather than " quoting for the strings
used as the value of the ATF descr variable for each
test. This allows $ and " to be used in those strings
without requiring \ escaping, making them easier to read.
Also, drop meaningless leading/trailing spaces in these
strings, they don't use C string concat, which simply abuts
the contents of the strings, but more like sh "$*" which
puts spaces between the strings when joined into one.
2. Consistently write multi-line sh function definitions as
func_name()
{
[23 lines not shown]
src/tests/bin/sh - add a source code maintenance script
The sh tests contain many sets of tests which, when one fails, reports the
number of the test which failed (along with symptoms, actual code, ...) as
part of the failure log. Those numbers match numbers inserted as comments
with the tests, to allow the actual test to be more easily found (there tend
to be many which differ in just small details, hunting for the correct code
can be time consuming and error prone).
Until now, keeping those (comment) numbers correct has been a manual process,
itself almost as likely to fail as any of the tests the numbers are intended
to help identify.
This script (which has a very limited scope, just the shell ATF test sources
- and not even all, or even a majority, of those) will create a modified
version of the source code with all the comment numbers corrected. That
can then be compared with the unmodified version, and if all looks good,
replace it.
[14 lines not shown]
imx_ccm: split the core from the FDT glue
Move the FDT parts to imx_ccm_fdt.c so the core can be used without
fdt. composite set_rate now returns ENXIO when the parent is not found.
Tested on QEMU mcimx7d-sabre.