From d6d32e5c7092491e280c5c34078721ef148e9333 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Sat, 23 Oct 2010 20:05:28 -0200 Subject: [PATCH] qemu-kvm: use upstream regs save/restore code Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity --- qemu-kvm-x86.c | 50 ++------------------------------------------------ target-i386/kvm.c | 3 --- 2 files changed, 2 insertions(+), 51 deletions(-) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 45c6aaea4d..9813f475cb 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -719,35 +719,12 @@ static void kvm_reset_mpstate(CPUState *env) void kvm_arch_load_regs(CPUState *env, int level) { - struct kvm_regs regs; struct kvm_msr_entry msrs[100]; int rc, n, i; assert(kvm_cpu_is_stopped(env) || env->thread_id == kvm_get_thread_id()); - regs.rax = env->regs[R_EAX]; - regs.rbx = env->regs[R_EBX]; - regs.rcx = env->regs[R_ECX]; - regs.rdx = env->regs[R_EDX]; - regs.rsi = env->regs[R_ESI]; - regs.rdi = env->regs[R_EDI]; - regs.rsp = env->regs[R_ESP]; - regs.rbp = env->regs[R_EBP]; -#ifdef TARGET_X86_64 - regs.r8 = env->regs[8]; - regs.r9 = env->regs[9]; - regs.r10 = env->regs[10]; - regs.r11 = env->regs[11]; - regs.r12 = env->regs[12]; - regs.r13 = env->regs[13]; - regs.r14 = env->regs[14]; - regs.r15 = env->regs[15]; -#endif - - regs.rflags = env->eflags; - regs.rip = env->eip; - - kvm_set_regs(env, ®s); + kvm_getput_regs(env, 1); kvm_put_xsave(env); kvm_put_xcrs(env); @@ -824,35 +801,12 @@ void kvm_arch_load_regs(CPUState *env, int level) void kvm_arch_save_regs(CPUState *env) { - struct kvm_regs regs; struct kvm_msr_entry msrs[100]; uint32_t i, n, rc; assert(kvm_cpu_is_stopped(env) || env->thread_id == kvm_get_thread_id()); - kvm_get_regs(env, ®s); - - env->regs[R_EAX] = regs.rax; - env->regs[R_EBX] = regs.rbx; - env->regs[R_ECX] = regs.rcx; - env->regs[R_EDX] = regs.rdx; - env->regs[R_ESI] = regs.rsi; - env->regs[R_EDI] = regs.rdi; - env->regs[R_ESP] = regs.rsp; - env->regs[R_EBP] = regs.rbp; -#ifdef TARGET_X86_64 - env->regs[8] = regs.r8; - env->regs[9] = regs.r9; - env->regs[10] = regs.r10; - env->regs[11] = regs.r11; - env->regs[12] = regs.r12; - env->regs[13] = regs.r13; - env->regs[14] = regs.r14; - env->regs[15] = regs.r15; -#endif - - env->eflags = regs.rflags; - env->eip = regs.rip; + kvm_getput_regs(env, 0); kvm_get_xsave(env); kvm_get_xcrs(env); diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 1e98a2eb7b..64a620256f 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -630,7 +630,6 @@ static void get_seg(SegmentCache *lhs, const struct kvm_segment *rhs) | (rhs->avl * DESC_AVL_MASK); } -#ifdef OBSOLETE_KVM_IMPL static void kvm_getput_reg(__u64 *kvm_reg, target_ulong *qemu_reg, int set) { @@ -679,8 +678,6 @@ static int kvm_getput_regs(CPUState *env, int set) return ret; } -#endif - static int kvm_put_fpu(CPUState *env) { struct kvm_fpu fpu; -- 2.11.4.GIT