Commit Graph

1700 Commits

Author SHA1 Message Date
andvar 62e7294679 fix typos, mainly s/comand/command/ 2022-01-05 16:01:54 +00:00
riastradh 57efa05d59 libkern: Make KASSERT verify expression is valid if !DIAGNOSTIC.
This way it is no longer necessary to mark variables __diagused if
they are used in KASSERT conditions.

Fix fallout from this by removing now-unnecessary and `#ifdef
DIAGNOSTIC'.

Don't do the same for KDASSERT if !DEBUG -- unlike KASSERT and
DIAGNOSTIC, variables needed by KDASSERT and DEBUG are likely to be
expensive to compute (and potentially difficult for a compiler to
prove flushable), so we don't want to require them under !DEBUG.
2021-12-31 14:19:57 +00:00
chs 3bb0445a32 revert rev 1.4 ("Add garbage instructions at end of kern_assert after vpanic.")
that change had no effect because vpanic() is marked __dead / noreturn
and thus the compiler would optimize away everything after a call to vpanic().
the original problem has now been fixed differently (but only for x86 so far).
2021-12-13 01:33:32 +00:00
thorpej d7b75e6eaa Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for SuperH for GBR, MACH, MACL, and SR.
2021-11-24 00:21:59 +00:00
thorpej 3c9111595d Revert unintended commit. 2021-11-22 16:41:32 +00:00
thorpej 4ee192103f Gah, fix two typos. 2021-11-22 16:41:00 +00:00
thorpej 241ca3464c Teach the LLVM-derived unwinder about the DWARF pseudo-register defined
by GCC for AArch64 to hold the return address where the signal trampoline
will resume.
2021-11-22 16:40:01 +00:00
thorpej a2dfa8a4c3 Teach the LLVM-derived unwinder about the alternate DWARF pseudo-register
that GCC defines for the PC / return address.  This is simply an alias for
the same internal PC register number.
2021-11-21 23:34:44 +00:00
thorpej 2944d33d0c Teach the LLVM-derived unwinder about the DWARF pseudo-register defined
by GCC for PPC32 to hold the return address where the signal trampoline
will resume, as well as for the CTR and XER registers.
2021-11-21 21:15:17 +00:00
skrll d7a401a8a2 Add parentheses 2021-11-21 10:53:01 +00:00
thorpej 834c26d8b1 Teach the LLVM-derived unwinder about the DWARF pseudo-register defined
by GCC for Alpha to hold the return address where the signal trampoline
will resume.
2021-11-20 19:06:21 +00:00
thorpej 9d3f86a921 - Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for MIPS64 to hold the MDHI and MDLO registers, as well as the return
  address where the signal trampoline will resume.
- In the MIPS64 validFloatVectorRegister(), compare against the internal
  register numbers, not the DWARF register numbers.
2021-11-20 18:19:18 +00:00
thorpej ec28cc6b78 - Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for MIPS to hold the MDHI and MDLO registers, as well as the return
  address where the signal trampoline will resume.  XXX Same treatment is
  needed for MIPS64, but not done as part of this commit.
- In the MIPS validFloatVectorRegister(), compare against the internal
  register numbers, not the DWARF register numbers.
2021-11-18 04:20:11 +00:00
ryo f989f9625c revert previous: http://mail-index.netbsd.org/source-changes/2021/10/25/msg133295.html
going to add __always_inline to the functions called from _mcount()
discussed on http://mail-index.netbsd.org/source-changes-d/2021/10/25/msg013480.html
2021-10-27 03:06:59 +00:00
ryo 843ce00650 In some arch, _mcount() would be called recursively when built with COPTS=-O0.
Normally, functions called from mcount.c are expected to be expanded inline,
so _mcount() will never be called recursively. But when build with COPTS=-O0,
`static inline' functions aren't inlined, and _mcount() will be called
recursively.

Even if _mcount() has `__attribute__((__no_ instrument_function__))',
it has no effect on the calling external (no-inlined) function.

To avoid this, PROF.<fn> is added can be set the profiling flag of any file.
"PROF.mcount.c" is set to blank by default, mcount.c itself is compiled
without -pg.
2021-10-25 07:54:44 +00:00
jmcneill e63dca36f8 Only define DEFAULT_TIMEOUT if it is not already defined. 2021-10-17 14:12:21 +00:00
nia b7fed38c88 Remove banner printing code from bootloaders, add it to libsa.
This harmonizes efiboot and the various x86 bootloaders to use shared
code for printing the banner. By friendly coincidence, it also adds
support for specifying 'banner=' in arm efiboot's boot.cfg, as on x86.
2021-09-07 11:41:31 +00:00
andvar 2e0bf311b3 fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected. 2021-08-17 22:00:26 +00:00
andvar 272cac88dd s/aligment/alignment/ + one more typo fix in comments. 2021-08-09 21:08:06 +00:00
andvar d7fca1ab3d fix typos in asymmetry, asymmetric(al), symmetrical. 2021-08-09 19:57:57 +00:00
rin 76020b2c7d Improve previous:
- Add suffix ``d'' for mkdep(1).
- Improve comment a little...
2021-07-26 12:49:13 +00:00
rin 735b96eca6 For evbppc, use C version of memcpy(3), memcmp(3), and memmove(3)
consistently for *.{po,pico,go} (for RUMP), in order to avoid
alignment faults for 403.
2021-07-24 05:29:26 +00:00
rin 749cec1f31 PR port-arm/55897
Fix ABI mismatch for armhf runtime routines for floating-point arithmetics;
For hard-float arm variants, provide

(1) generic runtime routines with correct calling convention, and
(2) EABI runtime routines at the same time.

I've confirmed that no binary changes for kernels.

LGTM by skrll
2021-06-16 05:21:08 +00:00
rin 679d0566e4 PR toolchain/55837
Stop using enum for flags, as per request from joerg.

#define constants and #undef after use.
2021-05-31 21:31:33 +00:00
rin be367f2780 PR toolchain/55837
Bump LAST_REGISTER and LAST_RESTORE_REG to REGNO_ARM32_S31 for arm.

There are two numbering schemes for VFPv2 registers: s0-s31 and d0-d15.
The former is used by GCC, and the latter is by LLVM. Since libunwind was
derived from LLVM, it has never supported the former. This results in
crashes for GCC-compiled binaries in exception handler of C++, if it
encounters VFPv2 registers when unwinding frames.

This commit adds support for s0-s31 numbering to libunwind. I choose an
implementation in which VFPv2 registers are ``double-counted'' as s0-s31
AND d0-d15. This does not cause real problems, since the former is only
used by GCC, and the later is by LLVM. That is, different numbering
schemes cannot appear in a same frame. To make sure, assertions are added
in order to check this.

I've confirmed that no regression for ATF both for GCC- and LLVM-compiled
userlands.
2021-05-31 12:12:24 +00:00
rin 59bb4ebecd PR toolchain/55837
Fix logic error in copyFloatVectorRegister() for arm; copy s0-s31 or
d0-d31, not both.
2021-05-31 11:57:28 +00:00
rin 6048a3f308 PR toolchain/55837
Fix pointer arithmetic when copying s0-s31 registers for arm.
2021-05-31 11:54:01 +00:00
rin f8fd5b9f7e PR toolchain/55837
Fix DWARF/internal register numbers of s31 for arm.
2021-05-31 11:50:43 +00:00
rin 3c4340442b PR toolchain/55837
Fix for jumpto() armeb; use word-wise load for flags, instead of byte-wise one.
2021-05-31 11:47:18 +00:00
rin 07d38a85f2 PR toolchain/55837
copyFloatVectorRegister(): Assert register number is valid to make sure.
2021-05-31 11:44:06 +00:00
rin 737353f511 PR toolchain/55837
Misc style fixes for clarity:

- Rename lazyVFP1() and lazyVFP3() to lazyVFPv2() and lazyVFPv3(),
  respectively. Note that VFPv1 was obsoleted and replaced by VFPv2.

- Introduce enum for flags.

- Add few comments.

No functional changes.
2021-05-31 11:41:22 +00:00
mlelstv 70b14a2a2d Add "root" command to provide a BTINFO_ROOTDEVICE parameter. 2021-05-30 05:59:22 +00:00
mrg 13c625776c add bi-endian support to the libsa ufs reader and enable it in efiboot.
ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.)  these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member.  accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.)  sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up.  (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c.  (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size.  booted several platforms with
new boot code.
2021-05-27 06:54:44 +00:00
mrg ccb4458a63 in getdisklabel() swap the other-endian disklabel, #ifdef LIBSA_DISKLABEL_EI 2021-05-26 04:28:15 +00:00
jmcneill e6f176d843 Capture the endianness of the ELF file loaded in 'netbsd_elf_data', the
same way we do already for the class in 'netbsd_elf_class'.
2021-05-21 21:52:15 +00:00
mrg 7de9d97fa4 move bi-endian disklabel support from the kernel and libsa into libkern.
- dkcksum() and dkcksum_sized() move from subr_disk.c and from
  libsa into libkern/dkcksum.c (which is missing _sized() version),
  using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
  disklabel_swap().  (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64.  tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
2021-05-17 08:50:36 +00:00
mrg 201465fecc push the FFSv1 superblock code into ffs_find_superblock() and
hide all the ugliness in this function, out of ufs_open().

NFC, objects same size if not identical.
2021-05-12 08:45:28 +00:00
rin 3bc8d4e817 Twiddle also for data transfer for seek. 2021-03-26 10:35:08 +00:00
joerg 97a8824f43 Defer acquiring the FDE lock until after the allocation. This can avoid
nesting issues between malloc and backtrace when using LSan.
2021-02-28 23:12:37 +00:00
joerg d46facd88a Redo the aarch64 support in libunwind. This included a number of bugs
starting from returning the wrong value from the constructor to
completely bogus offset computations. Drop the ELR support for now.
2021-02-23 15:09:27 +00:00
joerg f2de411b1f The return address register entry is the DWARF register. On PowerPC,
this is not the same as the internal encoding, since the Link Register
is deliberately non-continous from the other general purpose register
values. To handle this, always translate the value into the internal
format.
2021-02-23 15:07:32 +00:00
thorpej 77507b12b7 Build strlist.c.
(Sigh, missed in original commit.)
2021-01-25 12:45:49 +00:00
thorpej 58b4172551 Fix building in the _STANDALONE case. 2021-01-23 19:41:16 +00:00
thorpej 2be6059b3b Allow this to be built for the strlist.c unit tests. 2021-01-21 15:44:14 +00:00
thorpej fa320c3f7e Add a generic set of routines for interacting with OpenFirmware-style
string lists.
2021-01-21 15:43:37 +00:00
chs 6aca65cc80 remove unused "_DIAGNOSTIC" option and opt_diagnostic.h.
note that this is unrelated to the widely used "DIAGNOSTIC" option.
2021-01-16 23:51:50 +00:00
rin ae5bdb2a50 Fix previous; define missing lfs_version. 2020-12-19 08:51:03 +00:00
rin eb10415da2 ufs_open(): Check fs->lfs_version ifdef LIBSA_*L*FS, not LIBSA_*F*FS.
This was harmless for FFS variants, that define LIBSA_FFSv[12], not LIBSA_FFS.
2020-12-19 07:19:30 +00:00
thorpej 2c5ba6c2be Build x86emu.c with -fno-inline, otherwise all of the auto-inlining
the compiler does causes stack usage to exceed the limits we've set.
2020-12-04 00:43:00 +00:00
simonb 20d7b25b25 Add a slow twiddle option. This speeds up a pmax netboot by 15% and
is only 1% slower than no twiddle.
2020-09-29 00:13:12 +00:00