Align AARCH32 version of debug.S with AARCH64
Re-order code (put panic and report_exception at the end of the file).
Export asm_print_* functions.
Add asm_print_line_dec macro, and asm_print_newline func.
Align comments in both AARCH32 and AARCH64 files.
Add blank lines in AARCH64 files to align with AARCH32.
Change-Id: I8e299a27c1390f71f04e260cd4a0e59b2384eb19
Signed-off-by: Yann Gautier <yann.gautier@st.com>
diff --git a/common/aarch64/debug.S b/common/aarch64/debug.S
index 7db2439..ad6acd9 100644
--- a/common/aarch64/debug.S
+++ b/common/aarch64/debug.S
@@ -38,11 +38,11 @@
mov x6, #10 /* Divide by 10 after every loop iteration */
mov x5, #MAX_DEC_DIVISOR
dec_print_loop:
- udiv x0, x4, x5 /* Get the quotient */
- msub x4, x0, x5, x4 /* Find the remainder */
- add x0, x0, #ASCII_OFFSET_NUM /* Convert to ascii */
+ udiv x0, x4, x5 /* Get the quotient */
+ msub x4, x0, x5, x4 /* Find the remainder */
+ add x0, x0, #ASCII_OFFSET_NUM /* Convert to ascii */
bl plat_crash_console_putc
- udiv x5, x5, x6 /* Reduce divisor */
+ udiv x5, x5, x6 /* Reduce divisor */
cbnz x5, dec_print_loop
.endm
@@ -64,10 +64,13 @@
*/
mov x5, x0
mov x6, x1
+
/* Ensure the console is initialized */
bl plat_crash_console_init
+
/* Check if the console is initialized */
cbz x0, _assert_loop
+
/* The console is initialized */
adr x4, assert_msg1
bl asm_print_str
@@ -75,6 +78,7 @@
bl asm_print_str
adr x4, assert_msg2
bl asm_print_str
+
/* Check if line number higher than max permitted */
tst x6, #~0xffff
b.ne _assert_loop
@@ -191,12 +195,15 @@
el3_panic:
mov x6, x30
bl plat_crash_console_init
+
/* Check if the console is initialized */
cbz x0, _panic_handler
+
/* 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