diff options
Diffstat (limited to 'include/linux/compat.h')
-rw-r--r-- | include/linux/compat.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h index 9847c5a013c3..2d85ec5cfda2 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -24,6 +24,17 @@ | |||
24 | #include <asm/siginfo.h> | 24 | #include <asm/siginfo.h> |
25 | #include <asm/signal.h> | 25 | #include <asm/signal.h> |
26 | 26 | ||
27 | #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER | ||
28 | /* | ||
29 | * It may be useful for an architecture to override the definitions of the | ||
30 | * COMPAT_SYSCALL_DEFINE0 and COMPAT_SYSCALL_DEFINEx() macros, in particular | ||
31 | * to use a different calling convention for syscalls. To allow for that, | ||
32 | + the prototypes for the compat_sys_*() functions below will *not* be included | ||
33 | * if CONFIG_ARCH_HAS_SYSCALL_WRAPPER is enabled. | ||
34 | */ | ||
35 | #include <asm/syscall_wrapper.h> | ||
36 | #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */ | ||
37 | |||
27 | #ifndef COMPAT_USE_64BIT_TIME | 38 | #ifndef COMPAT_USE_64BIT_TIME |
28 | #define COMPAT_USE_64BIT_TIME 0 | 39 | #define COMPAT_USE_64BIT_TIME 0 |
29 | #endif | 40 | #endif |
@@ -32,10 +43,12 @@ | |||
32 | #define __SC_DELOUSE(t,v) ((__force t)(unsigned long)(v)) | 43 | #define __SC_DELOUSE(t,v) ((__force t)(unsigned long)(v)) |
33 | #endif | 44 | #endif |
34 | 45 | ||
46 | #ifndef COMPAT_SYSCALL_DEFINE0 | ||
35 | #define COMPAT_SYSCALL_DEFINE0(name) \ | 47 | #define COMPAT_SYSCALL_DEFINE0(name) \ |
36 | asmlinkage long compat_sys_##name(void); \ | 48 | asmlinkage long compat_sys_##name(void); \ |
37 | ALLOW_ERROR_INJECTION(compat_sys_##name, ERRNO); \ | 49 | ALLOW_ERROR_INJECTION(compat_sys_##name, ERRNO); \ |
38 | asmlinkage long compat_sys_##name(void) | 50 | asmlinkage long compat_sys_##name(void) |
51 | #endif /* COMPAT_SYSCALL_DEFINE0 */ | ||
39 | 52 | ||
40 | #define COMPAT_SYSCALL_DEFINE1(name, ...) \ | 53 | #define COMPAT_SYSCALL_DEFINE1(name, ...) \ |
41 | COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) | 54 | COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) |
@@ -50,6 +63,7 @@ | |||
50 | #define COMPAT_SYSCALL_DEFINE6(name, ...) \ | 63 | #define COMPAT_SYSCALL_DEFINE6(name, ...) \ |
51 | COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) | 64 | COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) |
52 | 65 | ||
66 | #ifndef COMPAT_SYSCALL_DEFINEx | ||
53 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | 67 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ |
54 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ | 68 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ |
55 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ | 69 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ |
@@ -62,6 +76,7 @@ | |||
62 | return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ | 76 | return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ |
63 | } \ | 77 | } \ |
64 | static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) | 78 | static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) |
79 | #endif /* COMPAT_SYSCALL_DEFINEx */ | ||
65 | 80 | ||
66 | #ifndef compat_user_stack_pointer | 81 | #ifndef compat_user_stack_pointer |
67 | #define compat_user_stack_pointer() current_user_stack_pointer() | 82 | #define compat_user_stack_pointer() current_user_stack_pointer() |
@@ -517,7 +532,12 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long); | |||
517 | * Please note that these prototypes here are only provided for information | 532 | * Please note that these prototypes here are only provided for information |
518 | * purposes, for static analysis, and for linking from the syscall table. | 533 | * purposes, for static analysis, and for linking from the syscall table. |
519 | * These functions should not be called elsewhere from kernel code. | 534 | * These functions should not be called elsewhere from kernel code. |
535 | * | ||
536 | * As the syscall calling convention may be different from the default | ||
537 | * for architectures overriding the syscall calling convention, do not | ||
538 | * include the prototypes if CONFIG_ARCH_HAS_SYSCALL_WRAPPER is enabled. | ||
520 | */ | 539 | */ |
540 | #ifndef CONFIG_ARCH_HAS_SYSCALL_WRAPPER | ||
521 | asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); | 541 | asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); |
522 | asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr, | 542 | asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr, |
523 | u32 __user *iocb); | 543 | u32 __user *iocb); |
@@ -955,6 +975,8 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr); | |||
955 | /* obsolete: net/socket.c */ | 975 | /* obsolete: net/socket.c */ |
956 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args); | 976 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args); |
957 | 977 | ||
978 | #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */ | ||
979 | |||
958 | 980 | ||
959 | /* | 981 | /* |
960 | * For most but not all architectures, "am I in a compat syscall?" and | 982 | * For most but not all architectures, "am I in a compat syscall?" and |