[vbox-dev] Simple PCI device for shared memory
vbox at zavalon.com
Fri May 21 10:31:41 GMT 2010
On Wed, 2010-05-19 at 16:54 +0200, Knut St. Osmundsen wrote:
> Nev wrote:
> > 4. call PDMDevHlpMMIO2Register - to allocate Host R3 address space ?
> This allocates the actual physical memory as well as mapping it into the
> virtual address space of the VM process. Note that you do NOT specify
> any address to this API, but you get a memory pointer back from it. The
> guest will access the physical memory directly (via shadow page tables).
Thanks for info, But is there a more appropriate function? I have
searched and not been able to find one.
> > 5. call PDMDevHlpMMHyperMapMMIO2 - to allocate Guest address space ?
> This maps the memory into the hypervisor's raw-mode context. This is
> only necessary if there is alternative ways of accessing the memory from
> the guest (the only use case is the VGA port I/O IIRC).
OK. Have deleted.
My requirement for shared memory is to be able to share a block of
memory between multiple Host processes and multiple guest processes.
To the best of my knowledge this in not possible on a Linux host unless
the memory is allocated using one of the IPC shared memory API such as
Searching thur the VBox code, memory is allocated with "malloc" or one
of the alloc variants, or mmap with MAP_ANONYMOUS.
Is this true?
I think I can patch the code to use mmap with MAP_SHARED. My
understanding of the code is very limited and would appreciate any
suggestion on the following.
I believe PDMDevHlpMMHyperMapMMIO2 calls
pfnMIO2Register which will call
pdmR3DevHelp_MMIO2Register which will call
PGMR3PhysMMIO2Register which will call
SUPR3PageAllocEx which will call
suplibOsIOCtl which issues an ioctl call, a which point I could not find
the target of this call.
But I think if I force the code to call supPageALlocNoKernelFallback,
instead of suplibOsIOCtl, when shared memory is required for Ring 3, I
can then modify the mmap call in suplibOsPageAlloc to map a shared
Is this approach likely to be successful?
More information about the vbox-dev