<html><head><base href="x-msg://492/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Francesco.<div><br><div><div>On Jul 23, 2011, at 4:02 PM, Francesco Di Paolo wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div class="hmmessage" style="font-size: 10pt; font-family: Tahoma; "><div dir="ltr">Hello there,<br>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<span class="Apple-converted-space"> </span><br>uses a function<span class="Apple-converted-space"> </span><font color="#000000"><font face="FreeMono"><font size="2" style="font-size: 10pt; ">EMInterpretCRxWrite()<span class="Apple-converted-space"> </span><font face="Times New Roman">that calls<span class="Apple-converted-space"> </span></font></font></font></font><font color="#000000"><font face="FreeMono"><font size="2"><span lang="en-GB">emUpdateCRx</span></font></font></font><font color="#000000"><font size="2" style="font-size: 10pt; "><font face="FreeMono">()<span class="Apple-converted-space"> </span><font face="Times New Roman">which modifies</font></font></font></font><font color="#000000"><font face="FreeMono"><font size="2" style="font-size: 10pt; "><span class="Apple-converted-space"> </span><font face="Times New Roman">the VCpu. In particular, in regards to CR3, it sets the new value(with </font></font></font></font><span class="Apple-converted-space"> </span><font color="#000000"><font face="FreeMono, monospace"><font size="2" style="font-size: 10pt; ">CPUMSetGuestCR3</font></font></font><span class="Apple-converted-space"> </span><font color="#000000"><font face="FreeMono"><font size="2" style="font-size: 10pt; "><font face="Times New Roman">)and does a flush calling<span class="Apple-converted-space"> </span></font></font></font></font><font color="#000000"><font face="FreeMono, monospace"><font size="2" style="font-size: 10pt; ">PGMFlushTLB</font></font></font><font color="#000000"><font face="FreeMono"><font size="2" style="font-size: 10pt; ">()<font face="Times New Roman"><span class="Apple-converted-space"> </span>that remap the CR3 with the function<span class="Apple-converted-space"> </span></font></font></font></font><font color="#000000"><font size="2" style="font-size: 10pt; "><font face="FreeMono, monospace">MapCR3()</font></font></font><font color="#000000"><font face="FreeMono"><font size="2" style="font-size: 10pt; ">.<font face="Times New Roman"><span class="Apple-converted-space"> </span>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??</font></font></font></font><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0cm; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><font color="#000000"><font face="FreeMono"><font size="2" style="font-size: 10pt; "><font face="Times New Roman">i would appreciate</font></font></font></font></div></div></div></span></blockquote><br></div></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>-- <br><br>Kind regards / Mit freundlichen Gruessen / Vennlig hilsen,<br> bird<br><br>--<br><br>ORACLE Deutschland B.V. & Co. KG  Knut St. Osmundsen<br>Werkstrasse 24                    Senior Staff Engineer, VirtualBox<br>71384 Weinstadt, Germany          <a href="mailto:bird@sun.com">mailto:bird@sun.com</a><br><br>Hauptverwaltung: Riesstr. 25, D-80992 Muenchen<br>Registergericht: Amtsgericht Muenchen, HRA 95603<br><br>Komplementaerin: ORACLE Deutschland Verwaltung B.V.<br>Rijnzathe 6, 3454PV De Meern, Niederlande<br>Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697<br>Geschaeftsfuehrer: J. Kunz, M. van de Molen, A. van der Ven</div></div></div></span></span>
</div>
<br></body></html>