xen/arm64: Move print_reg macro to asm/arm64/macros.h
PATCH v2 1/1 xen/arm64: Move print_reg macro to asm/arm64/macros.h
Macro print_reg is used to print a value of a register passed as an argument. While today it is only used from within the common head.S, in the future we might want to make use of it from other files, just like PRINT(). It also serves as a great aid when debugging.
Expose print_reg macro by moving it to asm/arm64/macros.h and:
- rename putn to asm_putn to denote the usage from assembly only,
- use ENTRY() for asm_putn to make it globally visible.
This way the behavior will be consistent with what we already do on arm32.
Take the opportunity to get rid of unneeded stubs for early_puts, init_uart and putn since the calls to them are already protected by respective #ifdef CONFIG_EARLY_PRINTK.
---
Changes in v2:
- re-sentence the stubs removal in commit msg
- patch split out from series (others dropped)
--- xen/arch/arm/arm64/head.S | 32 ++++--------------------- xen/arch/arm/include/asm/arm64/macros.h | 15 ++++++++++++ 2 files changed, 19 insertions(+), 28 deletions(-)
xen/arch/arm/arm64/head.S +4 -28
@@ -74,25 +74,6 @@ * x30 - lr */ - #ifdef CONFIG_EARLY_PRINTK -/* - * Macro to print the value of register \xb - * - * Clobbers x0 - x4 - */ -.macro print_reg xb - mov x0, \xb - mov x4, lr - bl putn - mov lr, x4 -.endm - -#else /* CONFIG_EARLY_PRINTK */ -.macro print_reg xb -.endm - -#endif /* !CONFIG_EARLY_PRINTK */ - .section .text.header, "ax", %progbits /*.aarch64*/
@@ -493,11 +474,12 @@ ENDPROC(asm_puts) /* * Print a 64-bit number in hex. + * Note: This function must be called from assembly. * x0: Number to print. * x23: Early UART base address * Clobbers x0-x3 */ -putn: +ENTRY(asm_putn) adr x1, hex mov x3, #16 1:
@@ -510,18 +492,12 @@ putn: subs x3, x3, #1 b.ne 1b ret -ENDPROC(putn) +ENDPROC(asm_putn) hex: .ascii "0123456789abcdef" .align 2 -#else /* CONFIG_EARLY_PRINTK */ - -ENTRY(early_puts) -init_uart: -putn: ret - -#endif /* !CONFIG_EARLY_PRINTK */ +#endif /* CONFIG_EARLY_PRINTK */ /* This provides a C-API version of __lookup_processor_type * TODO: For now, the implementation return NULL every time
xen/arch/arm/include/asm/arm64/macros.h +15 -0
@@ -45,9 +45,24 @@mov lr, x3 ; \RODATA_STR (98 , _s) +/* +* Macro to print the value of register \xb +* +* Clobbers x0 - x4 +*/ +.macro print_reg xb + mov x0, \xb + mov x4, lr + bl asm_putn + mov lr, x4 +.endm + #else /* CONFIG_EARLY_PRINTK */ #define PRINT(s) +.macro print_reg xb +.endm +#endif /* !CONFIG_EARLY_PRINTK */ /*
Signature · 1 line
2.25.1
Hi,
Quoted 11 lines · Michal Orzel
Macro
print_regis used to print a value of a register passed as an argument. While today it is only used from within the commonhead.S, in the future we might want to make use of it from other files, just likePRINT(). It also serves as a great aid when debugging.Expose
print_regmacro by moving it toasm/arm64/macros.hand:
- rename putn toasm_putnto denote the usage from assembly only,
- useENTRY()forasm_putnto make it globally visible.This way the behavior will be consistent with what we already do on arm32.
Quoted 8 lines
Take the opportunity to get rid of unneeded stubs for
early_puts,init_uartand putn since the calls to them are already protected by respective #ifdefCONFIG_EARLY_PRINTK.Signed-off-by Michal Orzel <[email protected]>Reviewed-by Luca Fancellu <[email protected]>Tested-by Luca Fancellu <[email protected]>Acked-by Julien Grall <[email protected]>
This is now committed.
Cheers,
Signature · 1 line
Julien Grall