blob: e8d0e08c227fc5f36d864378bf5cf75dfbb00e10 [file] [log] [blame]
Catalin Marinasbbe88882007-05-08 22:27:46 +01001#include <linux/linkage.h>
2#include <asm/assembler.h>
3/*
4 * Function: v7_early_abort
5 *
Russell Kingda740472011-06-26 16:01:26 +01006 * Params : r2 = pt_regs
7 * : r4 = aborted context pc
Russell King3e287be2011-06-26 14:35:07 +01008 * : r5 = aborted context psr
Catalin Marinasbbe88882007-05-08 22:27:46 +01009 *
Russell Kingda740472011-06-26 16:01:26 +010010 * Returns : r4 - r11, r13 preserved
Catalin Marinasbbe88882007-05-08 22:27:46 +010011 *
12 * Purpose : obtain information about current aborted instruction.
13 */
14 .align 5
15ENTRY(v7_early_abort)
Catalin Marinasbbe88882007-05-08 22:27:46 +010016 mrc p15, 0, r1, c5, c0, 0 @ get FSR
17 mrc p15, 0, r0, c6, c0, 0 @ get FAR
Russell King2190fed2015-08-20 10:32:02 +010018 uaccess_disable ip @ disable userspace access
Catalin Marinasbbe88882007-05-08 22:27:46 +010019
20 /*
21 * V6 code adjusts the returned DFSR.
22 * New designs should not need to patch up faults.
23 */
Dave Estese220ba62009-08-11 17:58:49 -040024
25#if defined(CONFIG_VERIFY_PERMISSION_FAULT)
26 /*
27 * Detect erroneous permission failures and fix
28 */
29 ldr r3, =0x40d @ On permission fault
30 and r3, r1, r3
31 cmp r3, #0x0d
Russell Kingda740472011-06-26 16:01:26 +010032 bne do_DataAbort
Dave Estese220ba62009-08-11 17:58:49 -040033
34 mcr p15, 0, r0, c7, c8, 0 @ Retranslate FAR
35 isb
Russell King0d147db2011-06-26 14:42:02 +010036 mrc p15, 0, ip, c7, c4, 0 @ Read the PAR
37 and r3, ip, #0x7b @ On translation fault
Dave Estese220ba62009-08-11 17:58:49 -040038 cmp r3, #0x0b
Russell Kingda740472011-06-26 16:01:26 +010039 bne do_DataAbort
Dave Estese220ba62009-08-11 17:58:49 -040040 bic r1, r1, #0xf @ Fix up FSR FS[5:0]
Russell King0d147db2011-06-26 14:42:02 +010041 and ip, ip, #0x7e
42 orr r1, r1, ip, LSR #1
Dave Estese220ba62009-08-11 17:58:49 -040043#endif
44
Russell Kingda740472011-06-26 16:01:26 +010045 b do_DataAbort
Catalin Marinas93ed3972008-08-28 11:22:32 +010046ENDPROC(v7_early_abort)