diff options
author | Rich Felker <dalias@aerifal.cx> | 2019-04-10 20:11:19 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-04-10 20:11:19 -0400 |
commit | 788d5e24ca19c6291cebd8d1ad5b5ed6abf42665 (patch) | |
tree | 1ae614424b48069950baec8ae09699d750fe3414 /src | |
parent | 1bcdaeee6e659f1d856717c9aa562a068f2f3bd4 (diff) | |
download | musl-788d5e24ca19c6291cebd8d1ad5b5ed6abf42665.tar.gz musl-788d5e24ca19c6291cebd8d1ad5b5ed6abf42665.tar.bz2 musl-788d5e24ca19c6291cebd8d1ad5b5ed6abf42665.tar.xz musl-788d5e24ca19c6291cebd8d1ad5b5ed6abf42665.zip |
remove external __syscall function and last remaining users
the weak version of __syscall_cp_c was using a tail call to __syscall
to avoid duplicating the 6-argument syscall code inline in small
static-linked programs, but now that __syscall no longer exists, the
inline expansion is no longer duplication.
the syscall.h machinery suppported up to 7 syscall arguments, only via
an external __syscall function, but we presently have no syscall call
points that actually make use of that many, and the kernel only
defines 7-argument calling conventions for arm, powerpc (32-bit), and
sh. if it turns out we need them in the future, they can easily be
added.
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/aarch64/syscall.s | 14 | ||||
-rw-r--r-- | src/internal/arm/syscall.s | 15 | ||||
-rw-r--r-- | src/internal/i386/syscall.s | 21 | ||||
-rw-r--r-- | src/internal/m68k/syscall.s | 9 | ||||
-rw-r--r-- | src/internal/microblaze/syscall.s | 14 | ||||
-rw-r--r-- | src/internal/mips/syscall.s | 26 | ||||
-rw-r--r-- | src/internal/mips64/syscall.s | 19 | ||||
-rw-r--r-- | src/internal/mipsn32/syscall.s | 19 | ||||
-rw-r--r-- | src/internal/or1k/syscall.s | 14 | ||||
-rw-r--r-- | src/internal/powerpc/syscall.s | 19 | ||||
-rw-r--r-- | src/internal/powerpc64/syscall.s | 17 | ||||
-rw-r--r-- | src/internal/s390x/syscall.s | 15 | ||||
-rw-r--r-- | src/internal/sh/syscall.s | 23 | ||||
-rw-r--r-- | src/internal/syscall.c | 0 | ||||
-rw-r--r-- | src/internal/syscall.h | 13 | ||||
-rw-r--r-- | src/internal/x32/syscall.s | 13 | ||||
-rw-r--r-- | src/internal/x86_64/syscall.s | 13 | ||||
-rw-r--r-- | src/thread/__syscall_cp.c | 2 |
18 files changed, 2 insertions, 264 deletions
diff --git a/src/internal/aarch64/syscall.s b/src/internal/aarch64/syscall.s deleted file mode 100644 index 845986bf..00000000 --- a/src/internal/aarch64/syscall.s +++ /dev/null @@ -1,14 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall,%function -__syscall: - uxtw x8,w0 - mov x0,x1 - mov x1,x2 - mov x2,x3 - mov x3,x4 - mov x4,x5 - mov x5,x6 - mov x6,x7 - svc 0 - ret diff --git a/src/internal/arm/syscall.s b/src/internal/arm/syscall.s deleted file mode 100644 index 64dba2fc..00000000 --- a/src/internal/arm/syscall.s +++ /dev/null @@ -1,15 +0,0 @@ -.syntax unified -.global __syscall -.hidden __syscall -.type __syscall,%function -__syscall: - mov ip,sp - stmfd sp!,{r4,r5,r6,r7} - mov r7,r0 - mov r0,r1 - mov r1,r2 - mov r2,r3 - ldmfd ip,{r3,r4,r5,r6} - svc 0 - ldmfd sp!,{r4,r5,r6,r7} - bx lr diff --git a/src/internal/i386/syscall.s b/src/internal/i386/syscall.s deleted file mode 100644 index 004ddfef..00000000 --- a/src/internal/i386/syscall.s +++ /dev/null @@ -1,21 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall,@function -__syscall: - push %ebx - push %esi - push %edi - push %ebp - mov 20(%esp),%eax - mov 24(%esp),%ebx - mov 28(%esp),%ecx - mov 32(%esp),%edx - mov 36(%esp),%esi - mov 40(%esp),%edi - mov 44(%esp),%ebp - call *%gs:16 - pop %ebp - pop %edi - pop %esi - pop %ebx - ret diff --git a/src/internal/m68k/syscall.s b/src/internal/m68k/syscall.s deleted file mode 100644 index 9972a34d..00000000 --- a/src/internal/m68k/syscall.s +++ /dev/null @@ -1,9 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall,%function -__syscall: - movem.l %d2-%d5,-(%sp) - movem.l 20(%sp),%d0-%d5/%a0 - trap #0 - movem.l (%sp)+,%d2-%d5 - rts diff --git a/src/internal/microblaze/syscall.s b/src/internal/microblaze/syscall.s deleted file mode 100644 index e0312e78..00000000 --- a/src/internal/microblaze/syscall.s +++ /dev/null @@ -1,14 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall,@function -__syscall: - addi r12, r5, 0 # Save the system call number - add r5, r6, r0 # Shift the arguments, arg1 - add r6, r7, r0 # arg2 - add r7, r8, r0 # arg3 - add r8, r9, r0 # arg4 - add r9, r10, r0 # arg5 - lwi r10, r1, 28 # Get arg6. - brki r14, 0x8 # syscall - rtsd r15, 8 - nop diff --git a/src/internal/mips/syscall.s b/src/internal/mips/syscall.s deleted file mode 100644 index 5d0def52..00000000 --- a/src/internal/mips/syscall.s +++ /dev/null @@ -1,26 +0,0 @@ -.set noreorder - -.global __syscall -.hidden __syscall -.type __syscall,@function -__syscall: - 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) - sw $10,24($sp) - sw $2 ,28($sp) - lw $2, 28($sp) - syscall - beq $7, $0, 1f - addu $sp, $sp, 32 - subu $2, $0, $2 -1: jr $ra - nop diff --git a/src/internal/mips64/syscall.s b/src/internal/mips64/syscall.s deleted file mode 100644 index 98448667..00000000 --- a/src/internal/mips64/syscall.s +++ /dev/null @@ -1,19 +0,0 @@ -.set noreorder -.global __syscall -.hidden __syscall -.type __syscall,@function -__syscall: - move $2, $4 - move $4, $5 - move $5, $6 - move $6, $7 - move $7, $8 - move $8, $9 - move $9, $10 - move $10, $11 - syscall - beq $7, $0, 1f - nop - dsubu $2, $0, $2 -1: jr $ra - nop diff --git a/src/internal/mipsn32/syscall.s b/src/internal/mipsn32/syscall.s deleted file mode 100644 index 510a6fa4..00000000 --- a/src/internal/mipsn32/syscall.s +++ /dev/null @@ -1,19 +0,0 @@ -.set noreorder -.global __syscall -.hidden __syscall -.type __syscall,@function -__syscall: - move $2, $4 - move $4, $5 - move $5, $6 - move $6, $7 - move $7, $8 - move $8, $9 - move $9, $10 - move $10, $11 - syscall - beq $7, $0, 1f - nop - subu $2, $0, $2 -1: jr $ra - nop diff --git a/src/internal/or1k/syscall.s b/src/internal/or1k/syscall.s deleted file mode 100644 index 177964e9..00000000 --- a/src/internal/or1k/syscall.s +++ /dev/null @@ -1,14 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall,@function -__syscall: - l.ori r11, r3, 0 - l.lwz r3, 0(r1) - l.lwz r4, 4(r1) - l.lwz r5, 8(r1) - l.lwz r6, 12(r1) - l.lwz r7, 16(r1) - l.lwz r8, 20(r1) - l.sys 1 - l.jr r9 - l.nop diff --git a/src/internal/powerpc/syscall.s b/src/internal/powerpc/syscall.s deleted file mode 100644 index 5b16b8f2..00000000 --- a/src/internal/powerpc/syscall.s +++ /dev/null @@ -1,19 +0,0 @@ - .global __syscall - .hidden __syscall - .type __syscall,@function -__syscall: - mr 0, 3 # Save the system call number - mr 3, 4 # Shift the arguments: arg1 - mr 4, 5 # arg2 - mr 5, 6 # arg3 - mr 6, 7 # arg4 - mr 7, 8 # arg5 - mr 8, 9 # arg6 - sc - bnslr+ # return if not summary overflow - #else error: - # return negated value. - neg 3, 3 - blr - .end __syscall - .size __syscall, .-__syscall diff --git a/src/internal/powerpc64/syscall.s b/src/internal/powerpc64/syscall.s deleted file mode 100644 index fe21f9e1..00000000 --- a/src/internal/powerpc64/syscall.s +++ /dev/null @@ -1,17 +0,0 @@ - .global __syscall - .hidden __syscall - .type __syscall,@function -__syscall: - mr 0, 3 # Save the system call number - mr 3, 4 # Shift the arguments: arg1 - mr 4, 5 # arg2 - mr 5, 6 # arg3 - mr 6, 7 # arg4 - mr 7, 8 # arg5 - mr 8, 9 # arg6 - sc - bnslr+ # return if not summary overflow - neg 3, 3 # otherwise error: return negated value. - blr - .end __syscall - .size __syscall, .-__syscall diff --git a/src/internal/s390x/syscall.s b/src/internal/s390x/syscall.s deleted file mode 100644 index 2322bc36..00000000 --- a/src/internal/s390x/syscall.s +++ /dev/null @@ -1,15 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall, %function -__syscall: - stg %r7, 56(%r15) - lgr %r1, %r2 - lgr %r2, %r3 - lgr %r3, %r4 - lgr %r4, %r5 - lgr %r5, %r6 - lg %r6, 160(%r15) - lg %r7, 168(%r15) - svc 0 - lg %r7, 56(%r15) - br %r14 diff --git a/src/internal/sh/syscall.s b/src/internal/sh/syscall.s deleted file mode 100644 index 331918a5..00000000 --- a/src/internal/sh/syscall.s +++ /dev/null @@ -1,23 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall, @function -__syscall: - ! The kernel syscall entry point documents that the trap number indicates - ! the number of arguments being passed, but it then ignores that information. - ! Since we do not actually know how many arguments are being passed, we will - ! say there are six, since that is the maximum we support here. - mov r4, r3 - mov r5, r4 - mov r6, r5 - mov r7, r6 - mov.l @r15, r7 - mov.l @(4,r15), r0 - mov.l @(8,r15), r1 - trapa #31 - or r0, r0 - or r0, r0 - or r0, r0 - or r0, r0 - or r0, r0 - rts - nop diff --git a/src/internal/syscall.c b/src/internal/syscall.c deleted file mode 100644 index e69de29b..00000000 --- a/src/internal/syscall.c +++ /dev/null diff --git a/src/internal/syscall.h b/src/internal/syscall.h index 06c5527f..2e810db0 100644 --- a/src/internal/syscall.h +++ b/src/internal/syscall.h @@ -22,27 +22,16 @@ typedef long syscall_arg_t; #endif -hidden long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...), +hidden long __syscall_ret(unsigned long), __syscall_cp(syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t, syscall_arg_t); -#ifdef SYSCALL_NO_INLINE -#define __syscall0(n) (__syscall)(n) -#define __syscall1(n,a) (__syscall)(n,__scc(a)) -#define __syscall2(n,a,b) (__syscall)(n,__scc(a),__scc(b)) -#define __syscall3(n,a,b,c) (__syscall)(n,__scc(a),__scc(b),__scc(c)) -#define __syscall4(n,a,b,c,d) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d)) -#define __syscall5(n,a,b,c,d,e) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e)) -#define __syscall6(n,a,b,c,d,e,f) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f)) -#else #define __syscall1(n,a) __syscall1(n,__scc(a)) #define __syscall2(n,a,b) __syscall2(n,__scc(a),__scc(b)) #define __syscall3(n,a,b,c) __syscall3(n,__scc(a),__scc(b),__scc(c)) #define __syscall4(n,a,b,c,d) __syscall4(n,__scc(a),__scc(b),__scc(c),__scc(d)) #define __syscall5(n,a,b,c,d,e) __syscall5(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e)) #define __syscall6(n,a,b,c,d,e,f) __syscall6(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f)) -#endif -#define __syscall7(n,a,b,c,d,e,f,g) (__syscall)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f),__scc(g)) #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,) diff --git a/src/internal/x32/syscall.s b/src/internal/x32/syscall.s deleted file mode 100644 index c4bee804..00000000 --- a/src/internal/x32/syscall.s +++ /dev/null @@ -1,13 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall,@function -__syscall: - movq %rdi,%rax - movq %rsi,%rdi - movq %rdx,%rsi - movq %rcx,%rdx - movq %r8,%r10 - movq %r9,%r8 - movq 8(%rsp),%r9 - syscall - ret diff --git a/src/internal/x86_64/syscall.s b/src/internal/x86_64/syscall.s deleted file mode 100644 index c4bee804..00000000 --- a/src/internal/x86_64/syscall.s +++ /dev/null @@ -1,13 +0,0 @@ -.global __syscall -.hidden __syscall -.type __syscall,@function -__syscall: - movq %rdi,%rax - movq %rsi,%rdi - movq %rdx,%rsi - movq %rcx,%rdx - movq %r8,%r10 - movq %r9,%r8 - movq 8(%rsp),%r9 - syscall - ret diff --git a/src/thread/__syscall_cp.c b/src/thread/__syscall_cp.c index af666f06..42a01674 100644 --- a/src/thread/__syscall_cp.c +++ b/src/thread/__syscall_cp.c @@ -7,7 +7,7 @@ static long sccp(syscall_arg_t nr, syscall_arg_t u, syscall_arg_t v, syscall_arg_t w, syscall_arg_t x, syscall_arg_t y, syscall_arg_t z) { - return (__syscall)(nr, u, v, w, x, y, z); + return __syscall(nr, u, v, w, x, y, z); } weak_alias(sccp, __syscall_cp_c); |