summaryrefslogtreecommitdiff
path: root/include/common/aarch32
diff options
context:
space:
mode:
authordanh-arm <dan.handley@arm.com>2016-12-12 14:29:01 +0000
committerGitHub <noreply@github.com>2016-12-12 14:29:01 +0000
commit1b5fa6ef1082ffb9979df4aad91525eda571eb50 (patch)
tree082595c467672752cadc9228f43ef1c78f369e4e /include/common/aarch32
parent919ad05ecb8fab23f91a37783dc5f246847c7bd2 (diff)
parenta806dad58c4cf752238d7bbffbc9a1ce17f63cea (diff)
Merge pull request #774 from jeenu-arm/no-return-macro
Define and use no_ret macro where no return is expected
Diffstat (limited to 'include/common/aarch32')
-rw-r--r--include/common/aarch32/asm_macros.S22
-rw-r--r--include/common/aarch32/el3_common_macros.S2
2 files changed, 23 insertions, 1 deletions
diff --git a/include/common/aarch32/asm_macros.S b/include/common/aarch32/asm_macros.S
index 5f044991..23122f34 100644
--- a/include/common/aarch32/asm_macros.S
+++ b/include/common/aarch32/asm_macros.S
@@ -102,4 +102,26 @@
ldr r0, =(\_name + \_size)
.endm
+ /*
+ * Macro to mark instances where we're jumping to a function and don't
+ * expect a return. To provide the function being jumped to with
+ * additional information, we use 'bl' instruction to jump rather than
+ * 'b'.
+ *
+ * Debuggers infer the location of a call from where LR points to, which
+ * is usually the instruction after 'bl'. If this macro expansion
+ * happens to be the last location in a function, that'll cause the LR
+ * to point a location beyond the function, thereby misleading debugger
+ * back trace. We therefore insert a 'nop' after the function call for
+ * debug builds, unless 'skip_nop' parameter is non-zero.
+ */
+ .macro no_ret _func:req, skip_nop=0
+ bl \_func
+#if DEBUG
+ .ifeq \skip_nop
+ nop
+ .endif
+#endif
+ .endm
+
#endif /* __ASM_MACROS_S__ */
diff --git a/include/common/aarch32/el3_common_macros.S b/include/common/aarch32/el3_common_macros.S
index 50ce952f..dcb4edd4 100644
--- a/include/common/aarch32/el3_common_macros.S
+++ b/include/common/aarch32/el3_common_macros.S
@@ -204,7 +204,7 @@
/* This is a cold boot on a secondary CPU */
bl plat_secondary_cold_boot_setup
/* plat_secondary_cold_boot_setup() is not supposed to return */
- bl plat_panic_handler
+ no_ret plat_panic_handler
do_primary_cold_boot:
.endif /* _secondary_cold_boot */