Commit f44ce2e5 authored by Russell King's avatar Russell King

[ARM] Use #defined constants for handle_mm_fault and __do_page_fault.

parent 03a3cda8
...@@ -164,6 +164,9 @@ do_bad_area(struct task_struct *tsk, struct mm_struct *mm, unsigned long addr, ...@@ -164,6 +164,9 @@ do_bad_area(struct task_struct *tsk, struct mm_struct *mm, unsigned long addr,
__do_kernel_fault(mm, addr, fsr, regs); __do_kernel_fault(mm, addr, fsr, regs);
} }
#define VM_FAULT_BADMAP (-20)
#define VM_FAULT_BADACCESS (-21)
static int static int
__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
struct task_struct *tsk) struct task_struct *tsk)
...@@ -172,7 +175,7 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, ...@@ -172,7 +175,7 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
int fault, mask; int fault, mask;
vma = find_vma(mm, addr); vma = find_vma(mm, addr);
fault = -2; /* bad map area */ fault = VM_FAULT_BADMAP;
if (!vma) if (!vma)
goto out; goto out;
if (vma->vm_start > addr) if (vma->vm_start > addr)
...@@ -188,7 +191,7 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, ...@@ -188,7 +191,7 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
else else
mask = VM_WRITE; mask = VM_WRITE;
fault = -1; /* bad access type */ fault = VM_FAULT_BADACCESS;
if (!(vma->vm_flags & mask)) if (!(vma->vm_flags & mask))
goto out; goto out;
...@@ -204,16 +207,15 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, ...@@ -204,16 +207,15 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
* Handle the "normal" cases first - successful and sigbus * Handle the "normal" cases first - successful and sigbus
*/ */
switch (fault) { switch (fault) {
case 2: case VM_FAULT_MAJOR:
tsk->maj_flt++; tsk->maj_flt++;
return fault; return fault;
case 1: case VM_FAULT_MINOR:
tsk->min_flt++; tsk->min_flt++;
case 0: case VM_FAULT_SIGBUS:
return fault; return fault;
} }
fault = -3; /* out of memory */
if (tsk->pid != 1) if (tsk->pid != 1)
goto out; goto out;
...@@ -271,7 +273,7 @@ int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) ...@@ -271,7 +273,7 @@ int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (!user_mode(regs)) if (!user_mode(regs))
goto no_context; goto no_context;
if (fault == -3) { if (fault == VM_FAULT_OOM) {
/* /*
* We ran out of memory, or some other thing happened to * We ran out of memory, or some other thing happened to
* us that made us unable to handle the page fault gracefully. * us that made us unable to handle the page fault gracefully.
...@@ -279,7 +281,7 @@ int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) ...@@ -279,7 +281,7 @@ int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
printk("VM: killing process %s\n", tsk->comm); printk("VM: killing process %s\n", tsk->comm);
do_exit(SIGKILL); do_exit(SIGKILL);
} else } else
__do_user_fault(tsk, addr, fsr, fault == -1 ? __do_user_fault(tsk, addr, fsr, fault == VM_FAULT_BADACCESS ?
SEGV_ACCERR : SEGV_MAPERR, regs); SEGV_ACCERR : SEGV_MAPERR, regs);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment