From 3998e18ec463c3542240e62b53270de507bc472a Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sat, 1 Jun 2024 10:26:04 +0800 Subject: [PATCH] arch: rename all esf struct to `struct arch_esf` Rename every architecture's esf struct to `struct esf`. Signed-off-by: Yong Cong Sin --- arch/arc/include/kernel_arch_data.h | 6 +++--- arch/arm/include/kernel_arch_data.h | 2 +- arch/arm64/core/thread.c | 2 +- arch/arm64/include/kernel_arch_data.h | 2 +- arch/mips/core/thread.c | 6 +++--- arch/riscv/Kconfig | 2 +- arch/riscv/core/thread.c | 6 +++--- include/zephyr/arch/arc/v2/exception.h | 2 +- include/zephyr/arch/arm/cortex_a_r/exception.h | 4 ++-- include/zephyr/arch/arm/cortex_m/exception.h | 4 ++-- include/zephyr/arch/arm64/exception.h | 4 ++-- include/zephyr/arch/mips/exception.h | 4 ++-- include/zephyr/arch/nios2/exception.h | 4 ++-- include/zephyr/arch/posix/exception.h | 4 ++-- include/zephyr/arch/riscv/exception.h | 4 ++-- include/zephyr/arch/sparc/exception.h | 4 ++-- include/zephyr/arch/x86/ia32/exception.h | 2 +- include/zephyr/arch/x86/intel64/exception.h | 4 ++-- include/zephyr/arch/xtensa/exception.h | 3 +++ scripts/coredump/gdbstubs/arch/arm64.py | 2 +- soc/nordic/common/vpr/soc_isr_stacking.h | 4 ++-- subsys/testsuite/ztest/include/zephyr/ztest.h | 4 ++-- tests/arch/arm/arm_interrupt/src/arm_interrupt.c | 2 +- 23 files changed, 42 insertions(+), 39 deletions(-) diff --git a/arch/arc/include/kernel_arch_data.h b/arch/arc/include/kernel_arch_data.h index efe2bd7d1c6..b0dc733446b 100644 --- a/arch/arc/include/kernel_arch_data.h +++ b/arch/arc/include/kernel_arch_data.h @@ -36,7 +36,7 @@ extern "C" { #endif #ifdef CONFIG_ARC_HAS_SECURE -struct _irq_stack_frame { +struct arch_esf { #ifdef CONFIG_ARC_HAS_ZOL uintptr_t lp_end; uintptr_t lp_start; @@ -72,7 +72,7 @@ struct _irq_stack_frame { uintptr_t status32; }; #else -struct _irq_stack_frame { +struct arch_esf { uintptr_t r0; uintptr_t r1; uintptr_t r2; @@ -108,7 +108,7 @@ struct _irq_stack_frame { }; #endif -typedef struct _irq_stack_frame _isf_t; +typedef struct arch_esf _isf_t; diff --git a/arch/arm/include/kernel_arch_data.h b/arch/arm/include/kernel_arch_data.h index 5ad19db8f84..9b4ca04f66c 100644 --- a/arch/arm/include/kernel_arch_data.h +++ b/arch/arm/include/kernel_arch_data.h @@ -42,7 +42,7 @@ extern "C" { #endif -typedef struct __esf _esf_t; +typedef struct arch_esf _esf_t; typedef struct __basic_sf _basic_sf_t; #if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) typedef struct __fpu_sf _fpu_sf_t; diff --git a/arch/arm64/core/thread.c b/arch/arm64/core/thread.c index a0269501c19..667a868602d 100644 --- a/arch/arm64/core/thread.c +++ b/arch/arm64/core/thread.c @@ -102,7 +102,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, * dropping into EL0. */ - pInitCtx = Z_STACK_PTR_TO_FRAME(struct __esf, stack_ptr); + pInitCtx = Z_STACK_PTR_TO_FRAME(struct arch_esf, stack_ptr); pInitCtx->x0 = (uint64_t)entry; pInitCtx->x1 = (uint64_t)p1; diff --git a/arch/arm64/include/kernel_arch_data.h b/arch/arm64/include/kernel_arch_data.h index ec781fc902d..8b607c1dbf4 100644 --- a/arch/arm64/include/kernel_arch_data.h +++ b/arch/arm64/include/kernel_arch_data.h @@ -36,7 +36,7 @@ extern "C" { #endif -typedef struct __esf _esf_t; +typedef struct arch_esf _esf_t; typedef struct __basic_sf _basic_sf_t; #ifdef __cplusplus diff --git a/arch/mips/core/thread.c b/arch/mips/core/thread.c index e551674d521..7966ff462f5 100644 --- a/arch/mips/core/thread.c +++ b/arch/mips/core/thread.c @@ -19,11 +19,11 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, char *stack_ptr, k_thread_entry_t entry, void *p1, void *p2, void *p3) { - struct __esf *stack_init; + struct arch_esf *stack_init; /* Initial stack frame for thread */ - stack_init = (struct __esf *)Z_STACK_PTR_ALIGN( - Z_STACK_PTR_TO_FRAME(struct __esf, stack_ptr) + stack_init = (struct arch_esf *)Z_STACK_PTR_ALIGN( + Z_STACK_PTR_TO_FRAME(struct arch_esf, stack_ptr) ); /* Setup the initial stack frame */ diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 00121adc714..76ea74026ac 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -88,7 +88,7 @@ config RISCV_SOC_HAS_ISR_STACKING guarded by !_ASMLANGUAGE. The ESF should be defined to account for the hardware stacked registers in the proper order as they are saved on the stack by the hardware, and the registers saved by the - software macros. The structure must be called '__esf'. + software macros. The structure must be called 'struct arch_esf'. config RISCV_SOC_HAS_CUSTOM_IRQ_HANDLING bool diff --git a/arch/riscv/core/thread.c b/arch/riscv/core/thread.c index 38d5dbde092..60f73a5f531 100644 --- a/arch/riscv/core/thread.c +++ b/arch/riscv/core/thread.c @@ -23,15 +23,15 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, void *p1, void *p2, void *p3) { extern void z_riscv_thread_start(void); - struct __esf *stack_init; + struct arch_esf *stack_init; #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE const struct soc_esf soc_esf_init = {SOC_ESF_INIT}; #endif /* Initial stack frame for thread */ - stack_init = (struct __esf *)Z_STACK_PTR_ALIGN( - Z_STACK_PTR_TO_FRAME(struct __esf, stack_ptr) + stack_init = (struct arch_esf *)Z_STACK_PTR_ALIGN( + Z_STACK_PTR_TO_FRAME(struct arch_esf, stack_ptr) ); /* Setup the initial stack frame */ diff --git a/include/zephyr/arch/arc/v2/exception.h b/include/zephyr/arch/arc/v2/exception.h index 553024fa3a8..8993d7cfe06 100644 --- a/include/zephyr/arch/arc/v2/exception.h +++ b/include/zephyr/arch/arc/v2/exception.h @@ -20,7 +20,7 @@ extern "C" { #ifdef _ASMLANGUAGE #else -typedef struct _irq_stack_frame z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; #endif #ifdef __cplusplus diff --git a/include/zephyr/arch/arm/cortex_a_r/exception.h b/include/zephyr/arch/arm/cortex_a_r/exception.h index 3bef647566d..2a6bd313e15 100644 --- a/include/zephyr/arch/arm/cortex_a_r/exception.h +++ b/include/zephyr/arch/arm/cortex_a_r/exception.h @@ -54,7 +54,7 @@ struct __extra_esf_info { }; #endif /* CONFIG_EXTRA_EXCEPTION_INFO */ -struct __esf { +struct arch_esf { #if defined(CONFIG_EXTRA_EXCEPTION_INFO) struct __extra_esf_info extra_info; #endif @@ -75,7 +75,7 @@ struct __esf { extern uint32_t z_arm_coredump_fault_sp; -typedef struct __esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; extern void z_arm_exc_exit(bool fatal); diff --git a/include/zephyr/arch/arm/cortex_m/exception.h b/include/zephyr/arch/arm/cortex_m/exception.h index a9896cea1e4..09ab68575b0 100644 --- a/include/zephyr/arch/arm/cortex_m/exception.h +++ b/include/zephyr/arch/arm/cortex_m/exception.h @@ -98,7 +98,7 @@ struct __extra_esf_info { }; #endif /* CONFIG_EXTRA_EXCEPTION_INFO */ -struct __esf { +struct arch_esf { struct __basic_sf { sys_define_gpr_with_alias(a1, r0); sys_define_gpr_with_alias(a2, r1); @@ -119,7 +119,7 @@ struct __esf { extern uint32_t z_arm_coredump_fault_sp; -typedef struct __esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; extern void z_arm_exc_exit(void); diff --git a/include/zephyr/arch/arm64/exception.h b/include/zephyr/arch/arm64/exception.h index 05257c087fe..d6be6715d5d 100644 --- a/include/zephyr/arch/arm64/exception.h +++ b/include/zephyr/arch/arm64/exception.h @@ -24,7 +24,7 @@ extern "C" { #endif -struct __esf { +struct arch_esf { uint64_t x0; uint64_t x1; uint64_t x2; @@ -55,7 +55,7 @@ struct __esf { #endif } __aligned(16); -typedef struct __esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; #ifdef __cplusplus } diff --git a/include/zephyr/arch/mips/exception.h b/include/zephyr/arch/mips/exception.h index d4403f1d599..40e9ac0506f 100644 --- a/include/zephyr/arch/mips/exception.h +++ b/include/zephyr/arch/mips/exception.h @@ -17,7 +17,7 @@ extern "C" { #endif -struct __esf { +struct arch_esf { unsigned long ra; /* return address */ unsigned long gp; /* global pointer */ @@ -50,7 +50,7 @@ struct __esf { unsigned long cause; }; -typedef struct __esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; #ifdef __cplusplus } diff --git a/include/zephyr/arch/nios2/exception.h b/include/zephyr/arch/nios2/exception.h index 5b781e9114b..af13754baa6 100644 --- a/include/zephyr/arch/nios2/exception.h +++ b/include/zephyr/arch/nios2/exception.h @@ -14,7 +14,7 @@ extern "C" { #endif -struct __esf { +struct arch_esf { uint32_t ra; /* return address r31 */ uint32_t r1; /* at */ uint32_t r2; /* return value */ @@ -35,7 +35,7 @@ struct __esf { uint32_t instr; /* Instruction being executed when exc occurred */ }; -typedef struct __esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; #ifdef __cplusplus } diff --git a/include/zephyr/arch/posix/exception.h b/include/zephyr/arch/posix/exception.h index 2e5e7155bc0..d267d87363c 100644 --- a/include/zephyr/arch/posix/exception.h +++ b/include/zephyr/arch/posix/exception.h @@ -15,11 +15,11 @@ extern "C" { #endif -struct __esf { +struct arch_esf { uint32_t dummy; /*maybe we will want to add something someday*/ }; -typedef struct __esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; #ifdef __cplusplus } diff --git a/include/zephyr/arch/riscv/exception.h b/include/zephyr/arch/riscv/exception.h index 644df2cd1fb..05d5bac02c2 100644 --- a/include/zephyr/arch/riscv/exception.h +++ b/include/zephyr/arch/riscv/exception.h @@ -48,7 +48,7 @@ struct soc_esf { #if defined(CONFIG_RISCV_SOC_HAS_ISR_STACKING) SOC_ISR_STACKING_ESF_DECLARE; #else -struct __esf { +struct arch_esf { unsigned long ra; /* return address */ unsigned long t0; /* Caller-saved temporary register */ @@ -87,7 +87,7 @@ struct __esf { } __aligned(16); #endif /* CONFIG_RISCV_SOC_HAS_ISR_STACKING */ -typedef struct __esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE typedef struct soc_esf soc_esf_t; #endif diff --git a/include/zephyr/arch/sparc/exception.h b/include/zephyr/arch/sparc/exception.h index d867d4d5651..597d1f94df7 100644 --- a/include/zephyr/arch/sparc/exception.h +++ b/include/zephyr/arch/sparc/exception.h @@ -14,7 +14,7 @@ extern "C" { #endif -struct __esf { +struct arch_esf { uint32_t out[8]; uint32_t global[8]; uint32_t psr; @@ -25,7 +25,7 @@ struct __esf { uint32_t y; }; -typedef struct __esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; #ifdef __cplusplus } diff --git a/include/zephyr/arch/x86/ia32/exception.h b/include/zephyr/arch/x86/ia32/exception.h index 30fe3bd973f..929c65428b2 100644 --- a/include/zephyr/arch/x86/ia32/exception.h +++ b/include/zephyr/arch/x86/ia32/exception.h @@ -27,7 +27,7 @@ extern "C" { * Those registers are pushed onto the stack by _ExcEnt(). */ -typedef struct nanoEsf { +typedef struct arch_esf { #ifdef CONFIG_GDBSTUB unsigned int ss; unsigned int gs; diff --git a/include/zephyr/arch/x86/intel64/exception.h b/include/zephyr/arch/x86/intel64/exception.h index 7184d4a9ebb..eb6690eca57 100644 --- a/include/zephyr/arch/x86/intel64/exception.h +++ b/include/zephyr/arch/x86/intel64/exception.h @@ -17,7 +17,7 @@ extern "C" { * the exception stack frame */ -struct x86_esf { +struct arch_esf { #ifdef CONFIG_EXCEPTION_DEBUG /* callee-saved */ unsigned long rbx; @@ -53,7 +53,7 @@ struct x86_esf { unsigned long ss; }; -typedef struct x86_esf z_arch_esf_t; +typedef struct arch_esf z_arch_esf_t; struct x86_ssf { unsigned long rip; diff --git a/include/zephyr/arch/xtensa/exception.h b/include/zephyr/arch/xtensa/exception.h index 51a5d5aef90..94cb4ce5bb2 100644 --- a/include/zephyr/arch/xtensa/exception.h +++ b/include/zephyr/arch/xtensa/exception.h @@ -25,6 +25,9 @@ extern "C" { * register windows are in use. This isn't a struct type, it just * matches the register/stack-unit width. */ +struct arch_esf { + int dummy; +}; typedef int z_arch_esf_t; #endif diff --git a/scripts/coredump/gdbstubs/arch/arm64.py b/scripts/coredump/gdbstubs/arch/arm64.py index 008fb88c1b9..7f4c03eb375 100644 --- a/scripts/coredump/gdbstubs/arch/arm64.py +++ b/scripts/coredump/gdbstubs/arch/arm64.py @@ -95,7 +95,7 @@ class GdbStub_ARM64(GdbStub): self.registers[RegNum.X17] = tu[17] self.registers[RegNum.X18] = tu[18] - # Callee saved registers are not provided in __esf structure + # Callee saved registers are not provided in arch_esf structure # So they will be omitted (set to undefined) when stub generates the # packet in handle_register_group_read_packet. diff --git a/soc/nordic/common/vpr/soc_isr_stacking.h b/soc/nordic/common/vpr/soc_isr_stacking.h index ff34f9d4e09..da4dffc4b8c 100644 --- a/soc/nordic/common/vpr/soc_isr_stacking.h +++ b/soc/nordic/common/vpr/soc_isr_stacking.h @@ -17,7 +17,7 @@ #if DT_PROP(VPR_CPU, nordic_bus_width) == 64 #define SOC_ISR_STACKING_ESF_DECLARE \ - struct __esf { \ + struct arch_esf { \ unsigned long s0; \ unsigned long mstatus; \ unsigned long tp; \ @@ -40,7 +40,7 @@ #else /* DT_PROP(VPR_CPU, nordic_bus_width) == 32 */ #define SOC_ISR_STACKING_ESF_DECLARE \ - struct __esf { \ + struct arch_esf { \ unsigned long s0; \ unsigned long mstatus; \ unsigned long tp; \ diff --git a/subsys/testsuite/ztest/include/zephyr/ztest.h b/subsys/testsuite/ztest/include/zephyr/ztest.h index 52d686756c6..5dba0afa336 100644 --- a/subsys/testsuite/ztest/include/zephyr/ztest.h +++ b/subsys/testsuite/ztest/include/zephyr/ztest.h @@ -28,8 +28,8 @@ #ifdef __cplusplus extern "C" { #endif -struct esf; -typedef struct esf z_arch_esf_t; +struct arch_esf; +typedef struct arch_esf z_arch_esf_t; #ifdef __cplusplus } #endif diff --git a/tests/arch/arm/arm_interrupt/src/arm_interrupt.c b/tests/arch/arm/arm_interrupt/src/arm_interrupt.c index b569bbe1678..5494d77d70d 100644 --- a/tests/arch/arm/arm_interrupt/src/arm_interrupt.c +++ b/tests/arch/arm/arm_interrupt/src/arm_interrupt.c @@ -74,7 +74,7 @@ static int check_esf_matches_expectations(const z_arch_esf_t *pEsf) * is overwritten in fault.c) */ if (memcmp((void *)callee_regs->psp, pEsf, - offsetof(struct __esf, basic.xpsr)) != 0) { + offsetof(struct arch_esf, basic.xpsr)) != 0) { printk("psp does not match __basic_sf provided\n"); return -1; }