All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
To: qemu-devel@nongnu.org
Cc: ohmura.kei@lab.ntt.co.jp, mtosatti@redhat.com, avi@redhat.com,
	Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Subject: [Qemu-devel] [PATCH 1/2] Introduce wrapper functions to access phys_ram_dirty.
Date: Tue, 23 Mar 2010 16:39:52 +0900	[thread overview]
Message-ID: <1269329993-10854-2-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> (raw)
In-Reply-To: <1269329993-10854-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp>

Adds wrapper functions to prevent direct access to the phys_ram_dirty bitmap.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
---
 cpu-all.h |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/cpu-all.h b/cpu-all.h
index 897cd44..54d8449 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -893,6 +893,11 @@ static inline int cpu_physical_memory_is_dirty(ram_addr_t addr)
     return phys_ram_dirty[addr >> TARGET_PAGE_BITS] == 0xff;
 }
 
+static inline int cpu_physical_memory_get_dirty_flags(ram_addr_t addr)
+{
+    return phys_ram_dirty[addr >> TARGET_PAGE_BITS];
+}
+
 static inline int cpu_physical_memory_get_dirty(ram_addr_t addr,
                                                 int dirty_flags)
 {
@@ -904,6 +909,26 @@ static inline void cpu_physical_memory_set_dirty(ram_addr_t addr)
     phys_ram_dirty[addr >> TARGET_PAGE_BITS] = 0xff;
 }
 
+static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr,
+                                                      int dirty_flags)
+{
+    return phys_ram_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags;
+}
+
+static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start,
+                                                        int length,
+                                                        int dirty_flags)
+{
+    int i, mask, len;
+    uint8_t *p;
+
+    len = length >> TARGET_PAGE_BITS;
+    mask = ~dirty_flags;
+    p = phys_ram_dirty + (start >> TARGET_PAGE_BITS);
+    for (i = 0; i < len; i++)
+        p[i] &= mask;
+}
+
 void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
                                      int dirty_flags);
 void cpu_tlb_update_dirty(CPUState *env);
-- 
1.7.0.31.g1df487

  reply	other threads:[~2010-03-23  7:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23  7:39 [Qemu-devel] [PATCH 0/2] Introduce wrapper functions to access phys_ram_dirty, and replace existing direct accesses to it Yoshiaki Tamura
2010-03-23  7:39 ` Yoshiaki Tamura [this message]
2010-03-23  7:39 ` [Qemu-devel] [PATCH 2/2] Replace direct phys_ram_dirty access with wrapper functions Yoshiaki Tamura
2010-03-23  9:00 ` [Qemu-devel] Re: [PATCH 0/2] Introduce wrapper functions to access phys_ram_dirty, and replace existing direct accesses to it Avi Kivity
2010-04-05 10:52   ` Yoshiaki Tamura
2010-04-08  9:59 ` [Qemu-devel] " Aurelien Jarno

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=1269329993-10854-2-git-send-email-tamura.yoshiaki@lab.ntt.co.jp \
    --to=tamura.yoshiaki@lab.ntt.co.jp \
    --cc=avi@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=ohmura.kei@lab.ntt.co.jp \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.