^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: v4_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) * Note: we read user space. This means we might cause a data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * abort here if the I-TLB and D-TLB aren't seeing the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * picture. Unfortunately, this does happen. We live with it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .align 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) ENTRY(v4_early_abort)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) mrc p15, 0, r1, c5, c0, 0 @ get FSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) mrc p15, 0, r0, c6, c0, 0 @ get FAR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) ldr r3, [r4] @ read aborted ARM instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) uaccess_disable ip @ disable userspace access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) bic r1, r1, #1 << 11 | 1 << 10 @ clear bits 11 and 10 of FSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) tst r3, #1 << 20 @ L = 1 -> write?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) orreq r1, r1, #1 << 11 @ yes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) b do_DataAbort