i386: clean up user_mode macros
Quoted 8 lines · Linus Torvalds
Quoted 6 lines · Chuck Ebbert
Recent patches from the Xen group changed the X86
user_modemacros.This patch does the following:
1. Makes the new
user_mode()return 0 or 1 (same asx86_64)
Quoted 7 lines
I _really_ prefer
x != 0over
!!x
Take 2: compile tested only.
Signed-off-by Chuck Ebbert <[email protected]>
===================================================================
include/asm-i386/ptrace.h +10 -3
@@ -57,14 +57,21 @@#ifdef __KERNEL__struct task_struct ;extern void send_sigtrap (struct task_struct *tsk,struct pt_regs *regs,int error_code); -#define user_mode (regs) (3 & (regs)->xcs) -#define user_mode_vm (regs) ((VM_MASK & (regs)->eflags) || user_mode(regs)) + +static inline int user_mode (struct pt_regs *regs) +{ +return (regs->xcs &3 ) !=0 ; +} +static inline int user_mode_vm (struct pt_regs *regs) +{ +return ((regs->xcs &3 ) | (regs->eflags &VM_MASK )) !=0 ; +}#define instruction_pointer (regs) ((regs)->eip)#if defined(CONFIG_SMP ) && defined(CONFIG_FRAME_POINTER )extern unsigned long profile_pc (struct pt_regs *regs);#else #define profile_pc (regs) instruction_pointer(regs)#endif -#endif +#endif /* __KERNEL__ */ #endif
__
Chuck