Browse Source

[LibOS/glibc] Don't ignore redzone in syscall-template.S

For trivial system call, sysdeps/unix/syscall-template.S is used to generate system call stub functions, which ignores redzone.
This commit fixes the issue.
Also use %rcx instead of %rbx without pushq/popq as %rcx is clobbered in system call ABI.

Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
Isaku Yamahata 5 years ago
parent
commit
7dae9d6460
1 changed files with 11 additions and 6 deletions
  1. 11 6
      LibOS/glibc-2.19/syscalldb.h

+ 11 - 6
LibOS/glibc-2.19/syscalldb.h

@@ -5,12 +5,17 @@
 .weak syscalldb
 .type syscalldb, @function
 
-# define SYSCALLDB				\
-    pushq %rbx;					\
-    movq syscalldb@GOTPCREL(%rip), %rbx;	\
-    call *%rbx;					\
-    popq %rbx;
-
+# if defined(PSEUDO) && defined(SYSCALL_NAME) && defined(SYSCALL_SYMBOL)
+#  define SYSCALLDB				\
+    subq $128, %rsp;            \
+    movq syscalldb@GOTPCREL(%rip), %rcx;	\
+    call *%rcx;					\
+    addq $128, %rsp
+# else
+#  define SYSCALLDB				\
+    movq syscalldb@GOTPCREL(%rip), %rcx;	\
+    call *%rcx
+# endif
 
 #else /* !__ASSEMBLER__ */
 asm (