2 * linux/arch/arm/mm/fault.c
4 * Copyright (C) 1995 Linus Torvalds
5 * Modifications for ARM processor (c) 1995-2004 Russell King
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #include <linux/module.h>
12 #include <linux/signal.h>
14 #include <linux/hardirq.h>
15 #include <linux/init.h>
16 #include <linux/kprobes.h>
17 #include <linux/uaccess.h>
18 #include <linux/page-flags.h>
19 #include <linux/sched.h>
20 #include <linux/highmem.h>
21 #include <linux/perf_event.h>
23 #include <asm/system.h>
24 #include <asm/pgtable.h>
25 #include <asm/tlbflush.h>
30 * Fault status register encodings. We steal bit 31 for our own purposes.
32 #define FSR_LNX_PF (1 << 31)
33 #define FSR_WRITE (1 << 11)
34 #define FSR_FS4 (1 << 10)
35 #define FSR_FS3_0 (15)
36 #define FSR_FS5_0 (0x3f)
38 static inline int fsr_fs(unsigned int fsr
)
40 #ifdef CONFIG_ARM_LPAE
41 return fsr
& FSR_FS5_0
;
43 return (fsr
& FSR_FS3_0
) | (fsr
& FSR_FS4
) >> 6;
50 static inline int notify_page_fault(struct pt_regs
*regs
, unsigned int fsr
)
54 if (!user_mode(regs
)) {
55 /* kprobe_running() needs smp_processor_id() */
57 if (kprobe_running() && kprobe_fault_handler(regs
, fsr
))
65 static inline int notify_page_fault(struct pt_regs
*regs
, unsigned int fsr
)
72 * This is useful to dump out the page tables associated with
75 void show_pte(struct mm_struct
*mm
, unsigned long addr
)
82 printk(KERN_ALERT
"pgd = %p\n", mm
->pgd
);
83 pgd
= pgd_offset(mm
, addr
);
84 printk(KERN_ALERT
"[%08lx] *pgd=%08llx",
85 addr
, (long long)pgd_val(*pgd
));
100 pud
= pud_offset(pgd
, addr
);
101 if (PTRS_PER_PUD
!= 1)
102 printk(", *pud=%08llx", (long long)pud_val(*pud
));
112 pmd
= pmd_offset(pud
, addr
);
113 if (PTRS_PER_PMD
!= 1)
114 printk(", *pmd=%08llx", (long long)pmd_val(*pmd
));
124 /* We must not map this if we have highmem enabled */
125 if (PageHighMem(pfn_to_page(pmd_val(*pmd
) >> PAGE_SHIFT
)))
128 pte
= pte_offset_map(pmd
, addr
);
129 printk(", *pte=%08llx", (long long)pte_val(*pte
));
130 #ifndef CONFIG_ARM_LPAE
131 printk(", *ppte=%08llx",
132 (long long)pte_val(pte
[PTE_HWTABLE_PTRS
]));
139 #else /* CONFIG_MMU */
140 void show_pte(struct mm_struct
*mm
, unsigned long addr
)
142 #endif /* CONFIG_MMU */
145 * Oops. The kernel tried to access some page that wasn't present.
148 __do_kernel_fault(struct mm_struct
*mm
, unsigned long addr
, unsigned int fsr
,
149 struct pt_regs
*regs
)
152 * Are we prepared to handle this kernel fault?
154 if (fixup_exception(regs
))
158 * No handler, we'll have to terminate things with extreme prejudice.
162 "Unable to handle kernel %s at virtual address %08lx\n",
163 (addr
< PAGE_SIZE
) ? "NULL pointer dereference" :
164 "paging request", addr
);
167 die("Oops", regs
, fsr
);
173 * Something tried to access memory that isn't in our memory map..
174 * User mode accesses just cause a SIGSEGV
177 __do_user_fault(struct task_struct
*tsk
, unsigned long addr
,
178 unsigned int fsr
, unsigned int sig
, int code
,
179 struct pt_regs
*regs
)
183 #ifdef CONFIG_DEBUG_USER
184 if (user_debug
& UDBG_SEGV
) {
185 printk(KERN_DEBUG
"%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n",
186 tsk
->comm
, sig
, addr
, fsr
);
187 show_pte(tsk
->mm
, addr
);
192 tsk
->thread
.address
= addr
;
193 tsk
->thread
.error_code
= fsr
;
194 tsk
->thread
.trap_no
= 14;
198 si
.si_addr
= (void __user
*)addr
;
199 force_sig_info(sig
, &si
, tsk
);
202 void do_bad_area(unsigned long addr
, unsigned int fsr
, struct pt_regs
*regs
)
204 struct task_struct
*tsk
= current
;
205 struct mm_struct
*mm
= tsk
->active_mm
;
208 * If we are in kernel mode at this point, we
209 * have no context to handle this fault with.
212 __do_user_fault(tsk
, addr
, fsr
, SIGSEGV
, SEGV_MAPERR
, regs
);
214 __do_kernel_fault(mm
, addr
, fsr
, regs
);
218 #define VM_FAULT_BADMAP 0x010000
219 #define VM_FAULT_BADACCESS 0x020000
222 * Check that the permissions on the VMA allow for the fault which occurred.
223 * If we encountered a write fault, we must have write permission, otherwise
224 * we allow any permission.
226 static inline bool access_error(unsigned int fsr
, struct vm_area_struct
*vma
)
228 unsigned int mask
= VM_READ
| VM_WRITE
| VM_EXEC
;
232 if (fsr
& FSR_LNX_PF
)
235 return vma
->vm_flags
& mask
? false : true;
239 __do_page_fault(struct mm_struct
*mm
, unsigned long addr
, unsigned int fsr
,
240 struct task_struct
*tsk
)
242 struct vm_area_struct
*vma
;
245 vma
= find_vma(mm
, addr
);
246 fault
= VM_FAULT_BADMAP
;
249 if (unlikely(vma
->vm_start
> addr
))
253 * Ok, we have a good vm_area for this
254 * memory access, so we can handle it.
257 if (access_error(fsr
, vma
)) {
258 fault
= VM_FAULT_BADACCESS
;
263 * If for any reason at all we couldn't handle the fault, make
264 * sure we exit gracefully rather than endlessly redo the fault.
266 fault
= handle_mm_fault(mm
, vma
, addr
& PAGE_MASK
, (fsr
& FSR_WRITE
) ? FAULT_FLAG_WRITE
: 0);
267 if (unlikely(fault
& VM_FAULT_ERROR
))
269 if (fault
& VM_FAULT_MAJOR
)
276 if (vma
->vm_flags
& VM_GROWSDOWN
&& !expand_stack(vma
, addr
))
283 do_page_fault(unsigned long addr
, unsigned int fsr
, struct pt_regs
*regs
)
285 struct task_struct
*tsk
;
286 struct mm_struct
*mm
;
287 int fault
, sig
, code
;
289 if (notify_page_fault(regs
, fsr
))
295 /* Enable interrupts if they were enabled in the parent context. */
296 if (interrupts_enabled(regs
))
300 * If we're in an interrupt or have no user
301 * context, we must not take the fault..
303 if (in_atomic() || !mm
)
307 * As per x86, we may deadlock here. However, since the kernel only
308 * validly references user space from well defined areas of the code,
309 * we can bug out early if this is from code which shouldn't.
311 if (!down_read_trylock(&mm
->mmap_sem
)) {
312 if (!user_mode(regs
) && !search_exception_tables(regs
->ARM_pc
))
314 down_read(&mm
->mmap_sem
);
317 * The above down_read_trylock() might have succeeded in
318 * which case, we'll have missed the might_sleep() from
322 #ifdef CONFIG_DEBUG_VM
323 if (!user_mode(regs
) &&
324 !search_exception_tables(regs
->ARM_pc
))
329 fault
= __do_page_fault(mm
, addr
, fsr
, tsk
);
330 up_read(&mm
->mmap_sem
);
332 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS
, 1, regs
, addr
);
333 if (fault
& VM_FAULT_MAJOR
)
334 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ
, 1, regs
, addr
);
335 else if (fault
& VM_FAULT_MINOR
)
336 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN
, 1, regs
, addr
);
339 * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR
341 if (likely(!(fault
& (VM_FAULT_ERROR
| VM_FAULT_BADMAP
| VM_FAULT_BADACCESS
))))
344 if (fault
& VM_FAULT_OOM
) {
346 * We ran out of memory, call the OOM killer, and return to
347 * userspace (which will retry the fault, or kill us if we
350 pagefault_out_of_memory();
355 * If we are in kernel mode at this point, we
356 * have no context to handle this fault with.
358 if (!user_mode(regs
))
361 if (fault
& VM_FAULT_SIGBUS
) {
363 * We had some memory, but were unable to
364 * successfully fix up this page fault.
370 * Something tried to access memory that
371 * isn't in our memory map..
374 code
= fault
== VM_FAULT_BADACCESS
?
375 SEGV_ACCERR
: SEGV_MAPERR
;
378 __do_user_fault(tsk
, addr
, fsr
, sig
, code
, regs
);
382 __do_kernel_fault(mm
, addr
, fsr
, regs
);
385 #else /* CONFIG_MMU */
387 do_page_fault(unsigned long addr
, unsigned int fsr
, struct pt_regs
*regs
)
391 #endif /* CONFIG_MMU */
394 * First Level Translation Fault Handler
396 * We enter here because the first level page table doesn't contain
397 * a valid entry for the address.
399 * If the address is in kernel space (>= TASK_SIZE), then we are
400 * probably faulting in the vmalloc() area.
402 * If the init_task's first level page tables contains the relevant
403 * entry, we copy the it to this task. If not, we send the process
404 * a signal, fixup the exception, or oops the kernel.
406 * NOTE! We MUST NOT take any locks for this case. We may be in an
407 * interrupt or a critical region, and should only copy the information
408 * from the master page table, nothing more.
412 do_translation_fault(unsigned long addr
, unsigned int fsr
,
413 struct pt_regs
*regs
)
420 if (addr
< TASK_SIZE
)
421 return do_page_fault(addr
, fsr
, regs
);
426 index
= pgd_index(addr
);
429 * FIXME: CP15 C1 is write only on ARMv3 architectures.
431 pgd
= cpu_get_pgd() + index
;
432 pgd_k
= init_mm
.pgd
+ index
;
434 if (pgd_none(*pgd_k
))
436 if (!pgd_present(*pgd
))
437 set_pgd(pgd
, *pgd_k
);
439 pud
= pud_offset(pgd
, addr
);
440 pud_k
= pud_offset(pgd_k
, addr
);
442 if (pud_none(*pud_k
))
444 if (!pud_present(*pud
))
445 set_pud(pud
, *pud_k
);
447 pmd
= pmd_offset(pud
, addr
);
448 pmd_k
= pmd_offset(pud_k
, addr
);
450 #ifdef CONFIG_ARM_LPAE
452 * Only one hardware entry per PMD with LPAE.
457 * On ARM one Linux PGD entry contains two hardware entries (see page
458 * tables layout in pgtable.h). We normally guarantee that we always
459 * fill both L1 entries. But create_mapping() doesn't follow the rule.
460 * It can create inidividual L1 entries, so here we have to call
461 * pmd_none() check for the entry really corresponded to address, not
462 * for the first of pair.
464 index
= (addr
>> SECTION_SHIFT
) & 1;
466 if (pmd_none(pmd_k
[index
]))
469 copy_pmd(pmd
, pmd_k
);
473 do_bad_area(addr
, fsr
, regs
);
476 #else /* CONFIG_MMU */
478 do_translation_fault(unsigned long addr
, unsigned int fsr
,
479 struct pt_regs
*regs
)
483 #endif /* CONFIG_MMU */
486 * Some section permission faults need to be handled gracefully.
487 * They can happen due to a __{get,put}_user during an oops.
490 do_sect_fault(unsigned long addr
, unsigned int fsr
, struct pt_regs
*regs
)
492 do_bad_area(addr
, fsr
, regs
);
497 * This abort handler always returns "fault".
500 do_bad(unsigned long addr
, unsigned int fsr
, struct pt_regs
*regs
)
505 static struct fsr_info
{
506 int (*fn
)(unsigned long addr
, unsigned int fsr
, struct pt_regs
*regs
);
511 #ifdef CONFIG_ARM_LPAE
512 { do_bad
, SIGBUS
, 0, "unknown 0" },
513 { do_bad
, SIGBUS
, 0, "unknown 1" },
514 { do_bad
, SIGBUS
, 0, "unknown 2" },
515 { do_bad
, SIGBUS
, 0, "unknown 3" },
516 { do_bad
, SIGBUS
, 0, "reserved translation fault" },
517 { do_translation_fault
, SIGSEGV
, SEGV_MAPERR
, "level 1 translation fault" },
518 { do_translation_fault
, SIGSEGV
, SEGV_MAPERR
, "level 2 translation fault" },
519 { do_page_fault
, SIGSEGV
, SEGV_MAPERR
, "level 3 translation fault" },
520 { do_bad
, SIGBUS
, 0, "reserved access flag fault" },
521 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "level 1 access flag fault" },
522 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "level 2 access flag fault" },
523 { do_page_fault
, SIGSEGV
, SEGV_ACCERR
, "level 3 access flag fault" },
524 { do_bad
, SIGBUS
, 0, "reserved permission fault" },
525 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "level 1 permission fault" },
526 { do_sect_fault
, SIGSEGV
, SEGV_ACCERR
, "level 2 permission fault" },
527 { do_page_fault
, SIGSEGV
, SEGV_ACCERR
, "level 3 permission fault" },
528 { do_bad
, SIGBUS
, 0, "synchronous external abort" },
529 { do_bad
, SIGBUS
, 0, "asynchronous external abort" },
530 { do_bad
, SIGBUS
, 0, "unknown 18" },
531 { do_bad
, SIGBUS
, 0, "unknown 19" },
532 { do_bad
, SIGBUS
, 0, "synchronous abort (translation table walk)" },
533 { do_bad
, SIGBUS
, 0, "synchronous abort (translation table walk)" },
534 { do_bad
, SIGBUS
, 0, "synchronous abort (translation table walk)" },
535 { do_bad
, SIGBUS
, 0, "synchronous abort (translation table walk)" },
536 { do_bad
, SIGBUS
, 0, "synchronous parity error" },
537 { do_bad
, SIGBUS
, 0, "asynchronous parity error" },
538 { do_bad
, SIGBUS
, 0, "unknown 26" },
539 { do_bad
, SIGBUS
, 0, "unknown 27" },
540 { do_bad
, SIGBUS
, 0, "synchronous parity error (translation table walk" },
541 { do_bad
, SIGBUS
, 0, "synchronous parity error (translation table walk" },
542 { do_bad
, SIGBUS
, 0, "synchronous parity error (translation table walk" },
543 { do_bad
, SIGBUS
, 0, "synchronous parity error (translation table walk" },
544 { do_bad
, SIGBUS
, 0, "unknown 32" },
545 { do_bad
, SIGBUS
, BUS_ADRALN
, "alignment fault" },
546 { do_bad
, SIGBUS
, 0, "debug event" },
547 { do_bad
, SIGBUS
, 0, "unknown 35" },
548 { do_bad
, SIGBUS
, 0, "unknown 36" },
549 { do_bad
, SIGBUS
, 0, "unknown 37" },
550 { do_bad
, SIGBUS
, 0, "unknown 38" },
551 { do_bad
, SIGBUS
, 0, "unknown 39" },
552 { do_bad
, SIGBUS
, 0, "unknown 40" },
553 { do_bad
, SIGBUS
, 0, "unknown 41" },
554 { do_bad
, SIGBUS
, 0, "unknown 42" },
555 { do_bad
, SIGBUS
, 0, "unknown 43" },
556 { do_bad
, SIGBUS
, 0, "unknown 44" },
557 { do_bad
, SIGBUS
, 0, "unknown 45" },
558 { do_bad
, SIGBUS
, 0, "unknown 46" },
559 { do_bad
, SIGBUS
, 0, "unknown 47" },
560 { do_bad
, SIGBUS
, 0, "unknown 48" },
561 { do_bad
, SIGBUS
, 0, "unknown 49" },
562 { do_bad
, SIGBUS
, 0, "unknown 50" },
563 { do_bad
, SIGBUS
, 0, "unknown 51" },
564 { do_bad
, SIGBUS
, 0, "implementation fault (lockdown abort)" },
565 { do_bad
, SIGBUS
, 0, "unknown 53" },
566 { do_bad
, SIGBUS
, 0, "unknown 54" },
567 { do_bad
, SIGBUS
, 0, "unknown 55" },
568 { do_bad
, SIGBUS
, 0, "unknown 56" },
569 { do_bad
, SIGBUS
, 0, "unknown 57" },
570 { do_bad
, SIGBUS
, 0, "implementation fault (coprocessor abort)" },
571 { do_bad
, SIGBUS
, 0, "unknown 59" },
572 { do_bad
, SIGBUS
, 0, "unknown 60" },
573 { do_bad
, SIGBUS
, 0, "unknown 61" },
574 { do_bad
, SIGBUS
, 0, "unknown 62" },
575 { do_bad
, SIGBUS
, 0, "unknown 63" },
576 #else /* !CONFIG_ARM_LPAE */
578 * The following are the standard ARMv3 and ARMv4 aborts. ARMv5
579 * defines these to be "precise" aborts.
581 { do_bad
, SIGSEGV
, 0, "vector exception" },
582 { do_bad
, SIGBUS
, BUS_ADRALN
, "alignment exception" },
583 { do_bad
, SIGKILL
, 0, "terminal exception" },
584 { do_bad
, SIGBUS
, BUS_ADRALN
, "alignment exception" },
585 { do_bad
, SIGBUS
, 0, "external abort on linefetch" },
586 { do_translation_fault
, SIGSEGV
, SEGV_MAPERR
, "section translation fault" },
587 { do_bad
, SIGBUS
, 0, "external abort on linefetch" },
588 { do_page_fault
, SIGSEGV
, SEGV_MAPERR
, "page translation fault" },
589 { do_bad
, SIGBUS
, 0, "external abort on non-linefetch" },
590 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "section domain fault" },
591 { do_bad
, SIGBUS
, 0, "external abort on non-linefetch" },
592 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "page domain fault" },
593 { do_bad
, SIGBUS
, 0, "external abort on translation" },
594 { do_sect_fault
, SIGSEGV
, SEGV_ACCERR
, "section permission fault" },
595 { do_bad
, SIGBUS
, 0, "external abort on translation" },
596 { do_page_fault
, SIGSEGV
, SEGV_ACCERR
, "page permission fault" },
598 * The following are "imprecise" aborts, which are signalled by bit
599 * 10 of the FSR, and may not be recoverable. These are only
600 * supported if the CPU abort handler supports bit 10.
602 { do_bad
, SIGBUS
, 0, "unknown 16" },
603 { do_bad
, SIGBUS
, 0, "unknown 17" },
604 { do_bad
, SIGBUS
, 0, "unknown 18" },
605 { do_bad
, SIGBUS
, 0, "unknown 19" },
606 { do_bad
, SIGBUS
, 0, "lock abort" }, /* xscale */
607 { do_bad
, SIGBUS
, 0, "unknown 21" },
608 { do_bad
, SIGBUS
, BUS_OBJERR
, "imprecise external abort" }, /* xscale */
609 { do_bad
, SIGBUS
, 0, "unknown 23" },
610 { do_bad
, SIGBUS
, 0, "dcache parity error" }, /* xscale */
611 { do_bad
, SIGBUS
, 0, "unknown 25" },
612 { do_bad
, SIGBUS
, 0, "unknown 26" },
613 { do_bad
, SIGBUS
, 0, "unknown 27" },
614 { do_bad
, SIGBUS
, 0, "unknown 28" },
615 { do_bad
, SIGBUS
, 0, "unknown 29" },
616 { do_bad
, SIGBUS
, 0, "unknown 30" },
617 { do_bad
, SIGBUS
, 0, "unknown 31" }
618 #endif /* CONFIG_ARM_LPAE */
622 hook_fault_code(int nr
, int (*fn
)(unsigned long, unsigned int, struct pt_regs
*),
623 int sig
, int code
, const char *name
)
625 if (nr
< 0 || nr
>= ARRAY_SIZE(fsr_info
))
628 fsr_info
[nr
].fn
= fn
;
629 fsr_info
[nr
].sig
= sig
;
630 fsr_info
[nr
].code
= code
;
631 fsr_info
[nr
].name
= name
;
635 * Dispatch a data abort to the relevant handler.
637 asmlinkage
void __exception
638 do_DataAbort(unsigned long addr
, unsigned int fsr
, struct pt_regs
*regs
)
640 const struct fsr_info
*inf
= fsr_info
+ fsr_fs(fsr
);
643 if (!inf
->fn(addr
, fsr
& ~FSR_LNX_PF
, regs
))
646 printk(KERN_ALERT
"Unhandled fault: %s (0x%03x) at 0x%08lx\n",
647 inf
->name
, fsr
, addr
);
649 info
.si_signo
= inf
->sig
;
651 info
.si_code
= inf
->code
;
652 info
.si_addr
= (void __user
*)addr
;
653 arm_notify_die("", regs
, &info
, fsr
, 0);
657 #ifdef CONFIG_ARM_LPAE
658 #define ifsr_info fsr_info
659 #else /* !CONFIG_ARM_LPAE */
660 static struct fsr_info ifsr_info
[] = {
661 { do_bad
, SIGBUS
, 0, "unknown 0" },
662 { do_bad
, SIGBUS
, 0, "unknown 1" },
663 { do_bad
, SIGBUS
, 0, "debug event" },
664 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "section access flag fault" },
665 { do_bad
, SIGBUS
, 0, "unknown 4" },
666 { do_translation_fault
, SIGSEGV
, SEGV_MAPERR
, "section translation fault" },
667 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "page access flag fault" },
668 { do_page_fault
, SIGSEGV
, SEGV_MAPERR
, "page translation fault" },
669 { do_bad
, SIGBUS
, 0, "external abort on non-linefetch" },
670 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "section domain fault" },
671 { do_bad
, SIGBUS
, 0, "unknown 10" },
672 { do_bad
, SIGSEGV
, SEGV_ACCERR
, "page domain fault" },
673 { do_bad
, SIGBUS
, 0, "external abort on translation" },
674 { do_sect_fault
, SIGSEGV
, SEGV_ACCERR
, "section permission fault" },
675 { do_bad
, SIGBUS
, 0, "external abort on translation" },
676 { do_page_fault
, SIGSEGV
, SEGV_ACCERR
, "page permission fault" },
677 { do_bad
, SIGBUS
, 0, "unknown 16" },
678 { do_bad
, SIGBUS
, 0, "unknown 17" },
679 { do_bad
, SIGBUS
, 0, "unknown 18" },
680 { do_bad
, SIGBUS
, 0, "unknown 19" },
681 { do_bad
, SIGBUS
, 0, "unknown 20" },
682 { do_bad
, SIGBUS
, 0, "unknown 21" },
683 { do_bad
, SIGBUS
, 0, "unknown 22" },
684 { do_bad
, SIGBUS
, 0, "unknown 23" },
685 { do_bad
, SIGBUS
, 0, "unknown 24" },
686 { do_bad
, SIGBUS
, 0, "unknown 25" },
687 { do_bad
, SIGBUS
, 0, "unknown 26" },
688 { do_bad
, SIGBUS
, 0, "unknown 27" },
689 { do_bad
, SIGBUS
, 0, "unknown 28" },
690 { do_bad
, SIGBUS
, 0, "unknown 29" },
691 { do_bad
, SIGBUS
, 0, "unknown 30" },
692 { do_bad
, SIGBUS
, 0, "unknown 31" },
694 #endif /* CONFIG_ARM_LPAE */
697 hook_ifault_code(int nr
, int (*fn
)(unsigned long, unsigned int, struct pt_regs
*),
698 int sig
, int code
, const char *name
)
700 if (nr
< 0 || nr
>= ARRAY_SIZE(ifsr_info
))
703 ifsr_info
[nr
].fn
= fn
;
704 ifsr_info
[nr
].sig
= sig
;
705 ifsr_info
[nr
].code
= code
;
706 ifsr_info
[nr
].name
= name
;
709 asmlinkage
void __exception
710 do_PrefetchAbort(unsigned long addr
, unsigned int ifsr
, struct pt_regs
*regs
)
712 const struct fsr_info
*inf
= ifsr_info
+ fsr_fs(ifsr
);
715 if (!inf
->fn(addr
, ifsr
| FSR_LNX_PF
, regs
))
718 printk(KERN_ALERT
"Unhandled prefetch abort: %s (0x%03x) at 0x%08lx\n",
719 inf
->name
, ifsr
, addr
);
721 info
.si_signo
= inf
->sig
;
723 info
.si_code
= inf
->code
;
724 info
.si_addr
= (void __user
*)addr
;
725 arm_notify_die("", regs
, &info
, ifsr
, 0);
728 static int __init
exceptions_init(void)
730 #ifndef CONFIG_ARM_LPAE
731 if (cpu_architecture() >= CPU_ARCH_ARMv6
) {
732 hook_fault_code(4, do_translation_fault
, SIGSEGV
, SEGV_MAPERR
,
733 "I-cache maintenance fault");
736 if (cpu_architecture() >= CPU_ARCH_ARMv7
) {
738 * TODO: Access flag faults introduced in ARMv6K.
739 * Runtime check for 'K' extension is needed
741 hook_fault_code(3, do_bad
, SIGSEGV
, SEGV_MAPERR
,
742 "section access flag fault");
743 hook_fault_code(6, do_bad
, SIGSEGV
, SEGV_MAPERR
,
744 "section access flag fault");
751 arch_initcall(exceptions_init
);