aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/alternative.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2007-10-17 12:04:41 -0400
committerThomas Gleixner <tglx@inhelltoy.tec.linutronix.de>2007-10-17 14:17:04 -0400
commit32c464f5d9701db45bc1673288594e664065388e (patch)
tree342e6e8be44bcdc5bdc3ddd0cbf1ba15a0340602 /arch/x86/kernel/alternative.c
parentc861eff88c92d98ee661cf0d2fa978611edeaceb (diff)
x86: multi-byte single instruction NOPs
Add support for and use the multi-byte NOPs recently documented to be available on all PentiumPro and later processors. This patch only applies cleanly on top of the "x86: misc. constifications" patch sent earlier. [ tglx: arch/x86 adaptation ] Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> arch/x86/kernel/alternative.c | 23 ++++++++++++++++++++++- include/asm-x86/processor_32.h | 22 ++++++++++++++++++++++ include/asm-x86/processor_64.h | 22 ++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-)
Diffstat (limited to 'arch/x86/kernel/alternative.c')
-rw-r--r--arch/x86/kernel/alternative.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 8cb5dbbd9c2e..a3ae8e6c8b3b 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -116,12 +116,31 @@ static const unsigned char *const k7_nops[ASM_NOP_MAX+1] = {
116}; 116};
117#endif 117#endif
118 118
119#ifdef P6_NOP1
120asm("\t.section .rodata, \"a\"\np6nops: "
121 P6_NOP1 P6_NOP2 P6_NOP3 P6_NOP4 P6_NOP5 P6_NOP6
122 P6_NOP7 P6_NOP8);
123extern const unsigned char p6nops[];
124static const unsigned char *const p6_nops[ASM_NOP_MAX+1] = {
125 NULL,
126 p6nops,
127 p6nops + 1,
128 p6nops + 1 + 2,
129 p6nops + 1 + 2 + 3,
130 p6nops + 1 + 2 + 3 + 4,
131 p6nops + 1 + 2 + 3 + 4 + 5,
132 p6nops + 1 + 2 + 3 + 4 + 5 + 6,
133 p6nops + 1 + 2 + 3 + 4 + 5 + 6 + 7,
134};
135#endif
136
119#ifdef CONFIG_X86_64 137#ifdef CONFIG_X86_64
120 138
121extern char __vsyscall_0; 139extern char __vsyscall_0;
122static inline const unsigned char*const * find_nop_table(void) 140static inline const unsigned char*const * find_nop_table(void)
123{ 141{
124 return k8_nops; 142 return boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
143 boot_cpu_data.x86 < 6 ? k8_nops : p6_nops;
125} 144}
126 145
127#else /* CONFIG_X86_64 */ 146#else /* CONFIG_X86_64 */
@@ -132,6 +151,8 @@ static const struct nop {
132} noptypes[] = { 151} noptypes[] = {
133 { X86_FEATURE_K8, k8_nops }, 152 { X86_FEATURE_K8, k8_nops },
134 { X86_FEATURE_K7, k7_nops }, 153 { X86_FEATURE_K7, k7_nops },
154 { X86_FEATURE_P4, p6_nops },
155 { X86_FEATURE_P3, p6_nops },
135 { -1, NULL } 156 { -1, NULL }
136}; 157};
137 158