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

[Xen-changelog] [xen master] x86/alt: Introduce ALTERNATIVE{, _2} macros



commit 4711428f5e2a9bfff9f8d75b6a696072118c19a4
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Nov 3 16:32:59 2017 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Jan 5 19:57:07 2018 +0000

    x86/alt: Introduce ALTERNATIVE{,_2} macros
    
    To help creating alternative frames in assembly.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/asm-x86/alternative-asm.h | 46 +++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/xen/include/asm-x86/alternative-asm.h 
b/xen/include/asm-x86/alternative-asm.h
index bf0332e..6640e85 100644
--- a/xen/include/asm-x86/alternative-asm.h
+++ b/xen/include/asm-x86/alternative-asm.h
@@ -17,6 +17,52 @@
     .byte \alt_len
 .endm
 
+.macro ALTERNATIVE oldinstr, newinstr, feature
+.Lold_start_\@:
+    \oldinstr
+.Lold_end_\@:
+
+    .pushsection .altinstructions, "a", @progbits
+    altinstruction_entry .Lold_start_\@, .Lnew_start_\@, \feature, \
+        (.Lold_end_\@ - .Lold_start_\@), (.Lnew_end_\@ - .Lnew_start_\@)
+
+    .section .discard, "a", @progbits
+    /* Assembler-time check that \newinstr isn't longer than \oldinstr. */
+    .byte 0xff + (.Lnew_end_\@ - .Lnew_start_\@) - (.Lold_end_\@ - 
.Lold_start_\@)
+
+    .section .altinstr_replacement, "ax", @progbits
+.Lnew_start_\@:
+    \newinstr
+.Lnew_end_\@:
+    .popsection
+.endm
+
+.macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2
+.Lold_start_\@:
+    \oldinstr
+.Lold_end_\@:
+
+    .pushsection .altinstructions, "a", @progbits
+    altinstruction_entry .Lold_start_\@, .Lnew1_start_\@, \feature1, \
+        (.Lold_end_\@ - .Lold_start_\@), (.Lnew1_end_\@ - .Lnew1_start_\@)
+    altinstruction_entry .Lold_start_\@, .Lnew2_start_\@, \feature2, \
+        (.Lold_end_\@ - .Lold_start_\@), (.Lnew2_end_\@ - .Lnew2_start_\@)
+
+    .section .discard, "a", @progbits
+    /* Assembler-time check that \newinstr{1,2} aren't longer than \oldinstr. 
*/
+    .byte 0xff + (.Lnew1_end_\@ - .Lnew1_start_\@) - (.Lold_end_\@ - 
.Lold_start_\@)
+    .byte 0xff + (.Lnew2_end_\@ - .Lnew2_start_\@) - (.Lold_end_\@ - 
.Lold_start_\@)
+
+    .section .altinstr_replacement, "ax", @progbits
+.Lnew1_start_\@:
+    \newinstr1
+.Lnew1_end_\@:
+.Lnew2_start_\@:
+    \newinstr2
+.Lnew2_end_\@:
+    .popsection
+.endm
+
 #endif /* __ASSEMBLY__ */
 #endif /* _ASM_X86_ALTERNATIVE_ASM_H_ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.