VirtualBox

Changeset 73263 in vbox for trunk/src


Ignore:
Timestamp:
Jul 20, 2018 11:20:08 AM (7 years ago)
Author:
vboxsync
Message:

PGM,HM: Prepping for moving PGMR3ModeChange into ring-0... bugref:9044

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

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

    r73246 r73263  
    542542}
    543543
     544
     545/**
     546 * Notification callback which is called whenever there is a chance that a CR3
     547 * value might have changed.
     548 *
     549 * This is called by PGM.
     550 *
     551 * @param   pVCpu          The cross context virtual CPU structure.
     552 * @param   enmShadowMode  New shadow paging mode.
     553 * @param   enmGuestMode   New guest paging mode.
     554 */
     555VMM_INT_DECL(void) HMPagingModeChanged(PVMCPU pVCpu, PGMMODE enmShadowMode, PGMMODE enmGuestMode)
     556{
     557#ifdef IN_RING3
     558    /* Ignore page mode changes during state loading. */
     559    if (VMR3GetState(pVCpu->pVMR3) == VMSTATE_LOADING)
     560        return;
     561#endif
     562
     563    pVCpu->hm.s.enmShadowMode = enmShadowMode;
     564
     565    /*
     566     * If the guest left protected mode VMX execution, we'll have to be
     567     * extra careful if/when the guest switches back to protected mode.
     568     */
     569    if (enmGuestMode == PGMMODE_REAL)
     570        pVCpu->hm.s.vmx.fWasInRealMode = true;
     571
     572    Log4(("HMR3PagingModeChanged: Guest paging mode '%s', shadow paging mode '%s'\n", PGMGetModeName(enmGuestMode),
     573          PGMGetModeName(enmShadowMode)));
     574}
     575
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r73203 r73263  
    19191919
    19201920/**
    1921  * Notification callback which is called whenever there is a chance that a CR3
    1922  * value might have changed.
    1923  *
    1924  * This is called by PGM.
    1925  *
    1926  * @param   pVM            The cross context VM structure.
    1927  * @param   pVCpu          The cross context virtual CPU structure.
    1928  * @param   enmShadowMode  New shadow paging mode.
    1929  * @param   enmGuestMode   New guest paging mode.
    1930  */
    1931 VMMR3_INT_DECL(void) HMR3PagingModeChanged(PVM pVM, PVMCPU pVCpu, PGMMODE enmShadowMode, PGMMODE enmGuestMode)
    1932 {
    1933     RT_NOREF_PV(pVM);
    1934 
    1935     /* Ignore page mode changes during state loading. */
    1936     if (VMR3GetState(pVCpu->pVMR3) == VMSTATE_LOADING)
    1937         return;
    1938 
    1939     pVCpu->hm.s.enmShadowMode = enmShadowMode;
    1940 
    1941     /*
    1942      * If the guest left protected mode VMX execution, we'll have to be
    1943      * extra careful if/when the guest switches back to protected mode.
    1944      */
    1945     if (enmGuestMode == PGMMODE_REAL)
    1946         pVCpu->hm.s.vmx.fWasInRealMode = true;
    1947 
    1948     Log4(("HMR3PagingModeChanged: Guest paging mode '%s', shadow paging mode '%s'\n", PGMGetModeName(enmGuestMode),
    1949           PGMGetModeName(enmShadowMode)));
    1950 }
    1951 
    1952 
    1953 /**
    19541921 * Terminates the HM.
    19551922 *
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r73260 r73263  
    681681static FNVMATSTATE        pgmR3ResetNoMorePhysWritesFlag;
    682682#endif
    683 static PGMMODE            pgmR3CalcShadowMode(PVM pVM, PGMMODE enmGuestMode, SUPPAGINGMODE enmHostMode, PGMMODE enmShadowMode, VMMSWITCHER *penmSwitcher);
    684683
    685684#ifdef VBOX_WITH_DEBUGGER
     
    32683267 *                          VMMSWITCHER_INVALID means no change.
    32693268 */
    3270 static PGMMODE pgmR3CalcShadowMode(PVM pVM, PGMMODE enmGuestMode, SUPPAGINGMODE enmHostMode, PGMMODE enmShadowMode, VMMSWITCHER *penmSwitcher)
     3269static PGMMODE pgmCalcShadowMode(PVM pVM, PGMMODE enmGuestMode, SUPPAGINGMODE enmHostMode, PGMMODE enmShadowMode,
     3270                                 VMMSWITCHER *penmSwitcher)
    32713271{
    32723272    VMMSWITCHER enmSwitcher = VMMSWITCHER_INVALID;
     
    33013301                    enmShadowMode = PGMMODE_PAE;
    33023302                    enmSwitcher = VMMSWITCHER_PAE_TO_PAE;
    3303 #ifdef DEBUG_bird
    3304                     if (RTEnvExist("VBOX_32BIT"))
    3305                     {
    3306                         enmShadowMode = PGMMODE_32_BIT;
    3307                         enmSwitcher = VMMSWITCHER_PAE_TO_32;
    3308                     }
    3309 #endif
    33103303                    break;
    33113304
     
    33163309                    enmShadowMode = PGMMODE_PAE;
    33173310                    enmSwitcher = VMMSWITCHER_AMD64_TO_PAE;
    3318 #ifdef DEBUG_bird
    3319                     if (RTEnvExist("VBOX_32BIT"))
    3320                     {
    3321                         enmShadowMode = PGMMODE_32_BIT;
    3322                         enmSwitcher = VMMSWITCHER_AMD64_TO_32;
    3323                     }
    3324 #endif
    33253311                    break;
    33263312
    3327                 default: AssertMsgFailed(("enmHostMode=%d\n", enmHostMode)); break;
     3313                default:
     3314                    AssertLogRelMsgFailedReturnStmt(("enmHostMode=%d\n", enmHostMode),
     3315                                                    *penmSwitcher = VMMSWITCHER_INVALID, PGMMODE_INVALID);
    33283316            }
    33293317            break;
     
    33443332                    enmShadowMode = PGMMODE_PAE;
    33453333                    enmSwitcher = VMMSWITCHER_PAE_TO_PAE;
    3346 #ifdef DEBUG_bird
    3347                     if (RTEnvExist("VBOX_32BIT"))
    3348                     {
    3349                         enmShadowMode = PGMMODE_32_BIT;
    3350                         enmSwitcher = VMMSWITCHER_PAE_TO_32;
    3351                     }
    3352 #endif
    33533334                    break;
    33543335
     
    33593340                    enmShadowMode = PGMMODE_PAE;
    33603341                    enmSwitcher = VMMSWITCHER_AMD64_TO_PAE;
    3361 #ifdef DEBUG_bird
    3362                     if (RTEnvExist("VBOX_32BIT"))
    3363                     {
    3364                         enmShadowMode = PGMMODE_32_BIT;
    3365                         enmSwitcher = VMMSWITCHER_AMD64_TO_32;
    3366                     }
    3367 #endif
    33683342                    break;
    33693343
    3370                 default: AssertMsgFailed(("enmHostMode=%d\n", enmHostMode)); break;
     3344                default:
     3345                    AssertLogRelMsgFailedReturnStmt(("enmHostMode=%d\n", enmHostMode),
     3346                                                    *penmSwitcher = VMMSWITCHER_INVALID, PGMMODE_INVALID);
    33713347            }
    33723348            break;
     
    33983374                    break;
    33993375
    3400                 default: AssertMsgFailed(("enmHostMode=%d\n", enmHostMode)); break;
     3376                default:
     3377                    AssertLogRelMsgFailedReturnStmt(("enmHostMode=%d\n", enmHostMode),
     3378                                                    *penmSwitcher = VMMSWITCHER_INVALID, PGMMODE_INVALID);
    34013379            }
    34023380            break;
     
    34283406                    break;
    34293407
    3430                 default: AssertMsgFailed(("enmHostMode=%d\n", enmHostMode)); break;
     3408                default:
     3409                    AssertLogRelMsgFailedReturnStmt(("enmHostMode=%d\n", enmHostMode),
     3410                                                    *penmSwitcher = VMMSWITCHER_INVALID, PGMMODE_INVALID);
    34313411            }
    34323412            break;
    34333413
    3434 
    34353414        default:
    3436             AssertLogRelMsgFailed(("enmGuestMode=%d\n", enmGuestMode));
    3437             *penmSwitcher = VMMSWITCHER_INVALID;
    3438             return PGMMODE_INVALID;
     3415            AssertLogRelMsgFailedReturnStmt(("enmGuestMode=%d\n", enmGuestMode),
     3416                                            *penmSwitcher = VMMSWITCHER_INVALID, PGMMODE_INVALID);
    34393417    }
    34403418
     
    34863464#endif
    34873465                        default:
    3488                             AssertLogRelFailedReturn(PGMMODE_INVALID);
     3466                            AssertLogRelMsgFailedReturnStmt(("enmHostMode=%d\n", pVM->pgm.s.enmHostMode),
     3467                                                            *penmSwitcher = VMMSWITCHER_INVALID, PGMMODE_INVALID);
    34893468                    }
    34903469            }
     
    35193498    VMMSWITCHER enmSwitcher   = VMMSWITCHER_INVALID;
    35203499    PGMMODE     enmShadowMode = PGMMODE_INVALID;
    3521     enmShadowMode = pgmR3CalcShadowMode(pVM, enmGuestMode, pVM->pgm.s.enmHostMode, pVCpu->pgm.s.enmShadowMode, &enmSwitcher);
    3522 
    3523 #ifdef VBOX_WITH_RAW_MODE
     3500    enmShadowMode = pgmCalcShadowMode(pVM, enmGuestMode, pVM->pgm.s.enmHostMode, pVCpu->pgm.s.enmShadowMode, &enmSwitcher);
     3501
     3502#ifdef VBOX_WITH_RAW_MODE_NOT_R0
    35243503    if (   enmSwitcher != VMMSWITCHER_INVALID
    35253504        && VM_IS_RAW_MODE_ENABLED(pVM))
     
    36743653     * Notify HM.
    36753654     */
    3676     HMR3PagingModeChanged(pVM, pVCpu, pVCpu->pgm.s.enmShadowMode, pVCpu->pgm.s.enmGuestMode);
     3655    HMPagingModeChanged(pVCpu, pVCpu->pgm.s.enmShadowMode, pVCpu->pgm.s.enmGuestMode);
    36773656    return rc;
    36783657}
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