Mapping guest physical memory to host virtual memory
Posted: 15. Apr 2019, 08:40
Hi all,
I'm trying to implement a basic version of the virtio 1.0 standard which only supports PCI devices.
The implementation is based on the QEMU virtio implementation.
To achieve high efficiency it's necessary to map regions of the physical guest memory to virtual host memory to avoid copying data.
In QEMU, guest physical addresses can be mapped with cpu_physical_memory_map(). This allows any address range to be mapped to host memory.
The only equivalent functions I have found in VirtualBox (PDMDevHlpPhysGCPhys2CCPtr(), MMR3HyperMapGCPhys()) require the address to be page aligned.
It would be nice, if I don't have to deal with page alignment myself. Are there any functions I'm missing which allow any address range to be mapped from guest physical to host virtual memory?
Best,
matthias
I'm trying to implement a basic version of the virtio 1.0 standard which only supports PCI devices.
The implementation is based on the QEMU virtio implementation.
To achieve high efficiency it's necessary to map regions of the physical guest memory to virtual host memory to avoid copying data.
In QEMU, guest physical addresses can be mapped with cpu_physical_memory_map(). This allows any address range to be mapped to host memory.
The only equivalent functions I have found in VirtualBox (PDMDevHlpPhysGCPhys2CCPtr(), MMR3HyperMapGCPhys()) require the address to be page aligned.
It would be nice, if I don't have to deal with page alignment myself. Are there any functions I'm missing which allow any address range to be mapped from guest physical to host virtual memory?
Best,
matthias