lint: remove temporary code to identify floating point bug
On sparc64, SoftFloat 2a invoked undefined behavior, returning wrong
results. The code added here didn't trigger, as the ATF_SH environment
variable was not set in the real test run.
See tests/lib/libc/t_long_double.c for more specialized tests to
pinpoint the exact problem.
tests/libc: clean up test for long double
Previously, the test had invoked undefined behavior when converting long
double to uint64_t, by using input values outside the portable range.
Explicitly mark this part of the test and make it easy to disable.
Add a machine_init_common() routine that will be the holding tank
for common tasks across m68k machine_init() routines. For now, it
only initializes the message buffer, and only on the seglist.h-using
platforms (mvme68k, next68k, virt68k).
Note that there will be some minor code duplication (as dead code)
as the various platforms make the transition to using this new routine,
but that seems preferable to large unweildy diffs across multiple platforms.
Centralize the declaration of msgbufpa. Not all m68k platforms use this,
but it's part of forthcoming unification changes, and does no harm in
the meantime.
As part of this, a hook for Sun platforms (__HAVE_M68K_PRIVATE_MSGSBUF)
is provided to handle the scenario somewhat unique to Sun2, but where
the pattern is also present in Sun3/Sun3x -- On Sun2, PROM mappings of
4 (2K) pages are used for the message buffer, and there is technically
no guarantee that those pages will be physically contiguous. Instead,
the existing PageMap entries are fixed up during VM bootstrap to ensure
that the permissions are correct, but the existing VA->PA mappings
remain.
This PageMap treatment is also done on Sun3, although since the Sun3
page size is 8K, only one page is used. Similarly, on Sun3x, we just
use the first physical (8K) page and create our own mapping for it.
However, it's easiest just to treat all the Sun platforms the same
and embrace the lovable little oddballs that they are.
More catch-up with other m68k platforms:
- pmap_bootstrap() -> pmap_bootstrap1()
- Pass the updated "nextpa" to machine_init(), and use it to calculate
avail_start and avail_end there, rather than in pmap_bootstrap1().
libc: fix undefined behavior in int64_to_float128
When negating a signed integer, the integer must not be LLONG_MIN, as
negating that value would not change the sign. GCC's -ftrapv mode
detects cases like this reliably.
In this case, on sparc64 with -O2 (but not -O0 or -O1),
countLeadingZeros64(LLONG_MIN) returned 48 instead of the desired 0, and
int64_to_float128(LLONG_MIN) returned -0x1p+14 instead of the desired
-0x1p+63.
The same pattern is used in several other conversion functions. These
will be fixed in a follow-up commit once the lint tests for msg_380 and
msg_381 on sparc64 work again.
Align loading of physical memory with virt68k, and stop keeping two
copies of this information (one in the phys_seg_list[] and one in
mem_clusters[]; the latter is now gone).
Use the data structure from <m68k/seglist.h> to describe the memory
configuration extracted from linux bootinfo. Align virt68k's memory
loading with mvme68k (which will also get some changes in a follow-on
commit). This will be used as a template to eventually merge this
code for all m68k platforms.