From 4a826ddad8ea0fc5ce09709f534efb72cc33611c Mon Sep 17 00:00:00 2001 From: Achin Gupta Date: Mon, 25 Nov 2013 14:00:56 +0000 Subject: 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 --- include/bl_common.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/bl_common.h') 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__ /******************************************************************************* -- cgit