fault.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. /*
  2. * linux/arch/arm/mm/fault.c
  3. *
  4. * Copyright (C) 1995 Linus Torvalds
  5. * Modifications for ARM processor (c) 1995-2004 Russell King
  6. *
  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.
  10. */
  11. #include <linux/module.h>
  12. #include <linux/signal.h>
  13. #include <linux/mm.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>
  22. #include <asm/system.h>
  23. #include <asm/pgtable.h>
  24. #include <asm/tlbflush.h>
  25. #include "fault.h"
  26. /*
  27. * Fault status register encodings. We steal bit 31 for our own purposes.
  28. */
  29. #define FSR_LNX_PF (1 << 31)
  30. #define FSR_WRITE (1 << 11)
  31. #define FSR_FS4 (1 << 10)
  32. #define FSR_FS3_0 (15)
  33. static inline int fsr_fs(unsigned int fsr)
  34. {
  35. return (fsr & FSR_FS3_0) | (fsr & FSR_FS4) >> 6;
  36. }
  37. #ifdef CONFIG_MMU
  38. #ifdef CONFIG_KPROBES
  39. static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
  40. {
  41. int ret = 0;
  42. if (!user_mode(regs)) {
  43. /* kprobe_running() needs smp_processor_id() */
  44. preempt_disable();
  45. if (kprobe_running() && kprobe_fault_handler(regs, fsr))
  46. ret = 1;
  47. preempt_enable();
  48. }
  49. return ret;
  50. }
  51. #else
  52. static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
  53. {
  54. return 0;
  55. }
  56. #endif
  57. /*
  58. * This is useful to dump out the page tables associated with
  59. * 'addr' in mm 'mm'.
  60. */
  61. void show_pte(struct mm_struct *mm, unsigned long addr)
  62. {
  63. pgd_t *pgd;
  64. if (!mm)
  65. mm = &init_mm;
  66. printk(KERN_ALERT "pgd = %p\n", mm->pgd);
  67. pgd = pgd_offset(mm, addr);
  68. printk(KERN_ALERT "[%08lx] *pgd=%08lx", addr, pgd_val(*pgd));
  69. do {
  70. pmd_t *pmd;
  71. pte_t *pte;
  72. if (pgd_none(*pgd))
  73. break;
  74. if (pgd_bad(*pgd)) {
  75. printk("(bad)");
  76. break;
  77. }
  78. pmd = pmd_offset(pgd, addr);
  79. if (PTRS_PER_PMD != 1)
  80. printk(", *pmd=%08lx", pmd_val(*pmd));
  81. if (pmd_none(*pmd))
  82. break;
  83. if (pmd_bad(*pmd)) {
  84. printk("(bad)");
  85. break;
  86. }
  87. /* We must not map this if we have highmem enabled */
  88. if (PageHighMem(pfn_to_page(pmd_val(*pmd) >> PAGE_SHIFT)))
  89. break;
  90. pte = pte_offset_map(pmd, addr);
  91. printk(", *pte=%08lx", pte_val(*pte));
  92. printk(", *ppte=%08lx", pte_val(pte[-PTRS_PER_PTE]));
  93. pte_unmap(pte);
  94. } while(0);
  95. printk("\n");
  96. }
  97. #else /* CONFIG_MMU */
  98. void show_pte(struct mm_struct *mm, unsigned long addr)
  99. { }
  100. #endif /* CONFIG_MMU */
  101. /*
  102. * Oops. The kernel tried to access some page that wasn't present.
  103. */
  104. static void
  105. __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
  106. struct pt_regs *regs)
  107. {
  108. /*
  109. * Are we prepared to handle this kernel fault?
  110. */
  111. if (fixup_exception(regs))
  112. return;
  113. /*
  114. * No handler, we'll have to terminate things with extreme prejudice.
  115. */
  116. bust_spinlocks(1);
  117. printk(KERN_ALERT
  118. "Unable to handle kernel %s at virtual address %08lx\n",
  119. (addr < PAGE_SIZE) ? "NULL pointer dereference" :
  120. "paging request", addr);
  121. show_pte(mm, addr);
  122. die("Oops", regs, fsr);
  123. bust_spinlocks(0);
  124. do_exit(SIGKILL);
  125. }
  126. /*
  127. * Something tried to access memory that isn't in our memory map..
  128. * User mode accesses just cause a SIGSEGV
  129. */
  130. static void
  131. __do_user_fault(struct task_struct *tsk, unsigned long addr,
  132. unsigned int fsr, unsigned int sig, int code,
  133. struct pt_regs *regs)
  134. {
  135. struct siginfo si;
  136. #ifdef CONFIG_DEBUG_USER
  137. if (user_debug & UDBG_SEGV) {
  138. printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n",
  139. tsk->comm, sig, addr, fsr);
  140. show_pte(tsk->mm, addr);
  141. show_regs(regs);
  142. }
  143. #endif
  144. tsk->thread.address = addr;
  145. tsk->thread.error_code = fsr;
  146. tsk->thread.trap_no = 14;
  147. si.si_signo = sig;
  148. si.si_errno = 0;
  149. si.si_code = code;
  150. si.si_addr = (void __user *)addr;
  151. force_sig_info(sig, &si, tsk);
  152. }
  153. void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
  154. {
  155. struct task_struct *tsk = current;
  156. struct mm_struct *mm = tsk->active_mm;
  157. /*
  158. * If we are in kernel mode at this point, we
  159. * have no context to handle this fault with.
  160. */
  161. if (user_mode(regs))
  162. __do_user_fault(tsk, addr, fsr, SIGSEGV, SEGV_MAPERR, regs);
  163. else
  164. __do_kernel_fault(mm, addr, fsr, regs);
  165. }
  166. #ifdef CONFIG_MMU
  167. #define VM_FAULT_BADMAP 0x010000
  168. #define VM_FAULT_BADACCESS 0x020000
  169. /*
  170. * Check that the permissions on the VMA allow for the fault which occurred.
  171. * If we encountered a write fault, we must have write permission, otherwise
  172. * we allow any permission.
  173. */
  174. static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
  175. {
  176. unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
  177. if (fsr & FSR_WRITE)
  178. mask = VM_WRITE;
  179. if (fsr & FSR_LNX_PF)
  180. mask = VM_EXEC;
  181. return vma->vm_flags & mask ? false : true;
  182. }
  183. static int __kprobes
  184. __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
  185. struct task_struct *tsk)
  186. {
  187. struct vm_area_struct *vma;
  188. int fault;
  189. vma = find_vma(mm, addr);
  190. fault = VM_FAULT_BADMAP;
  191. if (unlikely(!vma))
  192. goto out;
  193. if (unlikely(vma->vm_start > addr))
  194. goto check_stack;
  195. /*
  196. * Ok, we have a good vm_area for this
  197. * memory access, so we can handle it.
  198. */
  199. good_area:
  200. if (access_error(fsr, vma)) {
  201. fault = VM_FAULT_BADACCESS;
  202. goto out;
  203. }
  204. /*
  205. * If for any reason at all we couldn't handle the fault, make
  206. * sure we exit gracefully rather than endlessly redo the fault.
  207. */
  208. fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & FSR_WRITE) ? FAULT_FLAG_WRITE : 0);
  209. if (unlikely(fault & VM_FAULT_ERROR))
  210. return fault;
  211. if (fault & VM_FAULT_MAJOR)
  212. tsk->maj_flt++;
  213. else
  214. tsk->min_flt++;
  215. return fault;
  216. check_stack:
  217. if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
  218. goto good_area;
  219. out:
  220. return fault;
  221. }
  222. static int __kprobes
  223. do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
  224. {
  225. struct task_struct *tsk;
  226. struct mm_struct *mm;
  227. int fault, sig, code;
  228. if (notify_page_fault(regs, fsr))
  229. return 0;
  230. tsk = current;
  231. mm = tsk->mm;
  232. /*
  233. * If we're in an interrupt or have no user
  234. * context, we must not take the fault..
  235. */
  236. if (in_atomic() || !mm)
  237. goto no_context;
  238. /*
  239. * As per x86, we may deadlock here. However, since the kernel only
  240. * validly references user space from well defined areas of the code,
  241. * we can bug out early if this is from code which shouldn't.
  242. */
  243. if (!down_read_trylock(&mm->mmap_sem)) {
  244. if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc))
  245. goto no_context;
  246. down_read(&mm->mmap_sem);
  247. } else {
  248. /*
  249. * The above down_read_trylock() might have succeeded in
  250. * which case, we'll have missed the might_sleep() from
  251. * down_read()
  252. */
  253. might_sleep();
  254. #ifdef CONFIG_DEBUG_VM
  255. if (!user_mode(regs) &&
  256. !search_exception_tables(regs->ARM_pc))
  257. goto no_context;
  258. #endif
  259. }
  260. fault = __do_page_fault(mm, addr, fsr, tsk);
  261. up_read(&mm->mmap_sem);
  262. perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, addr);
  263. if (fault & VM_FAULT_MAJOR)
  264. perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, regs, addr);
  265. else if (fault & VM_FAULT_MINOR)
  266. perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, regs, addr);
  267. /*
  268. * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR
  269. */
  270. if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS))))
  271. return 0;
  272. if (fault & VM_FAULT_OOM) {
  273. /*
  274. * We ran out of memory, call the OOM killer, and return to
  275. * userspace (which will retry the fault, or kill us if we
  276. * got oom-killed)
  277. */
  278. pagefault_out_of_memory();
  279. return 0;
  280. }
  281. /*
  282. * If we are in kernel mode at this point, we
  283. * have no context to handle this fault with.
  284. */
  285. if (!user_mode(regs))
  286. goto no_context;
  287. if (fault & VM_FAULT_SIGBUS) {
  288. /*
  289. * We had some memory, but were unable to
  290. * successfully fix up this page fault.
  291. */
  292. sig = SIGBUS;
  293. code = BUS_ADRERR;
  294. } else {
  295. /*
  296. * Something tried to access memory that
  297. * isn't in our memory map..
  298. */
  299. sig = SIGSEGV;
  300. code = fault == VM_FAULT_BADACCESS ?
  301. SEGV_ACCERR : SEGV_MAPERR;
  302. }
  303. __do_user_fault(tsk, addr, fsr, sig, code, regs);
  304. return 0;
  305. no_context:
  306. __do_kernel_fault(mm, addr, fsr, regs);
  307. return 0;
  308. }
  309. #else /* CONFIG_MMU */
  310. static int
  311. do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
  312. {
  313. return 0;
  314. }
  315. #endif /* CONFIG_MMU */
  316. /*
  317. * First Level Translation Fault Handler
  318. *
  319. * We enter here because the first level page table doesn't contain
  320. * a valid entry for the address.
  321. *
  322. * If the address is in kernel space (>= TASK_SIZE), then we are
  323. * probably faulting in the vmalloc() area.
  324. *
  325. * If the init_task's first level page tables contains the relevant
  326. * entry, we copy the it to this task. If not, we send the process
  327. * a signal, fixup the exception, or oops the kernel.
  328. *
  329. * NOTE! We MUST NOT take any locks for this case. We may be in an
  330. * interrupt or a critical region, and should only copy the information
  331. * from the master page table, nothing more.
  332. */
  333. #ifdef CONFIG_MMU
  334. static int __kprobes
  335. do_translation_fault(unsigned long addr, unsigned int fsr,
  336. struct pt_regs *regs)
  337. {
  338. unsigned int index;
  339. pgd_t *pgd, *pgd_k;
  340. pmd_t *pmd, *pmd_k;
  341. if (addr < TASK_SIZE)
  342. return do_page_fault(addr, fsr, regs);
  343. if (user_mode(regs))
  344. goto bad_area;
  345. index = pgd_index(addr);
  346. /*
  347. * FIXME: CP15 C1 is write only on ARMv3 architectures.
  348. */
  349. pgd = cpu_get_pgd() + index;
  350. pgd_k = init_mm.pgd + index;
  351. if (pgd_none(*pgd_k))
  352. goto bad_area;
  353. if (!pgd_present(*pgd))
  354. set_pgd(pgd, *pgd_k);
  355. pmd_k = pmd_offset(pgd_k, addr);
  356. pmd = pmd_offset(pgd, addr);
  357. /*
  358. * On ARM one Linux PGD entry contains two hardware entries (see page
  359. * tables layout in pgtable.h). We normally guarantee that we always
  360. * fill both L1 entries. But create_mapping() doesn't follow the rule.
  361. * It can create inidividual L1 entries, so here we have to call
  362. * pmd_none() check for the entry really corresponded to address, not
  363. * for the first of pair.
  364. */
  365. index = (addr >> SECTION_SHIFT) & 1;
  366. if (pmd_none(pmd_k[index]))
  367. goto bad_area;
  368. copy_pmd(pmd, pmd_k);
  369. return 0;
  370. bad_area:
  371. do_bad_area(addr, fsr, regs);
  372. return 0;
  373. }
  374. #else /* CONFIG_MMU */
  375. static int
  376. do_translation_fault(unsigned long addr, unsigned int fsr,
  377. struct pt_regs *regs)
  378. {
  379. return 0;
  380. }
  381. #endif /* CONFIG_MMU */
  382. /*
  383. * Some section permission faults need to be handled gracefully.
  384. * They can happen due to a __{get,put}_user during an oops.
  385. */
  386. static int
  387. do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
  388. {
  389. do_bad_area(addr, fsr, regs);
  390. return 0;
  391. }
  392. /*
  393. * This abort handler always returns "fault".
  394. */
  395. static int
  396. do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
  397. {
  398. return 1;
  399. }
  400. static struct fsr_info {
  401. int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
  402. int sig;
  403. int code;
  404. const char *name;
  405. } fsr_info[] = {
  406. /*
  407. * The following are the standard ARMv3 and ARMv4 aborts. ARMv5
  408. * defines these to be "precise" aborts.
  409. */
  410. { do_bad, SIGSEGV, 0, "vector exception" },
  411. { do_bad, SIGBUS, BUS_ADRALN, "alignment exception" },
  412. { do_bad, SIGKILL, 0, "terminal exception" },
  413. { do_bad, SIGBUS, BUS_ADRALN, "alignment exception" },
  414. { do_bad, SIGBUS, 0, "external abort on linefetch" },
  415. { do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
  416. { do_bad, SIGBUS, 0, "external abort on linefetch" },
  417. { do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
  418. { do_bad, SIGBUS, 0, "external abort on non-linefetch" },
  419. { do_bad, SIGSEGV, SEGV_ACCERR, "section domain fault" },
  420. { do_bad, SIGBUS, 0, "external abort on non-linefetch" },
  421. { do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault" },
  422. { do_bad, SIGBUS, 0, "external abort on translation" },
  423. { do_sect_fault, SIGSEGV, SEGV_ACCERR, "section permission fault" },
  424. { do_bad, SIGBUS, 0, "external abort on translation" },
  425. { do_page_fault, SIGSEGV, SEGV_ACCERR, "page permission fault" },
  426. /*
  427. * The following are "imprecise" aborts, which are signalled by bit
  428. * 10 of the FSR, and may not be recoverable. These are only
  429. * supported if the CPU abort handler supports bit 10.
  430. */
  431. { do_bad, SIGBUS, 0, "unknown 16" },
  432. { do_bad, SIGBUS, 0, "unknown 17" },
  433. { do_bad, SIGBUS, 0, "unknown 18" },
  434. { do_bad, SIGBUS, 0, "unknown 19" },
  435. { do_bad, SIGBUS, 0, "lock abort" }, /* xscale */
  436. { do_bad, SIGBUS, 0, "unknown 21" },
  437. { do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */
  438. { do_bad, SIGBUS, 0, "unknown 23" },
  439. { do_bad, SIGBUS, 0, "dcache parity error" }, /* xscale */
  440. { do_bad, SIGBUS, 0, "unknown 25" },
  441. { do_bad, SIGBUS, 0, "unknown 26" },
  442. { do_bad, SIGBUS, 0, "unknown 27" },
  443. { do_bad, SIGBUS, 0, "unknown 28" },
  444. { do_bad, SIGBUS, 0, "unknown 29" },
  445. { do_bad, SIGBUS, 0, "unknown 30" },
  446. { do_bad, SIGBUS, 0, "unknown 31" }
  447. };
  448. void __init
  449. hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *),
  450. int sig, int code, const char *name)
  451. {
  452. if (nr < 0 || nr >= ARRAY_SIZE(fsr_info))
  453. BUG();
  454. fsr_info[nr].fn = fn;
  455. fsr_info[nr].sig = sig;
  456. fsr_info[nr].code = code;
  457. fsr_info[nr].name = name;
  458. }
  459. /*
  460. * Dispatch a data abort to the relevant handler.
  461. */
  462. asmlinkage void __exception
  463. do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
  464. {
  465. const struct fsr_info *inf = fsr_info + fsr_fs(fsr);
  466. struct siginfo info;
  467. if (!inf->fn(addr, fsr & ~FSR_LNX_PF, regs))
  468. return;
  469. printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n",
  470. inf->name, fsr, addr);
  471. info.si_signo = inf->sig;
  472. info.si_errno = 0;
  473. info.si_code = inf->code;
  474. info.si_addr = (void __user *)addr;
  475. arm_notify_die("", regs, &info, fsr, 0);
  476. }
  477. static struct fsr_info ifsr_info[] = {
  478. { do_bad, SIGBUS, 0, "unknown 0" },
  479. { do_bad, SIGBUS, 0, "unknown 1" },
  480. { do_bad, SIGBUS, 0, "debug event" },
  481. { do_bad, SIGSEGV, SEGV_ACCERR, "section access flag fault" },
  482. { do_bad, SIGBUS, 0, "unknown 4" },
  483. { do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
  484. { do_bad, SIGSEGV, SEGV_ACCERR, "page access flag fault" },
  485. { do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
  486. { do_bad, SIGBUS, 0, "external abort on non-linefetch" },
  487. { do_bad, SIGSEGV, SEGV_ACCERR, "section domain fault" },
  488. { do_bad, SIGBUS, 0, "unknown 10" },
  489. { do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault" },
  490. { do_bad, SIGBUS, 0, "external abort on translation" },
  491. { do_sect_fault, SIGSEGV, SEGV_ACCERR, "section permission fault" },
  492. { do_bad, SIGBUS, 0, "external abort on translation" },
  493. { do_page_fault, SIGSEGV, SEGV_ACCERR, "page permission fault" },
  494. { do_bad, SIGBUS, 0, "unknown 16" },
  495. { do_bad, SIGBUS, 0, "unknown 17" },
  496. { do_bad, SIGBUS, 0, "unknown 18" },
  497. { do_bad, SIGBUS, 0, "unknown 19" },
  498. { do_bad, SIGBUS, 0, "unknown 20" },
  499. { do_bad, SIGBUS, 0, "unknown 21" },
  500. { do_bad, SIGBUS, 0, "unknown 22" },
  501. { do_bad, SIGBUS, 0, "unknown 23" },
  502. { do_bad, SIGBUS, 0, "unknown 24" },
  503. { do_bad, SIGBUS, 0, "unknown 25" },
  504. { do_bad, SIGBUS, 0, "unknown 26" },
  505. { do_bad, SIGBUS, 0, "unknown 27" },
  506. { do_bad, SIGBUS, 0, "unknown 28" },
  507. { do_bad, SIGBUS, 0, "unknown 29" },
  508. { do_bad, SIGBUS, 0, "unknown 30" },
  509. { do_bad, SIGBUS, 0, "unknown 31" },
  510. };
  511. asmlinkage void __exception
  512. do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs)
  513. {
  514. const struct fsr_info *inf = ifsr_info + fsr_fs(ifsr);
  515. struct siginfo info;
  516. if (!inf->fn(addr, ifsr | FSR_LNX_PF, regs))
  517. return;
  518. printk(KERN_ALERT "Unhandled prefetch abort: %s (0x%03x) at 0x%08lx\n",
  519. inf->name, ifsr, addr);
  520. info.si_signo = inf->sig;
  521. info.si_errno = 0;
  522. info.si_code = inf->code;
  523. info.si_addr = (void __user *)addr;
  524. arm_notify_die("", regs, &info, ifsr, 0);
  525. }
  526. static int __init exceptions_init(void)
  527. {
  528. if (cpu_architecture() >= CPU_ARCH_ARMv6) {
  529. hook_fault_code(4, do_translation_fault, SIGSEGV, SEGV_MAPERR,
  530. "I-cache maintenance fault");
  531. }
  532. if (cpu_architecture() >= CPU_ARCH_ARMv7) {
  533. /*
  534. * TODO: Access flag faults introduced in ARMv6K.
  535. * Runtime check for 'K' extension is needed
  536. */
  537. hook_fault_code(3, do_bad, SIGSEGV, SEGV_MAPERR,
  538. "section access flag fault");
  539. hook_fault_code(6, do_bad, SIGSEGV, SEGV_MAPERR,
  540. "section access flag fault");
  541. }
  542. return 0;
  543. }
  544. arch_initcall(exceptions_init);