Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[pandora-kernel.git] / arch / mips / mm / fault.c
index 8423d85..521771b 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 #include <linux/vt_kern.h>             /* For unblank_screen() */
 #include <linux/module.h>
 
@@ -40,9 +39,10 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
        struct mm_struct *mm = tsk->mm;
        const int field = sizeof(unsigned long) * 2;
        siginfo_t info;
+       int fault;
 
 #if 0
-       printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", smp_processor_id(),
+       printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", raw_smp_processor_id(),
               current->comm, current->pid, field, address, write,
               field, regs->cp0_epc);
 #endif
@@ -60,6 +60,10 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
         */
        if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END))
                goto vmalloc_fault;
+#ifdef MODULE_START
+       if (unlikely(address >= MODULE_START && address < MODULE_END))
+               goto vmalloc_fault;
+#endif
 
        /*
         * If we're in an interrupt or have no user
@@ -99,20 +103,18 @@ survive:
         * make sure we exit gracefully rather than endlessly redo
         * the fault.
         */
-       switch (handle_mm_fault(mm, vma, address, write)) {
-       case VM_FAULT_MINOR:
-               tsk->min_flt++;
-               break;
-       case VM_FAULT_MAJOR:
-               tsk->maj_flt++;
-               break;
-       case VM_FAULT_SIGBUS:
-               goto do_sigbus;
-       case VM_FAULT_OOM:
-               goto out_of_memory;
-       default:
+       fault = handle_mm_fault(mm, vma, address, write);
+       if (unlikely(fault & VM_FAULT_ERROR)) {
+               if (fault & VM_FAULT_OOM)
+                       goto out_of_memory;
+               else if (fault & VM_FAULT_SIGBUS)
+                       goto do_sigbus;
                BUG();
        }
+       if (fault & VM_FAULT_MAJOR)
+               tsk->maj_flt++;
+       else
+               tsk->min_flt++;
 
        up_read(&mm->mmap_sem);
        return;
@@ -161,7 +163,7 @@ no_context:
 
        printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at "
               "virtual address %0*lx, epc == %0*lx, ra == %0*lx\n",
-              smp_processor_id(), field, address, field, regs->cp0_epc,
+              raw_smp_processor_id(), field, address, field, regs->cp0_epc,
               field,  regs->regs[31]);
        die("Oops", regs);
 
@@ -224,7 +226,7 @@ vmalloc_fault:
                pmd_t *pmd, *pmd_k;
                pte_t *pte_k;
 
-               pgd = (pgd_t *) pgd_current[smp_processor_id()] + offset;
+               pgd = (pgd_t *) pgd_current[raw_smp_processor_id()] + offset;
                pgd_k = init_mm.pgd + offset;
 
                if (!pgd_present(*pgd_k))