This source file includes following definitions.
- do_page_fault
1
2
3
4
5
6 #include <linux/signal.h>
7 #include <linux/sched.h>
8 #include <linux/head.h>
9 #include <linux/kernel.h>
10 #include <linux/errno.h>
11 #include <linux/string.h>
12 #include <linux/types.h>
13 #include <linux/ptrace.h>
14 #include <linux/mman.h>
15 #include <linux/mm.h>
16
17 #include <asm/system.h>
18 #include <asm/segment.h>
19 #include <asm/pgtable.h>
20
21 extern void die_if_kernel(char *, struct pt_regs *, long);
22
23
24
25
26
27
28 asmlinkage void
29 do_page_fault(struct pt_regs *regs, unsigned long writeaccess, unsigned long address)
30 {
31 struct vm_area_struct * vma;
32
33 #if 0
34 printk("do_page_fault() #1: %s %08lx (epc == %08lx, ra == %08lx)\n",
35 writeaccess ? "writeaccess to" : "readaccess from",
36 address, regs->cp0_epc, regs->reg31);
37 #endif
38 vma = find_vma(current, address);
39 if (!vma)
40 goto bad_area;
41 if (vma->vm_start <= address)
42 goto good_area;
43 if (!(vma->vm_flags & VM_GROWSDOWN))
44 goto bad_area;
45 if (expand_stack(vma, address))
46 goto bad_area;
47
48
49
50
51 good_area:
52 if (writeaccess) {
53 if (!(vma->vm_flags & VM_WRITE))
54 goto bad_area;
55 } else {
56 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
57 goto bad_area;
58 }
59 handle_mm_fault(vma, address, writeaccess);
60
61 sys_cacheflush(address, PAGE_SIZE, BCACHE);
62
63 return;
64
65
66
67
68
69 bad_area:
70 if (user_mode(regs)) {
71 current->tss.cp0_badvaddr = address;
72 current->tss.error_code = writeaccess;
73 send_sig(SIGSEGV, current, 1);
74 return;
75 }
76
77
78
79
80 printk(KERN_ALERT "Unable to handle kernel paging request at virtual "
81 "address %08lx\n", address);
82 die_if_kernel("Oops", regs, writeaccess);
83 do_exit(SIGKILL);
84 }