mirror of
https://github.com/apache/nuttx.git
synced 2026-05-18 00:34:10 +08:00
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:
@@ -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
|
||||
****************************************************************************/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user