Shared memory between hypervisor and Baremetal VM #83
Replies: 3 comments 2 replies
-
Hey! My first question here is: do you want to map an already existing guest region in the hypervisor or allocate a new one? In case you just want to map an existing region, you can use the following function: vaddr_t mem_map_cpy(struct addr_space *ass, struct addr_space *asd, vaddr_t vas,
vaddr_t vad, size_t num_pages) It allows you to copy a mapping on the source address space The hypervisor currently makes use of this function in ...
vaddr_t dst_va = mem_map_cpy(&vm->as, &cpu()->as, vm->config->image.base_addr,
INVALID_VA, img_num_pages);
memcpy((void*)dst_va, (void*)src_va, vm->config->image.size);
.... As in other mapping functions in Bao, by passing Let me know if this helps. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the detailed and prompt response. Assuming the source is hypervisor and destination is Guest, does this work before the guest is initialized or after? How would the hypervisor decide a free virtual address available at Guest AS? Isn't guest supposed to tell which virtual addresses are available? |
Beta Was this translation helpful? Give feedback.
-
Bao keeps track of allocated pages in a "page pool" struct with a bitmap where each bit represents a page. There is a page pool for each of the memory regions present on the platform description struct. The colors assigned to a given address space are represented using a "colors" mask, where if a bit is set, that color is assigned to that address space. When allocating physical pages, if that address space is not assigned all available colors, the allocation falls back to the
Looking forward to see that! |
Beta Was this translation helpful? Give feedback.
-
Hi,
I was wondering how would one implement a shared memory region between hypervisor and VM?
I am basically trying to profile a few things with bao and baremetal VM and my code would work out quite well if I can share an object between hypervisor and Baremetal VM. Any suggestions would be helpful.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions