mirror of
https://github.com/apache/nuttx.git
synced 2025-12-11 21:20:26 +08:00
arch: remove up_current_regs in common code
reason: When entering an exception or interrupt, there are two sets of registers: one is the "running regs", which we need to save, and the other is the "ready to running regs", which we may soon use. For consistency in logic, we can always store the "running regs" in the regs field of g_running_tasks, otherwise it may lead to errors in the storage location of the "running regs." When we need to access the "running regs," we should uniformly retrieve them from the regs field of g_running_tasks. As the next step, we will rename the set_current_regs/up_current_regs functions for each architecture to more appropriate names, solely for the purpose of identifying interrupts. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -59,6 +59,13 @@ uint32_t *ceva_doirq(int irq, uint32_t *regs)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||
|
||||
if (*running_task != NULL)
|
||||
{
|
||||
(*running_task)->xcp.regs = regs;
|
||||
}
|
||||
|
||||
/* Current regs non-zero indicates that we are processing an interrupt;
|
||||
* current_regs is also used to manage interrupt level context
|
||||
* switches.
|
||||
@@ -80,7 +87,7 @@ uint32_t *ceva_doirq(int irq, uint32_t *regs)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
|
||||
nxsched_suspend_scheduler(*running_task);
|
||||
nxsched_resume_scheduler(this_task());
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
|
||||
@@ -78,6 +78,8 @@ void _exit(int status)
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
g_running_tasks[this_cpu()] = tcb;
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
ceva_fullcontextrestore(tcb->xcp.regs);
|
||||
|
||||
Reference in New Issue
Block a user