From 0583db6c105df8870084ba866ca08bfb681eaf2d Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Wed, 27 Aug 2008 09:23:17 +0800
Subject: [PATCH] KVM: External Module: Moving two files for cross-arch support.

x86/external-module-compat.c -> external-module-compat.c.
hack-module.awk -> x86/hack-module.awk.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
 kernel/Makefile                           |    2 +-
 kernel/external-module-compat-comm.h      |    1 -
 kernel/{x86 => }/external-module-compat.c |    0 
 kernel/x86/Kbuild                         |    6 +++---
 kernel/x86/external-module-compat.h       |    2 ++
 kernel/{ => x86}/hack-module.awk          |    0 
 6 files changed, 6 insertions(+), 5 deletions(-)
 rename kernel/{x86 => }/external-module-compat.c (100%)
 rename kernel/{ => x86}/hack-module.awk (100%)

diff --git a/kernel/Makefile b/kernel/Makefile
index 6f8cc9d..d2913a9 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -19,7 +19,7 @@ LINUX = ../linux-2.6
 version = $(shell cd $(LINUX); git describe)
 
 _hack = mv $1 $1.orig && \
-	gawk -v version=$(version) -f hack-module.awk $1.orig \
+	gawk -v version=$(version) -f $(ARCH_DIR)/hack-module.awk $1.orig \
 	    | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig
 
 unifdef = mv $1 $1.orig && \
diff --git a/kernel/external-module-compat-comm.h b/kernel/external-module-compat-comm.h
index 97e921b..2e87c57 100644
--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -17,7 +17,6 @@
 #include <asm/processor.h>
 #include <linux/hrtimer.h>
 #include <asm/bitops.h>
-#include <asm/msr.h>
 
 /*
  * 2.6.16 does not have GFP_NOWAIT
diff --git a/kernel/x86/external-module-compat.c b/kernel/external-module-compat.c
similarity index 100%
rename from kernel/x86/external-module-compat.c
rename to kernel/external-module-compat.c
diff --git a/kernel/x86/Kbuild b/kernel/x86/Kbuild
index ee81a1e..8dc0483 100644
--- a/kernel/x86/Kbuild
+++ b/kernel/x86/Kbuild
@@ -1,11 +1,11 @@
 obj-m := kvm.o kvm-intel.o kvm-amd.o
 kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o ../anon_inodes.o irq.o i8259.o \
 	 lapic.o ioapic.o preempt.o i8254.o coalesced_mmio.o \
-	 external-module-compat.o
+	 ../external-module-compat.o
 ifeq ($(CONFIG_KVM_TRACE),y)
 kvm-objs += kvm_trace.o
 endif
-kvm-intel-objs := vmx.o vmx-debug.o external-module-compat.o
-kvm-amd-objs := svm.o external-module-compat.o
+kvm-intel-objs := vmx.o vmx-debug.o ../external-module-compat.o
+kvm-amd-objs := svm.o ../external-module-compat.o
 
 CFLAGS_kvm_main.o = -DKVM_MAIN
diff --git a/kernel/x86/external-module-compat.h b/kernel/x86/external-module-compat.h
index f6e3e34..c53e0d6 100644
--- a/kernel/x86/external-module-compat.h
+++ b/kernel/x86/external-module-compat.h
@@ -8,6 +8,8 @@
 
 #include "../external-module-compat-comm.h"
 
+#include <asm/msr.h>
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
 
 #ifndef _EFER_SCE
diff --git a/kernel/hack-module.awk b/kernel/x86/hack-module.awk
similarity index 100%
rename from kernel/hack-module.awk
rename to kernel/x86/hack-module.awk
-- 
1.5.6.2

