[vbox-dev] Managing CR3 on guest O.S.

Knut St. Osmundsen knut.osmundsen at oracle.com
Sat Jul 23 19:59:48 GMT 2011


Hi Francesco.

On Jul 23, 2011, at 4:02 PM, Francesco Di Paolo wrote:

> Hello there,
> i'd like some hints in regards how the CR3 register is handled. From what i've learned, it seems that VirtualBox, everytime a guest O.S. try to write on CR3. generates a #GP and 
> uses a function EMInterpretCRxWrite() that calls emUpdateCRx() which modifies the VCpu. In particular, in regards to CR3, it sets the new value(with  CPUMSetGuestCR3 )and does a flush calling PGMFlushTLB() that remap the CR3 with the function MapCR3(). Now, i  think that VirtualBox has to do the setup of the new page table right? And, in order to catch all the exceptions, it has to write protect it or am i wrong?and if it is so,can anyone address me to the source code that does these??
> i would appreciate

We cache shadow paging structures. So, when the guest loads a new value into CR3 its very likely that it will be in our cache. The cache is called PGMPool. It will take care of monitoring the paging structures and keeping the shadow sufficiently up to date.

Missing entries in the shadow paging structures will mostly be synced over from the guest structures when a page fault occurs, i.e. when they normally would be loaded into the CPUs TLB.

-- 

Kind regards / Mit freundlichen Gruessen / Vennlig hilsen,
 bird

--

ORACLE Deutschland B.V. & Co. KG  Knut St. Osmundsen
Werkstrasse 24                    Senior Staff Engineer, VirtualBox
71384 Weinstadt, Germany          mailto:bird at sun.com

Hauptverwaltung: Riesstr. 25, D-80992 Muenchen
Registergericht: Amtsgericht Muenchen, HRA 95603

Komplementaerin: ORACLE Deutschland Verwaltung B.V.
Rijnzathe 6, 3454PV De Meern, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschaeftsfuehrer: J. Kunz, M. van de Molen, A. van der Ven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20110723/bae489e1/attachment.html>


More information about the vbox-dev mailing list