Use the kernel's MAX_ERRNO in the syscall stubs.

Bug: http://code.google.com/p/android/issues/detail?id=53104
Change-Id: Iaabf7025b153e96dc5eca231a33a32d4cb7d8116
This commit is contained in:
Elliott Hughes
2013-03-12 14:57:30 -07:00
parent 94a34010c1
commit 9aceab5015
412 changed files with 1459 additions and 847 deletions

View File

@@ -46,6 +46,7 @@ def create_file( relpath ):
#
x86_header = """/* autogenerated by gensyscalls.py */
#include <linux/err.h>
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
@@ -56,7 +57,7 @@ x86_registers = [ "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp" ]
x86_call = """ movl $%(idname)s, %%eax
int $0x80
cmpl $-129, %%eax
cmpl $-MAX_ERRNO, %%eax
jb 1f
negl %%eax
pushl %%eax
@@ -75,6 +76,7 @@ END(%(fname)s)
#
arm_header = """/* autogenerated by gensyscalls.py */
#include <linux/err.h>
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
@@ -86,9 +88,10 @@ arm_eabi_call_default = arm_header + """\
ldr r7, =%(idname)s
swi #0
mov r7, ip
movs r0, r0
bxpl lr
b __set_syscall_errno
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
END(%(fname)s)
"""
@@ -100,9 +103,10 @@ arm_eabi_call_long = arm_header + """\
ldr r7, =%(idname)s
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
cmn r0, #(MAX_ERRNO + 1)
bxls lr
neg r0, r0
b __set_errno
END(%(fname)s)
"""