VirtualBox

Changeset 30078 in vbox


Ignore:
Timestamp:
Jun 7, 2010 2:41:10 PM (15 years ago)
Author:
vboxsync
Message:

VMM: Grumble! Reverted the wrong code before comitting.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/DBGFAddrSpace.cpp

    r29250 r30078  
    3939#define LOG_GROUP LOG_GROUP_DBGF
    4040#include <VBox/dbgf.h>
     41#include <VBox/pdmapi.h>
    4142#include <VBox/mm.h>
    4243#include "DBGFInternal.h"
     
    406407
    407408/**
     409 * @callback_method_impl{FNPDMR3ENUM}
     410 */
     411static DECLCALLBACK(int) dbgfR3AsLazyPopulateR0Callback(PVM pVM, const char *pszFilename, const char *pszName,
     412                                                        RTUINTPTR ImageBase, size_t cbImage, bool fRC, void *pvArg)
     413{
     414    /* Only ring-0 modules. */
     415    if (!fRC)
     416    {
     417        RTDBGMOD hDbgMod;
     418        int rc = RTDbgModCreateFromImage(&hDbgMod, pszFilename, pszName, 0 /*fFlags*/);
     419        if (RT_SUCCESS(rc))
     420        {
     421            rc = RTDbgAsModuleLink((RTDBGAS)pvArg, hDbgMod, ImageBase, 0 /*fFlags*/);
     422            if (RT_FAILURE(rc))
     423                LogRel(("DBGF: Failed to link module \"%s\" into DBGF_AS_R0 at %RTptr: %Rrc\n",
     424                        pszName, ImageBase, rc));
     425        }
     426        else
     427            LogRel(("DBGF: RTDbgModCreateFromImage failed with rc=%Rrc for module \"%s\" (%s)\n",
     428                    rc, pszName, pszFilename));
     429    }
     430    return VINF_SUCCESS;
     431}
     432
     433
     434/**
     435 * Lazily populates the specified address space.
     436 *
     437 * @param   pVM                 The VM handle.
     438 * @param   hAlias              The alias.
     439 */
     440static void dbgfR3AsLazyPopulate(PVM pVM, RTDBGAS hAlias)
     441{
     442    DBGF_AS_DB_LOCK_WRITE(pVM);
     443    uintptr_t iAlias = DBGF_AS_ALIAS_2_INDEX(hAlias);
     444    if (!pVM->dbgf.s.afAsAliasPopuplated[iAlias])
     445    {
     446        RTDBGAS hAs = pVM->dbgf.s.ahAsAliases[iAlias];
     447        if (hAlias == DBGF_AS_R0)
     448            PDMR3LdrEnumModules(pVM, dbgfR3AsLazyPopulateR0Callback, hAs);
     449        /** @todo what do we do about DBGF_AS_RC?  */
     450
     451        pVM->dbgf.s.afAsAliasPopuplated[iAlias] = true;
     452    }
     453    DBGF_AS_DB_UNLOCK_WRITE(pVM);
     454}
     455
     456
     457/**
    408458 * Resolves the address space handle into a real handle if it's an alias.
    409459 *
     
    447497        if (DBGF_AS_IS_FIXED_ALIAS(hAlias))
    448498        {
     499            /* Perform lazy address space population. */
     500            if (!pVM->dbgf.s.afAsAliasPopuplated[iAlias])
     501                dbgfR3AsLazyPopulate(pVM, hAlias);
     502
    449503            /* Won't ever change, no need to grab the lock. */
    450504            hAlias = pVM->dbgf.s.ahAsAliases[iAlias];
     
    927981            RTDbgModRelease(hMod);
    928982    }
    929     /* Temporary conversion. */
     983    /* Temporary conversions. */
    930984    else if (hDbgAs == DBGF_AS_GLOBAL)
    931985    {
     
    934988        if (RT_SUCCESS(rc))
    935989            dbgfR3AsSymbolConvert(pSymbol, &DbgfSym);
     990    }
     991    else if (hDbgAs == DBGF_AS_R0)
     992    {
     993        RTR0PTR     R0PtrMod;
     994        char        szNearSym[260];
     995        RTR0PTR     R0PtrNearSym;
     996        RTR0PTR     R0PtrNearSym2;
     997        rc = PDMR3LdrQueryR0ModFromPC(pVM, pAddress->FlatPtr,
     998                                      pSymbol->szName, sizeof(pSymbol->szName) / 2, &R0PtrMod,
     999                                      &szNearSym[0],   sizeof(szNearSym),           &R0PtrNearSym,
     1000                                      NULL,            0,                           &R0PtrNearSym2);
     1001        if (RT_SUCCESS(rc))
     1002        {
     1003            pSymbol->offSeg     = pSymbol->Value = R0PtrNearSym;
     1004            pSymbol->cb         = R0PtrNearSym2 > R0PtrNearSym ? R0PtrNearSym2 - R0PtrNearSym : 0;
     1005            pSymbol->iSeg       = 0;
     1006            pSymbol->fFlags     = 0;
     1007            pSymbol->iOrdinal   = UINT32_MAX;
     1008            size_t offName = strlen(pSymbol->szName);
     1009            pSymbol->szName[offName++] = '!';
     1010            size_t cchNearSym = strlen(szNearSym);
     1011            if (cchNearSym + offName >= sizeof(pSymbol->szName))
     1012                cchNearSym = sizeof(pSymbol->szName) - offName - 1;
     1013            strncpy(&pSymbol->szName[offName], szNearSym, cchNearSym);
     1014            pSymbol->szName[offName + cchNearSym] = '\0';
     1015            if (poffDisp)
     1016                *poffDisp = pAddress->FlatPtr - pSymbol->Value;
     1017        }
    9361018    }
    9371019
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r30072 r30078  
    12451245VMMDECL(int) PGMPhysGCPhys2CCPtr(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock)
    12461246{
    1247 #if !(defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)) // for provoking guru - DO NOT COMMIT THIS!
    12481247    int rc = pgmLock(pVM);
    12491248    AssertRCReturn(rc, rc);
    1250 #else
    1251     int rc;
    1252 #endif
    12531249
    12541250#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     
    13291325
    13301326#endif /* IN_RING3 || IN_RING0 */
    1331 #if !(defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)) // for provoking guru - DO NOT COMMIT THIS!
    13321327    pgmUnlock(pVM);
    1333 #endif
    13341328    return rc;
    13351329}
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