Skip to content

Commit 273bc76

Browse files
committed
arch/xtensa: support decouple signal related function from arch code
make arch xtensa implementation can work when signal is disabled Signed-off-by: guoshichao <[email protected]>
1 parent 94265cf commit 273bc76

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

arch/xtensa/include/irq.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct xcpt_syscall_s
189189

190190
struct xcptcontext
191191
{
192+
#ifndef CONFIG_DISABLE_SIGNALS
192193
/* These are saved copies of registers used during signal processing.
193194
*
194195
* REVISIT: Because there is only one copy of these save areas,
@@ -199,17 +200,18 @@ struct xcptcontext
199200

200201
uint32_t *saved_regs;
201202

202-
/* Register save area */
203-
204-
uint32_t *regs;
205-
206203
#ifndef CONFIG_BUILD_FLAT
207204
/* This is the saved address to use when returning from a user-space
208205
* signal handler.
209206
*/
210207

211208
uintptr_t sigreturn;
212209
#endif
210+
#endif /* !CONFIG_DISABLE_SIGNALS */
211+
212+
/* Register save area */
213+
214+
uint32_t *regs;
213215

214216
#ifdef CONFIG_LIB_SYSCALL
215217
/* The following array holds the return address and the exc_return value

arch/xtensa/src/common/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,18 @@ list(
6969
xtensa_perf.c
7070
xtensa_releasestack.c
7171
xtensa_registerdump.c
72-
xtensa_sigdeliver.c
7372
xtensa_swint.c
7473
xtensa_stackframe.c
7574
xtensa_saveusercontext.c
76-
xtensa_schedsigaction.c
7775
xtensa_usestack.c
7876
xtensa_tcbinfo.c)
7977

8078
# Configuration-dependent common Xtensa files
8179

80+
if(NOT CONFIG_DISABLE_SIGNALS)
81+
list(APPEND SRCS xtensa_sigdeliver.c xtensa_schedsigaction.c)
82+
endif()
83+
8284
if(CONFIG_ARCH_USE_TEXT_HEAP)
8385
list(APPEND SRCS xtensa_loadstore.S)
8486
endif()
@@ -106,8 +108,10 @@ endif()
106108
if(CONFIG_BUILD_PROTECTED)
107109
target_sources(arch_interface PRIVATE xtensa_signal_handler.S)
108110
list(APPEND SRCS xtensa_dispatch_syscall.S)
109-
list(APPEND SRCS xtensa_signal_dispatch.c xtensa_task_start.c
110-
xtensa_pthread_start.c)
111+
list(APPEND SRCS xtensa_task_start.c xtensa_pthread_start.c)
112+
if(NOT CONFIG_DISABLE_SIGNALS)
113+
list(APPEND SRCS xtensa_signal_dispatch.c)
114+
endif()
111115
endif()
112116

113117
target_sources(arch PRIVATE ${SRCS})

arch/xtensa/src/common/Make.defs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ CMN_CSRCS += xtensa_getintstack.c xtensa_initialize.c xtensa_initialstate.c
3737
CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c
3838
CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c
3939
CMN_CSRCS += xtensa_mpu.c xtensa_nputs.c xtensa_oneshot.c xtensa_perf.c
40-
CMN_CSRCS += xtensa_releasestack.c xtensa_registerdump.c xtensa_sigdeliver.c
40+
CMN_CSRCS += xtensa_releasestack.c xtensa_registerdump.c
4141
CMN_CSRCS += xtensa_swint.c xtensa_stackframe.c
42-
CMN_CSRCS += xtensa_saveusercontext.c xtensa_schedsigaction.c
43-
CMN_CSRCS += xtensa_usestack.c xtensa_tcbinfo.c
42+
CMN_CSRCS += xtensa_saveusercontext.c xtensa_usestack.c xtensa_tcbinfo.c
4443

4544
# Configuration-dependent common Xtensa files
4645

46+
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
47+
CMN_CSRCS += xtensa_schedsigaction.c xtensa_sigdeliver.c
48+
endif
49+
4750
ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP),y)
4851
CMN_ASRCS += xtensa_loadstore.S
4952
endif
@@ -80,5 +83,8 @@ endif
8083
ifeq ($(CONFIG_BUILD_PROTECTED),y)
8184
CMN_UASRCS += xtensa_signal_handler.S
8285
CMN_ASRCS += xtensa_dispatch_syscall.S
83-
CMN_CSRCS += xtensa_signal_dispatch.c xtensa_task_start.c xtensa_pthread_start.c
86+
CMN_CSRCS += xtensa_task_start.c xtensa_pthread_start.c
87+
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
88+
CMN_CSRCS += xtensa_signal_dispatch.c
89+
endif
8490
endif

arch/xtensa/src/common/xtensa_signal_dispatch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#include <arch/syscall.h>
3232

33-
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
33+
#ifdef __KERNEL__
3434

3535
/****************************************************************************
3636
* Public Functions
@@ -74,4 +74,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
7474
(uintptr_t)info, (uintptr_t)ucontext);
7575
}
7676

77-
#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */
77+
#endif

0 commit comments

Comments
 (0)