hermitux
hermitux copied to clipboard
Increase system calls support
We support only a subset of Linux's syscalls. Supporte system calls are listed here. Each case
of the switch statement corresponds to a system call and redirect the execution to the syscall implementation. The system call implementation themselves are present here (one file per system call).
When a system call is not supported the execution will abort. With verbose mode enabled it is easy to identify which system call was called as the log will contain a line like this:
[0.000][0:1][ERROR] Unsuported Linux syscall: 34
In this particular example we are missing the pause
system call implementation. It's id is 34. For a mapping of system call names to ids, see here for example.
In order to add a new system call implementation, one can create a new file in hermitux-kernel's kernel/syscalls
and write the corresponding case
directive in arch/x86/kernek/isrs.c
. Following the Linux ABI the parameters should be passed in the correct order: %rdi
, %rsi
, %rdx
, %r10
, %r8
and %r9
. An example for the read
system call can be found here.
Generally, the more system calls we support, the more application we support. This paper contains an interesting study of Linux's syscall usage, and may be used to prioritize system call support in HermiTux.