aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/traps_64.c
diff options
context:
space:
mode:
authorAlexander van Heukelum <heukelum@mailshack.com>2008-07-01 19:32:04 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-09 02:18:07 -0400
commit13485ab55bc77f02024e80bcca0374950b0becb3 (patch)
tree3f959112d6c70827319a61a415f70e34f79cbbf1 /arch/x86/kernel/traps_64.c
parenta7bbb0ce1d1f956c8491b925c74767adf654f373 (diff)
x86: traps_xx: restructure do_general_protection()
- if (cond) block -> if (!cond) goto end_of_block - local caching of current Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm> Acked-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/traps_64.c')
-rw-r--r--arch/x86/kernel/traps_64.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 1c2d533fe7ff..bc21ddc97a02 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -733,31 +733,34 @@ asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)
733 die(str, regs, error_code); 733 die(str, regs, error_code);
734} 734}
735 735
736asmlinkage void __kprobes do_general_protection(struct pt_regs * regs, 736asmlinkage void __kprobes
737 long error_code) 737do_general_protection(struct pt_regs *regs, long error_code)
738{ 738{
739 struct task_struct *tsk = current; 739 struct task_struct *tsk;
740 740
741 conditional_sti(regs); 741 conditional_sti(regs);
742 742
743 if (user_mode(regs)) { 743 tsk = current;
744 tsk->thread.error_code = error_code; 744 if (!user_mode(regs))
745 tsk->thread.trap_no = 13; 745 goto gp_in_kernel;
746
747 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
748 printk_ratelimit()) {
749 printk(KERN_INFO
750 "%s[%d] general protection ip:%lx sp:%lx error:%lx",
751 tsk->comm, tsk->pid,
752 regs->ip, regs->sp, error_code);
753 print_vma_addr(" in ", regs->ip);
754 printk("\n");
755 }
756 746
757 force_sig(SIGSEGV, tsk); 747 tsk->thread.error_code = error_code;
758 return; 748 tsk->thread.trap_no = 13;
759 } 749
750 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
751 printk_ratelimit()) {
752 printk(KERN_INFO
753 "%s[%d] general protection ip:%lx sp:%lx error:%lx",
754 tsk->comm, tsk->pid,
755 regs->ip, regs->sp, error_code);
756 print_vma_addr(" in ", regs->ip);
757 printk("\n");
758 }
759
760 force_sig(SIGSEGV, tsk);
761 return;
760 762
763gp_in_kernel:
761 if (fixup_exception(regs)) 764 if (fixup_exception(regs))
762 return; 765 return;
763 766