aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-30 07:31:40 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:31:40 -0500
commitea5e3593a493298c69b8c4a958628feace930478 (patch)
treeb6607e39bd44fd980e68a7ba80b0d76f7cdaa016 /include
parentae2e15eb3b6c2a011bee615470bf52d2beb99a4b (diff)
x86: unify asm nops
There's only one difference between the NOPs used in asm code for i386 and x86_64: i386 has a lot more variants. The code is moved to processor.h, and adjusted accordingly. Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86/processor.h85
-rw-r--r--include/asm-x86/processor_32.h85
-rw-r--r--include/asm-x86/processor_64.h44
3 files changed, 85 insertions, 129 deletions
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index bfac9739f57e..a8f1702ec3ba 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -592,6 +592,91 @@ extern int bootloader_type;
592extern char ignore_fpu_irq; 592extern char ignore_fpu_irq;
593#define cache_line_size() (boot_cpu_data.x86_cache_alignment) 593#define cache_line_size() (boot_cpu_data.x86_cache_alignment)
594 594
595/* generic versions from gas */
596#define GENERIC_NOP1 ".byte 0x90\n"
597#define GENERIC_NOP2 ".byte 0x89,0xf6\n"
598#define GENERIC_NOP3 ".byte 0x8d,0x76,0x00\n"
599#define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00\n"
600#define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4
601#define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00\n"
602#define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00\n"
603#define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7
604
605/* Opteron nops */
606#define K8_NOP1 GENERIC_NOP1
607#define K8_NOP2 ".byte 0x66,0x90\n"
608#define K8_NOP3 ".byte 0x66,0x66,0x90\n"
609#define K8_NOP4 ".byte 0x66,0x66,0x66,0x90\n"
610#define K8_NOP5 K8_NOP3 K8_NOP2
611#define K8_NOP6 K8_NOP3 K8_NOP3
612#define K8_NOP7 K8_NOP4 K8_NOP3
613#define K8_NOP8 K8_NOP4 K8_NOP4
614
615/* K7 nops */
616/* uses eax dependencies (arbitary choice) */
617#define K7_NOP1 GENERIC_NOP1
618#define K7_NOP2 ".byte 0x8b,0xc0\n"
619#define K7_NOP3 ".byte 0x8d,0x04,0x20\n"
620#define K7_NOP4 ".byte 0x8d,0x44,0x20,0x00\n"
621#define K7_NOP5 K7_NOP4 ASM_NOP1
622#define K7_NOP6 ".byte 0x8d,0x80,0,0,0,0\n"
623#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n"
624#define K7_NOP8 K7_NOP7 ASM_NOP1
625
626/* P6 nops */
627/* uses eax dependencies (Intel-recommended choice) */
628#define P6_NOP1 GENERIC_NOP1
629#define P6_NOP2 ".byte 0x66,0x90\n"
630#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n"
631#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n"
632#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n"
633#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n"
634#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n"
635#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n"
636
637#ifdef CONFIG_MK7
638#define ASM_NOP1 K7_NOP1
639#define ASM_NOP2 K7_NOP2
640#define ASM_NOP3 K7_NOP3
641#define ASM_NOP4 K7_NOP4
642#define ASM_NOP5 K7_NOP5
643#define ASM_NOP6 K7_NOP6
644#define ASM_NOP7 K7_NOP7
645#define ASM_NOP8 K7_NOP8
646#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \
647 defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \
648 defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4) || \
649 defined(CONFIG_MPSC)
650#define ASM_NOP1 P6_NOP1
651#define ASM_NOP2 P6_NOP2
652#define ASM_NOP3 P6_NOP3
653#define ASM_NOP4 P6_NOP4
654#define ASM_NOP5 P6_NOP5
655#define ASM_NOP6 P6_NOP6
656#define ASM_NOP7 P6_NOP7
657#define ASM_NOP8 P6_NOP8
658#elif defined(CONFIG_MK8) || defined(CONFIG_X86_64)
659#define ASM_NOP1 K8_NOP1
660#define ASM_NOP2 K8_NOP2
661#define ASM_NOP3 K8_NOP3
662#define ASM_NOP4 K8_NOP4
663#define ASM_NOP5 K8_NOP5
664#define ASM_NOP6 K8_NOP6
665#define ASM_NOP7 K8_NOP7
666#define ASM_NOP8 K8_NOP8
667#else
668#define ASM_NOP1 GENERIC_NOP1
669#define ASM_NOP2 GENERIC_NOP2
670#define ASM_NOP3 GENERIC_NOP3
671#define ASM_NOP4 GENERIC_NOP4
672#define ASM_NOP5 GENERIC_NOP5
673#define ASM_NOP6 GENERIC_NOP6
674#define ASM_NOP7 GENERIC_NOP7
675#define ASM_NOP8 GENERIC_NOP8
676#endif
677
678#define ASM_NOP_MAX 8
679
595#define HAVE_ARCH_PICK_MMAP_LAYOUT 1 680#define HAVE_ARCH_PICK_MMAP_LAYOUT 1
596#define ARCH_HAS_PREFETCHW 681#define ARCH_HAS_PREFETCHW
597#define ARCH_HAS_SPINLOCK_PREFETCH 682#define ARCH_HAS_SPINLOCK_PREFETCH
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h
index 61a9cae2364b..82fafabbfe7a 100644
--- a/include/asm-x86/processor_32.h
+++ b/include/asm-x86/processor_32.h
@@ -18,7 +18,6 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <asm/desc_defs.h> 19#include <asm/desc_defs.h>
20 20
21
22/* 21/*
23 * the following now lives in the per cpu area: 22 * the following now lives in the per cpu area:
24 * extern int cpu_llc_id[NR_CPUS]; 23 * extern int cpu_llc_id[NR_CPUS];
@@ -144,88 +143,4 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
144 143
145#define KSTK_ESP(task) (task_pt_regs(task)->sp) 144#define KSTK_ESP(task) (task_pt_regs(task)->sp)
146 145
147/* generic versions from gas */
148#define GENERIC_NOP1 ".byte 0x90\n"
149#define GENERIC_NOP2 ".byte 0x89,0xf6\n"
150#define GENERIC_NOP3 ".byte 0x8d,0x76,0x00\n"
151#define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00\n"
152#define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4
153#define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00\n"
154#define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00\n"
155#define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7
156
157/* Opteron nops */
158#define K8_NOP1 GENERIC_NOP1
159#define K8_NOP2 ".byte 0x66,0x90\n"
160#define K8_NOP3 ".byte 0x66,0x66,0x90\n"
161#define K8_NOP4 ".byte 0x66,0x66,0x66,0x90\n"
162#define K8_NOP5 K8_NOP3 K8_NOP2
163#define K8_NOP6 K8_NOP3 K8_NOP3
164#define K8_NOP7 K8_NOP4 K8_NOP3
165#define K8_NOP8 K8_NOP4 K8_NOP4
166
167/* K7 nops */
168/* uses eax dependencies (arbitary choice) */
169#define K7_NOP1 GENERIC_NOP1
170#define K7_NOP2 ".byte 0x8b,0xc0\n"
171#define K7_NOP3 ".byte 0x8d,0x04,0x20\n"
172#define K7_NOP4 ".byte 0x8d,0x44,0x20,0x00\n"
173#define K7_NOP5 K7_NOP4 ASM_NOP1
174#define K7_NOP6 ".byte 0x8d,0x80,0,0,0,0\n"
175#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n"
176#define K7_NOP8 K7_NOP7 ASM_NOP1
177
178/* P6 nops */
179/* uses eax dependencies (Intel-recommended choice) */
180#define P6_NOP1 GENERIC_NOP1
181#define P6_NOP2 ".byte 0x66,0x90\n"
182#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n"
183#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n"
184#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n"
185#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n"
186#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n"
187#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n"
188
189#ifdef CONFIG_MK8
190#define ASM_NOP1 K8_NOP1
191#define ASM_NOP2 K8_NOP2
192#define ASM_NOP3 K8_NOP3
193#define ASM_NOP4 K8_NOP4
194#define ASM_NOP5 K8_NOP5
195#define ASM_NOP6 K8_NOP6
196#define ASM_NOP7 K8_NOP7
197#define ASM_NOP8 K8_NOP8
198#elif defined(CONFIG_MK7)
199#define ASM_NOP1 K7_NOP1
200#define ASM_NOP2 K7_NOP2
201#define ASM_NOP3 K7_NOP3
202#define ASM_NOP4 K7_NOP4
203#define ASM_NOP5 K7_NOP5
204#define ASM_NOP6 K7_NOP6
205#define ASM_NOP7 K7_NOP7
206#define ASM_NOP8 K7_NOP8
207#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \
208 defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \
209 defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4)
210#define ASM_NOP1 P6_NOP1
211#define ASM_NOP2 P6_NOP2
212#define ASM_NOP3 P6_NOP3
213#define ASM_NOP4 P6_NOP4
214#define ASM_NOP5 P6_NOP5
215#define ASM_NOP6 P6_NOP6
216#define ASM_NOP7 P6_NOP7
217#define ASM_NOP8 P6_NOP8
218#else
219#define ASM_NOP1 GENERIC_NOP1
220#define ASM_NOP2 GENERIC_NOP2
221#define ASM_NOP3 GENERIC_NOP3
222#define ASM_NOP4 GENERIC_NOP4
223#define ASM_NOP5 GENERIC_NOP5
224#define ASM_NOP6 GENERIC_NOP6
225#define ASM_NOP7 GENERIC_NOP7
226#define ASM_NOP8 GENERIC_NOP8
227#endif
228
229#define ASM_NOP_MAX 8
230
231#endif /* __ASM_I386_PROCESSOR_H */ 146#endif /* __ASM_I386_PROCESSOR_H */
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h
index 08b965124b97..86fc2dcc8687 100644
--- a/include/asm-x86/processor_64.h
+++ b/include/asm-x86/processor_64.h
@@ -80,48 +80,4 @@ DECLARE_PER_CPU(struct orig_ist, orig_ist);
80#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1) 80#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1)
81#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ 81#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
82 82
83
84#if defined(CONFIG_MPSC) || defined(CONFIG_MCORE2)
85#define ASM_NOP1 P6_NOP1
86#define ASM_NOP2 P6_NOP2
87#define ASM_NOP3 P6_NOP3
88#define ASM_NOP4 P6_NOP4
89#define ASM_NOP5 P6_NOP5
90#define ASM_NOP6 P6_NOP6
91#define ASM_NOP7 P6_NOP7
92#define ASM_NOP8 P6_NOP8
93#else
94#define ASM_NOP1 K8_NOP1
95#define ASM_NOP2 K8_NOP2
96#define ASM_NOP3 K8_NOP3
97#define ASM_NOP4 K8_NOP4
98#define ASM_NOP5 K8_NOP5
99#define ASM_NOP6 K8_NOP6
100#define ASM_NOP7 K8_NOP7
101#define ASM_NOP8 K8_NOP8
102#endif
103
104/* Opteron nops */
105#define K8_NOP1 ".byte 0x90\n"
106#define K8_NOP2 ".byte 0x66,0x90\n"
107#define K8_NOP3 ".byte 0x66,0x66,0x90\n"
108#define K8_NOP4 ".byte 0x66,0x66,0x66,0x90\n"
109#define K8_NOP5 K8_NOP3 K8_NOP2
110#define K8_NOP6 K8_NOP3 K8_NOP3
111#define K8_NOP7 K8_NOP4 K8_NOP3
112#define K8_NOP8 K8_NOP4 K8_NOP4
113
114/* P6 nops */
115/* uses eax dependencies (Intel-recommended choice) */
116#define P6_NOP1 ".byte 0x90\n"
117#define P6_NOP2 ".byte 0x66,0x90\n"
118#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n"
119#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n"
120#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n"
121#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n"
122#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n"
123#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n"
124
125#define ASM_NOP_MAX 8
126
127#endif /* __ASM_X86_64_PROCESSOR_H */ 83#endif /* __ASM_X86_64_PROCESSOR_H */