]> git.corax.cc Git - corax/commitdiff
Implement _task_sig_stub assembly function for tasks executing signal handlers on...
authorMatthias Kruk <m@m10k.eu>
Sun, 5 Jan 2020 07:52:36 +0000 (16:52 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 5 Jan 2020 07:52:36 +0000 (16:52 +0900)
kernel/arch/task.S

index fb55a2754a564055b01c11dcb856e3f320978dad..f05f64bc935297aa2784eb5d7d22e784035f5e85 100644 (file)
@@ -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