diff options
Diffstat (limited to 'arch/x86/include/asm/syscall.h')
| -rw-r--r-- | arch/x86/include/asm/syscall.h | 30 | 
1 files changed, 29 insertions, 1 deletions
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h index c4a348f7bd4..d6a756ae04c 100644 --- a/arch/x86/include/asm/syscall.h +++ b/arch/x86/include/asm/syscall.h @@ -13,10 +13,15 @@  #ifndef _ASM_X86_SYSCALL_H  #define _ASM_X86_SYSCALL_H +#include <uapi/linux/audit.h>  #include <linux/sched.h>  #include <linux/err.h> +#include <asm/asm-offsets.h>	/* For NR_syscalls */ +#include <asm/thread_info.h>	/* for TS_COMPAT */ +#include <asm/unistd.h> -extern const unsigned long sys_call_table[]; +typedef void (*sys_call_ptr_t)(void); +extern const sys_call_ptr_t sys_call_table[];  /*   * Only the low 32 bits of orig_ax are meaningful, so we return int. @@ -86,6 +91,11 @@ static inline void syscall_set_arguments(struct task_struct *task,  	memcpy(®s->bx + i, args, n * sizeof(args[0]));  } +static inline int syscall_get_arch(void) +{ +	return AUDIT_ARCH_I386; +} +  #else	 /* CONFIG_X86_64 */  static inline void syscall_get_arguments(struct task_struct *task, @@ -210,6 +220,24 @@ static inline void syscall_set_arguments(struct task_struct *task,  		}  } +static inline int syscall_get_arch(void) +{ +#ifdef CONFIG_IA32_EMULATION +	/* +	 * TS_COMPAT is set for 32-bit syscall entry and then +	 * remains set until we return to user mode. +	 * +	 * TIF_IA32 tasks should always have TS_COMPAT set at +	 * system call time. +	 * +	 * x32 tasks should be considered AUDIT_ARCH_X86_64. +	 */ +	if (task_thread_info(current)->status & TS_COMPAT) +		return AUDIT_ARCH_I386; +#endif +	/* Both x32 and x86_64 are considered "64-bit". */ +	return AUDIT_ARCH_X86_64; +}  #endif	/* CONFIG_X86_32 */  #endif	/* _ASM_X86_SYSCALL_H */  | 
