From patchwork Wed Mar 17 05:51:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshiaki Tamura X-Patchwork-Id: 86261 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2H5tfXd008716 for ; Wed, 17 Mar 2010 05:55:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753037Ab0CQFzj (ORCPT ); Wed, 17 Mar 2010 01:55:39 -0400 Received: from sh.osrg.net ([192.16.179.4]:33501 "EHLO sh.osrg.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752892Ab0CQFzh (ORCPT ); Wed, 17 Mar 2010 01:55:37 -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 o2H5tCv4031954; Wed, 17 Mar 2010 14:55:13 +0900 Received: from localhost (hype-wd0.osrg.net [10.72.1.16]) by fs.osrg.net (Postfix) with ESMTP id DE9273E02D5; Wed, 17 Mar 2010 14:55:12 +0900 (JST) From: Yoshiaki Tamura To: kvm@vger.kernel.org, qemu-devel@nongnu.org Cc: avi@redhat.com, anthony@codemonkey.ws, ohmura.kei@lab.ntt.co.jp, Yoshiaki Tamura Subject: [PATCH 1/2] qemu-kvm: Introduce wrapper functions to access phys_ram_dirty. Date: Wed, 17 Mar 2010 14:51:47 +0900 Message-Id: <1268805108-27433-2-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> X-Mailer: git-send-email 1.7.0.31.g1df487 In-Reply-To: <1268805108-27433-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> References: <1268805108-27433-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> X-Dispatcher: imput version 20070423(IM149) Lines: 54 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 17 Mar 2010 05:55:42 +0000 (UTC) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (sh.osrg.net [192.16.179.4]); Wed, 17 Mar 2010 14:55:14 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at sh X-Virus-Status: Clean Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/cpu-all.h b/cpu-all.h index 9bc01b9..c279c0a 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -882,6 +882,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) { @@ -893,6 +898,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);