Hi, i've playing with libkvm.c and tried to make register_slot a bit more intelligent. The code in the repository always creates a new slot when register_slot is called but to give memory management more flexibility it could detect adjacent slots and merge them automatically. I attach a patch that illustrates what i want to do. With something like this implemented in kernel space too, memory management could be made much more flexible as memory holes could be created and modified on the run.
Sample scenario: 1) kvm_create_phys_mem creates a big memory chunk 2) kvm_create_mem_hole makes a hole that will redirect accesses to io emulation (starting at userspace address ADDR) 3) kvm_register_userspace_phys_ mem re-registers the hole as user memory by passing it a pointer to ADDR The patch will not work by its own without more changes, its just for illustrative purposes. Cheers !!!
libkvm.c.patch
Description: Binary data
