aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Gautier <yann.gautier@st.com>2018-11-15 09:49:24 +0100
committerYann Gautier <yann.gautier@st.com>2018-11-15 11:30:01 +0100
commit46c613ee0a4b5d6ff2dd016c455f8cc7ee9cabd4 (patch)
tree33c570aca06fc303e78627aac9c68e8eb5b20cc3 /include
parent35c4b414be0841b7da63ceb1b5eb6ccfed5dc686 (diff)
downloadplatform_external_arm-trusted-firmware-46c613ee0a4b5d6ff2dd016c455f8cc7ee9cabd4.tar.gz
platform_external_arm-trusted-firmware-46c613ee0a4b5d6ff2dd016c455f8cc7ee9cabd4.tar.bz2
platform_external_arm-trusted-firmware-46c613ee0a4b5d6ff2dd016c455f8cc7ee9cabd4.zip
utils_def: add an assembly version for GENMASK
When compiling assembly files, stdint.h is not included. UINT32_C and UINT64_C are then not defined. A new GENMASK macro for assembly is then created. Signed-off-by: Yann Gautier <yann.gautier@st.com>
Diffstat (limited to 'include')
-rw-r--r--include/lib/utils_def.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h
index 1dd57cb35..fa13caa6b 100644
--- a/include/lib/utils_def.h
+++ b/include/lib/utils_def.h
@@ -30,11 +30,19 @@
* position @h. For example
* GENMASK_64(39, 21) gives us the 64bit vector 0x000000ffffe00000.
*/
+#if defined(__LINKER__) || defined(__ASSEMBLY__)
+#define GENMASK_32(h, l) \
+ (((0xFFFFFFFF) << (l)) & (0xFFFFFFFF >> (32 - 1 - (h))))
+
+#define GENMASK_64(h, l) \
+ ((~0 << (l)) & (~0 >> (64 - 1 - (h))))
+#else
#define GENMASK_32(h, l) \
(((~UINT32_C(0)) << (l)) & (~UINT32_C(0) >> (32 - 1 - (h))))
#define GENMASK_64(h, l) \
(((~UINT64_C(0)) << (l)) & (~UINT64_C(0) >> (64 - 1 - (h))))
+#endif
#ifdef AARCH32
#define GENMASK GENMASK_32