From 5013f777b5ec638f0c733942325bd33e5f72c27a Mon Sep 17 00:00:00 2001 From: Ziyao Date: Sun, 3 Apr 2022 09:52:17 +0800 Subject: [PATCH] Fix the bug that the modified version of __syscall6() messes up the stack by poping an argument (a6) --- src/internal/x86_64/syscall.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/internal/x86_64/syscall.S b/src/internal/x86_64/syscall.S index c3ba2b6..c614c73 100644 --- a/src/internal/x86_64/syscall.S +++ b/src/internal/x86_64/syscall.S @@ -45,6 +45,8 @@ __syscall6: movq %rcx, %rdx movq %r8, %r10 movq %r9, %r8 - popq %r9 // The last argument is stored on the stack + movq (%rsp), %r9 // The last argument is stored on + // the stack + // But do NOT mess up the stack syscall retq