VirtualBox

Changeset 107102 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Nov 22, 2024 7:57:01 AM (8 weeks ago)
Author:
vboxsync
Message:

ValidationKit/bootsectors: Implement BS3_ASSERT() to actually do something useful; bugref:9898; bugref:10658; jiraref:VBP-1207

Image size note: this increases image sizes (about +15KB total between
bs3-cpu-instr-{2,3,4}). I've committed changes to make all of the
ValidatonKit/bootsectors images still fit within their constraints.
Some further work may be warranted to either eliminate unneeded asserts;
or wrap them in runtime `if's to shrink and/or coalesce failure strings.

Performance note: completion times for bs3-cpu-instr-{2,3,4} with this
fully disabled vs. are within 2% of each other -- not significant.

Location:
trunk/src/VBox/ValidationKit/bootsectors/bs3kit
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk

    r106061 r107102  
    7373        bs3-cmn-A20Disable.asm \
    7474        bs3-cmn-A20Enable.asm \
     75        bs3-cmn-Assert.c \
    7576        bs3-cmn-GetCpuVendor.c \
    7677        bs3-cmn-GetModeName.c \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk

    r104071 r107102  
    5252$(call BS3KIT_FN_GEN_CMN_FARSTUB,bs3kit-common-16,Bs3SelFar32ToFlat32NoClobber,6)
    5353$(call BS3KIT_FN_GEN_CMN_FARSTUB,bs3kit-common-16,Bs3RegCtxSaveEx,8)
     54$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Assert)
    5455$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxSetAbridgedFtw)
    5556$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxSetMm)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h

    r105094 r107102  
    4141#define Bs3A20EnableViaKbd BS3_CMN_MANGLER(Bs3A20EnableViaKbd)
    4242#define Bs3A20EnableViaPortA BS3_CMN_MANGLER(Bs3A20EnableViaPortA)
     43#define Bs3Assert BS3_CMN_MANGLER(Bs3Assert)
    4344#define Bs3ExtCtxAlloc BS3_CMN_MANGLER(Bs3ExtCtxAlloc)
    4445#define Bs3ExtCtxCopy BS3_CMN_MANGLER(Bs3ExtCtxCopy)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h

    r105094 r107102  
    4141#undef Bs3A20EnableViaKbd
    4242#undef Bs3A20EnableViaPortA
     43#undef Bs3Assert
    4344#undef Bs3ExtCtxAlloc
    4445#undef Bs3ExtCtxCopy
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r106061 r107102  
    15841584 * Assert that an expression is true.
    15851585 *
    1586  * Calls Bs3Panic if false and it's a strict build.  Does nothing in
    1587  * non-strict builds.  */
    1588 #ifdef BS3_STRICT
    1589 # define BS3_ASSERT(a_Expr) do { if (!!(a_Expr)) { /* likely */ } else { Bs3Panic(); } } while (0) /**< @todo later */
     1586 * @param   a_Expr      The expression to assert.
     1587 *
     1588 * If the expression is false, prints a message and calls Bs3Panic.
     1589 *
     1590 * This can be controlled with two defines:
     1591 *
     1592 * - BS3_ASSERT_IGNORE disables it entirely.
     1593 *
     1594 * - BS3_ASSERT_FILE prints filenames rather than function names.  This
     1595 *   is disabled by default, as it consumes noticeably more image space.
     1596 *   Function name + line number are generally enough to find an issue.
     1597 *
     1598 * The expression string also consumes space.  If necessary, reduce that
     1599 * by using a simpler ASSERT() inside more a complicated `if'.
     1600 */
     1601BS3_CMN_PROTO_STUB(DECL_NO_RETURN(void), Bs3Assert,(const char BS3_FAR *pszExpr, const char BS3_FAR *pszFileOrFunc, const unsigned uLine));
     1602#define BS3_ASSERT_IGNORE
     1603#if defined(BS3_ASSERT_IGNORE)
     1604# define BS3_ASSERT(a_Expr) do { } while (0)
     1605#elif defined(BS3_ASSERT_FILE)
     1606# define BS3_ASSERT(a_Expr) do { if (!!(a_Expr)) { /* likely */ } else { Bs3Assert(#a_Expr, __FILE__, __LINE__); } } while (0)
    15901607#else
    1591 # define BS3_ASSERT(a_Expr) do { } while (0)
     1608# define BS3_ASSERT(a_Expr) do { if (!!(a_Expr)) { /* likely */ } else { Bs3Assert(#a_Expr, __func__, __LINE__); } } while (0)
    15921609#endif
    15931610
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