summaryrefslogtreecommitdiff
path: root/include/bl_common.h
diff options
context:
space:
mode:
authorAchin Gupta <achin.gupta@arm.com>2013-11-25 14:00:56 +0000
committerDan Handley <dan.handley@arm.com>2013-12-05 12:28:50 +0000
commit4a826ddad8ea0fc5ce09709f534efb72cc33611c (patch)
tree2756ac5b549591af762e917841e81b5513c2ce7d /include/bl_common.h
parentab2d31edbd9dea69bd1ca495e3fce0511c9d42ff (diff)
rework general purpose registers save and restore
The runtime exception handling assembler code used magic numbers for saving and restoring the general purpose register context on stack memory. The memory is interpreted as a 'gp_regs' structure and the magic numbers are offsets to members of this structure. This patch replaces the magic number offsets with constants. It also adds compile time assertions to prevent an incorrect assembler view of this structure. Change-Id: Ibf125bfdd62ba3a33e58c5f1d71f8c229720781c
Diffstat (limited to 'include/bl_common.h')
-rw-r--r--include/bl_common.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/bl_common.h b/include/bl_common.h
index 3504d041..0af98d68 100644
--- a/include/bl_common.h
+++ b/include/bl_common.h
@@ -63,6 +63,13 @@
******************************************************************************/
#define EL_CHANGE_MEM_SIZE (sizeof(meminfo) + sizeof(el_change_info))
+/*******************************************************************************
+ * Macro to flag a compile time assertion. It uses the preprocessor to generate
+ * an invalid C construct if 'cond' evaluates to false.
+ * The following compilation error is triggered if the assertion fails:
+ * "error: size of array 'msg' is negative"
+ ******************************************************************************/
+#define CASSERT(cond, msg) typedef char msg[(cond) ? 0 : -1]
#ifndef __ASSEMBLY__
/*******************************************************************************