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