fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / arm26 / mm / fault.c
index dacca8b..93c0cee 100644 (file)
@@ -8,7 +8,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#include <linux/config.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -156,7 +155,7 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
         */
 good_area:
        if (READ_FAULT(fsr)) /* read? */
-               mask = VM_READ|VM_EXEC;
+               mask = VM_READ|VM_EXEC|VM_WRITE;
        else
                mask = VM_WRITE;
 
@@ -176,17 +175,17 @@ survive:
         * Handle the "normal" cases first - successful and sigbus
         */
        switch (fault) {
-       case 2:
+       case VM_FAULT_MAJOR:
                tsk->maj_flt++;
                return fault;
-       case 1:
+       case VM_FAULT_MINOR:
                tsk->min_flt++;
-       case 0:
+       case VM_FAULT_SIGBUS:
                return fault;
        }
 
        fault = -3; /* out of memory */
-       if (tsk->pid != 1)
+       if (!is_init(tsk))
                goto out;
 
        /*
@@ -216,7 +215,7 @@ int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
         * If we're in an interrupt or have no user
         * context, we must not take the fault..
         */
-       if (in_interrupt() || !mm)
+       if (in_atomic() || !mm)
                goto no_context;
 
        down_read(&mm->mmap_sem);
@@ -226,14 +225,11 @@ int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
        /*
         * Handle the "normal" case first
         */
-       if (fault > 0)
+       switch (fault) {
+       case VM_FAULT_MINOR:
+       case VM_FAULT_MAJOR:
                return 0;
-
-       /*
-        * We had some memory, but were unable to
-        * successfully fix up this page fault.
-        */
-       if (fault == 0){
+       case VM_FAULT_SIGBUS:
                goto do_sigbus;
        }