Skip to content

Conversation

clemdiep
Copy link
Contributor

This PR refactor syscall handling to simplify the process of adding new ones. This is in the goal of supporting native musl library.

For that, an array (syscall_table) is used to contains the callback to use for a given syscall number. This remove the need of the switch to select the correct function.

Macros are also added to declare and define syscall function. They declare two functions __sys_SYSCALL_NAME and do_SYSCALL_NAME. The first one is also implemented and just call do_SYSCALL_NAME with casting each arguments to the correct type. They are inspired by Linux one's (see include/linux/syscalls.h in Linux sources).

The syscalls number are also moved into a per arch depend file. For now, the number are the same between the two archs, but to support native musl, different number will be needed (e.g. exit is 1 on arm32 and 93 on aarch64). This will be done futur work.

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