[rtems commit] sparc: Add static offset assertions

Sebastian Huber sebh at rtems.org
Tue May 26 12:10:15 UTC 2015


Module:    rtems
Branch:    master
Commit:    fedc68287012f3b812dc5d8ca2cd0376eb1c5cc0
Changeset: http://git.rtems.org/rtems/commit/?id=fedc68287012f3b812dc5d8ca2cd0376eb1c5cc0

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue May 26 14:03:35 2015 +0200

sparc: Add static offset assertions

---

 cpukit/score/cpu/sparc/cpu.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/cpukit/score/cpu/sparc/cpu.c b/cpukit/score/cpu/sparc/cpu.c
index 8941bca..2560f26 100644
--- a/cpukit/score/cpu/sparc/cpu.c
+++ b/cpukit/score/cpu/sparc/cpu.c
@@ -71,6 +71,38 @@ SPARC_ASSERT_OFFSET(isr_dispatch_disable, ISR_DISPATCH_DISABLE_STACK);
 SPARC_ASSERT_OFFSET(is_executing, SPARC_CONTEXT_CONTROL_IS_EXECUTING);
 #endif
 
+#define SPARC_ASSERT_ISF_OFFSET(field, off) \
+  RTEMS_STATIC_ASSERT( \
+    offsetof(CPU_Interrupt_frame, field) == ISF_ ## off ## _OFFSET, \
+    CPU_Interrupt_frame_offset_ ## field \
+  )
+
+SPARC_ASSERT_ISF_OFFSET(psr, PSR);
+SPARC_ASSERT_ISF_OFFSET(pc, PC);
+SPARC_ASSERT_ISF_OFFSET(npc, NPC);
+SPARC_ASSERT_ISF_OFFSET(g1, G1);
+SPARC_ASSERT_ISF_OFFSET(g2, G2);
+SPARC_ASSERT_ISF_OFFSET(g3, G3);
+SPARC_ASSERT_ISF_OFFSET(g4, G4);
+SPARC_ASSERT_ISF_OFFSET(g5, G5);
+SPARC_ASSERT_ISF_OFFSET(g7, G7);
+SPARC_ASSERT_ISF_OFFSET(i0, I0);
+SPARC_ASSERT_ISF_OFFSET(i1, I1);
+SPARC_ASSERT_ISF_OFFSET(i2, I2);
+SPARC_ASSERT_ISF_OFFSET(i3, I3);
+SPARC_ASSERT_ISF_OFFSET(i4, I4);
+SPARC_ASSERT_ISF_OFFSET(i5, I5);
+SPARC_ASSERT_ISF_OFFSET(i6_fp, I6_FP);
+SPARC_ASSERT_ISF_OFFSET(i7, I7);
+SPARC_ASSERT_ISF_OFFSET(y, Y);
+SPARC_ASSERT_ISF_OFFSET(tpc, TPC);
+
+/* https://devel.rtems.org/ticket/2352 */
+RTEMS_STATIC_ASSERT(
+  sizeof(CPU_Interrupt_frame) % CPU_ALIGNMENT == 0,
+  CPU_Interrupt_frame_alignment
+);
+
 /*
  *  _CPU_Initialize
  *



More information about the vc mailing list