abort-ev7.S 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #include <linux/linkage.h>
  3. #include <asm/assembler.h>
  4. /*
  5. * Function: v7_early_abort
  6. *
  7. * Params : r2 = pt_regs
  8. * : r4 = aborted context pc
  9. * : r5 = aborted context psr
  10. *
  11. * Returns : r4 - r11, r13 preserved
  12. *
  13. * Purpose : obtain information about current aborted instruction.
  14. */
  15. .align 5
  16. ENTRY(v7_early_abort)
  17. mrc p15, 0, r1, c5, c0, 0 @ get FSR
  18. mrc p15, 0, r0, c6, c0, 0 @ get FAR
  19. uaccess_disable ip @ disable userspace access
  20. /*
  21. * V6 code adjusts the returned DFSR.
  22. * New designs should not need to patch up faults.
  23. */
  24. #if defined(CONFIG_VERIFY_PERMISSION_FAULT)
  25. /*
  26. * Detect erroneous permission failures and fix
  27. */
  28. ldr r3, =0x40d @ On permission fault
  29. and r3, r1, r3
  30. cmp r3, #0x0d
  31. bne do_DataAbort
  32. mcr p15, 0, r0, c7, c8, 0 @ Retranslate FAR
  33. isb
  34. mrc p15, 0, ip, c7, c4, 0 @ Read the PAR
  35. and r3, ip, #0x7b @ On translation fault
  36. cmp r3, #0x0b
  37. bne do_DataAbort
  38. bic r1, r1, #0xf @ Fix up FSR FS[5:0]
  39. and ip, ip, #0x7e
  40. orr r1, r1, ip, LSR #1
  41. #endif
  42. b do_DataAbort
  43. ENDPROC(v7_early_abort)