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

[Xen-changelog] [xen master] x86: introduce NOP9 forms



commit 40b75c1d79e648caae24134e8e6319328be13d1b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Dec 20 10:03:20 2017 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Dec 20 10:03:20 2017 +0100

    x86: introduce NOP9 forms
    
    Both Intel and AMD recommend an operand-size-override-prefixed long NOP
    form for covering 9 bytes, so introduce this and use it in p6_nops[] to
    allow further reducing the number of NOPs needed when covering larger
    ranges.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/alternative.c | 12 ++++++++----
 xen/include/asm-x86/nops.h |  6 +++++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index af7b42f..ee18e6c 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -37,7 +37,8 @@ static const unsigned char k8nops[] init_or_livepatch_const = 
{
     K8_NOP5,
     K8_NOP6,
     K8_NOP7,
-    K8_NOP8
+    K8_NOP8,
+    K8_NOP9,
 };
 static const unsigned char * const k8_nops[ASM_NOP_MAX+1] 
init_or_livepatch_constrel = {
     NULL,
@@ -48,7 +49,8 @@ static const unsigned char * const k8_nops[ASM_NOP_MAX+1] 
init_or_livepatch_cons
     k8nops + 1 + 2 + 3 + 4,
     k8nops + 1 + 2 + 3 + 4 + 5,
     k8nops + 1 + 2 + 3 + 4 + 5 + 6,
-    k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7
+    k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7,
+    k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8,
 };
 #endif
 
@@ -61,7 +63,8 @@ static const unsigned char p6nops[] init_or_livepatch_const = 
{
     P6_NOP5,
     P6_NOP6,
     P6_NOP7,
-    P6_NOP8
+    P6_NOP8,
+    P6_NOP9,
 };
 static const unsigned char * const p6_nops[ASM_NOP_MAX+1] 
init_or_livepatch_constrel = {
     NULL,
@@ -72,7 +75,8 @@ static const unsigned char * const p6_nops[ASM_NOP_MAX+1] 
init_or_livepatch_cons
     p6nops + 1 + 2 + 3 + 4,
     p6nops + 1 + 2 + 3 + 4 + 5,
     p6nops + 1 + 2 + 3 + 4 + 5 + 6,
-    p6nops + 1 + 2 + 3 + 4 + 5 + 6 + 7
+    p6nops + 1 + 2 + 3 + 4 + 5 + 6 + 7,
+    p6nops + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8,
 };
 #endif
 
diff --git a/xen/include/asm-x86/nops.h b/xen/include/asm-x86/nops.h
index 9a6a4e1..dda9d20 100644
--- a/xen/include/asm-x86/nops.h
+++ b/xen/include/asm-x86/nops.h
@@ -22,6 +22,7 @@
 #define K8_NOP6 K8_NOP3,K8_NOP3
 #define K8_NOP7 K8_NOP4,K8_NOP3
 #define K8_NOP8 K8_NOP4,K8_NOP4
+#define K8_NOP9 K8_NOP3,K8_NOP3,K8_NOP3
 
 /*
  * P6 nops
@@ -34,6 +35,7 @@
  * 6: osp nopl 0x00(%eax,%eax,1)
  * 7: nopl 0x00000000(%eax)
  * 8: nopl 0x00000000(%eax,%eax,1)
+ * 9: nopw 0x00000000(%eax,%eax,1)
  *    Note: All the above are assumed to be a single instruction.
  *          There is kernel code that depends on this.
  */
@@ -45,6 +47,7 @@
 #define P6_NOP6 0x66,0x0f,0x1f,0x44,0x00,0
 #define P6_NOP7 0x0f,0x1f,0x80,0,0,0,0
 #define P6_NOP8 0x0f,0x1f,0x84,0x00,0,0,0,0
+#define P6_NOP9 0x66,0x0f,0x1f,0x84,0x00,0,0,0,0
 
 #ifdef __ASSEMBLY__
 #define _ASM_MK_NOP(x) .byte x
@@ -60,7 +63,8 @@
 #define ASM_NOP6 _ASM_MK_NOP(K8_NOP6)
 #define ASM_NOP7 _ASM_MK_NOP(K8_NOP7)
 #define ASM_NOP8 _ASM_MK_NOP(K8_NOP8)
+#define ASM_NOP9 _ASM_MK_NOP(K8_NOP9)
 
-#define ASM_NOP_MAX 8
+#define ASM_NOP_MAX 9
 
 #endif /* __X86_ASM_NOPS_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®.