kvm: refactor start address calculation
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
This commit is contained in:
parent
747afd5bcd
commit
c9dd46fc0d
|
@ -382,7 +382,8 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned long page_number, c;
|
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;
|
ram_addr_t ram_addr;
|
||||||
unsigned int pages = int128_get64(section->size) / getpagesize();
|
unsigned int pages = int128_get64(section->size) / getpagesize();
|
||||||
unsigned int len = (pages + HOST_LONG_BITS - 1) / HOST_LONG_BITS;
|
unsigned int len = (pages + HOST_LONG_BITS - 1) / HOST_LONG_BITS;
|
||||||
|
@ -399,9 +400,8 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
|
||||||
j = ffsl(c) - 1;
|
j = ffsl(c) - 1;
|
||||||
c &= ~(1ul << j);
|
c &= ~(1ul << j);
|
||||||
page_number = (i * HOST_LONG_BITS + j) * hpratio;
|
page_number = (i * HOST_LONG_BITS + j) * hpratio;
|
||||||
addr1 = page_number * TARGET_PAGE_SIZE;
|
addr = page_number * TARGET_PAGE_SIZE;
|
||||||
addr = section->offset_within_region + addr1;
|
ram_addr = start + addr;
|
||||||
ram_addr = section->mr->ram_addr + addr;
|
|
||||||
cpu_physical_memory_set_dirty_range(ram_addr,
|
cpu_physical_memory_set_dirty_range(ram_addr,
|
||||||
TARGET_PAGE_SIZE * hpratio);
|
TARGET_PAGE_SIZE * hpratio);
|
||||||
} while (c != 0);
|
} while (c != 0);
|
||||||
|
|
Loading…
Reference in New Issue