From patchwork Tue Mar 23 07:39:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshiaki Tamura X-Patchwork-Id: 48328 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0656AB7CE2 for ; Tue, 23 Mar 2010 19:09:07 +1100 (EST) Received: from localhost ([127.0.0.1]:35404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ntz72-0002U0-Bv for incoming@patchwork.ozlabs.org; Tue, 23 Mar 2010 04:05:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ntylk-0005X0-I2 for qemu-devel@nongnu.org; Tue, 23 Mar 2010 03:43:20 -0400 Received: from [199.232.76.173] (port=39600 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ntylj-0005WF-4Q for qemu-devel@nongnu.org; Tue, 23 Mar 2010 03:43:19 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Ntylf-0004j9-Mp for qemu-devel@nongnu.org; Tue, 23 Mar 2010 03:43:18 -0400 Received: from sh.osrg.net ([192.16.179.4]:35979) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ntyld-0004ia-OB for qemu-devel@nongnu.org; Tue, 23 Mar 2010 03:43:14 -0400 Received: from fs.osrg.net (postfix@fs.osrg.net [10.0.0.12]) by sh.osrg.net (8.14.3/8.14.3/OSRG-NET) with ESMTP id o2N7h1nr005861; Tue, 23 Mar 2010 16:43:02 +0900 Received: from localhost (hype-wd0.osrg.net [10.72.1.16]) by fs.osrg.net (Postfix) with ESMTP id BDFA73E02D5; Tue, 23 Mar 2010 16:43:01 +0900 (JST) From: Yoshiaki Tamura To: qemu-devel@nongnu.org Date: Tue, 23 Mar 2010 16:39:52 +0900 Message-Id: <1269329993-10854-2-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> X-Mailer: git-send-email 1.7.0.31.g1df487 In-Reply-To: <1269329993-10854-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> References: <1269329993-10854-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> X-Dispatcher: imput version 20070423(IM149) Lines: 54 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (sh.osrg.net [192.16.179.4]); Tue, 23 Mar 2010 16:43:03 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at sh X-Virus-Status: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: ohmura.kei@lab.ntt.co.jp, mtosatti@redhat.com, avi@redhat.com, Yoshiaki Tamura Subject: [Qemu-devel] [PATCH 1/2] Introduce wrapper functions to access phys_ram_dirty. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Adds wrapper functions to prevent direct access to the phys_ram_dirty bitmap. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- 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);