From a81d061652253a94f0edb37b22020331c06a8b37 Mon Sep 17 00:00:00 2001 From: flysand7 Date: Tue, 12 Sep 2023 02:37:54 +1100 Subject: [PATCH] Fix stack alignment on thread entry --- arch/sysv_x86-64/thread-entry.asm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/sysv_x86-64/thread-entry.asm b/arch/sysv_x86-64/thread-entry.asm index 1a9cf5c..e8395af 100644 --- a/arch/sysv_x86-64/thread-entry.asm +++ b/arch/sysv_x86-64/thread-entry.asm @@ -44,6 +44,8 @@ _rt_thread_start: ; If child, jump to thread function pop rax ; thread_fn pop rdi ; ctx + ; Align the stack + and rsp, -16 call rax ; Make return value the first arg and call thread finish routine mov rdi, rax