[rtems commit] arm: Align ARM exception frame to 8 bytes
Sebastian Huber
sebh at rtems.org
Fri Apr 10 06:17:02 UTC 2015
Module: rtems
Branch: master
Commit: a6c5a7e0b68ea9b9eed98997b85fe49434eeb1c8
Changeset: http://git.rtems.org/rtems/commit/?id=a6c5a7e0b68ea9b9eed98997b85fe49434eeb1c8
Author: Daniel Krueger <daniel.krueger at systec-electronic.com>
Date: Tue Mar 17 14:02:59 2015 +0000
arm: Align ARM exception frame to 8 bytes
The stack pointer must be aligned on 8 byte boundary on ARM, so the size of
the exception frame must be a multiple of 8 bytes. Otherwise we might/will
get an alignment fault, when executing code in the data abort handler for
example.
Close #2318.
Signed-off-by: Daniel Krueger <daniel.krueger at systec-electronic.com>
---
cpukit/score/cpu/arm/cpu.c | 5 +++++
cpukit/score/cpu/arm/rtems/score/cpu.h | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/cpukit/score/cpu/arm/cpu.c b/cpukit/score/cpu/arm/cpu.c
index 9942c4a..944ca63 100644
--- a/cpukit/score/cpu/arm/cpu.c
+++ b/cpukit/score/cpu/arm/cpu.c
@@ -64,6 +64,11 @@ RTEMS_STATIC_ASSERT(
);
RTEMS_STATIC_ASSERT(
+ sizeof( CPU_Exception_frame ) % CPU_STACK_ALIGNMENT == 0,
+ CPU_Exception_frame_alignment
+);
+
+RTEMS_STATIC_ASSERT(
offsetof( CPU_Exception_frame, register_sp )
== ARM_EXCEPTION_FRAME_REGISTER_SP_OFFSET,
ARM_EXCEPTION_FRAME_REGISTER_SP_OFFSET
diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h
index ca8a09f..6aced79 100644
--- a/cpukit/score/cpu/arm/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
@@ -222,7 +222,7 @@
#endif
#endif
-#define ARM_EXCEPTION_FRAME_SIZE 76
+#define ARM_EXCEPTION_FRAME_SIZE 80
#define ARM_EXCEPTION_FRAME_REGISTER_SP_OFFSET 52
@@ -687,6 +687,7 @@ typedef struct {
uint32_t vector;
#endif
const ARM_VFP_context *vfp_context;
+ uint32_t reserved_for_stack_alignment;
} CPU_Exception_frame;
typedef CPU_Exception_frame CPU_Interrupt_frame;
More information about the vc
mailing list