diff mbox

[1/3] memory: fix dirty mask function length handling

Message ID CAAu8pHsmQrM8-QiAiBvEiJE=F1O_A41hn4Ru0A3yDxjz-J5VYw@mail.gmail.com
State New
Headers show

Commit Message

Blue Swirl Jan. 22, 2012, 1:07 p.m. UTC
Fix handling of cases like start = 0xfff, length = 2.

Change length to ram_addr_t to handle larger lengths.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 exec-obsolete.h |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
diff mbox

Patch

From 41f0624d559ef63f1f3c97f4d4ecb3e310935eb9 Mon Sep 17 00:00:00 2001
Message-Id: <41f0624d559ef63f1f3c97f4d4ecb3e310935eb9.1327237042.git.blauwirbel@gmail.com>
From: Blue Swirl <blauwirbel@gmail.com>
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 <blauwirbel@gmail.com>
---
 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