aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-01-30 07:34:11 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:11 -0500
commitfd40d6e3188b12c59696d6cb4a6f26333814d66f (patch)
tree501f109ea72beaf113b417feb71746afec18f7a0
parent5b727a3b0158a129827c21ce3bfb0ba997e8ddd0 (diff)
x86: shrink some ifdefs in fault.c
The change from current to tsk in do_page_fault is safe as this is set at the very beginning of the function. Removes a likely() annotation from the 64-bit version, this could have instead been added to 32-bit. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/mm/fault.c43
1 files changed, 14 insertions, 29 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 1c836527dde7..72547a7e32c6 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -378,6 +378,7 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code,
378#ifdef CONFIG_X86_32 378#ifdef CONFIG_X86_32
379 if (!oops_may_print()) 379 if (!oops_may_print())
380 return; 380 return;
381#endif
381 382
382#ifdef CONFIG_X86_PAE 383#ifdef CONFIG_X86_PAE
383 if (error_code & PF_INSTR) { 384 if (error_code & PF_INSTR) {
@@ -390,28 +391,20 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code,
390 "(uid: %d)\n", current->uid); 391 "(uid: %d)\n", current->uid);
391 } 392 }
392#endif 393#endif
393 printk(KERN_ALERT "BUG: unable to handle kernel ");
394 if (address < PAGE_SIZE)
395 printk(KERN_CONT "NULL pointer dereference");
396 else
397 printk(KERN_CONT "paging request");
398 printk(KERN_CONT " at %08lx\n", address);
399 394
400 printk(KERN_ALERT "IP:");
401 printk_address(regs->ip, 1);
402 dump_pagetable(address);
403#else /* CONFIG_X86_64 */
404 printk(KERN_ALERT "BUG: unable to handle kernel "); 395 printk(KERN_ALERT "BUG: unable to handle kernel ");
405 if (address < PAGE_SIZE) 396 if (address < PAGE_SIZE)
406 printk(KERN_CONT "NULL pointer dereference"); 397 printk(KERN_CONT "NULL pointer dereference");
407 else 398 else
408 printk(KERN_CONT "paging request"); 399 printk(KERN_CONT "paging request");
400#ifdef CONFIG_X86_32
401 printk(KERN_CONT " at %08lx\n", address);
402#else
409 printk(KERN_CONT " at %016lx\n", address); 403 printk(KERN_CONT " at %016lx\n", address);
410 404#endif
411 printk(KERN_ALERT "IP:"); 405 printk(KERN_ALERT "IP:");
412 printk_address(regs->ip, 1); 406 printk_address(regs->ip, 1);
413 dump_pagetable(address); 407 dump_pagetable(address);
414#endif
415} 408}
416 409
417#ifdef CONFIG_X86_64 410#ifdef CONFIG_X86_64
@@ -705,11 +698,7 @@ again:
705 vma = find_vma(mm, address); 698 vma = find_vma(mm, address);
706 if (!vma) 699 if (!vma)
707 goto bad_area; 700 goto bad_area;
708#ifdef CONFIG_X86_32
709 if (vma->vm_start <= address) 701 if (vma->vm_start <= address)
710#else
711 if (likely(vma->vm_start <= address))
712#endif
713 goto good_area; 702 goto good_area;
714 if (!(vma->vm_flags & VM_GROWSDOWN)) 703 if (!(vma->vm_flags & VM_GROWSDOWN))
715 goto bad_area; 704 goto bad_area;
@@ -858,23 +847,21 @@ no_context:
858 */ 847 */
859#ifdef CONFIG_X86_32 848#ifdef CONFIG_X86_32
860 bust_spinlocks(1); 849 bust_spinlocks(1);
850#else
851 flags = oops_begin();
852#endif
861 853
862 show_fault_oops(regs, error_code, address); 854 show_fault_oops(regs, error_code, address);
863 855
864 tsk->thread.cr2 = address; 856 tsk->thread.cr2 = address;
865 tsk->thread.trap_no = 14; 857 tsk->thread.trap_no = 14;
866 tsk->thread.error_code = error_code; 858 tsk->thread.error_code = error_code;
859
860#ifdef CONFIG_X86_32
867 die("Oops", regs, error_code); 861 die("Oops", regs, error_code);
868 bust_spinlocks(0); 862 bust_spinlocks(0);
869 do_exit(SIGKILL); 863 do_exit(SIGKILL);
870#else /* CONFIG_X86_64 */ 864#else
871 flags = oops_begin();
872
873 show_fault_oops(regs, error_code, address);
874
875 tsk->thread.cr2 = address;
876 tsk->thread.trap_no = 14;
877 tsk->thread.error_code = error_code;
878 if (__die("Oops", regs, error_code)) 865 if (__die("Oops", regs, error_code))
879 regs = NULL; 866 regs = NULL;
880 /* Executive summary in case the body of the oops scrolled away */ 867 /* Executive summary in case the body of the oops scrolled away */
@@ -888,18 +875,16 @@ no_context:
888 */ 875 */
889out_of_memory: 876out_of_memory:
890 up_read(&mm->mmap_sem); 877 up_read(&mm->mmap_sem);
891#ifdef CONFIG_X86_32
892 if (is_global_init(tsk)) { 878 if (is_global_init(tsk)) {
893 yield(); 879 yield();
880#ifdef CONFIG_X86_32
894 down_read(&mm->mmap_sem); 881 down_read(&mm->mmap_sem);
895 goto survive; 882 goto survive;
896 }
897#else 883#else
898 if (is_global_init(current)) {
899 yield();
900 goto again; 884 goto again;
901 }
902#endif 885#endif
886 }
887
903 printk("VM: killing process %s\n", tsk->comm); 888 printk("VM: killing process %s\n", tsk->comm);
904 if (error_code & PF_USER) 889 if (error_code & PF_USER)
905 do_group_exit(SIGKILL); 890 do_group_exit(SIGKILL);