Xtensa port: Fixed Swap function not updating _kernel.current.

Change-Id: I561967404751436717950e28a776317aea5e05c3
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
This commit is contained in:
Mazen NEIFER 2017-01-30 22:10:37 +01:00 committed by Andrew Boie
commit b72936f305
2 changed files with 6 additions and 5 deletions

View file

@ -78,8 +78,9 @@ _Swap:
call4 _sys_k_event_logger_context_switch call4 _sys_k_event_logger_context_switch
#endif #endif
#endif #endif
/* Updated current thread: _kernel.current := _kernel.ready_q.cache */
l32i a2, a2, KERNEL_OFFSET(ready_q_cache) l32i a3, a2, KERNEL_OFFSET(ready_q_cache)
s32i a3, a2, KERNEL_OFFSET(current) /* _kernel.current := a3 */
/* /*
* At this point, the a2 register contains the 'k_thread *' of the * At this point, the a2 register contains the 'k_thread *' of the
* thread to be swapped in. * thread to be swapped in.

View file

@ -16,14 +16,14 @@
.set _interrupt_stack_top, _interrupt_stack + CONFIG_ISR_STACK_SIZE .set _interrupt_stack_top, _interrupt_stack + CONFIG_ISR_STACK_SIZE
/* /*
* _zxt_dispatch(k_thread_t *_thread) * _zxt_dispatch(k_thread_t *_thread)
* parameter _thread should be passed in a3, not in a2 as ABI is expecting!!!
*/ */
.text .text
.globl _zxt_dispatch .globl _zxt_dispatch
.type _zxt_dispatch,@function .type _zxt_dispatch,@function
.align 4 .align 4
_zxt_dispatch: _zxt_dispatch:
mov a3, a2 /* a3 := _thread = _kernel.ready_q.cache */
l32i sp, a3, THREAD_OFFSET(sp) /* sp := _thread->topOfStack; */ l32i sp, a3, THREAD_OFFSET(sp) /* sp := _thread->topOfStack; */
/* Determine the type of stack frame. */ /* Determine the type of stack frame. */
@ -190,7 +190,7 @@ _zxt_int_exit:
wsr a3, CPENABLE /* disable all co-processors */ wsr a3, CPENABLE /* disable all co-processors */
#endif #endif
l32i a2, a2, KERNEL_OFFSET(ready_q_cache) l32i a3, a2, KERNEL_OFFSET(ready_q_cache)
/* /*
* At this point, the a2 register contains the 'k_thread *' of the * At this point, the a2 register contains the 'k_thread *' of the
* thread to be swapped in. * thread to be swapped in.