Catalin Marinas | bbe8888 | 2007-05-08 22:27:46 +0100 | [diff] [blame] | 1 | #include <linux/linkage.h> |
| 2 | #include <asm/assembler.h> |
| 3 | /* |
| 4 | * Function: v7_early_abort |
| 5 | * |
Russell King | da74047 | 2011-06-26 16:01:26 +0100 | [diff] [blame] | 6 | * Params : r2 = pt_regs |
| 7 | * : r4 = aborted context pc |
Russell King | 3e287be | 2011-06-26 14:35:07 +0100 | [diff] [blame] | 8 | * : r5 = aborted context psr |
Catalin Marinas | bbe8888 | 2007-05-08 22:27:46 +0100 | [diff] [blame] | 9 | * |
Russell King | da74047 | 2011-06-26 16:01:26 +0100 | [diff] [blame] | 10 | * Returns : r4 - r11, r13 preserved |
Catalin Marinas | bbe8888 | 2007-05-08 22:27:46 +0100 | [diff] [blame] | 11 | * |
| 12 | * Purpose : obtain information about current aborted instruction. |
| 13 | */ |
| 14 | .align 5 |
| 15 | ENTRY(v7_early_abort) |
| 16 | /* |
| 17 | * The effect of data aborts on on the exclusive access monitor are |
| 18 | * UNPREDICTABLE. Do a CLREX to clear the state |
| 19 | */ |
| 20 | clrex |
| 21 | |
| 22 | mrc p15, 0, r1, c5, c0, 0 @ get FSR |
| 23 | mrc p15, 0, r0, c6, c0, 0 @ get FAR |
| 24 | |
| 25 | /* |
| 26 | * V6 code adjusts the returned DFSR. |
| 27 | * New designs should not need to patch up faults. |
| 28 | */ |
Dave Estes | e220ba6 | 2009-08-11 17:58:49 -0400 | [diff] [blame] | 29 | |
| 30 | #if defined(CONFIG_VERIFY_PERMISSION_FAULT) |
| 31 | /* |
| 32 | * Detect erroneous permission failures and fix |
| 33 | */ |
| 34 | ldr r3, =0x40d @ On permission fault |
| 35 | and r3, r1, r3 |
| 36 | cmp r3, #0x0d |
Russell King | da74047 | 2011-06-26 16:01:26 +0100 | [diff] [blame] | 37 | bne do_DataAbort |
Dave Estes | e220ba6 | 2009-08-11 17:58:49 -0400 | [diff] [blame] | 38 | |
| 39 | mcr p15, 0, r0, c7, c8, 0 @ Retranslate FAR |
| 40 | isb |
Russell King | 0d147db | 2011-06-26 14:42:02 +0100 | [diff] [blame] | 41 | mrc p15, 0, ip, c7, c4, 0 @ Read the PAR |
| 42 | and r3, ip, #0x7b @ On translation fault |
Dave Estes | e220ba6 | 2009-08-11 17:58:49 -0400 | [diff] [blame] | 43 | cmp r3, #0x0b |
Russell King | da74047 | 2011-06-26 16:01:26 +0100 | [diff] [blame] | 44 | bne do_DataAbort |
Dave Estes | e220ba6 | 2009-08-11 17:58:49 -0400 | [diff] [blame] | 45 | bic r1, r1, #0xf @ Fix up FSR FS[5:0] |
Russell King | 0d147db | 2011-06-26 14:42:02 +0100 | [diff] [blame] | 46 | and ip, ip, #0x7e |
| 47 | orr r1, r1, ip, LSR #1 |
Dave Estes | e220ba6 | 2009-08-11 17:58:49 -0400 | [diff] [blame] | 48 | #endif |
| 49 | |
Russell King | da74047 | 2011-06-26 16:01:26 +0100 | [diff] [blame] | 50 | b do_DataAbort |
Catalin Marinas | 93ed397 | 2008-08-28 11:22:32 +0100 | [diff] [blame] | 51 | ENDPROC(v7_early_abort) |