From b99ba04a8ceb7025c9db10c5bb5f730cad1b2cc9 Mon Sep 17 00:00:00 2001 From: zhuyanlin Date: Wed, 11 May 2022 10:47:38 +0800 Subject: [PATCH] arch:xtensa: Add SYS_flush_context syscall This syscall do nothing as flush context was done in interrupt handler. Signed-off-by: zhuyanlin --- arch/xtensa/include/syscall.h | 21 ++++++++++++++------- arch/xtensa/src/common/xtensa_swint.c | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/arch/xtensa/include/syscall.h b/arch/xtensa/include/syscall.h index 2e82543d32..2df4cac41e 100644 --- a/arch/xtensa/include/syscall.h +++ b/arch/xtensa/include/syscall.h @@ -91,9 +91,9 @@ */ #ifndef CONFIG_BUILD_FLAT -# define CONFIG_SYS_RESERVED 8 +# define CONFIG_SYS_RESERVED 9 #else -# define CONFIG_SYS_RESERVED 4 +# define CONFIG_SYS_RESERVED 5 #endif /* Xtensa system calls ******************************************************/ @@ -119,6 +119,13 @@ #define SYS_switch_context (2) +/* SYS call 3: + * + * void xtensa_flushcontext(void); + */ + +#define SYS_flush_context (3) + #ifdef CONFIG_LIB_SYSCALL /* SYS call 3: @@ -126,7 +133,7 @@ * void xtensa_syscall_return(void); */ -#define SYS_syscall_return (3) +#define SYS_syscall_return (4) #endif /* CONFIG_LIB_SYSCALL */ #ifndef CONFIG_BUILD_FLAT @@ -136,7 +143,7 @@ * noreturn_function; */ -#define SYS_task_start (4) +#define SYS_task_start (5) /* SYS call 5: * @@ -145,7 +152,7 @@ * noreturn_function */ -#define SYS_pthread_start (5) +#define SYS_pthread_start (6) /* SYS call 6: * @@ -153,14 +160,14 @@ * siginfo_t *info, void *ucontext); */ -#define SYS_signal_handler (6) +#define SYS_signal_handler (7) /* SYS call 7: * * void signal_handler_return(void); */ -#define SYS_signal_handler_return (7) +#define SYS_signal_handler_return (8) #endif /* !CONFIG_BUILD_FLAT */ /**************************************************************************** diff --git a/arch/xtensa/src/common/xtensa_swint.c b/arch/xtensa/src/common/xtensa_swint.c index d9a69927d7..45ae1b04f0 100644 --- a/arch/xtensa/src/common/xtensa_swint.c +++ b/arch/xtensa/src/common/xtensa_swint.c @@ -165,6 +165,23 @@ int xtensa_swint(int irq, void *context, void *arg) CURRENT_REGS = (uint32_t *)regs[REG_A4]; } + break; + + /* A2=SYS_flush_context: This flush windows to the stack: + * + * int xtensa_flushcontext(void); + * + * At this point, the following values are saved in context: + * + * A2 = SYS_flush_context + * + * In this case, we simply need to do nothing. + * As flush the register windows to the stack has be done by + * interrupt enter handler. + */ + + case SYS_flush_context: + break; }