VirtualBox

Changeset 70970 in vbox for trunk


Ignore:
Timestamp:
Feb 12, 2018 11:12:48 AM (7 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested Hw.virt: Flush TLB after switching modes if needed to prevent using CR3 with an old/previous paging mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp.h

    r70900 r70970  
    6161{
    6262    /*
     63     * Inform PGM about paging mode changes.
     64     * We include X86_CR0_PE because PGM doesn't handle paged-real mode yet,
     65     * see comment in iemMemPageTranslateAndCheckAccess().
     66     */
     67    int rc = PGMChangeMode(pVCpu, pCtx->cr0 | X86_CR0_PE, pCtx->cr4, pCtx->msrEFER);
     68#ifdef IN_RING3
     69    Assert(rc != VINF_PGM_CHANGE_MODE);
     70#endif
     71    AssertRCReturn(rc, rc);
     72
     73    /* Inform CPUM (recompiler), can later be removed. */
     74    CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_ALL);
     75
     76    /*
    6377     * Flush the TLB with new CR3. This is required in case the PGM mode change
    64      * below doesn't actually change anything.
     78     * above doesn't actually change anything.
    6579     */
    66     int rc = PGMFlushTLB(pVCpu, pCtx->cr3, true);
    67     if (RT_SUCCESS(rc))
    68     {
    69         /*
    70          * Inform PGM about paging mode changes.
    71          * We include X86_CR0_PE because PGM doesn't handle paged-real mode yet,
    72          * see comment in iemMemPageTranslateAndCheckAccess().
    73          */
    74         rc = PGMChangeMode(pVCpu, pCtx->cr0 | X86_CR0_PE, pCtx->cr4, pCtx->msrEFER);
    75 #ifdef IN_RING3
    76         Assert(rc != VINF_PGM_CHANGE_MODE);
    77 #endif
     80    if (rc == VINF_SUCCESS)
     81    {
     82        rc = PGMFlushTLB(pVCpu, pCtx->cr3, true);
    7883        AssertRCReturn(rc, rc);
    79 
    80         /* Inform CPUM (recompiler), can later be removed. */
    81         CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_ALL);
    82 
    83         /* Re-initialize IEM cache/state after the drastic mode switch. */
    84         iemReInitExec(pVCpu);
    85     }
     84    }
     85
     86    /* Re-initialize IEM cache/state after the drastic mode switch. */
     87    iemReInitExec(pVCpu);
    8688    return rc;
    8789}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette