yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From c3347218d224591fe59debbf2006811b418f9070 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Tue, 14 Jan 2014 15:07:18 +0100
Subject: [PATCH 07/40] exec: create function to get a single dirty bit

RH-Author: Juan Quintela <quintela@redhat.com>
Message-id: <1389712071-23303-8-git-send-email-quintela@redhat.com>
Patchwork-id: 56663
O-Subject: [RHEL7 qemu-kvm PATCH 07/40] exec: create function to get a single dirty bit
Bugzilla: 997559
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
(cherry picked from commit 7e5609a85e3f35965af5e4c7b1480254642cf2dd)
Signed-off-by: Juan Quintela <quintela@trasno.org>
---
 exec.c                         | 2 +-
 include/exec/memory-internal.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 exec.c                         |    2 +-
 include/exec/memory-internal.h |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/exec.c b/exec.c
index 436dbe9..e993049 100644
--- a/exec.c
+++ b/exec.c
@@ -1482,7 +1482,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
 {
     int dirty_flags;
     dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);
-    if (!(dirty_flags & CODE_DIRTY_FLAG)) {
+    if (!cpu_physical_memory_get_dirty_flag(ram_addr, CODE_DIRTY_FLAG)) {
         tb_invalidate_phys_page_fast(ram_addr, size);
         dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);
     }
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
index 4f476d2..8872e36 100644
--- a/include/exec/memory-internal.h
+++ b/include/exec/memory-internal.h
@@ -58,6 +58,12 @@ static inline int cpu_physical_memory_get_dirty_flags(ram_addr_t addr)
     return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS];
 }
 
+static inline bool cpu_physical_memory_get_dirty_flag(ram_addr_t addr,
+                                                      int dirty_flag)
+{
+    return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] & dirty_flag;
+}
+
 /* read dirty bit (return 0 or 1) */
 static inline int cpu_physical_memory_is_dirty(ram_addr_t addr)
 {
-- 
1.7.1