diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-23 09:12:59 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-19 18:06:58 -0500 |
| commit | 468366138850f20543f1d4878028900672b23dae (patch) | |
| tree | 89c694a8e8cbf60656ac69a7f783a34d75288c4a | |
| parent | 541880d9a2c7871f6370071d55aa6662d329c51e (diff) | |
COMPAT_SYSCALL_DEFINE: infrastructure
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | arch/s390/include/asm/compat.h | 3 | ||||
| -rw-r--r-- | include/linux/compat.h | 42 |
2 files changed, 45 insertions, 0 deletions
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index 18cd6b59265..f8c6df6cd1f 100644 --- a/arch/s390/include/asm/compat.h +++ b/arch/s390/include/asm/compat.h | |||
| @@ -7,6 +7,9 @@ | |||
| 7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
| 8 | #include <linux/thread_info.h> | 8 | #include <linux/thread_info.h> |
| 9 | 9 | ||
| 10 | #define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p(typeof(0?(t)0:0ULL), u64)) | ||
| 11 | #define __SC_DELOUSE(t,v) (t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)) | ||
| 12 | |||
| 10 | #define PSW32_MASK_PER 0x40000000UL | 13 | #define PSW32_MASK_PER 0x40000000UL |
| 11 | #define PSW32_MASK_DAT 0x04000000UL | 14 | #define PSW32_MASK_DAT 0x04000000UL |
| 12 | #define PSW32_MASK_IO 0x02000000UL | 15 | #define PSW32_MASK_IO 0x02000000UL |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 784ebfe63c4..a7877fa809f 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
| @@ -23,6 +23,48 @@ | |||
| 23 | #define COMPAT_USE_64BIT_TIME 0 | 23 | #define COMPAT_USE_64BIT_TIME 0 |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | #ifndef __SC_DELOUSE | ||
| 27 | #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1) | ||
| 31 | #define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__) | ||
| 32 | #define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__) | ||
| 33 | #define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__) | ||
| 34 | #define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__) | ||
| 35 | #define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__) | ||
| 36 | #define COMPAT_SYSCALL_DEFINE1(name, ...) \ | ||
| 37 | COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) | ||
| 38 | #define COMPAT_SYSCALL_DEFINE2(name, ...) \ | ||
| 39 | COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) | ||
| 40 | #define COMPAT_SYSCALL_DEFINE3(name, ...) \ | ||
| 41 | COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__) | ||
| 42 | #define COMPAT_SYSCALL_DEFINE4(name, ...) \ | ||
| 43 | COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__) | ||
| 44 | #define COMPAT_SYSCALL_DEFINE5(name, ...) \ | ||
| 45 | COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) | ||
| 46 | #define COMPAT_SYSCALL_DEFINE6(name, ...) \ | ||
| 47 | COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) | ||
| 48 | |||
| 49 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS | ||
| 50 | |||
| 51 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | ||
| 52 | asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \ | ||
| 53 | static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ | ||
| 54 | asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \ | ||
| 55 | { \ | ||
| 56 | return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \ | ||
| 57 | } \ | ||
| 58 | SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ | ||
| 59 | static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)) | ||
| 60 | |||
| 61 | #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
| 62 | |||
| 63 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | ||
| 64 | asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)) | ||
| 65 | |||
| 66 | #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
| 67 | |||
| 26 | #define compat_jiffies_to_clock_t(x) \ | 68 | #define compat_jiffies_to_clock_t(x) \ |
| 27 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) | 69 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) |
| 28 | 70 | ||
