From: Avi Kivity <avi@xxxxxxxxxx> Unbreaks vga text mode after switching from graphics mode. Signed-off-by: Avi Kivity <avi@xxxxxxxxxx> Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx> diff --git a/qemu-kvm.c b/qemu-kvm.c index fab00ac..10e2caa 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -889,14 +889,15 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr, unsigned long phys_offset) { int r = 0; - unsigned long area_flags = phys_offset & ~TARGET_PAGE_MASK; + unsigned long area_flags; #ifdef TARGET_I386 struct mapping *p; #endif phys_offset &= ~IO_MEM_ROM; + area_flags = phys_offset & ~TARGET_PAGE_MASK; - if (area_flags == IO_MEM_UNASSIGNED) { + if (area_flags != IO_MEM_RAM) { #ifdef TARGET_I386 if (must_use_aliases_source(start_addr)) { kvm_destroy_memory_alias(kvm_context, start_addr); @@ -905,7 +906,19 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr, if (must_use_aliases_target(start_addr)) return; #endif - kvm_unregister_memory_area(kvm_context, start_addr, size); + while (size > 0) { + p = find_mapping(start_addr); + if (p) { + kvm_unregister_memory_area(kvm_context, p->phys, p->len); + drop_mapping(p->phys); + } + start_addr += TARGET_PAGE_SIZE; + if (size > TARGET_PAGE_SIZE) { + size -= TARGET_PAGE_SIZE; + } else { + size = 0; + } + } return; } -- 1.6.0.6 -- 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