summaryrefslogtreecommitdiff
path: root/common/aarch64
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2014-06-25 10:07:40 +0100
committerSoby Mathew <soby.mathew@arm.com>2014-07-28 11:03:20 +0100
commit626ed510f179c905a699f4663ee933c10892b4c3 (patch)
treea9328fb3d8a00b2f065be0e91ba225e46968247a /common/aarch64
parentbc9201289c9ae4ccfc6b11048431d47eba547a44 (diff)
Rework the crash reporting in BL3-1 to use less stack
This patch reworks the crash reporting mechanism to further optimise the stack and code size. The reporting makes use of assembly console functions to avoid calling C Runtime to report the CPU state. The crash buffer requirement is reduced to 64 bytes with this implementation. The crash buffer is now part of per-cpu data which makes retrieving the crash buffer trivial. Also now panic() will use crash reporting if invoked from BL3-1. Fixes ARM-software/tf-issues#199 Change-Id: I79d27a4524583d723483165dc40801f45e627da5
Diffstat (limited to 'common/aarch64')
-rw-r--r--common/aarch64/debug.S (renamed from common/aarch64/assert.S)47
1 files changed, 47 insertions, 0 deletions
diff --git a/common/aarch64/assert.S b/common/aarch64/debug.S
index a62c8f51..b7d7ac23 100644
--- a/common/aarch64/assert.S
+++ b/common/aarch64/debug.S
@@ -139,3 +139,50 @@ func asm_print_hex
cbnz x5, 1b
ret x3
+ /***********************************************************
+ * The common implementation of do_panic for all BL stages
+ ***********************************************************/
+
+.section .rodata.panic_str, "aS"
+ panic_msg: .asciz "PANIC at PC : 0x"
+
+/* ---------------------------------------------------------------------------
+ * do_panic assumes that it is invoked from a C Runtime Environment ie a
+ * valid stack exists. This call will not return.
+ * Clobber list : if CRASH_REPORTING is not enabled then x30, x0 - x6
+ * ---------------------------------------------------------------------------
+ */
+
+/* This is for the non el3 BL stages to compile through */
+ .weak el3_panic
+
+func do_panic
+#if CRASH_REPORTING
+ str x0, [sp, #-0x10]!
+ mrs x0, currentel
+ ubfx x0, x0, #2, #2
+ cmp x0, #0x3
+ ldr x0, [sp], #0x10
+ b.eq el3_panic
+#endif
+
+panic_common:
+/*
+ * el3_panic will be redefined by the BL31
+ * crash reporting mechanism (if enabled)
+ */
+el3_panic:
+ mov x6, x30
+ bl plat_crash_console_init
+ /* Check if the console is initialized */
+ cbz x0, _panic_loop
+ /* The console is initialized */
+ adr x4, panic_msg
+ bl asm_print_str
+ mov x4, x6
+ /* The panic location is lr -4 */
+ sub x4, x4, #4
+ bl asm_print_hex
+_panic_loop:
+ b _panic_loop
+