arch: rename all esf struct to struct arch_esf

Rename every architecture's esf struct to `struct esf`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
Yong Cong Sin 2024-06-01 10:26:04 +08:00 committed by Maureen Helm
commit 3998e18ec4
23 changed files with 42 additions and 39 deletions

View file

@ -36,7 +36,7 @@ extern "C" {
#endif #endif
#ifdef CONFIG_ARC_HAS_SECURE #ifdef CONFIG_ARC_HAS_SECURE
struct _irq_stack_frame { struct arch_esf {
#ifdef CONFIG_ARC_HAS_ZOL #ifdef CONFIG_ARC_HAS_ZOL
uintptr_t lp_end; uintptr_t lp_end;
uintptr_t lp_start; uintptr_t lp_start;
@ -72,7 +72,7 @@ struct _irq_stack_frame {
uintptr_t status32; uintptr_t status32;
}; };
#else #else
struct _irq_stack_frame { struct arch_esf {
uintptr_t r0; uintptr_t r0;
uintptr_t r1; uintptr_t r1;
uintptr_t r2; uintptr_t r2;
@ -108,7 +108,7 @@ struct _irq_stack_frame {
}; };
#endif #endif
typedef struct _irq_stack_frame _isf_t; typedef struct arch_esf _isf_t;

View file

@ -42,7 +42,7 @@
extern "C" { extern "C" {
#endif #endif
typedef struct __esf _esf_t; typedef struct arch_esf _esf_t;
typedef struct __basic_sf _basic_sf_t; typedef struct __basic_sf _basic_sf_t;
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) #if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
typedef struct __fpu_sf _fpu_sf_t; typedef struct __fpu_sf _fpu_sf_t;

View file

@ -102,7 +102,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
* dropping into EL0. * 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->x0 = (uint64_t)entry;
pInitCtx->x1 = (uint64_t)p1; pInitCtx->x1 = (uint64_t)p1;

View file

@ -36,7 +36,7 @@
extern "C" { extern "C" {
#endif #endif
typedef struct __esf _esf_t; typedef struct arch_esf _esf_t;
typedef struct __basic_sf _basic_sf_t; typedef struct __basic_sf _basic_sf_t;
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -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, char *stack_ptr, k_thread_entry_t entry,
void *p1, void *p2, void *p3) void *p1, void *p2, void *p3)
{ {
struct __esf *stack_init; struct arch_esf *stack_init;
/* Initial stack frame for thread */ /* Initial stack frame for thread */
stack_init = (struct __esf *)Z_STACK_PTR_ALIGN( stack_init = (struct arch_esf *)Z_STACK_PTR_ALIGN(
Z_STACK_PTR_TO_FRAME(struct __esf, stack_ptr) Z_STACK_PTR_TO_FRAME(struct arch_esf, stack_ptr)
); );
/* Setup the initial stack frame */ /* Setup the initial stack frame */

View file

@ -88,7 +88,7 @@ config RISCV_SOC_HAS_ISR_STACKING
guarded by !_ASMLANGUAGE. The ESF should be defined to account for guarded by !_ASMLANGUAGE. The ESF should be defined to account for
the hardware stacked registers in the proper order as they are the hardware stacked registers in the proper order as they are
saved on the stack by the hardware, and the registers saved by the 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 config RISCV_SOC_HAS_CUSTOM_IRQ_HANDLING
bool bool

View file

@ -23,15 +23,15 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
void *p1, void *p2, void *p3) void *p1, void *p2, void *p3)
{ {
extern void z_riscv_thread_start(void); extern void z_riscv_thread_start(void);
struct __esf *stack_init; struct arch_esf *stack_init;
#ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE
const struct soc_esf soc_esf_init = {SOC_ESF_INIT}; const struct soc_esf soc_esf_init = {SOC_ESF_INIT};
#endif #endif
/* Initial stack frame for thread */ /* Initial stack frame for thread */
stack_init = (struct __esf *)Z_STACK_PTR_ALIGN( stack_init = (struct arch_esf *)Z_STACK_PTR_ALIGN(
Z_STACK_PTR_TO_FRAME(struct __esf, stack_ptr) Z_STACK_PTR_TO_FRAME(struct arch_esf, stack_ptr)
); );
/* Setup the initial stack frame */ /* Setup the initial stack frame */

View file

@ -20,7 +20,7 @@ extern "C" {
#ifdef _ASMLANGUAGE #ifdef _ASMLANGUAGE
#else #else
typedef struct _irq_stack_frame z_arch_esf_t; typedef struct arch_esf z_arch_esf_t;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -54,7 +54,7 @@ struct __extra_esf_info {
}; };
#endif /* CONFIG_EXTRA_EXCEPTION_INFO */ #endif /* CONFIG_EXTRA_EXCEPTION_INFO */
struct __esf { struct arch_esf {
#if defined(CONFIG_EXTRA_EXCEPTION_INFO) #if defined(CONFIG_EXTRA_EXCEPTION_INFO)
struct __extra_esf_info extra_info; struct __extra_esf_info extra_info;
#endif #endif
@ -75,7 +75,7 @@ struct __esf {
extern uint32_t z_arm_coredump_fault_sp; 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); extern void z_arm_exc_exit(bool fatal);

View file

@ -98,7 +98,7 @@ struct __extra_esf_info {
}; };
#endif /* CONFIG_EXTRA_EXCEPTION_INFO */ #endif /* CONFIG_EXTRA_EXCEPTION_INFO */
struct __esf { struct arch_esf {
struct __basic_sf { struct __basic_sf {
sys_define_gpr_with_alias(a1, r0); sys_define_gpr_with_alias(a1, r0);
sys_define_gpr_with_alias(a2, r1); sys_define_gpr_with_alias(a2, r1);
@ -119,7 +119,7 @@ struct __esf {
extern uint32_t z_arm_coredump_fault_sp; 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); extern void z_arm_exc_exit(void);

View file

@ -24,7 +24,7 @@
extern "C" { extern "C" {
#endif #endif
struct __esf { struct arch_esf {
uint64_t x0; uint64_t x0;
uint64_t x1; uint64_t x1;
uint64_t x2; uint64_t x2;
@ -55,7 +55,7 @@ struct __esf {
#endif #endif
} __aligned(16); } __aligned(16);
typedef struct __esf z_arch_esf_t; typedef struct arch_esf z_arch_esf_t;
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -17,7 +17,7 @@
extern "C" { extern "C" {
#endif #endif
struct __esf { struct arch_esf {
unsigned long ra; /* return address */ unsigned long ra; /* return address */
unsigned long gp; /* global pointer */ unsigned long gp; /* global pointer */
@ -50,7 +50,7 @@ struct __esf {
unsigned long cause; unsigned long cause;
}; };
typedef struct __esf z_arch_esf_t; typedef struct arch_esf z_arch_esf_t;
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -14,7 +14,7 @@
extern "C" { extern "C" {
#endif #endif
struct __esf { struct arch_esf {
uint32_t ra; /* return address r31 */ uint32_t ra; /* return address r31 */
uint32_t r1; /* at */ uint32_t r1; /* at */
uint32_t r2; /* return value */ uint32_t r2; /* return value */
@ -35,7 +35,7 @@ struct __esf {
uint32_t instr; /* Instruction being executed when exc occurred */ 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 #ifdef __cplusplus
} }

View file

@ -15,11 +15,11 @@
extern "C" { extern "C" {
#endif #endif
struct __esf { struct arch_esf {
uint32_t dummy; /*maybe we will want to add something someday*/ 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 #ifdef __cplusplus
} }

View file

@ -48,7 +48,7 @@ struct soc_esf {
#if defined(CONFIG_RISCV_SOC_HAS_ISR_STACKING) #if defined(CONFIG_RISCV_SOC_HAS_ISR_STACKING)
SOC_ISR_STACKING_ESF_DECLARE; SOC_ISR_STACKING_ESF_DECLARE;
#else #else
struct __esf { struct arch_esf {
unsigned long ra; /* return address */ unsigned long ra; /* return address */
unsigned long t0; /* Caller-saved temporary register */ unsigned long t0; /* Caller-saved temporary register */
@ -87,7 +87,7 @@ struct __esf {
} __aligned(16); } __aligned(16);
#endif /* CONFIG_RISCV_SOC_HAS_ISR_STACKING */ #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 #ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE
typedef struct soc_esf soc_esf_t; typedef struct soc_esf soc_esf_t;
#endif #endif

View file

@ -14,7 +14,7 @@
extern "C" { extern "C" {
#endif #endif
struct __esf { struct arch_esf {
uint32_t out[8]; uint32_t out[8];
uint32_t global[8]; uint32_t global[8];
uint32_t psr; uint32_t psr;
@ -25,7 +25,7 @@ struct __esf {
uint32_t y; uint32_t y;
}; };
typedef struct __esf z_arch_esf_t; typedef struct arch_esf z_arch_esf_t;
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -27,7 +27,7 @@ extern "C" {
* Those registers are pushed onto the stack by _ExcEnt(). * Those registers are pushed onto the stack by _ExcEnt().
*/ */
typedef struct nanoEsf { typedef struct arch_esf {
#ifdef CONFIG_GDBSTUB #ifdef CONFIG_GDBSTUB
unsigned int ss; unsigned int ss;
unsigned int gs; unsigned int gs;

View file

@ -17,7 +17,7 @@ extern "C" {
* the exception stack frame * the exception stack frame
*/ */
struct x86_esf { struct arch_esf {
#ifdef CONFIG_EXCEPTION_DEBUG #ifdef CONFIG_EXCEPTION_DEBUG
/* callee-saved */ /* callee-saved */
unsigned long rbx; unsigned long rbx;
@ -53,7 +53,7 @@ struct x86_esf {
unsigned long ss; unsigned long ss;
}; };
typedef struct x86_esf z_arch_esf_t; typedef struct arch_esf z_arch_esf_t;
struct x86_ssf { struct x86_ssf {
unsigned long rip; unsigned long rip;

View file

@ -25,6 +25,9 @@ extern "C" {
* register windows are in use. This isn't a struct type, it just * register windows are in use. This isn't a struct type, it just
* matches the register/stack-unit width. * matches the register/stack-unit width.
*/ */
struct arch_esf {
int dummy;
};
typedef int z_arch_esf_t; typedef int z_arch_esf_t;
#endif #endif

View file

@ -95,7 +95,7 @@ class GdbStub_ARM64(GdbStub):
self.registers[RegNum.X17] = tu[17] self.registers[RegNum.X17] = tu[17]
self.registers[RegNum.X18] = tu[18] 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 # So they will be omitted (set to undefined) when stub generates the
# packet in handle_register_group_read_packet. # packet in handle_register_group_read_packet.

View file

@ -17,7 +17,7 @@
#if DT_PROP(VPR_CPU, nordic_bus_width) == 64 #if DT_PROP(VPR_CPU, nordic_bus_width) == 64
#define SOC_ISR_STACKING_ESF_DECLARE \ #define SOC_ISR_STACKING_ESF_DECLARE \
struct __esf { \ struct arch_esf { \
unsigned long s0; \ unsigned long s0; \
unsigned long mstatus; \ unsigned long mstatus; \
unsigned long tp; \ unsigned long tp; \
@ -40,7 +40,7 @@
#else /* DT_PROP(VPR_CPU, nordic_bus_width) == 32 */ #else /* DT_PROP(VPR_CPU, nordic_bus_width) == 32 */
#define SOC_ISR_STACKING_ESF_DECLARE \ #define SOC_ISR_STACKING_ESF_DECLARE \
struct __esf { \ struct arch_esf { \
unsigned long s0; \ unsigned long s0; \
unsigned long mstatus; \ unsigned long mstatus; \
unsigned long tp; \ unsigned long tp; \

View file

@ -28,8 +28,8 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct esf; struct arch_esf;
typedef struct esf z_arch_esf_t; typedef struct arch_esf z_arch_esf_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -74,7 +74,7 @@ static int check_esf_matches_expectations(const z_arch_esf_t *pEsf)
* is overwritten in fault.c) * is overwritten in fault.c)
*/ */
if (memcmp((void *)callee_regs->psp, pEsf, 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"); printk("psp does not match __basic_sf provided\n");
return -1; return -1;
} }