kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/5] kvm: avoid using cpu_single_env
       [not found] <cover.1351436501.git.blauwirbel@gmail.com>
@ 2012-10-28 15:03 ` Blue Swirl
  2012-10-31  3:25   ` [Qemu-devel] " Andreas Färber
  0 siblings, 1 reply; 2+ messages in thread
From: Blue Swirl @ 2012-10-28 15:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel, Avi Kivity, Marcelo Tosatti, kvm

Pass around CPUState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 target-i386/kvm.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 3aa62b2..3329d5e 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1909,14 +1909,15 @@ void kvm_arch_remove_all_hw_breakpoints(void)
 
 static CPUWatchpoint hw_watchpoint;
 
-static int kvm_handle_debug(struct kvm_debug_exit_arch *arch_info)
+static int kvm_handle_debug(CPUX86State *env,
+                            struct kvm_debug_exit_arch *arch_info)
 {
     int ret = 0;
     int n;
 
     if (arch_info->exception == 1) {
         if (arch_info->dr6 & (1 << 14)) {
-            if (cpu_single_env->singlestep_enabled) {
+            if (env->singlestep_enabled) {
                 ret = EXCP_DEBUG;
             }
         } else {
@@ -1928,13 +1929,13 @@ static int kvm_handle_debug(struct kvm_debug_exit_arch *arch_info)
                         break;
                     case 0x1:
                         ret = EXCP_DEBUG;
-                        cpu_single_env->watchpoint_hit = &hw_watchpoint;
+                        env->watchpoint_hit = &hw_watchpoint;
                         hw_watchpoint.vaddr = hw_breakpoint[n].addr;
                         hw_watchpoint.flags = BP_MEM_WRITE;
                         break;
                     case 0x3:
                         ret = EXCP_DEBUG;
-                        cpu_single_env->watchpoint_hit = &hw_watchpoint;
+                        env->watchpoint_hit = &hw_watchpoint;
                         hw_watchpoint.vaddr = hw_breakpoint[n].addr;
                         hw_watchpoint.flags = BP_MEM_ACCESS;
                         break;
@@ -1942,16 +1943,16 @@ static int kvm_handle_debug(struct kvm_debug_exit_arch *arch_info)
                 }
             }
         }
-    } else if (kvm_find_sw_breakpoint(cpu_single_env, arch_info->pc)) {
+    } else if (kvm_find_sw_breakpoint(env, arch_info->pc)) {
         ret = EXCP_DEBUG;
     }
     if (ret == 0) {
-        cpu_synchronize_state(cpu_single_env);
-        assert(cpu_single_env->exception_injected == -1);
+        cpu_synchronize_state(env);
+        assert(env->exception_injected == -1);
 
         /* pass to guest */
-        cpu_single_env->exception_injected = arch_info->exception;
-        cpu_single_env->has_error_code = 0;
+        env->exception_injected = arch_info->exception;
+        env->has_error_code = 0;
     }
 
     return ret;
@@ -2034,7 +2035,7 @@ int kvm_arch_handle_exit(CPUX86State *env, struct kvm_run *run)
         break;
     case KVM_EXIT_DEBUG:
         DPRINTF("kvm_exit_debug\n");
-        ret = kvm_handle_debug(&run->debug.arch);
+        ret = kvm_handle_debug(env, &run->debug.arch);
         break;
     default:
         fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH 2/5] kvm: avoid using cpu_single_env
  2012-10-28 15:03 ` [PATCH 2/5] kvm: avoid using cpu_single_env Blue Swirl
@ 2012-10-31  3:25   ` Andreas Färber
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Färber @ 2012-10-31  3:25 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel, Marcelo Tosatti, Avi Kivity, kvm

Am 28.10.2012 16:03, schrieb Blue Swirl:
> Pass around CPUState instead of using global cpu_single_env.
> 
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
>  target-i386/kvm.c |   21 +++++++++++----------
>  1 files changed, 11 insertions(+), 10 deletions(-)

If you fix CPUState -> CPU*State or CPUArchState above,

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-31  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1351436501.git.blauwirbel@gmail.com>
2012-10-28 15:03 ` [PATCH 2/5] kvm: avoid using cpu_single_env Blue Swirl
2012-10-31  3:25   ` [Qemu-devel] " Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).