1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 13:45:08 +00:00

Kernel: Stop hardcoding syscall in signal trampoline.

We now no longer hardcode the sigreturn syscall in
the signal trampoline. Because of the way inline asm inputs
work, I've had to enclose the trampoline in the function
signal_trampoline_dummy.
This commit is contained in:
Drew Stratford 2019-09-18 01:41:42 +12:00 committed by Andreas Kling
parent 224fbb7910
commit 6e51ebad8c

View file

@ -793,6 +793,8 @@ void Process::sys$exit(int status)
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
void signal_trampoline_dummy(void)
{
// The trampoline preserves the current eax, pushes the signal code and // The trampoline preserves the current eax, pushes the signal code and
// then calls the signal handler. We do this because, when interrupting a // then calls the signal handler. We do this because, when interrupting a
// blocking syscall, that syscall may return some special error code in eax; // blocking syscall, that syscall may return some special error code in eax;
@ -809,10 +811,11 @@ asm(
"push eax\n" "push eax\n"
"call [ebp+8]\n" // call the signal handler "call [ebp+8]\n" // call the signal handler
"add esp, 8\n" "add esp, 8\n"
"mov eax, 0x2d\n" // FIXME: We shouldn't be hardcoding this. "mov eax, %P0\n"
"int 0x82\n" // sigreturn syscall "int 0x82\n" // sigreturn syscall
"asm_signal_trampoline_end:\n" "asm_signal_trampoline_end:\n"
".att_syntax"); ".att_syntax" ::"i"(Syscall::SC_sigreturn));
}
extern "C" void asm_signal_trampoline(void); extern "C" void asm_signal_trampoline(void);
extern "C" void asm_signal_trampoline_end(void); extern "C" void asm_signal_trampoline_end(void);