From 8488efaa0913f8484cbfdb61180e47bc19fff5d8 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Tue, 29 Mar 2011 12:00:38 +0800 Subject: [PATCH] x86 libc: fix the wrong return value of syscall According to Intel ABI spec, there is no need to save %eax, %ecx, %edx on the stack. Worse, popping %eax will wipe out the return value. Change-Id: Ida536c3b98174b8deef88f8f3b9352eaaeb7c0c0 --- libc/arch-x86/bionic/syscall.S | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libc/arch-x86/bionic/syscall.S b/libc/arch-x86/bionic/syscall.S index 71abe6b3f..3cca85c4e 100644 --- a/libc/arch-x86/bionic/syscall.S +++ b/libc/arch-x86/bionic/syscall.S @@ -20,18 +20,15 @@ .align 4 syscall: - push %eax push %ebx - push %ecx - push %edx push %esi push %edi - mov 28(%esp),%eax - mov 32(%esp),%ebx - mov 36(%esp),%ecx - mov 40(%esp),%edx - mov 44(%esp),%esi - mov 48(%esp),%edi + mov 16(%esp),%eax + mov 20(%esp),%ebx + mov 24(%esp),%ecx + mov 28(%esp),%edx + mov 32(%esp),%esi + mov 36(%esp),%edi int $0x80 @@ -45,8 +42,5 @@ syscall: 1: pop %edi pop %esi - pop %edx - pop %ecx pop %ebx - pop %eax ret