mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
arch/tricore: Regs for context switching save the memory address of the CSA.
In the exception panic process, regs needs to use a memory address, which defaults to PCXI. Here, it is uniformly saved as the actual memory address. Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
This commit is contained in:
@@ -205,14 +205,15 @@ static inline_function bool up_interrupt_context(void)
|
|||||||
static inline_function uintptr_t up_getusrsp(void *regs)
|
static inline_function uintptr_t up_getusrsp(void *regs)
|
||||||
{
|
{
|
||||||
uintptr_t *csa = regs;
|
uintptr_t *csa = regs;
|
||||||
|
uintptr_t pcxi = tricore_addr2csa(csa);
|
||||||
|
|
||||||
while (((uintptr_t)csa & PCXI_UL) == 0)
|
while ((pcxi & PCXI_UL) == 0)
|
||||||
{
|
{
|
||||||
csa = tricore_csa2addr((uintptr_t)csa);
|
csa = tricore_csa2addr(csa[REG_UPCXI]);
|
||||||
csa = (uintptr_t *)csa[0];
|
pcxi = csa[REG_UPCXI];
|
||||||
}
|
}
|
||||||
|
|
||||||
csa = tricore_csa2addr((uintptr_t)csa);
|
csa = tricore_csa2addr(pcxi);
|
||||||
|
|
||||||
return csa[REG_SP];
|
return csa[REG_SP];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ uintptr_t *tricore_alloc_csa(uintptr_t pc, uintptr_t sp,
|
|||||||
plcsa[REG_LPCXI] |= PCXI_PIE;
|
plcsa[REG_LPCXI] |= PCXI_PIE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uintptr_t *)tricore_addr2csa(plcsa);
|
return plcsa;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255)
|
|||||||
uintptr_t *regs;
|
uintptr_t *regs;
|
||||||
|
|
||||||
icr.U = __mfcr(CPU_ICR);
|
icr.U = __mfcr(CPU_ICR);
|
||||||
regs = (uintptr_t *)__mfcr(CPU_PCXI);
|
regs = tricore_csa2addr(__mfcr(CPU_PCXI));
|
||||||
|
|
||||||
if (running_task != NULL)
|
if (running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -112,7 +112,7 @@ IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255)
|
|||||||
running_task = tcb;
|
running_task = tcb;
|
||||||
g_running_tasks[this_cpu()] = running_task;
|
g_running_tasks[this_cpu()] = running_task;
|
||||||
|
|
||||||
__mtcr(CPU_PCXI, (uintptr_t)up_current_regs());
|
__mtcr(CPU_PCXI, tricore_addr2csa(up_current_regs()));
|
||||||
__isync();
|
__isync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void tricore_svcall(volatile void *trap)
|
|||||||
|
|
||||||
case SYS_switch_context:
|
case SYS_switch_context:
|
||||||
{
|
{
|
||||||
*(uintptr_t **)regs[REG_D9] = (uintptr_t *)regs[REG_UPCXI];
|
*(uintptr_t **)regs[REG_D9] = tricore_csa2addr(regs[REG_UPCXI]);
|
||||||
up_set_current_regs((uintptr_t *)regs[REG_D10]);
|
up_set_current_regs((uintptr_t *)regs[REG_D10]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -133,7 +133,7 @@ void tricore_svcall(volatile void *trap)
|
|||||||
|
|
||||||
g_running_tasks[cpu] = this_task();
|
g_running_tasks[cpu] = this_task();
|
||||||
|
|
||||||
regs[REG_UPCXI] = (uintptr_t)up_current_regs();
|
regs[REG_UPCXI] = tricore_addr2csa(up_current_regs());
|
||||||
|
|
||||||
__isync();
|
__isync();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user