[vbox-dev] Accessing guest memory from the vBox host

Sander van Leeuwen sander.x.van.leeuwen at oracle.com
Thu Aug 26 12:13:30 GMT 2010

  On 8/19/2010 9:26 PM, Glenn Tremblay wrote:
> Sander -- thank you for the prompt response. My follow up is below.
> > Two options:
> > 1) create a virtual device that reads and writes from/to guest memory;
> > you can map guest memory into host memory, but that is generally 
> discouraged
> Our plans are to run a single guest per vbox instance -- so guest 
> security is not as much of an issue.
> I'd like to know what calls I would need to map (and nmap) a guest 
> [physical?] address into host address space?
The pfnPhysGCPhys2CCPtr(ReadOnly) PDM helper should be used to get the 
host virtual address of a guest physical page. If you just need the 
mapping to copy the contents,
then you can also use read/write functions for access GC virtual or 
physical memory.

> > 2) create a virtual device that maps an associated MMIO range into guest
> > memory (our VGA device does that)
> So the associated MMIO memory would be allocated by the host and 
> associated with the PCI device I create? And the guest would have to 
> copy its I/O buffer data to/from this region? With this approach there 
> is a lot of copy overhead. Due to our isolated environment I'd prefer 
> to temporarily map each guest I/O buffer (which is in our own 
> proprietary format) so the host can access it for the duration of the 
> I/O operation. Is this feasible? How expensive are the 
> mapping/unmapping operations?
They are fairly cheap. Especially on 64-bit hosts as we map the entire 
guest physical ram into the address space of the VM process. On 32-bit 
hosts you can trigger expensive mapping operations; not with the current 
releases, but with the next major release.

Kind regards / Mit freundlichen Gruessen / Met vriendelijke groet

Sander van Leeuwen | Senior Staff Engineer, VirtualBox
Oracle Virtualization

ORACLE Deutschland B.V. & Co. KG | Werkstrasse 24 | 71384 Weinstadt

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Rijnzathe 6, 3454PV De Meern, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20100826/67740607/attachment.html>

More information about the vbox-dev mailing list