VirtualBox

Ignore:
Timestamp:
Sep 1, 2017 3:32:33 PM (7 years ago)
Author:
vboxsync
Message:

bs3kit.h: Made Bs3StrFormatV work in small model 16-bit environment too. va_list is tricky in this context, because it's an C array and gets treated like a pointer when passed as an argument. so, it ended up being a near pointer even when -zu (SS!=DS) was enabled and crashed. Fix was to add BS3_FAR to the va_list arguments. Also, undefine IN_RING0 before forcibly defining it, since it is 1 when defined on the command line (e.g. for VBoxMouse) and causes a warning/error.

Location:
trunk/src/VBox/ValidationKit/bootsectors/bs3kit
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Printf.c

    r60527 r68604  
    6565
    6666#undef Bs3PrintfV
    67 BS3_CMN_DEF(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list va))
     67BS3_CMN_DEF(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va))
    6868{
    6969    BS3PRINTBUF Buf;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c

    r66464 r68604  
    7777} BS3FMTSTATE;
    7878/** Pointer to a BS3Kit string formatter state. */
    79 typedef BS3FMTSTATE *PBS3FMTSTATE;
     79typedef BS3FMTSTATE BS3_FAR *PBS3FMTSTATE;
    8080
    8181
     
    9898 * @param   cchNumber           The length of the number.
    9999 */
    100 static size_t bs3StrFormatNumberString(PBS3FMTSTATE pState, char const *pszNumber, size_t cchNumber)
     100static size_t bs3StrFormatNumberString(PBS3FMTSTATE pState, char const BS3_FAR *pszNumber, size_t cchNumber)
    101101{
    102102    /*
     
    225225
    226226    {
    227         const char *pachDigits = !(pState->fFlags & STR_F_CAPITAL) ? g_achBs3HexDigits : g_achBs3HexDigitsUpper;
    228         char       *psz = &pState->szTmp[BS3FMT_TMP_SIZE];
     227        const char BS3_FAR *pachDigits = !(pState->fFlags & STR_F_CAPITAL) ? g_achBs3HexDigits : g_achBs3HexDigitsUpper;
     228        char       BS3_FAR *psz = &pState->szTmp[BS3FMT_TMP_SIZE];
    229229
    230230        *--psz = '\0';
     
    263263{
    264264#if ARCH_BITS < 64
    265     const char *pachDigits = !(pState->fFlags & STR_F_CAPITAL) ? g_achBs3HexDigits : g_achBs3HexDigitsUpper;
    266     char       *psz = &pState->szTmp[BS3FMT_TMP_SIZE];
     265    const char BS3_FAR *pachDigits = !(pState->fFlags & STR_F_CAPITAL) ? g_achBs3HexDigits : g_achBs3HexDigitsUpper;
     266    char       BS3_FAR *psz = &pState->szTmp[BS3FMT_TMP_SIZE];
    267267
    268268    *--psz = '\0';
     
    305305    if (pState->uBase == 10)
    306306    {
    307         const char *pachDigits = !(pState->fFlags & STR_F_CAPITAL)
    308                                ? g_achBs3HexDigits : g_achBs3HexDigitsUpper;
    309         char       *psz = &pState->szTmp[BS3FMT_TMP_SIZE];
     307        const char BS3_FAR *pachDigits = !(pState->fFlags & STR_F_CAPITAL)
     308                                       ? g_achBs3HexDigits : g_achBs3HexDigitsUpper;
     309        char       BS3_FAR *psz = &pState->szTmp[BS3FMT_TMP_SIZE];
    310310
    311311        *--psz = '\0';
     
    362362
    363363#undef Bs3StrFormatV
    364 BS3_CMN_DEF(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list va,
     364BS3_CMN_DEF(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va,
    365365                                   PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser))
    366366{
     
    368368    size_t      cchRet = 0;
    369369    char        ch;
     370#if ARCH_BITS == 16
     371    typedef int SIZE_CHECK_TYPE1[sizeof(va) == 4 && sizeof(va[0]) == 4];
     372#endif
    370373
    371374    State.pfnOutput = pfnOutput;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrPrintf.c

    r62484 r68604  
    7474
    7575#undef Bs3StrPrintfV
    76 BS3_CMN_DEF(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, va_list va))
     76BS3_CMN_DEF(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, va_list BS3_FAR va))
    7777{
    7878    BS3STRPRINTFSTATE State;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestFailed.c

    r66117 r68604  
    9696 */
    9797#undef Bs3TestFailedV
    98 BS3_CMN_DEF(bool, Bs3TestFailedV,(const char *pszFormat, va_list va))
     98BS3_CMN_DEF(bool, Bs3TestFailedV,(const char *pszFormat, va_list BS3_FAR va))
    9999{
    100100    BS3TESTFAILEDBUF Buf;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestPrintf.c

    r64367 r68604  
    116116
    117117#undef Bs3TestPrintfV
    118 BS3_CMN_DEF(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list va))
     118BS3_CMN_DEF(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va))
    119119{
    120120    BS3TESTPRINTBUF Buf;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSkipped.c

    r60527 r68604  
    3838 */
    3939#undef Bs3TestSkippedV
    40 BS3_CMN_DEF(void, Bs3TestSkippedV,(const char *pszFormat, va_list va))
     40BS3_CMN_DEF(void, Bs3TestSkippedV,(const char *pszFormat, va_list BS3_FAR va))
    4141{
    4242    if (g_cusBs3TestErrors == g_cusBs3SubTestAtErrors)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSub.c

    r66115 r68604  
    3838 */
    3939#undef Bs3TestSubV
    40 BS3_CMN_DEF(void, Bs3TestSubV,(const char *pszFormat, va_list va))
     40BS3_CMN_DEF(void, Bs3TestSubV,(const char *pszFormat, va_list BS3_FAR va))
    4141{
    4242    size_t cch;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r66454 r68604  
    2929
    3030#ifndef DOXYGEN_RUNNING
     31# undef  IN_RING0
    3132# define IN_RING0
    3233#endif
     34
    3335#define RT_NO_STRICT            /* Don't drag in IPRT assertion code in inline code we may use (asm.h). */
    3436#include <iprt/cdefs.h>
    3537#include <iprt/types.h>
     38
    3639#ifndef DOXYGEN_RUNNING
    3740# undef  IN_RING0
     
    15601563 * @param   va              Format arguments.
    15611564 */
    1562 BS3_CMN_PROTO_STUB(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list va));
     1565BS3_CMN_PROTO_STUB(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va));
    15631566
    15641567/**
     
    16161619 * @param   pvUser      The user argument for the output function.
    16171620 */
    1618 BS3_CMN_PROTO_STUB(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list va,
     1621BS3_CMN_PROTO_STUB(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va,
    16191622                                          PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser));
    16201623
     
    16311634 * @param   va          Format arguments.
    16321635 */
    1633 BS3_CMN_PROTO_STUB(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va));
     1636BS3_CMN_PROTO_STUB(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list BS3_FAR va));
    16341637
    16351638/**
     
    31083111 * Equivalent to RTTestISubV.
    31093112 */
    3110 BS3_CMN_PROTO_STUB(void, Bs3TestSubV,(const char BS3_FAR *pszFormat, va_list va));
     3113BS3_CMN_PROTO_STUB(void, Bs3TestSubV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va));
    31113114
    31123115/**
     
    31343137 * @param   va          String format arguments.
    31353138 */
    3136 BS3_CMN_PROTO_STUB(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list va));
     3139BS3_CMN_PROTO_STUB(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va));
    31373140
    31383141/**
     
    31523155 * @returns false.
    31533156 */
    3154 BS3_CMN_PROTO_STUB(bool, Bs3TestFailedV,(const char BS3_FAR *pszFormat, va_list va));
     3157BS3_CMN_PROTO_STUB(bool, Bs3TestFailedV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va));
    31553158
    31563159/**
     
    31753178 * @param   va              Format arguments.
    31763179 */
    3177 BS3_CMN_PROTO_STUB(void, Bs3TestSkippedV,(const char BS3_FAR *pszFormat, va_list va));
     3180BS3_CMN_PROTO_STUB(void, Bs3TestSkippedV,(const char BS3_FAR *pszFormat, va_list BS3_FAR va));
    31783181
    31793182/**
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