Hi Ram,<br><br><div class="gmail_quote">On Wed, Jul 11, 2012 at 10:31 PM, Ramshankar <span dir="ltr"><<a href="mailto:ramshankar.venkataraman@oracle.com" target="_blank">ramshankar.venkataraman@oracle.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 12/07/12 04:47, Jaikumar G wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello folks,<br>
    So from the documentation for HGCM -<br>
<br>
A request is constructed in the guest physical memory, which must be<br>
locked by the guest. The physical address is passed to the VMM device<br>
using a 32 bit out edx, eax instruction.<br>
Can someone elaborate as to where in the code I can find as to how the<br>
physical address is passed to the VMM device ? Also how is the guest<br>
physical memory mapped to be accessed by the host ?<br>
</blockquote>
<br></div>
The guest physical memory is allocated and locked down in the guest using the guest additions. Take a look at VBoxGuestLib/GenericRequest.<u></u>cpp:VbglGRAlloc() and vbglPhysHeapChunkAlloc() which calls into IPRT's RTMemContAlloc() which is implemented for each supported platform which actually does the physical memory allocation and lock down, obviously this allocation is kept below the _4G range for port IO.<br>

<br>
See VBoxGuestLib/GenericRequest.<u></u>cpp: VbglGRPerform() The 32-bit physical address of the request is transferred using port IO of the VMM PCI device. The port address is initialized by the vboxguest PCI driver (take a look at callers of VBoxGuestInitDevExt() if interested).<br>

<br>
On the host side this translates as port IO which gets handled in Devices/VMMDev/VMMDEv.cpp:<u></u>vmmdevRequestHandler(). The devices accces memory via PDM, in this case PDMDevHlpPhysRead() reads the guest physical memory. The guest memory is allocated and locked down on the host and handled as RAM/ROM ranges with context based access handlers.</blockquote>
<div><br></div><div>Thanks that makes a lot of sense. </div><div><br></div><div>Regarding allocation of memory in guest space:</div><div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">"QEMU has a feature where it can translate a guest virtual address in user space directly into the corresponding physical/backing page in RAM without the need for allocating memory in Guest space."</span></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></span></div><div>Is is something that can be done in virtual box ? Is there any significant performance differences ?</div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br>
</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I looked around in the HGCM files in the both<br>
Additions/common/VBoxGuest* and in Devices/VMMDev but I was just going<br>
around in circles.<br>
</blockquote>
<br></div>
Devices/VMMDev/ is the place to look to see how these requests are handled on the host side.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Any pointers would be really appreciated.<br>
<br>
Thanks<br>
<br>
</blockquote>
<br></div>
Regards,<br>
Ram.<br>
<br>
</blockquote></div><br>