[S390] implement is_compat_task

Implement is_compat_task and use it all over the place.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Heiko Carstens
2009-06-12 10:26:25 +02:00
committed by Martin Schwidefsky
parent d90cbd469c
commit 7757591ab4
7 changed files with 36 additions and 19 deletions

View File

@@ -5,6 +5,7 @@
*/
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/thread_info.h>
#define PSW32_MASK_PER 0x40000000UL
#define PSW32_MASK_DAT 0x04000000UL
@@ -163,12 +164,28 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
return (u32)(unsigned long)uptr;
}
#ifdef CONFIG_COMPAT
static inline int is_compat_task(void)
{
return test_thread_flag(TIF_31BIT);
}
#else
static inline int is_compat_task(void)
{
return 0;
}
#endif
static inline void __user *compat_alloc_user_space(long len)
{
unsigned long stack;
stack = KSTK_ESP(current);
if (test_thread_flag(TIF_31BIT))
if (is_compat_task())
stack &= 0x7fffffffUL;
return (void __user *) (stack - len);
}