From 4f99a38b06357e11cc24dbacbf19862d67d3e94e Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Wed, 17 Apr 2019 14:54:15 -0700 Subject: [PATCH] arch: all: Remove not used struct _caller_saved The struct _caller_saved is not used. Most architectures put automatically the registers onto stack, in others architectures the exception code does it. Signed-off-by: Flavio Ceolin --- arch/arc/include/kernel_arch_thread.h | 10 ------- arch/arm/include/kernel_arch_thread.h | 23 +--------------- arch/nios2/include/kernel_arch_thread.h | 10 ------- arch/posix/include/kernel_arch_thread.h | 8 ------ arch/riscv32/include/kernel_arch_thread.h | 10 ------- arch/x86/include/kernel_arch_thread.h | 27 ------------------- arch/x86_64/include/kernel_arch_thread.h | 1 - arch/xtensa/core/offsets/offsets.c | 3 --- arch/xtensa/include/kernel_arch_thread.h | 23 ---------------- include/kernel.h | 2 -- kernel/include/kernel_offsets.h | 1 - .../ztest/include/kernel_arch_thread.h | 6 ----- 12 files changed, 1 insertion(+), 123 deletions(-) diff --git a/arch/arc/include/kernel_arch_thread.h b/arch/arc/include/kernel_arch_thread.h index 33b57f989dd..98f882838dd 100644 --- a/arch/arc/include/kernel_arch_thread.h +++ b/arch/arc/include/kernel_arch_thread.h @@ -12,7 +12,6 @@ * * struct _thread_arch * struct _callee_saved - * struct _caller_saved * * necessary to instantiate instances of struct k_thread. */ @@ -32,15 +31,6 @@ #ifndef _ASMLANGUAGE #include -struct _caller_saved { - /* - * Saved on the stack as part of handling a regular IRQ or by the - * kernel when calling the FIRQ return code. - */ -}; - -typedef struct _caller_saved _caller_saved_t; - struct _callee_saved { u32_t sp; /* r28 */ }; diff --git a/arch/arm/include/kernel_arch_thread.h b/arch/arm/include/kernel_arch_thread.h index e39b1c2fecc..074118c10cb 100644 --- a/arch/arm/include/kernel_arch_thread.h +++ b/arch/arm/include/kernel_arch_thread.h @@ -12,8 +12,7 @@ * * struct _thread_arch * struct _callee_saved - * struct _caller_saved - * + * * necessary to instantiate instances of struct k_thread. */ @@ -23,26 +22,6 @@ #ifndef _ASMLANGUAGE #include -struct _caller_saved { - /* - * Unused for Cortex-M, which automatically saves the necessary - * registers in its exception stack frame. - * - * For Cortex-A, this may be: - * - * u32_t a1; r0 - * u32_t a2; r1 - * u32_t a3; r2 - * u32_t a4; r3 - * u32_t ip; r12 - * u32_t lr; r14 - * u32_t pc; r15 - * u32_t xpsr; - */ -}; - -typedef struct _caller_saved _caller_saved_t; - struct _callee_saved { u32_t v1; /* r4 */ u32_t v2; /* r5 */ diff --git a/arch/nios2/include/kernel_arch_thread.h b/arch/nios2/include/kernel_arch_thread.h index 9266a45b62c..975b66c2a42 100644 --- a/arch/nios2/include/kernel_arch_thread.h +++ b/arch/nios2/include/kernel_arch_thread.h @@ -12,7 +12,6 @@ * * struct _thread_arch * struct _callee_saved - * struct _caller_saved * * necessary to instantiate instances of struct k_thread. */ @@ -23,15 +22,6 @@ #ifndef _ASMLANGUAGE #include -struct _caller_saved { - /* - * Nothing here, the exception code puts all the caller-saved - * registers onto the stack. - */ -}; - -typedef struct _caller_saved _caller_saved_t; - struct _callee_saved { /* General purpose callee-saved registers */ u32_t r16; diff --git a/arch/posix/include/kernel_arch_thread.h b/arch/posix/include/kernel_arch_thread.h index d97594957f9..6611df024fb 100644 --- a/arch/posix/include/kernel_arch_thread.h +++ b/arch/posix/include/kernel_arch_thread.h @@ -13,7 +13,6 @@ * * struct _thread_arch * struct _callee_saved - * struct _caller_saved * * necessary to instantiate instances of struct k_thread. */ @@ -24,13 +23,6 @@ #ifndef _ASMLANGUAGE #include -struct _caller_saved { - /* - * Nothing here - */ -}; - - struct _callee_saved { /* IRQ status before irq_lock() and call to z_swap() */ u32_t key; diff --git a/arch/riscv32/include/kernel_arch_thread.h b/arch/riscv32/include/kernel_arch_thread.h index 24c2d7d0112..0a66521d9fb 100644 --- a/arch/riscv32/include/kernel_arch_thread.h +++ b/arch/riscv32/include/kernel_arch_thread.h @@ -12,7 +12,6 @@ * * struct _thread_arch * struct _callee_saved - * struct _caller_saved * * necessary to instantiate instances of struct k_thread. */ @@ -45,15 +44,6 @@ struct _callee_saved { }; typedef struct _callee_saved _callee_saved_t; -struct _caller_saved { - /* - * Nothing here, the exception code puts all the caller-saved - * registers onto the stack. - */ -}; - -typedef struct _caller_saved _caller_saved_t; - struct _thread_arch { u32_t swap_return_value; /* Return value of z_swap() */ }; diff --git a/arch/x86/include/kernel_arch_thread.h b/arch/x86/include/kernel_arch_thread.h index 660359464dd..ec98df36181 100644 --- a/arch/x86/include/kernel_arch_thread.h +++ b/arch/x86/include/kernel_arch_thread.h @@ -12,7 +12,6 @@ * * struct _thread_arch * struct _callee_saved - * struct _caller_saved * * necessary to instantiate instances of struct k_thread. */ @@ -37,32 +36,6 @@ #ifndef _ASMLANGUAGE #include -/* - * The following structure defines the set of 'volatile' integer registers. - * These registers need not be preserved by a called C function. Given that - * they are not preserved across function calls, they must be save/restored - * (along with the struct _caller_saved) when a preemptive context switch - * occurs. - */ - -struct _caller_saved { - - /* - * The volatile registers 'eax', 'ecx' and 'edx' area not included in - * the definition of 'tPreempReg' since the interrupt and exception - * handling routunes use the stack to save and restore the values of - * these registers in order to support interrupt nesting. The stubs - * do _not_ copy the saved values from the stack into the TCS. - * - * unsigned long eax; - * unsigned long ecx; - * unsigned long edx; - */ - -}; - -typedef struct _caller_saved _caller_saved_t; - /* * The following structure defines the set of 'non-volatile' integer registers. * These registers must be preserved by a called C function. These are the diff --git a/arch/x86_64/include/kernel_arch_thread.h b/arch/x86_64/include/kernel_arch_thread.h index 78fb5ee900f..5fd04ed0fce 100644 --- a/arch/x86_64/include/kernel_arch_thread.h +++ b/arch/x86_64/include/kernel_arch_thread.h @@ -11,7 +11,6 @@ * Zephyr thread struct. But we don't need that for this arch. */ -struct _caller_saved { }; struct _callee_saved { }; struct _thread_arch { }; diff --git a/arch/xtensa/core/offsets/offsets.c b/arch/xtensa/core/offsets/offsets.c index b74d32689b9..8ff8ce3241b 100644 --- a/arch/xtensa/core/offsets/offsets.c +++ b/arch/xtensa/core/offsets/offsets.c @@ -50,9 +50,6 @@ GEN_OFFSET_SYM(__esf_t, pc); /* size of the entire __esf_t structure */ GEN_ABSOLUTE_SYM(____esf_t_SIZEOF, sizeof(__esf_t)); -/* size of the entire preempt registers structure */ -GEN_ABSOLUTE_SYM(__tPreempt_SIZEOF, sizeof(_caller_saved_t)); - /* size of the struct k_thread structure without save area for coproc regs */ GEN_ABSOLUTE_SYM(_K_THREAD_NO_FLOAT_SIZEOF, sizeof(struct k_thread) - sizeof(tCoopCoprocReg) - diff --git a/arch/xtensa/include/kernel_arch_thread.h b/arch/xtensa/include/kernel_arch_thread.h index 6f33ee341d2..0d2731d3fa3 100644 --- a/arch/xtensa/include/kernel_arch_thread.h +++ b/arch/xtensa/include/kernel_arch_thread.h @@ -12,7 +12,6 @@ * * struct _thread_arch * struct _callee_saved - * struct _caller_saved * * necessary to instantiate instances of struct k_thread. */ @@ -24,28 +23,6 @@ #include #include -/* - * The following structure defines the set of 'volatile' integer registers. - * These registers need not be preserved by a called C function. Given that - * they are not preserved across function calls, they must be save/restored - * (along with the struct _caller_saved) when a preemptive context switch - * occurs. - */ - -struct _caller_saved { - - /* - * The volatile registers area not included in the definition of - * 'tPreempReg' since the interrupt stubs (_IntEnt/_IntExit) - * and exception stubs (_ExcEnt/_ExcEnter) use the stack to save and - * restore the values of these registers in order to support interrupt - * nesting. The stubs do _not_ copy the saved values from the stack - * into the k_thread. - */ -}; - -typedef struct _caller_saved _caller_saved_t; - /* * The following structure defines the set of 'non-volatile' integer registers. * These registers must be preserved by a called C function. These are the diff --git a/include/kernel.h b/include/kernel.h index 4050ecdcbb7..425024d6329 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -513,8 +513,6 @@ struct k_thread { struct _thread_base base; - /** defined by the architecture, but all archs need these */ - struct _caller_saved caller_saved; /** defined by the architecture, but all archs need these */ struct _callee_saved callee_saved; diff --git a/kernel/include/kernel_offsets.h b/kernel/include/kernel_offsets.h index 7eb590a18d0..ccbee7a88c6 100644 --- a/kernel/include/kernel_offsets.h +++ b/kernel/include/kernel_offsets.h @@ -55,7 +55,6 @@ GEN_OFFSET_SYM(_thread_base_t, preempt); GEN_OFFSET_SYM(_thread_base_t, swap_data); GEN_OFFSET_SYM(_thread_t, base); -GEN_OFFSET_SYM(_thread_t, caller_saved); GEN_OFFSET_SYM(_thread_t, callee_saved); GEN_OFFSET_SYM(_thread_t, arch); diff --git a/subsys/testsuite/ztest/include/kernel_arch_thread.h b/subsys/testsuite/ztest/include/kernel_arch_thread.h index cd21574a85f..0122f42c965 100644 --- a/subsys/testsuite/ztest/include/kernel_arch_thread.h +++ b/subsys/testsuite/ztest/include/kernel_arch_thread.h @@ -12,7 +12,6 @@ * * struct _thread_arch * struct _callee_saved - * struct _caller_saved * * necessary to instantiate instances of struct k_thread. */ @@ -23,11 +22,6 @@ #ifndef _ASMLANGUAGE -struct _caller_saved { -}; - -typedef struct _caller_saved _caller_saved_t; - struct _callee_saved { };