a "bootinfo" structure for us. Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments. So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:
- Support specifying the root device in the forms "root=/dev/wd0a",
"root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD". In the case of
Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
perform an auto-boot.
Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
It's not the primary task of make to handle procedure calls with
parameters, combined with lexical scoping, therefore the code does not
look as straight-forward or clean as in other programming languages. It
feels more like squeezing a programming problem from the imperative
world into the world of declarative dependencies.
A more idiomatic way of implementing this puzzle should be as a
dependency graph since that's both the natural structure of the puzzle
and the primary domain of make. Something like having a main target
"hanoi-5" that depends on intermediate targets of the form
"move-1.2.3.4.5-_._._._._-_._._._._", each representing a single
configuration of the stacks. These targets could be generated
dynamically. A benefit of this implementation would be that the puzzle
could be resumed from an arbitrary configuration, just just from the
initial configuration.
This is only intended for the unit tests, to selectively enable and
disable debug logging as needed. Previously the tests for debug logging
required complicated postprocessing that was not obvious when looking at
the test .mk file alone, but was specified externally in
unit-tests/Makefile.
This is the simplest possible implementation. Another variant would
have been to selectively disable individual debug logging options, but
that would have made the code more complicated.
The -dL option is not affected by -d0 since that is not really a debug
option, even if it is implemented as one.
The expression ${VAR:LPL} must now be written as ${VAR:L:P:L}. The
manual page has never documented that some modifiers don't need to be
delimited by ':' and others need to. That would have been unnecessarily
confusing anyway.
Previously, assigning the string "-env" to the variable .MAKE.EXPORTED
had the same effect as the .export-env directive. This was only due to
a sloppy implementation, not by design.
For the string "-literal" and the directive .export-literal, the
situation was even worse since the actually executed code was a wild
mixture between .export and .export-literal that in the end exported the
expanded form of the variable. Therefore there was no practical use
case of this implementation flaw.
By convention, names of environment variables consist of uppercase
letters and underscores. Most of them start with an uppercase letter.
In a few cases, the names also contain lowercase letters, such as in
http_proxy.
Variable names starting with a hyphen are confusing and might be
mistaken as command line options. Therefore don't export these.
This also affects a few edge cases that don't occur in practice, such as
setting .MAKE.EXPORTED=-env or .MAKE.EXPORTED=-literal. These had not
worked as expected anyway.
As long as there are less than 20 open directories, it's perfectly fine
to use a doubly-linked list for name lookup. A singly linked list or
even an array list would have been better, but anyway.
When the number of directories rises above 1000, which happens with
dirdeps.mk, linear list lookup becomes too expensive, especially since
each list entry is compared using a strcmp call, in a callback function
that is not inlined.
Using a hash table is much more efficient than linear lookup. While
here, abstract all operations regarding the openDirectories list into a
new data type that provides a simple and straight-forward API. This
strongly typed API is especially important since the current
implementation of the list and hash table is weakly typed, using void *
for the actual data, and StringList and CachedDirList refer to the
exactly same type, they just have different names to help the human
readers but don't provide any type safety.
Before, the parsing position was updated once at the beginning, which
didn't make sense. Updating it in each branch allows to decide for its
appropriate value in each branch individually.
Cherry-pick and adapt:
From 2a9ce60de98e53198047daaeeec3cf09ece4e693 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <n54@gmx.com>
Date: Fri, 2 Oct 2020 16:13:09 +0200
Subject: [PATCH] [compiler-rt] [netbsd] Improve the portability of
ThreadSelfTlsTcb
Use __lwp_gettcb_fast() and __lwp_getprivate_fast(), as _lwp_getprivate()
can be a biased pointer and invalid for use in this function on all CPUs.