From: Matthias Kruk Date: Sun, 5 Jan 2020 07:52:36 +0000 (+0900) Subject: Implement _task_sig_stub assembly function for tasks executing signal handlers on... X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=c468f8aa4e8968c467cbe3bc66cbf142cfcd5596;p=corax Implement _task_sig_stub assembly function for tasks executing signal handlers on the way out from the kernel --- diff --git a/kernel/arch/task.S b/kernel/arch/task.S index fb55a27..f05f64b 100644 --- a/kernel/arch/task.S +++ b/kernel/arch/task.S @@ -32,6 +32,7 @@ .global task_move_stack .global task_lock .global task_unlock +.global _task_sig_stub task_prepare: /* @@ -498,3 +499,30 @@ task_unlock: call spinlock_unlock subl $OFFSET_TASK_LOCK, 4(%esp) ret + + /* + * task_sig_stub is used to execute a signal handler while returning + * from kernel to user space. The stack frame has to look like this: + * + * | ... | + * +----------------+ + * | struct siginfo | the address of this is the `si' argument + * | data | this is the `data' argument + * | signal | this is the `sig' argument + * | handler | (*sa_sigaction)(int sig, siginfo_t *si, void *data) + * | EIP | the original return address of the interrupt + * +----------------+ + */ +_task_sig_stub: + pusha + movl 36(%esp), %edx + movl 40(%esp), %eax + movl 44(%esp), %ecx + leal 48(%esp), %ebx + pushl %ecx + pushl %ebx + pushl %eax + call *%edx + addl $12, %esp + popa + ret