|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/2] 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>
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -37,7 +37,8 @@ static const unsigned char k8nops[] init
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_no
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
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_no
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
--- 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__ */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |