FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 06-03-2008, 11:32 PM
Alok Kataria
 
Default x86: move nop declarations into separate include file

OriginalAuthor: Andi Kleen <ak@suse.de>
Commit: bd61643ef6139ba44142f2ba6e79e03267e6b54a

Move nop declarations required for alternative to a separate header
file, needed to avoid a include loop.

Signed-off-by: Alok Kataria <akataria@vmware.com>
---
include/asm-x86/nops.h | 5 ++
include/asm-x86/nops_32.h | 90 ++++++++++++++++++++++++++++++++++++++++
include/asm-x86/nops_64.h | 49 ++++++++++++++++++++++
include/asm-x86/processor_32.h | 85 +-------------------------------------
include/asm-x86/processor_64.h | 45 +-------------------
5 files changed, 146 insertions(+), 128 deletions(-)
create mode 100644 include/asm-x86/nops.h
create mode 100644 include/asm-x86/nops_32.h
create mode 100644 include/asm-x86/nops_64.h

diff --git a/include/asm-x86/nops.h b/include/asm-x86/nops.h
new file mode 100644
index 0000000..404f17d
--- /dev/null
+++ b/include/asm-x86/nops.h
@@ -0,0 +1,5 @@
+#ifdef CONFIG_X86_32
+# include "nops_32.h"
+#else
+# include "nops_64.h"
+#endif
diff --git a/include/asm-x86/nops_32.h b/include/asm-x86/nops_32.h
new file mode 100644
index 0000000..5ba60de
--- /dev/null
+++ b/include/asm-x86/nops_32.h
@@ -0,0 +1,90 @@
+#ifndef _ASM_NOPS_H
+#define _ASM_NOPS_H
+
+/* Define nops for use with alternative() */
+
+/* generic versions from gas */
+#define GENERIC_NOP1 ".byte 0x90
"
+#define GENERIC_NOP2 ".byte 0x89,0xf6
"
+#define GENERIC_NOP3 ".byte 0x8d,0x76,0x00
"
+#define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00
"
+#define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4
+#define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00
"
+#define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00
"
+#define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7
+
+/* Opteron nops */
+#define K8_NOP1 GENERIC_NOP1
+#define K8_NOP2 ".byte 0x66,0x90
"
+#define K8_NOP3 ".byte 0x66,0x66,0x90
"
+#define K8_NOP4 ".byte 0x66,0x66,0x66,0x90
"
+#define K8_NOP5 K8_NOP3 K8_NOP2
+#define K8_NOP6 K8_NOP3 K8_NOP3
+#define K8_NOP7 K8_NOP4 K8_NOP3
+#define K8_NOP8 K8_NOP4 K8_NOP4
+
+/* K7 nops */
+/* uses eax dependencies (arbitary choice) */
+#define K7_NOP1 GENERIC_NOP1
+#define K7_NOP2 ".byte 0x8b,0xc0
"
+#define K7_NOP3 ".byte 0x8d,0x04,0x20
"
+#define K7_NOP4 ".byte 0x8d,0x44,0x20,0x00
"
+#define K7_NOP5 K7_NOP4 ASM_NOP1
+#define K7_NOP6 ".byte 0x8d,0x80,0,0,0,0
"
+#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0
"
+#define K7_NOP8 K7_NOP7 ASM_NOP1
+
+/* P6 nops */
+/* uses eax dependencies (Intel-recommended choice) */
+#define P6_NOP1 GENERIC_NOP1
+#define P6_NOP2 ".byte 0x66,0x90
"
+#define P6_NOP3 ".byte 0x0f,0x1f,0x00
"
+#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0
"
+#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0
"
+#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0
"
+#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0
"
+#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0
"
+
+#ifdef CONFIG_MK8
+#define ASM_NOP1 K8_NOP1
+#define ASM_NOP2 K8_NOP2
+#define ASM_NOP3 K8_NOP3
+#define ASM_NOP4 K8_NOP4
+#define ASM_NOP5 K8_NOP5
+#define ASM_NOP6 K8_NOP6
+#define ASM_NOP7 K8_NOP7
+#define ASM_NOP8 K8_NOP8
+#elif defined(CONFIG_MK7)
+#define ASM_NOP1 K7_NOP1
+#define ASM_NOP2 K7_NOP2
+#define ASM_NOP3 K7_NOP3
+#define ASM_NOP4 K7_NOP4
+#define ASM_NOP5 K7_NOP5
+#define ASM_NOP6 K7_NOP6
+#define ASM_NOP7 K7_NOP7
+#define ASM_NOP8 K7_NOP8
+#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) ||
+ defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) ||
+ defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4)
+#define ASM_NOP1 P6_NOP1
+#define ASM_NOP2 P6_NOP2
+#define ASM_NOP3 P6_NOP3
+#define ASM_NOP4 P6_NOP4
+#define ASM_NOP5 P6_NOP5
+#define ASM_NOP6 P6_NOP6
+#define ASM_NOP7 P6_NOP7
+#define ASM_NOP8 P6_NOP8
+#else
+#define ASM_NOP1 GENERIC_NOP1
+#define ASM_NOP2 GENERIC_NOP2
+#define ASM_NOP3 GENERIC_NOP3
+#define ASM_NOP4 GENERIC_NOP4
+#define ASM_NOP5 GENERIC_NOP5
+#define ASM_NOP6 GENERIC_NOP6
+#define ASM_NOP7 GENERIC_NOP7
+#define ASM_NOP8 GENERIC_NOP8
+#endif
+
+#define ASM_NOP_MAX 8
+
+#endif
diff --git a/include/asm-x86/nops_64.h b/include/asm-x86/nops_64.h
new file mode 100644
index 0000000..df20290
--- /dev/null
+++ b/include/asm-x86/nops_64.h
@@ -0,0 +1,49 @@
+#ifndef _ASM_NOPS_H
+#define _ASM_NOPS_H
+
+/* Define nops for use with alternative() */
+
+#if defined(CONFIG_MPSC) || defined(CONFIG_MCORE2)
+#define ASM_NOP1 P6_NOP1
+#define ASM_NOP2 P6_NOP2
+#define ASM_NOP3 P6_NOP3
+#define ASM_NOP4 P6_NOP4
+#define ASM_NOP5 P6_NOP5
+#define ASM_NOP6 P6_NOP6
+#define ASM_NOP7 P6_NOP7
+#define ASM_NOP8 P6_NOP8
+#else
+#define ASM_NOP1 K8_NOP1
+#define ASM_NOP2 K8_NOP2
+#define ASM_NOP3 K8_NOP3
+#define ASM_NOP4 K8_NOP4
+#define ASM_NOP5 K8_NOP5
+#define ASM_NOP6 K8_NOP6
+#define ASM_NOP7 K8_NOP7
+#define ASM_NOP8 K8_NOP8
+#endif
+
+/* Opteron nops */
+#define K8_NOP1 ".byte 0x90
"
+#define K8_NOP2 ".byte 0x66,0x90
"
+#define K8_NOP3 ".byte 0x66,0x66,0x90
"
+#define K8_NOP4 ".byte 0x66,0x66,0x66,0x90
"
+#define K8_NOP5 K8_NOP3 K8_NOP2
+#define K8_NOP6 K8_NOP3 K8_NOP3
+#define K8_NOP7 K8_NOP4 K8_NOP3
+#define K8_NOP8 K8_NOP4 K8_NOP4
+
+/* P6 nops */
+/* uses eax dependencies (Intel-recommended choice) */
+#define P6_NOP1 ".byte 0x90
"
+#define P6_NOP2 ".byte 0x66,0x90
"
+#define P6_NOP3 ".byte 0x0f,0x1f,0x00
"
+#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0
"
+#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0
"
+#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0
"
+#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0
"
+#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0
"
+
+#define ASM_NOP_MAX 8
+
+#endif
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h
index 13976b0..f5910b3 100644
--- a/include/asm-x86/processor_32.h
+++ b/include/asm-x86/processor_32.h
@@ -15,6 +15,7 @@
#include <asm/sigcontext.h>
#include <asm/cpufeature.h>
#include <asm/msr.h>
+#include <asm/nops.h>
#include <asm/system.h>
#include <linux/cache.h>
#include <linux/threads.h>
@@ -652,90 +653,6 @@ static inline unsigned int cpuid_edx(unsigned int op)
return edx;
}

-/* generic versions from gas */
-#define GENERIC_NOP1 ".byte 0x90
"
-#define GENERIC_NOP2 ".byte 0x89,0xf6
"
-#define GENERIC_NOP3 ".byte 0x8d,0x76,0x00
"
-#define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00
"
-#define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4
-#define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00
"
-#define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00
"
-#define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7
-
-/* Opteron nops */
-#define K8_NOP1 GENERIC_NOP1
-#define K8_NOP2 ".byte 0x66,0x90
"
-#define K8_NOP3 ".byte 0x66,0x66,0x90
"
-#define K8_NOP4 ".byte 0x66,0x66,0x66,0x90
"
-#define K8_NOP5 K8_NOP3 K8_NOP2
-#define K8_NOP6 K8_NOP3 K8_NOP3
-#define K8_NOP7 K8_NOP4 K8_NOP3
-#define K8_NOP8 K8_NOP4 K8_NOP4
-
-/* K7 nops */
-/* uses eax dependencies (arbitary choice) */
-#define K7_NOP1 GENERIC_NOP1
-#define K7_NOP2 ".byte 0x8b,0xc0
"
-#define K7_NOP3 ".byte 0x8d,0x04,0x20
"
-#define K7_NOP4 ".byte 0x8d,0x44,0x20,0x00
"
-#define K7_NOP5 K7_NOP4 ASM_NOP1
-#define K7_NOP6 ".byte 0x8d,0x80,0,0,0,0
"
-#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0
"
-#define K7_NOP8 K7_NOP7 ASM_NOP1
-
-/* P6 nops */
-/* uses eax dependencies (Intel-recommended choice) */
-#define P6_NOP1 GENERIC_NOP1
-#define P6_NOP2 ".byte 0x66,0x90
"
-#define P6_NOP3 ".byte 0x0f,0x1f,0x00
"
-#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0
"
-#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0
"
-#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0
"
-#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0
"
-#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0
"
-
-#ifdef CONFIG_MK8
-#define ASM_NOP1 K8_NOP1
-#define ASM_NOP2 K8_NOP2
-#define ASM_NOP3 K8_NOP3
-#define ASM_NOP4 K8_NOP4
-#define ASM_NOP5 K8_NOP5
-#define ASM_NOP6 K8_NOP6
-#define ASM_NOP7 K8_NOP7
-#define ASM_NOP8 K8_NOP8
-#elif defined(CONFIG_MK7)
-#define ASM_NOP1 K7_NOP1
-#define ASM_NOP2 K7_NOP2
-#define ASM_NOP3 K7_NOP3
-#define ASM_NOP4 K7_NOP4
-#define ASM_NOP5 K7_NOP5
-#define ASM_NOP6 K7_NOP6
-#define ASM_NOP7 K7_NOP7
-#define ASM_NOP8 K7_NOP8
-#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) ||
- defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) ||
- defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4)
-#define ASM_NOP1 P6_NOP1
-#define ASM_NOP2 P6_NOP2
-#define ASM_NOP3 P6_NOP3
-#define ASM_NOP4 P6_NOP4
-#define ASM_NOP5 P6_NOP5
-#define ASM_NOP6 P6_NOP6
-#define ASM_NOP7 P6_NOP7
-#define ASM_NOP8 P6_NOP8
-#else
-#define ASM_NOP1 GENERIC_NOP1
-#define ASM_NOP2 GENERIC_NOP2
-#define ASM_NOP3 GENERIC_NOP3
-#define ASM_NOP4 GENERIC_NOP4
-#define ASM_NOP5 GENERIC_NOP5
-#define ASM_NOP6 GENERIC_NOP6
-#define ASM_NOP7 GENERIC_NOP7
-#define ASM_NOP8 GENERIC_NOP8
-#endif
-
-#define ASM_NOP_MAX 8
-
/* Prefetch instructions for Pentium III and AMD Athlon */
/* It's not worth to care about 3dnow! prefetches for the K6
because they are microcoded there and very slow.
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h
index e4f1997..d25ea71 100644
--- a/include/asm-x86/processor_64.h
+++ b/include/asm-x86/processor_64.h
@@ -15,6 +15,7 @@
#include <linux/threads.h>
#include <asm/msr.h>
#include <asm/current.h>
+#include <asm/nops.h>
#include <asm/system.h>
#include <asm/mmsegment.h>
#include <asm/percpu.h>
@@ -335,50 +336,6 @@ struct extended_sigtable {
struct extended_signature sigs[0];
};

-
-#if defined(CONFIG_MPSC) || defined(CONFIG_MCORE2)
-#define ASM_NOP1 P6_NOP1
-#define ASM_NOP2 P6_NOP2
-#define ASM_NOP3 P6_NOP3
-#define ASM_NOP4 P6_NOP4
-#define ASM_NOP5 P6_NOP5
-#define ASM_NOP6 P6_NOP6
-#define ASM_NOP7 P6_NOP7
-#define ASM_NOP8 P6_NOP8
-#else
-#define ASM_NOP1 K8_NOP1
-#define ASM_NOP2 K8_NOP2
-#define ASM_NOP3 K8_NOP3
-#define ASM_NOP4 K8_NOP4
-#define ASM_NOP5 K8_NOP5
-#define ASM_NOP6 K8_NOP6
-#define ASM_NOP7 K8_NOP7
-#define ASM_NOP8 K8_NOP8
-#endif
-
-/* Opteron nops */
-#define K8_NOP1 ".byte 0x90
"
-#define K8_NOP2 ".byte 0x66,0x90
"
-#define K8_NOP3 ".byte 0x66,0x66,0x90
"
-#define K8_NOP4 ".byte 0x66,0x66,0x66,0x90
"
-#define K8_NOP5 K8_NOP3 K8_NOP2
-#define K8_NOP6 K8_NOP3 K8_NOP3
-#define K8_NOP7 K8_NOP4 K8_NOP3
-#define K8_NOP8 K8_NOP4 K8_NOP4
-
-/* P6 nops */
-/* uses eax dependencies (Intel-recommended choice) */
-#define P6_NOP1 ".byte 0x90
"
-#define P6_NOP2 ".byte 0x66,0x90
"
-#define P6_NOP3 ".byte 0x0f,0x1f,0x00
"
-#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0
"
-#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0
"
-#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0
"
-#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0
"
-#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0
"
-
-#define ASM_NOP_MAX 8
-
/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
static inline void rep_nop(void)
{
--
1.5.4




--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 07:58 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org