1
0
Fork 0
forked from nuttx/nuttx-update

arch/arm64: syscall SYS_switch_context and SYS_restore_context use 0 para

reason:
simplify context switch
sys_call0(SYS_switch_context)
sys_call0(SYS_restore_context)

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-11-23 11:15:35 +08:00 committed by Xiang Xiao
parent f4d212fd6d
commit fccd908114
4 changed files with 6 additions and 12 deletions

View file

@ -447,8 +447,9 @@ static inline void up_irq_restore(irqstate_t flags)
{ \
if (!up_interrupt_context()) \
{ \
sys_call2(SYS_switch_context, (uintptr_t)rtcb, (uintptr_t)tcb); \
sys_call0(SYS_switch_context); \
} \
UNUSED(rtcb); \
} \
while (0)

View file

@ -57,24 +57,17 @@
void up_exit(int status)
{
struct tcb_s *tcb = this_task();
UNUSED(status);
/* Destroy the task at the head of the ready to run list. */
nxtask_exit();
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.
*/
tcb = this_task();
/* Scheduler parameters will update inside syscall */
g_running_tasks[this_cpu()] = NULL;
/* Then switch contexts */
arm64_fullcontextrestore(tcb);
arm64_fullcontextrestore();
}

View file

@ -112,10 +112,10 @@
/* Context switching */
#define arm64_fullcontextrestore(next) \
#define arm64_fullcontextrestore() \
do \
{ \
sys_call1(SYS_restore_context, (uintptr_t)next); \
sys_call0(SYS_restore_context); \
} \
while (1)

View file

@ -162,5 +162,5 @@ retry:
#endif
g_running_tasks[this_cpu()] = NULL;
arm64_fullcontextrestore(rtcb);
arm64_fullcontextrestore();
}