1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

Kernel: Use user stack for signal handlers.

This commit drastically changes how signals are handled.

In the case that an unblocked thread is signaled it works much
in the same way as previously. However, when a blocking syscall
is interrupted, we set up the signal trampoline on the user
stack, complete the blocking syscall, return down the kernel
stack and then jump to the handler. This means that from the
kernel stack's perspective, we only ever get one system call deep.

The signal trampoline has also been changed in order to properly
store the return value from system calls. This is necessary due
to the new way we exit from signaled system calls.
This commit is contained in:
Drew Stratford 2019-09-05 01:14:54 +12:00 committed by Andreas Kling
parent 259a1d56b0
commit 81d0f96f20
5 changed files with 104 additions and 122 deletions

View file

@ -141,7 +141,7 @@ public:
int sys$lseek(int fd, off_t, int whence);
int sys$kill(pid_t pid, int sig);
[[noreturn]] void sys$exit(int status);
[[noreturn]] void sys$sigreturn();
int sys$sigreturn(RegisterDump& registers);
pid_t sys$waitpid(pid_t, int* wstatus, int options);
void* sys$mmap(const Syscall::SC_mmap_params*);
int sys$munmap(void*, size_t size);