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
This commit is contained in:
Kan-Ru Chen 2011-03-29 12:00:38 +08:00 committed by Chih-Wei Huang
parent 0e47a919f4
commit 8488efaa09

View File

@ -20,18 +20,15 @@
.align 4 .align 4
syscall: syscall:
push %eax
push %ebx push %ebx
push %ecx
push %edx
push %esi push %esi
push %edi push %edi
mov 28(%esp),%eax mov 16(%esp),%eax
mov 32(%esp),%ebx mov 20(%esp),%ebx
mov 36(%esp),%ecx mov 24(%esp),%ecx
mov 40(%esp),%edx mov 28(%esp),%edx
mov 44(%esp),%esi mov 32(%esp),%esi
mov 48(%esp),%edi mov 36(%esp),%edi
int $0x80 int $0x80
@ -45,8 +42,5 @@ syscall:
1: 1:
pop %edi pop %edi
pop %esi pop %esi
pop %edx
pop %ecx
pop %ebx pop %ebx
pop %eax
ret ret