From: Zhang Xiantao <[EMAIL PROTECTED]> Date: Mon, 3 Dec 2007 16:46:05 +0800 Subject: [PATCH] kvm: qemu: using kvm_arch_pre_kvm_run to hold x86-specific code. In this patch, it use kvm_arch_pre_kvm_run to hold x86-specific code for pre_kvm_run; Signed-off-by: Zhang Xiantao <[EMAIL PROTECTED]> --- qemu/qemu-kvm-x86.c | 8 ++++++++ qemu/qemu-kvm.c | 4 ++-- qemu/qemu-kvm.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 3eeb419..d5fe6c2 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -565,4 +565,12 @@ int kvm_arch_halt(void *opaque, int vcpu)
return 1;
}
+void kvm_arch_pre_kvm_run(void *opaque, int vcpu)
+{
+ CPUState *env = cpu_single_env;
+
+ if (!kvm_irqchip_in_kernel(kvm_context))
+ kvm_set_cr8(kvm_context, vcpu, cpu_get_apic_tpr(env));
+}
+
#endif
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index a20a393..669720c 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -138,8 +138,8 @@ static int pre_kvm_run(void *opaque, int vcpu)
pthread_mutex_lock(&qemu_mutex);
}
- if (!kvm_irqchip_in_kernel(kvm_context))
- kvm_set_cr8(kvm_context, vcpu, cpu_get_apic_tpr(env));
+ kvm_arch_pre_kvm_run(opaque, vcpu);
+
if (env->interrupt_request & CPU_INTERRUPT_EXIT)
return 1;
pthread_mutex_unlock(&qemu_mutex);
diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h
index 2f0e696..c380e60 100644
--- a/qemu/qemu-kvm.h
+++ b/qemu/qemu-kvm.h
@@ -34,6 +34,7 @@ void kvm_arch_save_regs(CPUState *env);
void kvm_arch_load_regs(CPUState *env);
int kvm_arch_qemu_init_env(CPUState *cenv);
int kvm_arch_halt(void *opaque, int vcpu);
+void kvm_arch_pre_kvm_run(void *opaque, int vcpu);
#define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1))
#define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS)
/ 8)
--
1.5.1.2
0006-kvm-qemu-using-kvm_arch_pre_kvm_run-to-hold-x86-sp.patch
Description: 0006-kvm-qemu-using-kvm_arch_pre_kvm_run-to-hold-x86-sp.patch
------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________ kvm-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-devel
