mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
Rework use of labels in assembly macros.
This patch provides a workaround for the ASM_ASSERT label issue and also reworks the use of labels in assembly macros. If the caller of the ASM_ASSERT macro happened to use the label '1' to jump past the ASM_ASSERT macro, it would not have worked since the ASM_ASSERT macro internally used the same label. Hence, as a workaround, this patch makes the label a high number in the expectation that the caller will never use it. Also updated the other assembly macros using numerical labels to named lables. Change-Id: Iec892359db84f2391ad2a83a92141c4d7049776a
This commit is contained in:
parent
a4a8eaeb36
commit
aecc084080
3 changed files with 13 additions and 10 deletions
|
@ -58,13 +58,13 @@ assert_msg2:
|
||||||
.macro asm_print_line_dec
|
.macro asm_print_line_dec
|
||||||
mov x6, #10 /* Divide by 10 after every loop iteration */
|
mov x6, #10 /* Divide by 10 after every loop iteration */
|
||||||
mov x5, #MAX_DEC_DIVISOR
|
mov x5, #MAX_DEC_DIVISOR
|
||||||
1:
|
dec_print_loop:
|
||||||
udiv x0, x4, x5 /* Get the quotient */
|
udiv x0, x4, x5 /* Get the quotient */
|
||||||
msub x4, x0, x5, x4 /* Find the remainder */
|
msub x4, x0, x5, x4 /* Find the remainder */
|
||||||
add x0, x0, #ASCII_OFFSET_NUM /* Convert to ascii */
|
add x0, x0, #ASCII_OFFSET_NUM /* Convert to ascii */
|
||||||
bl plat_crash_console_putc
|
bl plat_crash_console_putc
|
||||||
udiv x5, x5, x6 /* Reduce divisor */
|
udiv x5, x5, x6 /* Reduce divisor */
|
||||||
cbnz x5, 1b
|
cbnz x5, dec_print_loop
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,10 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assembler macro to enable asm_assert. Use this macro wherever
|
* Assembler macro to enable asm_assert. Use this macro wherever
|
||||||
* assert is required in assembly.
|
* assert is required in assembly. Please note that the macro makes
|
||||||
|
* use of label '300' to provide the logic and the caller
|
||||||
|
* should make sure that this label is not used to branch prior
|
||||||
|
* to calling this macro.
|
||||||
*/
|
*/
|
||||||
#define ASM_ASSERT(_cc) \
|
#define ASM_ASSERT(_cc) \
|
||||||
.ifndef .L_assert_filename ;\
|
.ifndef .L_assert_filename ;\
|
||||||
|
@ -39,8 +42,8 @@
|
||||||
.string __FILE__ ;\
|
.string __FILE__ ;\
|
||||||
.popsection ;\
|
.popsection ;\
|
||||||
.endif ;\
|
.endif ;\
|
||||||
b._cc 1f ;\
|
b._cc 300f ;\
|
||||||
adr x0, .L_assert_filename ;\
|
adr x0, .L_assert_filename ;\
|
||||||
mov x1, __LINE__ ;\
|
mov x1, __LINE__ ;\
|
||||||
b asm_assert ;\
|
b asm_assert ;\
|
||||||
1:
|
300:
|
||||||
|
|
|
@ -52,7 +52,7 @@ spacer:
|
||||||
.macro plat_print_gic_regs
|
.macro plat_print_gic_regs
|
||||||
adr x0, plat_config
|
adr x0, plat_config
|
||||||
ldr w16, [x0, #CONFIG_GICC_BASE_OFFSET]
|
ldr w16, [x0, #CONFIG_GICC_BASE_OFFSET]
|
||||||
cbz x16, 1f
|
cbz x16, exit_print_gic_regs
|
||||||
/* gic base address is now in x16 */
|
/* gic base address is now in x16 */
|
||||||
adr x6, gic_regs /* Load the gic reg list to x6 */
|
adr x6, gic_regs /* Load the gic reg list to x6 */
|
||||||
/* Load the gic regs to gp regs used by str_in_crash_buf_print */
|
/* Load the gic regs to gp regs used by str_in_crash_buf_print */
|
||||||
|
@ -66,10 +66,10 @@ spacer:
|
||||||
add x7, x16, #GICD_ISPENDR
|
add x7, x16, #GICD_ISPENDR
|
||||||
adr x4, gicd_pend_reg
|
adr x4, gicd_pend_reg
|
||||||
bl asm_print_str
|
bl asm_print_str
|
||||||
2:
|
gicd_ispendr_loop:
|
||||||
sub x4, x7, x16
|
sub x4, x7, x16
|
||||||
cmp x4, #0x280
|
cmp x4, #0x280
|
||||||
b.eq 1f
|
b.eq exit_print_gic_regs
|
||||||
bl asm_print_hex
|
bl asm_print_hex
|
||||||
adr x4, spacer
|
adr x4, spacer
|
||||||
bl asm_print_str
|
bl asm_print_str
|
||||||
|
@ -77,8 +77,8 @@ spacer:
|
||||||
bl asm_print_hex
|
bl asm_print_hex
|
||||||
adr x4, newline
|
adr x4, newline
|
||||||
bl asm_print_str
|
bl asm_print_str
|
||||||
b 2b
|
b gicd_ispendr_loop
|
||||||
1:
|
exit_print_gic_regs:
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.section .rodata.cci_reg_name, "aS"
|
.section .rodata.cci_reg_name, "aS"
|
||||||
|
|
Loading…
Add table
Reference in a new issue