diff options
author | rofl0r <retnyg@gmx.net> | 2014-01-07 03:31:34 +0100 |
---|---|---|
committer | rofl0r <retnyg@gmx.net> | 2014-02-22 09:50:39 +0100 |
commit | bf84967cae9a5ef5582f9bbf5a097fb083126e33 (patch) | |
tree | ffede24b7242714f9797d95a7d85552bb2dacc99 /src/internal/syscall.h | |
parent | dc01e2cbfb290198c03514fe51ed32c1098b774f (diff) | |
download | musl-bf84967cae9a5ef5582f9bbf5a097fb083126e33.tar.gz musl-bf84967cae9a5ef5582f9bbf5a097fb083126e33.tar.bz2 musl-bf84967cae9a5ef5582f9bbf5a097fb083126e33.tar.xz musl-bf84967cae9a5ef5582f9bbf5a097fb083126e33.zip |
internal/syscall.h: use a macro for the syscall args casts
this allows syscall_arch.h to define the macro __scc if special
casting is needed, as is the case for x32, where the actual syscall
arguments are 64bit, but, in case of pointers, would get sign-extended
and thus become invalid.
Diffstat (limited to 'src/internal/syscall.h')
-rw-r--r-- | src/internal/syscall.h | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/internal/syscall.h b/src/internal/syscall.h index 8eebe71e..f8d425af 100644 --- a/src/internal/syscall.h +++ b/src/internal/syscall.h @@ -10,13 +10,17 @@ long __syscall_ret(unsigned long), __syscall(long, ...), #include <sys/syscall.h> #include "syscall_arch.h" -#define __syscall1(n,a) __syscall1(n,(long)(a)) -#define __syscall2(n,a,b) __syscall2(n,(long)(a),(long)(b)) -#define __syscall3(n,a,b,c) __syscall3(n,(long)(a),(long)(b),(long)(c)) -#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) +#ifndef __scc +#define __scc(X) (long) (X) +#endif + +#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)) +#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,) @@ -31,12 +35,12 @@ long __syscall_ret(unsigned long), __syscall(long, ...), #define socketcall_cp __socketcall_cp #define __syscall_cp0(n) (__syscall_cp)(n,0,0,0,0,0,0) -#define __syscall_cp1(n,a) (__syscall_cp)(n,(long)(a),0,0,0,0,0) -#define __syscall_cp2(n,a,b) (__syscall_cp)(n,(long)(a),(long)(b),0,0,0,0) -#define __syscall_cp3(n,a,b,c) (__syscall_cp)(n,(long)(a),(long)(b),(long)(c),0,0,0) -#define __syscall_cp4(n,a,b,c,d) (__syscall_cp)(n,(long)(a),(long)(b),(long)(c),(long)(d),0,0) -#define __syscall_cp5(n,a,b,c,d,e) (__syscall_cp)(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),0) -#define __syscall_cp6(n,a,b,c,d,e,f) (__syscall_cp)(n,(long)(a),(long)(b),(long)(c),(long)(d),(long)(e),(long)(f)) +#define __syscall_cp1(n,a) (__syscall_cp)(n,__scc(a),0,0,0,0,0) +#define __syscall_cp2(n,a,b) (__syscall_cp)(n,__scc(a),__scc(b),0,0,0,0) +#define __syscall_cp3(n,a,b,c) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),0,0,0) +#define __syscall_cp4(n,a,b,c,d) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),0,0) +#define __syscall_cp5(n,a,b,c,d,e) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),0) +#define __syscall_cp6(n,a,b,c,d,e,f) (__syscall_cp)(n,__scc(a),__scc(b),__scc(c),__scc(d),__scc(e),__scc(f)) #define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__) #define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__)) |