blob: f7cc5d68444b56217a613bead95bf0d492fc372e [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Catalin Marinasbbe88882007-05-08 22:27:46 +01002#include <linux/linkage.h>
3#include <asm/assembler.h>
4/*
5 * Function: v7_early_abort
6 *
Russell Kingda740472011-06-26 16:01:26 +01007 * Params : r2 = pt_regs
8 * : r4 = aborted context pc
Russell King3e287be2011-06-26 14:35:07 +01009 * : r5 = aborted context psr
Catalin Marinasbbe88882007-05-08 22:27:46 +010010 *
Russell Kingda740472011-06-26 16:01:26 +010011 * Returns : r4 - r11, r13 preserved
Catalin Marinasbbe88882007-05-08 22:27:46 +010012 *
13 * Purpose : obtain information about current aborted instruction.
14 */
15 .align 5
16ENTRY(v7_early_abort)
Catalin Marinasbbe88882007-05-08 22:27:46 +010017 mrc p15, 0, r1, c5, c0, 0 @ get FSR
18 mrc p15, 0, r0, c6, c0, 0 @ get FAR
Russell King2190fed2015-08-20 10:32:02 +010019 uaccess_disable ip @ disable userspace access
Catalin Marinasbbe88882007-05-08 22:27:46 +010020
21 /*
22 * V6 code adjusts the returned DFSR.
23 * New designs should not need to patch up faults.
24 */
Dave Estese220ba62009-08-11 17:58:49 -040025
26#if defined(CONFIG_VERIFY_PERMISSION_FAULT)
27 /*
28 * Detect erroneous permission failures and fix
29 */
30 ldr r3, =0x40d @ On permission fault
31 and r3, r1, r3
32 cmp r3, #0x0d
Russell Kingda740472011-06-26 16:01:26 +010033 bne do_DataAbort
Dave Estese220ba62009-08-11 17:58:49 -040034
35 mcr p15, 0, r0, c7, c8, 0 @ Retranslate FAR
36 isb
Russell King0d147db2011-06-26 14:42:02 +010037 mrc p15, 0, ip, c7, c4, 0 @ Read the PAR
38 and r3, ip, #0x7b @ On translation fault
Dave Estese220ba62009-08-11 17:58:49 -040039 cmp r3, #0x0b
Russell Kingda740472011-06-26 16:01:26 +010040 bne do_DataAbort
Dave Estese220ba62009-08-11 17:58:49 -040041 bic r1, r1, #0xf @ Fix up FSR FS[5:0]
Russell King0d147db2011-06-26 14:42:02 +010042 and ip, ip, #0x7e
43 orr r1, r1, ip, LSR #1
Dave Estese220ba62009-08-11 17:58:49 -040044#endif
45
Russell Kingda740472011-06-26 16:01:26 +010046 b do_DataAbort
Catalin Marinas93ed3972008-08-28 11:22:32 +010047ENDPROC(v7_early_abort)