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