arm64/crt0.c: Fix stack alignment when executing signal trampoline

The stack alignment requirement is 16-bytes, not 8-bytes.
This commit is contained in:
Ville Juven
2024-09-04 12:29:15 +03:00
committed by Xiang Xiao
parent cd8db329de
commit 48f545d54a

View File

@@ -72,7 +72,7 @@ static void sig_trampoline(void)
{
__asm__ __volatile__
(
" sub sp, sp, #8\n" /* Create a stack frame to hold LR */
" sub sp, sp, #16\n" /* Create a stack frame to hold LR */
" str lr, [sp, #0]\n" /* Save LR on the stack */
" mov ip0, x0\n" /* IP=sighand */
" mov x0, x1\n" /* R0=signo */
@@ -80,7 +80,7 @@ static void sig_trampoline(void)
" mov x2, x3\n" /* R2=ucontext */
" blr ip0\n" /* Call the signal handler */
" ldr lr, [sp, #0]\n" /* Recover LR in R2 */
" add sp, sp, #8\n" /* Destroy the stack frame */
" add sp, sp, #16\n" /* Destroy the stack frame */
" mov x0, %0\n" /* SYS_signal_handler_return */
" svc %1\n" /* Return from the SYSCALL */
: