OLD | NEW |
1 /* Copyright (c) 2005-2011, Google Inc. | 1 /* Copyright (c) 2005-2011, Google Inc. |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 #endif | 1793 #endif |
1794 #undef LSS_BODY | 1794 #undef LSS_BODY |
1795 #define LSS_BODY(type,name, ...) \ | 1795 #define LSS_BODY(type,name, ...) \ |
1796 long __res; \ | 1796 long __res; \ |
1797 __asm__ __volatile__(LSS_ENTRYPOINT \ | 1797 __asm__ __volatile__(LSS_ENTRYPOINT \ |
1798 : "=a" (__res) : "0" (__NR_##name), \ | 1798 : "=a" (__res) : "0" (__NR_##name), \ |
1799 ##__VA_ARGS__ : "r11", "rcx", "memory"); \ | 1799 ##__VA_ARGS__ : "r11", "rcx", "memory"); \ |
1800 LSS_RETURN(type, __res) | 1800 LSS_RETURN(type, __res) |
1801 #undef _syscall0 | 1801 #undef _syscall0 |
1802 #define _syscall0(type,name) \ | 1802 #define _syscall0(type,name) \ |
1803 type LSS_NAME(name)() { \ | 1803 type LSS_NAME(name)(void) { \ |
1804 LSS_BODY(type, name); \ | 1804 LSS_BODY(type, name); \ |
1805 } | 1805 } |
1806 #undef _syscall1 | 1806 #undef _syscall1 |
1807 #define _syscall1(type,name,type1,arg1) \ | 1807 #define _syscall1(type,name,type1,arg1) \ |
1808 type LSS_NAME(name)(type1 arg1) { \ | 1808 type LSS_NAME(name)(type1 arg1) { \ |
1809 LSS_BODY(type, name, "D" ((long)(arg1))); \ | 1809 LSS_BODY(type, name, "D" ((long)(arg1))); \ |
1810 } | 1810 } |
1811 #undef _syscall2 | 1811 #undef _syscall2 |
1812 #define _syscall2(type,name,type1,arg1,type2,arg2) \ | 1812 #define _syscall2(type,name,type1,arg1,type2,arg2) \ |
1813 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ | 1813 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 #undef LSS_BODY | 1962 #undef LSS_BODY |
1963 #define LSS_BODY(type,name,args...) \ | 1963 #define LSS_BODY(type,name,args...) \ |
1964 register long __res_r0 __asm__("r0"); \ | 1964 register long __res_r0 __asm__("r0"); \ |
1965 long __res; \ | 1965 long __res; \ |
1966 __asm__ __volatile__ (__syscall(name) \ | 1966 __asm__ __volatile__ (__syscall(name) \ |
1967 : "=r"(__res_r0) : args : "lr", "memory"); \ | 1967 : "=r"(__res_r0) : args : "lr", "memory"); \ |
1968 __res = __res_r0; \ | 1968 __res = __res_r0; \ |
1969 LSS_RETURN(type, __res) | 1969 LSS_RETURN(type, __res) |
1970 #undef _syscall0 | 1970 #undef _syscall0 |
1971 #define _syscall0(type, name) \ | 1971 #define _syscall0(type, name) \ |
1972 type LSS_NAME(name)() { \ | 1972 type LSS_NAME(name)(void) { \ |
1973 LSS_BODY(type, name); \ | 1973 LSS_BODY(type, name); \ |
1974 } | 1974 } |
1975 #undef _syscall1 | 1975 #undef _syscall1 |
1976 #define _syscall1(type, name, type1, arg1) \ | 1976 #define _syscall1(type, name, type1, arg1) \ |
1977 type LSS_NAME(name)(type1 arg1) { \ | 1977 type LSS_NAME(name)(type1 arg1) { \ |
1978 LSS_REG(0, arg1); LSS_BODY(type, name, "r"(__r0)); \ | 1978 LSS_REG(0, arg1); LSS_BODY(type, name, "r"(__r0)); \ |
1979 } | 1979 } |
1980 #undef _syscall2 | 1980 #undef _syscall2 |
1981 #define _syscall2(type, name, type1, arg1, type2, arg2) \ | 1981 #define _syscall2(type, name, type1, arg1, type2, arg2) \ |
1982 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ | 1982 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 "mov r7, %1\n" \ | 2088 "mov r7, %1\n" \ |
2089 "swi 0x0\n" \ | 2089 "swi 0x0\n" \ |
2090 "pop {r7}\n" \ | 2090 "pop {r7}\n" \ |
2091 : "=r"(__res_r0) \ | 2091 : "=r"(__res_r0) \ |
2092 : "i"(__NR_##name) , ## args \ | 2092 : "i"(__NR_##name) , ## args \ |
2093 : "lr", "memory"); \ | 2093 : "lr", "memory"); \ |
2094 __res = __res_r0; \ | 2094 __res = __res_r0; \ |
2095 LSS_RETURN(type, __res) | 2095 LSS_RETURN(type, __res) |
2096 #undef _syscall0 | 2096 #undef _syscall0 |
2097 #define _syscall0(type, name) \ | 2097 #define _syscall0(type, name) \ |
2098 type LSS_NAME(name)() { \ | 2098 type LSS_NAME(name)(void) { \ |
2099 LSS_BODY(type, name); \ | 2099 LSS_BODY(type, name); \ |
2100 } | 2100 } |
2101 #undef _syscall1 | 2101 #undef _syscall1 |
2102 #define _syscall1(type, name, type1, arg1) \ | 2102 #define _syscall1(type, name, type1, arg1) \ |
2103 type LSS_NAME(name)(type1 arg1) { \ | 2103 type LSS_NAME(name)(type1 arg1) { \ |
2104 LSS_REG(0, arg1); LSS_BODY(type, name, "r"(__r0)); \ | 2104 LSS_REG(0, arg1); LSS_BODY(type, name, "r"(__r0)); \ |
2105 } | 2105 } |
2106 #undef _syscall2 | 2106 #undef _syscall2 |
2107 #define _syscall2(type, name, type1, arg1, type2, arg2) \ | 2107 #define _syscall2(type, name, type1, arg1, type2, arg2) \ |
2108 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ | 2108 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 register unsigned long __v0 __asm__("$2") = __NR_##name; \ | 2238 register unsigned long __v0 __asm__("$2") = __NR_##name; \ |
2239 __asm__ __volatile__ ("syscall\n" \ | 2239 __asm__ __volatile__ ("syscall\n" \ |
2240 : "+r"(__v0), r7 (__r7) \ | 2240 : "+r"(__v0), r7 (__r7) \ |
2241 : "0"(__v0), ##__VA_ARGS__ \ | 2241 : "0"(__v0), ##__VA_ARGS__ \ |
2242 : "$8", "$9", "$10", "$11", "$12", \ | 2242 : "$8", "$9", "$10", "$11", "$12", \ |
2243 "$13", "$14", "$15", "$24", "$25", \ | 2243 "$13", "$14", "$15", "$24", "$25", \ |
2244 "memory"); \ | 2244 "memory"); \ |
2245 LSS_RETURN(type, __v0, __r7) | 2245 LSS_RETURN(type, __v0, __r7) |
2246 #undef _syscall0 | 2246 #undef _syscall0 |
2247 #define _syscall0(type, name) \ | 2247 #define _syscall0(type, name) \ |
2248 type LSS_NAME(name)() { \ | 2248 type LSS_NAME(name)(void) { \ |
2249 register unsigned long __r7 __asm__("$7"); \ | 2249 register unsigned long __r7 __asm__("$7"); \ |
2250 LSS_BODY(type, name, "=r"); \ | 2250 LSS_BODY(type, name, "=r"); \ |
2251 } | 2251 } |
2252 #undef _syscall1 | 2252 #undef _syscall1 |
2253 #define _syscall1(type, name, type1, arg1) \ | 2253 #define _syscall1(type, name, type1, arg1) \ |
2254 type LSS_NAME(name)(type1 arg1) { \ | 2254 type LSS_NAME(name)(type1 arg1) { \ |
2255 register unsigned long __r7 __asm__("$7"); \ | 2255 register unsigned long __r7 __asm__("$7"); \ |
2256 LSS_REG(4, arg1); LSS_BODY(type, name, "=r", "r"(__r4)); \ | 2256 LSS_REG(4, arg1); LSS_BODY(type, name, "=r", "r"(__r4)); \ |
2257 } | 2257 } |
2258 #undef _syscall2 | 2258 #undef _syscall2 |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3389 LSS_INLINE int LSS_NAME(fstatfs64)(int f,struct kernel_statfs64 *b) { | 3389 LSS_INLINE int LSS_NAME(fstatfs64)(int f,struct kernel_statfs64 *b) { |
3390 return LSS_NAME(_fstatfs64)(f, sizeof(*b), b); | 3390 return LSS_NAME(_fstatfs64)(f, sizeof(*b), b); |
3391 } | 3391 } |
3392 #endif | 3392 #endif |
3393 | 3393 |
3394 LSS_INLINE int LSS_NAME(execv)(const char *path, const char *const argv[]) { | 3394 LSS_INLINE int LSS_NAME(execv)(const char *path, const char *const argv[]) { |
3395 extern char **environ; | 3395 extern char **environ; |
3396 return LSS_NAME(execve)(path, argv, (const char *const *)environ); | 3396 return LSS_NAME(execve)(path, argv, (const char *const *)environ); |
3397 } | 3397 } |
3398 | 3398 |
3399 LSS_INLINE pid_t LSS_NAME(gettid)() { | 3399 LSS_INLINE pid_t LSS_NAME(gettid)(void) { |
3400 pid_t tid = LSS_NAME(_gettid)(); | 3400 pid_t tid = LSS_NAME(_gettid)(); |
3401 if (tid != -1) { | 3401 if (tid != -1) { |
3402 return tid; | 3402 return tid; |
3403 } | 3403 } |
3404 return LSS_NAME(getpid)(); | 3404 return LSS_NAME(getpid)(); |
3405 } | 3405 } |
3406 | 3406 |
3407 LSS_INLINE void *LSS_NAME(mremap)(void *old_address, size_t old_size, | 3407 LSS_INLINE void *LSS_NAME(mremap)(void *old_address, size_t old_size, |
3408 size_t new_size, int flags, ...) { | 3408 size_t new_size, int flags, ...) { |
3409 va_list ap; | 3409 va_list ap; |
(...skipping 26 matching lines...) Expand all Loading... |
3436 if (LSS_ERRNO == ENOSYS) | 3436 if (LSS_ERRNO == ENOSYS) |
3437 LSS_NAME(kill)(pid, SIGCONT); | 3437 LSS_NAME(kill)(pid, SIGCONT); |
3438 LSS_ERRNO = err; | 3438 LSS_ERRNO = err; |
3439 return rc; | 3439 return rc; |
3440 } | 3440 } |
3441 | 3441 |
3442 LSS_INLINE int LSS_NAME(raise)(int sig) { | 3442 LSS_INLINE int LSS_NAME(raise)(int sig) { |
3443 return LSS_NAME(kill)(LSS_NAME(getpid)(), sig); | 3443 return LSS_NAME(kill)(LSS_NAME(getpid)(), sig); |
3444 } | 3444 } |
3445 | 3445 |
3446 LSS_INLINE int LSS_NAME(setpgrp)() { | 3446 LSS_INLINE int LSS_NAME(setpgrp)(void) { |
3447 return LSS_NAME(setpgid)(0, 0); | 3447 return LSS_NAME(setpgid)(0, 0); |
3448 } | 3448 } |
3449 | 3449 |
3450 LSS_INLINE int LSS_NAME(sysconf)(int name) { | 3450 LSS_INLINE int LSS_NAME(sysconf)(int name) { |
3451 extern int __getpagesize(void); | 3451 extern int __getpagesize(void); |
3452 switch (name) { | 3452 switch (name) { |
3453 case _SC_OPEN_MAX: { | 3453 case _SC_OPEN_MAX: { |
3454 struct kernel_rlimit limit; | 3454 struct kernel_rlimit limit; |
3455 #if defined(__ARM_EABI__) | 3455 #if defined(__ARM_EABI__) |
3456 return LSS_NAME(ugetrlimit)(RLIMIT_NOFILE, &limit) < 0 | 3456 return LSS_NAME(ugetrlimit)(RLIMIT_NOFILE, &limit) < 0 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3538 # pragma pop_macro("fstat64") | 3538 # pragma pop_macro("fstat64") |
3539 # pragma pop_macro("lstat64") | 3539 # pragma pop_macro("lstat64") |
3540 #endif | 3540 #endif |
3541 | 3541 |
3542 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) | 3542 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) |
3543 } | 3543 } |
3544 #endif | 3544 #endif |
3545 | 3545 |
3546 #endif | 3546 #endif |
3547 #endif | 3547 #endif |
OLD | NEW |