7 #include <linux/mman.h>
9 #include <linux/kernel.h>
10 #include <linux/ptrace.h>
12 #include <linux/module.h>
14 #include <asm/setup.h>
15 #include <asm/traps.h>
16 #include <asm/uaccess.h>
17 #include <asm/pgalloc.h>
27 siginfo.si_addr = (
void *)
current->thread.faddr;
36 if (handle_kernel_fault(regs))
47 if ((
unsigned long)siginfo.si_addr <
PAGE_SIZE)
51 printk(
" at virtual address %p\n", siginfo.si_addr);
76 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
79 printk (
"do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
80 regs->
sr, regs->
pc, address, error_code,
101 if (!(vma->
vm_flags & VM_GROWSDOWN))
108 if (address + 256 < rdusp())
120 printk(
"do_page_fault: good_area\n");
122 switch (error_code & 3) {
128 flags |= FAULT_FLAG_WRITE;
133 if (!(vma->
vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
145 printk(
"handle_mm_fault returns %d\n",fault);
148 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(
current))
151 if (
unlikely(fault & VM_FAULT_ERROR)) {
152 if (fault & VM_FAULT_OOM)
154 else if (fault & VM_FAULT_SIGBUS)
164 if (flags & FAULT_FLAG_ALLOW_RETRY) {
165 if (fault & VM_FAULT_MAJOR)
169 if (fault & VM_FAULT_RETRY) {
172 flags &= ~FAULT_FLAG_ALLOW_RETRY;
173 flags |= FAULT_FLAG_TRIED;