aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/include/asm/compat.h')
-rw-r--r--arch/s390/include/asm/compat.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index de065b32381a..01a08020bc0e 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -5,6 +5,7 @@
5 */ 5 */
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/thread_info.h>
8 9
9#define PSW32_MASK_PER 0x40000000UL 10#define PSW32_MASK_PER 0x40000000UL
10#define PSW32_MASK_DAT 0x04000000UL 11#define PSW32_MASK_DAT 0x04000000UL
@@ -163,12 +164,28 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
163 return (u32)(unsigned long)uptr; 164 return (u32)(unsigned long)uptr;
164} 165}
165 166
167#ifdef CONFIG_COMPAT
168
169static inline int is_compat_task(void)
170{
171 return test_thread_flag(TIF_31BIT);
172}
173
174#else
175
176static inline int is_compat_task(void)
177{
178 return 0;
179}
180
181#endif
182
166static inline void __user *compat_alloc_user_space(long len) 183static inline void __user *compat_alloc_user_space(long len)
167{ 184{
168 unsigned long stack; 185 unsigned long stack;
169 186
170 stack = KSTK_ESP(current); 187 stack = KSTK_ESP(current);
171 if (test_thread_flag(TIF_31BIT)) 188 if (is_compat_task())
172 stack &= 0x7fffffffUL; 189 stack &= 0x7fffffffUL;
173 return (void __user *) (stack - len); 190 return (void __user *) (stack - len);
174} 191}