Commit Graph

208 Commits

Author SHA1 Message Date
Warner Losh
c1e987e062 makesyscalls.lua: Minor fluff removal
luacheck pointed out two minor issues: line isn't declared as a global,
so declare it local. Also remove an unused parameter.

Suggested by:		kevans
Sponsored by:		Netflix
2023-04-20 16:17:58 -06:00
Warner Losh
8341a74afe makesyscalls.lua: Use "sysxxx" consistently
Find the few places where we use 'sysxxx' and use "sysxxx" instead to be
more consistent.

Sponsored by:		Netflix
2023-04-20 16:17:25 -06:00
Warner Losh
1dd350fce0 makesyscalls.lua: Make more luaish
x["y"] can be written as x.y, which looks better and is a more typical
lua idiom.

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D39709
2023-04-20 16:17:25 -06:00
Mateusz Guzik
5f6df17775 vfs: validate that vop vectors provide all or none fplookup vops
In order to prevent later susprises.
2023-04-06 15:20:41 +00:00
Jason A. Harmening
5a4a83fd0e Improve debuggability of VOP_* locking assertions
Include the phase and argument field to make it easier to determine
at a glance where the failure originated.

Reviewed by:	kib, markj
Differential Revision: https://reviews.freebsd.org/D38091
2023-01-18 22:11:05 -06:00
Warner Losh
25b1b63dba dtb: Be much less verbose in the building of dtb
Make the dtb/dtbo files with less noise. Remove echo statements, but add
back the call for the non-meta builds to replace the removed noise.

Suggetions by:		jrtc27
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37073
2022-10-29 10:13:54 -06:00
Andrew Turner
dc39a3346e Make #if and #endif do what people expect in *_if.m
These are used in a few places. Pass them to the generated .c and .h
files to allow us to build the parts of the interface the kernel config
supports.

Reviewed by:	imp, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36882
2022-10-06 14:35:31 +01:00
Hans Petter Selasky
e7314192ce sound(4): Fix order of parameters for custom equalizer band pass filter.
When specifying a custom band-pass filter for the sound(4) equalizer,
use the same format as used by the resulting C-code define to avoid
confusion.

PR:		195760
Sponsored by:	NVIDIA Networking
2022-08-22 10:04:26 +02:00
John Baldwin
628a4156a7 firmware: Map '@' in filenames to '_' in symbols.
'@' is not a valid character in symbol names and can sometimes appear
in path names.

Reviewed by:	imp, markj
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35480
2022-06-14 10:50:51 -07:00
Brooks Davis
b1ad6a9000 syscallarg_t: Add a type for system call arguments
This more clearly differentiates system call arguments from integer
registers and return values. On current architectures it has no effect,
but on architectures where pointers are not integers (CHERI) and may
not even share registers (CHERI-MIPS) it is necessiary to differentiate
between system call arguments (syscallarg_t) and integer register values
(register_t).

Obtained from:	CheriBSD

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D33780
2022-03-28 19:43:03 +01:00
Brooks Davis
0910a41ef3 Revert "syscallarg_t: Add a type for system call arguments"
Missed issues in truss on at least armv7 and powerpcspe need to be
resolved before recommit.

This reverts commit 3889fb8af0.
This reverts commit 1544e0f5d1.
2022-01-12 23:29:20 +00:00
Brooks Davis
1544e0f5d1 syscallarg_t: Add a type for system call arguments
This more clearly differentiates system call arguments from integer
registers and return values. On current architectures it has no effect,
but on architectures where pointers are not integers (CHERI) and may
not even share registers (CHERI-MIPS) it is necessiary to differentiate
between system call arguments (syscallarg_t) and integer register values
(register_t).

Obtained from:	CheriBSD

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D33780
2022-01-12 22:51:25 +00:00
Jessica Clarke
1846bbd1b3 arm64: Don't rely on host readelf for u-boot booti image generation
readelf is not a bootstrap tool and so cannot be relied upon to exist.
On macOS there is no system readelf, and even on Linux or FreeBSD where
it does exist, BUILD_WITH_STRICT_TMPPATH builds won't be able to use it.
Instead of making it a bootstrap tool, just use nm as that suffices and
already is a bootstrap tool.

Fixes:		28482babd0 ("arm64: Use new arm_kernel_boothdr script for generating booti images.")
Reviewed by:	emaste, mmel
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32734
2021-12-24 19:25:20 +00:00
Kyle Evans
8494666658 sysent: move away from allowing all compat options for other ABIs
Notably, the current compat_options only makes sense for native and
freebsd32 ABIs.  For the others, it just adds cruft. Switch to having
sets of compat options, and default to the native set.  Setup the other
ABIs where it doesn't make sense to opt-out of the native set.

This removes some redundant COMPAT_FREEBSD* stuff from Linuxolator bits.

line_expr in makesyscalls.lua is fixed to allow empty strings to be
specified, since they're harmless.

Reviewed by:	brooks, kib (both earlier version)
Differential Revision:	https://reviews.freebsd.org/D33356
2021-12-16 20:56:28 -06:00
Konstantin Belousov
c1a8472793 syscalls: add COMPAT13
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33343
2021-12-09 02:48:32 +02:00
Jessica Clarke
169b368a62 amd64: Pass DEBUG when building VDSO wrapper
Not doing so results in ctfconvert failing with

  ERROR: ctfconvert: elf-vdso.so.o doesn't have type data to convert

On FreeBSD this is non-fatal, since the ctf tools have a hack to make
such errors not fail the build and instead just silently continue
without CTF data (which is a bad idea these days and should probably be
removed; they date back to the original import). However, those are
under #ifdef __FreeBSD__ so do not apply when cross-building from
non-FreeBSD, causing the build to fail.

Fix this by forwarding DEBUG on to the compiler invocation for the VDSO
wrapper. It's assembly so it's not hugely useful, but there is a
non-zero amount of information preserved, and other assembly files are
built with -g by default too so this matches them; the alternative would
be to tag the files.amd64 entries with no-ctfmerge. Note that the VDSO
itself is still compiled without debug info, this only affects the
wrapper linked into the kernel.

Fixes:		98c8b62524 ("vdso for ia32 on amd64"), ab4524b3d7 ("amd64: wrap 64bit sigtramp into vdso")
MFC after:	1 month
2021-12-07 00:24:20 +00:00
Konstantin Belousov
d49b75d0d6 Enforce that vdso does not contain runtime relocations
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:47:30 +02:00
Konstantin Belousov
b0e0b4e7b3 Enforce that vdso does not consume too much from the shared page
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:47:30 +02:00
Konstantin Belousov
5b8918fac6 amd64 native vdso: add unwind annotations to the signal trampoline
Reviewed by:	emaste
Discussed with:	jhb, jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:47:17 +02:00
Konstantin Belousov
98c8b62524 vdso for ia32 on amd64
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:46:49 +02:00
Konstantin Belousov
ab4524b3d7 amd64: wrap 64bit sigtramp into vdso
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D32960
2021-12-06 20:46:49 +02:00
Bjoern A. Zeeb
b394e16ef0 fw_stub: fix -Wunused-but-set-variable for firmware files
In case we are only embedding a single firmware image the variable
"parent" gets set but never used.  Add checks for the number of files
for it and only print it out if we are exceeding the single file count.
This fixes -Wunused-but-set-variable warnings for the majority of
firmware files in the tree.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2021-11-30 14:23:18 +00:00
Brooks Davis
d7f306c5be makesyscalls: add a new SYSMUX type
This type is for system call multiplexers (syscall(2), __syscall(2))
that don't have a normal handler and instead are handled in the
machine-dependent syscall code.

Reviewed by:	kib, imp
2021-11-29 22:04:43 +00:00
Brooks Davis
f260a69dec makesyscalls: strip _Contains_ argument annotations
Reviewed by:	kevans
2021-11-22 22:36:58 +00:00
Brooks Davis
64cc9803ab makesyscalls: add override of ABI change detection
While we can detect most ABI changes through analysis of
syscalls.master with suitable annotations, to cases are handled
in the core implementation and others have changes that can not be
infered.  Add two new config variables syscall_abi_change and
syscall_no_abi_change which override the detected value.  Both are
space-seperated lists of syscall names.

Reviewed by:	kevans
2021-11-22 22:36:58 +00:00
Brooks Davis
988e8db3c0 makesyscalls: automate detection of ABI changes
Use pattern matching including matches of _Contains_*_ argument
annotations to (mostly) determine which system calls require
ABI-specific handling.  Automatically treat syscalls as NOPROTO
if no ABI changes are present.

Reviewed by:	kevans
2021-11-22 22:36:58 +00:00
Brooks Davis
804a84fbf2 makesyscalls.lua: Add the ABI function prefix reliably.
The previous code mostly worked, but ended up adding bogus sys_<foo>()
declerations.

Reviewed by:	kevans
2021-11-22 22:36:58 +00:00
Brooks Davis
5e70931184 makesyscalls: allow config to force OBSOL and UNIMPL
The obsol and unimpl config variables are space-seperated lists of
syscalls that should treated as being declared OBSOL and UNIMPL.

The allows an ABI to exclude select system calls listed in
syscalls.master.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
64007b000a makesyscalls: handle 64-bit args on 32-bit
On 32-bit architectures, 64-bit arguments are passed in pairs of
registers. On non-x86 architectures these arguments must be in evenly
aligned registers which necessiciates inserting a pad register into the
argument list. This has historically been supported by adding ifdefs
around padded and unpadded syscall defintions in syscalls.master.

In order to enable generation of 32-bit support files from the base
syscalls.master, pull this support in to makesyscalls.lua enabled by
adding pair_64bit to abi_flags.

The changes to sys_proto.h simply add #ifdef PAD64_REQUIRED
around pad arguments in struct <syscall>_args. In systrace_args(),
replace static syscall index values with post-incremented indexs
allowing a simple ifdef around the argument. Under -O1 or higher
code generation is identical. systrace_entry_setargdesc() is a bit
more complicated as we switch on argument indices.  Solve this
with some use of define/undef pairs to compute the correct indices.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
79634eb90b makesyscalls: handle arrays of pointers
When the config variable abi_intptr_t is not "", transform arrays of
pointers to arrays of abi_intptr_t.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
0a4e16446b makesyscalls: handle longs in ABI compat
Replace long-derived types with their abi equivalent where
required by the target ABI. There are two cases:
 - All pointers to types that go from 64-bit to 32-bit between the
   default ABI and the target ABI.
 - Signed arguments that go from 64-bit to 32-bit (these require
   sign-extension before passing to general kernel ABIs).

This adds four new config variables: abi_long, semid_t, abi_size_t,
and abi_u_long which default to long, size_t, and u_long respectively.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
b85fb39047 makesyscalls.lua: Allow translation of intptr_t arguments
Translate instances of intptr_t to the config value abi_intptr_t
(defaults to "intptr_t").  Used in CheriABI to translate intptr_t
to intcap_t for hybrid kernels.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
37b425bd05 makesyscalls: intptr_t arguments are pointers
Match intptr_t arguments as pointers.  Currently this is a no-op
change to systrace_args.c.

Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
3f8f46a0ae makesyscalls: Add a way to include per-ABI headers
When the string %%ABI_HEADERS%% is found in syscalls.master, replace
it with the contents of the abi_headers config variable.  This allows
an ABI-specific syscalls.conf to add lines like:

	#include <compat/freebsd32/freebsd32.h>

when working from a shared syscalls.master.

Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
ed8a4423fb makesyscalls: allow multiple expressions for each abi change
Limitations in lua patterns means we need to be able to match more
than one possible expression.

Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
818aa9543d makesyscalls: Fix expression for time_t_size
Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
5203efead7 makesyscalls: Remove _native suffix handling
This supported a hack we used in CheriBSD which has been removed.

Reviewed by:	kevans
2021-11-22 22:36:56 +00:00
Brooks Davis
1739de97af makesyscalls: make strip_abi_prefix more robust
Allow strip_abi_prefix() to be called with nil and return nil in that
case.  This simplifies handling of RESERVED entries.

Reviewed by:	kevans
2021-11-17 20:12:21 +00:00
Adrian Chadd
8e53cd7099 ipq4018: add TCSR definitions from Linux.
These are hardware configuration options which are required in
the linux/openwrt device trees for the IPQ4018/IPQ4019 devices.

Since this isn't obtained from linux upstream but instead from
openwrt, this can't go in contrib; instead it is going in
sys/dts/include/ .

Obtained from: OpenWRT

Tested:

* IPQ4019 ASUS RT-AC58U AP, initial bootstrapping
2021-10-18 19:18:01 +00:00
Kyle Evans
6687410af7 makesyscalls: sprinkle some assert() on standard function calls
Improves our error reporting, ensuring that we aren't just ignoring
errors in the common case.

Note specifically the boundary where we have to change up our error
handling approach.  It's fine to error() out up until we create the
tempdir, then the rest should try to handle it gracefully and abort().
A future change will clean this up further by pcall'ing all of the bits
that cannot currently error() without cleaning up.
2021-09-24 20:55:56 -05:00
Kyle Evans
e12a0ffe2b makesyscalls: rip out arbitrary command execution
This was previously needed only for CloudABI, which used it to generate
its capenabled from syscalls.master.  CloudABI was removed in
cf0ee8738e, so we don't need to support this anymore.  Others looking
to do similar things should come up with a more integrated technique,
such as a .conf flag or pattern/glob support.  brooks suggests that it
could be done in modern makesyscalls.lua by adding a config flag to
specify always-on/initial flags (CAPENABLED).

Reviewed by:	brooks, imp
MFC after:	never
Differential Revision:	https://reviews.freebsd.org/D32095
2021-09-24 20:53:44 -05:00
Kyle Evans
340e009ecc makesyscalls: stop trying to remove . and .. in cleanup
lfs.dir() will include these entries, but os.remove() cannot remove them
for obvious reasons.
2021-09-24 20:50:39 -05:00
Konstantin Belousov
cf0ee8738e Drop cloudabi
According to https://github.com/NuxiNL/cloudlibc:
CloudABI is no longer being maintained. It was an awesome experiment,
but it never got enough traction to be sustainable.

There is no reason to keep it in FreeBSD.

Approved by:	ed (private mail)
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D31923
2021-09-22 00:18:44 +03:00
Brooks Davis
6945df3fff makesyscalls.lua: add a CAPENABLED flag
The CAPENABLED flag indicates that the syscall can be used in capsicum
capability mode.  It is intended to replace capabilities.conf.

Reviewed by:	kevans, emaste
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D31349
2021-09-01 21:58:06 +01:00
Ed Maste
9feff969a0 Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder (in the associated license block).

Sponsored by:	The FreeBSD Foundation
2021-08-08 10:42:24 -04:00
Michal Meloun
b07a6bd15a booti: Enable loading the kernel image to any address aligned to 2 MB
We've supported this for a long time, plus most u-boot setups quietly expect
it. Otherwise they fail with different levels of memory overwrites.
MFC after:	2 weeks
2021-07-28 13:42:13 +02:00
Ed Maste
ad385f7b46 makesyscalls.lua: improve generated file style(9) compliance
We generally like to avoid style changes when other changes are not
planned.  In this case there are some makesyscalls.lua changes in the
pipeline, and this cleans up style nits in generated files that were
highlighted by experiments with clang-format.

Reviewed by:	brooks, kevans
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30235
2021-05-13 13:59:25 -04:00
Warner Losh
099919b76d newbus: remove support for SINGLETON
Revert rest of de8dd262c4 since it's now unused.

jhibbits@ introduced this to give powerpc MMU functions IFUNC like
performance while retaining the kobj interface, speeding up operations
10-20%. Since there was only ever one instance of the mmu interface
active at any given time, we could cache the looked up results more
agressively.

powerpc migrated to using IFUNCs to get an even larger performance boost
in 45b69dd63e, deleting the two files it was added to in de8dd262c4.

However, there's few, if any, other potential applications of this to
the tree today. It's now unused and undocumented. Retire it to eliminate
this wart and to preclude the need to document it. Should a simmilar
case arise in the future, the code is in git...

Discusssed with:	jhibbits@
Reviewed by:		jhb@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D29997
2021-04-26 11:41:08 -06:00
Brooks Davis
119fa6ee8a syscalls.master: Add a new syscall type: RESERVED
RESERVED syscall number are reserved for local/vendor use.  RESERVED is
identical to UNIMPL except that comments are ignored.

Reviewed by:	kevans
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27988
2021-01-26 18:27:44 +00:00
Emmanuel Vadot
efdf807990 Switch to the new device-tree vendor tree
The old vendor tree was never fully merged and doing partial merge isn't
supported with git subtree merge so a new one was created.
Switch the build to use the new DTS from sys/contrib/device-tree
This also bump the DTS used to be in sync with Linux 5.9
While here change the way to get the linux version, simply hardcode
the value in sys/dts/freebsd-compatible.dts and use awk to get that
to put it in the CFLAGS.
As a bonus we now have the bindings docs available
in sys/contrib/device-tree/Bindings/ so no need to link to the Linux repo
or to the vendor tree.
2021-01-15 20:08:39 +01:00