about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-09-09 14:53:06 -0400
committerRich Felker <dalias@aerifal.cx>2012-09-09 14:53:06 -0400
commit9a3bbce447403d735282586786dc436ec1ffbad4 (patch)
tree5dc2b8d273b394fd8554d15f79aab34dd2d2dd11
parent5e3c243d8df6b1504db9c1e6442d47ed38937e02 (diff)
downloadmusl-9a3bbce447403d735282586786dc436ec1ffbad4.tar.gz
musl-9a3bbce447403d735282586786dc436ec1ffbad4.tar.xz
musl-9a3bbce447403d735282586786dc436ec1ffbad4.zip
add 7-arg syscall support for mips
no syscalls actually use that many arguments; the issue is that some
syscalls with 64-bit arguments have them ordered badly so that
breaking them into aligned 32-bit half-arguments wastes slots with
padding, and a 7th slot is needed for the last argument.
-rw-r--r--src/internal/mips/syscall.s7
-rw-r--r--src/internal/syscall.h5
2 files changed, 8 insertions, 4 deletions
diff --git a/src/internal/mips/syscall.s b/src/internal/mips/syscall.s
index 28575408..e18a382e 100644
--- a/src/internal/mips/syscall.s
+++ b/src/internal/mips/syscall.s
@@ -3,17 +3,20 @@
 .global __syscall
 .type   __syscall,@function
 __syscall:
-	move    $25, $4
+	move    $2, $4
 	move    $4, $5
 	move    $5, $6
 	move    $6, $7
 	lw      $7, 16($sp)
 	lw      $8, 20($sp)
 	lw      $9, 24($sp)
+	lw      $10,28($sp)
 	subu    $sp, $sp, 32
 	sw      $8, 16($sp)
 	sw      $9, 20($sp)
-	move    $2, $25
+	sw      $10,24($sp)
+	sw      $2 ,28($sp)
+	lw      $2, 28($sp)
 	syscall
 	beq     $7, $0, 1f
 	addu    $sp, $sp, 32
diff --git a/src/internal/syscall.h b/src/internal/syscall.h
index ffaf640a..50409ef8 100644
--- a/src/internal/syscall.h
+++ b/src/internal/syscall.h
@@ -14,9 +14,10 @@ long __syscall_cp(long, long, long, long, long, long, long);
 #define __syscall4(n,a,b,c,d) __syscall4(n,(long)(a),(long)(b),(long)(c),(long)(d))
 #define __syscall5(n,a,b,c,d,e) __syscall5(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e))
 #define __syscall6(n,a,b,c,d,e,f) __syscall6(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),(long)(f))
+#define __syscall7(n,a,b,c,d,e,f,g) (__syscall)(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),(long)(f),(long)g)
 
-#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,n,...) n
-#define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,6,5,4,3,2,1,0)
+#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n
+#define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1,0)
 #define __SYSCALL_CONCAT_X(a,b) a##b
 #define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X(a,b)
 #define __SYSCALL_DISP(b,...) __SYSCALL_CONCAT(b,__SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__)