diff options
| -rw-r--r-- | arch/mips/syscall_arch.h | 39 | 
1 files changed, 33 insertions, 6 deletions
diff --git a/arch/mips/syscall_arch.h b/arch/mips/syscall_arch.h index 01de67b8..3b33ce18 100644 --- a/arch/mips/syscall_arch.h +++ b/arch/mips/syscall_arch.h @@ -3,8 +3,6 @@  ((union { long long ll; long l[2]; }){ .ll = x }).l[1]  #define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) -hidden long (__syscall)(long, ...); -  #define SYSCALL_RLIM_INFINITY (-1UL/2)  #if _MIPSEL || __MIPSEL || __MIPSEL__ @@ -104,8 +102,22 @@ static inline long __syscall4(long n, long a, long b, long c, long d)  static inline long __syscall5(long n, long a, long b, long c, long d, long e)  { -	long r2 = (__syscall)(n, a, b, c, d, e); -	if (r2 > -4096UL) return r2; +	register long r4 __asm__("$4") = a; +	register long r5 __asm__("$5") = b; +	register long r6 __asm__("$6") = c; +	register long r7 __asm__("$7") = d; +	register long r8 __asm__("$8") = e; +	register long r2 __asm__("$2"); +	__asm__ __volatile__ ( +		"subu $sp,$sp,32 ; sw $8,16($sp) ; " +		"addu $2,$0,%3 ; syscall ;" +		"addu $sp,$sp,32" +		: "=&r"(r2), "=r"(r7), "+r"(r8) +		: "ir"(n), "0"(r2), "1"(r7), "r"(r4), "r"(r5), "r"(r6) +		: "$1", "$3", "$9", "$10", "$11", "$12", "$13", +		  "$14", "$15", "$24", "$25", "hi", "lo", "memory"); +	if (r7) return -r2; +	long ret = r2;  	if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);  	if (n == SYS_fstatat64) __stat_fix(c);  	return r2; @@ -113,8 +125,23 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)  static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)  { -	long r2 = (__syscall)(n, a, b, c, d, e, f); -	if (r2 > -4096UL) return r2; +	register long r4 __asm__("$4") = a; +	register long r5 __asm__("$5") = b; +	register long r6 __asm__("$6") = c; +	register long r7 __asm__("$7") = d; +	register long r8 __asm__("$8") = e; +	register long r9 __asm__("$9") = f; +	register long r2 __asm__("$2"); +	__asm__ __volatile__ ( +		"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; " +		"addu $2,$0,%4 ; syscall ;" +		"addu $sp,$sp,32" +		: "=&r"(r2), "=r"(r7), "+r"(r8), "+r"(r9) +		: "ir"(n), "0"(r2), "1"(r7), "r"(r4), "r"(r5), "r"(r6) +		: "$1", "$3", "$10", "$11", "$12", "$13", +		  "$14", "$15", "$24", "$25", "hi", "lo", "memory"); +	if (r7) return -r2; +	long ret = r2;  	if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);  	if (n == SYS_fstatat64) __stat_fix(c);  	return r2;  | 
