VirtualBox

Changeset 37354 in vbox for trunk/include


Ignore:
Timestamp:
Jun 7, 2011 3:05:32 PM (14 years ago)
Author:
vboxsync
Message:

PGM: Fixed locking issues in PGMR3PhysMMIORegister and PGMR3PhysMMIODeregister. Also addressed a harmless on in PGMR3PhysRomRegister (only used at init time, so no races). Fortified the code with assertions more lock assertion, replacing the incorrect PGMIsLocked() checks (we only care if the current thread is the lock owner). Cleaned up some ReturnStmt macros and adding more of them.

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pgm.h

    r36891 r37354  
    286286
    287287
    288 VMMDECL(bool)           PGMIsLocked(PVM pVM);
    289288VMMDECL(bool)           PGMIsLockOwner(PVM pVM);
    290289
     
    367366VMMDECL(bool)       PGMPhysIsGCPhysNormal(PVM pVM, RTGCPHYS GCPhys);
    368367VMMDECL(int)        PGMPhysGCPtr2GCPhys(PVMCPU pVCpu, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
    369 VMMDECL(void)       PGMPhysInvalidatePageMapTLB(PVM pVM);
    370 VMMDECL(void)       PGMPhysInvalidatePageMapTLBEntry(PVM pVM, RTGCPHYS GCPhys);
    371368VMMDECL(void)       PGMPhysReleasePageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock);
    372369VMMDECL(int)        PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead);
     
    396393#endif
    397394
    398 VMMDECL(void) PGMSetLargePageUsage(PVM pVM, bool fUseLargePages);
     395VMMDECL(int)        PGMSetLargePageUsage(PVM pVM, bool fUseLargePages);
    399396
    400397/**
  • trunk/include/iprt/assert.h

    r36573 r37354  
    821821 * @param   expr    Expression which should be true.
    822822 * @param   a       printf argument list (in parenthesis).
    823  * @param   stmt    Statement to execute before break in case of a failed assertion.
     823 * @param   stmt    Statement to execute before returning in case of a failed
     824 *                  assertion.
    824825 * @param   rc      What is to be presented to return.
    825826 */
     
    991992 * statement and return a value.
    992993 *
    993  * @param stmt The statement to execute before returning.
    994  * @param rc   The value to return.
     994 * @param   stmt    The statement to execute before returning.
     995 * @param   rc      The value to return.
    995996 */
    996997#ifdef RT_STRICT
     
    13621363
    13631364/** @def AssertLogRelMsgReturnStmt
    1364  * Assert that an expression is true, execute \a stmt and return \a rc if it
     1365 * Assert that an expression is true, execute @a stmt and return @a rcRet if it
    13651366 * isn't.
    13661367 * Strict builds will hit a breakpoint, non-strict will only do LogRel.
     
    13681369 * @param   expr    Expression which should be true.
    13691370 * @param   a       printf argument list (in parenthesis).
    1370  * @param   rc      What is to be presented to return.
    1371  * @param   stmt    Statement to execute before return in case of a failed
     1371 * @param   stmt    Statement to execute before returning in case of a failed
    13721372 *                  assertion.
    1373  */
    1374 #define AssertLogRelMsgReturnStmt(expr, a, rc, stmt) \
     1373 * @param   rcRet   What is to be presented to return.
     1374 */
     1375#define AssertLogRelMsgReturnStmt(expr, a, stmt, rcRet) \
    13751376    do { \
    13761377        if (RT_UNLIKELY(!(expr))) \
     
    13801381            RTAssertPanic(); \
    13811382            stmt; \
    1382             return (rc); \
     1383            return (rcRet); \
    13831384        } \
    13841385    } while (0)
     
    15261527    } while (0)
    15271528
     1529/** @def AssertLogRelMsgFailedReturn
     1530 * An assertion failed, execute @a stmt and return @a rc.
     1531 * Strict builds will hit a breakpoint, non-strict will only do LogRel.
     1532 *
     1533 * @param   a       printf argument list (in parenthesis).
     1534 * @param   stmt    Statement to execute before returning in case of a failed
     1535 *                  assertion.
     1536 * @param   rc      What is to be presented to return.
     1537 */
     1538#define AssertLogRelMsgFailedReturnStmt(a, stmt, rc) \
     1539    do { \
     1540        RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
     1541        RTAssertLogRelMsg2(a); \
     1542        RTAssertPanic(); \
     1543        stmt; \
     1544        return (rc); \
     1545    } while (0)
     1546
    15281547/** @def AssertLogRelMsgFailedReturnVoid
    15291548 * An assertion failed, return void.
     
    15371556        RTAssertLogRelMsg2(a); \
    15381557        RTAssertPanic(); \
     1558        return; \
     1559    } while (0)
     1560
     1561/** @def AssertLogRelMsgFailedReturnVoid
     1562 * An assertion failed, execute @a stmt and return void.
     1563 * Strict builds will hit a breakpoint, non-strict will only do LogRel.
     1564 *
     1565 * @param   a       printf argument list (in parenthesis).
     1566 * @param   stmt    Statement to execute before returning in case of a failed
     1567 *                  assertion.
     1568 */
     1569#define AssertLogRelMsgFailedReturnVoidStmt(a, stmt) \
     1570    do { \
     1571        RTAssertLogRelMsg1((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
     1572        RTAssertLogRelMsg2(a); \
     1573        RTAssertPanic(); \
     1574        stmt; \
    15391575        return; \
    15401576    } while (0)
     
    19742010#define AssertRCReturn(rc, rcRet)   AssertMsgRCReturn(rc, ("%Rra\n", (rc)), rcRet)
    19752011
     2012/** @def AssertRCReturn
     2013 * Asserts a iprt status code successful, bitch (RT_STRICT mode only), execute
     2014 * @a stmt and returns @a rcRet if it isn't.
     2015 *
     2016 * @param   rc      iprt status code.
     2017 * @param   stmt    Statement to execute before returning in case of a failed
     2018 *                  assertion.
     2019 * @param   rcRet   What is to be presented to return.
     2020 * @remark  rc is referenced multiple times. In release mode is NOREF()'ed.
     2021 */
     2022#define AssertRCReturnStmt(rc, stmt, rcRet) AssertMsgRCReturnStmt(rc, ("%Rra\n", (rc)), stmt, rcRet)
     2023
    19762024/** @def AssertRCReturnVoid
    19772025 * Asserts a iprt status code successful, bitch (RT_STRICT mode only) and return if it isn't.
     
    20342082    do { AssertMsgReturn(RT_SUCCESS_NP(rc), msg, rcRet); NOREF(rc); } while (0)
    20352083
     2084/** @def AssertMsgRCReturnStmt
     2085 * Asserts a iprt status code successful and if it's not execute @a stmt and
     2086 * return the specified status code (@a rcRet).
     2087 *
     2088 * If RT_STRICT is defined the message will be printed and a breakpoint hit before it returns
     2089 *
     2090 * @param   rc      iprt status code.
     2091 * @param   msg     printf argument list (in parenthesis).
     2092 * @param   stmt    Statement to execute before returning in case of a failed
     2093 *                  assertion.
     2094 * @param   rcRet   What is to be presented to return.
     2095 * @remark  rc is referenced multiple times. In release mode is NOREF()'ed.
     2096 */
     2097#define AssertMsgRCReturnStmt(rc, msg, stmt, rcRet) \
     2098    do { AssertMsgReturnStmt(RT_SUCCESS_NP(rc), msg, stmt, rcRet); NOREF(rc); } while (0)
     2099
    20362100/** @def AssertMsgRCReturnVoid
    20372101 * Asserts a iprt status code successful and if it's not return.
     
    21512215 *
    21522216 * @param   rc      iprt status code.
    2153  * @param   rcRet   What is to be presented to return.
    21542217 * @param   stmt    Statement to execute before returning in case of a failed
    21552218 *                  assertion.
    2156  * @remark  rc is referenced multiple times.
    2157  */
    2158 #define AssertLogRelRCReturnStmt(rc, rcRet, stmt) AssertLogRelMsgRCReturnStmt(rc, ("%Rra\n", (rc)), rcRet, stmt)
     2219 * @param   rcRet   What is to be presented to return.
     2220 * @remark  rc is referenced multiple times.
     2221 */
     2222#define AssertLogRelRCReturnStmt(rc, stmt, rcRet) AssertLogRelMsgRCReturnStmt(rc, ("%Rra\n", (rc)), rcRet, stmt)
    21592223
    21602224/** @def AssertLogRelRCReturnVoid
     
    22082272 * @param   rc      iprt status code.
    22092273 * @param   msg     printf argument list (in parenthesis).
     2274 * @param   stmt    Statement to execute before returning in case of a failed
     2275 *                  assertion.
    22102276 * @param   rcRet   What is to be presented to return.
    2211  * @param   stmt    Statement to execute before break in case of a failed assertion.
    2212  * @remark  rc is referenced multiple times.
    2213  */
    2214 #define AssertLogRelMsgRCReturnStmt(rc, msg, rcRet, stmt) AssertLogRelMsgReturnStmt(RT_SUCCESS_NP(rc), msg, rcRet, stmt)
     2277 * @remark  rc is referenced multiple times.
     2278 */
     2279#define AssertLogRelMsgRCReturnStmt(rc, msg, stmt, rcRet) AssertLogRelMsgReturnStmt(RT_SUCCESS_NP(rc), msg, stmt, rcRet)
    22152280
    22162281/** @def AssertLogRelMsgRCReturnVoid
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