So I promised to implement the mapping of user
memory as guest physical memory, but the kernel
module code seems to have changed a bit since I
last had a good look at it ;). It doesn't appear
to be as simple as I thought, because the current
code sort of assumes that all virtualised physical
memory is at the beginning of the address space.
Still, we really need to be able to map in memory
elsewhere as well, in order to eliminate unneccessary
data copying etc.
The data structures that are unsuitable for this
purpose appear to be (in include/monitor.h):
typedef struct
{
// requested size of the guest[] array in megs and pages
unsigned guest_n_megs;
unsigned guest_n_pages;
unsigned guest_n_bytes;
[...]
} vm_pages_t;
typedef struct
{
[...]
phy_page_usage_t page_usage[MON_GUEST_PAGES];
[...]
} vm_t;
[why isn't page_usage[] part of vm_pages_t?]
How do we solve the problem ? A solution would be to
replace the four above variables by a linked list, one
element for each physical memory region. Perhaps somebody
has a better solution though ?
Another glitch is that assumptions based on PLEX86_MAX_PHY_MEGS
may not be suitable anymore (for instance, in the size
of the page tables). Perhaps things like page tables should
be dynamically allocated...
What do you think ?
-- Ramon