aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel
diff options
context:
space:
mode:
authorVincent Hanquez <vincent.hanquez@cl.cam.ac.uk>2005-06-23 03:08:46 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:14 -0400
commit76381fee7e8feb4c22be636aa5d4765dbe4fbf9e (patch)
treee12d15d64acb25dc35b4ab9d022314243181bc10 /arch/x86_64/kernel
parente9129e56e9ec50c0689eb4cf7a3ca132f1e776db (diff)
[PATCH] xen: x86_64: use more usermode macro
Make use of the user_mode macro where it's possible. This is useful for Xen because it will need only to redefine only the macro to a hypervisor call. Signed-off-by: Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk> Cc: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel')
-rw-r--r--arch/x86_64/kernel/signal.c2
-rw-r--r--arch/x86_64/kernel/traps.c18
2 files changed, 10 insertions, 10 deletions
diff --git a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c
index 0446e8b96a20..98b7ba95d581 100644
--- a/arch/x86_64/kernel/signal.c
+++ b/arch/x86_64/kernel/signal.c
@@ -422,7 +422,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
422 * kernel mode. Just return without doing anything 422 * kernel mode. Just return without doing anything
423 * if so. 423 * if so.
424 */ 424 */
425 if ((regs->cs & 3) != 3) 425 if (!user_mode(regs))
426 return 1; 426 return 1;
427 427
428 if (try_to_freeze(0)) 428 if (try_to_freeze(0))
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 21706c1a0f95..121646fc43f6 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -274,7 +274,7 @@ EXPORT_SYMBOL(dump_stack);
274void show_registers(struct pt_regs *regs) 274void show_registers(struct pt_regs *regs)
275{ 275{
276 int i; 276 int i;
277 int in_kernel = (regs->cs & 3) == 0; 277 int in_kernel = !user_mode(regs);
278 unsigned long rsp; 278 unsigned long rsp;
279 const int cpu = safe_smp_processor_id(); 279 const int cpu = safe_smp_processor_id();
280 struct task_struct *cur = cpu_pda[cpu].pcurrent; 280 struct task_struct *cur = cpu_pda[cpu].pcurrent;
@@ -318,7 +318,7 @@ void handle_BUG(struct pt_regs *regs)
318 struct bug_frame f; 318 struct bug_frame f;
319 char tmp; 319 char tmp;
320 320
321 if (regs->cs & 3) 321 if (user_mode(regs))
322 return; 322 return;
323 if (__copy_from_user(&f, (struct bug_frame *) regs->rip, 323 if (__copy_from_user(&f, (struct bug_frame *) regs->rip,
324 sizeof(struct bug_frame))) 324 sizeof(struct bug_frame)))
@@ -437,7 +437,7 @@ static void do_trap(int trapnr, int signr, char *str,
437 } 437 }
438#endif 438#endif
439 439
440 if ((regs->cs & 3) != 0) { 440 if (user_mode(regs)) {
441 struct task_struct *tsk = current; 441 struct task_struct *tsk = current;
442 442
443 if (exception_trace && unhandled_signal(tsk, signr)) 443 if (exception_trace && unhandled_signal(tsk, signr))
@@ -522,7 +522,7 @@ asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
522 } 522 }
523#endif 523#endif
524 524
525 if ((regs->cs & 3)!=0) { 525 if (user_mode(regs)) {
526 struct task_struct *tsk = current; 526 struct task_struct *tsk = current;
527 527
528 if (exception_trace && unhandled_signal(tsk, SIGSEGV)) 528 if (exception_trace && unhandled_signal(tsk, SIGSEGV))
@@ -638,7 +638,7 @@ asmlinkage struct pt_regs *sync_regs(struct pt_regs *eregs)
638 if (eregs == (struct pt_regs *)eregs->rsp) 638 if (eregs == (struct pt_regs *)eregs->rsp)
639 ; 639 ;
640 /* Exception from user space */ 640 /* Exception from user space */
641 else if (eregs->cs & 3) 641 else if (user_mode(eregs))
642 regs = ((struct pt_regs *)current->thread.rsp0) - 1; 642 regs = ((struct pt_regs *)current->thread.rsp0) - 1;
643 /* Exception from kernel and interrupts are enabled. Move to 643 /* Exception from kernel and interrupts are enabled. Move to
644 kernel process stack. */ 644 kernel process stack. */
@@ -697,7 +697,7 @@ asmlinkage void do_debug(struct pt_regs * regs, unsigned long error_code)
697 * allowing programs to debug themselves without the ptrace() 697 * allowing programs to debug themselves without the ptrace()
698 * interface. 698 * interface.
699 */ 699 */
700 if ((regs->cs & 3) == 0) 700 if (!user_mode(regs))
701 goto clear_TF_reenable; 701 goto clear_TF_reenable;
702 /* 702 /*
703 * Was the TF flag set by a debugger? If so, clear it now, 703 * Was the TF flag set by a debugger? If so, clear it now,
@@ -715,7 +715,7 @@ asmlinkage void do_debug(struct pt_regs * regs, unsigned long error_code)
715 info.si_signo = SIGTRAP; 715 info.si_signo = SIGTRAP;
716 info.si_errno = 0; 716 info.si_errno = 0;
717 info.si_code = TRAP_BRKPT; 717 info.si_code = TRAP_BRKPT;
718 if ((regs->cs & 3) == 0) 718 if (!user_mode(regs))
719 goto clear_dr7; 719 goto clear_dr7;
720 720
721 info.si_addr = (void __user *)regs->rip; 721 info.si_addr = (void __user *)regs->rip;
@@ -756,7 +756,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
756 unsigned short cwd, swd; 756 unsigned short cwd, swd;
757 757
758 conditional_sti(regs); 758 conditional_sti(regs);
759 if ((regs->cs & 3) == 0 && 759 if (!user_mode(regs) &&
760 kernel_math_error(regs, "kernel x87 math error")) 760 kernel_math_error(regs, "kernel x87 math error"))
761 return; 761 return;
762 762
@@ -822,7 +822,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
822 unsigned short mxcsr; 822 unsigned short mxcsr;
823 823
824 conditional_sti(regs); 824 conditional_sti(regs);
825 if ((regs->cs & 3) == 0 && 825 if (!user_mode(regs) &&
826 kernel_math_error(regs, "kernel simd math error")) 826 kernel_math_error(regs, "kernel simd math error"))
827 return; 827 return;
828 828