Skip to content

Commit 3f90574

Browse files
lstnljhedberg
authored andcommitted
soc: nordic: vpr: align ESF_SW_IRQ_SIZEOF when new exception debug is used
There is new exception debugging mechanism for RISC-V which needs additional member in arch_esf structure. VPRs handle stacking partially in hw so exact position of some stack members needs to be at the end of arch_esf, so explicit padding is needed. Aligned also ESF_SW_IRQ_SIZEOF when exception debug is used. Signed-off-by: Łukasz Stępnicki <lukasz.stepnicki@nordicsemi.no>
1 parent 1078e59 commit 3f90574

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

soc/nordic/common/vpr/soc_isr_stacking.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@
1515
#define VPR_CPU DT_INST(0, nordic_vpr)
1616

1717
#ifdef CONFIG_EXCEPTION_DEBUG
18-
#define ESF_CSF _callee_saved_t *csf
18+
/*
19+
* Explicit padding is needed for VPRs, because they use hardware stacking on part of arch_esf and
20+
* ESF_SW_IRQ_SIZEOF needs to be calculated accordingly.
21+
*/
22+
#define ESF_CSF \
23+
_callee_saved_t *csf; \
24+
unsigned long padding1; \
25+
unsigned long padding2; \
26+
unsigned long padding3;
1927
#else
2028
#define ESF_CSF
2129
#endif /* CONFIG_EXCEPTION_DEBUG */
@@ -90,10 +98,13 @@
9098

9199
/*
92100
* Size of the SW managed part of the ESF in case of interrupt
93-
* sizeof(__padding) + ... + sizeof(soc_context)
101+
* sizeof(s0) + sizeof(mstatus) + sizeof(soc_context) +...+ sizeof(ESF_CSF)
94102
*/
95-
#define ESF_SW_IRQ_SIZEOF (0x10)
96-
103+
#ifdef CONFIG_EXCEPTION_DEBUG
104+
#define ESF_SW_IRQ_SIZEOF (0x20)
105+
#else
106+
#define ESF_SW_IRQ_SIZEOF (0x10)
107+
#endif
97108
/*
98109
* VPR needs aligned(8) SP when doing HW stacking, if this condition is not fulfilled it will move
99110
* SP by additional 4 bytes when HW stacking is done. This will be indicated by LSB bit in stacked

0 commit comments

Comments
 (0)