diff mbox series

[Xen-devel,MM-PART2,RESEND,v2,08/19] xen/arm64: head: Move earlyprintk messages in .rodata.str

Message ID 20190514122456.28559-9-julien.grall@arm.com
State New
Headers show
Series xen/arm: Clean-up & fixes in boot/mm code | expand

Commit Message

Julien Grall May 14, 2019, 12:24 p.m. UTC
At the moment, the earlyprintk messages are interleaved with the
instructions. This makes more difficult to read the objdump output.

Introduce a new macro to add a string in .rodata.str and use it for all
the earlyprintk messages.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andrii Anisov <andrii_anisov@epam.com>

---

I haven't done a similar change in arm32 yet because the compiler will
throw an error when using 'adr' when load an address from a different
section (see A5-200 in ARM DDI 0406C.a for the technical reason).
The change is likely to be more elaborate.

    Changes in v2:
        - Add Andrii's reviewed-by
---
 xen/arch/arm/arm64/head.S       | 14 +++++---------
 xen/include/asm-arm/asm_defns.h |  5 +++++
 2 files changed, 10 insertions(+), 9 deletions(-)

Comments

Stefano Stabellini May 20, 2019, 10:56 p.m. UTC | #1
On Tue, 14 May 2019, Julien Grall wrote:
> At the moment, the earlyprintk messages are interleaved with the
> instructions. This makes more difficult to read the objdump output.
> 
> Introduce a new macro to add a string in .rodata.str and use it for all
> the earlyprintk messages.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Reviewed-by: Andrii Anisov <andrii_anisov@epam.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> 
> I haven't done a similar change in arm32 yet because the compiler will
> throw an error when using 'adr' when load an address from a different
> section (see A5-200 in ARM DDI 0406C.a for the technical reason).
> The change is likely to be more elaborate.
> 
>     Changes in v2:
>         - Add Andrii's reviewed-by
> ---
>  xen/arch/arm/arm64/head.S       | 14 +++++---------
>  xen/include/asm-arm/asm_defns.h |  5 +++++
>  2 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
> index ad446e7345..b957eb90fb 100644
> --- a/xen/arch/arm/arm64/head.S
> +++ b/xen/arch/arm/arm64/head.S
> @@ -81,13 +81,10 @@
>  /* Macro to print a string to the UART, if there is one.
>   * Clobbers x0-x3. */
>  #ifdef CONFIG_EARLY_PRINTK
> -#define PRINT(_s)       \
> -        adr   x0, 98f ; \
> -        bl    puts    ; \
> -        b     99f     ; \
> -98:     .asciz _s     ; \
> -        .align 2      ; \
> -99:
> +#define PRINT(_s)           \
> +        adr   x0, 98f ;     \
> +        bl    puts    ;     \
> +        RODATA_STR(98, _s)
>  #else /* CONFIG_EARLY_PRINTK */
>  #define PRINT(s)
>  #endif /* !CONFIG_EARLY_PRINTK */
> @@ -633,8 +630,7 @@ init_uart:
>  #endif
>          adr   x0, 1f
>          b     puts
> -1:      .asciz "- UART enabled -\r\n"
> -        .align 4
> +RODATA_STR(1, "- UART enabled -\r\n")
>  
>  /* Print early debug messages.
>   * x0: Nul-terminated string to print.
> diff --git a/xen/include/asm-arm/asm_defns.h b/xen/include/asm-arm/asm_defns.h
> index 02be83e2b3..3f21def0ab 100644
> --- a/xen/include/asm-arm/asm_defns.h
> +++ b/xen/include/asm-arm/asm_defns.h
> @@ -16,6 +16,11 @@
>  # error "unknown ARM variant"
>  #endif
>  
> +#define RODATA_STR(label, msg)                  \
> +.pushsection .rodata.str, "aMS", %progbits, 1 ; \
> +label:  .asciz msg;                             \
> +.popsection
> +
>  #endif /* __ARM_ASM_DEFNS_H__ */
>  /*
>   * Local variables:
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index ad446e7345..b957eb90fb 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -81,13 +81,10 @@ 
 /* Macro to print a string to the UART, if there is one.
  * Clobbers x0-x3. */
 #ifdef CONFIG_EARLY_PRINTK
-#define PRINT(_s)       \
-        adr   x0, 98f ; \
-        bl    puts    ; \
-        b     99f     ; \
-98:     .asciz _s     ; \
-        .align 2      ; \
-99:
+#define PRINT(_s)           \
+        adr   x0, 98f ;     \
+        bl    puts    ;     \
+        RODATA_STR(98, _s)
 #else /* CONFIG_EARLY_PRINTK */
 #define PRINT(s)
 #endif /* !CONFIG_EARLY_PRINTK */
@@ -633,8 +630,7 @@  init_uart:
 #endif
         adr   x0, 1f
         b     puts
-1:      .asciz "- UART enabled -\r\n"
-        .align 4
+RODATA_STR(1, "- UART enabled -\r\n")
 
 /* Print early debug messages.
  * x0: Nul-terminated string to print.
diff --git a/xen/include/asm-arm/asm_defns.h b/xen/include/asm-arm/asm_defns.h
index 02be83e2b3..3f21def0ab 100644
--- a/xen/include/asm-arm/asm_defns.h
+++ b/xen/include/asm-arm/asm_defns.h
@@ -16,6 +16,11 @@ 
 # error "unknown ARM variant"
 #endif
 
+#define RODATA_STR(label, msg)                  \
+.pushsection .rodata.str, "aMS", %progbits, 1 ; \
+label:  .asciz msg;                             \
+.popsection
+
 #endif /* __ARM_ASM_DEFNS_H__ */
 /*
  * Local variables: