1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00
Commit Graph

243 Commits

Author SHA1 Message Date
Brooks Davis
bbc0f33b13 sysent: add a NOLIB modifer to prevent stub generation
The yield system call has long existed, but never had a stub.  Replace
the hardcoded checks for it in libsys_h.lua and syscalls_map.lua and
stop inserting it into MIASM (requiring libsys/Makefile.sys to disable
the stub).

(This seems like overkill, but I've got another case in CheriBSD so this
reduces my diff appreciably.)

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1503
2024-11-01 15:44:47 +00:00
Brooks Davis
2ea829e3ab sysent: sort modifier flags
These flags are a mix of excusive types and modifer flags.  Comment the
modifer flags and sort them.

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1503
2024-11-01 15:44:34 +00:00
Brooks Davis
5212b95001 sysent: GC sys/tools/makesyscalls.lua
System call entry generation now lives in sys/tools/syscalls/*
2024-10-30 21:04:31 +00:00
Brooks Davis
913bfd86c1 Update mentions of makesyscalls.lua
It is obsolete and will be removed in a followup commit.
2024-10-30 21:04:31 +00:00
Brooks Davis
ec86d763d1 sys/tools/syscalls: desupport capabilities.conf
We haven't used this since commit be67ea40c5 in 2021 so stop carrying
it forward.

Also remove support for setting the list in syscalls.conf via the
capenabled variable.  This was last used by cloudabi (removed in 2021
by commit cf0ee8738e).
2024-10-30 21:04:31 +00:00
agge3
9ded074e87 Refactor makesyscalls.lua into a library
* main.lua replicates the functionality of makesyscalls.lua
* Individual files are generated by their associated module
  * Modules can be called as standalone scripts to generate a specific
    file
* Data and procedures are performed by objects instead of procedual code
* Bitmasks are replaced by declarative types
* Temporary files are no longer produced, writing is stored in memory
* Comments provide explanation to functions and semantics

Google Summer of Code 2024 Final Work Product

Co-authored-by: Warner Losh <imp@freebsd.org>
Co-authored-by: Kyle Evans <kevans@freebsd.org>
Co-authored-by: Brooks Davis <brooks@freebsd.org>
Sponsored by:    Google (GSoC 24)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1362
Signed-off-by: agge3 <sterspark@gmail.com>
2024-10-30 21:04:30 +00:00
Brooks Davis
8bc14f6ba9 makesyscalls.lua: converstion -> conversion
Reported by:	agge3 <sterspark@gmail.com>
2024-10-22 19:21:26 +01:00
Konstantin Belousov
3b2cf9381e amd64: do not pass -z rodynamic to ld.bfd when building vdso
Apparently newer versions of binutils complain instead of silently
ignoring the unknown -z option.

Reported by:	bz
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47176
2024-10-18 21:48:56 +03:00
Brooks Davis
0f1d5bfb72 sysent: fix a couple more do-no-edit comments
Add blank like after comment to align with upcoming refactor for
makesysent.lua.

Fixes:		0d490c6a44 sysent: make header comments more consistent
2024-10-03 18:01:30 +01:00
Brooks Davis
0d490c6a44 sysent: make header comments more consistent
An upcoming refactor appends do-not-merge comments to all headers
centrally to do the same to reduce the final diff.  Headers also start
with a comment line (for /*) and end with a blank line.
2024-10-01 18:44:03 +01:00
agge3
e668866c82 sysent: Remove comment aligning
Comment aligning was inconsistent and required a ton of book-keeping.
Replaced comment aligning with a simple, single tab out.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1441
Signed-off-by: agge3 <sterspark@gmail.com>
2024-10-01 17:08:41 +01:00
Bjoern A. Zeeb
b4ef1b1be7 tools/sdiodevs2h.awk: introduce palias
Some of the defined names are not the direct 1:1 mapping with vendor
and device names used by Linux device drivers.
Introduce a p(roduct)alias so we can map the one device entry I came
across without much extra hassle and generate a name device drivers
know about:
palias BROADCOM_CYPRESS_43439  CYPRESS_43439

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46455
2024-08-31 21:37:53 +00:00
Bjoern A. Zeeb
51cb6f5244 tools/sdiodevs2h.awk: adjust defined named for vendor and device IDs
Generate defined names which match the ones in the Linux drivers (a lot more);
given we are likely to have drivers only based on those one way or another
there is absolutely no reason to fight over differently generated names
for device and vendor IDs.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D46300
2024-08-27 18:37:55 +00:00
Bjoern A. Zeeb
499c337781 tools/sdiodevs2h.awk: fix after removal of $FreeBSD$
The input file used to have a $FreeBSD$ tag on the first line and we
recorded that in the generated files to know which versions they were
based on.  With the removal of $FreeBSD$ the logic was not quite
correct anymore;  fix that to generate proper header files again.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D46300
2024-08-27 18:33:14 +00:00
Warner Losh
de22251127 arm_kernel_bothdr.awk: Update to latest ota
The latest ota is the first one in FreeBSD that treats 0 + "0xf" as
being '0' instead of '15'. Don't use this old trick anymore to convert
from hexidecimal to a number. Write a function to do that instead. This
fixes kernel.bin building on arm*. awk on 14 doesn't need this, but to
build FreeBSD stable/14's kernel.bin on 15 we'll need it, so fast MFC.

MFC After:		3 days
Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:  https://reviews.freebsd.org/D44801
2024-04-16 21:30:17 -06:00
Brooks Davis
79b758e327 makesyscalls: generate core libsys header
Create a header covering most of the "stable" libsys interfaces.
Specifically __sys_<foo> syscall stubs and __sys_<foo>_t typedefs for
those interfaces.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44386
2024-04-16 17:48:07 +01:00
Brooks Davis
5d88a2aacf sysproto.h: sys/acl.h -> sys/types.h
In sysproto.h, stop including sys/acl.h as syscall defintions now use
__acl* types from sys/_types.h.  Add sys/types.h to provide types
previously provided by sys/param.h (via sys/acl.h).

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44467
2024-04-15 21:35:41 +01:00
Brooks Davis
cc4ffc9786 libsys: don't try to expose yield
The undocumented yield system call has never been implemented via libc
or libsys (except accidentally for <15 minutes in 1998 between commits
abd529ceba and 0db2fac06a).  Avoid trying to export it now to avoid
failures when linking with --no-undefined-version.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44236
2024-03-07 01:01:36 +00:00
Brooks Davis
304cdac738 lib{c,sys}: expose _getlogin consistently
Historically we exposed _getlogin as a private symbol on a per-arch basis
(except on aarch64 and riscv) for no obvious reason.  We now need to
expose it for libc's use so remove the special case from
makesyscalls.lua and expose it in the generated syscalls.map.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44116
2024-02-29 19:46:33 +00:00
Brooks Davis
b71defdbd8 makesyscalls: generate private syscall symbols
For libsys we need to expose all the private symbols (_ and __sys_
prefixes) so libsys can replace the libc versions.  Rather than trying
to maintain a table, teach makesyscalls to generate it.

There are a small number of "_" prefixed symbols that are exposed as
public interfaces rather than in the private symbol space.  Since the
list is short, just hardcode it for now.

If doesn't appear that we need to export freebsd#_foo symbols for compat
system calls explicitly.  If it turns out we do, there are probably few
enough of them to handle seperately.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis
c1c8afd04e makesyscalls: add COMPAT14 support
Reviewed by:	kevans, imp
Fixes:		84d12f887c Add a COMPAT_FREEBSD14 kernel option
Differential Revision:	https://reviews.freebsd.org/D42861
2023-12-01 20:00:39 +00:00
Warner Losh
29363fb446 sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:30 -07:00
Olivier Certner
2f68ae6150 makesyscall: Simplify a bit emitting syscall declarations
Reviewed by:            kevans, imp
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42168
2023-11-21 13:25:34 -05:00
Brooks Davis
54d487c4d0 makesyscalls: don't make syscall.mk by default
We only want to produce syscall.mk for the main syscall table so default
to not producing it (send it to /dev/null) and add a syscalls.conf to
sys/kern to trigger the creation of sys/sys/syscall.mk.  This eliminates
the need for entries in other syscalls.conf files and is a cleaner
pattern going forward.

Reviewed by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D42663
2023-11-18 00:48:14 +00:00
Warner Losh
67dd7233be pccarddevs2h.awk: Remove
pccard support was removed in 31b35400cf77on Dec 14, 2021, but this
wasn't.  Belatedly remove it.

MFC After: 1 week
Sponsored by: Netflix
2023-08-25 15:12:44 -06:00
Warner Losh
8c99d94c90 sys: Remove $FreeBSD$: two-line lua tag
Remove /^--\n--\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:27 -06:00
Warner Losh
031beb4e23 sys: Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:58 -06:00
Warner Losh
750a49b606 vnode_if: Don't add $FreeBSD$ to the output
Sponsored by:		Netflix
2023-08-16 00:23:39 -06:00
Warner Losh
fa12e8fe51 fw_stub: Don't add $FreeBSD$ to generated file
Sponsored by:		Netflix
2023-08-16 00:23:37 -06:00
Warner Losh
021c4fa6b0 miidevs2h: Ignore the first line
The first line hasn't contained version information in years. Ignore it
entirely.

Sponsored by:		Netflix
2023-08-15 23:34:19 -06:00
Warner Losh
94b73d30ef usbdevs2h: Ignore First Line and stop generating $FreeBSD$
Just ignore the first line of the usbdevs file. And stop recording what
the usbdevs* files were generated from. It's said '$FreeBSD$' for years
now...

Sponsored by:		Netflix
2023-08-15 23:34:18 -06:00
Jessica Clarke
8a6ab0f71f Pre-quote macros passed to .incbin to avoid unwanted substitution
Currently for the MFS, firmware and VDSO template assembly files we pass
the path to include with .incbin unquoted and use __XSTRING within the
assembly file to stringify it. However, __XSTRING doesn't just perform a
single level of expansion, it performs the normal full expansion of the
macro, and so if the path itself happens to tokenise to something that
includes a defined macro in it that will itself be substituted. For
example, with #define MACRO 1, a path like /path/containing/MACRO/in/it
will expand to /path/containing/1/in/it and then, when stringified, end
up as "/path/containing/1/in/it", not the intended string. Normally,
macros have names that start or end witih underscores and are unlikely
to appear in a tokenised path (even if technically they could), but now
that we've switched to GNU C as of commit ec41a96daa ("sys: Switch the
kernel's C standard from C99 to GNU99.") there are a few new macros
defined which don't start or end with underscores: unix, which is always
defined to 1, and i386, which is defined to 1 on i386. The former
probably doesn't appear in user paths in practice, but the latter has
been seen to and is likely quite common in the wild.

Fix this by defining the macro pre-quoted instead of using __XSTRING.
Note that technically we don't need to do this for vdso_wrap.S today as
all the paths passed to it are safe file names with no user-controlled
prefix but we should do it anyway for consistency and robustness against
future changes.

This allows make tinderbox to pass when built with source and object
directories inside ~/path-with-unix, which would otherwise expand to
~/path-with-1 and break.

PR:	272744
Fixes:	ec41a96daa ("sys: Switch the kernel's C standard from C99 to GNU99.")
2023-07-28 05:08:43 +01:00
Warner Losh
61fe63f698 makesyscall: Stop generating $FreeBSD$
With 14 coming, we no longer need to generate the $FreeBSD$. We can
likely MFC that to 13 as well.

MFC After:		2 weeks
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D39879
2023-06-09 07:26:24 -06:00
Warner Losh
b61a573019 spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:04 -06:00
Warner Losh
4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
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