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:
hujun5
2024-09-24 16:46:08 +08:00
committed by Xiang Xiao
parent 5300d77398
commit 19b4911d7f
51 changed files with 305 additions and 171 deletions

View File

@@ -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.

View File

@@ -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);