提交 ae6578fe 编写于 作者: C Chuck Ebbert 提交者: Linus Torvalds

[PATCH] i386: clean up user_mode macros

 - make the new user_mode() return 0 or 1 (same as x86_64)

 - remove conditional jump from user_mode_vm() it's called every timer
   tick on each CPU on SMP)
Signed-off-by: NChuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 4d7de66e
......@@ -57,14 +57,21 @@ struct pt_regs {
#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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册