diff options
| author | Vineet Gupta <vgupta@synopsys.com> | 2014-06-26 11:33:31 +0530 | 
|---|---|---|
| committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2014-07-22 09:50:50 +0200 | 
| commit | e16dc639784ffbe64df198f518c433fb14d230e5 (patch) | |
| tree | fb320d120127b580072f68ea83b89f0ba2c18911 | |
| parent | a427368f140f4bc94f806f912286dc1849a9fb93 (diff) | |
ARC: syscalls.h: code-reuse/fix-arg-annotations
- Use syscalls-common.h vers of INTERNAL_SYSCALL / INLINE_SYSCALL_NOERR
- INLINE_SYSCALL takes syscall name (e.g. write)
- {INLINE,INTERNAL}_SYSCALL_NCS macros take syscall num (__NR_write)
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| -rw-r--r-- | libc/sysdeps/linux/arc/bits/syscalls.h | 25 | 
1 files changed, 8 insertions, 17 deletions
diff --git a/libc/sysdeps/linux/arc/bits/syscalls.h b/libc/sysdeps/linux/arc/bits/syscalls.h index 06d2cf926..5da6aadb3 100644 --- a/libc/sysdeps/linux/arc/bits/syscalls.h +++ b/libc/sysdeps/linux/arc/bits/syscalls.h @@ -56,22 +56,19 @@ extern int __syscall_error (int);  #endif /* IS_IN_rtld */ -/* Invoke the syscall and return unprocessed kernel status */ -#define INTERNAL_SYSCALL(nm, err, nr, args...)		\ -	INTERNAL_SYSCALL_NCS(SYS_ify (nm), err, nr, args) -  /* -1 to -1023 as valid error values will suffice for some time */  #define INTERNAL_SYSCALL_ERROR_P(val, err)		\  	((unsigned int) (val) > (unsigned int) -1024)  /* - * Standard sycall wrapper: - *  -"const" syscall number @nm, sets errno, return success/error-codes + * Standard sycall wrapper + *  -Gets syscall name (conv to __NR_xxx) + *  -sets errno, return success/error-codes   */ -#define INLINE_SYSCALL(nm, nr_args, args...)				\ +#define INLINE_SYSCALL(name, nr_args, args...)				\  ({									\  	register int __res __asm__("r0");				\ -	__res = INTERNAL_SYSCALL(nm, , nr_args, args);			\ +	__res = INTERNAL_SYSCALL_NCS(__NR_##name, , nr_args, args);	\  	if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P ((__res), ), 0))	\  	{								\  		ERRNO_ERRANDS(__res);					\ @@ -79,14 +76,12 @@ extern int __syscall_error (int);  	__res;								\  }) -/* Non const syscall number @nm - * Ideally this could be folded within INLINE_SYSCALL with - * __builtin_constant_p in INTERNAL_SYSCALL but that fails for syscall.c +/* variant of INLINE_SYSCALL, gets syscall number   */ -#define INLINE_SYSCALL_NCS(nm, nr_args, args...)			\ +#define INLINE_SYSCALL_NCS(num, nr_args, args...)			\  ({									\  	register int __res __asm__("r0");				\ -	__res = INTERNAL_SYSCALL_NCS(nm, , nr_args, args);		\ +	__res = INTERNAL_SYSCALL_NCS(num, , nr_args, args);		\  	if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P ((__res), ), 0))	\  	{								\  		ERRNO_ERRANDS(__res);					\ @@ -94,10 +89,6 @@ extern int __syscall_error (int);  	__res;								\  }) -#define INLINE_SYSCALL_NOERR(name, nr, args...)				   \ -  ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args);\ -     (int) _inline_sys_result; }) -  /*-------------------------------------------------------------------------   * Mechanics of Trap - specific to ARC700   *  | 
