From 155a10068ac6feefcc783b7b023fc90390e5cc44 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Tue, 12 Dec 2017 14:23:26 -0800 Subject: utils_def: Add REGSZ and make BIT() assembly-compatible In assembly code it can be useful to have a constant for the width of a register in the current architecture, so this patch adds one to and replaces the existing custom one in crash_reporting.S with that. It also fixes up the BIT() macro in the same file so that it can be safely used in assembly code. Change-Id: I10513a311f3379e767396e6ddfbae8d2d8201464 Signed-off-by: Julius Werner --- include/lib/utils_def.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h index 185a1c129..bda3b0735 100644 --- a/include/lib/utils_def.h +++ b/include/lib/utils_def.h @@ -16,7 +16,7 @@ #define SIZE_FROM_LOG2_WORDS(n) (4 << (n)) -#define BIT(nr) (1ULL << (nr)) +#define BIT(nr) (ULL(1) << (nr)) /* * This variant of div_round_up can be used in macro definition but should not @@ -84,6 +84,13 @@ # define ULL(_x) (_x##ull) #endif +/* Register size of the current architecture. */ +#ifdef AARCH32 +#define REGSZ U(4) +#else +#define REGSZ U(8) +#endif + /* * Test for the current architecture version to be at least the version * expected. -- cgit v1.2.3