arch/tricore: Inline up_switch_context

inline up_switch_context, avoid function call burden.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
This commit is contained in:
zhangyu117
2024-12-12 11:18:57 +08:00
committed by Xiang Xiao
parent 69ed5f54f3
commit b8fd06cf0e
4 changed files with 17 additions and 16 deletions
+15
View File
@@ -34,6 +34,7 @@
#include <sys/types.h>
#ifndef __ASSEMBLY__
# include <stdbool.h>
# include <syscall.h>
#endif
/* Include NuttX-specific IRQ definitions */
@@ -211,6 +212,20 @@ static inline_function uintptr_t up_getusrsp(void *regs)
#endif /* __ASSEMBLY__ */
/****************************************************************************
* Name: up_switch_context
****************************************************************************/
#define up_switch_context(tcb, rtcb) \
do { \
if (!up_interrupt_context()) \
{ \
nxsched_switch_context(rtcb, tcb); \
sys_call2(SYS_switch_context, (uintptr_t)&rtcb->xcp.regs, \
(uintptr_t)tcb->xcp.regs); \
} \
} while (0)
/****************************************************************************
* Name: up_getusrpc
****************************************************************************/
-1
View File
@@ -40,7 +40,6 @@ set(SRCS
tricore_sigdeliver.c
tricore_stackframe.c
tricore_svcall.c
tricore_switchcontext.c
tricore_tcbinfo.c
tricore_trapcall.c
tricore_systimer.c
-1
View File
@@ -41,7 +41,6 @@ CMN_CSRCS += tricore_schedulesigaction.c
CMN_CSRCS += tricore_sigdeliver.c
CMN_CSRCS += tricore_stackframe.c
CMN_CSRCS += tricore_svcall.c
CMN_CSRCS += tricore_switchcontext.c
CMN_CSRCS += tricore_tcbinfo.c
CMN_CSRCS += tricore_trapcall.c
CMN_CSRCS += tricore_systimer.c
+2 -14
View File
@@ -131,20 +131,8 @@
/* Context switching */
#ifndef tricore_fullcontextrestore
# define tricore_fullcontextrestore(restoreregs) \
sys_call1(SYS_restore_context, (uintptr_t)restoreregs);
#else
extern void tricore_fullcontextrestore(uintptr_t *restoreregs);
#endif
#ifndef tricore_switchcontext
# define tricore_switchcontext(saveregs, restoreregs) \
sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs);
#else
extern void tricore_switchcontext(uintptr_t **saveregs,
uintptr_t *restoreregs);
#endif
#define tricore_fullcontextrestore(restoreregs) \
sys_call1(SYS_restore_context, (uintptr_t)restoreregs);
/****************************************************************************
* Public Types