]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Introduce DECLSTR() for declaring strings in ASM
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 22 Apr 2016 19:00:30 +0000 (20:00 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 22 Apr 2016 19:00:30 +0000 (20:00 +0100)
Put the string in the mergeable string section, declare it as data, and set
its size.

Replace the partial open-coding of this in head_{pv,hvm}.S for main_err_msg,
and switch the label to being local.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/boot/head_hvm.S
arch/x86/boot/head_pv.S
include/xtf/asm_macros.h

index 7f503d68e031a62150ddd0b52cb599c6e2f5b561..3288216af0a4a831864e0ecccbca0691fb60e044 100644 (file)
@@ -74,17 +74,14 @@ GLOBAL(_start)                  /* HVM common setup. */
 
         /* panic() if xtf_main manages to return. */
 #ifdef __x86_64__
-        lea main_err_msg(%rip), %rdi
+        lea .Lmain_err_msg(%rip), %rdi
 #else
-        push $main_err_msg
+        push $.Lmain_err_msg
 #endif
         call panic
 ENDFUNC(_start)
 
-.section .rodata.str1, "aMS", @progbits, 1
-
-main_err_msg: .asciz "xtf_main() returned\n"
-SIZE(main_err_msg)
+DECLSTR(.Lmain_err_msg, "xtf_main() returned\n")
 
 /*
  * Local variables:
index cdb1b2ba44c9ed38ba36a5ba44feca467eb2e24a..88fa8cf0db5c425c9bfaaadebb0730f2e1ba9676 100644 (file)
@@ -41,17 +41,14 @@ GLOBAL(_start)
 
         /* panic() if xtf_main manages to return. */
 #ifdef __x86_64__
-        lea main_err_msg(%rip), %rdi
+        lea .Lmain_err_msg(%rip), %rdi
 #else
-        push $main_err_msg
+        push $.Lmain_err_msg
 #endif
         call panic
 ENDFUNC(_start)
 
-.section .rodata.str1, "aMS", @progbits, 1
-
-main_err_msg: .asciz "xtf_main() returned\n"
-SIZE(main_err_msg)
+DECLSTR(.Lmain_err_msg, "xtf_main() returned\n")
 
 /*
  * Local variables:
index 1806fa1a5d0cf5e2769d44abc499b08853f6b0db..1fe00ffcc25a6f50bc1be045a8eaa70b6cadc5dd 100644 (file)
@@ -43,6 +43,19 @@ name:
     .type name, STT_FUNC;                       \
     SIZE(name)
 
+/**
+ * Declare a string with label @p name and value @p val.  It is placed in the
+ * mergable string section, is declared as data, and has its size set.
+ * @param name String name.
+ * @param val String content.
+ */
+#define DECLSTR(name, val)                          \
+    .pushsection .rodata.str1, "aMS", @progbits, 1; \
+    name: .asciz val;                               \
+    .type name, STT_OBJECT;                         \
+    SIZE(name)                                      \
+    .popsection
+
 /**
  * Create an ELF note entry.
  *