<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 8/19/2010 9:26 PM, Glenn Tremblay wrote:
    <blockquote
cite="mid:40B551BEDC7945419A5897958AB3947C0223ECD4@mtexch.marathontechnologies.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 12 (filtered
        medium)">
      <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">Sander
            – thank you for the prompt response. My follow up is below.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">>
            Two options:<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">>
            1) create a virtual device that reads and writes from/to
            guest memory; <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">>
            you can map guest memory into host memory, but that is
            generally discouraged<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">Our
            plans are to run a single guest per vbox instance – so guest
            security is
            not as much of an issue.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">I’d
            like to know what calls I would need to map (and nmap) a
            guest [physical?] address
            into host address space?</span></p>
      </div>
    </blockquote>
    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,<br>
    then you can also use read/write functions for access GC virtual or
    physical memory.<br>
    <br>
    <blockquote
cite="mid:40B551BEDC7945419A5897958AB3947C0223ECD4@mtexch.marathontechnologies.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">>
            2) create a virtual device that maps an associated MMIO
            range into guest <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">>
            memory (our VGA device does that)<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Courier New";">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?<o:p></o:p></span></p>
      </div>
    </blockquote>
    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.<br>
    <br>
    <br>
    <br>
    <div class="moz-signature">-- <br>
      Kind regards / Mit freundlichen Gruessen / Met vriendelijke groet<br>
      <br>
      --<br>
      Sander van Leeuwen | Senior Staff Engineer, VirtualBox<br>
      Oracle Virtualization<br>
      <br>
      ORACLE Deutschland B.V. & Co. KG | Werkstrasse 24 | 71384
      Weinstadt<br>
      <br>
      ORACLE Deutschland B.V. & Co. KG<br>
      Hauptverwaltung: Riesstr. 25, D-80992 München<br>
      Registergericht: Amtsgericht München, HRA 95603<br>
      <br>
      Komplementärin: ORACLE Deutschland Verwaltung B.V.<br>
      Rijnzathe 6, 3454PV De Meern, Niederlande<br>
      Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697<br>
      Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van
      der Ven<br>
    </div>
  </body>
</html>