VirtualBox

Changeset 14599 in vbox for trunk/src


Ignore:
Timestamp:
Nov 25, 2008 8:48:16 PM (16 years ago)
Author:
vboxsync
Message:

MMHyperR0ToY: Lookup on the actual R0 address instead of hacked R3.

File:
1 edited

Legend:

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

    r14597 r14599  
    4444DECLINLINE(PMMLOOKUPHYPER) mmHyperLookupR3(PVM pVM, RTR3PTR R3Ptr, uint32_t *poff)
    4545{
    46     /** @todo cache last lookup this stuff ain't cheap! */
     46    /** @todo cache last lookup, this stuff ain't cheap! */
    4747    PMMLOOKUPHYPER  pLookup = (PMMLOOKUPHYPER)((uint8_t *)pVM->mm.s.CTX_SUFF(pHyperHeap) + pVM->mm.s.offLookupHyper);
    4848    for (;;)
     
    8888    }
    8989
    90     AssertMsgFailed(("R3Ptr=%p is not inside the hypervisor memory area!\n", R3Ptr));
     90    AssertMsgFailed(("R3Ptr=%RHv is not inside the hypervisor memory area!\n", R3Ptr));
    9191    return NULL;
    9292}
     
    106106    AssertCompile(sizeof(RTR0PTR) == sizeof(RTR3PTR));
    107107
    108     /*
    109      * Translate Ring-0 VM addresses into Ring-3 VM addresses before feeding it to mmHyperLookupR3.
    110      */
    111     /** @todo fix this properly; the ring 0 pVM address differs from the R3 one. (#1865) */
    112     RTR0UINTPTR offVM = (RTR0UINTPTR)R0Ptr - (RTR0UINTPTR)pVM->pVMR0;
    113     RTR3PTR R3Ptr = offVM < sizeof(*pVM)
    114                   ? (RTR3PTR)((RTR3UINTPTR)pVM->pVMR3 + offVM)
    115                   : (RTR3PTR)R0Ptr;
    116 
    117     return mmHyperLookupR3(pVM, R3Ptr, poff);
     108    /** @todo cache last lookup, this stuff ain't cheap! */
     109    PMMLOOKUPHYPER  pLookup = (PMMLOOKUPHYPER)((uint8_t *)pVM->mm.s.CTX_SUFF(pHyperHeap) + pVM->mm.s.offLookupHyper);
     110    for (;;)
     111    {
     112        switch (pLookup->enmType)
     113        {
     114            case MMLOOKUPHYPERTYPE_LOCKED:
     115            {
     116                const uint32_t off = (RTR3UINTPTR)R0Ptr - (RTR0UINTPTR)pLookup->u.Locked.pvR0;
     117                if (off < pLookup->cb && pLookup->u.Locked.pvR0)
     118                {
     119                    *poff = off;
     120                    return pLookup;
     121                }
     122                break;
     123            }
     124
     125            case MMLOOKUPHYPERTYPE_HCPHYS:
     126            {
     127                const uint32_t off = (RTR0UINTPTR)R0Ptr - (RTR0UINTPTR)pLookup->u.HCPhys.pvR0;
     128                if (off < pLookup->cb && pLookup->u.HCPhys.pvR0)
     129                {
     130                    *poff = off;
     131                    return pLookup;
     132                }
     133                break;
     134            }
     135
     136            case MMLOOKUPHYPERTYPE_GCPHYS:  /* (for now we'll not allow these kind of conversions) */
     137            case MMLOOKUPHYPERTYPE_MMIO2:
     138            case MMLOOKUPHYPERTYPE_DYNAMIC:
     139                break;
     140
     141            default:
     142                AssertMsgFailed(("enmType=%d\n", pLookup->enmType));
     143                break;
     144        }
     145
     146        /* next */
     147        if (pLookup->offNext ==  (int32_t)NIL_OFFSET)
     148            break;
     149        pLookup = (PMMLOOKUPHYPER)((uint8_t *)pLookup + pLookup->offNext);
     150    }
     151
     152    AssertMsgFailed(("R0Ptr=%RHv is not inside the hypervisor memory area!\n", R0Ptr));
     153    return NULL;
    118154}
    119155
     
    157193    }
    158194
    159     AssertMsgFailed(("GCPtr=%p is not inside the hypervisor memory area!\n", RCPtr));
     195    AssertMsgFailed(("RCPtr=%RRv is not inside the hypervisor memory area!\n", RCPtr));
    160196    return NULL;
    161197}
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