summary refs log tree commit diff stats
path: root/hw/apic.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-08-17 23:19:53 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:35:30 -0500
commit4c0960c0c483fffc5f8e1dab169d946ac295bf44 (patch)
tree1dd3a77d60b3aa96132741326bdb3a8e66fa95c8 /hw/apic.c
parent09aaa1602f9381c0e0fb539390b1793e51bdfc7b (diff)
downloadfocaccia-qemu-4c0960c0c483fffc5f8e1dab169d946ac295bf44.tar.gz
focaccia-qemu-4c0960c0c483fffc5f8e1dab169d946ac295bf44.zip
kvm: Simplify cpu_synchronize_state()
cpu_synchronize_state() is a little unreadable since the 'modified'
argument isn't self-explanatory.  Simplify it by making it always
synchronize the kernel state into qemu, and automatically flush the
registers back to the kernel if they've been synchronized on this
exit.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/apic.c')
-rw-r--r--hw/apic.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/apic.c b/hw/apic.c
index 223af16925..2c414c1878 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -936,8 +936,11 @@ static const VMStateDescription vmstate_apic = {
 static void apic_reset(void *opaque)
 {
     APICState *s = opaque;
-    int bsp = cpu_is_bsp(s->cpu_env);
+    int bsp;
 
+    cpu_synchronize_state(s->cpu_env);
+
+    bsp = cpu_is_bsp(s->cpu_env);
     s->apicbase = 0xfee00000 |
         (bsp ? MSR_IA32_APICBASE_BSP : 0) | MSR_IA32_APICBASE_ENABLE;
 
@@ -952,8 +955,6 @@ static void apic_reset(void *opaque)
          */
         s->lvt[APIC_LVT_LINT0] = 0x700;
     }
-
-    cpu_synchronize_state(s->cpu_env, 1);
 }
 
 static CPUReadMemoryFunc * const apic_mem_read[3] = {