2024-08-21 13:37:50 +03:00
|
|
|
.section .userspace, "ax"
|
2023-07-21 15:45:02 +03:00
|
|
|
|
2023-08-03 18:09:48 +03:00
|
|
|
// stack contains
|
|
|
|
// return address
|
|
|
|
// signal number
|
|
|
|
// signal handler
|
|
|
|
|
2023-07-21 15:45:02 +03:00
|
|
|
.global signal_trampoline
|
|
|
|
signal_trampoline:
|
|
|
|
pushq %rax
|
|
|
|
pushq %rbx
|
|
|
|
pushq %rcx
|
|
|
|
pushq %rdx
|
|
|
|
pushq %rbp
|
|
|
|
pushq %rdi
|
|
|
|
pushq %rsi
|
|
|
|
pushq %r8
|
|
|
|
pushq %r9
|
|
|
|
pushq %r10
|
|
|
|
pushq %r11
|
|
|
|
pushq %r12
|
|
|
|
pushq %r13
|
|
|
|
pushq %r14
|
|
|
|
pushq %r15
|
|
|
|
|
|
|
|
movq 128(%rsp), %rdi
|
|
|
|
movq 120(%rsp), %rax
|
2024-04-18 13:32:40 +03:00
|
|
|
|
|
|
|
// align stack to 16 bytes
|
|
|
|
movq %rsp, %rbx
|
|
|
|
andq $0x0F, %rbx
|
|
|
|
subq %rbx, %rsp
|
|
|
|
|
2023-07-21 15:45:02 +03:00
|
|
|
call *%rax
|
|
|
|
|
2024-04-18 13:32:40 +03:00
|
|
|
// restore stack
|
|
|
|
addq %rbx, %rsp
|
2023-07-21 15:45:02 +03:00
|
|
|
popq %r15
|
|
|
|
popq %r14
|
|
|
|
popq %r13
|
|
|
|
popq %r12
|
|
|
|
popq %r11
|
|
|
|
popq %r10
|
|
|
|
popq %r9
|
|
|
|
popq %r8
|
|
|
|
popq %rsi
|
|
|
|
popq %rdi
|
|
|
|
popq %rbp
|
|
|
|
popq %rdx
|
|
|
|
popq %rcx
|
|
|
|
popq %rbx
|
|
|
|
popq %rax
|
|
|
|
|
|
|
|
addq $16, %rsp
|
|
|
|
|
2023-08-03 18:09:48 +03:00
|
|
|
// return over red-zone
|
|
|
|
ret $128
|