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