VirtualBox

Changeset 26155 in vbox


Ignore:
Timestamp:
Feb 2, 2010 4:20:05 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57169
Message:

PDMLdr.cpp: Finished PDMR3LdrGetInterfaceSymbols.

File:
1 edited

Legend:

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

    r26151 r26155  
    12701270        while (pszCur)
    12711271        {
    1272             /* Find the end of the current symbol name. */
     1272            /*
     1273             * Find the end of the current symbol name.
     1274             */
    12731275            size_t      cchSym;
    12741276            const char *pszNext = strchr(pszCur, ';');
     
    12801282            else
    12811283                cchSym = strlen(pszCur);
    1282             AssertReturn(cchSym > 0, VERR_INVALID_PARAMETER);
    1283 
    1284             /* check for skip instructions */
     1284            AssertBreakStmt(cchSym > 0, rc = VERR_INVALID_PARAMETER);
     1285
     1286            /* Is it a skip instruction? */
    12851287            const char *pszColon = (const char *)memchr(pszCur, ':', cchSym);
    12861288            if (pszColon)
    12871289            {
     1290                /*
     1291                 * String switch on the instruction and execute it, checking
     1292                 * that we didn't overshoot the interface structure.
     1293                 */
    12881294#define IS_SKIP_INSTR(szInstr) \
    12891295                (   cchSkip == sizeof(szInstr) - 1 \
     
    13101316                    offInterface += sizeof(RTGCPHYS);
    13111317                else
    1312                     AssertMsgFailedReturn(("Invalid skip instruction %.*s (prefix=%s)\n", cchSym, pszCur, pszSymPrefix),
    1313                                           VERR_INVALID_PARAMETER);
    1314                 AssertMsgReturn(offInterface <= cbInterface,
    1315                                 ("off=%#x cb=%#x (sym=%.*s prefix=%s)\n", offInterface, cbInterface, cchSym, pszCur, pszSymPrefix),
    1316                                 VERR_BUFFER_OVERFLOW);
     1318                    AssertMsgFailedBreakStmt(("Invalid skip instruction %.*s (prefix=%s)\n", cchSym, pszCur, pszSymPrefix),
     1319                                             rc = VERR_INVALID_PARAMETER);
     1320                AssertMsgBreakStmt(offInterface <= cbInterface,
     1321                                   ("off=%#x cb=%#x (sym=%.*s prefix=%s)\n", offInterface, cbInterface, cchSym, pszCur, pszSymPrefix),
     1322                                   rc = VERR_BUFFER_OVERFLOW);
    13171323#undef IS_SKIP_INSTR
    13181324            }
    13191325            else
    13201326            {
     1327                /*
     1328                 * Construct the symbol name, get its value, store it and
     1329                 * advance the interface cursor.
     1330                 */
    13211331                AssertReturn(cchSymPrefix + cchSym >= sizeof(szSymbol), VERR_SYMBOL_NOT_FOUND);
    13221332                memcmp(&szSymbol[cchSymPrefix], pszCur, cchSym);
    13231333                szSymbol[cchSymPrefix + cchSym] = '\0';
    13241334
    1325 //                rc = resume coding here...
     1335                RTUINTPTR Value;
     1336                rc = RTLdrGetSymbolEx(pModule->hLdrMod, pModule->pvBits, pModule->ImageBase, szSymbol, &Value);
     1337                AssertMsgRCBreak(rc, ("Couldn't find symbol '%s' in module '%s'\n", szSymbol, pModule->szName));
     1338
     1339                if (fRing0OrRC)
     1340                {
     1341                    PRTR0PTR pValue = (PRTR0PTR)((uintptr_t)pvInterface + offInterface);
     1342                    AssertMsgBreakStmt(offInterface + sizeof(*pValue) <= cbInterface,
     1343                                       ("off=%#x cb=%#x sym=%s\n", offInterface, cbInterface, szSymbol),
     1344                                       rc = VERR_BUFFER_OVERFLOW);
     1345                    *pValue = (RTR0PTR)Value;
     1346                    Assert(*pValue == Value);
     1347                    offInterface += sizeof(*pValue);
     1348                }
     1349                else
     1350                {
     1351                    PRTRCPTR pValue = (PRTRCPTR)((uintptr_t)pvInterface + offInterface);
     1352                    AssertMsgBreakStmt(offInterface + sizeof(*pValue) <= cbInterface,
     1353                                       ("off=%#x cb=%#x sym=%s\n", offInterface, cbInterface, szSymbol),
     1354                                       rc = VERR_BUFFER_OVERFLOW);
     1355                    *pValue = (RTRCPTR)Value;
     1356                    Assert(*pValue == Value);
     1357                    offInterface += sizeof(*pValue);
     1358                }
    13261359            }
    13271360
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