platform_bionic/libc/arch-x86/bionic/syscall.S
Jun Nakajima 5288fee835 x86 libc: Fix the range to check the error
The spec says "A value in the range between -4095 to -1 indicates an error" (not -129).
This was pointed out in the comment in 22039.

Change-Id: I11b7c45015a9e4ccf09aed5364a889437eab6ab8
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
2011-06-17 14:37:50 -07:00

46 lines
850 B
ArmAsm

/*
* Generic syscall call.
* Upon entry
* %eax: system call number
* %ebx: arg0 to system call
* %ecx: arg..
* %edx: arg..
* %esi: arg..
* %edi: arg..
* We push these (to save them) load them up with the
* values from the calling frame (not all will actually be valid)
* and make the syscall.
*/
#include <sys/linux-syscalls.h>
.text
.type syscall, @function
.globl syscall
.align 4
syscall:
push %ebx
push %esi
push %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
cmpl $-4095, %eax
jb 1f
negl %eax
pushl %eax
call __set_errno
addl $4, %esp
orl $-1, %eax
1:
pop %edi
pop %esi
pop %ebx
ret