This will sign extend pointers that have bit 31 set. Go through uintptr_t instead, so that the next conversion to uint64_t will zero-extend. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- api/dirty-log-perf.cc | 2 +- api/dirty-log.cc | 2 +- api/identity.cc | 4 ++-- api/kvmxx.cc | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/dirty-log-perf.cc b/api/dirty-log-perf.cc index 7f2488e..af0b27e 100644 --- a/api/dirty-log-perf.cc +++ b/api/dirty-log-perf.cc @@ -125,7 +125,7 @@ int main(int ac, char **av) printf("dirty-log-perf: Could not allocate guest memory.\n"); exit(1); } - uint64_t mem_addr = reinterpret_cast<uint64_t>(mem_head); + uint64_t mem_addr = reinterpret_cast<uintptr_t>(mem_head); identity::hole hole(mem_head, mem_size); identity::vm ident_vm(vm, memmap, hole); diff --git a/api/dirty-log.cc b/api/dirty-log.cc index 1e4ef9e..b65bed7 100644 --- a/api/dirty-log.cc +++ b/api/dirty-log.cc @@ -62,7 +62,7 @@ int main(int ac, char **av) bool running = true; int nr_fail = 0; mem_slot logged_slot(memmap, - reinterpret_cast<uint64_t>(logged_slot_virt), + reinterpret_cast<uintptr_t>(logged_slot_virt), 4096, logged_slot_virt); boost::thread host_poll_thread(check_dirty_log, ref(logged_slot), ref(running), diff --git a/api/identity.cc b/api/identity.cc index e04231b..f9e1830 100644 --- a/api/identity.cc +++ b/api/identity.cc @@ -18,7 +18,7 @@ hole::hole(void* address, size_t size) vm::vm(kvm::vm& vm, mem_map& mmap, hole h) { - uint64_t hole_gpa = reinterpret_cast<uint64_t>(h.address); + uint64_t hole_gpa = reinterpret_cast<uintptr_t>(h.address); char* hole_hva = static_cast<char*>(h.address); if (h.address) { _slots.push_back(mem_slot_ptr(new mem_slot(mmap, 0, hole_gpa, NULL))); @@ -51,7 +51,7 @@ void vcpu::setup_sregs() asm ("mov %%gs:0, %0" : "=r"(gsbase)); sregs.gs.base = gsbase; - sregs.tr.base = reinterpret_cast<ulong>(&*_stack.begin()); + sregs.tr.base = reinterpret_cast<uintptr_t>(&*_stack.begin()); sregs.tr.type = 11; sregs.tr.s = 0; sregs.tr.present = 1; diff --git a/api/kvmxx.cc b/api/kvmxx.cc index 7ebebb5..1df6f38 100644 --- a/api/kvmxx.cc +++ b/api/kvmxx.cc @@ -159,7 +159,7 @@ void vm::set_memory_region(int slot, void *addr, uint64_t gpa, size_t len, umr.flags = flags; umr.guest_phys_addr = gpa; umr.memory_size = len; - umr.userspace_addr = reinterpret_cast<uint64_t>(addr); + umr.userspace_addr = reinterpret_cast<uintptr_t>(addr); _fd.ioctlp(KVM_SET_USER_MEMORY_REGION, &umr); } -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html