aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86
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 /include/asm-x86
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 'include/asm-x86')
-rw-r--r--include/asm-x86/processor_32.h22
-rw-r--r--include/asm-x86/processor_64.h22
2 files changed, 44 insertions, 0 deletions
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h
index 38cc1061487e..83800e7496ee 100644
--- a/include/asm-x86/processor_32.h
+++ b/include/asm-x86/processor_32.h
@@ -677,6 +677,17 @@ static inline unsigned int cpuid_edx(unsigned int op)
677#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n" 677#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n"
678#define K7_NOP8 K7_NOP7 ASM_NOP1 678#define K7_NOP8 K7_NOP7 ASM_NOP1
679 679
680/* P6 nops */
681/* uses eax dependencies (Intel-recommended choice) */
682#define P6_NOP1 GENERIC_NOP1
683#define P6_NOP2 ".byte 0x66,0x90\n"
684#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n"
685#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n"
686#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n"
687#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n"
688#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n"
689#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n"
690
680#ifdef CONFIG_MK8 691#ifdef CONFIG_MK8
681#define ASM_NOP1 K8_NOP1 692#define ASM_NOP1 K8_NOP1
682#define ASM_NOP2 K8_NOP2 693#define ASM_NOP2 K8_NOP2
@@ -695,6 +706,17 @@ static inline unsigned int cpuid_edx(unsigned int op)
695#define ASM_NOP6 K7_NOP6 706#define ASM_NOP6 K7_NOP6
696#define ASM_NOP7 K7_NOP7 707#define ASM_NOP7 K7_NOP7
697#define ASM_NOP8 K7_NOP8 708#define ASM_NOP8 K7_NOP8
709#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \
710 defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \
711 defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4)
712#define ASM_NOP1 P6_NOP1
713#define ASM_NOP2 P6_NOP2
714#define ASM_NOP3 P6_NOP3
715#define ASM_NOP4 P6_NOP4
716#define ASM_NOP5 P6_NOP5
717#define ASM_NOP6 P6_NOP6
718#define ASM_NOP7 P6_NOP7
719#define ASM_NOP8 P6_NOP8
698#else 720#else
699#define ASM_NOP1 GENERIC_NOP1 721#define ASM_NOP1 GENERIC_NOP1
700#define ASM_NOP2 GENERIC_NOP2 722#define ASM_NOP2 GENERIC_NOP2
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h
index 2f12eb6e46b0..f422becbddd9 100644
--- a/include/asm-x86/processor_64.h
+++ b/include/asm-x86/processor_64.h
@@ -334,6 +334,16 @@ struct extended_sigtable {
334}; 334};
335 335
336 336
337#if defined(CONFIG_MPSC) || defined(CONFIG_MCORE2)
338#define ASM_NOP1 P6_NOP1
339#define ASM_NOP2 P6_NOP2
340#define ASM_NOP3 P6_NOP3
341#define ASM_NOP4 P6_NOP4
342#define ASM_NOP5 P6_NOP5
343#define ASM_NOP6 P6_NOP6
344#define ASM_NOP7 P6_NOP7
345#define ASM_NOP8 P6_NOP8
346#else
337#define ASM_NOP1 K8_NOP1 347#define ASM_NOP1 K8_NOP1
338#define ASM_NOP2 K8_NOP2 348#define ASM_NOP2 K8_NOP2
339#define ASM_NOP3 K8_NOP3 349#define ASM_NOP3 K8_NOP3
@@ -342,6 +352,7 @@ struct extended_sigtable {
342#define ASM_NOP6 K8_NOP6 352#define ASM_NOP6 K8_NOP6
343#define ASM_NOP7 K8_NOP7 353#define ASM_NOP7 K8_NOP7
344#define ASM_NOP8 K8_NOP8 354#define ASM_NOP8 K8_NOP8
355#endif
345 356
346/* Opteron nops */ 357/* Opteron nops */
347#define K8_NOP1 ".byte 0x90\n" 358#define K8_NOP1 ".byte 0x90\n"
@@ -353,6 +364,17 @@ struct extended_sigtable {
353#define K8_NOP7 K8_NOP4 K8_NOP3 364#define K8_NOP7 K8_NOP4 K8_NOP3
354#define K8_NOP8 K8_NOP4 K8_NOP4 365#define K8_NOP8 K8_NOP4 K8_NOP4
355 366
367/* P6 nops */
368/* uses eax dependencies (Intel-recommended choice) */
369#define P6_NOP1 ".byte 0x90\n"
370#define P6_NOP2 ".byte 0x66,0x90\n"
371#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n"
372#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n"
373#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n"
374#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n"
375#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n"
376#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n"
377
356#define ASM_NOP_MAX 8 378#define ASM_NOP_MAX 8
357 379
358/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ 380/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */