提交 717b594a 编写于 作者: V Vincent Hanquez 提交者: Linus Torvalds

[PATCH] xen: x86: Use more usermode macro

Use the user_mode macro where it's possible.
Signed-off-by: NVincent Hanquez <vincent.hanquez@cl.cam.ac.uk>
Cc: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 fa1e1bdf
...@@ -266,7 +266,7 @@ void show_regs(struct pt_regs * regs) ...@@ -266,7 +266,7 @@ void show_regs(struct pt_regs * regs)
printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id());
print_symbol("EIP is at %s\n", regs->eip); print_symbol("EIP is at %s\n", regs->eip);
if (regs->xcs & 3) if (user_mode(regs))
printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
printk(" EFLAGS: %08lx %s (%s)\n", printk(" EFLAGS: %08lx %s (%s)\n",
regs->eflags, print_tainted(), system_utsname.release); regs->eflags, print_tainted(), system_utsname.release);
......
...@@ -605,7 +605,7 @@ int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset) ...@@ -605,7 +605,7 @@ int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset)
* kernel mode. Just return without doing anything * kernel mode. Just return without doing anything
* if so. * if so.
*/ */
if ((regs->xcs & 3) != 3) if (!user_mode(regs))
return 1; return 1;
if (current->flags & PF_FREEZE) { if (current->flags & PF_FREEZE) {
......
...@@ -210,7 +210,7 @@ void show_registers(struct pt_regs *regs) ...@@ -210,7 +210,7 @@ void show_registers(struct pt_regs *regs)
esp = (unsigned long) (&regs->esp); esp = (unsigned long) (&regs->esp);
ss = __KERNEL_DS; ss = __KERNEL_DS;
if (regs->xcs & 3) { if (user_mode(regs)) {
in_kernel = 0; in_kernel = 0;
esp = regs->esp; esp = regs->esp;
ss = regs->xss & 0xffff; ss = regs->xss & 0xffff;
...@@ -266,7 +266,7 @@ static void handle_BUG(struct pt_regs *regs) ...@@ -266,7 +266,7 @@ static void handle_BUG(struct pt_regs *regs)
char c; char c;
unsigned long eip; unsigned long eip;
if (regs->xcs & 3) if (user_mode(regs))
goto no_bug; /* Not in kernel */ goto no_bug; /* Not in kernel */
eip = regs->eip; eip = regs->eip;
...@@ -354,7 +354,7 @@ void die(const char * str, struct pt_regs * regs, long err) ...@@ -354,7 +354,7 @@ void die(const char * str, struct pt_regs * regs, long err)
static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err) static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err)
{ {
if (!(regs->eflags & VM_MASK) && !(3 & regs->xcs)) if (!user_mode_vm(regs))
die(str, regs, err); die(str, regs, err);
} }
...@@ -367,7 +367,7 @@ static void do_trap(int trapnr, int signr, char *str, int vm86, ...@@ -367,7 +367,7 @@ static void do_trap(int trapnr, int signr, char *str, int vm86,
goto trap_signal; goto trap_signal;
} }
if (!(regs->xcs & 3)) if (!user_mode(regs))
goto kernel_trap; goto kernel_trap;
trap_signal: { trap_signal: {
...@@ -489,7 +489,7 @@ fastcall void do_general_protection(struct pt_regs * regs, long error_code) ...@@ -489,7 +489,7 @@ fastcall void do_general_protection(struct pt_regs * regs, long error_code)
if (regs->eflags & VM_MASK) if (regs->eflags & VM_MASK)
goto gp_in_vm86; goto gp_in_vm86;
if (!(regs->xcs & 3)) if (!user_mode(regs))
goto gp_in_kernel; goto gp_in_kernel;
current->thread.error_code = error_code; current->thread.error_code = error_code;
...@@ -716,7 +716,7 @@ fastcall void do_debug(struct pt_regs * regs, long error_code) ...@@ -716,7 +716,7 @@ fastcall void do_debug(struct pt_regs * regs, long error_code)
* check for kernel mode by just checking the CPL * check for kernel mode by just checking the CPL
* of CS. * of CS.
*/ */
if ((regs->xcs & 3) == 0) if (!user_mode(regs))
goto clear_TF_reenable; goto clear_TF_reenable;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册