xtensa port: Fixed crash on startup on CP enabled cores
The issue was that cpStack was changed to a memory buffer by commit https://gerrit.zephyrproject.org/r/#/c/12816 However the assembly code was expecting it to be a pointer and thus issuing an indirection, that leads to wrong addresses. The fix removed this unnecessary indirection and thus the inherent invalid memory access exception. Issue: ZEP-1997 Change-Id: I843f049212f2d116a01b05367a284209f463a5e7 Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
This commit is contained in:
parent
6e1ff792fc
commit
a6e0404983
3 changed files with 8 additions and 10 deletions
|
@ -70,12 +70,9 @@ _Swap:
|
||||||
#if XCHAL_CP_NUM > 0
|
#if XCHAL_CP_NUM > 0
|
||||||
/* Clear CPENABLE, also in task's co-processor state save area. */
|
/* Clear CPENABLE, also in task's co-processor state save area. */
|
||||||
movi a3, 0
|
movi a3, 0
|
||||||
/* a4 := current->arch.preempCoprocReg.cpStack */
|
/* a4 = _kernel->current */
|
||||||
l32i a4, a4, THREAD_OFFSET(cpStack)
|
|
||||||
wsr a3, CPENABLE
|
wsr a3, CPENABLE
|
||||||
beqz a4, 1f
|
s16i a3, a4, THREAD_OFFSET(cpEnable) /* clear saved cpenable */
|
||||||
s16i a3, a4, XT_CPENABLE /* clear saved cpenable */
|
|
||||||
1:
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH
|
#ifdef CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH
|
||||||
|
|
|
@ -66,8 +66,7 @@ _zxt_dispatch:
|
||||||
|
|
||||||
#if XCHAL_CP_NUM > 0
|
#if XCHAL_CP_NUM > 0
|
||||||
/* Restore CPENABLE from task's co-processor save area. */
|
/* Restore CPENABLE from task's co-processor save area. */
|
||||||
l32i a2, a3, THREAD_OFFSET(cpStack)
|
l16ui a3, a3, THREAD_OFFSET(cpEnable) /* a3 := cp_state->cpenable */
|
||||||
l16ui a3, a2, XT_CPENABLE
|
|
||||||
wsr a3, CPENABLE
|
wsr a3, CPENABLE
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
|
@ -179,9 +178,8 @@ _zxt_int_exit:
|
||||||
|
|
||||||
#if XCHAL_CP_NUM > 0
|
#if XCHAL_CP_NUM > 0
|
||||||
l32i a3, a2, KERNEL_OFFSET(current) /* _thread := _kernel->current */
|
l32i a3, a2, KERNEL_OFFSET(current) /* _thread := _kernel->current */
|
||||||
l32i a4, a3, THREAD_OFFSET(cpStack)
|
|
||||||
rsr a5, CPENABLE
|
rsr a5, CPENABLE
|
||||||
s16i a5, a4, XT_CPENABLE /* cp_state->cpenable = CPENABLE; */
|
s16i a5, a3, THREAD_OFFSET(cpEnable) /* cp_state->cpenable = CPENABLE */
|
||||||
movi a3, 0
|
movi a3, 0
|
||||||
wsr a3, CPENABLE /* disable all co-processors */
|
wsr a3, CPENABLE /* disable all co-processors */
|
||||||
#endif
|
#endif
|
||||||
|
@ -379,7 +377,7 @@ _zxt_task_coproc_state:
|
||||||
bnez a15, 1f
|
bnez a15, 1f
|
||||||
l32i a2, a2, KERNEL_OFFSET(current)
|
l32i a2, a2, KERNEL_OFFSET(current)
|
||||||
beqz a2, 1f
|
beqz a2, 1f
|
||||||
l32i a15, a2, THREAD_OFFSET(cpStack)
|
addi a15, a2, THREAD_OFFSET(cpStack)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
1: movi a15, 0
|
1: movi a15, 0
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
#define _thread_offset_to_cpStack \
|
#define _thread_offset_to_cpStack \
|
||||||
(_thread_offset_to_preempCoprocReg + __tPreempCoprocReg_cpStack_OFFSET)
|
(_thread_offset_to_preempCoprocReg + __tPreempCoprocReg_cpStack_OFFSET)
|
||||||
|
|
||||||
|
#define _thread_offset_to_cpEnable \
|
||||||
|
(_thread_offset_to_cpStack + XT_CPENABLE)
|
||||||
|
|
||||||
/* end - threads */
|
/* end - threads */
|
||||||
|
|
||||||
#endif /* _offsets_short_arch__h_ */
|
#endif /* _offsets_short_arch__h_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue