[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] xen/arm64: head: Don't clobber x30/lr in the macro PRINT



commit 1396dabdfd6c050d6b2ed3593dbabb81a4ac41d6
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Mon Jul 22 22:39:26 2019 +0100
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Mon Jul 29 16:13:57 2019 -0700

    xen/arm64: head: Don't clobber x30/lr in the macro PRINT
    
    The current implementation of the macro PRINT will clobber x30/lr. This
    means the user should save lr if it cares about it.
    
    Follow-up patches will introduce more use of PRINT in place where lr
    should be preserved. Rather than requiring all the users to preserve
    lr, the macro PRINT is modified to save and restore it.
    
    While the comment state x3 will be clobbered, this is not the case. So
    PRINT will use x3 to preserve lr.
    
    Lastly, take the opportunity to move the comment on top of PRINT and use
    PRINT in init_uart. Both changes will be helpful in a follow-up patch.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/arm64/head.S | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index f2d7445f6a..6afe83c347 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -78,12 +78,17 @@
  *  x30 - lr
  */
 
-/* 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    ;     \
+/*
+ * Macro to print a string to the UART, if there is one.
+ *
+ * Clobbers x0 - x3
+ */
+#define PRINT(_s)          \
+        mov   x3, lr ;     \
+        adr   x0, 98f ;    \
+        bl    puts    ;    \
+        mov   lr, x3 ;     \
         RODATA_STR(98, _s)
 #else /* CONFIG_EARLY_PRINTK */
 #define PRINT(s)
@@ -622,9 +627,8 @@ init_uart:
 #ifdef EARLY_PRINTK_INIT_UART
         early_uart_init x23, 0
 #endif
-        adr   x0, 1f
-        b     puts
-RODATA_STR(1, "- UART enabled -\r\n")
+        PRINT("- UART enabled -\r\n")
+        ret
 
 /* Print early debug messages.
  * x0: Nul-terminated string to print.
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.