ARC: [arcompact] entry.S: Improve early return from exception
authorVineet Gupta <vgupta@synopsys.com>
Sat, 5 Sep 2015 17:38:31 +0000 (23:08 +0530)
committerVineet Gupta <vgupta@synopsys.com>
Sat, 17 Oct 2015 12:18:22 +0000 (17:48 +0530)
The requirement is to
 - Reenable Exceptions (AE cleared)
 - Reenable Interrupts (E1/E2 set)

We need to do wiggle these bits into ERSTATUS and call RTIE.

Prev version used the pre-exception STATUS32 as starting point for what
goes into ERSTATUS. This required explicit fixups of U/DE/L bits.

Instead, use the current (in-exception) STATUS32 as starting point.
Being in exception handler U/DE/L can be safely assumed to be correct.
Only AE/E1/E2 need to be fixed.

So the new implementation is slightly better
 -Avoids read form memory
 -Is 4 bytes smaller for the typical 1 level of intr configuration
 -Depicts the semantics more clearly

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/include/asm/entry-compact.h
arch/arc/include/asm/irqflags-compact.h

index 415443c2a8c4297d235796f8af4a71d2d07002fd..1aff3be9107563ca620072a49abf9e9925d4ec6b 100644 (file)
 
 .macro FAKE_RET_FROM_EXCPN
 
-       ld  r9, [sp, PT_status32]
-       bic r9, r9, (STATUS_U_MASK|STATUS_DE_MASK)
-       bset  r9, r9, STATUS_L_BIT
-       sr  r9, [erstatus]
-       mov r9, 55f
-       sr  r9, [eret]
-
+       lr      r9, [status32]
+       bclr    r9, r9, STATUS_AE_BIT
+       or      r9, r9, (STATUS_E1_MASK|STATUS_E2_MASK)
+       sr      r9, [erstatus]
+       mov     r9, 55f
+       sr      r9, [eret]
        rtie
 55:
 .endm
index a9490841c8012e49a63395df82248210b7d69e6c..d8c608174617783496b8855bc6ed19de9b6f67cd 100644 (file)
 #define STATUS_E2_BIT          2       /* Int 2 enable */
 #define STATUS_A1_BIT          3       /* Int 1 active */
 #define STATUS_A2_BIT          4       /* Int 2 active */
+#define STATUS_AE_BIT          5       /* Exception active */
 
 #define STATUS_E1_MASK         (1<<STATUS_E1_BIT)
 #define STATUS_E2_MASK         (1<<STATUS_E2_BIT)
 #define STATUS_A1_MASK         (1<<STATUS_A1_BIT)
 #define STATUS_A2_MASK         (1<<STATUS_A2_BIT)
+#define STATUS_AE_MASK         (1<<STATUS_AE_BIT)
 #define STATUS_IE_MASK         (STATUS_E1_MASK | STATUS_E2_MASK)
 
 /* Other Interrupt Handling related Aux regs */
This page took 0.025615 seconds and 5 git commands to generate.