arch: arc: fix and optimize the handling of SECT_STAT.IRM
For arc processor equiped with secureshield, SEC_STAT.IRM bit should be recorded, it determins which mode irq should return Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This commit is contained in:
parent
8cbcdd71ec
commit
5a73bf3966
6 changed files with 21 additions and 25 deletions
|
@ -295,6 +295,9 @@ exc_nest_handle:
|
||||||
bset.nz r3, r3, _ARC_V2_SEC_STAT_IRM_BIT
|
bset.nz r3, r3, _ARC_V2_SEC_STAT_IRM_BIT
|
||||||
bclr.z r3, r3, _ARC_V2_SEC_STAT_IRM_BIT
|
bclr.z r3, r3, _ARC_V2_SEC_STAT_IRM_BIT
|
||||||
sflag r3
|
sflag r3
|
||||||
|
/* save _ARC_V2_SEC_STAT */
|
||||||
|
and r3, r3, 0xff
|
||||||
|
push r3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_save_callee_saved_regs
|
_save_callee_saved_regs
|
||||||
|
|
|
@ -85,9 +85,6 @@ GEN_OFFSET_SYM(_callee_saved_stack_t, r24);
|
||||||
GEN_OFFSET_SYM(_callee_saved_stack_t, r25);
|
GEN_OFFSET_SYM(_callee_saved_stack_t, r25);
|
||||||
GEN_OFFSET_SYM(_callee_saved_stack_t, r26);
|
GEN_OFFSET_SYM(_callee_saved_stack_t, r26);
|
||||||
GEN_OFFSET_SYM(_callee_saved_stack_t, fp);
|
GEN_OFFSET_SYM(_callee_saved_stack_t, fp);
|
||||||
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
|
||||||
GEN_OFFSET_SYM(_callee_saved_stack_t, sec_stat);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
#ifdef CONFIG_ARC_HAS_SECURE
|
#ifdef CONFIG_ARC_HAS_SECURE
|
||||||
GEN_OFFSET_SYM(_callee_saved_stack_t, kernel_sp);
|
GEN_OFFSET_SYM(_callee_saved_stack_t, kernel_sp);
|
||||||
|
|
|
@ -94,7 +94,7 @@ SECTION_FUNC(TEXT, _rirq_exit)
|
||||||
|
|
||||||
_check_nest_int_by_irq_act r0, r1
|
_check_nest_int_by_irq_act r0, r1
|
||||||
|
|
||||||
jne _rirq_return_from_rirq
|
jne _rirq_no_reschedule
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_SENTINEL
|
#ifdef CONFIG_STACK_SENTINEL
|
||||||
bl z_check_stack_sentinel
|
bl z_check_stack_sentinel
|
||||||
|
@ -137,6 +137,11 @@ SECTION_FUNC(TEXT, _rirq_exit)
|
||||||
.balign 4
|
.balign 4
|
||||||
_rirq_reschedule:
|
_rirq_reschedule:
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
||||||
|
/* here need to remember SEC_STAT.IRM bit */
|
||||||
|
lr r3, [_ARC_V2_SEC_STAT]
|
||||||
|
push r3
|
||||||
|
#endif
|
||||||
/* _save_callee_saved_regs expects outgoing thread in r2 */
|
/* _save_callee_saved_regs expects outgoing thread in r2 */
|
||||||
_save_callee_saved_regs
|
_save_callee_saved_regs
|
||||||
|
|
||||||
|
@ -219,19 +224,20 @@ _rirq_return_from_coop:
|
||||||
*/
|
*/
|
||||||
st_s r13, [sp, ___isf_t_r13_OFFSET]
|
st_s r13, [sp, ___isf_t_r13_OFFSET]
|
||||||
|
|
||||||
/* stack now has the IRQ stack frame layout, pointing to r0 */
|
/* stack now has the IRQ stack frame layout, pointing to sp */
|
||||||
|
|
||||||
/* fall through to rtie instruction */
|
|
||||||
|
|
||||||
/* rtie will pop the rest from the stack */
|
/* rtie will pop the rest from the stack */
|
||||||
|
rtie
|
||||||
/* fall through to rtie instruction */
|
|
||||||
|
|
||||||
#endif /* CONFIG_PREEMPT_ENABLED */
|
#endif /* CONFIG_PREEMPT_ENABLED */
|
||||||
|
|
||||||
.balign 4
|
.balign 4
|
||||||
_rirq_return_from_firq:
|
_rirq_return_from_firq:
|
||||||
_rirq_return_from_rirq:
|
_rirq_return_from_rirq:
|
||||||
|
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
||||||
|
/* here need to recover SEC_STAT.IRM bit */
|
||||||
|
pop r3
|
||||||
|
sflag r3
|
||||||
|
#endif
|
||||||
_rirq_no_reschedule:
|
_rirq_no_reschedule:
|
||||||
|
|
||||||
rtie
|
rtie
|
||||||
|
|
|
@ -164,6 +164,11 @@ return_loc:
|
||||||
_switch_return_from_rirq:
|
_switch_return_from_rirq:
|
||||||
_switch_return_from_firq:
|
_switch_return_from_firq:
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
||||||
|
/* here need to recover SEC_STAT.IRM bit */
|
||||||
|
pop r3
|
||||||
|
sflag r3
|
||||||
|
#endif
|
||||||
lr r3, [_ARC_V2_STATUS32]
|
lr r3, [_ARC_V2_STATUS32]
|
||||||
bbit1 r3, _ARC_V2_STATUS32_AE_BIT, _return_from_exc_irq
|
bbit1 r3, _ARC_V2_STATUS32_AE_BIT, _return_from_exc_irq
|
||||||
|
|
||||||
|
|
|
@ -128,10 +128,6 @@ struct _callee_saved_stack {
|
||||||
u32_t r26;
|
u32_t r26;
|
||||||
u32_t fp; /* r27 */
|
u32_t fp; /* r27 */
|
||||||
|
|
||||||
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
|
||||||
u32_t sec_stat;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
#ifdef CONFIG_ARC_HAS_SECURE
|
#ifdef CONFIG_ARC_HAS_SECURE
|
||||||
u32_t user_sp;
|
u32_t user_sp;
|
||||||
|
|
|
@ -38,11 +38,6 @@
|
||||||
st r26, [sp, ___callee_saved_stack_t_r26_OFFSET]
|
st r26, [sp, ___callee_saved_stack_t_r26_OFFSET]
|
||||||
st fp, [sp, ___callee_saved_stack_t_fp_OFFSET]
|
st fp, [sp, ___callee_saved_stack_t_fp_OFFSET]
|
||||||
|
|
||||||
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
|
||||||
lr r13, [_ARC_V2_SEC_STAT]
|
|
||||||
st_s r13, [sp, ___callee_saved_stack_t_sec_stat_OFFSET]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
#ifdef CONFIG_ARC_HAS_SECURE
|
#ifdef CONFIG_ARC_HAS_SECURE
|
||||||
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
||||||
|
@ -146,12 +141,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
|
||||||
ld r13, [sp, ___callee_saved_stack_t_sec_stat_OFFSET]
|
|
||||||
|
|
||||||
sflag r13
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ld_s r13, [sp, ___callee_saved_stack_t_r13_OFFSET]
|
ld_s r13, [sp, ___callee_saved_stack_t_r13_OFFSET]
|
||||||
ld_s r14, [sp, ___callee_saved_stack_t_r14_OFFSET]
|
ld_s r14, [sp, ___callee_saved_stack_t_r14_OFFSET]
|
||||||
ld_s r15, [sp, ___callee_saved_stack_t_r15_OFFSET]
|
ld_s r15, [sp, ___callee_saved_stack_t_r15_OFFSET]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue