Skip to content

Commit

Permalink
xtensa: inline up_switch_context
Browse files Browse the repository at this point in the history
  • Loading branch information
chirping78 authored and xiaoxiang781216 committed Dec 25, 2024
1 parent bbcf0dc commit 63d3786
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 81 deletions.
10 changes: 10 additions & 0 deletions arch/xtensa/include/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <sys/types.h>
#ifndef __ASSEMBLY__
# include <stdbool.h>
# include <arch/syscall.h>
#endif

#include <arch/types.h>
Expand Down Expand Up @@ -458,6 +459,15 @@ noinstrument_function static inline_function bool up_interrupt_context(void)
}
#endif

#define up_switch_context(tcb, rtcb) \
do { \
if (!up_interrupt_context()) \
{ \
sys_call2(SYS_switch_context, (uintptr_t)&rtcb->xcp.regs, \
(uintptr_t)tcb->xcp.regs); \
} \
} while (0)

/****************************************************************************
* Name: up_getusrpc
****************************************************************************/
Expand Down
1 change: 0 additions & 1 deletion arch/xtensa/src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ list(
xtensa_releasestack.c
xtensa_registerdump.c
xtensa_sigdeliver.c
xtensa_switchcontext.c
xtensa_swint.c
xtensa_stackframe.c
xtensa_saveusercontext.c
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/src/common/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c
CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c
CMN_CSRCS += xtensa_mpu.c xtensa_nputs.c xtensa_oneshot.c xtensa_perf.c
CMN_CSRCS += xtensa_releasestack.c xtensa_registerdump.c xtensa_sigdeliver.c
CMN_CSRCS += xtensa_switchcontext.c xtensa_swint.c xtensa_stackframe.c
CMN_CSRCS += xtensa_swint.c xtensa_stackframe.c
CMN_CSRCS += xtensa_saveusercontext.c xtensa_schedsigaction.c xtensa_udelay.c
CMN_CSRCS += xtensa_usestack.c xtensa_tcbinfo.c

Expand Down
3 changes: 0 additions & 3 deletions arch/xtensa/src/common/xtensa.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@
#define xtensa_context_restore(regs)\
sys_call1(SYS_restore_context, (uintptr_t)regs)

#define xtensa_switchcontext(saveregs, restoreregs)\
sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs)

/* Interrupt codes from other CPUs: */

#define CPU_INTCODE_NONE 0
Expand Down
76 changes: 0 additions & 76 deletions arch/xtensa/src/common/xtensa_switchcontext.c

This file was deleted.

0 comments on commit 63d3786

Please sign in to comment.