diff mbox

[kvm-unit-tests,02/18] x86: move size #defines to processor.h

Message ID 1398698581-17302-3-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini April 28, 2014, 3:22 p.m. UTC
These are necessary in many testcases that includes hand-written
assembly, otherwise they will only run for either 32- or 64-bit.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 lib/x86/desc.c      | 10 ----------
 lib/x86/isr.c       |  6 ------
 lib/x86/processor.h | 11 +++++++++++
 x86/vmexit.c        |  6 ------
 4 files changed, 11 insertions(+), 22 deletions(-)
diff mbox

Patch

diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index f75ec1d..ac60686 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -101,16 +101,6 @@  void do_handle_exception(struct ex_regs *regs)
 	exit(7);
 }
 
-#ifdef __x86_64__
-#  define R "r"
-#  define W "q"
-#  define S "8"
-#else
-#  define R "e"
-#  define W "l"
-#  define S "4"
-#endif
-
 #define EX(NAME, N) extern char NAME##_fault;	\
 	asm (".pushsection .text \n\t"		\
 	     #NAME"_fault: \n\t"		\
diff --git a/lib/x86/isr.c b/lib/x86/isr.c
index 9986d17..7dcd38a 100644
--- a/lib/x86/isr.c
+++ b/lib/x86/isr.c
@@ -3,12 +3,6 @@ 
 #include "vm.h"
 #include "desc.h"
 
-#ifdef __x86_64__
-#  define R "r"
-#else
-#  define R "e"
-#endif
-
 extern char isr_entry_point[];
 
 asm (
diff --git a/lib/x86/processor.h b/lib/x86/processor.h
index 29811d4..fabd480 100644
--- a/lib/x86/processor.h
+++ b/lib/x86/processor.h
@@ -4,6 +4,17 @@ 
 #include "libcflat.h"
 #include <stdint.h>
 
+#ifdef __x86_64__
+#  define R "r"
+#  define W "q"
+#  define S "8"
+#else
+#  define R "e"
+#  define W "l"
+#  define S "4"
+#endif
+
+
 struct descriptor_table_ptr {
     u16 limit;
     ulong base;
diff --git a/x86/vmexit.c b/x86/vmexit.c
index cc24738..3bd0c81 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -47,12 +47,6 @@  static unsigned int inl(unsigned short port)
 
 static int nr_cpus;
 
-#ifdef __x86_64__
-#  define R "r"
-#else
-#  define R "e"
-#endif
-
 static void cpuid_test(void)
 {
 	asm volatile ("push %%"R "bx; cpuid; pop %%"R "bx"