diff options
Diffstat (limited to 'arch/arm/cpu/exceptions_64.S')
-rw-r--r-- | arch/arm/cpu/exceptions_64.S | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/arch/arm/cpu/exceptions_64.S b/arch/arm/cpu/exceptions_64.S index 58120253a1..22034eaef9 100644 --- a/arch/arm/cpu/exceptions_64.S +++ b/arch/arm/cpu/exceptions_64.S @@ -7,6 +7,7 @@ #include <config.h> #include <asm/ptrace.h> +#include <asm/assembler64.h> #include <linux/linkage.h> /* @@ -31,22 +32,18 @@ stp x3, x4, [sp, #-16]! stp x1, x2, [sp, #-16]! - /* Could be running at EL3/EL2/EL1 */ - mrs x11, CurrentEL - cmp x11, #0xC /* Check EL3 state */ - b.eq 1f - cmp x11, #0x8 /* Check EL2 state */ - b.eq 2f - cmp x11, #0x4 /* Check EL1 state */ - b.eq 3f + switch_el x11, 3f, 2f, 1f 3: mrs x1, esr_el3 mrs x2, elr_el3 + mrs x3, far_el3 b 0f 2: mrs x1, esr_el2 mrs x2, elr_el2 + mrs x3, far_el2 b 0f 1: mrs x1, esr_el1 mrs x2, elr_el1 + mrs x3, far_el1 0: stp x2, x0, [sp, #-16]! mov x0, sp @@ -86,34 +83,69 @@ vectors: _do_bad_sync: exception_entry bl do_bad_sync + b exception_exit _do_bad_irq: exception_entry bl do_bad_irq + b exception_exit _do_bad_fiq: exception_entry bl do_bad_fiq + b exception_exit _do_bad_error: exception_entry bl do_bad_error + b exception_exit _do_sync: exception_entry + mov x2, x3 bl do_sync + b exception_exit _do_irq: exception_entry bl do_irq + b exception_exit _do_fiq: exception_entry bl do_fiq + b exception_exit _do_error: exception_entry bl do_error + b exception_exit + +exception_exit: + ldp x2, x0, [sp],#16 + switch_el x11, 3f, 2f, 1f +3: msr elr_el3, x2 + b 0f +2: msr elr_el2, x2 + b 0f +1: msr elr_el1, x2 +0: + ldp x1, x2, [sp],#16 + ldp x3, x4, [sp],#16 + ldp x5, x6, [sp],#16 + ldp x7, x8, [sp],#16 + ldp x9, x10, [sp],#16 + ldp x11, x12, [sp],#16 + ldp x13, x14, [sp],#16 + ldp x15, x16, [sp],#16 + ldp x17, x18, [sp],#16 + ldp x19, x20, [sp],#16 + ldp x21, x22, [sp],#16 + ldp x23, x24, [sp],#16 + ldp x25, x26, [sp],#16 + ldp x27, x28, [sp],#16 + ldp x29, x30, [sp],#16 + eret .section .data .align 4 |