Kernel: Add support for SA_SIGINFO

This commit is contained in:
2025-11-13 04:19:06 +02:00
parent a44c45ff9e
commit dd636ffcb2
13 changed files with 260 additions and 96 deletions

View File

@@ -2,15 +2,41 @@
// stack contains
// return address
// return stack
// return rflags
// siginfo_t
// signal number
// signal handler
.global signal_trampoline
signal_trampoline:
pusha
pushl %esi // gregs
pushl %edi
pushl %edx
pushl %ecx
pushl %ebx
pushl %eax
pushl %ebp
movl 40(%esp), %edi
movl 36(%esp), %eax
movl 76(%esp), %eax // return sp
addl $4, %eax // return address
movl 80(%esp), %ebx // return ip
pushl %eax;
pushl %ebx
// FIXME: populate these
xorl %eax, %eax
pushl %eax // stack
pushl %eax
pushl %eax
pushl %eax // sigset
pushl %eax
pushl %eax // link
movl %esp, %edx // ucontext
leal 68(%esp), %esi // siginfo
movl 64(%esp), %edi // signal number
movl 60(%esp), %eax // handlers
// align stack to 16 bytes
movl %esp, %ebp
@@ -19,7 +45,9 @@ signal_trampoline:
subl $512, %esp
fxsave (%esp)
subl $12, %esp
subl $4, %esp
pushl %edx
pushl %esi
pushl %edi
call *%eax
addl $16, %esp
@@ -29,9 +57,21 @@ signal_trampoline:
// restore stack
movl %ebp, %esp
popa
addl $32, %esp
addl $8, %esp
// restore registers
popl %ebp
popl %eax
popl %ebx
popl %ecx
popl %edx
popl %edi
popl %esi
// skip handler, number, siginfo_t
addl $44, %esp
// restore flags
popf
movl (%esp), %esp