mirror of
https://github.com/apache/nuttx.git
synced 2026-05-12 09:48:31 +08:00
arch/tricore: Place nxsched_switch_context() at the correct location
Build Documentation / build-html (push) Has been cancelled
Build Documentation / build-html (push) Has been cancelled
The current implementation does not call nxsched_switch_context() exactly when a task switch occurs. This patch fixes the issue by placing the call at the correct location. Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
This commit is contained in:
committed by
Matteo Golin
parent
cb2d591b42
commit
4057d86e2b
@@ -56,11 +56,18 @@
|
||||
|
||||
void tricore_svcall(volatile void *trap)
|
||||
{
|
||||
struct tcb_s *running_task;
|
||||
struct tcb_s *tcb;
|
||||
int cpu = this_cpu();
|
||||
|
||||
uintptr_t *regs;
|
||||
uint32_t cmd;
|
||||
|
||||
regs = (uintptr_t *)__mfcr(CPU_PCXI);
|
||||
|
||||
running_task = g_running_tasks[cpu];
|
||||
tcb = this_task();
|
||||
|
||||
/* DSYNC instruction should be executed immediately prior to the MTCR */
|
||||
|
||||
__dsync();
|
||||
@@ -115,12 +122,16 @@ void tricore_svcall(volatile void *trap)
|
||||
|
||||
if (regs != up_current_regs())
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_switch_context(running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
*/
|
||||
|
||||
g_running_tasks[this_cpu()] = this_task();
|
||||
g_running_tasks[cpu] = this_task();
|
||||
|
||||
regs[REG_UPCXI] = (uintptr_t)up_current_regs();
|
||||
|
||||
|
||||
@@ -80,10 +80,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
else
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
tricore_switchcontext(&rtcb->xcp.regs, tcb->xcp.regs);
|
||||
|
||||
Reference in New Issue
Block a user