[PATCH v2] score/aarch64: Align context validation frame
Kinsey Moore
kinsey.moore at oarcorp.com
Tue Apr 13 14:02:23 UTC 2021
Ensure the stack remains aligned by keeping the context frame at a
multiple of 16 bytes. This avoids stack alignment exceptions which occur
when the stack pointer is not 16 byte aligned.
---
.../cpu/aarch64/aarch64-context-validate.S | 25 +++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/cpukit/score/cpu/aarch64/aarch64-context-validate.S b/cpukit/score/cpu/aarch64/aarch64-context-validate.S
index 57f634934b..07c5ba5a62 100644
--- a/cpukit/score/cpu/aarch64/aarch64-context-validate.S
+++ b/cpukit/score/cpu/aarch64/aarch64-context-validate.S
@@ -54,18 +54,23 @@
#define FRAME_OFFSET_LR 0x40
#ifdef AARCH64_MULTILIB_VFP
- #define FRAME_OFFSET_V8 0x48
- #define FRAME_OFFSET_V9 0x58
- #define FRAME_OFFSET_V10 0x68
- #define FRAME_OFFSET_V11 0x78
- #define FRAME_OFFSET_V12 0x88
- #define FRAME_OFFSET_V13 0x98
- #define FRAME_OFFSET_V14 0xA8
- #define FRAME_OFFSET_V15 0xB8
-
+ /* These must be 16 byte aligned to avoid misaligned accesses */
+ #define FRAME_OFFSET_V8 0x50
+ #define FRAME_OFFSET_V9 0x60
+ #define FRAME_OFFSET_V10 0x70
+ #define FRAME_OFFSET_V11 0x80
+ #define FRAME_OFFSET_V12 0x90
+ #define FRAME_OFFSET_V13 0xA0
+ #define FRAME_OFFSET_V14 0xB0
+ #define FRAME_OFFSET_V15 0xC0
+
+ /*
+ * The frame size must be 16 byte aligned to avoid stack pointer alignment
+ * exceptions.
+ */
#define FRAME_SIZE (FRAME_OFFSET_V15 + 0x10)
#else
- #define FRAME_SIZE (FRAME_OFFSET_LR + 0x08)
+ #define FRAME_SIZE (FRAME_OFFSET_LR + 0x10)
#endif
.section .text
--
2.20.1
More information about the devel
mailing list