From f792ee6d096426909f440421758e908460c18f77 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Tue, 14 Jan 2014 15:07:47 +0100 Subject: [PATCH 36/40] kvm: refactor start address calculation RH-Author: Juan Quintela Message-id: <1389712071-23303-37-git-send-email-quintela@redhat.com> Patchwork-id: 56691 O-Subject: [RHEL7 qemu-kvm PATCH 36/40] kvm: refactor start address calculation Bugzilla: 997559 RH-Acked-by: Paolo Bonzini RH-Acked-by: Orit Wasserman RH-Acked-by: Dr. David Alan Gilbert (git) Signed-off-by: Juan Quintela Reviewed-by: Orit Wasserman (cherry picked from commit c9dd46fc0d64d9f314aa3c220d4aff9d01ab778e) Signed-off-by: Juan Quintela --- kvm-all.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Signed-off-by: Miroslav Rezanina --- kvm-all.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 8e2bd34..d3aa869 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -367,7 +367,8 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, { unsigned int i, j; unsigned long page_number, c; - hwaddr addr, addr1; + hwaddr addr; + ram_addr_t start = section->offset_within_region + section->mr->ram_addr; ram_addr_t ram_addr; unsigned int len = ((section->size / getpagesize()) + HOST_LONG_BITS - 1) / HOST_LONG_BITS; unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE; @@ -383,9 +384,8 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, j = ffsl(c) - 1; c &= ~(1ul << j); page_number = (i * HOST_LONG_BITS + j) * hpratio; - addr1 = page_number * TARGET_PAGE_SIZE; - addr = section->offset_within_region + addr1; - ram_addr = section->mr->ram_addr + addr; + addr = page_number * TARGET_PAGE_SIZE; + ram_addr = start + addr; cpu_physical_memory_set_dirty_range(ram_addr, TARGET_PAGE_SIZE * hpratio); } while (c != 0); -- 1.7.1