public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com, gleb@redhat.com, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 4/5] qemu-kvm: use upstream regs save/restore code
Date: Sat, 23 Oct 2010 20:05:28 -0200	[thread overview]
Message-ID: <20101023220718.740264028@amt.cnet> (raw)
In-Reply-To: 20101023220524.049191736@amt.cnet

[-- Attachment #1: qemu-kvm-x86-5 --]
[-- Type: text/plain, Size: 2755 bytes --]

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-kvm/qemu-kvm-x86.c
===================================================================
--- qemu-kvm.orig/qemu-kvm-x86.c
+++ qemu-kvm/qemu-kvm-x86.c
@@ -719,35 +719,12 @@ static void kvm_reset_mpstate(CPUState *
 
 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, &regs);
+    kvm_getput_regs(env, 1);
 
     kvm_put_xsave(env);
     kvm_put_xcrs(env);
@@ -824,35 +801,12 @@ void kvm_arch_load_regs(CPUState *env, i
 
 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, &regs);
-
-    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);
Index: qemu-kvm/target-i386/kvm.c
===================================================================
--- qemu-kvm.orig/target-i386/kvm.c
+++ qemu-kvm/target-i386/kvm.c
@@ -630,7 +630,6 @@ static void get_seg(SegmentCache *lhs, c
 	| (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
     return ret;
 }
 
-#endif
-
 static int kvm_put_fpu(CPUState *env)
 {
     struct kvm_fpu fpu;



  parent reply	other threads:[~2010-10-23 22:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-23 22:05 [patch 0/5] use upstream x86 state save/restore code Marcelo Tosatti
2010-10-23 22:05 ` [patch 1/5] qemu-kvm: kill xsave/xcrs helpers Marcelo Tosatti
2010-10-23 22:05 ` [patch 2/5] qemu-kvm: use upstream fpu/xsave/xcrs save/restore code Marcelo Tosatti
2010-10-23 22:05 ` [patch 3/5] qemu-kvm: use upstream sregs " Marcelo Tosatti
2010-10-23 22:05 ` Marcelo Tosatti [this message]
2010-10-23 22:05 ` [patch 5/5] qemu-kvm: use upstream msr " Marcelo Tosatti
2010-10-24 13:46 ` [patch 0/5] use upstream x86 state " Avi Kivity
2010-10-24 21:05   ` Marcelo Tosatti
2010-10-25  9:56     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101023220718.740264028@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox