Commit b55a5a1b authored by James Morse's avatar James Morse Committed by Will Deacon

arm64: entry.S: convert el1_sync

el1_sync unmasks exceptions on a case-by-case basis, debug exceptions
are unmasked, unless this was a debug exception. IRQs are unmasked
for instruction and data aborts only if the interupted context had
irqs unmasked.

Following our 'dai' order, el1_dbg should run with everything masked.
For the other cases we can inherit whatever we interrupted.

Add a macro inherit_daif to set daif based on the interrupted pstate.
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Reviewed-by: default avatarJulien Thierry <julien.thierry@arm.com>
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 84d0fb1b
...@@ -49,6 +49,12 @@ ...@@ -49,6 +49,12 @@
msr daif, \flags msr daif, \flags
.endm .endm
/* Only on aarch64 pstate, PSR_D_BIT is different for aarch32 */
.macro inherit_daif, pstate:req, tmp:req
and \tmp, \pstate, #(PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
msr daif, \tmp
.endm
/* /*
* Enable and disable interrupts. * Enable and disable interrupts.
*/ */
......
...@@ -510,11 +510,7 @@ el1_da: ...@@ -510,11 +510,7 @@ el1_da:
* Data abort handling * Data abort handling
*/ */
mrs x3, far_el1 mrs x3, far_el1
enable_dbg inherit_daif pstate=x23, tmp=x2
// re-enable interrupts if they were enabled in the aborted context
tbnz x23, #7, 1f // PSR_I_BIT
enable_irq
1:
clear_address_tag x0, x3 clear_address_tag x0, x3
mov x2, sp // struct pt_regs mov x2, sp // struct pt_regs
bl do_mem_abort bl do_mem_abort
...@@ -525,7 +521,7 @@ el1_sp_pc: ...@@ -525,7 +521,7 @@ el1_sp_pc:
* Stack or PC alignment exception handling * Stack or PC alignment exception handling
*/ */
mrs x0, far_el1 mrs x0, far_el1
enable_dbg inherit_daif pstate=x23, tmp=x2
mov x2, sp mov x2, sp
bl do_sp_pc_abort bl do_sp_pc_abort
ASM_BUG() ASM_BUG()
...@@ -533,7 +529,7 @@ el1_undef: ...@@ -533,7 +529,7 @@ el1_undef:
/* /*
* Undefined instruction * Undefined instruction
*/ */
enable_dbg inherit_daif pstate=x23, tmp=x2
mov x0, sp mov x0, sp
bl do_undefinstr bl do_undefinstr
ASM_BUG() ASM_BUG()
...@@ -550,7 +546,7 @@ el1_dbg: ...@@ -550,7 +546,7 @@ el1_dbg:
kernel_exit 1 kernel_exit 1
el1_inv: el1_inv:
// TODO: add support for undefined instructions in kernel mode // TODO: add support for undefined instructions in kernel mode
enable_dbg inherit_daif pstate=x23, tmp=x2
mov x0, sp mov x0, sp
mov x2, x1 mov x2, x1
mov x1, #BAD_SYNC mov x1, #BAD_SYNC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment