64cc9803 brooks Nov. 22, 2021, 10:36 p.m.
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
cgit
988e8db3 brooks Nov. 22, 2021, 10:36 p.m.
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
cgit
804a84fb brooks Nov. 22, 2021, 10:36 p.m.
The previous code mostly worked, but ended up adding bogus sys_<foo>()
declerations.

Reviewed by:	kevans
cgit
5e709311 brooks Nov. 22, 2021, 10:36 p.m.
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
cgit
30bc335a brooks Nov. 22, 2021, 10:36 p.m.
faa67c2b brooks Nov. 22, 2021, 10:36 p.m.
This eliminates the need for ifdefs in syscalls.master and contains the
largest set of diff to generated files on the way to switching to using
the default ABI's syscalls.master.

Reviewed by:	kevans
cgit
6b7c23a0 brooks Nov. 22, 2021, 10:36 p.m.
64007b00 brooks Nov. 22, 2021, 10:36 p.m.
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
cgit
79634eb9 brooks Nov. 22, 2021, 10:36 p.m.
When the config variable abi_intptr_t is not "", transform arrays of
pointers to arrays of abi_intptr_t.

Reviewed by:	kevans
cgit
0a4e1644 brooks Nov. 22, 2021, 10:36 p.m.
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
cgit
b85fb390 brooks Nov. 22, 2021, 10:36 p.m.
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
cgit
f0cfbffc brooks Nov. 22, 2021, 10:36 p.m.
37b425bd brooks Nov. 22, 2021, 10:36 p.m.
Match intptr_t arguments as pointers.  Currently this is a no-op
change to systrace_args.c.

Reviewed by:	kevans
cgit
3f8f46a0 brooks Nov. 22, 2021, 10:36 p.m.
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
cgit
ed8a4423 brooks Nov. 22, 2021, 10:36 p.m.
Limitations in lua patterns means we need to be able to match more
than one possible expression.

Reviewed by:	kevans
cgit