Commit Graph

1717 Commits

Author SHA1 Message Date
rin eec9572cb1 Consistently use ntohs() instead of htons() when converting from
network to host byte order.

No binary changes both for big and little endian.
2022-08-07 05:51:55 +00:00
skrll afda606fbe alredy -> already 2022-07-08 07:02:47 +00:00
martin 8f08765306 Fix editing mishap, should fix the build 2022-06-27 06:45:14 +00:00
skrll d8ce3d4857 Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for HPPA to hold the return address where the signal trampoline
will resume.  XXX Same treatment is needed for HPPA64, but not done as
part of this commit.

Thanks to thorpej for help with this. (ages ago)
2022-06-26 14:31:33 +00:00
rillig 2a9be2a76b libkern: fix wrong escaping in makefile
In the unlikely event that KERNDIR contains a '$' character, that '$'
should not be doubled to '$$'. It only needs the usual shell quoting.
2022-06-19 18:28:16 +00:00
skrll 8c5aad32f0 Fix a dumb typo/thinko
Thanks to Tom Lane for spotting it.
2022-06-15 21:31:19 +00:00
skrll 934c436b1e Provide a __canonicalize_funcptr_for_compare which only needs to return
the passed value as the kernel doesn't do PLABELS.

PR/56878 (hppa: kernel module lua fails to load)
2022-06-13 16:03:07 +00:00
skrll 8ad5b80d68 Don't need $$sh_func_adrs 2022-06-13 16:00:05 +00:00
rin 9261ab392b 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.
2022-05-30 14:18:10 +00:00
rin 031d59ff12 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.
2022-05-30 14:13:59 +00:00
rin 2786ceb6bd Now, NULL is always defined correctly, as we include <sys/param.h> above. 2022-04-30 09:24:05 +00:00
rin 04dc166927 Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize for some archs.

Should be useful for ancient archs, for which secsize is fixed.

Thanks christos@ for comment.
2022-04-29 07:42:07 +00:00
rin 7ca4ea5592 Revert previous at the moment.
This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...

On 2022/04/27 20:48, Rin Okuyama wrote:
> Module Name:	src
> Committed By:	rin
> Date:		Wed Apr 27 11:48:26 UTC 2022
>
> Modified Files:
> 	src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c
>
> Log Message:
> Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
> used instead of secsize obtained by SAIOSECSIZE ioctl.
>
> This hack avoids divdi3 and friends from being linked, in order to
> support variable secsize.
>
> This is useful for amiga/boot(8); it is loaded by firmware into
> unpredictable address, and therefore all symbols should be
> addressable by PC relative mode with only 16-bit displacements.
>
> See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
> more details.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
> cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
2022-04-27 14:48:50 +00:00
rin e11b3c29a6 Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize.

This is useful for amiga/boot(8); it is loaded by firmware into
unpredictable address, and therefore all symbols should be
addressable by PC relative mode with only 16-bit displacements.

See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
more details.
2022-04-27 11:48:26 +00:00
mlelstv 56b23fbb85 Don't load filessytem module for filesystem that was found but isn't used
for booting.
2022-04-24 06:52:59 +00:00
mlelstv 5290066ee5 Ask driver about sector size to support reading superblocks from fixed
byte offsets.
2022-04-24 06:48:15 +00:00
skrll a60573591b Typo in comment. avoinds -> avoids 2022-04-19 09:25:38 +00:00
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