Skip to content

Commit 7c1e399

Browse files
Bradley Bolenstephanosio
authored andcommitted
arch: arm: aarch32: Create a fpu stack frame
Grouping the FPU registers together will make adding FPU support for Cortex-A/R easier later. It provides the ability to get the sizeof and offsetof FPU registers easier. Signed-off-by: Bradley Bolen <[email protected]>
1 parent 3f7162f commit 7c1e399

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

arch/arm/core/aarch32/fatal.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ static void esf_dump(const z_arch_esf_t *esf)
2525
esf->basic.a4, esf->basic.ip, esf->basic.lr);
2626
LOG_ERR(" xpsr: 0x%08x", esf->basic.xpsr);
2727
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
28-
for (int i = 0; i < ARRAY_SIZE(esf->s); i += 4) {
28+
for (int i = 0; i < ARRAY_SIZE(esf->fpu.s); i += 4) {
2929
LOG_ERR("s[%2d]: 0x%08x s[%2d]: 0x%08x"
3030
" s[%2d]: 0x%08x s[%2d]: 0x%08x",
31-
i, (uint32_t)esf->s[i],
32-
i + 1, (uint32_t)esf->s[i + 1],
33-
i + 2, (uint32_t)esf->s[i + 2],
34-
i + 3, (uint32_t)esf->s[i + 3]);
31+
i, (uint32_t)esf->fpu.s[i],
32+
i + 1, (uint32_t)esf->fpu.s[i + 1],
33+
i + 2, (uint32_t)esf->fpu.s[i + 2],
34+
i + 3, (uint32_t)esf->fpu.s[i + 3]);
3535
}
36-
LOG_ERR("fpscr: 0x%08x", esf->fpscr);
36+
LOG_ERR("fpscr: 0x%08x", esf->fpu.fpscr);
3737
#endif
3838
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
3939
const struct _callee_saved *callee = esf->extra_info.callee;

arch/arm/core/offsets/offsets_aarch32.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ GEN_OFFSET_SYM(_basic_sf_t, xpsr);
6161
GEN_ABSOLUTE_SYM(___basic_sf_t_SIZEOF, sizeof(_basic_sf_t));
6262

6363
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
64-
GEN_OFFSET_SYM(_esf_t, s);
65-
GEN_OFFSET_SYM(_esf_t, fpscr);
64+
GEN_OFFSET_SYM(_fpu_sf_t, s);
65+
GEN_OFFSET_SYM(_fpu_sf_t, fpscr);
66+
67+
GEN_ABSOLUTE_SYM(___fpu_t_SIZEOF, sizeof(_fpu_sf_t));
6668
#endif
6769

6870
GEN_ABSOLUTE_SYM(___esf_t_SIZEOF, sizeof(_esf_t));

arch/arm/include/kernel_arch_data.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ extern "C" {
4444

4545
typedef struct __esf _esf_t;
4646
typedef struct __basic_sf _basic_sf_t;
47+
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
48+
typedef struct __fpu_sf _fpu_sf_t;
49+
#endif
4750

4851
#ifdef CONFIG_ARM_MPU
4952
struct z_arm_mpu_partition {

include/zephyr/arch/arm/aarch32/exc.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ GTEXT(z_arm_exc_exit);
6969
extern "C" {
7070
#endif
7171

72+
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
73+
struct __fpu_sf {
74+
float s[16];
75+
uint32_t fpscr;
76+
uint32_t undefined;
77+
};
78+
#endif
79+
7280
/* Additional register state that is not stacked by hardware on exception
7381
* entry.
7482
*
@@ -97,9 +105,7 @@ struct __esf {
97105
uint32_t xpsr;
98106
} basic;
99107
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
100-
float s[16];
101-
uint32_t fpscr;
102-
uint32_t undefined;
108+
struct __fpu_sf fpu;
103109
#endif
104110
#if defined(CONFIG_EXTRA_EXCEPTION_INFO)
105111
struct __extra_esf_info extra_info;
@@ -113,9 +119,7 @@ struct __esf {
113119
struct __extra_esf_info extra_info;
114120
#endif
115121
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
116-
float s[16];
117-
uint32_t fpscr;
118-
uint32_t undefined;
122+
struct __fpu_sf fpu;
119123
#endif
120124
struct __basic_sf {
121125
sys_define_gpr_with_alias(a1, r0);

0 commit comments

Comments
 (0)