aboutsummaryrefslogtreecommitdiff
path: root/exec-obsolete.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-01-29 16:47:47 +0200
committerBlue Swirl <blauwirbel@gmail.com>2012-01-29 14:53:55 +0000
commitfd39941ac78fbe969e292eeb91415ec548bd97a6 (patch)
treec27d37ca6948f9b4f2f5abcde9234a16183e176d /exec-obsolete.h
parent9ec032d2aca18737f1ee0e8e37d06383928ec9a4 (diff)
downloadqemu-fd39941ac78fbe969e292eeb91415ec548bd97a6.zip
qemu-fd39941ac78fbe969e292eeb91415ec548bd97a6.tar.gz
qemu-fd39941ac78fbe969e292eeb91415ec548bd97a6.tar.bz2
Fix off-by-one in dirty bitmap functions
Reported-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'exec-obsolete.h')
-rw-r--r--exec-obsolete.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/exec-obsolete.h b/exec-obsolete.h
index 03cf35e..d2749d3 100644
--- a/exec-obsolete.h
+++ b/exec-obsolete.h
@@ -83,9 +83,10 @@ static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
uint8_t *p;
ram_addr_t addr, end;
- end = start + length;
+ end = TARGET_PAGE_ALIGN(start + length);
+ start &= TARGET_PAGE_MASK;
p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
- for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) {
+ for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
*p++ |= dirty_flags;
}
}
@@ -98,10 +99,11 @@ static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start,
uint8_t *p;
ram_addr_t addr, end;
- end = start + length;
+ end = TARGET_PAGE_ALIGN(start + length);
+ start &= TARGET_PAGE_MASK;
mask = ~dirty_flags;
p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
- for (addr = start; addr <= end; addr += TARGET_PAGE_SIZE) {
+ for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
*p++ &= mask;
}
}