VirtualBox

Changeset 16045 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jan 19, 2009 4:27:59 PM (16 years ago)
Author:
vboxsync
Message:

PGMR3PhysTlbGCPhys2Ptr: Deal correctly with disabled access handlers. Ref #3399.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMInternal.h

    r15436 r16045  
    29072907
    29082908void            pgmR3HandlerPhysicalUpdateAll(PVM pVM);
     2909bool            pgmHandlerPhysicalIsAll(PVM pVM, RTGCPHYS GCPhys);
    29092910int             pgmHandlerVirtualFindByPhysAddr(PVM pVM, RTGCPHYS GCPhys, PPGMVIRTHANDLER *ppVirt, unsigned *piPage);
    29102911DECLCALLBACK(int) pgmHandlerVirtualResetOne(PAVLROGCPTRNODECORE pNode, void *pvUser);
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r15885 r16045  
    24632463                /* nothing */;
    24642464#endif
    2465             else if (PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage)) /* catches MMIO */
    2466                 rc = VERR_PGM_PHYS_TLB_CATCH_ALL;
    2467             else if (fWritable && PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage))
    2468                 rc = VINF_PGM_PHYS_TLB_CATCH_WRITE;
     2465            else if (PGM_PAGE_HAS_ANY_HANDLERS(pPage))
     2466            {
     2467                if (PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage)) /* catches MMIO */
     2468                    rc = VERR_PGM_PHYS_TLB_CATCH_ALL;
     2469                else if (fWritable && PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage))
     2470                    rc = VINF_PGM_PHYS_TLB_CATCH_WRITE;
     2471                else
     2472                {
     2473                    /* Temporariliy disabled phycial handler(s), since the recompiler
     2474                       doesn't get notified when it's reset we'll have to pretend its
     2475                       operating normally. */
     2476                    if (pgmHandlerPhysicalIsAll(pVM, GCPhys))
     2477                        rc = VERR_PGM_PHYS_TLB_CATCH_ALL;
     2478                    else
     2479                        rc = VINF_PGM_PHYS_TLB_CATCH_WRITE;
     2480                }
     2481            }
    24692482            else
    24702483                rc = VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp

    r15671 r16045  
    10651065    if (pCur)
    10661066    {
    1067         if (    GCPhys >= pCur->Core.Key
    1068             &&  GCPhys <= pCur->Core.KeyLast)
    1069         {
    1070             Assert(     pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE
    1071                    ||   pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL
    1072                    ||   pCur->enmType == PGMPHYSHANDLERTYPE_MMIO);
    1073             return true;
    1074         }
     1067        Assert(GCPhys >= pCur->Core.Key && GCPhys <= pCur->Core.KeyLast);
     1068        Assert(     pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE
     1069               ||   pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL
     1070               ||   pCur->enmType == PGMPHYSHANDLERTYPE_MMIO);
     1071        return true;
    10751072    }
    10761073
    10771074    return false;
     1075}
     1076
     1077
     1078/**
     1079 * Checks if it's an disabled all access handler or write access handler at the
     1080 * given address.
     1081 *
     1082 * @returns true if it's an all access handler, false if it's a write access
     1083 *          handler.
     1084 * @param   pVM         Pointer to the shared VM structure.
     1085 * @param   GCPhys      The address of the page with a disabled handler.
     1086 *
     1087 * @remarks The caller, PGMR3PhysTlbGCPhys2Ptr, must hold the PGM lock.
     1088 */
     1089bool pgmHandlerPhysicalIsAll(PVM pVM, RTGCPHYS GCPhys)
     1090{
     1091    PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     1092    AssertReturn(pCur, true);
     1093    Assert(     pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE
     1094           ||   pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL
     1095           ||   pCur->enmType == PGMPHYSHANDLERTYPE_MMIO); /* sanity */
     1096    /* Only whole pages can be disabled. */
     1097    Assert(   pCur->Core.Key     <= (GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK)
     1098           && pCur->Core.KeyLast >= (GCPhys | PAGE_OFFSET_MASK);
     1099    return pCur->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE;
    10781100}
    10791101
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