VirtualBox

Changeset 13235 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Oct 13, 2008 8:48:53 PM (16 years ago)
Author:
vboxsync
Message:

PGM: Merged PGMGCInvalidatePage into PGMInvalidatePage nad fixed the callers of it to handle the return codes correctly. other cleanup.

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

Legend:

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

    r13193 r13235  
    17861786     */
    17871787#ifdef IN_GC
    1788     // Note: we could also use PGMFlushPage here, but it currently doesn't always use invlpg!!!!!!!!!!
    1789     LogFlow(("GC: EMULATE: invlpg %08X\n", pAddrGC));
    1790     rc = PGMGCInvalidatePage(pVM, pAddrGC);
    1791 #else
     1788    LogFlow(("RC: EMULATE: invlpg %RGv\n", pAddrGC));
     1789#endif
    17921790    rc = PGMInvalidatePage(pVM, pAddrGC);
    1793 #endif
    1794     if (VBOX_SUCCESS(rc))
     1791    if (    rc == VINF_SUCCESS
     1792        ||  rc == VINF_PGM_SYNC_CR3 /* we can rely on the FF */)
    17951793        return VINF_SUCCESS;
    1796     Log(("PGMInvalidatePage %VGv returned %VGv (%d)\n", pAddrGC, rc, rc));
    1797     Assert(rc == VERR_REM_FLUSHED_PAGES_OVERFLOW);
    1798     /** @todo r=bird: we shouldn't ignore returns codes like this... I'm 99% sure the error is fatal. */
    1799     return VERR_EM_INTERPRETER;
     1794    AssertMsgReturn(   rc == VERR_REM_FLUSHED_PAGES_OVERFLOW
     1795                    || rc == VINF_EM_RAW_EMULATE_INSTR,
     1796                    ("%Rrc addr=%RGv\n", rc, pAddrGC),
     1797                    VERR_EM_INTERPRETER);
     1798    return rc;
    18001799}
    18011800
     
    18301829     */
    18311830#ifdef IN_GC
    1832     // Note: we could also use PGMFlushPage here, but it currently doesn't always use invlpg!!!!!!!!!!
    1833     LogFlow(("GC: EMULATE: invlpg %08X\n", addr));
    1834     rc = PGMGCInvalidatePage(pVM, addr);
    1835 #else
     1831    LogFlow(("RC: EMULATE: invlpg %RGv\n", addr));
     1832#endif
    18361833    rc = PGMInvalidatePage(pVM, addr);
    1837 #endif
    1838     if (VBOX_SUCCESS(rc))
     1834    if (    rc == VINF_SUCCESS
     1835        ||  rc == VINF_PGM_SYNC_CR3 /* we can rely on the FF */)
    18391836        return VINF_SUCCESS;
    1840     /** @todo r=bird: we shouldn't ignore returns codes like this... I'm 99% sure the error is fatal. */
    1841     return VERR_EM_INTERPRETER;
     1837    AssertMsgReturn(   rc == VERR_REM_FLUSHED_PAGES_OVERFLOW
     1838                    || rc == VINF_EM_RAW_EMULATE_INSTR,
     1839                    ("%Rrc addr=%RGv\n", rc, addr),
     1840                    VERR_EM_INTERPRETER);
     1841    return rc;
    18421842}
    18431843
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r13232 r13235  
    624624
    625625
    626 #ifndef IN_GC
    627626/**
    628627 * Emulation of the invlpg instruction (HC only actually).
    629628 *
    630  * @returns VBox status code.
     629 * @returns VBox status code, special care required.
     630 * @retval  VINF_PGM_SYNC_CR3 - handled.
     631 * @retval  VINF_EM_RAW_EMULATE_INSTR - not handled (RC only).
     632 * @retval  VERR_REM_FLUSHED_PAGES_OVERFLOW - not handled.
     633 *
    631634 * @param   pVM         VM handle.
    632635 * @param   GCPtrPage   Page to invalidate.
    633  * @remark  ASSUMES the page table entry or page directory is
    634  *          valid. Fairly safe, but there could be edge cases!
     636 *
     637 * @remark  ASSUMES the page table entry or page directory is valid. Fairly
     638 *          safe, but there could be edge cases!
     639 *
    635640 * @todo    Flush page or page directory only if necessary!
    636641 */
     
    638643{
    639644    int rc;
    640 
    641645    Log3(("PGMInvalidatePage: GCPtrPage=%VGv\n", GCPtrPage));
    642646
    643     /** @todo merge PGMGCInvalidatePage with this one */
    644 
    645 # ifndef IN_RING3
     647#ifndef IN_RING3
    646648    /*
    647649     * Notify the recompiler so it can record this instruction.
     
    649651     */
    650652    rc = REMNotifyInvalidatePage(pVM, GCPtrPage);
    651     if (VBOX_FAILURE(rc))
     653    if (rc != VINF_SUCCESS)
    652654        return rc;
    653 # endif
    654 
     655#endif /* !IN_RING3 */
     656
     657
     658#ifdef IN_GC
     659    /*
     660     * Check for conflicts and pending CR3 monitoring updates.
     661     */
     662    if (!pVM->pgm.s.fMappingsFixed)
     663    {
     664        if (    pgmGetMapping(pVM, GCPtrPage)
     665            &&  PGMGstGetPage(pVM, GCPtrPage, NULL, NULL) != VERR_PAGE_TABLE_NOT_PRESENT)
     666        {
     667            LogFlow(("PGMGCInvalidatePage: Conflict!\n"));
     668            VM_FF_SET(pVM, VM_FF_PGM_SYNC_CR3);
     669            STAM_COUNTER_INC(&pVM->pgm.s.StatRCInvlPgConflict);
     670            return VINF_PGM_SYNC_CR3;
     671        }
     672
     673        if (pVM->pgm.s.fSyncFlags & PGM_SYNC_MONITOR_CR3)
     674        {
     675            LogFlow(("PGMGCInvalidatePage: PGM_SYNC_MONITOR_CR3 -> reinterpret instruction in R3\n"));
     676            STAM_COUNTER_INC(&pVM->pgm.s.StatRCInvlPgSyncMonCR3);
     677            return VINF_EM_RAW_EMULATE_INSTR;
     678        }
     679    }
     680#endif /* IN_GC */
     681
     682    /*
     683     * Call paging mode specific worker.
     684     */
    655685    STAM_PROFILE_START(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage), a);
    656686    rc = PGM_BTH_PFN(InvalidatePage, pVM)(pVM, GCPtrPage);
    657687    STAM_PROFILE_STOP(&pVM->pgm.s.CTX_MID_Z(Stat,InvalidatePage), a);
    658688
    659 # ifndef IN_RING0
     689#ifdef IN_RING3
    660690    /*
    661691     * Check if we have a pending update of the CR3 monitoring.
     
    669699        rc = PGM_GST_PFN(MonitorCR3, pVM)(pVM, pVM->pgm.s.GCPhysCR3);
    670700    }
    671 # endif
    672 
    673 # ifdef IN_RING3
     701
    674702    /*
    675703     * Inform CSAM about the flush
    676      */
    677     /* note: This is to check if monitored pages have been changed; when we implement callbacks for virtual handlers, this is no longer required. */
     704     *
     705     * Note: This is to check if monitored pages have been changed; when we implement
     706     *       callbacks for virtual handlers, this is no longer required.
     707     */
    678708    CSAMR3FlushPage(pVM, GCPtrPage);
    679 # endif
     709#endif /* IN_RING3 */
    680710    return rc;
    681711}
    682 #endif /* !IN_GC */
    683712
    684713
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r13232 r13235  
    11101110                    && !(pPDEDst[iPD].u & PGM_PDFLAGS_MAPPING))
    11111111                {
    1112                 pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPDEDst[iPD].u & SHW_PDE_PG_MASK), SHW_POOL_ROOT_IDX, iPdpte * X86_PG_PAE_ENTRIES + iPD);
    1113                 pPDEDst[iPD].u = 0;
     1112                    pgmPoolFreeByPage(pPool, pgmPoolGetPage(pPool, pPDEDst[iPD].u & SHW_PDE_PG_MASK), SHW_POOL_ROOT_IDX, iPdpte * X86_PG_PAE_ENTRIES + iPD);
     1113                    pPDEDst[iPD].u = 0;
    11141114                }
    11151115            }
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