20 #include <linux/module.h>
21 #include <linux/signal.h>
22 #include <linux/sched.h>
23 #include <linux/kernel.h>
24 #include <linux/errno.h>
25 #include <linux/string.h>
26 #include <linux/types.h>
27 #include <linux/ptrace.h>
28 #include <linux/mman.h>
33 #include <asm/pgtable.h>
35 #include <asm/mmu_context.h>
37 #include <asm/exceptions.h>
50 if (
get_user(inst, (
unsigned int __user *)regs->
pc))
53 if (((inst >> 21) & 0x1f) != 1)
56 if ((inst & 0xd0000000) == 0xd0000000)
79 die(
"kernel access of bad area", regs, sig);
93 int is_write = error_code & ESR_S;
95 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
96 (is_write ? FAULT_FLAG_WRITE : 0);
108 if ((error_code & 0x13) == 0x13 || (error_code & 0x11) == 0x11)
112 if (kernel_mode(regs))
113 goto bad_area_nosemaphore;
118 "in_atomic(), mm = %p\n", mm);
141 goto bad_area_nosemaphore;
169 if (
unlikely(address + 0x100000 < vma->vm_end)) {
188 if (address + 2048 < uregs->
r1
189 && (kernel_mode(regs) || !store_updates_sp(regs)))
205 if (
unlikely(error_code & 0x08000000))
218 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(
current))
221 if (
unlikely(fault & VM_FAULT_ERROR)) {
222 if (fault & VM_FAULT_OOM)
224 else if (fault & VM_FAULT_SIGBUS)
229 if (flags & FAULT_FLAG_ALLOW_RETRY) {
230 if (
unlikely(fault & VM_FAULT_MAJOR))
234 if (fault & VM_FAULT_RETRY) {
235 flags &= ~FAULT_FLAG_ALLOW_RETRY;
236 flags |= FAULT_FLAG_TRIED;
261 bad_area_nosemaphore:
296 info.si_addr = (
void __user *)address;