Draft: Simplify signal handling
Various process/context management improvements. The first commits are x86-specific improvements.
Then, some significant simplifications: the kernel stacks are flattened regardless of signal depth, and registers and other state (e.g. procmask) are pushed to the userspace stack instead (sigaltstack is now optional). Flattening the kernel stack fixes this. The userspace registers, modified using ptrace and the signal handler code, are also stored exactly at the top of the kernel stack, eliminating ptrace::set_process_regs etc.
Finally, it divides signals into standard signals and realtime signals, the former being implemented using a bitmask and the latter using a now-bounded queue. Arguments can now be pushed to signal handlers.
Unresolved questions:
- should sa_restorer be used?
- is the current half-baked kernel signal trampoline sufficient, or should it be replaced with something better?
- is POSIX signal handling meant to be fast, or simply be the bare minimum POSIX needs? In the latter case, signal handling could be moved to a userspace daemon entirely (including or excluding CPU-exception-caused signals). In the former case, an interesting alternative would be to move signal delivery (but not the kill/sigqueue impl) to userspace, using kernel-user shared memory (some offset in the TCB), so that the kernel only writes temporary values to a few in-memory fields, and sets the instruction pointer (similar to syscall/sysret but without swapgs).