From patchwork Sun Jan 22 13:07:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 137236 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EA3551007D1 for ; Mon, 23 Jan 2012 00:07:39 +1100 (EST) Received: from localhost ([::1]:59254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rox8z-0002EK-OX for incoming@patchwork.ozlabs.org; Sun, 22 Jan 2012 08:07:37 -0500 Received: from eggs.gnu.org ([140.186.70.92]:43309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rox8t-0002EF-FT for qemu-devel@nongnu.org; Sun, 22 Jan 2012 08:07:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rox8s-0000sZ-JW for qemu-devel@nongnu.org; Sun, 22 Jan 2012 08:07:31 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:33505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rox8s-0000sU-Dx for qemu-devel@nongnu.org; Sun, 22 Jan 2012 08:07:30 -0500 Received: by iahk25 with SMTP id k25so817455iah.4 for ; Sun, 22 Jan 2012 05:07:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=72na8kP5KXhPno8qwJZeJxsmkEMh9cCsBd5Ys4DmVaA=; b=RqbDE2pHTkNhDcT/SR8KbtlgJgD5by8OyBLW7t7ErExVjmYrhKZvdQEaEZpYonyGks a1BhzwYFlZxvhAU4ICe3SSVvLDEwzVAzmqx4sGzngCooBA0PCAkXEsAZiaYIeSxVLuL/ 9jtxJZZRcAyx8zgHwTQOTcxCqjYqzfvC1H06k= Received: by 10.50.157.131 with SMTP id wm3mr5713898igb.13.1327237650156; Sun, 22 Jan 2012 05:07:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.193.229 with HTTP; Sun, 22 Jan 2012 05:07:09 -0800 (PST) From: Blue Swirl Date: Sun, 22 Jan 2012 13:07:09 +0000 Message-ID: To: Avi Kivity , qemu-devel X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [PATCH 1/3] memory: fix dirty mask function length handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fix handling of cases like start = 0xfff, length = 2. Change length to ram_addr_t to handle larger lengths. Signed-off-by: Blue Swirl --- exec-obsolete.h | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) From 41f0624d559ef63f1f3c97f4d4ecb3e310935eb9 Mon Sep 17 00:00:00 2001 Message-Id: <41f0624d559ef63f1f3c97f4d4ecb3e310935eb9.1327237042.git.blauwirbel@gmail.com> From: Blue Swirl Date: Sun, 22 Jan 2012 11:00:44 +0000 Subject: [PATCH 1/3] memory: fix dirty mask function length handling Fix handling of cases like start = 0xfff, length = 2. Change length to ram_addr_t to handle larger lengths. Signed-off-by: Blue Swirl --- exec-obsolete.h | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/exec-obsolete.h b/exec-obsolete.h index c412be9..22e0ba5 100644 --- a/exec-obsolete.h +++ b/exec-obsolete.h @@ -77,17 +77,18 @@ static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr, } static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start, - int length, + ram_addr_t length, int dirty_flags) { - int i, mask, len; + int mask; uint8_t *p; + ram_addr_t addr, end; - len = length >> TARGET_PAGE_BITS; + end = start + length; mask = ~dirty_flags; p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS); - for (i = 0; i < len; i++) { - p[i] &= mask; + for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) { + *p++ &= mask; } } -- 1.7.2.5