[vbox-dev] Translating different types of memory addresses in virtual box

mgofman1 at binghamton.edu mgofman1 at binghamton.edu
Sun Feb 14 16:49:47 GMT 2010


I analysed the return codes; they were either -1004
(PAGE_TABLE_NOT_FOUND) or -31 (PAGE_NOT_FOUND). I guess it was the addresses that I supplied.

I tried converting all virtual addresses from 0 to 10000000000 to physical and got valid conversions for many of them (while many others still returned error codes).  So I think the issue is as I said the addresses that I supplied.

So what I am trying to understand is the relationship between the VirtualBox virtual addresses and guest virtual addresses. I.e. suppose that in the guest I get the virtual address xxxx from proc file system or what not. Now, in the VirtualBox, if I use PGMPhysGCPtr2GCPhys function to convert address xxxx to physical, it should work, and the physical address should correspond to the actual guest physical address. So reading something from this physical address inside the guest or in VirtualBox should give the same result.

When I try to do the above, ie get the virtual address inside the guest from proc file system, and try to translate that address to physical in VirtualBox using PGMPhysGCPtr2GCPhys it gives me PAGE_TABLE_NOT_FOUND.  So it seems that there is not a one-to-one relationship between the virtual addresses which guest sees and what VirtualBox sees.

Is my understanding of the above correct? Or I am I doing something wrong?

Thanks.


On Sat, Feb 13, 2010 at 9:26 PM, Knut St. Osmundsen <bird at sun.com> wrote:
> On Feb 14, 2010, at 3:14 AM, mgofman1 at binghamton.edu wrote:
>
>> Thanks for the reply!
>>
>> I tried using PGMPhysGCPtr2GCPhys, but the returned value always seems to yield an error i.e. RT_SUCCESS(rc) never holds. I do not see what I am doing wrong.
>
> You might want to check which status code that is an try figure out why it happens.
>
>> Also, I tried using PGMR3DbgWriteGCPtr and I also have the same problem. Perhaps its because of the flags I am passing. Which flags should I pass to this function?
>>
>> Could you please provide a working example if possible on how to properly call these functions?
>
>
> PDMPhysGCPtr2GCPhys is used internally in the VMM in a few place (grep for them and the function their in).  It is also used indirectly by src/VBox/Devices/VMMDev/VMMDevHGCM.cpp in the guise of PDMDevHlpPhysGCPtr2GCPhys (line 266 here).
>
> --
>
> Kind regards / Mit freundlichen Gruessen / Vennlig hilsen,
>  Knut
>
> --
>
> Sun Microsystems GmbH        Knut St. Osmundsen
> Werkstrasse 24               Senior Staff Engineer, VirtualBox
> 71384 Weinstadt, Germany     mailto:bird at sun.com
>
> ==================================================
> Sitz der Gesellschaft: Sun Microsystems GmbH,
> Sonnenallee 1, D-85551 Kirchheim-Heimstetten
> Amtsgericht Muenchen: HRB 161028
> Gesch?ftsf?hrer: Thomas Schroeder, Wolfgang Engels
> Vorsitzender des Aufsichtsrates: Martin Haering
> ==================================================
>
>




More information about the vbox-dev mailing list