Skip to content

Conversation

clemdiep
Copy link
Contributor

This PR make it easier to maintain the syscall table used to match syscall number to their corresponding function.

For that, this script syscall_gen.sh is added. It will take as input the new file syscall.tbl and arch/ARCH/syscall.h.in and generate the files include/generated/syscall_number.h and include/generated/syscall_table.h.in.
This script is called by the build system in the first steps.

syscall.tbl is a custom file which list all syscall available in SO3 and a configuration requirements if there is any. This file isn't arch dependent and all new syscall implementation needs to be added there.

arch/ARCH/syscall.h.in is an exact copy from musl arch/ARCH/bits/syscall.h.in which list all syscall available on Linux why there corresponding number.

include/generated/syscall_number.h will contain the all syscalls that are listed in both syscall.tbl and syscall.h.in, with #ifdef CONFIG_... around if necessary. This means that now if SYSYCALL_xxx is defined in the kernel, then the syscall is activated. It can allow to remove undeed syscall implementation to reduce the kernel code size.

include/generated/syscall_table.h.in will contain all syscall from syscall.tbl in the following format:

#ifdef SYSCALL_read
	[SYSCALL_read] = &__sys_read,
#endif

This file can then be included in the syscall table initialisation list to get the correct list of used syscall function with their correct number.

Those changes allow for a more easily maintainable list of syscall as only syscall.tbl needs to be updated when implmenting a new one, without having to add a lot of #if around syscall table elements.

@clemdiep clemdiep force-pushed the 213-improve-syscall-table branch from fc21150 to d0a7017 Compare October 13, 2025 17:06
@clemdiep
Copy link
Contributor Author

In draft as #211 should be merge before to avoid conflict.
However, it may already be reviewed.

@clemdiep clemdiep requested review from Copilot, daniel-rossier and jmi-reds and removed request for Copilot October 13, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant