diff mbox

[2/2] vga: move back dirty_log functions to vga.c

Message ID a72ca10563d4c0a3f2ed0179029d0520e41ac1d6.1253521076.git.quintela@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Juan Quintela Sept. 21, 2009, 8:20 a.m. UTC
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/vga-pci.c |   43 -------------------------------------------
 hw/vga.c     |   43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 43 deletions(-)
diff mbox

Patch

diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index c49858c..9bb2d81 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -28,7 +28,6 @@ 
 #include "vga_int.h"
 #include "pixel_ops.h"
 #include "qemu-timer.h"
-#include "kvm.h"

 typedef struct PCIVGAState {
     PCIDevice dev;
@@ -59,48 +58,6 @@  static int pci_vga_load(QEMUFile *f, void *opaque, int version_id)
     return vga_common_load(f, &s->vga, version_id);
 }

-static int s1, s2;
-
-static void mark_dirty(target_phys_addr_t start, target_phys_addr_t len)
-{
-    target_phys_addr_t end = start + len;
-
-    while (start < end) {
-        cpu_physical_memory_set_dirty(cpu_get_physical_page_desc(start));
-        start += TARGET_PAGE_SIZE;
-    }
-}
-
-void vga_dirty_log_start(VGACommonState *s)
-{
-    if (kvm_enabled() && s->map_addr)
-        if (!s1) {
-            kvm_log_start(s->map_addr, s->map_end - s->map_addr);
-            mark_dirty(s->map_addr, s->map_end - s->map_addr);
-            s1 = 1;
-        }
-    if (kvm_enabled() && s->lfb_vram_mapped) {
-        if (!s2) {
-            kvm_log_start(isa_mem_base + 0xa0000, 0x8000);
-            kvm_log_start(isa_mem_base + 0xa8000, 0x8000);
-            mark_dirty(isa_mem_base + 0xa0000, 0x10000);
-        }
-        s2 = 1;
-    }
-}
-
-void vga_dirty_log_stop(VGACommonState *s)
-{
-    if (kvm_enabled() && s->map_addr && s1)
-        kvm_log_stop(s->map_addr, s->map_end - s->map_addr);
-
-    if (kvm_enabled() && s->lfb_vram_mapped && s2) {
-        kvm_log_stop(isa_mem_base + 0xa0000, 0x8000);
-        kvm_log_stop(isa_mem_base + 0xa8000, 0x8000);
-    }
-    s1 = s2 = 0;
-}
-
 static void vga_map(PCIDevice *pci_dev, int region_num,
                     uint32_t addr, uint32_t size, int type)
 {
diff --git a/hw/vga.c b/hw/vga.c
index df4c063..29a9f81 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -28,6 +28,7 @@ 
 #include "vga_int.h"
 #include "pixel_ops.h"
 #include "qemu-timer.h"
+#include "kvm.h"

 //#define DEBUG_VGA
 //#define DEBUG_VGA_MEM
@@ -1579,6 +1580,48 @@  static void vga_sync_dirty_bitmap(VGACommonState *s)
     vga_dirty_log_start(s);
 }

+static int s1, s2;
+
+static void mark_dirty(target_phys_addr_t start, target_phys_addr_t len)
+{
+    target_phys_addr_t end = start + len;
+
+    while (start < end) {
+        cpu_physical_memory_set_dirty(cpu_get_physical_page_desc(start));
+        start += TARGET_PAGE_SIZE;
+    }
+}
+
+void vga_dirty_log_start(VGACommonState *s)
+{
+    if (kvm_enabled() && s->map_addr)
+        if (!s1) {
+            kvm_log_start(s->map_addr, s->map_end - s->map_addr);
+            mark_dirty(s->map_addr, s->map_end - s->map_addr);
+            s1 = 1;
+        }
+    if (kvm_enabled() && s->lfb_vram_mapped) {
+        if (!s2) {
+            kvm_log_start(isa_mem_base + 0xa0000, 0x8000);
+            kvm_log_start(isa_mem_base + 0xa8000, 0x8000);
+            mark_dirty(isa_mem_base + 0xa0000, 0x10000);
+        }
+        s2 = 1;
+    }
+}
+
+void vga_dirty_log_stop(VGACommonState *s)
+{
+    if (kvm_enabled() && s->map_addr && s1)
+        kvm_log_stop(s->map_addr, s->map_end - s->map_addr);
+
+    if (kvm_enabled() && s->lfb_vram_mapped && s2) {
+        kvm_log_stop(isa_mem_base + 0xa0000, 0x8000);
+        kvm_log_stop(isa_mem_base + 0xa8000, 0x8000);
+    }
+    s1 = s2 = 0;
+}
+
 /*
  * graphic modes
  */