summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-07-29 10:24:02 +0300
committerAvi Kivity <avi@redhat.com>2009-07-29 10:24:02 +0300
commit50ab87121432e4e7f4bd2bebdb9115e2f94b8403 (patch)
tree6ab9d10eb90d32274562d17acac74a634819428d /kvm-all.c
parentMerge commit '9dfd7c7a00dd700de36ca58005a7cb3934a62efb' into upstream-merge (diff)
parentQEMU BOCHS bios patches to use maxcpus value. (diff)
downloadqemu-kvm-50ab87121432e4e7f4bd2bebdb9115e2f94b8403.tar.gz
qemu-kvm-50ab87121432e4e7f4bd2bebdb9115e2f94b8403.tar.bz2
qemu-kvm-50ab87121432e4e7f4bd2bebdb9115e2f94b8403.zip
Merge commit 'baef8a666c137fae513a195c8abeb80e1806d7bd' into upstream-merge
* commit 'baef8a666c137fae513a195c8abeb80e1806d7bd': QEMU BOCHS bios patches to use maxcpus value. Introduce -smp , maxcpus= flag to specify maximum number of CPUS. Use Little Endian for Dirty Log Use 64bit pointer for dirty log HPET fixes for reg writes slirp: Fix guestfwd for incoming data Conflicts: pc-bios/bios.bin (dropped) Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kvm-all.c b/kvm-all.c
index 3b610d779..f346162f1 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -305,6 +305,11 @@ int kvm_set_migration_log(int enable)
return 0;
}
+static int test_le_bit(unsigned long nr, unsigned char *addr)
+{
+ return (addr[nr >> 3] >> (nr & 7)) & 1;
+}
+
/**
* kvm_physical_sync_dirty_bitmap - Grab dirty bitmap from kernel space
* This function updates qemu's dirty bitmap using cpu_physical_memory_set_dirty().
@@ -358,12 +363,10 @@ int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
for (phys_addr = mem->start_addr, addr = mem->phys_offset;
phys_addr < mem->start_addr + mem->memory_size;
phys_addr += TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
- unsigned long *bitmap = (unsigned long *)d.dirty_bitmap;
+ unsigned char *bitmap = (unsigned char *)d.dirty_bitmap;
unsigned nr = (phys_addr - mem->start_addr) >> TARGET_PAGE_BITS;
- unsigned word = nr / (sizeof(*bitmap) * 8);
- unsigned bit = nr % (sizeof(*bitmap) * 8);
- if ((bitmap[word] >> bit) & 1) {
+ if (test_le_bit(nr, bitmap)) {
cpu_physical_memory_set_dirty(addr);
} else if (r < 0) {
/* When our KVM implementation doesn't know about dirty logging