summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-12-12 14:23:26 -0800
committerJulius Werner <jwerner@chromium.org>2017-12-12 15:00:34 -0800
commit155a10068ac6feefcc783b7b023fc90390e5cc44 (patch)
treefe2f30754806140be39d1c816da3faebf99b02b6 /include
parent211d307c6bfadbe44aa27998e105436143e1b147 (diff)
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 <utils_def.h> 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 <jwerner@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/lib/utils_def.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h
index 185a1c12..bda3b073 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.