Support passing arguments to signal handlers, to comply with POSIX
Currently, the only user-visible argument that is received to the signal handler when entering user mode from the kernel, is the signal number. As far as I am aware, POSIX requires that signal handlers specified via
sa_sigaction also take two additional arguments:
siginfo_t *info and
void *context (which technically is
ucontext_t *context). The lack of
sa_sigaction requires conditional compilation to support Redox, e.g. jobserver-rs#12, which is not ideal given that Redox belongs to the
#[cfg(unix) target family in
Implementing this would not be particularly hard; it should be as simple as pushing the required structures to the stack, and then pass pointers to them when calling the usermode code. Otherwise we could let the kernel deviate from the POSIX spec, and instead use a libc-level wrapper that registers the actual signal to the kernel, and then calls the
sa_sigaction field with the POSIX structures.
Another interesting point is whether we could use all of the allowed System V available registers (or all registers and come up with our own calling convention, which could also be a long-term optimization in the syscall handlers (they have to push the preserved registers once to comply with ptrace's
InterruptStack, and then again since the functions they call have no idea that the caller does not care about the preserved registers since they are already saved)). This could be used to implement SeL4-like synchronous IPC, despite the obvious drawbacks of re-entrant and asynchronous signals.