Skip to content

Commit cac6651

Browse files
committed
arch: deprecate _callee_saved_t and remove its usage internally
Make `struct arch_csf` compulsory for all architectures by declaring it in the `arch_interface.h` header. Update all references of `_callee_saved_t` internally to `struct arch_csf`. Update offsets generation with `struct arch_csf`. Signed-off-by: Yong Cong Sin <[email protected]> Signed-off-by: Yong Cong Sin <[email protected]>
1 parent db4834d commit cac6651

File tree

42 files changed

+175
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+175
-192
lines changed

arch/arc/core/offsets/offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ GEN_OFFSET_SYM(_isf_t, sec_stat);
7878
GEN_OFFSET_SYM(_isf_t, status32);
7979
GEN_ABSOLUTE_SYM(___isf_t_SIZEOF, sizeof(_isf_t));
8080

81-
GEN_OFFSET_SYM(_callee_saved_t, sp);
81+
GEN_OFFSET_STRUCT(arch_csf, sp);
8282

8383
GEN_OFFSET_SYM(_callee_saved_stack_t, r13);
8484
GEN_OFFSET_SYM(_callee_saved_stack_t, r14);

arch/arc/include/offsets_short_arch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
(___thread_t_arch_OFFSET + ___thread_arch_t_priv_stack_start_OFFSET)
3737

3838
#define _thread_offset_to_sp \
39-
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_sp_OFFSET)
39+
(___thread_t_callee_saved_OFFSET + __struct_arch_csf_sp_OFFSET)
4040

4141
/* end - threads */
4242

arch/arm/core/cortex_a_r/exc.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ GTEXT(z_arm_data_abort)
7676
str r0, [sp, #4]
7777
str r0, [sp, #8]
7878

79-
sub r1, sp, #___callee_saved_t_SIZEOF
79+
sub r1, sp, #__struct_arch_csf_SIZEOF
8080
str r1, [sp]
8181
cps #MODE_SYS
8282
stm r1, {r4-r11, sp}
@@ -99,7 +99,7 @@ GTEXT(z_arm_data_abort)
9999
/* Exit exception */
100100
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
101101
add sp, #___extra_esf_info_t_SIZEOF
102-
add sp, #___callee_saved_t_SIZEOF
102+
add sp, #__struct_arch_csf_SIZEOF
103103
#endif
104104
.endm
105105

@@ -163,7 +163,7 @@ SECTION_SUBSEC_FUNC(TEXT, __exc, z_arm_undef_instruction)
163163
str r0, [sp, #4]
164164
str r0, [sp, #8]
165165

166-
sub r1, sp, #___callee_saved_t_SIZEOF
166+
sub r1, sp, #__struct_arch_csf_SIZEOF
167167
str r1, [sp]
168168
cps #MODE_SYS
169169
stm r1, {r4-r11, sp}

arch/arm/core/cortex_m/fault.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,7 @@ static inline struct arch_esf *get_esf(uint32_t msp, uint32_t psp, uint32_t exc_
10891089
* @param callee_regs Callee-saved registers (R4-R11, PSP)
10901090
*
10911091
*/
1092-
void z_arm_fault(uint32_t msp, uint32_t psp, uint32_t exc_return,
1093-
_callee_saved_t *callee_regs)
1092+
void z_arm_fault(uint32_t msp, uint32_t psp, uint32_t exc_return, struct arch_csf *callee_regs)
10941093
{
10951094
uint32_t reason = K_ERR_CPU_EXCEPTION;
10961095
int fault = SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk;

arch/arm/core/cortex_m/fault_s.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ SECTION_SUBSEC_FUNC(TEXT,__fault,z_arm_exc_spurious)
8181
mrs r1, PSP
8282
push {r0, lr}
8383
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
84-
/* Build _callee_saved_t. To match the struct
84+
/* Build struct arch_csf. To match the struct
8585
* definition we push the psp & then r11-r4
8686
*/
8787
push { r1, r2 }
@@ -96,7 +96,7 @@ SECTION_SUBSEC_FUNC(TEXT,__fault,z_arm_exc_spurious)
9696
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
9797
push {r4-r11}
9898
#endif
99-
mov r3, sp /* pointer to _callee_saved_t */
99+
mov r3, sp /* pointer to struct arch_csf */
100100
#endif /* CONFIG_EXTRA_EXCEPTION_INFO */
101101
mov r2, lr /* EXC_RETURN */
102102
bl z_arm_fault

arch/arm/core/cortex_m/swap_helper.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ _oops:
306306
push {r0, lr}
307307
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
308308
#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
309-
/* Build _callee_saved_t. To match the struct
309+
/* Build struct arch_csf. To match the struct
310310
* definition we push the psp & then r11-r4
311311
*/
312312
mrs r1, PSP
313313
push {r1, r2}
314314
push {r4-r11}
315-
mov r1, sp /* pointer to _callee_saved_t */
315+
mov r1, sp /* pointer to struct arch_csf */
316316
#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */
317317
#endif /* CONFIG_EXTRA_EXCEPTION_INFO */
318318
bl z_do_kernel_oops

arch/arm/core/fatal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void z_arm_fatal_error(unsigned int reason, const struct arch_esf *esf)
102102
* @param esf exception frame
103103
* @param callee_regs Callee-saved registers (R4-R11)
104104
*/
105-
void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs)
105+
void z_do_kernel_oops(const struct arch_esf *esf, struct arch_csf *callee_regs)
106106
{
107107
#if !(defined(CONFIG_EXTRA_EXCEPTION_INFO) && defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE))
108108
ARG_UNUSED(callee_regs);

arch/arm/core/offsets/offsets_aarch32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ GEN_ABSOLUTE_SYM(___esf_t_SIZEOF, sizeof(_esf_t));
6868

6969
/* size of the entire preempt registers structure */
7070

71-
GEN_ABSOLUTE_SYM(___callee_saved_t_SIZEOF, sizeof(struct arch_csf));
71+
GEN_ABSOLUTE_SYM(__struct_arch_csf_SIZEOF, sizeof(struct arch_csf));
7272

7373
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
7474
GEN_ABSOLUTE_SYM(___extra_esf_info_t_SIZEOF, sizeof(struct __extra_esf_info));

arch/arm64/core/offsets/offsets.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232

3333
GEN_OFFSET_SYM(_thread_arch_t, exception_depth);
3434

35-
GEN_NAMED_OFFSET_SYM(_callee_saved_t, x19, x19_x20);
36-
GEN_NAMED_OFFSET_SYM(_callee_saved_t, x21, x21_x22);
37-
GEN_NAMED_OFFSET_SYM(_callee_saved_t, x23, x23_x24);
38-
GEN_NAMED_OFFSET_SYM(_callee_saved_t, x25, x25_x26);
39-
GEN_NAMED_OFFSET_SYM(_callee_saved_t, x27, x27_x28);
40-
GEN_NAMED_OFFSET_SYM(_callee_saved_t, x29, x29_sp_el0);
41-
GEN_NAMED_OFFSET_SYM(_callee_saved_t, sp_elx, sp_elx_lr);
35+
GEN_NAMED_OFFSET_STRUCT(arch_csf, x19, x19_x20);
36+
GEN_NAMED_OFFSET_STRUCT(arch_csf, x21, x21_x22);
37+
GEN_NAMED_OFFSET_STRUCT(arch_csf, x23, x23_x24);
38+
GEN_NAMED_OFFSET_STRUCT(arch_csf, x25, x25_x26);
39+
GEN_NAMED_OFFSET_STRUCT(arch_csf, x27, x27_x28);
40+
GEN_NAMED_OFFSET_STRUCT(arch_csf, x29, x29_sp_el0);
41+
GEN_NAMED_OFFSET_STRUCT(arch_csf, sp_elx, sp_elx_lr);
4242

4343
#ifdef CONFIG_FRAME_POINTER
4444
GEN_NAMED_OFFSET_SYM(_esf_t, fp, fp);

arch/arm64/include/offsets_short_arch.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
(___thread_t_arch_OFFSET + ___thread_arch_t_exception_depth_OFFSET)
1414

1515
#define _thread_offset_to_callee_saved_x19_x20 \
16-
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_x19_x20_OFFSET)
16+
(___thread_t_callee_saved_OFFSET + __struct_arch_csf_x19_x20_OFFSET)
1717
#define _thread_offset_to_callee_saved_x21_x22 \
18-
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_x21_x22_OFFSET)
18+
(___thread_t_callee_saved_OFFSET + __struct_arch_csf_x21_x22_OFFSET)
1919
#define _thread_offset_to_callee_saved_x23_x24 \
20-
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_x23_x24_OFFSET)
20+
(___thread_t_callee_saved_OFFSET + __struct_arch_csf_x23_x24_OFFSET)
2121
#define _thread_offset_to_callee_saved_x25_x26 \
22-
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_x25_x26_OFFSET)
22+
(___thread_t_callee_saved_OFFSET + __struct_arch_csf_x25_x26_OFFSET)
2323
#define _thread_offset_to_callee_saved_x27_x28 \
24-
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_x27_x28_OFFSET)
24+
(___thread_t_callee_saved_OFFSET + __struct_arch_csf_x27_x28_OFFSET)
2525
#define _thread_offset_to_callee_saved_x29_sp_el0 \
26-
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_x29_sp_el0_OFFSET)
26+
(___thread_t_callee_saved_OFFSET + __struct_arch_csf_x29_sp_el0_OFFSET)
2727
#define _thread_offset_to_callee_saved_sp_elx_lr \
28-
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_sp_elx_lr_OFFSET)
28+
(___thread_t_callee_saved_OFFSET + __struct_arch_csf_sp_elx_lr_OFFSET)
2929

3030
#ifdef CONFIG_ARM64_SAFE_EXCEPTION_STACK
3131
#define _cpu_offset_to_safe_exception_stack \

0 commit comments

Comments
 (0)