diff options
author | Daniel Krueger <daniel.krueger@systec-electronic.com> | 2015-03-17 14:02:59 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-10 08:12:14 +0200 |
commit | a6c5a7e0b68ea9b9eed98997b85fe49434eeb1c8 (patch) | |
tree | 7822bc369d83ffe5e97f8a01dfe8cd091b1b7a3e | |
parent | Add hardware FPU flags for Raspberry Pi 2 BSP (diff) | |
download | rtems-a6c5a7e0b68ea9b9eed98997b85fe49434eeb1c8.tar.bz2 |
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@systec-electronic.com>
-rw-r--r-- | cpukit/score/cpu/arm/cpu.c | 5 | ||||
-rw-r--r-- | cpukit/score/cpu/arm/rtems/score/cpu.h | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/cpukit/score/cpu/arm/cpu.c b/cpukit/score/cpu/arm/cpu.c index 9942c4a40e..944ca630c7 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 ca8a09fbf9..6aced79b3b 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; |