VirtualBox

Changeset 60527 in vbox for trunk


Ignore:
Timestamp:
Apr 18, 2016 9:11:04 AM (9 years ago)
Author:
vboxsync
Message:

bs3kit: Far updates.

Location:
trunk/src/VBox/ValidationKit/bootsectors
Files:
6 added
2 deleted
96 edited
2 copied

Legend:

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

    r60439 r60527  
    7070endif
    7171
     72
     73##
     74# Macro for generating near-call aliases for zero or more 16-bit C functions.
     75# @param    1   The target name.
     76# @param    2   List of functions.
     77BS3KIT_FN_GEN_NEARSTUBS = $(foreach fn,$2,$(evalcall2 def_Bs3KitGenNearStubSource,$1,$(fn)))
     78define def_Bs3KitGenNearStubSource
     79$1_SOURCES += $$($1_0_OUTDIR)/near-call-to-$2_f16.asm
     80$1_CLEAN   += $$($1_0_OUTDIR)/near-call-to-$2_f16.asm
     81$$$$($1_0_OUTDIR)/near-call-to-$2_f16.asm: | $$$$(dir $$$$@)
     82        $(QUIET)$(APPEND) -tn $$@ \
     83                '%include "bs3kit.mac"' \
     84        'BS3_BEGIN_TEXT16' \
     85               '      extern  _$2_f16' \
     86        'BS3_BEGIN_TEXT16_NEARSTUBS' \
     87               'GROUP CGROUP16 BS3TEXT16 BS3TEXT16_NEARSTUBS' \
     88                'BS3_GLOBAL_NAME_EX _$2_c16, function, 6' \
     89               '      pop     ax' \
     90               '      push    cs' \
     91               '      push    ax' \
     92               '      jmp     _$2_f16 wrt CGROUP16'
     93endef
     94
     95
     96#
     97# Tools Tools Tools
     98# Tools Tools Tools
     99# Tools Tools Tools
     100#
    72101
    73102# Dummy CP "linker" tool.
     
    530559         clname $(BS3KIT_CLASS_CODE16) segaddr=0x1000 \
    531560          segment BS3TEXT16 \
     561          segment BS3TEXT16_NEARSTUBS \
     562         segment BS3TEXT16_FARSTUBS \
    532563          segment BS3TEXT16_END \
    533564        clname BS3SYSTEM16 segaddr=0x2000 \
     
    571602          segment BS3DATA64_BSS \
    572603          segment BS3DATA64_END \
     604        clname BS3CLASS16RMCODE \
     605          segment BS3RMCODE16_START \
     606          segment BS3RMCODE16 \
     607          segment BS3RMCODE16_END \
    573608        clname BS3CLASS32CODE \
     609          segment BS3TEXT32_START \
    574610          segment BS3TEXT32 \
     611          segment BS3TEXT32_END \
    575612        clname BS3CLASS64CODE \
    576           segment BS3TEXT64
     613          segment BS3TEXT64_START \
     614          segment BS3TEXT64 \
     615          segment BS3TEXT64_END
    577616
    578617TEMPLATE_VBoxBS3KitImg_LNK_DEPS = \
     
    705744          segment BS3TEXT16 \
    706745          segment _TEXT \
     746          segment BS3TEXT16_NEARSTUBS \
     747          segment BS3TEXT16_FARSTUBS \
    707748          segment BS3TEXT16_END \
    708749        clname BS3SYSTEM16  \
     
    764805          segment BS3DATA64_BSS \
    765806          segment BS3DATA64_END \
     807        clname BS3CLASS16RMCODE \
     808          segment BS3RMCODE16_START \
     809          segment BS3RMCODE16 \
     810          segment BS3RMCODE16_END \
    766811        clname BS3CLASS32CODE \
    767812          segment BS3TEXT32 \
     813          segment BS3TEXT32_END \
    768814        clname BS3CLASS64CODE \
    769           segment BS3TEXT64
     815          segment BS3TEXT64 \
     816          segment BS3TEXT64_END
    770817#        clname BS3FLAT segaddr=0x0000 \
    771818#          segment BS3FLAT segaddr=0x0000
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-c.c

    r60445 r60527  
    4949{
    5050    //BS3TESTMODEENTRY_MODE("tss / gate / esp", bs3CpuBasic2_TssGateEsp),
    51     //BS3TESTMODEENTRY_MODE("raise xcpt #1", bs3CpuBasic2_RaiseXcpt1),
     51    BS3TESTMODEENTRY_MODE("raise xcpt #1", bs3CpuBasic2_RaiseXcpt1),
    5252    //BS3TESTMODEENTRY_CMN("iret", bs3CpuBasic2_iret),
    53     //BS3TESTMODEENTRY_MODE("iret", bs3CpuBasic2_iret),
    54     BS3TESTMODEENTRY_MODE("sidt", bs3CpuBasic2_sidt),
     53//    BS3TESTMODEENTRY_MODE("iret", bs3CpuBasic2_iret),
     54//    BS3TESTMODEENTRY_MODE("sidt", bs3CpuBasic2_sidt),
    5555};
    5656
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c

    r60445 r60527  
    351351# if TMPL_BITS == 16
    352352    bool const      f386Plus = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386;
    353     bool const      f286     = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80286;
     353    bool const      f286     = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) == BS3CPU_80286;
    354354# else
    355355    bool const      f286     = false;
     
    15711571    g_f16BitSys   = BS3_MODE_IS_16BIT_SYS(TMPL_MODE);
    15721572
     1573    Bs3PrintStrN(RT_STR_TUPLE("Hello world!\n"));
     1574#if !BS3_MODE_IS_V86(TMPL_MODE)
     1575    Bs3TestPrintf(RT_STR_TUPLE("Hi there!\n"));
     1576#endif
    15731577    return BS3TESTDOMODE_SKIPPED;
    15741578}
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk

    r60485 r60527  
    6666        bs3-cmn-PrintStr.c \
    6767        bs3-cmn-PrintStrN.asm \
    68        bs3-cmn-PrintStrColonSpaces.asm \
    69        bs3-cmn-PrintStrSpacesColonSpace.c \
    7068       bs3-cmn-StrFormatV.c \
    7169       bs3-cmn-StrPrintf.c \
     
    124122        bs3-cmn-TestCheckRegCtxEx.c \
    125123        bs3-cmn-TestPrintf.c \
     124        bs3-cmn-TrapRmV86Init.c \
     125        bs3-cmn-TrapRmV86SetGate.c \
    126126        bs3-cmn-Trap16Init.c \
    127127        bs3-cmn-Trap16SetGate.c \
     
    151151       ../../../Runtime/common/asm/ASMSerializeInstruction-rdtscp.asm \
    152152
     153#
     154# We generate a list of files with 16-bit far functions for which we generate
     155# near jump stubs.
     156#
     157#$(PATH_OUT_OBJ)/bs3kit-common-16-near-to-far.kmk.ts \
     158#+| $(PATH_OUT_OBJ)/bs3kit-common-16-near-to-far.kmk: $(VBOX_PATH_BS3KIT_SRC)/bs3kit.h
     159#       $(SED) \
     160#               -n -e '/no-near-stub/d' \
     161#               -e 's/^ *BS3_DECL(.*)  *\([a-zA-Z][a-zA-Z0-9_]*\)(.*[;,][^;]*$/\1/p' \
     162#               --output $@ \
     163#               bs3kit.h
     164#       .$(CP_CHANGED) --changed -f -- $@ $(PATH_OUT_OBJ)/bs3kit-common-16-near-to-far.kmk
     165#include $(PATH)
     166
     167
    153168# The 16-bit BS3Kit library.
    154169LIBRARIES += bs3kit-common-16
     
    176191        bs3-wc16-U4D.asm \
    177192        bs3-wc16-I4D.asm \
    178        bs3-c16-Trap16Generic.asm
     193       bs3-c16-Trap16Generic.asm \
     194        bs3-c16-CreateHybridFarRet.asm
    179195bs3kit-common-16_bs3-cmn-UInt64Div.c_CFLAGS = -oh -d0 # -d1+ vs -d0 saves 0x6a3-0x577 = 0x12C (300)!
     196bs3kit-common-16_VBOX_NEAR_TO_FAR_FUNCTIONS := \
     197        $(sort $(subst bs3-cmn-,Bs3,$(basename $(filter-out \
     198                %Data.c \
     199                bs3-rm-% \
     200                bs3-cmn-hexdigits.c \
     201        ,$(filter %.c,$(bs3kit-common-16_SOURCES)))))) \
     202       Bs3PrintfV \
     203       Bs3StrPrintfV \
     204       Bs3TestPrintfV \
     205       Bs3TestFailedF \
     206       Bs3TestFailedV \
     207       Bs3TestSkippedF \
     208       Bs3TestSkippedV \
     209       Bs3TestSubF \
     210       Bs3TestSubV \
     211       Bs3Trap16InitEx
     212$(call BS3KIT_FN_GEN_NEARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_NEAR_TO_FAR_FUNCTIONS))
    180213
    181214# The 32-bit BS3Kit library.
     
    431464
    432465
     466#
     467# Rule for regenerating bs3kit-mangling-functions-undef.h.
     468#
     469bs3kit-mangling-code-undef.h: $(PATH_SUB_CURRENT)/bs3kit-mangling-code-define.h
     470        $(SED) \
     471                -e 's/#define \([a-zA-Z_][a-zA-Z0-9_]*\) .*$(DOLLAR)/#undef \1/' \
     472        -e 's/Function needing mangling\./Undefining function mangling - automatically generated by the $@ makefile rule./' \
     473        --output $(dir $<)bs3kit-mangling-code-undef.h \
     474                $<
     475
     476
    433477include $(FILE_KBUILD_SUB_FOOTER)
    434478
    435 .PRECIOUS: $(PATH_OBJ)/bs3-shutdown/bs3-shutdown.map
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp

    r60462 r60527  
    5656# define ELF_FMT_D64  "lld"
    5757#endif
     58
     59/** Compares an OMF string with a constant string. */
     60#define IS_OMF_STR_EQUAL_EX(a_cch1, a_pch1, a_szConst2) \
     61    ( (a_cch1) == sizeof(a_szConst2) - 1 && memcmp(a_pch1, a_szConst2, sizeof(a_szConst2) - 1) == 0 )
     62
     63/** Compares an OMF string with a constant string. */
     64#define IS_OMF_STR_EQUAL(a_pchZeroPrefixed, a_szConst2) \
     65    IS_OMF_STR_EQUAL_EX((uint8_t)((a_pchZeroPrefixed)[0]), &((a_pchZeroPrefixed)[1]), a_szConst2)
    5866
    5967
     
    35943602
    35953603/**
     3604 * Segment definition.
     3605 */
     3606typedef struct OMFSEGDEF
     3607{
     3608    uint32_t    cbSeg;
     3609    uint8_t     bSegAttr;
     3610    uint16_t    idxName;
     3611    uint16_t    idxClass;
     3612    uint16_t    idxOverlay;
     3613    uint8_t     cchName;
     3614    uint8_t     cchClass;
     3615    uint8_t     cchOverlay;
     3616    const char *pchName;
     3617    const char *pchClass;
     3618    const char *pchOverlay;
     3619    bool        fUse32;
     3620} OMFSEGDEF;
     3621typedef OMFSEGDEF *POMFSEGDEF;
     3622
     3623/**
     3624 * Group definition.
     3625 */
     3626typedef struct OMFGRPDEF
     3627{
     3628    const char *pchName;
     3629    uint16_t    idxName;
     3630    uint8_t     cchName;
     3631    uint16_t    cSegDefs;
     3632    uint16_t   *pidxSegDefs;
     3633} OMFGRPDEF;
     3634typedef OMFGRPDEF *POMFGRPDEF;
     3635
     3636/**
    35963637 * Records line number information for a file in a segment (for CV8 debug info).
    35973638 */
     
    36203661    /** The segment index. */
    36213662    uint16_t        idxSeg;
     3663    /** The group index for this segment.  This is zero if not yet determined and
     3664     * UINT16_MAX if no group applicable to this segment. */
     3665    uint16_t        idxGrp;
    36223666    /** File table. */
    36233667    POMFFILEINES    paFiles;
     
    36383682    /** Set if this module may need mangling. */
    36393683    bool            fMayNeedMangling;
    3640     /** Number of SEGDEFs records. */
    3641     uint32_t        cSegDefs;
     3684    /** Set if this module needs CGROUP16 for line number fixupes. */
     3685    bool            fNeedsCGroup16;
    36423686    /** The LNAME index of '$$SYMBOLS' or UINT16_MAX it not found. */
    36433687    uint16_t        iSymbolsNm;
     
    36463690    /** The '$$SYMBOLS' segment index. */
    36473691    uint16_t        iSymbolsSeg;
     3692    /** The LNAME index of 'CGROUP16' or UINT16_MAX it not found. */
     3693    uint16_t        iCGroup16Nm;
     3694    /** The 'CGROUP16' group definition index or UINT16_MAX it not found. */
     3695    uint16_t        iCGroup16Grp;
     3696
     3697    /** Number of SEGDEFs records. */
     3698    uint16_t        cSegDefs;
     3699    /** Number of GRPDEFs records. */
     3700    uint16_t        cGrpDefs;
     3701    /** Number of listed names. */
     3702    uint16_t        cLNames;
     3703
     3704    /** Segment defintions. */
     3705    POMFSEGDEF      paSegDefs;
     3706    /** Group defintions. */
     3707    POMFGRPDEF      paGrpDefs;
     3708    /** Name list.  Points to the size repfix. */
     3709    char          **papchLNames;
    36483710
    36493711    /** CV8: Filename string table size. */
     
    36673729typedef OMFDETAILS const *PCOMFDETAILS;
    36683730
     3731/** Grows a table to a given size (a_cNewEntries). */
     3732#define OMF_GROW_TABLE_EX_RET_ERR(a_EntryType, a_paTable, a_cEntries, a_cNewEntries) \
     3733    do\
     3734    { \
     3735        size_t cbOld = (a_cEntries) * sizeof(a_EntryType); \
     3736        size_t cbNew = (a_cNewEntries) * sizeof(a_EntryType); \
     3737        void  *pvNew = realloc(a_paTable, cbNew); \
     3738        if (pvNew) \
     3739        { \
     3740            memset((uint8_t *)pvNew + cbOld, 0, cbNew - cbOld); \
     3741            (a_paTable) = (a_EntryType *)pvNew; \
     3742        } \
     3743        else return error("???", "Out of memory!\n"); \
     3744    } while (0)
     3745
     3746/** Grows a table. */
     3747#define OMF_GROW_TABLE_RET_ERR(a_EntryType, a_paTable, a_cEntries, a_cEvery) \
     3748    if ((a_cEntries) % (a_cEvery) != 0) { /* likely */ } \
     3749    else do\
     3750    { \
     3751        size_t cbOld = (a_cEntries) * sizeof(a_EntryType); \
     3752        size_t cbNew = cbOld + (a_cEvery) * sizeof(a_EntryType); \
     3753        void  *pvNew = realloc(a_paTable, cbNew); \
     3754        if (pvNew) \
     3755        { \
     3756            memset((uint8_t *)pvNew + cbOld, 0, (a_cEvery) * sizeof(a_EntryType)); \
     3757            (a_paTable) = (a_EntryType *)pvNew; \
     3758        } \
     3759        else return error("???", "Out of memory!\n"); \
     3760    } while (0)
     3761
    36693762
    36703763/**
     
    37563849    if (idxSeg >= pOmfStuff->cSegLines)
    37573850    {
    3758         void *pvNew = realloc(pOmfStuff->paSegLines, (idxSeg + 1) * sizeof(pOmfStuff->paSegLines[0]));
    3759         if (!pvNew)
    3760             return error("???", "out of memory");
    3761         pOmfStuff->paSegLines = (POMFSEGLINES)pvNew;
    3762 
    3763         memset(&pOmfStuff->paSegLines[pOmfStuff->cSegLines], 0,
    3764                (idxSeg + 1 - pOmfStuff->cSegLines) * sizeof(pOmfStuff->paSegLines[0]));
     3851        OMF_GROW_TABLE_EX_RET_ERR(OMFSEGLINES, pOmfStuff->paSegLines, pOmfStuff->cSegLines, idxSeg + 1);
    37653852        for (uint32_t i = pOmfStuff->cSegLines; i <= idxSeg; i++)
    37663853        {
    37673854            pOmfStuff->paSegLines[i].idxSeg = i;
     3855            pOmfStuff->paSegLines[i].idxGrp = UINT16_MAX;
    37683856            pOmfStuff->paSegLines[i].cb = sizeof(RTCV8LINESHDR);
    37693857        }
     
    37863874    {
    37873875        i = pSegLines->cFiles;
    3788         if ((i % 4) == 0)
    3789         {
    3790             void *pvNew = realloc(pSegLines->paFiles, (i + 4) * sizeof(pSegLines->paFiles[0]));
    3791             if (!pvNew)
    3792                 return error("???", "out of memory");
    3793             pSegLines->paFiles = (POMFFILEINES)pvNew;
    3794         }
    3795 
     3876        OMF_GROW_TABLE_RET_ERR(OMFFILEINES, pSegLines->paFiles, pSegLines->cFiles, 4);
    37963877        pSegLines->cFiles = i + 1;
    37973878        pSegLines->cb    += sizeof(RTCV8LINESSRCMAP);
     
    38023883        pFileLines->cPairsAlloc = 0;
    38033884        pFileLines->paPairs     = NULL;
     3885
     3886        /*
     3887         * Check for segment group requirements the first time a segment is used.
     3888         */
     3889        if (i == 0)
     3890        {
     3891            if (idxSeg >= pOmfStuff->cSegDefs)
     3892                return error("???", "collectOmfAddLine: idxSeg=%#x is out of bounds (%#x)!\n", idxSeg, pOmfStuff->cSegDefs);
     3893            POMFSEGDEF pSegDef = &pOmfStuff->paSegDefs[idxSeg];
     3894            if (   IS_OMF_STR_EQUAL_EX(pSegDef->cchClass, pSegDef->pchClass, "BS3CLASS16CODE")
     3895                || IS_OMF_STR_EQUAL_EX(pSegDef->cchClass, pSegDef->pchClass, "CODE"))
     3896            {
     3897                pOmfStuff->fNeedsCGroup16 = true;
     3898                pSegLines->idxGrp = 0;  /* We'll replace zeros by the actual CGROUP16 index later. */
     3899            }
     3900        }
    38043901    }
    38053902
     
    38523949static bool collectOmfDetails(const char *pszFile, uint8_t const *pbFile, size_t cbFile, POMFDETAILS pOmfStuff)
    38533950{
    3854     uint32_t        cLNames = 0;
    38553951    uint32_t        cExtDefs = 0;
    38563952    uint32_t        cPubDefs = 0;
     
    38613957
    38623958    memset(pOmfStuff, 0, sizeof(*pOmfStuff));
    3863     pOmfStuff->iDebSymNm   = UINT16_MAX;
    3864     pOmfStuff->iSymbolsNm  = UINT16_MAX;
    3865     pOmfStuff->iSymbolsSeg = UINT16_MAX;
    3866 
     3959    pOmfStuff->iDebSymNm    = UINT16_MAX;
     3960    pOmfStuff->iSymbolsNm   = UINT16_MAX;
     3961    pOmfStuff->iSymbolsSeg  = UINT16_MAX;
     3962    pOmfStuff->iCGroup16Nm  = UINT16_MAX;
     3963    pOmfStuff->iCGroup16Grp = UINT16_MAX;
     3964
     3965    /* Dummy entries. */
     3966    OMF_GROW_TABLE_RET_ERR(char *, pOmfStuff->papchLNames, pOmfStuff->cLNames, 16);
     3967    pOmfStuff->papchLNames[0] = (char *)"";
     3968    pOmfStuff->cLNames = 1;
     3969
     3970    OMF_GROW_TABLE_RET_ERR(OMFSEGDEF, pOmfStuff->paSegDefs, pOmfStuff->cSegDefs, 16);
     3971    pOmfStuff->cSegDefs = 1;
     3972
     3973    OMF_GROW_TABLE_RET_ERR(OMFGRPDEF, pOmfStuff->paGrpDefs, pOmfStuff->cGrpDefs, 16);
     3974    pOmfStuff->cGrpDefs = 1;
     3975
     3976    /*
     3977     * Process the OMF records.
     3978     */
    38673979    while (off + 3 < cbFile)
    38683980    {
     
    38884000            } while (0)
    38894001
     4002#define OMF_READ_U16(a_u16, a_Name) \
     4003            do { \
     4004                OMF_CHECK_RET(4, a_Name); \
     4005                a_u16 = RT_MAKE_U16(pbRec[offRec], pbRec[offRec + 1]); \
     4006                offRec += 2; \
     4007            } while (0)
     4008#define OMF_READ_U32(a_u32, a_Name) \
     4009            do { \
     4010                OMF_CHECK_RET(4, a_Name); \
     4011                a_u32 = RT_MAKE_U32_FROM_U8(pbRec[offRec], pbRec[offRec + 1], pbRec[offRec + 2], pbRec[offRec + 3]); \
     4012                offRec += 4; \
     4013            } while (0)
     4014#define OMF_EXPLODE_LNAME(a_idxName, a_pchName, a_cchName, a_Name) \
     4015            do { \
     4016                if ((a_idxName) < pOmfStuff->cLNames) \
     4017                { \
     4018                    a_cchName = (uint8_t)*pOmfStuff->papchLNames[(a_idxName)]; \
     4019                    a_pchName = pOmfStuff->papchLNames[(a_idxName)] + 1; \
     4020                } \
     4021                else return error(pszFile, "Invalid LNAME reference %#x in " #a_Name "!\n", a_idxName); \
     4022            } while (0)
     4023
    38904024        switch (bRecType)
    38914025        {
     
    39014035                                     off, offRec, cch, (unsigned long)cbFile);
    39024036
    3903                     cLNames++;
    39044037                    if (g_cVerbose > 2)
    3905                         printf("  LNAME[%u]: %-*.*s\n", cLNames, cch, cch, &pbRec[offRec + 1]);
    3906 
    3907                     if (cch == 4 && memcmp(&pbRec[offRec + 1], "FLAT", 4) == 0)
     4038                        printf("  LNAME[%u]: %-*.*s\n", pOmfStuff->cLNames, cch, cch, &pbRec[offRec + 1]);
     4039
     4040                    OMF_GROW_TABLE_RET_ERR(char *, pOmfStuff->papchLNames, pOmfStuff->cLNames, 16);
     4041                    pOmfStuff->papchLNames[pOmfStuff->cLNames] = (char *)&pbRec[offRec];
     4042
     4043                    if (IS_OMF_STR_EQUAL_EX(cch, &pbRec[offRec + 1], "FLAT"))
    39084044                        pOmfStuff->fProbably32bit = true;
    39094045
    3910                     if (   cch == 6
    3911                         && pOmfStuff->iDebSymNm == UINT16_MAX
    3912                         && memcmp(&pbRec[offRec + 1], "DEBSYM", 6) == 0)
    3913                         pOmfStuff->iDebSymNm = cLNames;
    3914                     if (   cch == 9
    3915                         && pOmfStuff->iSymbolsNm == UINT16_MAX
    3916                         && memcmp(&pbRec[offRec + 1], "$$SYMBOLS", 9) == 0)
    3917                         pOmfStuff->iSymbolsNm = cLNames;
    3918 
     4046                    if (IS_OMF_STR_EQUAL_EX(cch, &pbRec[offRec + 1], "DEBSYM"))
     4047                        pOmfStuff->iDebSymNm = pOmfStuff->cLNames;
     4048                    if (IS_OMF_STR_EQUAL_EX(cch, &pbRec[offRec + 1], "$$SYMBOLS"))
     4049                        pOmfStuff->iSymbolsNm = pOmfStuff->cLNames;
     4050                    if (IS_OMF_STR_EQUAL_EX(cch, &pbRec[offRec + 1], "CGROUP16"))
     4051                        pOmfStuff->iCGroup16Nm = pOmfStuff->cLNames;
     4052
     4053                    pOmfStuff->cLNames++;
    39194054                    offRec += cch + 1;
    39204055                }
     
    39224057
    39234058            /*
    3924              * Display external defitions if -v is specified, also check if anything needs mangling.
     4059             * Display external definitions if -v is specified, also check if anything needs mangling.
    39254060             */
    39264061            case OMF_EXTDEF:
     
    40244159
    40254160            /*
    4026              * Must count segment defitions to figure the index of our segment.
     4161             * Must count segment definitions to figure the index of our segment.
    40274162             */
    40284163            case OMF_SEGDEF16:
    40294164            case OMF_SEGDEF32:
    4030                 pOmfStuff->cSegDefs++;
     4165            {
     4166                OMF_GROW_TABLE_RET_ERR(OMFSEGDEF, pOmfStuff->paSegDefs, pOmfStuff->cSegDefs, 16);
     4167                POMFSEGDEF pSegDef = &pOmfStuff->paSegDefs[pOmfStuff->cSegDefs++];
     4168
     4169                OMF_CHECK_RET(1 + (bRecType == OMF_SEGDEF16 ? 2 : 4) + 1 + 1 + 1, SEGDEF);
     4170                pSegDef->bSegAttr = pbRec[offRec++];
     4171                pSegDef->fUse32   = pSegDef->bSegAttr & 1;
     4172                if ((pSegDef->bSegAttr >> 5) == 0)
     4173                {
     4174                    /* A=0: skip frame number of offset. */
     4175                    OMF_CHECK_RET(3, SEGDEF);
     4176                    offRec += 3;
     4177                }
     4178                if (bRecType == OMF_SEGDEF16)
     4179                    OMF_READ_U16(pSegDef->cbSeg, SEGDEF16);
     4180                else
     4181                    OMF_READ_U32(pSegDef->cbSeg, SEGDEF32);
     4182                OMF_READ_IDX(pSegDef->idxName, SEGDEF);
     4183                OMF_READ_IDX(pSegDef->idxClass, SEGDEF);
     4184                OMF_READ_IDX(pSegDef->idxOverlay, SEGDEF);
     4185                OMF_EXPLODE_LNAME(pSegDef->idxName, pSegDef->pchName, pSegDef->cchName, SEGDEF);
     4186                OMF_EXPLODE_LNAME(pSegDef->idxClass, pSegDef->pchClass, pSegDef->cchClass, SEGDEF);
     4187                OMF_EXPLODE_LNAME(pSegDef->idxOverlay, pSegDef->pchOverlay, pSegDef->cchOverlay, SEGDEF);
    40314188                break;
     4189            }
     4190
     4191            /*
     4192             * Must count segment definitions to figure the index of our segment.
     4193             */
     4194            case OMF_GRPDEF:
     4195            {
     4196                OMF_GROW_TABLE_RET_ERR(OMFGRPDEF, pOmfStuff->paGrpDefs, pOmfStuff->cGrpDefs, 8);
     4197                POMFGRPDEF pGrpDef = &pOmfStuff->paGrpDefs[pOmfStuff->cGrpDefs];
     4198
     4199                OMF_READ_IDX(pGrpDef->idxName, GRPDEF);
     4200                OMF_EXPLODE_LNAME(pGrpDef->idxName, pGrpDef->pchName, pGrpDef->cchName, GRPDEF);
     4201                if (pGrpDef->idxName == pOmfStuff->iCGroup16Grp)
     4202                    pOmfStuff->iCGroup16Grp = pOmfStuff->cGrpDefs;
     4203
     4204                pGrpDef->cSegDefs    = 0;
     4205                pGrpDef->pidxSegDefs = NULL;
     4206                while (offRec + 2 + 1 < cbRec)
     4207                {
     4208                    if (pbRec[offRec] != 0xff)
     4209                        return error(pszFile, "Unsupported GRPDEF member type: %#x\n", pbRec[offRec]);
     4210                    offRec++;
     4211                    OMF_GROW_TABLE_RET_ERR(uint16_t, pGrpDef->pidxSegDefs, pGrpDef->cSegDefs, 16);
     4212                    OMF_READ_IDX(pGrpDef->pidxSegDefs[pGrpDef->cSegDefs], GRPDEF);
     4213                    pGrpDef->cSegDefs++;
     4214                }
     4215                pOmfStuff->cGrpDefs++;
     4216                break;
     4217            }
    40324218
    40334219            /*
     
    41494335
    41504336    /*
    4151      * Emit the segment defitions.
    4152      */
    4153     pOmfStuff->iSymbolsSeg = ++pOmfStuff->cSegDefs;
     4337     * Emit the segment definitions.
     4338     */
     4339    pOmfStuff->iSymbolsSeg = pOmfStuff->cSegDefs++;
    41544340
    41554341    uint8_t   bSegAttr = 0;
     
    41724358
    41734359/**
     4360 * Writes additional segment group definitions.
     4361 *
     4362 * @returns success indicator.
     4363 * @param   pThis       The OMF writer.
     4364 * @param   pOmfStuff   The OMF stuff with CV8 line number info.
     4365 */
     4366static bool convertOmfWriteDebugGrpDefs(POMFWRITER pThis, POMFDETAILS pOmfStuff)
     4367{
     4368    if (   pOmfStuff->cSegLines == 0
     4369        || !pOmfStuff->fNeedsCGroup16)
     4370        return true;
     4371
     4372    if (pOmfStuff->iCGroup16Grp == UINT16_MAX)
     4373    {
     4374        if (pOmfStuff->iCGroup16Nm == UINT16_MAX)
     4375            if (   !omfWriter_LNamesBegin(pThis, true)
     4376                || !omfWriter_LNamesAdd(pThis, "CGROUP16", &pOmfStuff->iCGroup16Nm)
     4377                || !omfWriter_LNamesEnd(pThis))
     4378                return false;
     4379
     4380        if (   !omfWriter_GrpDefBegin(pThis, pOmfStuff->iCGroup16Nm)
     4381            || !omfWriter_GrpDefEnd(pThis))
     4382            return false;
     4383        pOmfStuff->iCGroup16Grp = pOmfStuff->cGrpDefs;
     4384    }
     4385
     4386    for (unsigned i = 0; i < pOmfStuff->cSegLines; i++)
     4387        if (pOmfStuff->paSegLines[i].idxGrp == 0)
     4388            pOmfStuff->paSegLines[i].idxGrp = pOmfStuff->iCGroup16Grp;
     4389    return true;
     4390}
     4391
     4392
     4393/**
    41744394 * Writes the debug segment data.
    41754395 *
     
    42374457                return false;
    42384458
     4459            /* Default to the segment (BS3TEXT32, BS3TEXT64) or the group (CGROUP16,
     4460               RMGROUP16, etc).  The important thing is that we're framing the fixups
     4461               using a segment or group which ends up in the codeview segment map. */
     4462            uint16_t idxFrame = pSegLines->idxSeg;
     4463            uint8_t  bFrame   = OMF_FIX_F_SEGDEF;
     4464            if (pSegLines->idxGrp != UINT16_MAX)
     4465            {
     4466                idxFrame = pSegLines->idxGrp;
     4467                bFrame   = OMF_FIX_F_GRPDEF;
     4468            }
     4469
    42394470            /* Fixup #1: segment offset - IMAGE_REL_AMD64_SECREL. */
    42404471            if (!omfWriter_LEDataAddFixupNoDisp(pThis, 4 + 4 + RT_OFFSETOF(RTCV8LINESHDR, offSection), OMF_FIX_LOC_32BIT_OFFSET,
    4241                                                 OMF_FIX_F_SEGDEF, pSegLines->idxSeg,
    4242                                                 OMF_FIX_T_SEGDEF_NO_DISP, pSegLines->idxSeg))
     4472                                                bFrame, idxFrame, OMF_FIX_T_SEGDEF_NO_DISP, pSegLines->idxSeg))
    42434473                return false;
    42444474
     
    42464476            /* Fixup #2: segment number - IMAGE_REL_AMD64_SECTION. */
    42474477            if (!omfWriter_LEDataAddFixupNoDisp(pThis, 4 + 4 + RT_OFFSETOF(RTCV8LINESHDR, iSection), OMF_FIX_LOC_16BIT_SEGMENT,
    4248                                                 OMF_FIX_F_SEGDEF, pSegLines->idxSeg,
    4249                                                 OMF_FIX_T_SEGDEF_NO_DISP, pSegLines->idxSeg))
     4478                                                bFrame, idxFrame, OMF_FIX_T_SEGDEF_NO_DISP, pSegLines->idxSeg))
    42504479                return false;
    42514480
     
    43874616                    fSkip = pbRec[1] == OMF_CCLS_BORLAND_SRC_FILE;
    43884617                    if (pbRec[1] == OMF_CCLS_LINK_PASS_SEP)
    4389                         if (!convertOmfWriteDebugSegDefs(pThis, pOmfStuff))
     4618                        if (   !convertOmfWriteDebugSegDefs(pThis, pOmfStuff)
     4619                            || !convertOmfWriteDebugGrpDefs(pThis, pOmfStuff))
    43904620                            return false;
    43914621                }
     
    44204650                {
    44214651                    if (   convertOmfWriteDebugSegDefs(pThis, pOmfStuff)
     4652                        && convertOmfWriteDebugGrpDefs(pThis, pOmfStuff)
    44224653                        && convertOmfWriteDebugData(pThis, pOmfStuff))
    44234654                    { /* likely */ }
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/asmdefs-first.mac

    r58750 r60527  
    3434%include "bs3kit-template-header.mac"
    3535
     36;
    3637; Redefine some macros to suite us.
     38;
     39; We do near 16-bit code and produce far stubs separately as needed.
     40;
    3741%define BEGINCODE               TMPL_BEGIN_TEXT
    38 %define BEGINPROC_EXPORTED      BS3_PROC_BEGIN_CMN
     42%define BEGINPROC_EXPORTED      BS3_BEGINPROC_EXPORTED_WRAPPER
    3943%define ENDPROC                 BS3_PROC_END_CMN
    4044%undef  NAME
    4145%define NAME(a)                 BS3_CMN_NM(a)
    4246
     47%macro BS3_BEGINPROC_EXPORTED_WRAPPER 1
     48BS3_PROC_BEGIN_CMN %1, BS3_PBC_NEAR
     49%endmacro
     50
    4351%endif
    4452
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Disable.asm

    r59287 r60527  
    55
    66;
    7 ; Copyright (C) 2007-2015 Oracle Corporation
     7; Copyright (C) 2007-2016 Oracle Corporation
    88;
    99; This file is part of VirtualBox Open Source Edition (OSE), as
     
    3838; @uses     Nothing.
    3939;
    40 BS3_PROC_BEGIN_CMN Bs3A20Disable
     40BS3_PROC_BEGIN_CMN Bs3A20Disable, BS3_PBC_HYBRID_0_ARGS
    4141        ; Must call both because they may be ORed together on real HW.
    4242        BS3_ONLY_64BIT_STMT sub     rsp, 20h
     
    4444        call    BS3_CMN_NM(Bs3A20DisableViaPortA)
    4545        BS3_ONLY_64BIT_STMT add     rsp, 20h
    46         ret
     46        BS3_HYBRID_RET
    4747BS3_PROC_END_CMN   Bs3A20Disable
    4848
     
    5353; @uses     Nothing.
    5454;
    55 BS3_PROC_BEGIN_CMN Bs3A20DisableViaPortA
     55BS3_PROC_BEGIN_CMN Bs3A20DisableViaPortA, BS3_PBC_HYBRID_0_ARGS
    5656        push    xAX
    5757
     
    6565.done:
    6666        pop     xAX
    67         ret
     67        BS3_HYBRID_RET
    6868BS3_PROC_END_CMN   Bs3A20DisableViaPortA
    6969
     
    7474; @uses     Nothing.
    7575;
    76 BS3_PROC_BEGIN_CMN Bs3A20DisableViaKbd
     76BS3_PROC_BEGIN_CMN Bs3A20DisableViaKbd, BS3_PBC_HYBRID_0_ARGS
    7777        push    xBP
    7878        mov     xBP, xSP
     
    100100        popf
    101101        pop     xAX
    102         leave
    103         ret
     102        pop     xBP
     103        BS3_HYBRID_RET
    104104BS3_PROC_END_CMN   Bs3A20DisableViaKbd
    105105
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-A20Enable.asm

    r59287 r60527  
    3838; @uses     Nothing.
    3939;
    40 BS3_PROC_BEGIN_CMN Bs3A20Enable
     40BS3_PROC_BEGIN_CMN Bs3A20Enable, BS3_PBC_HYBRID_0_ARGS
    4141        push    xBP
    4242        mov     xBP, xSP
     
    4747;        call    TMPL_NM_CMN(Bs3A20EnableViaKbd)
    4848
    49         leave
    50         ret
     49        pop     xBP
     50        BS3_HYBRID_RET
    5151BS3_PROC_END_CMN   Bs3A20Enable
    5252
     
    5757; @uses     Nothing.
    5858;
    59 BS3_PROC_BEGIN_CMN Bs3A20EnableViaKbd
     59BS3_PROC_BEGIN_CMN Bs3A20EnableViaKbd, BS3_PBC_HYBRID_0_ARGS
    6060        push    xBP
    6161        mov     xBP, xSP
     
    8383        popf
    8484        pop     xAX
    85         leave
    86         ret
     85        pop     xBP
     86        BS3_HYBRID_RET
    8787BS3_PROC_END_CMN   Bs3A20EnableViaKbd
    8888
     
    9393; @uses     Nothing.
    9494;
    95 BS3_PROC_BEGIN_CMN Bs3A20EnableViaPortA
     95BS3_PROC_BEGIN_CMN Bs3A20EnableViaPortA, BS3_PBC_HYBRID_0_ARGS
    9696        push    xBP
    9797        mov     xBP, xSP
     
    107107.done:
    108108        pop     xAX
    109         leave
    110         ret
     109        pop     xBP
     110        BS3_HYBRID_RET
    111111BS3_PROC_END_CMN   Bs3A20EnableViaPortA
    112112
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm

    r59242 r60527  
    4343; @uses     cx, ss, esp
    4444;
    45 BS3_PROC_BEGIN_CMN Bs3ConvertRMStackToP16UsingCxReturnToAx
     45BS3_PROC_BEGIN_CMN Bs3ConvertRMStackToP16UsingCxReturnToAx, BS3_PBC_NEAR
    4646
    4747        ;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdRead.asm

    r59239 r60527  
    4040; @cproto   BS3_DECL(uint8_t) Bs3KbdRead_c16(uint8_t bCmd);
    4141;
    42 BS3_PROC_BEGIN_CMN Bs3KbdRead
     42BS3_PROC_BEGIN_CMN Bs3KbdRead, BS3_PBC_NEAR
    4343        push    xBP
    4444        mov     xBP, xSP
     
    5454        in      al, 60h                 ; Read the data.
    5555
    56         leave
    57         ret
     56        pop     xBP
     57        BS3_HYBRID_RET
    5858BS3_PROC_END_CMN   Bs3KbdRead
    5959
     60;
     61; We may be using the near code in some critical code paths, so don't
     62; penalize it.
     63;
     64BS3_CMN_FAR_STUB   Bs3KbdRead, 2
     65
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWait.asm

    r59239 r60527  
    3232; @cproto   BS3_DECL(void) Bs3KbdWait_c16(void);
    3333;
    34 BS3_PROC_BEGIN_CMN Bs3KbdWait
     34BS3_PROC_BEGIN_CMN Bs3KbdWait, BS3_PBC_HYBRID_0_ARGS
    3535        push    xBP
    3636        mov     xBP, xSP
     
    4545
    4646        pop     xAX
    47         leave
    48         ret
     47        pop     xBP
     48        BS3_HYBRID_RET
    4949
    5050.read_data_and_status:
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-KbdWrite.asm

    r59287 r60527  
    4545; @cproto   BS3_DECL(void) Bs3KbdWait_c16(uint8_t bCmd, uint8_t bData);
    4646;
    47 BS3_PROC_BEGIN_CMN Bs3KbdWrite
     47BS3_PROC_BEGIN_CMN Bs3KbdWrite, BS3_PBC_NEAR
    4848        push    xBP
    4949        mov     xBP, xSP
     
    6161        BS3_ONLY_64BIT_STMT add     rsp, 20h
    6262        pop     xAX
    63         leave
    64         ret
     63        pop     xBP
     64        BS3_HYBRID_RET
    6565BS3_PROC_END_CMN   Bs3KbdWrite
    6666
     67;
     68; We may be using the near code in some critical code paths, so don't
     69; penalize it.
     70;
     71BS3_CMN_FAR_STUB   Bs3KbdWrite, 4
     72
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAlloc.c

    r60311 r60527  
    3333
    3434
    35 BS3_DECL(void BS3_FAR *) Bs3MemAlloc(BS3MEMKIND enmKind, size_t cb)
     35#undef Bs3MemAlloc
     36BS3_CMN_DEF(void BS3_FAR *, Bs3MemAlloc,(BS3MEMKIND enmKind, size_t cb))
    3637{
    3738    void BS3_FAR   *pvRet;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAllocZ.c

    r59286 r60527  
    3232
    3333
    34 BS3_DECL(void BS3_FAR *) Bs3MemAllocZ(BS3MEMKIND enmKind, size_t cb)
     34#undef Bs3MemAllocZ
     35BS3_CMN_DEF(void BS3_FAR *, Bs3MemAllocZ,(BS3MEMKIND enmKind, size_t cb))
    3536{
    3637    void BS3_FAR *pvRet = Bs3MemAlloc(enmKind, cb);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemCpy.c

    r60088 r60527  
    2828
    2929#undef Bs3MemCpy
    30 BS3_DECL(void BS3_FAR *) BS3_CMN_NM(Bs3MemCpy)(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy)
     30BS3_CMN_DEF(void BS3_FAR *, Bs3MemCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy))
    3131{
    3232#if 1
     
    7474}
    7575
    76 
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemFree.c

    r60311 r60527  
    3232
    3333
    34 BS3_DECL(void) Bs3MemFree(void BS3_FAR *pv, size_t cb)
     34#undef Bs3MemFree
     35BS3_CMN_DEF(void, Bs3MemFree,(void BS3_FAR *pv, size_t cb))
    3536{
    3637    if (pv != NULL)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemMove.c

    r58667 r60527  
    2828
    2929#undef Bs3MemMove
    30 BS3_DECL(void BS3_FAR *) BS3_CMN_NM(Bs3MemMove)(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy)
     30BS3_CMN_DEF(void BS3_FAR *, Bs3MemMove,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy))
    3131{
    3232    size_t          cLargeRounds;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemPCpy.c

    r58667 r60527  
    2828
    2929#undef Bs3MemPCpy
    30 BS3_DECL(void BS3_FAR *) BS3_CMN_NM(Bs3MemPCpy)(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy)
     30BS3_CMN_DEF(void BS3_FAR *, Bs3MemPCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy))
    3131{
    3232    size_t          cLargeRounds;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemZero.asm

    r60366 r60527  
    3030; @cproto   BS3_DECL(void) Bs3MemZero_c16(void BS3_FAR *pvDst, size_t cbDst);
    3131;
    32 BS3_PROC_BEGIN_CMN Bs3MemZero
     32BS3_PROC_BEGIN_CMN Bs3MemZero, BS3_PBC_HYBRID
    3333%ifdef RT_ARCH_AMD64
    3434        push    rdi
     
    4646
    4747        pop     rdi
    48         ret
     48        BS3_HYBRID_RET
    4949
    5050%elif ARCH_BITS == 16
     
    5454        push    es
    5555
    56         mov     di, [bp + 4]            ; pvDst.off
    57         mov     dx, [bp + 4 + 2]        ; pvDst.sel
     56        mov     di, [bp + 2 + cbCurRetAddr]     ; pvDst.off
     57        mov     dx, [bp + 2 + cbCurRetAddr + 2] ; pvDst.sel
    5858        mov     es, dx
    59         mov     cx, [bp + 4 + 4]        ; cbDst
    60         shr     cx, 1                   ; calc dword count.
     59        mov     cx, [bp + 2 + cbCurRetAddr + 4] ; cbDst
     60        shr     cx, 1                           ; calc dword count.
    6161        xor     ax, ax
    6262        rep stosw
    6363
    64         mov     cx, [bp + 4 + 4]        ; cbDst
    65         and     cx, 1                   ; calc tailing byte count.
     64        mov     cx, [bp + 2 + cbCurRetAddr + 4] ; cbDst
     65        and     cx, 1                           ; calc tailing byte count.
    6666        rep stosb
    6767
     
    6969        pop     di
    7070        pop     bp
    71         ret
     71        BS3_HYBRID_RET
    7272
    7373%elif ARCH_BITS == 32
     
    8585
    8686        pop     edi
    87         ret
     87        BS3_HYBRID_RET
    8888
    8989%else
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForLM.c

    r60311 r60527  
    3232
    3333
    34 BS3_DECL(int) Bs3PagingInitRootForLM(void)
     34#undef Bs3PagingInitRootForLM
     35BS3_CMN_DEF(int, Bs3PagingInitRootForLM,(void))
    3536{
    3637    X86PML4 BS3_FAR *pPml4;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPAE.c

    r60311 r60527  
    3232
    3333
    34 BS3_DECL(int) Bs3PagingInitRootForPAE(void)
     34#undef Bs3PagingInitRootForPAE
     35BS3_CMN_DEF(int, Bs3PagingInitRootForPAE,(void))
    3536{
    3637    X86PDPT BS3_FAR *pPdPtr;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c

    r60321 r60527  
    6868
    6969
    70 BS3_DECL(int) Bs3PagingInitRootForPP(void)
     70#undef Bs3PagingInitRootForPP
     71BS3_CMN_DEF(int, Bs3PagingInitRootForPP,(void))
    7172{
    7273    X86PD BS3_FAR *pPgDir;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c

    r60321 r60527  
    5959
    6060
    61 BS3_DECL(X86PTE BS3_FAR *) bs3PagingGetLegacyPte(RTCCUINTXREG cr3, uint32_t uFlat, bool fUseInvlPg, int *prc)
     61#undef bs3PagingGetLegacyPte
     62BS3_CMN_DEF(X86PTE BS3_FAR *, bs3PagingGetLegacyPte,(RTCCUINTXREG cr3, uint32_t uFlat, bool fUseInvlPg, int *prc))
    6263{
    6364    X86PTE BS3_FAR *pPTE = NULL;
     
    120121
    121122
    122 BS3_DECL(X86PTEPAE BS3_FAR *) bs3PagingGetPte(RTCCUINTXREG cr3, uint64_t uFlat, bool fUseInvlPg, int *prc)
     123#undef bs3PagingGetPte
     124BS3_CMN_DEF(X86PTEPAE BS3_FAR *, bs3PagingGetPte,(RTCCUINTXREG cr3, uint64_t uFlat, bool fUseInvlPg, int *prc))
    123125{
    124126    X86PTEPAE BS3_FAR  *pPTE = NULL;
     
    212214
    213215
    214 BS3_DECL(int) Bs3PagingProtect(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear)
     216#undef Bs3PagingProtect
     217BS3_CMN_DEF(int, Bs3PagingProtect,(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear))
    215218{
    216219    RTCCUINTXREG const  cr3        = ASMGetCR3();
     
    242245        while ((uint32_t)cb > 0)
    243246        {
    244             PX86PTE pPte = bs3PagingGetLegacyPte(cr3, (uint32_t)uFlat, fUseInvlPg, &rc);
     247            PX86PTE pPte = BS3_CMN_NM(bs3PagingGetLegacyPte)(cr3, (uint32_t)uFlat, fUseInvlPg, &rc);
    245248            if (!pPte)
    246249                return rc;
     
    267270        while (cb > 0)
    268271        {
    269             PX86PTEPAE pPte = bs3PagingGetPte(cr3, uFlat, fUseInvlPg, &rc);
     272            PX86PTEPAE pPte = BS3_CMN_NM(bs3PagingGetPte)(cr3, uFlat, fUseInvlPg, &rc);
    270273            if (!pPte)
    271274                return rc;
     
    298301
    299302
    300 BS3_DECL(int) Bs3PagingProtectPtr(void *pv, size_t cb, uint64_t fSet, uint64_t fClear)
     303#undef Bs3PagingProtectPtr
     304BS3_CMN_DEF(int, Bs3PagingProtectPtr,(void *pv, size_t cb, uint64_t fSet, uint64_t fClear))
    301305{
    302306#if ARCH_BITS == 16
    303     return Bs3PagingProtect(Bs3SelPtrToFlat(pv), cb, fSet, fClear);
     307    return BS3_CMN_NM(Bs3PagingProtect)(Bs3SelPtrToFlat(pv), cb, fSet, fClear);
    304308#else
    305     return Bs3PagingProtect((uintptr_t)pv, cb, fSet, fClear);
     309    return BS3_CMN_NM(Bs3PagingProtect)((uintptr_t)pv, cb, fSet, fClear);
    306310#endif
    307311}
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Panic.asm

    r59244 r60527  
    2828
    2929
    30 BS3_PROC_BEGIN_CMN Bs3Panic
     30BS3_PROC_BEGIN_CMN Bs3Panic, BS3_PBC_HYBRID_0_ARGS
    3131        push    xBP
    3232        mov     xBP, xSP
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PicMaskAll.c

    r60302 r60527  
    3333
    3434
    35 BS3_DECL(void) Bs3PicMaskAll(void)
     35#undef Bs3PicMaskAll
     36BS3_CMN_DEF(void, Bs3PicMaskAll,(void))
    3637{
    3738    ASMOutU8(0xa1, 0xff);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintChr.asm

    r60218 r60527  
    4646; @cproto   BS3_DECL(void) Bs3PrintChr_c16(char ch);
    4747;
    48 BS3_PROC_BEGIN_CMN Bs3PrintChr
     48BS3_PROC_BEGIN_CMN Bs3PrintChr, BS3_PBC_NEAR
    4949        BS3_CALL_CONV_PROLOG 1
    5050        push    xBP
     
    8787        mov     cl, [xBP + xCB*2]       ; Load the char
    8888        mov     ax, BS3_SYSCALL_PRINT_CHR
    89         call    Bs3Syscall              ; (no BS3_CALL!)
     89        call    Bs3Syscall              ; near! no BS3_CALL!
    9090
    9191.return:
     
    9393        pop     xCX
    9494        pop     xAX
    95         leave
     95        pop     xBP
    9696        BS3_CALL_CONV_EPILOG 1
    9797        ret
    9898BS3_PROC_END_CMN   Bs3PrintChr
    9999
     100;
     101; Generate 16-bit far stub.
     102; Peformance critical, so don't penalize near calls.
     103;
     104BS3_CMN_FAR_STUB Bs3PrintChr, 2
     105
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStr.c

    r60291 r60527  
    2727#include "bs3kit-template-header.h"
    2828
    29 BS3_DECL(void) Bs3PrintStr(const char BS3_FAR *pszString)
     29#undef Bs3PrintStr
     30BS3_CMN_DEF(void, Bs3PrintStr,(const char BS3_FAR *pszString))
    3031{
    3132    Bs3PrintStrN(pszString, Bs3StrLen(pszString));
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintStrN.asm

    r60439 r60527  
    4848; ASSUMES cchString < 64KB!
    4949;
    50 BS3_PROC_BEGIN_CMN Bs3PrintStrN
     50BS3_PROC_BEGIN_CMN Bs3PrintStrN, BS3_PBC_NEAR
    5151        BS3_CALL_CONV_PROLOG 2
    5252        push    xBP
     
    7474.do_bios_call:
    7575        push    ds
    76         lds     si, [xBP + xCB*2]       ; DS:SI -> string.
     76        lds     si, [xBP + xCB + cbCurRetAddr]          ; DS:SI -> string.
    7777        cld
    78         mov     cx, [xBP + xCB*2 + sCB] ; Use CX for counting down.
     78        mov     cx, [xBP + xCB + cbCurRetAddr + sCB]    ; Use CX for counting down.
    7979        call    Bs3PrintStrN_c16_CX_Bytes_At_DS_SI
    8080        pop     ds
     
    9292.do_system_call:
    9393%if TMPL_BITS == 16
    94         mov     cx, [xBP + xCB*2 + 2]
     94        mov     cx, [xBP + xCB + cbCurRetAddr + 2]
    9595%else
    9696        mov     cx, ds
    9797%endif
    98         mov     xSI, [xBP + xCB*2]
    99         mov     dx, [xBP + xCB*2 + sCB]
     98        mov     xSI, [xBP + xCB + cbCurRetAddr]
     99        mov     dx,  [xBP + xCB + cbCurRetAddr + sCB]
    100100%if TMPL_BITS == 16
    101101
     
    105105%endif
    106106        mov     ax, BS3_SYSCALL_PRINT_STR
    107         call    Bs3Syscall              ; (no BS3_CALL!)
     107        call    Bs3Syscall              ; near! no BS3_CALL!
    108108
    109109.return:
     
    112112        pop     xCX
    113113        pop     xAX
    114         leave
     114        pop     xBP
    115115        BS3_CALL_CONV_EPILOG 2
    116         ret
     116        BS3_HYBRID_RET
    117117
    118118        ;
     
    130130        mov     ax, BS3_SYSCALL_PRINT_CHR
    131131        mov     cl, [BS3_ONLY_16BIT(es:) xSI]
    132         call    Bs3Syscall              ; (no BS3_CALL!)
     132        call    Bs3Syscall              ; near! no BS3_CALL!
    133133        inc     xSI
    134134        dec     xDX
     
    183183        jmp     .bios_loop_int10h
    184184BS3_PROC_END   Bs3PrintStrN_c16_CX_Bytes_At_DS_SI
     185
     186
     187;
     188; Generate 16-bit far stub.
     189; Peformance critical, so don't penalize near calls.
     190;
     191BS3_CMN_FAR_STUB Bs3PrintStrN, 6
     192
    185193%endif
    186194
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintU32.asm

    r59287 r60527  
    3535; @param    [xBP + xCB*2]   32-bit value to format and print.
    3636;
    37 BS3_PROC_BEGIN_CMN Bs3PrintU32
     37BS3_PROC_BEGIN_CMN Bs3PrintU32, BS3_PBC_HYBRID
    3838        BS3_CALL_CONV_PROLOG 1
    3939        push    xBP
     
    4545        BS3_ONLY_16BIT_STMT push ds
    4646
    47         mov     eax, [xBP + xCB*2]
     47        mov     eax, [xBP + xCB + cbCurRetAddr]
    4848
    4949        ; Allocate a stack buffer and terminate it. ds:bx points ot the end.
     
    7979        leave
    8080        BS3_CALL_CONV_EPILOG 1
    81         ret
     81        BS3_HYBRID_RET
    8282BS3_PROC_END_CMN   Bs3PrintU32
    8383
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintX32.asm

    r59287 r60527  
    3535; @param    [xBP + xCB*2]   32-bit value to format and print.
    3636;
    37 BS3_PROC_BEGIN_CMN Bs3PrintX32
     37BS3_PROC_BEGIN_CMN Bs3PrintX32, BS3_PBC_HYBRID
    3838        BS3_CALL_CONV_PROLOG 1
    3939        push    xBP
     
    4545        BS3_ONLY_16BIT_STMT push ds
    4646
    47         mov     eax, [xBP + xCB*2]
     47        mov     eax, [xBP + xCB + cbCurRetAddr]
    4848
    4949        ; Allocate a stack buffer and terminate it. ds:bx points ot the end.
     
    8383        leave
    8484        BS3_CALL_CONV_EPILOG 1
    85         ret
     85        BS3_HYBRID_RET
    8686BS3_PROC_END_CMN   Bs3PrintX32
    8787
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Printf.c

    r60291 r60527  
    6464
    6565
    66 BS3_DECL(size_t) Bs3PrintfV(const char BS3_FAR *pszFormat, va_list va)
     66#undef Bs3PrintfV
     67BS3_CMN_DEF(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list va))
    6768{
    6869    BS3PRINTBUF Buf;
     
    7273
    7374
    74 BS3_DECL(size_t) Bs3Printf(const char BS3_FAR *pszFormat, ...)
     75#undef Bs3Printf
     76BS3_CMN_DEF(size_t, Bs3Printf,(const char BS3_FAR *pszFormat, ...))
    7577{
    7678    size_t cchRet;
    7779    va_list va;
    7880    va_start(va, pszFormat);
    79     cchRet = Bs3PrintfV(pszFormat, va);
     81    cchRet = BS3_CMN_NM(Bs3PrintfV)(pszFormat, va);
    8082    va_end(va);
    8183    return cchRet;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxConvertToRingX.c

    r60311 r60527  
    139139 * @param   bRing       The target ring (0..3).
    140140 */
    141 BS3_DECL(void) Bs3RegCtxConvertToRingX(PBS3REGCTX pRegCtx, uint8_t bRing)
     141#undef Bs3RegCtxConvertToRingX
     142BS3_CMN_DEF(void, Bs3RegCtxConvertToRingX,(PBS3REGCTX pRegCtx, uint8_t bRing))
    142143{
    143144    if (   (pRegCtx->rflags.u32 & X86_EFL_VM)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxPrint.c

    r60216 r60527  
    3131
    3232
    33 BS3_DECL(void) Bs3RegCtxPrint(PCBS3REGCTX pRegCtx)
     33#undef Bs3RegCtxPrint
     34BS3_CMN_DEF(void, Bs3RegCtxPrint,(PCBS3REGCTX pRegCtx))
    3435{
    3536    //if (BS3_MODE_IS_64BIT_CODE(pRegCtx->bMode))
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm

    r60439 r60527  
    4747; @note         Only respects the BS3_MODE_CODE_MASK part of pRegCtx->bMode.
    4848;
    49 %if TMPL_BITS == 16 || TMPL_BITS == 32
    50 BS3_PROC_BEGIN_CMN Bs3RegCtxRestore_aborts ; special entry point for when watcom applies __aborts
    51  %if TMPL_BITS == 16
     49%if TMPL_BITS == 16
     50BS3_PROC_BEGIN_CMN Bs3RegCtxRestore_aborts, BS3_PBC_FAR ; special entry point for when watcom applies __aborts
     51BS3_PROC_BEGIN_CMN Bs3RegCtxRestore_aborts, BS3_PBC_NEAR ; special entry point for when watcom applies __aborts
    5252        CPU 8086
    5353        xor     xAX, xAX
    5454        push    xAX                     ; fake return address.
    55  %else
     55        push    xAX
     56        jmp     _Bs3RegCtxRestore_f16
     57%elif TMPL_BITS == 32
     58BS3_PROC_BEGIN_CMN Bs3RegCtxRestore_aborts, BS3_PBC_NEAR ; special entry point for when watcom applies __aborts
    5659        push    0feedfaceh              ; fake return address.
    57  %endif
    58 %endif
    59 BS3_PROC_BEGIN_CMN Bs3RegCtxRestore
     60%endif
     61BS3_PROC_BEGIN_CMN Bs3RegCtxRestore, BS3_PBC_HYBRID
    6062        BS3_CALL_CONV_PROLOG 2
    6163        push    xBP
     
    7173        jz      .in_ring0
    7274%if TMPL_BITS == 16
    73         mov     si, [bp + 4]
    74         mov     cx, [bp + 4+2]
    75         mov     dx, [bp + 8]
     75        mov     si, [bp + xCB + cbCurRetAddr]
     76        mov     cx, [bp + xCB + cbCurRetAddr + 2]
     77        mov     dx, [bp + xCB + cbCurRetAddr + sCB]
    7678        mov     ax, BS3_SYSCALL_RESTORE_CTX
    7779%else
     
    9193        mov     ax, BS3_SEL_DATA16
    9294        mov     es, ax
    93         lds     bx, [bp + 4]
    94         mov     cx, [bp + 8]
     95        lds     bx, [bp + xCB + cbCurRetAddr]
     96        mov     cx, [bp + xCB + cbCurRetAddr + sCB]
    9597%elif TMPL_BITS == 32
    9698        mov     ax, BS3_SEL_R0_DS32
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxSave.asm

    r60439 r60527  
    3838
    3939;;
    40 ; Restores the given register context.
     40; Saves the current register context.
    4141;
    4242; @param        pRegCtx
    4343; @uses         None.
    4444;
    45 BS3_PROC_BEGIN_CMN Bs3RegCtxSave
     45BS3_PROC_BEGIN_CMN Bs3RegCtxSave, BS3_PBC_HYBRID_SAFE
    4646        TMPL_ONLY_16BIT_STMT CPU 8086
    4747        BS3_CALL_CONV_PROLOG 1
     
    5656
    5757        ;
    58         ; Prologue. Load ES:xDI with pRegCtx.
    59         ; (ASSUMES ds is BS3KIT_GRPNM_DATA16/FLAT of course.)
    60         ;
    61 %if TMPL_BITS == 16
    62         les     di, [bp + 4]
    63 %else
    64         mov     xDI, [xBP + xCB*2]
    65 %endif
    66 
    67         ;
    6858        ; Clear the whole structure first.
    6959        ;
     
    7262        AssertCompileSizeAlignment(BS3REGCTX, 4)
    7363%if TMPL_BITS == 16
    74         les     xDI, [xBP + xCB*2]
     64        les     xDI, [xBP + xCB + cbCurRetAddr]
    7565        mov     xCX, BS3REGCTX_size / 2
    7666        rep stosw
    7767%else
    78         mov     xDI, [xBP + xCB*2]
     68        mov     xDI, [xBP + xCB + cbCurRetAddr]
    7969        mov     xCX, BS3REGCTX_size / 4
    8070        rep stosd
    8171%endif
    82         mov     xDI, [xBP + xCB*2]
     72        mov     xDI, [xBP + xCB + cbCurRetAddr]
    8373
    8474        ;
     
    201191.common_80286:
    202192        TMPL_ONLY_16BIT_STMT CPU 286
     193        cmp     cl, BS3_MODE_RM
     194        je      .common_ancient
    203195        str     [xDI + BS3REGCTX.tr]
    204196        sldt    [xDI + BS3REGCTX.ldtr]
     
    219211        mov     xAX, [xBP + xCB]
    220212        mov     [xDI + BS3REGCTX.rip], xAX
    221         lea     xAX, [xBP + xCB*2]
     213        lea     xAX, [xBP + xCB + cbCurRetAddr]
    222214        mov     [xDI + BS3REGCTX.rsp], xAX
    223215
    224         mov     [xDI + BS3REGCTX.cs], cs
    225 %if TMPL_BITS == 16
     216%if TMPL_BITS == 16
     217        mov     ax, [xBP + xCB + 2]
     218        mov     [xDI + BS3REGCTX.cs], ax
    226219        mov     ax, [xBP - xCB*6]
    227220        mov     [xDI + BS3REGCTX.ds], ax
     
    229222        mov     [xDI + BS3REGCTX.es], ax
    230223%else
     224        mov     [xDI + BS3REGCTX.cs], cs
    231225        mov     [xDI + BS3REGCTX.ds], ds
    232226        mov     [xDI + BS3REGCTX.es], es
     
    245239        xPOPF
    246240        pop     xBP
    247         ret
     241        BS3_HYBRID_RET
    248242BS3_PROC_END_CMN   Bs3RegCtxSave
    249243
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelFar32ToFlat32.c

    r60311 r60527  
    2828
    2929
    30 BS3_DECL(uint32_t) Bs3SelFar32ToFlat32(uint32_t off, uint16_t uSel)
     30#undef Bs3SelFar32ToFlat32
     31BS3_CMN_DEF(uint32_t, Bs3SelFar32ToFlat32,(uint32_t off, uint16_t uSel))
    3132{
    3233    if (g_bBs3CurrentMode == BS3_MODE_RM)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelProtFar32ToFlat32.c

    r60311 r60527  
    2828
    2929
    30 BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32(uint32_t off, uint16_t uSel)
     30#undef Bs3SelProtFar32ToFlat32
     31BS3_CMN_DEF(uint32_t, Bs3SelProtFar32ToFlat32,(uint32_t off, uint16_t uSel))
    3132{
    3233    uint32_t    uRet;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Shutdown.asm

    r58628 r60527  
    2929BS3_EXTERN_CMN Bs3Panic
    3030
    31 BS3_PROC_BEGIN_CMN Bs3Shutdown
     31BS3_PROC_BEGIN_CMN Bs3Shutdown, BS3_PBC_HYBRID_0_ARGS
    3232        cli
    3333        mov     bl, 64
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAlloc.c

    r59286 r60527  
    3232
    3333
    34 BS3_DECL(void BS3_FAR *) Bs3SlabAlloc(PBS3SLABCTL pSlabCtl)
     34#undef Bs3SlabAlloc
     35BS3_CMN_DEF(void BS3_FAR *, Bs3SlabAlloc,(PBS3SLABCTL pSlabCtl))
    3536{
    3637    if (pSlabCtl->cFreeChunks)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAllocEx.c

    r59941 r60527  
    3232
    3333
    34 BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags)
     34#undef Bs3SlabAllocEx
     35BS3_CMN_DEF(void BS3_FAR *, Bs3SlabAllocEx,(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags))
    3536{
    3637    BS3_ASSERT(cChunks > 0);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabFree.c

    r59286 r60527  
    3232
    3333
    34 BS3_DECL(uint16_t) Bs3SlabFree(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks)
     34#undef Bs3SlabFree
     35BS3_CMN_DEF(uint16_t, Bs3SlabFree,(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks))
    3536{
    3637    uint16_t cFreed = 0;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabInit.c

    r59286 r60527  
    3232
    3333
    34 BS3_DECL(void) Bs3SlabInit(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk)
     34#undef Bs3SlabInit
     35BS3_CMN_DEF(void, Bs3SlabInit,(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk))
    3536{
    3637    uint16_t cBits;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAdd.c

    r58789 r60527  
    2828
    2929
    30 BS3_DECL(void) Bs3SlabListAdd(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl)
     30#undef Bs3SlabListAdd
     31BS3_CMN_DEF(void, Bs3SlabListAdd,(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl))
    3132{
    3233    BS3_ASSERT(pHead->cbChunk == pSlabCtl->cbChunk);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAlloc.c

    r59286 r60527  
    3131
    3232
    33 BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc(PBS3SLABHEAD pHead)
     33#undef Bs3SlabListAlloc
     34BS3_CMN_DEF(void BS3_FAR *, Bs3SlabListAlloc,(PBS3SLABHEAD pHead))
    3435{
    3536    if (pHead->cFreeChunks)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAllocEx.c

    r59286 r60527  
    3131
    3232
    33 BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags)
     33#undef Bs3SlabListAllocEx
     34BS3_CMN_DEF(void BS3_FAR *, Bs3SlabListAllocEx,(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags))
    3435{
    3536    BS3_ASSERT(!(fFlags & ~BS3_SLAB_ALLOC_F_SAME_TILE));
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListFree.c

    r58789 r60527  
    2828
    2929
    30 BS3_DECL(void) Bs3SlabListFree(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks)
     30#undef Bs3SlabListFree
     31BS3_CMN_DEF(void, Bs3SlabListFree,(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks))
    3132{
    3233    BS3_ASSERT(cChunks > 0);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListInit.c

    r58789 r60527  
    2828
    2929
    30 BS3_DECL(void) Bs3SlabListInit(PBS3SLABHEAD pHead, uint16_t cbChunk)
     30#undef Bs3SlabListInit
     31BS3_CMN_DEF(void, Bs3SlabListInit,(PBS3SLABHEAD pHead, uint16_t cbChunk))
    3132{
    3233    BS3_ASSERT(RT_IS_POWER_OF_TWO(cbChunk));
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrCpy.c

    r58666 r60527  
    2828
    2929#undef Bs3StrCpy
    30 BS3_DECL(char BS3_FAR *) BS3_CMN_NM(Bs3StrCpy)(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc)
     30BS3_CMN_DEF(char BS3_FAR *, Bs3StrCpy,(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc))
    3131{
    3232    char BS3_FAR *pszRet = pszDst;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c

    r60311 r60527  
    359359
    360360
    361 BS3_DECL(size_t) Bs3StrFormatV(const char BS3_FAR *pszFormat, va_list va,
    362                                PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser)
     361#undef Bs3StrFormatV
     362BS3_CMN_DEF(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list va,
     363                               PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser))
    363364{
    364365    BS3FMTSTATE State;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrLen.c

    r58666 r60527  
    2828
    2929#undef Bs3StrLen
    30 BS3_DECL(size_t) BS3_CMN_NM(Bs3StrLen)(const char BS3_FAR *pszString)
     30BS3_CMN_DEF(size_t, Bs3StrLen,(const char BS3_FAR *pszString))
    3131{
    3232    size_t cch = 0;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrNLen.c

    r58666 r60527  
    2828
    2929#undef Bs3StrNLen
    30 BS3_DECL(size_t) BS3_CMN_NM(Bs3StrNLen)(const char BS3_FAR *pszString, size_t cchMax)
     30BS3_CMN_DEF(size_t, Bs3StrNLen,(const char BS3_FAR *pszString, size_t cchMax))
    3131{
    3232    size_t cch = 0;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrPrintf.c

    r58812 r60527  
    7373
    7474
    75 BS3_DECL(size_t) Bs3StrPrintfV(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, va_list va)
     75#undef Bs3StrPrintfV
     76BS3_CMN_DEF(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, va_list va))
    7677{
    7778    BS3STRPRINTFSTATE State;
     
    8283
    8384
    84 BS3_DECL(size_t) Bs3StrPrintf(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, ...)
     85#undef Bs3StrPrintf
     86BS3_CMN_DEF(size_t, Bs3StrPrintf,(char BS3_FAR *pszBuf, size_t cchBuf, const char BS3_FAR *pszFormat, ...))
    8587{
    8688    size_t cchRet;
    8789    va_list va;
    8890    va_start(va, pszFormat);
    89     cchRet = Bs3StrPrintfV(pszBuf, cchBuf, pszFormat, va);
     91    cchRet = BS3_CMN_NM(Bs3StrPrintfV)(pszBuf, cchBuf, pszFormat, va);
    9092    va_end(va);
    9193    return cchRet;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm

    r60218 r60527  
    3838; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    3939;
    40 BS3_PROC_BEGIN_CMN Bs3SwitchTo16Bit
     40BS3_PROC_BEGIN_CMN Bs3SwitchTo16Bit, BS3_PBC_NEAR
    4141%if TMPL_BITS == 16
    4242        push    ax
     
    117117BS3_PROC_END_CMN   Bs3SwitchTo16Bit
    118118
     119;; @todo far 16-bit variant.
     120
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16BitV86.asm

    r60439 r60527  
    4040;       values and the stack register converted to real mode (not ebp).
    4141;
    42 BS3_PROC_BEGIN_CMN Bs3SwitchTo16BitV86
     42BS3_PROC_BEGIN_CMN Bs3SwitchTo16BitV86, BS3_PBC_NEAR
    4343        ; Construct basic v8086 return frame.
    4444        BS3_ONLY_16BIT_STMT movzx   esp, sp
     
    118118BS3_PROC_END_CMN   Bs3SwitchTo16BitV86
    119119
     120;; @todo far 16-bit variant.
     121
    120122%endif ; ! 64-bit
    121123
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm

    r60218 r60527  
    4343; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4444;
    45 BS3_PROC_BEGIN_CMN Bs3SwitchTo32Bit
     45BS3_PROC_BEGIN_CMN Bs3SwitchTo32Bit, BS3_PBC_NEAR
    4646%if TMPL_BITS == 32
    4747        ret
     
    148148BS3_PROC_END_CMN   Bs3SwitchTo32Bit
    149149
     150;; @todo far 16-bit variant.
     151
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm

    r59949 r60527  
    3737;
    3838; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
     39; @uses     No GPRs.
    3940;
    40 BS3_PROC_BEGIN_CMN Bs3SwitchTo64Bit
     41BS3_PROC_BEGIN_CMN Bs3SwitchTo64Bit, BS3_PBC_NEAR
    4142%if TMPL_BITS == 64
    4243        ret
     
    105106BS3_PROC_END_CMN   Bs3SwitchTo64Bit
    106107
     108
     109;; @todo far 16-bit variant.
     110
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing0.asm

    r60001 r60527  
    3434;*  External Symbols                                                                                                             *
    3535;*********************************************************************************************************************************
    36 BS3_EXTERN_CMN Bs3SwitchToRingX
     36BS3_EXTERN_CMN_FAR Bs3SwitchToRingX
    3737TMPL_BEGIN_TEXT
    3838
     
    4444; @uses     No GPRs.
    4545;
    46 BS3_PROC_BEGIN_CMN Bs3SwitchToRing0
     46BS3_PROC_BEGIN_CMN Bs3SwitchToRing0, BS3_PBC_HYBRID_0_ARGS
    4747%if TMPL_BITS == 64
    4848        push    rcx
     
    5555%else
    5656        push    0
     57        TMPL_ONLY_16BIT_STMT push cs
    5758        call    Bs3SwitchToRingX
    5859        add     xSP, xCB
    5960%endif
    60         ret
     61        BS3_HYBRID_RET
    6162BS3_PROC_END_CMN   Bs3SwitchToRing0
    6263
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing1.asm

    r60001 r60527  
    3434;*  External Symbols                                                                                                             *
    3535;*********************************************************************************************************************************
    36 BS3_EXTERN_CMN Bs3SwitchToRingX
     36BS3_EXTERN_CMN_FAR Bs3SwitchToRingX
    3737TMPL_BEGIN_TEXT
    3838
     
    4444; @uses     No GPRs.
    4545;
    46 BS3_PROC_BEGIN_CMN Bs3SwitchToRing1
     46BS3_PROC_BEGIN_CMN Bs3SwitchToRing1, BS3_PBC_HYBRID_0_ARGS
    4747%if TMPL_BITS == 64
    4848        push    rcx
     
    5555%else
    5656        push    1
     57        TMPL_ONLY_16BIT_STMT push cs
    5758        call    Bs3SwitchToRingX
    5859        add     xSP, xCB
    5960%endif
    60         ret
     61        BS3_HYBRID_RET
    6162BS3_PROC_END_CMN   Bs3SwitchToRing1
    6263
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing2.asm

    r60001 r60527  
    3434;*  External Symbols                                                                                                             *
    3535;*********************************************************************************************************************************
    36 BS3_EXTERN_CMN Bs3SwitchToRingX
     36BS3_EXTERN_CMN_FAR Bs3SwitchToRingX
    3737TMPL_BEGIN_TEXT
    3838
     
    4444; @uses     No GPRs.
    4545;
    46 BS3_PROC_BEGIN_CMN Bs3SwitchToRing2
     46BS3_PROC_BEGIN_CMN Bs3SwitchToRing2, BS3_PBC_HYBRID_0_ARGS
    4747%if TMPL_BITS == 64
    4848        push    rcx
     
    5555%else
    5656        push    2
     57        TMPL_ONLY_16BIT_STMT push cs
    5758        call    Bs3SwitchToRingX
    5859        add     xSP, xCB
    5960%endif
    60         ret
     61        BS3_HYBRID_RET
    6162BS3_PROC_END_CMN   Bs3SwitchToRing2
    6263
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing3.asm

    r60001 r60527  
    3434;*  External Symbols                                                                                                             *
    3535;*********************************************************************************************************************************
    36 BS3_EXTERN_CMN Bs3SwitchToRingX
     36BS3_EXTERN_CMN_FAR Bs3SwitchToRingX
    3737TMPL_BEGIN_TEXT
    3838
     
    4444; @uses     No GPRs.
    4545;
    46 BS3_PROC_BEGIN_CMN Bs3SwitchToRing3
     46BS3_PROC_BEGIN_CMN Bs3SwitchToRing3, BS3_PBC_HYBRID_0_ARGS
    4747%if TMPL_BITS == 64
    4848        push    rcx
     
    5555%else
    5656        push    3
     57        TMPL_ONLY_16BIT_STMT push cs
    5758        call    Bs3SwitchToRingX
    5859        add     xSP, xCB
    5960%endif
    60         ret
     61        BS3_HYBRID_RET
    6162BS3_PROC_END_CMN   Bs3SwitchToRing3
    6263
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRingX.asm

    r60218 r60527  
    4343; @uses     No GPRs.
    4444;
    45 BS3_PROC_BEGIN_CMN Bs3SwitchToRingX
     45BS3_PROC_BEGIN_CMN Bs3SwitchToRingX, BS3_PBC_HYBRID_SAFE
    4646        BS3_CALL_CONV_PROLOG 1
    4747        push    xBP
     
    6565        mov     ax, cs
    6666        and     al, 3
    67         cmp     al, byte [xBP + xCB*2]
     67        cmp     al, byte [xBP + xCB + cbCurRetAddr]
    6868        je      .return
    6969
    7070.just_do_it:
    7171        mov     xAX, BS3_SYSCALL_TO_RING0
    72         add     al, [xBP + xCB*2]
     72        add     al, [xBP + xCB + cbCurRetAddr]
    7373        call    Bs3Syscall
    7474
     
    8080        pop     xBP
    8181        BS3_CALL_CONV_EPILOG 1
    82         ret
     82        BS3_HYBRID_RET
    8383
    8484%ifdef BS3_STRICT
    8585; In real mode, only ring-0 makes any sense.
    8686.return_real_mode:
    87         cmp     byte [xBP + xCB*2], 0
     87        cmp     byte [xBP + xCB + cbCurRetAddr], 0
    8888        je      .return
    8989        int3
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Syscall.asm

    r60218 r60527  
    5151; @uses     Whatever the syscall modified (xBX and XBP are always saved).
    5252;
    53 BS3_PROC_BEGIN_CMN Bs3Syscall
     53BS3_PROC_BEGIN_CMN Bs3Syscall, BS3_PBC_HYBRID_0_ARGS ; (all parameters are in registers)
    5454        push    xBP
    5555        mov     xBP, xSP
     
    8080        pop     xBX
    8181        pop     xBP
    82         ret
     82        BS3_HYBRID_RET
    8383BS3_PROC_END_CMN   Bs3Syscall
    8484
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestCheckRegCtxEx.c

    r60216 r60527  
    3232
    3333
    34 BS3_DECL(bool) Bs3TestCheckRegCtxEx(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAcjust,
    35                                     uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep)
     34#undef Bs3TestCheckRegCtxEx
     35BS3_CMN_DEF(bool, Bs3TestCheckRegCtxEx,(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAcjust,
     36                                        uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep))
    3637{
    3738    uint16_t cErrorsBefore = Bs3TestSubErrorCount();
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestFailed.c

    r60439 r60527  
    9595 * Equivalent to RTTestIFailedV.
    9696 */
    97 BS3_DECL(void) Bs3TestFailedV(const char *pszFormat, va_list va)
     97#undef Bs3TestFailedV
     98BS3_CMN_DEF(void, Bs3TestFailedV,(const char *pszFormat, va_list va))
    9899{
    99100    BS3TESTFAILEDBUF Buf;
     
    118119 * Equivalent to RTTestIFailedF.
    119120 */
    120 BS3_DECL(void) Bs3TestFailedF(const char *pszFormat, ...)
     121#undef Bs3TestFailedF
     122BS3_CMN_DEF(void, Bs3TestFailedF,(const char *pszFormat, ...))
    121123{
    122124    va_list va;
    123125    va_start(va, pszFormat);
    124     Bs3TestFailedV(pszFormat, va);
     126    BS3_CMN_NM(Bs3TestFailedV)(pszFormat, va);
    125127    va_end(va);
    126128}
     
    130132 * Equivalent to RTTestIFailed.
    131133 */
    132 BS3_DECL(void) Bs3TestFailed(const char *pszMessage)
     134#undef Bs3TestFailed
     135BS3_CMN_DEF(void, Bs3TestFailed,(const char *pszMessage))
    133136{
    134     Bs3TestFailedF("%s", pszMessage);
     137    BS3_CMN_NM(Bs3TestFailedF)("%s", pszMessage);
    135138}
    136139
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestInit.c

    r60311 r60527  
    3838 * @param   pszTest         The test name.
    3939 */
    40 BS3_DECL(void) Bs3TestInit(const char BS3_FAR *pszTest)
     40#undef Bs3TestInit
     41BS3_CMN_DEF(void, Bs3TestInit,(const char BS3_FAR *pszTest))
    4142{
    4243    /*
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestIsVmmDevTestingPresent.asm

    r60367 r60527  
    3838; @cproto   BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c16(void);
    3939;
    40 BS3_PROC_BEGIN_CMN bs3TestIsVmmDevTestingPresent
     40BS3_PROC_BEGIN_CMN bs3TestIsVmmDevTestingPresent, BS3_PBC_HYBRID_0_ARGS
    4141        BS3_CALL_CONV_PROLOG 2
    4242        push    xBP
     
    5959        pop     xBP
    6060        BS3_CALL_CONV_EPILOG 2
    61         ret
     61        BS3_HYBRID_RET
    6262
    6363.ancient_cpu:
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestPrintf.c

    r60439 r60527  
    115115
    116116
    117 BS3_DECL(void) Bs3TestPrintfV(const char BS3_FAR *pszFormat, va_list va)
     117#undef Bs3TestPrintfV
     118BS3_CMN_DEF(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list va))
    118119{
    119120    BS3TESTPRINTBUF Buf;
     
    125126
    126127
    127 BS3_DECL(void) Bs3TestPrintf(const char BS3_FAR *pszFormat, ...)
     128#undef Bs3TestPrintf
     129BS3_CMN_DEF(void, Bs3TestPrintf,(const char BS3_FAR *pszFormat, ...))
    128130{
    129131    va_list va;
    130132    va_start(va, pszFormat);
    131     Bs3TestPrintfV(pszFormat, va);
     133    BS3_CMN_NM(Bs3TestPrintfV)(pszFormat, va);
    132134    va_end(va);
    133135}
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithStr.asm

    r60439 r60527  
    3434; @cproto   BS3_DECL(void) bs3TestSendCmdWithStr_c16(uint32_t uCmd, const char BS3_FAR *pszString);
    3535;
    36 BS3_PROC_BEGIN_CMN bs3TestSendCmdWithStr
     36BS3_PROC_BEGIN_CMN bs3TestSendCmdWithStr, BS3_PBC_HYBRID
    3737        BS3_CALL_CONV_PROLOG 2
    3838        push    xBP
     
    4949        mov     dx, VMMDEV_TESTING_IOPORT_CMD
    5050%if TMPL_BITS == 16
    51         mov     ax, [xBP + xCB*2]       ; We ignore the top bits in 16-bit mode.
     51        mov     ax, [xBP + xCB + cbCurRetAddr]  ; We ignore the top bits in 16-bit mode.
    5252        out     dx, ax
    5353%else
    54         mov     eax, [xBP + xCB*2]
     54        mov     eax, [xBP + xCB + cbCurRetAddr]
    5555        out     dx, eax
    5656%endif
     
    5959        mov     dx, VMMDEV_TESTING_IOPORT_DATA
    6060%if TMPL_BITS == 16
    61         lds     si, [xBP + xCB*2 + sCB]
     61        lds     si,  [xBP + xCB + cbCurRetAddr + sCB]
    6262%else
    63         mov     xSI, [xBP + xCB*2 + sCB]
     63        mov     xSI, [xBP + xCB + cbCurRetAddr + sCB]
    6464%endif
    6565.next_char:
     
    7474        pop     xDX
    7575        pop     xAX
    76         leave
     76        pop     xBP
    7777        BS3_CALL_CONV_EPILOG 2
    78         ret
     78        BS3_HYBRID_RET
    7979BS3_PROC_END_CMN   bs3TestSendCmdWithStr
    8080
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithU32.asm

    r60439 r60527  
    3434; @cproto   BS3_DECL(void) bs3TestSendCmdWithU32_c16(uint32_t uCmd, uint32_t uValue);
    3535;
    36 BS3_PROC_BEGIN_CMN bs3TestSendCmdWithU32
     36BS3_PROC_BEGIN_CMN bs3TestSendCmdWithU32, BS3_PBC_HYBRID
    3737        BS3_CALL_CONV_PROLOG 2
    3838        push    xBP
     
    4848        mov     dx, VMMDEV_TESTING_IOPORT_CMD
    4949%if TMPL_BITS == 16
    50         mov     ax, [xBP + xCB*2]      ; We ignore the top bits in 16-bit mode.
     50        mov     ax, [xBP + xCB + cbCurRetAddr] ; We ignore the top bits in 16-bit mode.
    5151        out     dx, ax
    5252%else
     
    5959        mov     dx, VMMDEV_TESTING_IOPORT_DATA
    6060%if TMPL_BITS == 16
    61         mov     ax, [xBP + xCB*2 + sCB]
     61        mov     ax, [xBP + xCB + cbCurRetAddr + sCB]
    6262        out     dx, ax
    63         mov     ax, [xBP + xCB*2 + sCB + 2]
     63        mov     ax, [xBP + xCB + cbCurRetAddr + sCB + 2]
    6464        out     dx, ax
    6565%else
     
    7575        pop     xDX
    7676        pop     xAX
    77         leave
     77        pop     xBP
    7878        BS3_CALL_CONV_EPILOG 2
    79         ret
     79        BS3_HYBRID_RET
    8080BS3_PROC_END_CMN   bs3TestSendCmdWithU32
    8181
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSkipped.c

    r60439 r60527  
    3737 * Equivalent to RTTestSkippedV.
    3838 */
    39 BS3_DECL(void) Bs3TestSkippedV(const char *pszFormat, va_list va)
     39#undef Bs3TestSkippedV
     40BS3_CMN_DEF(void, Bs3TestSkippedV,(const char *pszFormat, va_list va))
    4041{
    4142    if (g_cusBs3TestErrors == g_cusBs3SubTestAtErrors)
     
    6970 * Equivalent to RTTestSkipped.
    7071 */
    71 BS3_DECL(void) Bs3TestSkippedF(const char *pszFormat, ...)
     72#undef Bs3TestSkippedF
     73BS3_CMN_DEF(void, Bs3TestSkippedF,(const char *pszFormat, ...))
    7274{
    7375    va_list va;
    7476    va_start(va, pszFormat);
    75     Bs3TestSkippedV(pszFormat, va);
     77    BS3_CMN_NM(Bs3TestSkippedV)(pszFormat, va);
    7678    va_end(va);
    7779}
     
    8183 * Equivalent to RTTestSkipped.
    8284 */
    83 BS3_DECL(void) Bs3TestSkipped(const char *pszWhy)
     85#undef Bs3TestSkipped
     86BS3_CMN_DEF(void, Bs3TestSkipped,(const char *pszWhy))
    8487{
    85     Bs3TestSkippedF(pszWhy ? "%s" : NULL, pszWhy);
     88    BS3_CMN_NM(Bs3TestSkippedF)(pszWhy ? "%s" : NULL, pszWhy);
    8689}
    8790
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSub.c

    r60311 r60527  
    3737 * Equivalent to RTTestISubV.
    3838 */
    39 BS3_DECL(void) Bs3TestSubV(const char *pszFormat, va_list va)
     39#undef Bs3TestSubV
     40BS3_CMN_DEF(void, Bs3TestSubV,(const char *pszFormat, va_list va))
    4041{
    4142    size_t cch;
     
    7071 * Equivalent to RTTestIFailedF.
    7172 */
    72 BS3_DECL(void) Bs3TestSubF(const char *pszFormat, ...)
     73#undef Bs3TestSubF
     74BS3_CMN_DEF(void, Bs3TestSubF,(const char *pszFormat, ...))
    7375{
    7476    va_list va;
    7577    va_start(va, pszFormat);
    76     Bs3TestSubV(pszFormat, va);
     78    BS3_CMN_NM(Bs3TestSubV)(pszFormat, va);
    7779    va_end(va);
    7880}
     
    8284 * Equivalent to RTTestISub.
    8385 */
    84 BS3_DECL(void) Bs3TestSub(const char *pszMessage)
     86#undef Bs3TestSub
     87BS3_CMN_DEF(void, Bs3TestSub,(const char *pszMessage))
    8588{
    86     Bs3TestSubF("%s", pszMessage);
     89    BS3_CMN_NM(Bs3TestSubF)("%s", pszMessage);
    8790}
    8891
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubDone.c

    r59865 r60527  
    3737 * Equivalent to RTTestISubDone.
    3838 */
    39 BS3_DECL(void) Bs3TestSubDone(void)
     39#undef Bs3TestSubDone
     40BS3_CMN_DEF(void, Bs3TestSubDone,(void))
    4041{
    4142    bs3TestSubCleanup();
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSubErrorCount.c

    r60311 r60527  
    3737 * Equivalent to RTTestSubErrorCount.
    3838 */
    39 BS3_DECL(uint16_t) Bs3TestSubErrorCount(void)
     39#undef Bs3TestSubErrorCount
     40BS3_CMN_DEF(uint16_t, Bs3TestSubErrorCount,(void))
    4041{
    4142    return g_cusBs3TestErrors - g_cusBs3SubTestAtErrors;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestTerm.c

    r60311 r60527  
    7777 * Equivalent to RTTestSummaryAndDestroy.
    7878 */
    79 BS3_DECL(void) Bs3TestTerm(void)
     79#undef Bs3TestTerm
     80BS3_CMN_DEF(void, Bs3TestTerm,(void))
    8081{
    8182    /*
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16Init.c

    r60311 r60527  
    4545
    4646
    47 BS3_DECL(void) Bs3Trap16InitEx(bool f386Plus)
     47#undef Bs3Trap16InitEx
     48BS3_CMN_DEF(void, Bs3Trap16InitEx,(bool f386Plus))
    4849{
    4950    X86TSS16 BS3_FAR *pTss;
     
    6869     * IDT entries, except the system call gate.
    6970     */
    70     for (iIdt = 0; iIdt < BS3_TRAP_SYSCALL; iIdt++)
    71         Bs3Trap16SetGate(iIdt, X86_SEL_TYPE_SYS_286_INT_GATE, 0 /*bDpl*/,
    72                          BS3_SEL_R0_CS16, (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIdt * 8, 0 /*cParams*/);
    73     for (iIdt = BS3_TRAP_SYSCALL + 1; iIdt < 256; iIdt++)
    74         Bs3Trap16SetGate(iIdt, X86_SEL_TYPE_SYS_286_INT_GATE, 0 /*bDpl*/,
    75                          BS3_SEL_R0_CS16, (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIdt * 8, 0 /*cParams*/);
     71    for (iIdt = 0; iIdt < 256; iIdt++)
     72        if (iIdt != BS3_TRAP_SYSCALL)
     73            Bs3Trap16SetGate(iIdt, X86_SEL_TYPE_SYS_286_INT_GATE, 0 /*bDpl*/,
     74                             BS3_SEL_R0_CS16, (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIdt * 8, 0 /*cParams*/);
    7675
    7776    /*
     
    112111
    113112
    114 BS3_DECL(void) Bs3Trap16Init(void)
     113#undef Bs3Trap16Init
     114BS3_CMN_DEF(void, Bs3Trap16Init,(void))
    115115{
    116     Bs3Trap16InitEx((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386);
     116    BS3_CMN_NM(Bs3Trap16InitEx)((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386);
    117117}
    118118
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap16SetGate.c

    r60311 r60527  
    11/* $Id$ */
    22/** @file
    3  * BS3Kit - Bs3Trap32SetGate
     3 * BS3Kit - Bs3Trap16SetGate
    44 */
    55
     
    3131
    3232
    33 BS3_DECL(void) Bs3Trap16SetGate(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams)
     33#undef Bs3Trap16SetGate
     34BS3_CMN_DEF(void, Bs3Trap16SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams))
    3435{
    3536    X86DESC BS3_FAR *pIdte = &Bs3Idt16[iIdt];
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32Init.c

    r60311 r60527  
    3838
    3939
    40 BS3_DECL(void) Bs3Trap32Init(void)
     40#undef Bs3Trap32Init
     41BS3_CMN_DEF(void, Bs3Trap32Init,(void))
    4142{
    4243     X86TSS32 BS3_FAR *pTss;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32SetGate.c

    r60311 r60527  
    3131
    3232
    33 BS3_DECL(void) Bs3Trap32SetGate(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams)
     33#undef Bs3Trap32SetGate
     34BS3_CMN_DEF(void, Bs3Trap32SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams))
    3435{
    3536    X86DESC BS3_FAR *pIdte = &Bs3Idt32[iIdt];
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64Init.c

    r60311 r60527  
    3131
    3232
    33 BS3_DECL(void) Bs3Trap64Init(void)
     33#undef Bs3Trap64Init
     34BS3_CMN_DEF(void, Bs3Trap64Init,(void))
    3435{
    3536     X86TSS64 BS3_FAR *pTss;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64SetGate.c

    r60311 r60527  
    3131
    3232
    33 BS3_DECL(void) Bs3Trap64SetGate(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst)
     33#undef Bs3Trap64SetGate
     34BS3_CMN_DEF(void, Bs3Trap64SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst))
    3435{
    3536    X86DESC64 BS3_FAR *pIdte = &Bs3Idt64[iIdt];
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c

    r60311 r60527  
    4848        Bs3PrintChr(pTrapFrame->Ctx.rcx.u8);
    4949    else if (pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_PRINT_STR)
    50         Bs3PrintStrN(Bs3XptrFlatToCurrent((pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16), pTrapFrame->Ctx.rdx.u16);
     50        Bs3PrintStrN(Bs3XptrFlatToCurrent(((uint32_t)pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16),
     51                     pTrapFrame->Ctx.rdx.u16);
    5152    else if (pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_RESTORE_CTX)
    52         Bs3RegCtxRestore(Bs3XptrFlatToCurrent((pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16), pTrapFrame->Ctx.rdx.u16);
     53        Bs3RegCtxRestore(Bs3XptrFlatToCurrent(((uint32_t)pTrapFrame->Ctx.rcx.u16 << 4) + pTrapFrame->Ctx.rsi.u16),
     54                         pTrapFrame->Ctx.rdx.u16);
    5355    else if (   pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING0
    5456             || pTrapFrame->Ctx.rax.u16 == BS3_SYSCALL_TO_RING1
     
    6365#endif
    6466
    65 BS3_DECL(void) Bs3TrapDefaultHandler(PBS3TRAPFRAME pTrapFrame)
     67#undef Bs3TrapDefaultHandler
     68BS3_CMN_DEF(void, Bs3TrapDefaultHandler,(PBS3TRAPFRAME pTrapFrame))
    6669{
    6770#if TMPL_BITS != 64
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapPrintFrame.c

    r60439 r60527  
    3131
    3232
    33 BS3_DECL(void) Bs3TrapPrintFrame(PCBS3TRAPFRAME pTrapFrame)
     33#undef Bs3TrapPrintFrame
     34BS3_CMN_DEF(void, Bs3TrapPrintFrame,(PCBS3TRAPFRAME pTrapFrame))
    3435{
    3536#if 1
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86Init.c

    r60511 r60527  
    11/* $Id$ */
    22/** @file
    3  * BS3Kit - Bs3Trap16Init
     3 * BS3Kit - Bs3TrapRmV86Init
    44 */
    55
     
    3737   flat address matches.   Also, these symbols are defined both with
    3838   and without underscore prefixes. */
    39 extern BS3_DECL(void) BS3_FAR_CODE Bs3Trap16DoubleFaultHandler80386(void);
    40 extern BS3_DECL(void) BS3_FAR_CODE Bs3Trap16DoubleFaultHandler80286(void);
    4139extern BS3_DECL(void) BS3_FAR_CODE Bs3Trap16GenericEntries(void);
    4240
     
    4442extern uint8_t  BS3_FAR_DATA bs3Trap16GenericTrapOrInt[];
    4543
     44/* bs3-cmn-TrapRmV86Data.c: */
     45#define g_fBs3RmIvtCopied   BS3_DATA_NM(g_fBs3RmIvtCopied)
     46extern bool    g_fBs3RmIvtCopied;
    4647
    47 BS3_DECL(void) Bs3Trap16InitEx(bool f386Plus)
     48
     49#undef Bs3TrapRmV86InitEx
     50BS3_CMN_DEF(void, Bs3TrapRmV86InitEx,(bool f386Plus))
    4851{
    49     X86TSS16 BS3_FAR *pTss;
    50     unsigned iIdt;
     52    RTFAR16 BS3_FAR *paIvt = Bs3XptrFlatToCurrent(0);
     53    unsigned iIvt;
     54
     55    /*
     56     * Copy the real mode IVT the first time we are here.
     57     */
     58    if (!g_fBs3RmIvtCopied)
     59    {
     60        Bs3MemCpy(g_aBs3RmIvtOriginal, paIvt, sizeof(g_aBs3RmIvtOriginal));
     61        g_fBs3RmIvtCopied = true;
     62    }
     63    /*
     64     * The rest of the times, we copy back the original and modify it.
     65     */
     66    else
     67        Bs3MemCpy(paIvt, g_aBs3RmIvtOriginal, sizeof(g_aBs3RmIvtOriginal));
     68
    5169
    5270    /*
     
    6684
    6785    /*
    68      * IDT entries, except the system call gate.
     86     * Since we want to play with V86 mode as well as 8086 and 186 CPUs, we
     87     * cannot move the IVT from its default location.  So, modify it in place.
     88     *
     89     * Note! We must keep int 10h working, which is easy since the CPU does
     90     *       use it (well, it's been reserved for 30+ years).
    6991     */
    70     for (iIdt = 0; iIdt < BS3_TRAP_SYSCALL; iIdt++)
    71         Bs3Trap16SetGate(iIdt, X86_SEL_TYPE_SYS_286_INT_GATE, 0 /*bDpl*/,
    72                          BS3_SEL_R0_CS16, (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIdt * 8, 0 /*cParams*/);
    73     for (iIdt = BS3_TRAP_SYSCALL + 1; iIdt < 256; iIdt++)
    74         Bs3Trap16SetGate(iIdt, X86_SEL_TYPE_SYS_286_INT_GATE, 0 /*bDpl*/,
    75                          BS3_SEL_R0_CS16, (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIdt * 8, 0 /*cParams*/);
    76 
    77     /*
    78      * Initialize the normal TSS so we can do ring transitions via the IDT.
    79      */
    80     pTss = &Bs3Tss16;
    81     Bs3MemZero(pTss, sizeof(*pTss));
    82     pTss->sp0       = BS3_ADDR_STACK_R0;
    83     pTss->ss0       = BS3_SEL_R0_SS16;
    84     pTss->sp1       = BS3_ADDR_STACK_R1;
    85     pTss->ss1       = BS3_SEL_R1_SS16 | 1;
    86     pTss->sp2       = BS3_ADDR_STACK_R2;
    87     pTss->ss2       = BS3_SEL_R2_SS16 | 2;
    88 
    89     /*
    90      * Initialize the double fault TSS.
    91      * cr3 is filled in by switcher code, when needed.
    92      */
    93     pTss = &Bs3Tss16DoubleFault;
    94     Bs3MemZero(pTss, sizeof(*pTss));
    95     pTss->sp0       = BS3_ADDR_STACK_R0;
    96     pTss->ss0       = BS3_SEL_R0_SS16;
    97     pTss->sp1       = BS3_ADDR_STACK_R1;
    98     pTss->ss1       = BS3_SEL_R1_SS16 | 1;
    99     pTss->sp2       = BS3_ADDR_STACK_R2;
    100     pTss->ss2       = BS3_SEL_R2_SS16 | 2;
    101     pTss->ip        = (uint16_t)(uintptr_t)(f386Plus ? &Bs3Trap16DoubleFaultHandler80386 : &Bs3Trap16DoubleFaultHandler80286);
    102     pTss->flags     = X86_EFL_1;
    103     pTss->sp        = BS3_ADDR_STACK_R0_IST1;
    104     pTss->es        = BS3_SEL_R0_DS16;
    105     pTss->ds        = BS3_SEL_R0_DS16;
    106     pTss->cs        = BS3_SEL_R0_CS16;
    107     pTss->ss        = BS3_SEL_R0_SS16;
    108     pTss->dx        = f386Plus;
    109 
    110     Bs3Trap16SetGate(X86_XCPT_DF, X86_SEL_TYPE_SYS_TASK_GATE, 0 /*bDpl*/, BS3_SEL_TSS16_DF, 0, 0 /*cParams*/);
     92    for (iIvt = 0; iIvt < 256; iIvt++)
     93        if (iIvt != 0x10 && iIvt != BS3_TRAP_SYSCALL)
     94        {
     95            paIvt[iIvt].off = (uint16_t)(uintptr_t)Bs3Trap16GenericEntries + iIvt * 8;
     96            paIvt[iIvt].sel = BS3_SEL_TEXT16;
     97        }
    11198}
    11299
    113100
    114 BS3_DECL(void) Bs3Trap16Init(void)
     101#undef Bs3TrapRmV86InitEx
     102BS3_CMN_DEF(void, Bs3TrapRmV86Init,(void))
    115103{
    116     Bs3Trap16InitEx((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386);
     104    BS3_CMN_NM(Bs3TrapRmV86InitEx)((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386);
    117105}
    118106
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapRmV86SetGate.c

    r60511 r60527  
    11/* $Id$ */
    22/** @file
    3  * BS3Kit - Bs3Trap32SetGate
     3 * BS3Kit - Bs3TrapRmV86SetGate
    44 */
    55
    66/*
    7  * Copyright (C) 2007-2015 Oracle Corporation
     7 * Copyright (C) 2007-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3131
    3232
    33 BS3_DECL(void) Bs3Trap16SetGate(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams)
     33#undef Bs3TrapRmV86SetGate
     34BS3_CMN_DEF(void, Bs3TrapRmV86SetGate,(uint8_t iIvt, uint16_t uSeg, uint16_t off))
    3435{
    35     X86DESC BS3_FAR *pIdte = &Bs3Idt16[iIdt];
    36 
    37     BS3_ASSERT(bDpl <= 3);
    38     BS3_ASSERT(bType <= 15);
    39     BS3_ASSERT(cParams <= 15);
    40     pIdte->Gate.u16OffsetLow    = (uint16_t)off;
    41     pIdte->Gate.u16OffsetHigh   = 0;
    42     pIdte->Gate.u16Sel          = uSel;
    43     pIdte->Gate.u4ParmCount     = cParams;
    44     pIdte->Gate.u4Type          = bType;
    45     pIdte->Gate.u2Dpl           = bDpl;
    46     pIdte->Gate.u4Reserved      = 0;
    47     pIdte->Gate.u1DescType      = 0; /* system */
    48     pIdte->Gate.u1Present       = 1;
     36    RTFAR16 BS3_FAR *paIvt = Bs3XptrFlatToCurrent(0);
     37    paIvt[iIvt].off = off;
     38    paIvt[iIvt].sel = uSeg;
    4939}
    5040
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetHandler.c

    r60311 r60527  
    3737
    3838
    39 BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler)
     39#undef Bs3TrapSetHandler
     40BS3_CMN_DEF(PFNBS3TRAPHANDLER, Bs3TrapSetHandler,(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler))
    4041{
    4142    PFNBS3TRAPHANDLER pfnOld = BS3_DATA_NM(BS3_CMN_NM(g_apfnBs3TrapHandlers))[iIdt];
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmp.asm

    r60194 r60527  
    3737BS3_EXTERN_CMN Bs3RegCtxSave
    3838%if TMPL_BITS == 16
    39 BS3_EXTERN_CMN Bs3SelFar32ToFlat32
     39BS3_EXTERN_CMN_FAR Bs3SelFar32ToFlat32
    4040%endif
    4141BS3_EXTERN_DATA16 g_Bs3TrapSetJmpCtx
     
    4949; @uses     See, applicable C calling convention.
    5050;
    51 BS3_PROC_BEGIN_CMN Bs3TrapSetJmp
     51BS3_PROC_BEGIN_CMN Bs3TrapSetJmp, BS3_PBC_HYBRID
    5252        BS3_CALL_CONV_PROLOG 1
    5353        push    xBP
     
    7171        mov     xAX, [xBP + xCB]        ; The return address of this function
    7272        mov     [xBX + BS3REGCTX.rip], xAX
     73%if TMPL_BITS == 16
     74        mov     xAX, [xBP + xCB+2]      ; The return address CS of this function.
     75        mov     [xBX + BS3REGCTX.cs], xAX
     76%endif
    7377        mov     xAX, [xBP]
    7478        mov     [xBX + BS3REGCTX.rbp], xAX
    75         lea     xAX, [xBP + xCB*2]
     79        lea     xAX, [xBP + xCB + cbCurRetAddr]
    7680        mov     [xBX + BS3REGCTX.rsp], xAX
    7781        mov     xAX, [xBP - xCB]
     
    8690%if TMPL_BITS == 16
    8791        push    es
    88         les     di, [xBP + xCB*2]
     92        les     di, [xBP + xCB + cbCurRetAddr]
    8993        mov     cx, BS3TRAPFRAME_size / 2
    9094        mov     ax, 0faceh
     
    104108%if TMPL_BITS == 16
    105109        xor     ax, ax
    106         push    word [xBP + xCB*2 + 2]
     110        push    word [xBP + xCB + cbCurRetAddr + 2]
    107111        push    ax
    108         push    word [xBP + xCB*2]
     112        push    word [xBP + xCB + cbCurRetAddr]
     113        push    cs
    109114        call    Bs3SelFar32ToFlat32
    110115        add     sp, 6h
     
    124129        pop     xBP
    125130        BS3_CALL_CONV_EPILOG 1
    126         ret
     131        BS3_HYBRID_RET
    127132BS3_PROC_END_CMN   Bs3TrapSetJmp
    128133
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetJmpAndRestore.c

    r60311 r60527  
    3131
    3232
    33 BS3_DECL(void) Bs3TrapSetJmpAndRestore(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame)
     33#undef Bs3TrapSetJmpAndRestore
     34BS3_CMN_DEF(void, Bs3TrapSetJmpAndRestore,(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame))
    3435{
    3536    if (Bs3TrapSetJmp(pTrapFrame))
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapUnsetJmp.c

    r60311 r60527  
    4040
    4141
    42 BS3_DECL(void) Bs3TrapUnsetJmp(void)
     42#undef Bs3TrapUnsetJmp
     43BS3_CMN_DEF(void, Bs3TrapUnsetJmp,(void))
    4344{
    4445    g_pBs3TrapSetJmpFrame = 0;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt32Div.c

    r60485 r60527  
    3333
    3434
    35 
    36 void BS3_CMN_NM(Bs3UInt32Div)(RTUINT32U uDividend, RTUINT32U uDivisor, RTUINT32U BS3_FAR *paQuotientReminder)
     35#undef Bs3UInt32Div
     36BS3_CMN_DEF(void, Bs3UInt32Div,(RTUINT32U uDividend, RTUINT32U uDivisor, RTUINT32U BS3_FAR *paQuotientReminder))
    3737{
    3838    RTUInt32DivRem(&paQuotientReminder[0], &paQuotientReminder[1], &uDividend, &uDivisor);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-UInt64Div.c

    r60485 r60527  
    3333
    3434
    35 
    36 void BS3_CMN_NM(Bs3UInt64Div)(RTUINT64U uDividend, RTUINT64U uDivisor, RTUINT64U BS3_FAR *paQuotientReminder)
     35#undef Bs3UInt64Div
     36BS3_CMN_DEF(void, Bs3UInt64Div,(RTUINT64U uDividend, RTUINT64U uDivisor, RTUINT64U BS3_FAR *paQuotientReminder))
    3737{
    3838    RTUInt64DivRem(&paQuotientReminder[0], &paQuotientReminder[1], &uDividend, &uDivisor);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-test.h

    r60439 r60527  
    100100 * @param   pszString   The string.
    101101 */
    102 BS3_DECL(void) bs3TestSendCmdWithStr_c16(uint32_t uCmd, const char BS3_FAR *pszString);
    103 BS3_DECL(void) bs3TestSendCmdWithStr_c32(uint32_t uCmd, const char BS3_FAR *pszString); /**< @copydoc bs3TestSendCmdWithStr_c16 */
    104 BS3_DECL(void) bs3TestSendCmdWithStr_c64(uint32_t uCmd, const char BS3_FAR *pszString); /**< @copydoc bs3TestSendCmdWithStr_c16 */
    105 #define bs3TestSendCmdWithStr BS3_CMN_NM(bs3TestSendCmdWithStr) /**< Selects #bs3TestSendCmdWithStr_c16, #bs3TestSendCmdWithStr_c32 or #bs3TestSendCmdWithStr_c64. */
     102#ifndef DOXYGEN_RUNNING
     103# define bs3TestSendCmdWithStr BS3_CMN_NM(bs3TestSendCmdWithStr)
     104#endif
     105BS3_DECL(void) bs3TestSendCmdWithStr(uint32_t uCmd, const char BS3_FAR *pszString);
    106106
    107107/**
     
    114114 * @param   uValue      The value.
    115115 */
    116 BS3_DECL(void) bs3TestSendCmdWithU32_c16(uint32_t uCmd, uint32_t uValue);
    117 BS3_DECL(void) bs3TestSendCmdWithU32_c32(uint32_t uCmd, uint32_t uValue); /**< @copydoc bs3TestSendCmdWithU32_c16 */
    118 BS3_DECL(void) bs3TestSendCmdWithU32_c64(uint32_t uCmd, uint32_t uValue); /**< @copydoc bs3TestSendCmdWithU32_c16 */
    119 #define bs3TestSendCmdWithU32 BS3_CMN_NM(bs3TestSendCmdWithU32) /**< Selects #bs3TestSendCmdWithU32_c16, #bs3TestSendCmdWithU32_c32 or #bs3TestSendCmdWithU32_c64. */
     116#ifndef DOXYGEN_RUNNING
     117# define bs3TestSendCmdWithU32 BS3_CMN_NM(bs3TestSendCmdWithU32)
     118#endif
     119BS3_DECL(void) bs3TestSendCmdWithU32(uint32_t uCmd, uint32_t uValue);
    120120
    121121/**
     
    124124 * @returns true / false.
    125125 */
    126 BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c16(void);
    127 BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c32(void); /**< @copydoc bs3TestIsVmmDevTestingPresent_c16 */
    128 BS3_DECL(bool) bs3TestIsVmmDevTestingPresent_c64(void); /**< @copydoc bs3TestIsVmmDevTestingPresent_c16 */
    129 #define bs3TestIsVmmDevTestingPresent BS3_CMN_NM(bs3TestIsVmmDevTestingPresent) /**< Selects #bs3TestIsVmmDevTestingPresent_c16, #bs3TestIsVmmDevTestingPresent_c32 or #bs3TestIsVmmDevTestingPresent_c64. */
     126#ifndef DOXYGEN_RUNNING
     127# define bs3TestIsVmmDevTestingPresent BS3_CMN_NM(bs3TestIsVmmDevTestingPresent)
     128#endif
     129BS3_DECL(bool) bs3TestIsVmmDevTestingPresent(void);
    130130
    131131/**
    132132 * Similar to rtTestSubCleanup.
    133133 */
    134 BS3_DECL(void) bs3TestSubCleanup_c16(void);
    135 BS3_DECL(void) bs3TestSubCleanup_c32(void); /**< @copydoc bs3TestSubCleanup_c16 */
    136 BS3_DECL(void) bs3TestSubCleanup_c64(void); /**< @copydoc bs3TestSubCleanup_c16 */
    137 #define bs3TestSubCleanup BS3_CMN_NM(bs3TestSubCleanup) /**< Selects #bs3TestSubCleanup_c16, #bs3TestSubCleanup_c32 or #bs3TestSubCleanup_c64. */
     134#ifndef DOXYGEN_RUNNING
     135# define bs3TestSubCleanup BS3_CMN_NM(bs3TestSubCleanup)
     136#endif
     137BS3_DECL(void) bs3TestSubCleanup(void);
    138138
    139139/**
     
    143143 *      The @a pvUser parameter must point a BS3TESTFAILEDBUF structure. }
    144144 */
    145 BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c16(char ch, void BS3_FAR *pvUser);
    146 BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c32(char ch, void BS3_FAR *pvUser);
    147 BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput_c64(char ch, void BS3_FAR *pvUser);
    148 #define bs3TestFailedStrOutput BS3_CMN_NM(bs3TestFailedStrOutput) /**< Selects #bs3TestFailedStrOutput_c16, #bs3TestFailedStrOutput_c32 or #bs3TestFailedStrOutput_c64. */
     145#ifndef DOXYGEN_RUNNING
     146# define bs3TestFailedStrOutput BS3_CMN_NM(bs3TestFailedStrOutput)
     147#endif
     148BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput(char ch, void BS3_FAR *pvUser);
    149149
    150150/**
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac

    r60439 r60527  
    6565
    6666%ifdef ASM_FORMAT_ELF
    67 section BS3TEXT16_END   align=2 progbits alloc exec nowrite
    68 %else
    69 section _TEXT           align=2 CLASS=BS3CLASS16CODE PUBLIC USE16
    70 section BS3TEXT16_END   align=2 CLASS=BS3CLASS16CODE PUBLIC USE16
     67section BS3TEXT16_NEARSTUBS align=1 progbits alloc exec nowrite
     68section BS3TEXT16_FARSTUBS  align=1 progbits alloc exec nowrite
     69section BS3TEXT16_END       align=1 progbits alloc exec nowrite
     70%else
     71section _TEXT               align=2 CLASS=BS3CLASS16CODE PUBLIC USE16
     72section BS3TEXT16_NEARSTUBS align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
     73section BS3TEXT16_FARSTUBS  align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
     74section BS3TEXT16_END       align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
    7175%endif
    7276
     
    7579%ifndef ASM_FORMAT_ELF
    7680 %ifndef BS3_IS_DOS_EXE
    77 GROUP CGROUP16 BS3TEXT16 BS3TEXT16_END
     81GROUP CGROUP16 BS3TEXT16 _TEXT BS3TEXT16_NEARSTUBS BS3TEXT16_FARSTUBS BS3TEXT16_END
    7882 %else
    79 GROUP CGROUP16 BEGTEXT BS3TEXT16 _TEXT BS3TEXT16_END
     83GROUP CGROUP16 BEGTEXT BS3TEXT16 _TEXT BS3TEXT16_NEARSTUBS BS3TEXT16_FARSTUBS BS3TEXT16_END
    8084 %endif
    8185%endif
     
    148152%endif
    149153
     154;
     155; 16-bit real-mode text
     156;
     157%ifdef ASM_FORMAT_ELF
     158section BS3RMTEXT16_START   align=16 progbits alloc exec nowrite
     159%else
     160section BS3RMTEXT16_START   align=16 CLASS=BS3CLASS16RMCODE PUBLIC USE16
     161%endif
     162BS3_GLOBAL_DATA Bs3RmText16_StartOfSegment, 0
     163    db      10,13,'eye-catcher: BS3RMTEXT16',10,13
     164
     165BS3_BEGIN_RMTEXT16
     166
     167%ifdef ASM_FORMAT_ELF
     168section BS3RMTEXT16_END   align=1 progbits alloc exec nowrite
     169%else
     170section BS3RMTEXT16_END   align=1 CLASS=BS3CLASS16RMCODE PUBLIC USE16
     171%endif
     172
     173BS3_GLOBAL_DATA Bs3RmText16_EndOfSegment, 0
     174
    150175
    151176;
     
    161186section BS3TEXT32_END   align=1 CLASS=BS3CLASS32CODE PUBLIC USE32 FLAT
    162187%endif
    163 
    164188BS3_GLOBAL_DATA Bs3Text32_EndOfSegment, 0
    165189
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm

    r60000 r60527  
    262262.return_stack_ok:
    263263%endif
    264         leave
     264        pop     xBP
    265265        ret
    266 .dbg_str:
    267     db 'CurrentMode=%#x', 0ah, 0
    268266BS3_PROC_END_MODE   Bs3EnteredMode
    269267
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c

    r60311 r60527  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31//#define BS3_USE_RM_TEXT_SEG 1
    3132#include "bs3kit-template-header.h"
    3233#include "bs3-cmn-test.h"
    3334#include <iprt/asm-amd64-x86.h>
     35
     36//#ifdef __WATCOMC__
     37//# pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
     38//#endif
    3439
    3540
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c

    r60321 r60527  
    2828*   Header Files                                                                                                                 *
    2929*********************************************************************************************************************************/
     30#define BS3_USE_RM_TEXT_SEG 1
    3031#include "bs3kit-template-header.h"
    3132#include "bs3-cmn-memory.h"
    3233#include <iprt/asm.h>
     34
     35#ifdef __WATCOMC__
     36# pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
     37#endif
    3338
    3439
     
    234239
    235240
    236 BS3_DECL(void) Bs3InitMemory_rm(void)
     241BS3_DECL(void) BS3_FAR_CODE Bs3InitMemory_rm(void)
    237242{
    238243    uint16_t        i;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.h

    r59863 r60527  
    138138#else /* !DOXYGEN_RUNNING */
    139139
    140 #undef BS3_CMN_NM
     140//#undef BS3_CMN_NM
     141//#undef BS3_CMN_FAR_NM
    141142
    142143
     
    205206# define TMPL_BITS              16
    206207# define TMPL_UNDERSCORE        _
    207 # define BS3_CMN_NM(Name)       RT_CONCAT(Name,_c16)
     208//# define BS3_CMN_NM(Name)       RT_CONCAT(Name,_c16)
     209//# define BS3_CMN_FAR_NM(Name)   RT_CONCAT(Name,_f16)
     210
    208211
    209212#elif (TMPL_MODE & BS3_MODE_CODE_MASK) == BS3_MODE_CODE_32
     
    214217# define TMPL_BITS              32
    215218# define TMPL_UNDERSCORE        _
    216 # define BS3_CMN_NM(Name)       RT_CONCAT(Name,_c32)
     219//# define BS3_CMN_NM(Name)       RT_CONCAT(Name,_c32)
     220//# define BS3_CMN_FAR_NM(a_Name) RT_CONCAT(Name,_c32)
    217221
    218222#elif (TMPL_MODE & BS3_MODE_CODE_MASK) == BS3_MODE_CODE_V86
     
    223227# define TMPL_BITS              16
    224228# define TMPL_UNDERSCORE        _
    225 # define BS3_CMN_NM(Name)       RT_CONCAT(Name,_c16)
     229//# define BS3_CMN_NM(Name)       RT_CONCAT(Name,_c16)
     230//# define BS3_CMN_FAR_NM(Name)   RT_CONCAT(Name,_f16)
    226231# define TMPL_CMN_R86
    227232# define TMPL_CMN_V86
     
    234239# define TMPL_BITS              64
    235240# define TMPL_UNDERSCORE
    236 # define BS3_CMN_NM(Name)       RT_CONCAT(Name,_c64)
     241//# define BS3_CMN_NM(Name)       RT_CONCAT(Name,_c64)
     242//# define BS3_CMN_FAR_NM(a_Name) RT_CONCAT(Name,_c64)
    237243
    238244#else
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r60439 r60527  
    5555 * declarations before we can define it. Thus the duplciate effort.)
    5656 */
    57 #define RT_MANGLER(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
     57#if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
     58# define RT_MANGLER(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
     59#else
     60# define RT_MANGLER(a_Name) RT_CONCAT(a_Name,_f16)
     61#endif
    5862#include <iprt/mangling.h>
    5963#include <iprt/x86.h>
    6064#include <iprt/err.h>
    6165
     66/*
     67 * Include data symbol mangling (function mangling/mapping must be done
     68 * after the protypes).
     69 */
     70#include "bs3kit-mangling-data.h"
    6271
    6372
     
    492501
    493502/** @def BS3_DECL
    494  * Declares a BS3Kit function.
     503 * Declares a BS3Kit function with default far/near.
     504 *
     505 * Until we outgrow BS3TEXT16, we use all near functions in 16-bit.
     506 *
     507 * @param a_Type        The return type. */
     508#if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
     509# define BS3_DECL(a_Type)  BS3_DECL_NEAR(a_Type)
     510#else
     511# define BS3_DECL(a_Type)  BS3_DECL_FAR(a_Type)
     512#endif
     513
     514/** @def BS3_DECL_NEAR
     515 * Declares a BS3Kit function, always near everywhere.
    495516 *
    496517 * Until we outgrow BS3TEXT16, we use all near functions in 16-bit.
     
    498519 * @param a_Type        The return type. */
    499520#ifdef IN_BS3KIT
    500 # define BS3_DECL(a_Type)   DECLEXPORT(a_Type) BS3_NEAR_CODE BS3_CALL
     521# define BS3_DECL_NEAR(a_Type)  DECLEXPORT(a_Type) BS3_NEAR_CODE BS3_CALL
    501522#else
    502 # define BS3_DECL(a_Type)   DECLIMPORT(a_Type) BS3_NEAR_CODE BS3_CALL
     523# define BS3_DECL_NEAR(a_Type)  DECLIMPORT(a_Type) BS3_NEAR_CODE BS3_CALL
     524#endif
     525
     526/** @def BS3_DECL_FAR
     527 * Declares a BS3Kit function, far 16-bit, otherwise near.
     528 *
     529 * Until we outgrow BS3TEXT16, we use all near functions in 16-bit.
     530 *
     531 * @param a_Type        The return type. */
     532#ifdef IN_BS3KIT
     533# define BS3_DECL_FAR(a_Type)   DECLEXPORT(a_Type) BS3_FAR_CODE BS3_CALL
     534#else
     535# define BS3_DECL_FAR(a_Type)   DECLIMPORT(a_Type) BS3_FAR_CODE BS3_CALL
    503536#endif
    504537
     
    521554 *
    522555 * @param   a_Name      The name of the function or global variable.
    523  */
    524 #define BS3_CMN_NM(a_Name)  RT_CONCAT3(a_Name,_c,ARCH_BITS)
     556 * @todo fix code vs data issue with _f16
     557 */
     558#define BS3_CMN_NM(a_Name)      RT_CONCAT3(a_Name,_c,ARCH_BITS)
     559
     560/**
     561 * Constructs a common function name, far in 16-bit code.
     562 *
     563 * Example: BS3_CMN_FAR_NM(Bs3Shutdown)
     564 *
     565 * @param   a_Name      The name of the function.
     566 */
     567#if ARCH_BITS == 16
     568# define BS3_CMN_FAR_NM(a_Name) RT_CONCAT(a_Name,_f16)
     569#else
     570# define BS3_CMN_FAR_NM(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
     571#endif
     572
     573/**
     574 * Constructs a common function name, far or near as defined by the source.
     575 *
     576 * Which to use in 16-bit mode is defined by BS3_USE_RM_TEXT_SEG.  In 32-bit and
     577 * 64-bit mode there are no far symbols, only near ones.
     578 *
     579 * Example: BS3_CMN_FN_NM(Bs3Shutdown)
     580 *
     581 * @param   a_Name      The name of the function.
     582 */
     583#if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
     584# define BS3_CMN_FN_NM(a_Name)  BS3_CMN_NM(a_Name)
     585#else
     586# define BS3_CMN_FN_NM(a_Name)  BS3_CMN_FAR_NM(a_Name)
     587#endif
     588
    525589
    526590/**
    527591 * Constructs a data name.
     592 *
     593 * This glosses over the underscore prefix usage of our 16-bit, 32-bit and
     594 * 64-bit compilers.
    528595 *
    529596 * Example: @code{.c}
     
    533600 *
    534601 * @param   a_Name      The name of the global variable.
     602 * @remarks Mainly used in bs3kit-mangling.h, internal headers and templates.
    535603 */
    536604#if ARCH_BITS == 64
     
    618686/** @defgroup grp_bs3kit_system System structures
    619687 * @{ */
    620 #if ARCH_BITS == 64 && !defined(DOXYGEN_RUNNING)
    621 # define Bs3Gdt                                 BS3_DATA_NM(Bs3Gdt)
    622 # define Bs3Gdt_Ldt                             BS3_DATA_NM(Bs3Gdt_Ldt)
    623 # define Bs3Gdte_Tss16                          BS3_DATA_NM(Bs3Gdte_Tss16)
    624 # define Bs3Gdte_Tss16DoubleFault               BS3_DATA_NM(Bs3Gdte_Tss16DoubleFault)
    625 # define Bs3Gdte_Tss16Spare0                    BS3_DATA_NM(Bs3Gdte_Tss16Spare0)
    626 # define Bs3Gdte_Tss16Spare1                    BS3_DATA_NM(Bs3Gdte_Tss16Spare1)
    627 # define Bs3Gdte_Tss32                          BS3_DATA_NM(Bs3Gdte_Tss32)
    628 # define Bs3Gdte_Tss32DoubleFault               BS3_DATA_NM(Bs3Gdte_Tss32DoubleFault)
    629 # define Bs3Gdte_Tss32Spare0                    BS3_DATA_NM(Bs3Gdte_Tss32Spare0)
    630 # define Bs3Gdte_Tss32Spare1                    BS3_DATA_NM(Bs3Gdte_Tss32Spare1)
    631 # define Bs3Gdte_Tss32IobpIntRedirBm            BS3_DATA_NM(Bs3Gdte_Tss32IobpIntRedirBm)
    632 # define Bs3Gdte_Tss32IntRedirBm                BS3_DATA_NM(Bs3Gdte_Tss32IntRedirBm)
    633 # define Bs3Gdte_Tss64                          BS3_DATA_NM(Bs3Gdte_Tss64)
    634 # define Bs3Gdte_Tss64Spare0                    BS3_DATA_NM(Bs3Gdte_Tss64Spare0)
    635 # define Bs3Gdte_Tss64Spare1                    BS3_DATA_NM(Bs3Gdte_Tss64Spare1)
    636 # define Bs3Gdte_Tss64Iobp                      BS3_DATA_NM(Bs3Gdte_Tss64Iobp)
    637 # define Bs3Gdte_R0_MMIO16                      BS3_DATA_NM(Bs3Gdte_R0_MMIO16)
    638 
    639 # define Bs3Gdte_R0_First                       BS3_DATA_NM(Bs3Gdte_R0_First)
    640 # define Bs3Gdte_R0_CS16                        BS3_DATA_NM(Bs3Gdte_R0_CS16)
    641 # define Bs3Gdte_R0_DS16                        BS3_DATA_NM(Bs3Gdte_R0_DS16)
    642 # define Bs3Gdte_R0_SS16                        BS3_DATA_NM(Bs3Gdte_R0_SS16)
    643 # define Bs3Gdte_R0_CS32                        BS3_DATA_NM(Bs3Gdte_R0_CS32)
    644 # define Bs3Gdte_R0_DS32                        BS3_DATA_NM(Bs3Gdte_R0_DS32)
    645 # define Bs3Gdte_R0_SS32                        BS3_DATA_NM(Bs3Gdte_R0_SS32)
    646 # define Bs3Gdte_R0_CS64                        BS3_DATA_NM(Bs3Gdte_R0_CS64)
    647 # define Bs3Gdte_R0_DS64                        BS3_DATA_NM(Bs3Gdte_R0_DS64)
    648 # define Bs3Gdte_R0_CS16_EO                     BS3_DATA_NM(Bs3Gdte_R0_CS16_EO)
    649 # define Bs3Gdte_R0_CS16_CNF                    BS3_DATA_NM(Bs3Gdte_R0_CS16_CNF)
    650 # define Bs3Gdte_R0_CS16_CND_EO                 BS3_DATA_NM(Bs3Gdte_R0_CS16_CND_EO)
    651 # define Bs3Gdte_R0_CS32_EO                     BS3_DATA_NM(Bs3Gdte_R0_CS32_EO)
    652 # define Bs3Gdte_R0_CS32_CNF                    BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF)
    653 # define Bs3Gdte_R0_CS32_CNF_EO                 BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF_EO)
    654 # define Bs3Gdte_R0_CS64_EO                     BS3_DATA_NM(Bs3Gdte_R0_CS64_EO)
    655 # define Bs3Gdte_R0_CS64_CNF                    BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF)
    656 # define Bs3Gdte_R0_CS64_CNF_EO                 BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF_EO)
    657 
    658 # define Bs3Gdte_R1_First                       BS3_DATA_NM(Bs3Gdte_R1_First)
    659 # define Bs3Gdte_R1_CS16                        BS3_DATA_NM(Bs3Gdte_R1_CS16)
    660 # define Bs3Gdte_R1_DS16                        BS3_DATA_NM(Bs3Gdte_R1_DS16)
    661 # define Bs3Gdte_R1_SS16                        BS3_DATA_NM(Bs3Gdte_R1_SS16)
    662 # define Bs3Gdte_R1_CS32                        BS3_DATA_NM(Bs3Gdte_R1_CS32)
    663 # define Bs3Gdte_R1_DS32                        BS3_DATA_NM(Bs3Gdte_R1_DS32)
    664 # define Bs3Gdte_R1_SS32                        BS3_DATA_NM(Bs3Gdte_R1_SS32)
    665 # define Bs3Gdte_R1_CS64                        BS3_DATA_NM(Bs3Gdte_R1_CS64)
    666 # define Bs3Gdte_R1_DS64                        BS3_DATA_NM(Bs3Gdte_R1_DS64)
    667 # define Bs3Gdte_R1_CS16_EO                     BS3_DATA_NM(Bs3Gdte_R1_CS16_EO)
    668 # define Bs3Gdte_R1_CS16_CNF                    BS3_DATA_NM(Bs3Gdte_R1_CS16_CNF)
    669 # define Bs3Gdte_R1_CS16_CND_EO                 BS3_DATA_NM(Bs3Gdte_R1_CS16_CND_EO)
    670 # define Bs3Gdte_R1_CS32_EO                     BS3_DATA_NM(Bs3Gdte_R1_CS32_EO)
    671 # define Bs3Gdte_R1_CS32_CNF                    BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF)
    672 # define Bs3Gdte_R1_CS32_CNF_EO                 BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF_EO)
    673 # define Bs3Gdte_R1_CS64_EO                     BS3_DATA_NM(Bs3Gdte_R1_CS64_EO)
    674 # define Bs3Gdte_R1_CS64_CNF                    BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF)
    675 # define Bs3Gdte_R1_CS64_CNF_EO                 BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF_EO)
    676 
    677 # define Bs3Gdte_R2_First                       BS3_DATA_NM(Bs3Gdte_R2_First)
    678 # define Bs3Gdte_R2_CS16                        BS3_DATA_NM(Bs3Gdte_R2_CS16)
    679 # define Bs3Gdte_R2_DS16                        BS3_DATA_NM(Bs3Gdte_R2_DS16)
    680 # define Bs3Gdte_R2_SS16                        BS3_DATA_NM(Bs3Gdte_R2_SS16)
    681 # define Bs3Gdte_R2_CS32                        BS3_DATA_NM(Bs3Gdte_R2_CS32)
    682 # define Bs3Gdte_R2_DS32                        BS3_DATA_NM(Bs3Gdte_R2_DS32)
    683 # define Bs3Gdte_R2_SS32                        BS3_DATA_NM(Bs3Gdte_R2_SS32)
    684 # define Bs3Gdte_R2_CS64                        BS3_DATA_NM(Bs3Gdte_R2_CS64)
    685 # define Bs3Gdte_R2_DS64                        BS3_DATA_NM(Bs3Gdte_R2_DS64)
    686 # define Bs3Gdte_R2_CS16_EO                     BS3_DATA_NM(Bs3Gdte_R2_CS16_EO)
    687 # define Bs3Gdte_R2_CS16_CNF                    BS3_DATA_NM(Bs3Gdte_R2_CS16_CNF)
    688 # define Bs3Gdte_R2_CS16_CND_EO                 BS3_DATA_NM(Bs3Gdte_R2_CS16_CND_EO)
    689 # define Bs3Gdte_R2_CS32_EO                     BS3_DATA_NM(Bs3Gdte_R2_CS32_EO)
    690 # define Bs3Gdte_R2_CS32_CNF                    BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF)
    691 # define Bs3Gdte_R2_CS32_CNF_EO                 BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF_EO)
    692 # define Bs3Gdte_R2_CS64_EO                     BS3_DATA_NM(Bs3Gdte_R2_CS64_EO)
    693 # define Bs3Gdte_R2_CS64_CNF                    BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF)
    694 # define Bs3Gdte_R2_CS64_CNF_EO                 BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF_EO)
    695 
    696 # define Bs3Gdte_R3_First                       BS3_DATA_NM(Bs3Gdte_R3_First)
    697 # define Bs3Gdte_R3_CS16                        BS3_DATA_NM(Bs3Gdte_R3_CS16)
    698 # define Bs3Gdte_R3_DS16                        BS3_DATA_NM(Bs3Gdte_R3_DS16)
    699 # define Bs3Gdte_R3_SS16                        BS3_DATA_NM(Bs3Gdte_R3_SS16)
    700 # define Bs3Gdte_R3_CS32                        BS3_DATA_NM(Bs3Gdte_R3_CS32)
    701 # define Bs3Gdte_R3_DS32                        BS3_DATA_NM(Bs3Gdte_R3_DS32)
    702 # define Bs3Gdte_R3_SS32                        BS3_DATA_NM(Bs3Gdte_R3_SS32)
    703 # define Bs3Gdte_R3_CS64                        BS3_DATA_NM(Bs3Gdte_R3_CS64)
    704 # define Bs3Gdte_R3_DS64                        BS3_DATA_NM(Bs3Gdte_R3_DS64)
    705 # define Bs3Gdte_R3_CS16_EO                     BS3_DATA_NM(Bs3Gdte_R3_CS16_EO)
    706 # define Bs3Gdte_R3_CS16_CNF                    BS3_DATA_NM(Bs3Gdte_R3_CS16_CNF)
    707 # define Bs3Gdte_R3_CS16_CND_EO                 BS3_DATA_NM(Bs3Gdte_R3_CS16_CND_EO)
    708 # define Bs3Gdte_R3_CS32_EO                     BS3_DATA_NM(Bs3Gdte_R3_CS32_EO)
    709 # define Bs3Gdte_R3_CS32_CNF                    BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF)
    710 # define Bs3Gdte_R3_CS32_CNF_EO                 BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF_EO)
    711 # define Bs3Gdte_R3_CS64_EO                     BS3_DATA_NM(Bs3Gdte_R3_CS64_EO)
    712 # define Bs3Gdte_R3_CS64_CNF                    BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF)
    713 # define Bs3Gdte_R3_CS64_CNF_EO                 BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF_EO)
    714 
    715 # define Bs3GdteSpare00                         BS3_DATA_NM(Bs3GdteSpare00)
    716 # define Bs3GdteSpare01                         BS3_DATA_NM(Bs3GdteSpare01)
    717 # define Bs3GdteSpare02                         BS3_DATA_NM(Bs3GdteSpare02)
    718 # define Bs3GdteSpare03                         BS3_DATA_NM(Bs3GdteSpare03)
    719 # define Bs3GdteSpare04                         BS3_DATA_NM(Bs3GdteSpare04)
    720 # define Bs3GdteSpare05                         BS3_DATA_NM(Bs3GdteSpare05)
    721 # define Bs3GdteSpare06                         BS3_DATA_NM(Bs3GdteSpare06)
    722 # define Bs3GdteSpare07                         BS3_DATA_NM(Bs3GdteSpare07)
    723 # define Bs3GdteSpare08                         BS3_DATA_NM(Bs3GdteSpare08)
    724 # define Bs3GdteSpare09                         BS3_DATA_NM(Bs3GdteSpare09)
    725 # define Bs3GdteSpare0a                         BS3_DATA_NM(Bs3GdteSpare0a)
    726 # define Bs3GdteSpare0b                         BS3_DATA_NM(Bs3GdteSpare0b)
    727 # define Bs3GdteSpare0c                         BS3_DATA_NM(Bs3GdteSpare0c)
    728 # define Bs3GdteSpare0d                         BS3_DATA_NM(Bs3GdteSpare0d)
    729 # define Bs3GdteSpare0e                         BS3_DATA_NM(Bs3GdteSpare0e)
    730 # define Bs3GdteSpare0f                         BS3_DATA_NM(Bs3GdteSpare0f)
    731 # define Bs3GdteSpare10                         BS3_DATA_NM(Bs3GdteSpare10)
    732 # define Bs3GdteSpare11                         BS3_DATA_NM(Bs3GdteSpare11)
    733 # define Bs3GdteSpare12                         BS3_DATA_NM(Bs3GdteSpare12)
    734 # define Bs3GdteSpare13                         BS3_DATA_NM(Bs3GdteSpare13)
    735 # define Bs3GdteSpare14                         BS3_DATA_NM(Bs3GdteSpare14)
    736 # define Bs3GdteSpare15                         BS3_DATA_NM(Bs3GdteSpare15)
    737 # define Bs3GdteSpare16                         BS3_DATA_NM(Bs3GdteSpare16)
    738 # define Bs3GdteSpare17                         BS3_DATA_NM(Bs3GdteSpare17)
    739 # define Bs3GdteSpare18                         BS3_DATA_NM(Bs3GdteSpare18)
    740 # define Bs3GdteSpare19                         BS3_DATA_NM(Bs3GdteSpare19)
    741 # define Bs3GdteSpare1a                         BS3_DATA_NM(Bs3GdteSpare1a)
    742 # define Bs3GdteSpare1b                         BS3_DATA_NM(Bs3GdteSpare1b)
    743 # define Bs3GdteSpare1c                         BS3_DATA_NM(Bs3GdteSpare1c)
    744 # define Bs3GdteSpare1d                         BS3_DATA_NM(Bs3GdteSpare1d)
    745 # define Bs3GdteSpare1e                         BS3_DATA_NM(Bs3GdteSpare1e)
    746 # define Bs3GdteSpare1f                         BS3_DATA_NM(Bs3GdteSpare1f)
    747 
    748 # define Bs3GdteTiled                           BS3_DATA_NM(Bs3GdteTiled)
    749 # define Bs3GdteFreePart1                       BS3_DATA_NM(Bs3GdteFreePart1)
    750 # define Bs3Gdte_CODE16                         BS3_DATA_NM(Bs3Gdte_CODE16)
    751 # define Bs3GdteFreePart2                       BS3_DATA_NM(Bs3GdteFreePart2)
    752 # define Bs3Gdte_SYSTEM16                       BS3_DATA_NM(Bs3Gdte_SYSTEM16)
    753 # define Bs3GdteFreePart3                       BS3_DATA_NM(Bs3GdteFreePart3)
    754 # define Bs3Gdte_DATA16                         BS3_DATA_NM(Bs3Gdte_DATA16)
    755 
    756 # define Bs3GdteFreePart4                       BS3_DATA_NM(Bs3GdteFreePart4)
    757 # define Bs3GdtePreTestPage08                   BS3_DATA_NM(Bs3GdtePreTestPage08)
    758 # define Bs3GdtePreTestPage07                   BS3_DATA_NM(Bs3GdtePreTestPage07)
    759 # define Bs3GdtePreTestPage06                   BS3_DATA_NM(Bs3GdtePreTestPage06)
    760 # define Bs3GdtePreTestPage05                   BS3_DATA_NM(Bs3GdtePreTestPage05)
    761 # define Bs3GdtePreTestPage04                   BS3_DATA_NM(Bs3GdtePreTestPage04)
    762 # define Bs3GdtePreTestPage03                   BS3_DATA_NM(Bs3GdtePreTestPage03)
    763 # define Bs3GdtePreTestPage02                   BS3_DATA_NM(Bs3GdtePreTestPage02)
    764 # define Bs3GdtePreTestPage01                   BS3_DATA_NM(Bs3GdtePreTestPage01)
    765 # define Bs3GdteTestPage                        BS3_DATA_NM(Bs3GdteTestPage)
    766 # define Bs3GdteTestPage00                      BS3_DATA_NM(Bs3GdteTestPage00)
    767 # define Bs3GdteTestPage01                      BS3_DATA_NM(Bs3GdteTestPage01)
    768 # define Bs3GdteTestPage02                      BS3_DATA_NM(Bs3GdteTestPage02)
    769 # define Bs3GdteTestPage03                      BS3_DATA_NM(Bs3GdteTestPage03)
    770 # define Bs3GdteTestPage04                      BS3_DATA_NM(Bs3GdteTestPage04)
    771 # define Bs3GdteTestPage05                      BS3_DATA_NM(Bs3GdteTestPage05)
    772 # define Bs3GdteTestPage06                      BS3_DATA_NM(Bs3GdteTestPage06)
    773 # define Bs3GdteTestPage07                      BS3_DATA_NM(Bs3GdteTestPage07)
    774 
    775 # define Bs3GdtEnd                              BS3_DATA_NM(Bs3GdtEnd)
    776 
    777 # define Bs3Tss16                               BS3_DATA_NM(Bs3Tss16)
    778 # define Bs3Tss16DoubleFault                    BS3_DATA_NM(Bs3Tss16DoubleFault)
    779 # define Bs3Tss16Spare0                         BS3_DATA_NM(Bs3Tss16Spare0)
    780 # define Bs3Tss16Spare1                         BS3_DATA_NM(Bs3Tss16Spare1)
    781 # define Bs3Tss32                               BS3_DATA_NM(Bs3Tss32)
    782 # define Bs3Tss32DoubleFault                    BS3_DATA_NM(Bs3Tss32DoubleFault)
    783 # define Bs3Tss32Spare0                         BS3_DATA_NM(Bs3Tss32Spare0)
    784 # define Bs3Tss32Spare1                         BS3_DATA_NM(Bs3Tss32Spare1)
    785 # define Bs3Tss64                               BS3_DATA_NM(Bs3Tss64)
    786 # define Bs3Tss64Spare0                         BS3_DATA_NM(Bs3Tss64Spare0)
    787 # define Bs3Tss64Spare1                         BS3_DATA_NM(Bs3Tss64Spare1)
    788 # define Bs3Tss64WithIopb                       BS3_DATA_NM(Bs3Tss64WithIopb)
    789 # define Bs3Tss32WithIopb                       BS3_DATA_NM(Bs3Tss32WithIopb)
    790 # define Bs3SharedIntRedirBm                    BS3_DATA_NM(Bs3SharedIntRedirBm)
    791 # define Bs3SharedIobp                          BS3_DATA_NM(Bs3SharedIobp)
    792 # define Bs3SharedIobpEnd                       BS3_DATA_NM(Bs3SharedIobpEnd)
    793 # define Bs3Idt16                               BS3_DATA_NM(Bs3Idt16)
    794 # define Bs3Idt32                               BS3_DATA_NM(Bs3Idt32)
    795 # define Bs3Idt64                               BS3_DATA_NM(Bs3Idt64)
    796 # define Bs3Lidt_Idt16                          BS3_DATA_NM(Bs3Lidt_Idt16)
    797 # define Bs3Lidt_Idt32                          BS3_DATA_NM(Bs3Lidt_Idt32)
    798 # define Bs3Lidt_Idt64                          BS3_DATA_NM(Bs3Lidt_Idt64)
    799 # define Bs3Lidt_Ivt                            BS3_DATA_NM(Bs3Lidt_Ivt)
    800 # define Bs3Lgdt_Gdt                            BS3_DATA_NM(Bs3Lgdt_Gdt)
    801 # define Bs3Ldt                                 BS3_DATA_NM(Bs3Ldt)
    802 # define Bs3LdtEnd                              BS3_DATA_NM(Bs3LdtEnd)
    803 #endif /* ARCH_BITS == 64 && !DOXYGEN_RUNNING*/
    804 
    805688/** The GDT, indexed by BS3_SEL_XXX shifted by 3. */
    806689extern X86DESC BS3_FAR_DATA Bs3Gdt[(BS3_SEL_GDT_LIMIT + 1) / 8];
     
    1024907 * @{ */
    1025908/** Start of the BS3TEXT16 segment.   */
    1026 #ifndef DOXYGEN_RUNNING
    1027 # define Bs3Text16_StartOfSegment BS3_DATA_NM(Bs3Text16_StartOfSegment)
    1028 #endif
    1029909extern uint8_t  BS3_FAR_DATA Bs3Text16_StartOfSegment;
    1030910/** End of the BS3TEXT16 segment.   */
    1031 #ifndef DOXYGEN_RUNNING
    1032 # define Bs3Text16_EndOfSegment BS3_DATA_NM(Bs3Text16_EndOfSegment)
    1033 #endif
    1034911extern uint8_t  BS3_FAR_DATA Bs3Text16_EndOfSegment;
    1035912/** The size of the BS3TEXT16 segment.   */
    1036 #ifndef DOXYGEN_RUNNING
    1037 # define Bs3Text16_Size BS3_DATA_NM(Bs3Text16_Size)
    1038 #endif
    1039913extern uint16_t BS3_FAR_DATA Bs3Text16_Size;
    1040914
    1041915/** Start of the BS3SYSTEM16 segment.   */
    1042 #ifndef DOXYGEN_RUNNING
    1043 # define Bs3System16_StartOfSegment BS3_DATA_NM(Bs3System16_StartOfSegment)
    1044 #endif
    1045916extern uint8_t  BS3_FAR_DATA Bs3System16_StartOfSegment;
    1046917/** End of the BS3SYSTEM16 segment.   */
    1047 #ifndef DOXYGEN_RUNNING
    1048 # define Bs3System16_EndOfSegment BS3_DATA_NM(Bs3System16_EndOfSegment)
    1049 #endif
    1050918extern uint8_t  BS3_FAR_DATA Bs3System16_EndOfSegment;
    1051919
    1052920/** Start of the BS3DATA16/BS3KIT_GRPNM_DATA16 segment.   */
    1053 #ifndef DOXYGEN_RUNNING
    1054 # define Bs3Data16_StartOfSegment BS3_DATA_NM(Bs3Data16_StartOfSegment)
    1055 #endif
    1056921extern uint8_t  BS3_FAR_DATA Bs3Data16_StartOfSegment;
    1057922/** End of the BS3DATA16/BS3KIT_GRPNM_DATA16 segment.   */
    1058 #ifndef DOXYGEN_RUNNING
    1059 # define Bs3Data16_EndOfSegment BS3_DATA_NM(Bs3Data16_EndOfSegment)
    1060 #endif
    1061923extern uint8_t  BS3_FAR_DATA Bs3Data16_EndOfSegment;
    1062924
    1063925/** Start of the BS3TEXT32 segment.   */
    1064 #ifndef DOXYGEN_RUNNING
    1065 # define Bs3Text32_StartOfSegment BS3_DATA_NM(Bs3Text32_StartOfSegment)
    1066 #endif
    1067926extern uint8_t  BS3_FAR_DATA Bs3Text32_StartOfSegment;
    1068927/** Start of the BS3TEXT32 segment.   */
    1069 #ifndef DOXYGEN_RUNNING
    1070 # define Bs3Text32_EndOfSegment BS3_DATA_NM(Bs3Text32_EndOfSegment)
    1071 #endif
    1072928extern uint8_t  BS3_FAR_DATA Bs3Text32_EndOfSegment;
    1073929
    1074930/** Start of the BS3DATA32 segment.   */
    1075 #ifndef DOXYGEN_RUNNING
    1076 # define Bs3Data32_StartOfSegment BS3_DATA_NM(Bs3Data32_StartOfSegment)
    1077 #endif
    1078931extern uint8_t  BS3_FAR_DATA Bs3Data32_StartOfSegment;
    1079932/** Start of the BS3DATA32 segment.   */
    1080 #ifndef DOXYGEN_RUNNING
    1081 # define Bs3Data32_EndOfSegment BS3_DATA_NM(Bs3Data32_EndOfSegment)
    1082 #endif
    1083933extern uint8_t  BS3_FAR_DATA Bs3Data32_EndOfSegment;
    1084934
    1085935/** Start of the BS3TEXT64 segment.   */
    1086 #ifndef DOXYGEN_RUNNING
    1087 # define Bs3Text64_StartOfSegment BS3_DATA_NM(Bs3Text64_StartOfSegment)
    1088 #endif
    1089936extern uint8_t  BS3_FAR_DATA Bs3Text64_StartOfSegment;
    1090937/** Start of the BS3TEXT64 segment.   */
    1091 #ifndef DOXYGEN_RUNNING
    1092 # define Bs3Text64_EndOfSegment BS3_DATA_NM(Bs3Text64_EndOfSegment)
    1093 #endif
    1094938extern uint8_t  BS3_FAR_DATA Bs3Text64_EndOfSegment;
    1095939
    1096940/** Start of the BS3DATA64 segment.   */
    1097 #ifndef DOXYGEN_RUNNING
    1098 # define Bs3Data64_StartOfSegment BS3_DATA_NM(Bs3Data64_StartOfSegment)
    1099 #endif
    1100941extern uint8_t  BS3_FAR_DATA Bs3Data64_StartOfSegment;
    1101942/** Start of the BS3DATA64 segment.   */
    1102 #ifndef DOXYGEN_RUNNING
    1103 # define Bs3Data64_EndOfSegment BS3_DATA_NM(Bs3Data64_EndOfSegment)
    1104 #endif
    1105943extern uint8_t  BS3_FAR_DATA Bs3Data64_EndOfSegment;
    1106944
    1107945/** The size of the Data16, Text32, Text64, Data32 and Data64 blob. */
    1108 #ifndef DOXYGEN_RUNNING
    1109 # define Bs3Data16Thru64Text32And64_TotalSize BS3_DATA_NM(Bs3Data16Thru64Text32And64_TotalSize)
    1110 #endif
    1111946extern uint32_t BS3_FAR_DATA Bs3Data16Thru64Text32And64_TotalSize;
    1112947/** The total image size (from Text16 thu Data64). */
    1113 #ifndef DOXYGEN_RUNNING
    1114 # define Bs3TotalImageSize BS3_DATA_NM(Bs3TotalImageSize)
    1115 #endif
    1116948extern uint32_t BS3_FAR_DATA Bs3TotalImageSize;
    1117949/** @} */
     
    1119951
    1120952/** Lower case hex digits. */
    1121 #ifndef DOXYGEN_RUNNING
    1122 # define g_achBs3HexDigits BS3_DATA_NM(g_achBs3HexDigits)
    1123 #endif
    1124953extern char const g_achBs3HexDigits[16+1];
    1125954/** Upper case hex digits. */
    1126 #ifndef DOXYGEN_RUNNING
    1127 # define g_achBs3HexDigitsUpper BS3_DATA_NM(g_achBs3HexDigitsUpper)
    1128 #endif
    1129955extern char const g_achBs3HexDigitsUpper[16+1];
    1130956
    1131957
    1132958/** The current mode (BS3_MODE_XXX) of CPU \#0. */
    1133 #ifndef DOXYGEN_RUNNING
    1134 # define g_bBs3CurrentMode BS3_DATA_NM(g_bBs3CurrentMode)
    1135 #endif
    1136959extern uint8_t    g_bBs3CurrentMode;
    1137960
    1138961/** Hint for 16-bit trap handlers regarding the high word of EIP. */
    1139 #ifndef DOXYGEN_RUNNING
    1140 # define g_uBs3TrapEipHint BS3_DATA_NM(g_uBs3TrapEipHint)
    1141 #endif
    1142962extern uint32_t   g_uBs3TrapEipHint;
     963
     964/** Copy of the original real-mode interrupt vector table. */
     965extern RTFAR16 g_aBs3RmIvtOriginal[256];
    1143966
    1144967
     
    14031226 */
    14041227
     1228/** @def BS3_CMN_PROTO
     1229 * Macro for prototyping all the variations of a common function.
     1230 * @param   a_RetType   The return type.
     1231 * @param   a_Name      The function basename.
     1232 * @param   a_Params    The parameter list (in parentheses).
     1233 * @param   a_fAutoStub Whether to autogenerate a 16-bit near -> 16-bit far stub
     1234 *                      function. Either 'true' for stub or 'false' for no stub.
     1235 */
     1236#if ARCH_BITS == 16
     1237# define BS3_CMN_PROTO(a_RetType, a_Name, a_Params, a_fAutoStub) \
     1238    BS3_DECL_NEAR(a_RetType) BS3_CMN_NM(a_Name) a_Params;  \
     1239    BS3_DECL_FAR(a_RetType)  BS3_CMN_FAR_NM(a_Name) a_Params
     1240#else
     1241# define BS3_CMN_PROTO(a_RetType, a_Name, a_Params, a_fAutoStub) \
     1242    BS3_DECL_NEAR(a_RetType) BS3_CMN_NM(a_Name) a_Params
     1243#endif
     1244
     1245/** @def BS3_CMN_DEF
     1246 * Macro for defining a common function.
     1247 *
     1248 * This makes 16-bit common function far, while 32-bit and 64-bit are near.
     1249 *
     1250 * @param   a_RetType   The return type.
     1251 * @param   a_Name      The function basename.
     1252 * @param   a_Params    The parameter list (in parentheses).
     1253 */
     1254#if ARCH_BITS == 16
     1255# define BS3_CMN_DEF(a_RetType, a_Name, a_Params) \
     1256    BS3_DECL_FAR(a_RetType)  BS3_CMN_FAR_NM(a_Name) a_Params
     1257#else
     1258# define BS3_CMN_DEF(a_RetType, a_Name, a_Params) \
     1259    BS3_DECL_NEAR(a_RetType) BS3_CMN_NM(a_Name) a_Params
     1260#endif
     1261
     1262/** @def BS3_ASSERT
     1263 * Assert that an expression is true.
     1264 *
     1265 * Calls Bs3Panic if false and it's a strict build.  Does nothing in
     1266 * non-strict builds.  */
    14051267#ifdef BS3_STRICT
    14061268# define BS3_ASSERT(a_Expr) do { if (!!(a_Expr)) { /* likely */ } else { Bs3Panic(); } } while (0) /**< @todo later */
     
    14141276 * The current implementation will only halt the CPU.
    14151277 */
    1416 BS3_DECL(DECL_NO_RETURN(void)) Bs3Panic_c16(void);
    1417 BS3_DECL(DECL_NO_RETURN(void)) Bs3Panic_c32(void); /**< @copydoc Bs3Panic_c16  */
    1418 BS3_DECL(DECL_NO_RETURN(void)) Bs3Panic_c64(void); /**< @copydoc Bs3Panic_c16  */
    1419 #define Bs3Panic BS3_CMN_NM(Bs3Panic) /**< Selects #Bs3Panic_c16, #Bs3Panic_c32 or #Bs3Panic_c64. */
     1278BS3_CMN_PROTO(DECL_NO_RETURN(void), Bs3Panic,(void), false);
    14201279#if !defined(BS3_KIT_WITH_NO_RETURN) && defined(__WATCOMC__)
    14211280# pragma aux Bs3Panic_c16 __aborts
     1281# pragma aux Bs3Panic_f16 __aborts
    14221282# pragma aux Bs3Panic_c32 __aborts
    14231283#endif
     
    14291289 * just halt the CPU.
    14301290 */
    1431 BS3_DECL(void) Bs3Shutdown_c16(void);
    1432 BS3_DECL(void) Bs3Shutdown_c32(void); /**< @copydoc Bs3Shutdown_c16 */
    1433 BS3_DECL(void) Bs3Shutdown_c64(void); /**< @copydoc Bs3Shutdown_c16 */
    1434 #define Bs3Shutdown BS3_CMN_NM(Bs3Shutdown) /**< Selects #Bs3Shutdown_c16, #Bs3Shutdown_c32 or #Bs3Shutdown_c64. */
     1291BS3_CMN_PROTO(void, Bs3Shutdown,(void), false);
    14351292
    14361293/**
     
    14391296 * @param   uValue      The 32-bit value.
    14401297 */
    1441 BS3_DECL(void) Bs3PrintU32_c16(uint32_t uValue);
    1442 BS3_DECL(void) Bs3PrintU32_c32(uint32_t uValue); /**< @copydoc Bs3PrintU32_c16 */
    1443 BS3_DECL(void) Bs3PrintU32_c64(uint32_t uValue); /**< @copydoc Bs3PrintU32_c16 */
    1444 #define Bs3PrintU32 BS3_CMN_NM(Bs3PrintU32) /**< Selects #Bs3PrintU32_c16, #Bs3PrintU32_c32 or #Bs3PrintU32_c64. */
     1298BS3_CMN_PROTO(void, Bs3PrintU32,(uint32_t uValue), false);
    14451299
    14461300/**
     
    14491303 * @param   uValue      The 32-bit value.
    14501304 */
    1451 BS3_DECL(void) Bs3PrintX32_c16(uint32_t uValue);
    1452 BS3_DECL(void) Bs3PrintX32_c32(uint32_t uValue); /**< @copydoc Bs3PrintX32_c16 */
    1453 BS3_DECL(void) Bs3PrintX32_c64(uint32_t uValue); /**< @copydoc Bs3PrintX32_c16 */
    1454 #define Bs3PrintX32 BS3_CMN_NM(Bs3PrintX32) /**< Selects #Bs3PrintX32_c16, #Bs3PrintX32_c32 or #Bs3PrintX32_c64. */
     1305BS3_CMN_PROTO(void, Bs3PrintX32,(uint32_t uValue), false);
    14551306
    14561307/**
     
    14621313 * @param   ...             Format arguments.
    14631314 */
    1464 BS3_DECL(size_t) Bs3Printf_c16(const char BS3_FAR *pszFormat, ...);
    1465 BS3_DECL(size_t) Bs3Printf_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3Printf_c16 */
    1466 BS3_DECL(size_t) Bs3Printf_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3Printf_c16 */
    1467 #define Bs3Printf BS3_CMN_NM(Bs3Printf) /**< Selects #Bs3Printf_c16, #Bs3Printf_c32 or #Bs3Printf_c64. */
     1315BS3_CMN_PROTO(size_t, Bs3Printf,(const char BS3_FAR *pszFormat, ...), true);
    14681316
    14691317/**
     
    14751323 * @param   va              Format arguments.
    14761324 */
    1477 BS3_DECL(size_t) Bs3PrintfV_c16(const char BS3_FAR *pszFormat, va_list va);
    1478 BS3_DECL(size_t) Bs3PrintfV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3PrintfV_c16 */
    1479 BS3_DECL(size_t) Bs3PrintfV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3PrintfV_c16 */
    1480 #define Bs3PrintfV BS3_CMN_NM(Bs3PrintfV) /**< Selects #Bs3PrintfV_c16, #Bs3PrintfV_c32 or #Bs3PrintfV_c64. */
     1325BS3_CMN_PROTO(size_t, Bs3PrintfV,(const char BS3_FAR *pszFormat, va_list va), true);
    14811326
    14821327/**
     
    14851330 * @param   pszString       The string to print.
    14861331 */
    1487 BS3_DECL(void) Bs3PrintStr_c16(const char BS3_FAR *pszString);
    1488 BS3_DECL(void) Bs3PrintStr_c32(const char BS3_FAR *pszString); /**< @copydoc Bs3PrintStr_c16 */
    1489 BS3_DECL(void) Bs3PrintStr_c64(const char BS3_FAR *pszString); /**< @copydoc Bs3PrintStr_c16 */
    1490 #define Bs3PrintStr BS3_CMN_NM(Bs3PrintStr) /**< Selects #Bs3PrintStr_c16, #Bs3PrintStr_c32 or #Bs3PrintStr_c64. */
     1332BS3_CMN_PROTO(void, Bs3PrintStr,(const char BS3_FAR *pszString), true);
    14911333
    14921334/**
     
    14961338 * @param   cchString       The exact number of characters to print.
    14971339 */
    1498 BS3_DECL(void) Bs3PrintStrN_c16(const char BS3_FAR *pszString, size_t cchString);
    1499 BS3_DECL(void) Bs3PrintStrN_c32(const char BS3_FAR *pszString, size_t cchString); /**< @copydoc Bs3PrintStrN_c16 */
    1500 BS3_DECL(void) Bs3PrintStrN_c64(const char BS3_FAR *pszString, size_t cchString); /**< @copydoc Bs3PrintStrN_c16 */
    1501 #define Bs3PrintStrN BS3_CMN_NM(Bs3PrintStrN) /**< Selects #Bs3PrintStrN_c16, #Bs3PrintStrN_c32 or #Bs3PrintStrN_c64. */
     1340BS3_CMN_PROTO(void, Bs3PrintStrN,(const char BS3_FAR *pszString, size_t cchString), false);
    15021341
    15031342/**
     
    15061345 * @param   ch              The character to print.
    15071346 */
    1508 BS3_DECL(void) Bs3PrintChr_c16(char ch);
    1509 BS3_DECL(void) Bs3PrintChr_c32(char ch); /**< @copydoc Bs3PrintChr_c16 */
    1510 BS3_DECL(void) Bs3PrintChr_c64(char ch); /**< @copydoc Bs3PrintChr_c16 */
    1511 #define Bs3PrintChr BS3_CMN_NM(Bs3PrintChr) /**< Selects #Bs3PrintChr_c16, #Bs3PrintChr_c32 or #Bs3PrintChr_c64. */
     1347BS3_CMN_PROTO(void, Bs3PrintChr,(char ch), false);
    15121348
    15131349
     
    15431379 * @param   pvUser      The user argument for the output function.
    15441380 */
    1545 BS3_DECL(size_t) Bs3StrFormatV_c16(const char BS3_FAR *pszFormat, va_list va,
    1546                                    PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser);
    1547 /** @copydoc Bs3StrFormatV_c16  */
    1548 BS3_DECL(size_t) Bs3StrFormatV_c32(const char BS3_FAR *pszFormat, va_list va,
    1549                                    PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser);
    1550 /** @copydoc Bs3StrFormatV_c16  */
    1551 BS3_DECL(size_t) Bs3StrFormatV_c64(const char BS3_FAR *pszFormat, va_list va,
    1552                                    PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser);
    1553 #define Bs3StrFormatV BS3_CMN_NM(Bs3StrFormatV) /**< Selects #Bs3StrFormatV_c16, #Bs3StrFormatV_c32 or #Bs3StrFormatV_c64. */
     1381BS3_CMN_PROTO(size_t, Bs3StrFormatV,(const char BS3_FAR *pszFormat, va_list va,
     1382                                     PFNBS3STRFORMATOUTPUT pfnOutput, void BS3_FAR *pvUser), true);
    15541383
    15551384/**
     
    15651394 * @param   va          Format arguments.
    15661395 */
    1567 BS3_DECL(size_t) Bs3StrPrintfV_c16(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va);
    1568 /** @copydoc Bs3StrPrintfV_c16  */
    1569 BS3_DECL(size_t) Bs3StrPrintfV_c32(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va);
    1570 /** @copydoc Bs3StrPrintfV_c16  */
    1571 BS3_DECL(size_t) Bs3StrPrintfV_c64(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va);
    1572 #define Bs3StrPrintfV BS3_CMN_NM(Bs3StrPrintfV) /**< Selects #Bs3StrPrintfV_c16, #Bs3StrPrintfV_c32 or #Bs3StrPrintfV_c64. */
     1396BS3_CMN_PROTO(size_t, Bs3StrPrintfV,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, va_list va), true);
    15731397
    15741398/**
     
    15841408 * @param   ...         Format arguments.
    15851409 */
    1586 BS3_DECL(size_t) Bs3StrPrintf_c16(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...);
    1587 /** @copydoc Bs3StrPrintf_c16  */
    1588 BS3_DECL(size_t) Bs3StrPrintf_c32(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...);
    1589 /** @copydoc Bs3StrPrintf_c16  */
    1590 BS3_DECL(size_t) Bs3StrPrintf_c64(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...);
    1591 #define Bs3StrPrintf BS3_CMN_NM(Bs3StrPrintf) /**< Selects #Bs3StrPrintf_c16, #Bs3StrPrintf_c32 or #Bs3StrPrintf_c64. */
     1410BS3_CMN_PROTO(size_t, Bs3StrPrintf,(char BS3_FAR *pszBuf, size_t cbBuf, const char BS3_FAR *pszFormat, ...), true);
    15921411
    15931412
     
    15981417 * @param   pszString       The string to examine.
    15991418 */
    1600 BS3_DECL(size_t) Bs3StrLen_c16(const char BS3_FAR *pszString);
    1601 BS3_DECL(size_t) Bs3StrLen_c32(const char BS3_FAR *pszString); /** @copydoc Bs3StrLen_c16 */
    1602 BS3_DECL(size_t) Bs3StrLen_c64(const char BS3_FAR *pszString); /** @copydoc Bs3StrLen_c16 */
    1603 #define Bs3StrLen BS3_CMN_NM(Bs3StrLen) /**< Selects #Bs3StrLen_c16, #Bs3StrLen_c32 or #Bs3StrLen_c64. */
     1419BS3_CMN_PROTO(size_t, Bs3StrLen,(const char BS3_FAR *pszString), true);
    16041420
    16051421/**
     
    16111427 * @param   cchMax          The max length to examine.
    16121428 */
    1613 BS3_DECL(size_t) Bs3StrNLen_c16(const char BS3_FAR *pszString, size_t cchMax);
    1614 BS3_DECL(size_t) Bs3StrNLen_c32(const char BS3_FAR *pszString, size_t cchMax); /** @copydoc Bs3StrNLen_c16 */
    1615 BS3_DECL(size_t) Bs3StrNLen_c64(const char BS3_FAR *pszString, size_t cchMax); /** @copydoc Bs3StrNLen_c16 */
    1616 #define Bs3StrNLen BS3_CMN_NM(Bs3StrNLen) /**< Selects #Bs3StrNLen_c16, #Bs3StrNLen_c32 or #Bs3StrNLen_c64. */
     1429BS3_CMN_PROTO(size_t, Bs3StrNLen,(const char BS3_FAR *pszString, size_t cchMax), true);
    16171430
    16181431/**
     
    16241437 * @param   pszSrc          The source string.
    16251438 */
    1626 BS3_DECL(char BS3_FAR *) Bs3StrCpy_c16(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc);
    1627 BS3_DECL(char BS3_FAR *) Bs3StrCpy_c32(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc); /** @copydoc Bs3StrCpy_c16 */
    1628 BS3_DECL(char BS3_FAR *) Bs3StrCpy_c64(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc); /** @copydoc Bs3StrCpy_c16 */
    1629 #define Bs3StrCpy BS3_CMN_NM(Bs3StrCpy) /**< Selects #Bs3StrCpy_c16, #Bs3StrCpy_c32 or #Bs3StrCpy_c64. */
     1439BS3_CMN_PROTO(char BS3_FAR *, Bs3StrCpy,(char BS3_FAR *pszDst, const char BS3_FAR *pszSrc), true);
    16301440
    16311441/**
     
    16371447 * @param   cbCopy          The number of bytes to copy.
    16381448 */
    1639 BS3_DECL(void BS3_FAR *) Bs3MemCpy_c16(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy);
    1640 BS3_DECL(void BS3_FAR *) Bs3MemCpy_c32(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemCpy_c16 */
    1641 BS3_DECL(void BS3_FAR *) Bs3MemCpy_c64(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemCpy_c16 */
    1642 #define Bs3MemCpy BS3_CMN_NM(Bs3MemCpy) /**< Selects #Bs3MemCpy_c16, #Bs3MemCpy_c32 or #Bs3MemCpy_c64. */
     1449BS3_CMN_PROTO(void BS3_FAR *, Bs3MemCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
    16431450
    16441451/**
     
    16501457 * @param   cbCopy          The number of bytes to copy.
    16511458 */
    1652 BS3_DECL(void BS3_FAR *) Bs3MemPCpy_c16(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy);
    1653 BS3_DECL(void BS3_FAR *) Bs3MemPCpy_c32(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemPCpy_c16 */
    1654 BS3_DECL(void BS3_FAR *) Bs3MemPCpy_c64(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemPCpy_c16 */
    1655 #define Bs3MemPCpy BS3_CMN_NM(Bs3MemPCpy) /**< Selects #Bs3MemPCpy_c16, #Bs3MemPCpy_c32 or #Bs3MemPCpy_c64. */
     1459BS3_CMN_PROTO(void BS3_FAR *, Bs3MemPCpy,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
    16561460
    16571461/**
     
    16631467 * @param   cbCopy          The number of bytes to copy.
    16641468 */
    1665 BS3_DECL(void BS3_FAR *) Bs3MemMove_c16(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy);
    1666 BS3_DECL(void BS3_FAR *) Bs3MemMove_c32(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemMove_c16 */
    1667 BS3_DECL(void BS3_FAR *) Bs3MemMove_c64(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy); /** @copydoc Bs3MemMove_c16 */
    1668 #define Bs3MemMove BS3_CMN_NM(Bs3MemMove) /**< Selects #Bs3MemMove_c16, #Bs3MemMove_c32 or #Bs3MemMove_c64. */
     1469BS3_CMN_PROTO(void BS3_FAR *, Bs3MemMove,(void BS3_FAR *pvDst, const void BS3_FAR *pvSrc, size_t cbToCopy), true);
    16691470
    16701471/**
     
    16741475 * @param   cbDst           The number of bytes to zero.
    16751476 */
    1676 BS3_DECL(void) Bs3MemZero_c16(void BS3_FAR *pvDst, size_t cbDst);
    1677 BS3_DECL(void) Bs3MemZero_c32(void BS3_FAR *pvDst, size_t cbDst); /** @copydoc Bs3MemZero_c16 */
    1678 BS3_DECL(void) Bs3MemZero_c64(void BS3_FAR *pvDst, size_t cbDst); /** @copydoc Bs3MemZero_c16 */
    1679 #define Bs3MemZero BS3_CMN_NM(Bs3MemZero) /**< Selects #Bs3MemZero_c16, #Bs3MemZero_c32 or #Bs3MemZero_c64. */
     1477BS3_CMN_PROTO(void, Bs3MemZero,(void BS3_FAR *pvDst, size_t cbDst), false);
    16801478
    16811479
     
    16871485 * @param   uSel            The protected mode segment selector.
    16881486 */
    1689 BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32_c16(uint32_t off, uint16_t uSel);
    1690 BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32_c32(uint32_t off, uint16_t uSel); /**< @copydoc Bs3SelProtFar32ToFlat32_c16 */
    1691 BS3_DECL(uint32_t) Bs3SelProtFar32ToFlat32_c64(uint32_t off, uint16_t uSel); /**< @copydoc Bs3SelProtFar32ToFlat32_c16 */
    1692 #define Bs3SelProtFar32ToFlat32 BS3_CMN_NM(Bs3SelProtFar32ToFlat32) /**< Selects #Bs3SelProtFar32ToFlat32_c16, #Bs3SelProtFar32ToFlat32_c32 or #Bs3SelProtFar32ToFlat32_c64. */
     1487BS3_CMN_PROTO(uint32_t, Bs3SelProtFar32ToFlat32,(uint32_t off, uint16_t uSel), true);
    16931488
    16941489
     
    17001495 * @param   uSel            The current mode segment selector.
    17011496 */
    1702 BS3_DECL(uint32_t) Bs3SelFar32ToFlat32_c16(uint32_t off, uint16_t uSel);
    1703 BS3_DECL(uint32_t) Bs3SelFar32ToFlat32_c32(uint32_t off, uint16_t uSel); /**< @copydoc Bs3SelFar32ToFlat32_c16 */
    1704 BS3_DECL(uint32_t) Bs3SelFar32ToFlat32_c64(uint32_t off, uint16_t uSel); /**< @copydoc Bs3SelFar32ToFlat32_c16 */
    1705 #define Bs3SelFar32ToFlat32 BS3_CMN_NM(Bs3SelFar32ToFlat32) /**< Selects #Bs3SelFar32ToFlat32_c16, #Bs3SelFar32ToFlat32_c32 or #Bs3SelFar32ToFlat32_c64. */
     1497BS3_CMN_PROTO(uint32_t, Bs3SelFar32ToFlat32,(uint32_t off, uint16_t uSel), true);
    17061498
    17071499/**
     
    17141506{
    17151507#if ARCH_BITS == 16
    1716     return Bs3SelFar32ToFlat32(BS3_FP_OFF(pv), BS3_FP_SEG(pv));
     1508    return BS3_CMN_FN_NM(Bs3SelFar32ToFlat32)(BS3_FP_OFF(pv), BS3_FP_SEG(pv));
    17171509#else
    17181510    return (uintptr_t)pv;
     
    17841576 * @param   cbChunk         The chunk size.
    17851577 */
    1786 BS3_DECL(void) Bs3SlabInit_c16(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk);
    1787 /** @copydoc Bs3SlabInit_c16 */
    1788 BS3_DECL(void) Bs3SlabInit_c32(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk);
    1789 /** @copydoc Bs3SlabInit_c16 */
    1790 BS3_DECL(void) Bs3SlabInit_c64(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr, uint32_t cbSlab, uint16_t cbChunk);
    1791 #define Bs3SlabInit BS3_CMN_NM(Bs3SlabInit) /**< Selects #Bs3SlabInit_c16, #Bs3SlabInit_c32 or #Bs3SlabInit_c64. */
     1578BS3_CMN_PROTO(void, Bs3SlabInit,(PBS3SLABCTL pSlabCtl, size_t cbSlabCtl, uint32_t uFlatSlabPtr,
     1579                                 uint32_t cbSlab, uint16_t cbChunk), true);
    17921580
    17931581/**
     
    17971585 * @param   pSlabCtl        The slab constrol structure to allocate from.
    17981586 */
    1799 BS3_DECL(void BS3_FAR *) Bs3SlabAlloc_c16(PBS3SLABCTL pSlabCtl);
    1800 BS3_DECL(void BS3_FAR *) Bs3SlabAlloc_c32(PBS3SLABCTL pSlabCtl); /**< @copydoc Bs3SlabAlloc_c16 */
    1801 BS3_DECL(void BS3_FAR *) Bs3SlabAlloc_c64(PBS3SLABCTL pSlabCtl); /**< @copydoc Bs3SlabAlloc_c16 */
    1802 #define Bs3SlabAlloc BS3_CMN_NM(Bs3SlabAlloc) /**< Selects #Bs3SlabAlloc_c16, #Bs3SlabAlloc_c32 or #Bs3SlabAlloc_c64. */
     1587BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabAlloc,(PBS3SLABCTL pSlabCtl), true);
    18031588
    18041589/**
     
    18111596 * @param   fFlags          Flags, see BS3_SLAB_ALLOC_F_XXX
    18121597 */
    1813 BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx_c16(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags);
    1814 BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx_c32(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags); /**< @copydoc Bs3SlabAllocEx_c16 */
    1815 BS3_DECL(void BS3_FAR *) Bs3SlabAllocEx_c64(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags); /**< @copydoc Bs3SlabAllocEx_c16 */
    1816 #define Bs3SlabAllocEx BS3_CMN_NM(Bs3SlabAllocEx) /**< Selects #Bs3SlabAllocEx_c16, #Bs3SlabAllocEx_c32 or #Bs3SlabAllocEx_c64. */
     1598BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabAllocEx,(PBS3SLABCTL pSlabCtl, uint16_t cChunks, uint16_t fFlags), true);
    18171599
    18181600/**
     
    18251607 * @param   cChunks         The number of contiguous chunks to free.
    18261608 */
    1827 BS3_DECL(uint16_t) Bs3SlabFree_c16(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks);
    1828 BS3_DECL(uint16_t) Bs3SlabFree_c32(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks); /**< @copydoc Bs3SlabFree_c16 */
    1829 BS3_DECL(uint16_t) Bs3SlabFree_c64(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks); /**< @copydoc Bs3SlabFree_c16 */
    1830 #define Bs3SlabFree BS3_CMN_NM(Bs3SlabFree) /**< Selects #Bs3SlabFree_c16, #Bs3SlabFree_c32 or #Bs3SlabFree_c64. */
     1609BS3_CMN_PROTO(uint16_t, Bs3SlabFree,(PBS3SLABCTL pSlabCtl, uint32_t uFlatChunkPtr, uint16_t cChunks), true);
    18311610
    18321611
     
    18371616 * @param   cbChunk     The chunk size.
    18381617 */
    1839 BS3_DECL(void) Bs3SlabListInit_c16(PBS3SLABHEAD pHead, uint16_t cbChunk);
    1840 BS3_DECL(void) Bs3SlabListInit_c32(PBS3SLABHEAD pHead, uint16_t cbChunk); /**< @copydoc Bs3SlabListInit_c16 */
    1841 BS3_DECL(void) Bs3SlabListInit_c64(PBS3SLABHEAD pHead, uint16_t cbChunk); /**< @copydoc Bs3SlabListInit_c16 */
    1842 #define Bs3SlabListInit BS3_CMN_NM(Bs3SlabListInit) /**< Selects #Bs3SlabListInit_c16, #Bs3SlabListInit_c32 or #Bs3SlabListInit_c64. */
     1618BS3_CMN_PROTO(void, Bs3SlabListInit,(PBS3SLABHEAD pHead, uint16_t cbChunk), true);
    18431619
    18441620/**
     
    18481624 * @param   pSlabCtl        The slab control structure to add.
    18491625 */
    1850 BS3_DECL(void) Bs3SlabListAdd_c16(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl);
    1851 /** @copydoc Bs3SlabListAdd_c16 */
    1852 BS3_DECL(void) Bs3SlabListAdd_c32(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl);
    1853 /** @copydoc Bs3SlabListAdd_c16 */
    1854 BS3_DECL(void) Bs3SlabListAdd_c64(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl);
    1855 #define Bs3SlabListAdd BS3_CMN_NM(Bs3SlabListAdd) /**< Selects #Bs3SlabListAdd_c16, #Bs3SlabListAdd_c32 or #Bs3SlabListAdd_c64. */
     1626BS3_CMN_PROTO(void, Bs3SlabListAdd,(PBS3SLABHEAD pHead, PBS3SLABCTL pSlabCtl), true);
    18561627
    18571628/**
     
    18611632 * @param   pHead           The slab list to allocate from.
    18621633 */
    1863 BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc_c16(PBS3SLABHEAD pHead);
    1864 BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc_c32(PBS3SLABHEAD pHead); /**< @copydoc Bs3SlabListAlloc_c16 */
    1865 BS3_DECL(void BS3_FAR *) Bs3SlabListAlloc_c64(PBS3SLABHEAD pHead); /**< @copydoc Bs3SlabListAlloc_c16 */
    1866 #define Bs3SlabListAlloc BS3_CMN_NM(Bs3SlabListAlloc) /**< Selects #Bs3SlabListAlloc_c16, #Bs3SlabListAlloc_c32 or #Bs3SlabListAlloc_c64. */
     1634BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabListAlloc,(PBS3SLABHEAD pHead), true);
    18671635
    18681636/**
     
    18751643 * @param   fFlags          Flags, see BS3_SLAB_ALLOC_F_XXX
    18761644 */
    1877 BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx_c16(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags);
    1878 BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx_c32(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags); /**< @copydoc Bs3SlabListAllocEx_c16 */
    1879 BS3_DECL(void BS3_FAR *) Bs3SlabListAllocEx_c64(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags); /**< @copydoc Bs3SlabListAllocEx_c16 */
    1880 #define Bs3SlabListAllocEx BS3_CMN_NM(Bs3SlabListAllocEx) /**< Selects #Bs3SlabListAllocEx_c16, #Bs3SlabListAllocEx_c32 or #Bs3SlabListAllocEx_c64. */
     1645BS3_CMN_PROTO(void BS3_FAR *, Bs3SlabListAllocEx,(PBS3SLABHEAD pHead, uint16_t cChunks, uint16_t fFlags), true);
    18811646
    18821647/**
     
    18871652 * @param   cChunks         The number of contiguous chunks to free.
    18881653 */
    1889 BS3_DECL(void) Bs3SlabListFree_c16(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks);
    1890 BS3_DECL(void) Bs3SlabListFree_c32(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks); /**< @copydoc Bs3SlabListFree_c16 */
    1891 BS3_DECL(void) Bs3SlabListFree_c64(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks); /**< @copydoc Bs3SlabListFree_c16 */
    1892 #define Bs3SlabListFree BS3_CMN_NM(Bs3SlabListFree) /**< Selects #Bs3SlabListFree_c16, #Bs3SlabListFree_c32 or #Bs3SlabListFree_c64. */
     1654BS3_CMN_PROTO(void, Bs3SlabListFree,(PBS3SLABHEAD pHead, void BS3_FAR *pvChunks, uint16_t cChunks), true);
    18931655
    18941656/**
     
    19191681 * @param   cb          How much to allocate.  Must be 4KB or less.
    19201682 */
    1921 BS3_DECL(void BS3_FAR *) Bs3MemAlloc_c16(BS3MEMKIND enmKind, size_t cb);
    1922 BS3_DECL(void BS3_FAR *) Bs3MemAlloc_c32(BS3MEMKIND enmKind, size_t cb); /**< @copydoc Bs3MemAlloc_c16 */
    1923 BS3_DECL(void BS3_FAR *) Bs3MemAlloc_c64(BS3MEMKIND enmKind, size_t cb); /**< @copydoc Bs3MemAlloc_c16 */
    1924 #define Bs3MemAlloc BS3_CMN_NM(Bs3MemAlloc) /**< Selects #Bs3MemAlloc_c16, #Bs3MemAlloc_c32 or #Bs3MemAlloc_c64. */
     1683BS3_CMN_PROTO(void BS3_FAR *, Bs3MemAlloc,(BS3MEMKIND enmKind, size_t cb), true);
    19251684
    19261685/**
     
    19311690 * @param   cb          How much to allocate.  Must be 4KB or less.
    19321691 */
    1933 BS3_DECL(void BS3_FAR *) Bs3MemAllocZ_c16(BS3MEMKIND enmKind, size_t cb);
    1934 BS3_DECL(void BS3_FAR *) Bs3MemAllocZ_c32(BS3MEMKIND enmKind, size_t cb); /**< @copydoc Bs3MemAllocZ_c16 */
    1935 BS3_DECL(void BS3_FAR *) Bs3MemAllocZ_c64(BS3MEMKIND enmKind, size_t cb); /**< @copydoc Bs3MemAllocZ_c16 */
    1936 #define Bs3MemAllocZ BS3_CMN_NM(Bs3MemAllocZ) /**< Selects #Bs3MemAllocZ_c16, #Bs3MemAllocZ_c32 or #Bs3MemAllocZ_c64. */
     1692BS3_CMN_PROTO(void BS3_FAR *, Bs3MemAllocZ,(BS3MEMKIND enmKind, size_t cb), true);
    19371693
    19381694/**
     
    19431699 * @param   cb          The size of the allocation.
    19441700 */
    1945 BS3_DECL(void) Bs3MemFree_c16(void BS3_FAR *pv, size_t cb);
    1946 BS3_DECL(void) Bs3MemFree_c32(void BS3_FAR *pv, size_t cb); /**< @copydoc Bs3MemFree_c16 */
    1947 BS3_DECL(void) Bs3MemFree_c64(void BS3_FAR *pv, size_t cb); /**< @copydoc Bs3MemFree_c16 */
    1948 #define Bs3MemFree BS3_CMN_NM(Bs3MemFree) /**< Selects #Bs3MemFree_c16, #Bs3MemFree_c32 or #Bs3MemFree_c64. */
     1701BS3_CMN_PROTO(void, Bs3MemFree,(void BS3_FAR *pv, size_t cb), true);
    19491702
    19501703
     
    19521705 * Enables the A20 gate.
    19531706 */
    1954 BS3_DECL(void) Bs3A20Enable_c16(void);
    1955 BS3_DECL(void) Bs3A20Enable_c32(void); /**< @copydoc Bs3A20Enable_c16 */
    1956 BS3_DECL(void) Bs3A20Enable_c64(void); /**< @copydoc Bs3A20Enable_c16 */
    1957 #define Bs3A20Enable BS3_CMN_NM(Bs3A20Enable) /**< Selects #Bs3A20Enable_c16, #Bs3A20Enable_c32 or #Bs3A20Enable_c64. */
     1707BS3_CMN_PROTO(void, Bs3A20Enable,(void), false);
    19581708
    19591709/**
    19601710 * Enables the A20 gate via the keyboard controller
    19611711 */
    1962 BS3_DECL(void) Bs3A20EnableViaKbd_c16(void);
    1963 BS3_DECL(void) Bs3A20EnableViaKbd_c32(void); /**< @copydoc Bs3A20EnableViaKbd_c16 */
    1964 BS3_DECL(void) Bs3A20EnableViaKbd_c64(void); /**< @copydoc Bs3A20EnableViaKbd_c16 */
    1965 #define Bs3A20EnableViaKbd BS3_CMN_NM(Bs3A20EnableViaKbd) /**< Selects #Bs3A20EnableViaKbd_c16, #Bs3A20EnableViaKbd_c32 or #Bs3A20EnableViaKbd_c64. */
     1712BS3_CMN_PROTO(void, Bs3A20EnableViaKbd,(void), false);
    19661713
    19671714/**
    19681715 * Enables the A20 gate via the PS/2 control port A.
    19691716 */
    1970 BS3_DECL(void) Bs3A20EnableViaPortA_c16(void);
    1971 BS3_DECL(void) Bs3A20EnableViaPortA_c32(void); /**< @copydoc Bs3A20EnableViaPortA_c16 */
    1972 BS3_DECL(void) Bs3A20EnableViaPortA_c64(void); /**< @copydoc Bs3A20EnableViaPortA_c16 */
    1973 #define Bs3A20EnableViaPortA BS3_CMN_NM(Bs3A20EnableViaPortA) /**< Selects #Bs3A20EnableViaPortA_c16, #Bs3A20EnableViaPortA_c32 or #Bs3A20EnableViaPortA_c64. */
     1717BS3_CMN_PROTO(void, Bs3A20EnableViaPortA,(void), false);
    19741718
    19751719/**
    19761720 * Disables the A20 gate.
    19771721 */
    1978 BS3_DECL(void) Bs3A20Disable_c16(void);
    1979 BS3_DECL(void) Bs3A20Disable_c32(void); /**< @copydoc Bs3A20Disable_c16 */
    1980 BS3_DECL(void) Bs3A20Disable_c64(void); /**< @copydoc Bs3A20Disable_c16 */
    1981 #define Bs3A20Disable BS3_CMN_NM(Bs3A20Disable) /**< Selects #Bs3A20Disable_c16, #Bs3A20Disable_c32 or #Bs3A20Disable_c64. */
     1722BS3_CMN_PROTO(void, Bs3A20Disable,(void), false);
    19821723
    19831724/**
    19841725 * Disables the A20 gate via the keyboard controller
    19851726 */
    1986 BS3_DECL(void) Bs3A20DisableViaKbd_c16(void);
    1987 BS3_DECL(void) Bs3A20DisableViaKbd_c32(void); /**< @copydoc Bs3A20DisableViaKbd_c16 */
    1988 BS3_DECL(void) Bs3A20DisableViaKbd_c64(void); /**< @copydoc Bs3A20DisableViaKbd_c16 */
    1989 #define Bs3A20DisableViaKbd BS3_CMN_NM(Bs3A20DisableViaKbd) /**< Selects #Bs3A20DisableViaKbd_c16, #Bs3A20DisableViaKbd_c32 or #Bs3A20DisableViaKbd_c64. */
     1727BS3_CMN_PROTO(void, Bs3A20DisableViaKbd,(void), false);
    19901728
    19911729/**
    19921730 * Disables the A20 gate via the PS/2 control port A.
    19931731 */
    1994 BS3_DECL(void) Bs3A20DisableViaPortA_c16(void);
    1995 BS3_DECL(void) Bs3A20DisableViaPortA_c32(void); /**< @copydoc Bs3A20DisableViaPortA_c16 */
    1996 BS3_DECL(void) Bs3A20DisableViaPortA_c64(void); /**< @copydoc Bs3A20DisableViaPortA_c16 */
    1997 #define Bs3A20DisableViaPortA BS3_CMN_NM(Bs3A20DisableViaPortA) /**< Selects #Bs3A20DisableViaPortA_c16, #Bs3A20DisableViaPortA_c32 or #Bs3A20DisableViaPortA_c64. */
     1732BS3_CMN_PROTO(void, Bs3A20DisableViaPortA,(void), false);
    19981733
    19991734
     
    20041739 * @remarks Must not be called in real-mode!
    20051740 */
    2006 BS3_DECL(int) Bs3PagingInitRootForPP_c16(void);
    2007 BS3_DECL(int) Bs3PagingInitRootForPP_c32(void); /**< @copydoc Bs3PagingInitRootForPP_c16 */
    2008 BS3_DECL(int) Bs3PagingInitRootForPP_c64(void); /**< @copydoc Bs3PagingInitRootForPP_c16 */
    2009 #define Bs3PagingInitRootForPP BS3_CMN_NM(Bs3PagingInitRootForPP) /**< Selects #Bs3PagingInitRootForPP_c16, #Bs3PagingInitRootForPP_c32 or #Bs3PagingInitRootForPP_c64. */
     1741BS3_CMN_PROTO(int, Bs3PagingInitRootForPP,(void), true);
    20101742
    20111743/**
     
    20161748 * @remarks Must not be called in real-mode!
    20171749 */
    2018 BS3_DECL(int) Bs3PagingInitRootForPAE_c16(void);
    2019 BS3_DECL(int) Bs3PagingInitRootForPAE_c32(void); /**< @copydoc Bs3PagingInitRootForPAE_c16 */
    2020 BS3_DECL(int) Bs3PagingInitRootForPAE_c64(void); /**< @copydoc Bs3PagingInitRootForPAE_c16 */
    2021 #define Bs3PagingInitRootForPAE BS3_CMN_NM(Bs3PagingInitRootForPAE) /**< Selects #Bs3PagingInitRootForPAE_c16, #Bs3PagingInitRootForPAE_c32 or #Bs3PagingInitRootForPAE_c64. */
     1750BS3_CMN_PROTO(int, Bs3PagingInitRootForPAE,(void), true);
    20221751
    20231752/**
     
    20281757 * @remarks Must not be called in real-mode!
    20291758 */
    2030 BS3_DECL(int) Bs3PagingInitRootForLM_c16(void);
    2031 BS3_DECL(int) Bs3PagingInitRootForLM_c32(void); /**< @copydoc Bs3PagingInitRootForLM_c16 */
    2032 BS3_DECL(int) Bs3PagingInitRootForLM_c64(void); /**< @copydoc Bs3PagingInitRootForLM_c16 */
    2033 #define Bs3PagingInitRootForLM BS3_CMN_NM(Bs3PagingInitRootForLM) /**< Selects #Bs3PagingInitRootForLM_c16, #Bs3PagingInitRootForLM_c32 or #Bs3PagingInitRootForLM_c64. */
     1759BS3_CMN_PROTO(int, Bs3PagingInitRootForLM,(void), true);
    20341760
    20351761/**
     
    20491775 * @param   fClear      Mask of zero or more X86_PTE_XXX values to clear for the range.
    20501776 */
    2051 BS3_DECL(int) Bs3PagingProtect_c16(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear);
    2052 BS3_DECL(int) Bs3PagingProtect_c32(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear); /**< @copydoc Bs3PagingProtect_c16 */
    2053 BS3_DECL(int) Bs3PagingProtect_c64(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear); /**< @copydoc Bs3PagingProtect_c16 */
    2054 #define Bs3PagingProtect BS3_CMN_NM(Bs3PagingProtect) /**< Selects #Bs3PagingProtect_c16, #Bs3PagingProtect_c32 or #Bs3PagingProtect_c64. */
     1777BS3_CMN_PROTO(int, Bs3PagingProtect,(uint64_t uFlat, uint64_t cb, uint64_t fSet, uint64_t fClear), true);
    20551778
    20561779/**
     
    20701793 * @param   fClear      Mask of zero or more X86_PTE_XXX values to clear for the range.
    20711794 */
    2072 BS3_DECL(int) Bs3PagingProtectPtr_c16(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear);
    2073 BS3_DECL(int) Bs3PagingProtectPtr_c32(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear); /**< @copydoc Bs3PagingProtectPtr_c16 */
    2074 BS3_DECL(int) Bs3PagingProtectPtr_c64(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear); /**< @copydoc Bs3PagingProtectPtr_c16 */
    2075 #define Bs3PagingProtectPtr BS3_CMN_NM(Bs3PagingProtectPtr) /**< Selects #Bs3PagingProtectPtr_c16, #Bs3PagingProtectPtr_c32 or #Bs3PagingProtectPtr_c64. */
     1795BS3_CMN_PROTO(int, Bs3PagingProtectPtr,(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear), true);
    20761796
    20771797/**
    20781798 * Waits for the keyboard controller to become ready.
    20791799 */
    2080 BS3_DECL(void) Bs3KbdWait_c16(void);
    2081 BS3_DECL(void) Bs3KbdWait_c32(void); /**< @copydoc Bs3KbdWait_c16 */
    2082 BS3_DECL(void) Bs3KbdWait_c64(void); /**< @copydoc Bs3KbdWait_c16 */
    2083 #define Bs3KbdWait BS3_CMN_NM(Bs3KbdWait) /**< Selects #Bs3KbdWait_c16, #Bs3KbdWait_c32 or #Bs3KbdWait_c64. */
     1800BS3_CMN_PROTO(void, Bs3KbdWait,(void), false);
    20841801
    20851802/**
     
    20921809 * @param        bCmd            The read command.
    20931810 */
    2094 BS3_DECL(uint8_t) Bs3KbdRead_c16(uint8_t bCmd);
    2095 BS3_DECL(uint8_t) Bs3KbdRead_c32(uint8_t bCmd); /**< @copydoc Bs3KbdRead_c16 */
    2096 BS3_DECL(uint8_t) Bs3KbdRead_c64(uint8_t bCmd); /**< @copydoc Bs3KbdRead_c16 */
    2097 #define Bs3KbdRead BS3_CMN_NM(Bs3KbdRead) /**< Selects #Bs3KbdRead_c16, #Bs3KbdRead_c32 or #Bs3KbdRead_c64. */
     1811BS3_CMN_PROTO(uint8_t, Bs3KbdRead,(uint8_t bCmd), false);
    20981812
    20991813/**
     
    21061820 * @param        bData          The data to write.
    21071821 */
    2108 BS3_DECL(void) Bs3KbdWrite_c16(uint8_t bCmd, uint8_t bData);
    2109 BS3_DECL(void) Bs3KbdWrite_c32(uint8_t bCmd, uint8_t bData); /**< @copydoc Bs3KbdWrite_c16 */
    2110 BS3_DECL(void) Bs3KbdWrite_c64(uint8_t bCmd, uint8_t bData); /**< @copydoc Bs3KbdWrite_c16 */
    2111 #define Bs3KbdWrite BS3_CMN_NM(Bs3KbdWrite) /**< Selects #Bs3KbdWrite_c16, #Bs3KbdWrite_c32 or #Bs3KbdWrite_c64. */
     1822BS3_CMN_PROTO(void, Bs3KbdWrite,(uint8_t bCmd, uint8_t bData), false);
    21121823
    21131824
     
    21151826 * Disables all IRQs on the PIC.
    21161827 */
    2117 BS3_DECL(void) Bs3PicMaskAll_c16(void);
    2118 BS3_DECL(void) Bs3PicMaskAll_c32(void); /**< @copydoc Bs3PicMaskAll_c16 */
    2119 BS3_DECL(void) Bs3PicMaskAll_c64(void); /**< @copydoc Bs3PicMaskAll_c16 */
    2120 #define Bs3PicMaskAll BS3_CMN_NM(Bs3PicMaskAll) /**< Selects #Bs3PicMaskAll_c16, #Bs3PicMaskAll_c32 or #Bs3PicMaskAll_c64. */
     1828BS3_CMN_PROTO(void, Bs3PicMaskAll,(void), true);
    21211829
    21221830
     
    22181926 * @param   pRegCtx     Where to store the register context.
    22191927 */
    2220 BS3_DECL(void) Bs3RegCtxSave_c16(PCBS3REGCTX pRegCtx);
    2221 BS3_DECL(void) Bs3RegCtxSave_c32(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxSave_c16 */
    2222 BS3_DECL(void) Bs3RegCtxSave_c64(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxSave_c16 */
    2223 #define Bs3RegCtxSave BS3_CMN_NM(Bs3RegCtxSave) /**< Selects #Bs3RegCtxSave_c16, #Bs3RegCtxSave_c32 or #Bs3RegCtxSave_c64. */
     1928BS3_CMN_PROTO(void, Bs3RegCtxSave,(PCBS3REGCTX pRegCtx), false);
    22241929
    22251930/**
     
    22291934 * @param   bRing       The target ring (0..3).
    22301935 */
    2231 BS3_DECL(void) Bs3RegCtxConvertToRingX_c16(PBS3REGCTX pRegCtx, uint8_t bRing);
    2232 BS3_DECL(void) Bs3RegCtxConvertToRingX_c32(PBS3REGCTX pRegCtx, uint8_t bRing); /**< @copydoc Bs3RegCtxConvertToRingX_c16 */
    2233 BS3_DECL(void) Bs3RegCtxConvertToRingX_c64(PBS3REGCTX pRegCtx, uint8_t bRing); /**< @copydoc Bs3RegCtxConvertToRingX_c16 */
    2234 #define Bs3RegCtxConvertToRingX BS3_CMN_NM(Bs3RegCtxConvertToRingX) /**< Selects #Bs3RegCtxConvertToRingX_c16, #Bs3RegCtxConvertToRingX_c32 or #Bs3RegCtxConvertToRingX_c64. */
     1936BS3_CMN_PROTO(void, Bs3RegCtxConvertToRingX,(PBS3REGCTX pRegCtx, uint8_t bRing), true);
    22351937
    22361938/**
     
    22431945 * @remarks Does not return.
    22441946 */
    2245 BS3_DECL(DECL_NO_RETURN(void)) Bs3RegCtxRestore_c16(PCBS3REGCTX pRegCtx, uint16_t fFlags);
    2246 BS3_DECL(DECL_NO_RETURN(void)) Bs3RegCtxRestore_c32(PCBS3REGCTX pRegCtx, uint16_t fFlags); /**< @copydoc Bs3RegCtxRestore_c16 */
    2247 BS3_DECL(DECL_NO_RETURN(void)) Bs3RegCtxRestore_c64(PCBS3REGCTX pRegCtx, uint16_t fFlags); /**< @copydoc Bs3RegCtxRestore_c16 */
    2248 #define Bs3RegCtxRestore BS3_CMN_NM(Bs3RegCtxRestore) /**< Selects #Bs3RegCtxRestore_c16, #Bs3RegCtxRestore_c32 or #Bs3RegCtxRestore_c64. */
     1947BS3_CMN_PROTO(DECL_NO_RETURN(void), Bs3RegCtxRestore,(PCBS3REGCTX pRegCtx, uint16_t fFlags), false);
    22491948#if !defined(BS3_KIT_WITH_NO_RETURN) && defined(__WATCOMC__)
    22501949# pragma aux Bs3RegCtxRestore_c16 "_Bs3RegCtxRestore_aborts_c16" __aborts
     1950# pragma aux Bs3RegCtxRestore_f16 "_Bs3RegCtxRestore_aborts_f16" __aborts
    22511951# pragma aux Bs3RegCtxRestore_c32 "_Bs3RegCtxRestore_aborts_c32" __aborts
    22521952#endif
     
    22601960 * @param   pRegCtx     The register context to be printed.
    22611961 */
    2262 BS3_DECL(void) Bs3RegCtxPrint_c16(PCBS3REGCTX pRegCtx);
    2263 BS3_DECL(void) Bs3RegCtxPrint_c32(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxPrint_c16 */
    2264 BS3_DECL(void) Bs3RegCtxPrint_c64(PCBS3REGCTX pRegCtx); /**< @copydoc Bs3RegCtxPrint_c16 */
    2265 #define Bs3RegCtxPrint BS3_CMN_NM(Bs3RegCtxPrint) /**< Selects #Bs3RegCtxPrint_c16, #Bs3RegCtxPrint_c32 or #Bs3RegCtxPrint_c64. */
     1962BS3_CMN_PROTO(void, Bs3RegCtxPrint,(PCBS3REGCTX pRegCtx), true);
    22661963
    22671964
     
    23042001 *          structures.
    23052002 */
    2306 BS3_DECL(void) Bs3Trap16Init_c16(void);
    2307 BS3_DECL(void) Bs3Trap16Init_c32(void); /**< @copydoc Bs3Trap16Init_c16 */
    2308 BS3_DECL(void) Bs3Trap16Init_c64(void); /**< @copydoc Bs3Trap16Init_c16 */
    2309 #define Bs3Trap16Init BS3_CMN_NM(Bs3Trap16Init) /**< Selects #Bs3Trap16Init_c16, #Bs3Trap16Init_c32 or #Bs3Trap16Init_c64. */
     2003BS3_CMN_PROTO(void, Bs3Trap16Init,(void), true);
    23102004
    23112005/**
     
    23202014 *          structures.
    23212015 */
    2322 BS3_DECL(void) Bs3Trap16InitEx_c16(bool f386Plus);
    2323 BS3_DECL(void) Bs3Trap16InitEx_c32(bool f386Plus); /**< @copydoc Bs3Trap16InitEx_c16 */
    2324 BS3_DECL(void) Bs3Trap16InitEx_c64(bool f386Plus); /**< @copydoc Bs3Trap16InitEx_c16 */
    2325 #define Bs3Trap16InitEx BS3_CMN_NM(Bs3Trap16InitEx) /**< Selects #Bs3Trap16InitEx_c16, #Bs3Trap16InitEx_c32 or #Bs3Trap16InitEx_c64. */
     2016BS3_CMN_PROTO(void, Bs3Trap16InitEx,(bool f386Plus), true);
    23262017
    23272018/**
     
    23312022 *          structures.
    23322023 */
    2333 BS3_DECL(void) Bs3Trap32Init_c16(void);
    2334 BS3_DECL(void) Bs3Trap32Init_c32(void); /**< @copydoc Bs3Trap32Init_c16 */
    2335 BS3_DECL(void) Bs3Trap32Init_c64(void); /**< @copydoc Bs3Trap32Init_c16 */
    2336 #define Bs3Trap32Init BS3_CMN_NM(Bs3Trap32Init) /**< Selects #Bs3Trap32Init_c16, #Bs3Trap32Init_c32 or #Bs3Trap32Init_c64. */
     2024BS3_CMN_PROTO(void, Bs3Trap32Init,(void), true);
    23372025
    23382026/**
     
    23422030 *          structures.
    23432031 */
    2344 BS3_DECL(void) Bs3Trap64Init_c16(void);
    2345 BS3_DECL(void) Bs3Trap64Init_c32(void); /**< @copydoc Bs3Trap64Init_c16 */
    2346 BS3_DECL(void) Bs3Trap64Init_c64(void); /**< @copydoc Bs3Trap64Init_c16 */
    2347 #define Bs3Trap64Init BS3_CMN_NM(Bs3Trap64Init) /**< Selects #Bs3Trap64Init_c16, #Bs3Trap64Init_c32 or #Bs3Trap64Init_c64. */
     2032BS3_CMN_PROTO(void, Bs3Trap64Init,(void), true);
     2033
     2034/**
     2035 * Modifies the real-mode / V86 IVT entry specified by @a iIvt.
     2036 *
     2037 * @param   iIvt        The index of the IDT entry to set.
     2038 * @param   uSel        The handler real-mode segment.
     2039 * @param   off         The handler offset.
     2040 */
     2041BS3_CMN_PROTO(void, Bs3TrapRmV86SetGate,(uint8_t iIvt, uint16_t uSeg, uint16_t off), true);
    23482042
    23492043/**
     
    23572051 * @param   cParams     The parameter count (for call gates).
    23582052 */
    2359 BS3_DECL(void) Bs3Trap16SetGate_c16(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams);
    2360 BS3_DECL(void) Bs3Trap16SetGate_c32(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams); /**< @copydoc Bs3Trap16SetGate_c16 */
    2361 BS3_DECL(void) Bs3Trap16SetGate_c64(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint16_t off, uint8_t cParams); /**< @copydoc Bs3Trap16SetGate_c16 */
    2362 #define Bs3Trap16SetGate BS3_CMN_NM(Bs3Trap16SetGate) /**< Selects #Bs3Trap16SetGate_c16, #Bs3Trap16SetGate_c32 or #Bs3Trap16SetGate_c64. */
     2053BS3_CMN_PROTO(void, Bs3Trap16SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
     2054                                      uint16_t uSel, uint16_t off, uint8_t cParams), true);
    23632055
    23642056/** The address of Bs3Trap16GenericEntries.
     
    23662058 * points, 8 bytes each, that will create a register frame and call the generic
    23672059 * C compatible trap handlers. */
    2368 #ifndef DOXYGEN_RUNNING
    2369 # define g_Bs3Trap16GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap16GenericEntriesFlatAddr)
    2370 #endif
    23712060extern uint32_t g_Bs3Trap16GenericEntriesFlatAddr;
    23722061
     
    23812070 * @param   cParams     The parameter count (for call gates).
    23822071 */
    2383 BS3_DECL(void) Bs3Trap32SetGate_c16(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams);
    2384 BS3_DECL(void) Bs3Trap32SetGate_c32(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams); /**< @copydoc Bs3Trap32SetGate_c16 */
    2385 BS3_DECL(void) Bs3Trap32SetGate_c64(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams); /**< @copydoc Bs3Trap32SetGate_c16 */
    2386 #define Bs3Trap32SetGate BS3_CMN_NM(Bs3Trap32SetGate) /**< Selects #Bs3Trap32SetGate_c16, #Bs3Trap32SetGate_c32 or #Bs3Trap32SetGate_c64. */
     2072BS3_CMN_PROTO(void, Bs3Trap32SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
     2073                                      uint16_t uSel, uint32_t off, uint8_t cParams), true);
    23872074
    23882075/** The address of Bs3Trap32GenericEntries.
     
    23902077 * points, 10 bytes each, that will create a register frame and call the generic
    23912078 * C compatible trap handlers. */
    2392 #ifndef DOXYGEN_RUNNING
    2393 # define g_Bs3Trap32GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap32GenericEntriesFlatAddr)
    2394 #endif
    23952079extern uint32_t g_Bs3Trap32GenericEntriesFlatAddr;
    23962080
     
    24052089 * @param   bIst        The interrupt stack to use.
    24062090 */
    2407 BS3_DECL(void) Bs3Trap64SetGate_c16(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst);
    2408 BS3_DECL(void) Bs3Trap64SetGate_c32(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst); /**< @copydoc Bs3Trap64SetGate_c16 */
    2409 BS3_DECL(void) Bs3Trap64SetGate_c64(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint64_t off, uint8_t bIst); /**< @copydoc Bs3Trap64SetGate_c16 */
    2410 #define Bs3Trap64SetGate BS3_CMN_NM(Bs3Trap64SetGate) /**< Selects #Bs3Trap64SetGate_c16, #Bs3Trap64SetGate_c32 or #Bs3Trap64SetGate_c64. */
     2091BS3_CMN_PROTO(void, Bs3Trap64SetGate,(uint8_t iIdt, uint8_t bType, uint8_t bDpl,
     2092                                      uint16_t uSel, uint64_t off, uint8_t bIst), true);
    24112093
    24122094/** The address of Bs3Trap64GenericEntries.
     
    24142096 * points, 8 bytes each, that will create a register frame and call the generic
    24152097 * C compatible trap handlers. */
    2416 #ifndef DOXYGEN_RUNNING
    2417 # define g_Bs3Trap64GenericEntriesFlatAddr BS3_DATA_NM(g_Bs3Trap64GenericEntriesFlatAddr)
    2418 #endif
    24192098extern uint32_t g_Bs3Trap64GenericEntriesFlatAddr;
    24202099
     
    24482127 * @param   pfnHandler  Pointer to the handler.
    24492128 */
    2450 BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler_c16(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler);
    2451 BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler_c32(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler); /**< @copydoc Bs3Trap32SetHandler_c16 */
    2452 BS3_DECL(PFNBS3TRAPHANDLER) Bs3TrapSetHandler_c64(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler); /**< @copydoc Bs3Trap32SetHandler_c16 */
    2453 #define Bs3Trap32SetHandler BS3_CMN_NM(Bs3Trap32SetHandler) /**< Selects #Bs3Trap32SetHandler_c16, #Bs3Trap32SetHandler_c32 or #Bs3Trap32SetHandler_c64. */
     2129BS3_CMN_PROTO(PFNBS3TRAPHANDLER, Bs3TrapSetHandler,(uint8_t iIdt, PFNBS3TRAPHANDLER pfnHandler), true);
    24542130
    24552131/**
     
    24602136 * @param   pTrapFrame      Trap frame of the trap to handle.
    24612137 */
    2462 BS3_DECL(void) Bs3TrapDefaultHandler_c16(PBS3TRAPFRAME pTrapFrame);
    2463 BS3_DECL(void) Bs3TrapDefaultHandler_c32(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapDefaultHandler_c16 */
    2464 BS3_DECL(void) Bs3TrapDefaultHandler_c64(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapDefaultHandler_c16 */
    2465 #define Bs3TrapDefaultHandler BS3_CMN_NM(Bs3TrapDefaultHandler) /**< Selects #Bs3TrapDefaultHandler_c16, #Bs3TrapDefaultHandler_c32 or #Bs3TrapDefaultHandler_c64. */
     2138BS3_CMN_PROTO(void, Bs3TrapDefaultHandler,(PBS3TRAPFRAME pTrapFrame), true);
    24662139
    24672140/**
     
    24692142 * @param   pTrapFrame      Trap frame to print.
    24702143 */
    2471 BS3_DECL(void) Bs3TrapPrintFrame_c16(PCBS3TRAPFRAME pTrapFrame);
    2472 BS3_DECL(void) Bs3TrapPrintFrame_c32(PCBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapPrintFrame_c16 */
    2473 BS3_DECL(void) Bs3TrapPrintFrame_c64(PCBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapPrintFrame_c16 */
    2474 #define Bs3TrapPrintFrame BS3_CMN_NM(Bs3TrapPrintFrame) /**< Selects #Bs3TrapPrintFrame_c16, #Bs3TrapPrintFrame_c32 or #Bs3TrapPrintFrame_c64. */
     2144BS3_CMN_PROTO(void, Bs3TrapPrintFrame,(PCBS3TRAPFRAME pTrapFrame), true);
    24752145
    24762146/**
     
    24862156 * @sa      #Bs3TrapUnsetJmp
    24872157 */
    2488 BS3_DECL(DECL_RETURNS_TWICE(bool)) Bs3TrapSetJmp_c16(PBS3TRAPFRAME pTrapFrame);
    2489 BS3_DECL(DECL_RETURNS_TWICE(bool)) Bs3TrapSetJmp_c32(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapSetJmp_c16 */
    2490 BS3_DECL(DECL_RETURNS_TWICE(bool)) Bs3TrapSetJmp_c64(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapSetJmp_c16 */
    2491 #define Bs3TrapSetJmp BS3_CMN_NM(Bs3TrapSetJmp) /**< Selects #Bs3TrapSetJmp_c16, #Bs3TrapSetJmp_c32 or #Bs3TrapSetJmp_c64. */
     2158BS3_CMN_PROTO(DECL_RETURNS_TWICE(bool),Bs3TrapSetJmp,(PBS3TRAPFRAME pTrapFrame), false);
    24922159
    24932160/**
     
    24972164 * @param   pTrapFrame      Where to store the trap information.
    24982165 */
    2499 BS3_DECL(void) Bs3TrapSetJmpAndRestore_c16(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame);
    2500 BS3_DECL(void) Bs3TrapSetJmpAndRestore_c32(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapSetJmpAndRestore_c16 */
    2501 BS3_DECL(void) Bs3TrapSetJmpAndRestore_c64(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapSetJmpAndRestore_c16 */
    2502 #define Bs3TrapSetJmpAndRestore BS3_CMN_NM(Bs3TrapSetJmpAndRestore) /**< Selects #Bs3TrapSetJmpAndRestore_c16, #Bs3TrapSetJmpAndRestore_c32 or #Bs3TrapSetJmpAndRestore_c64. */
     2166BS3_CMN_PROTO(void, Bs3TrapSetJmpAndRestore,(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame), true);
    25032167
    25042168/**
    25052169 * Disables a previous #Bs3TrapSetJmp call.
    25062170 */
    2507 BS3_DECL(void) Bs3TrapUnsetJmp_c16(void);
    2508 BS3_DECL(void) Bs3TrapUnsetJmp_c32(void); /**< @copydoc Bs3TrapUnsetJmp_c16 */
    2509 BS3_DECL(void) Bs3TrapUnsetJmp_c64(void); /**< @copydoc Bs3TrapUnsetJmp_c16 */
    2510 #define Bs3TrapUnsetJmp BS3_CMN_NM(Bs3TrapUnsetJmp) /**< Selects #Bs3TrapUnsetJmp_c16, #Bs3TrapUnsetJmp_c32 or #Bs3TrapUnsetJmp_c64. */
     2171BS3_CMN_PROTO(void, Bs3TrapUnsetJmp,(void), true);
    25112172
    25122173
     
    25142175 * The current test step.
    25152176 */
    2516 #ifndef DOXYGEN_RUNNING
    2517 # define g_usBs3TestStep BS3_DATA_NM(g_usBs3TestStep)
    2518 #endif
    25192177extern uint16_t g_usBs3TestStep;
    2520 #ifndef DOXYGEN_RUNNING
    2521 # define g_usBs3TestStep BS3_DATA_NM(g_usBs3TestStep)
    2522 #endif
    25232178
    25242179/**
     
    25272182 * @param   pszTest         The test name.
    25282183 */
    2529 BS3_DECL(void) Bs3TestInit_c16(const char BS3_FAR *pszTest);
    2530 BS3_DECL(void) Bs3TestInit_c32(const char BS3_FAR *pszTest); /**< @copydoc Bs3TestInit_c16 */
    2531 BS3_DECL(void) Bs3TestInit_c64(const char BS3_FAR *pszTest); /**< @copydoc Bs3TestInit_c16 */
    2532 #define Bs3TestInit BS3_CMN_NM(Bs3TestInit) /**< Selects #Bs3TestInit_c16, #Bs3TestInit_c32 or #Bs3TestInit_c64. */
     2184BS3_CMN_PROTO(void, Bs3TestInit,(const char BS3_FAR *pszTest), true);
    25332185
    25342186
     
    25362188 * Equivalent to RTTestSummaryAndDestroy.
    25372189 */
    2538 BS3_DECL(void) Bs3TestTerm_c16(void);
    2539 BS3_DECL(void) Bs3TestTerm_c32(void); /**< @copydoc Bs3TestTerm_c16 */
    2540 BS3_DECL(void) Bs3TestTerm_c64(void); /**< @copydoc Bs3TestTerm_c16 */
    2541 #define Bs3TestTerm BS3_CMN_NM(Bs3TestTerm) /**< Selects #Bs3TestTerm_c16, #Bs3TestTerm_c32 or #Bs3TestTerm_c64. */
     2190BS3_CMN_PROTO(void, Bs3TestTerm,(void), true);
    25422191
    25432192/**
    25442193 * Equivalent to RTTestISub.
    25452194 */
    2546 BS3_DECL(void) Bs3TestSub_c16(const char BS3_FAR *pszSubTest);
    2547 BS3_DECL(void) Bs3TestSub_c32(const char BS3_FAR *pszSubTest); /**< @copydoc Bs3TestSub_c16 */
    2548 BS3_DECL(void) Bs3TestSub_c64(const char BS3_FAR *pszSubTest); /**< @copydoc Bs3TestSub_c16 */
    2549 #define Bs3TestSub BS3_CMN_NM(Bs3TestSub) /**< Selects #Bs3TestSub_c16, #Bs3TestSub_c32 or #Bs3TestSub_c64. */
     2195BS3_CMN_PROTO(void, Bs3TestSub,(const char BS3_FAR *pszSubTest), true);
    25502196
    25512197/**
    25522198 * Equivalent to RTTestIFailedF.
    25532199 */
    2554 BS3_DECL(void) Bs3TestSubF_c16(const char BS3_FAR *pszFormat, ...);
    2555 BS3_DECL(void) Bs3TestSubF_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestSubF_c16 */
    2556 BS3_DECL(void) Bs3TestSubF_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestSubF_c16 */
    2557 #define Bs3TestSubF BS3_CMN_NM(Bs3TestSubF) /**< Selects #Bs3TestSubF_c16, #Bs3TestSubF_c32 or #Bs3TestSubF_c64. */
     2200BS3_CMN_PROTO(void, Bs3TestSubF,(const char BS3_FAR *pszFormat, ...), true);
    25582201
    25592202/**
    25602203 * Equivalent to RTTestISubV.
    25612204 */
    2562 BS3_DECL(void) Bs3TestSubV_c16(const char BS3_FAR *pszFormat, va_list va);
    2563 BS3_DECL(void) Bs3TestSubV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestSubV_c16 */
    2564 BS3_DECL(void) Bs3TestSubV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestSubV_c16 */
    2565 #define Bs3TestSubV BS3_CMN_NM(Bs3TestSubV) /**< Selects #Bs3TestSubV_c16, #Bs3TestSubV_c32 or #Bs3TestSubV_c64. */
     2205BS3_CMN_PROTO(void, Bs3TestSubV,(const char BS3_FAR *pszFormat, va_list va), true);
    25662206
    25672207/**
    25682208 * Equivalent to RTTestISubDone.
    25692209 */
    2570 BS3_DECL(void) Bs3TestSubDone_c16(void);
    2571 BS3_DECL(void) Bs3TestSubDone_c32(void); /**< @copydoc Bs3TestSubDone_c16 */
    2572 BS3_DECL(void) Bs3TestSubDone_c64(void); /**< @copydoc Bs3TestSubDone_c16 */
    2573 #define Bs3TestSubDone BS3_CMN_NM(Bs3TestSubDone) /**< Selects #Bs3TestSubDone_c16, #Bs3TestSubDone_c32 or #Bs3TestSubDone_c64. */
     2210BS3_CMN_PROTO(void, Bs3TestSubDone,(void), true);
    25742211
    25752212/**
    25762213 * Equivalent to RTTestSubErrorCount.
    25772214 */
    2578 BS3_DECL(uint16_t) Bs3TestSubErrorCount_c16(void);
    2579 BS3_DECL(uint16_t) Bs3TestSubErrorCount_c32(void); /**< @copydoc Bs3TestSubErrorCount_c16 */
    2580 BS3_DECL(uint16_t) Bs3TestSubErrorCount_c64(void); /**< @copydoc Bs3TestSubErrorCount_c16 */
    2581 #define Bs3TestSubErrorCount BS3_CMN_NM(Bs3TestSubErrorCount) /**< Selects #Bs3TestSubErrorCount_c16, #Bs3TestSubErrorCount_c32 or #Bs3TestSubErrorCount_c64. */
     2215BS3_CMN_PROTO(uint16_t, Bs3TestSubErrorCount,(void), true);
    25822216
    25832217/**
     
    25872221 * @param   ...         String format arguments.
    25882222 */
    2589 BS3_DECL(void) Bs3TestPrintf_c16(const char BS3_FAR *pszFormat, ...);
    2590 BS3_DECL(void) Bs3TestPrintf_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestPrintf_c16 */
    2591 BS3_DECL(void) Bs3TestPrintf_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestPrintf_c16 */
    2592 #define Bs3TestPrintf BS3_CMN_NM(Bs3TestPrintf) /**< Selects #Bs3TestPrintf_c16, #Bs3TestPrintf_c32 or #Bs3TestPrintf_c64. */
     2223BS3_CMN_PROTO(void, Bs3TestPrintf,(const char BS3_FAR *pszFormat, ...), true);
    25932224
    25942225/**
     
    25982229 * @param   va          String format arguments.
    25992230 */
    2600 BS3_DECL(void) Bs3TestPrintfV_c16(const char BS3_FAR *pszFormat, va_list va);
    2601 BS3_DECL(void) Bs3TestPrintfV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestPrintfV_c16 */
    2602 BS3_DECL(void) Bs3TestPrintfV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestPrintfV_c16 */
    2603 #define Bs3TestPrintfV BS3_CMN_NM(Bs3TestPrintfV) /**< Selects #Bs3TestPrintfV_c16, #Bs3TestPrintfV_c32 or #Bs3TestPrintfV_c64. */
     2231BS3_CMN_PROTO(void, Bs3TestPrintfV,(const char BS3_FAR *pszFormat, va_list va), true);
    26042232
    26052233/**
    26062234 * Equivalent to RTTestIFailed.
    26072235 */
    2608 BS3_DECL(void) Bs3TestFailed_c16(const char BS3_FAR *pszMessage);
    2609 BS3_DECL(void) Bs3TestFailed_c32(const char BS3_FAR *pszMessage); /**< @copydoc Bs3TestFailed_c16 */
    2610 BS3_DECL(void) Bs3TestFailed_c64(const char BS3_FAR *pszMessage); /**< @copydoc Bs3TestFailed_c16 */
    2611 #define Bs3TestFailed BS3_CMN_NM(Bs3TestFailed) /**< Selects #Bs3TestFailed_c16, #Bs3TestFailed_c32 or #Bs3TestFailed_c64. */
     2236BS3_CMN_PROTO(void, Bs3TestFailed,(const char BS3_FAR *pszMessage), true);
    26122237
    26132238/**
    26142239 * Equivalent to RTTestIFailedF.
    26152240 */
    2616 BS3_DECL(void) Bs3TestFailedF_c16(const char BS3_FAR *pszFormat, ...);
    2617 BS3_DECL(void) Bs3TestFailedF_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestFailedF_c16 */
    2618 BS3_DECL(void) Bs3TestFailedF_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestFailedF_c16 */
    2619 #define Bs3TestFailedF BS3_CMN_NM(Bs3TestFailedF) /**< Selects #Bs3TestFailedF_c16, #Bs3TestFailedF_c32 or #Bs3TestFailedF_c64. */
     2241BS3_CMN_PROTO(void, Bs3TestFailedF,(const char BS3_FAR *pszFormat, ...), true);
    26202242
    26212243/**
    26222244 * Equivalent to RTTestIFailedV.
    26232245 */
    2624 BS3_DECL(void) Bs3TestFailedV_c16(const char BS3_FAR *pszFormat, va_list va);
    2625 BS3_DECL(void) Bs3TestFailedV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestFailedV_c16 */
    2626 BS3_DECL(void) Bs3TestFailedV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestFailedV_c16 */
    2627 #define Bs3TestFailedV BS3_CMN_NM(Bs3TestFailedV) /**< Selects #Bs3TestFailedV_c16, #Bs3TestFailedV_c32 or #Bs3TestFailedV_c64. */
     2246BS3_CMN_PROTO(void, Bs3TestFailedV,(const char BS3_FAR *pszFormat, va_list va), true);
    26282247
    26292248/**
     
    26322251 * @param   pszWhy          Optional reason why it's being skipped.
    26332252 */
    2634 BS3_DECL(void) Bs3TestSkipped_c16(const char BS3_FAR *pszWhy);
    2635 BS3_DECL(void) Bs3TestSkipped_c32(const char BS3_FAR *pszWhy); /**< @copydoc Bs3TestSkipped_c16 */
    2636 BS3_DECL(void) Bs3TestSkipped_c64(const char BS3_FAR *pszWhy); /**< @copydoc Bs3TestSkipped_c16 */
    2637 #define Bs3TestSkipped BS3_CMN_NM(Bs3TestSkipped) /**< Selects #Bs3TestSkipped_c16, #Bs3TestSkipped_c32 or #Bs3TestSkipped_c64. */
     2253BS3_CMN_PROTO(void, Bs3TestSkipped,(const char BS3_FAR *pszWhy), true);
    26382254
    26392255/**
     
    26432259 * @param   ...             Format arguments.
    26442260 */
    2645 BS3_DECL(void) Bs3TestSkippedF_c16(const char BS3_FAR *pszFormat, ...);
    2646 BS3_DECL(void) Bs3TestSkippedF_c32(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestSkippedF_c16 */
    2647 BS3_DECL(void) Bs3TestSkippedF_c64(const char BS3_FAR *pszFormat, ...); /**< @copydoc Bs3TestSkippedF_c16 */
    2648 #define Bs3TestSkippedF BS3_CMN_NM(Bs3TestSkippedF) /**< Selects #Bs3TestSkippedF_c16, #Bs3TestSkippedF_c32 or #Bs3TestSkippedF_c64. */
     2261BS3_CMN_PROTO(void, Bs3TestSkippedF,(const char BS3_FAR *pszFormat, ...), true);
    26492262
    26502263/**
     
    26542267 * @param   va              Format arguments.
    26552268 */
    2656 BS3_DECL(void) Bs3TestSkippedV_c16(const char BS3_FAR *pszFormat, va_list va);
    2657 BS3_DECL(void) Bs3TestSkippedV_c32(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestSkippedV_c16 */
    2658 BS3_DECL(void) Bs3TestSkippedV_c64(const char BS3_FAR *pszFormat, va_list va); /**< @copydoc Bs3TestSkippedV_c16 */
    2659 #define Bs3TestSkippedV BS3_CMN_NM(Bs3TestSkippedV) /**< Selects #Bs3TestSkippedV_c16, #Bs3TestSkippedV_c32 or #Bs3TestSkippedV_c64. */
     2269BS3_CMN_PROTO(void, Bs3TestSkippedV,(const char BS3_FAR *pszFormat, va_list va), true);
    26602270
    26612271/**
     
    26732283 * @param   idTestStep      Test step identifier.
    26742284 */
    2675 BS3_DECL(bool) Bs3TestCheckRegCtxEx_c16(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAdjust,
    2676                                         uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep);
    2677 BS3_DECL(bool) Bs3TestCheckRegCtxEx_c32(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAdjust,
    2678                                         uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep); /** @copydoc Bs3TestCheckRegCtxEx_c16 */
    2679 BS3_DECL(bool) Bs3TestCheckRegCtxEx_c64(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust, int16_t cbSpAdjust,
    2680                                         uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep); /** @copydoc Bs3TestCheckRegCtxEx_c16 */
    2681 #define Bs3TestCheckRegCtxEx BS3_CMN_NM(Bs3TestCheckRegCtxEx) /**< Selects #Bs3TestCheckRegCtxEx_c16, #Bs3TestCheckRegCtxEx_c32 or #Bs3TestCheckRegCtxEx_c64. */
     2285BS3_CMN_PROTO(bool, Bs3TestCheckRegCtxEx,(PCBS3REGCTX pActualCtx, PCBS3REGCTX pExpectedCtx, uint16_t cbPcAdjust,
     2286                                          int16_t cbSpAdjust, uint32_t fExtraEfl, const char *pszMode, uint16_t idTestStep), true);
    26822287
    26832288/**
     
    28452450 * For proper operation on OLDer CPUs, call #Bs3CpuDetect_mmm first.
    28462451 */
    2847 BS3_DECL(void) Bs3InitMemory_rm(void);
     2452BS3_DECL_FAR(void) Bs3InitMemory_rm(void);
    28482453
    28492454
     
    28662471 */
    28672472#define BS3_MODE_EXPAND_PROTOTYPES(a_RetType, a_BaseFnNm, a_Parameters) \
    2868     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_rm)       a_Parameters; \
    2869     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16)     a_Parameters; \
    2870     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16_32)  a_Parameters; \
    2871     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16_v86) a_Parameters; \
    2872     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32)     a_Parameters; \
    2873     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32_16)  a_Parameters; \
    2874     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pev86)    a_Parameters; \
    2875     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16)     a_Parameters; \
    2876     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16_32)  a_Parameters; \
    2877     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16_v86) a_Parameters; \
    2878     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32)     a_Parameters; \
    2879     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32_16)  a_Parameters; \
    2880     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_ppv86)    a_Parameters; \
    2881     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16)    a_Parameters; \
    2882     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16_32) a_Parameters; \
    2883     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16_v86)a_Parameters; \
    2884     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32)    a_Parameters; \
    2885     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32_16) a_Parameters; \
    2886     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_paev86)   a_Parameters; \
    2887     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm16)     a_Parameters; \
    2888     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm32)     a_Parameters; \
    2889     BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm64)     a_Parameters
     2473    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_rm)       a_Parameters; \
     2474    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_rm_far)   a_Parameters; \
     2475    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16)     a_Parameters; \
     2476    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16_32)  a_Parameters; \
     2477    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16_v86) a_Parameters; \
     2478    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32)     a_Parameters; \
     2479    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32_16)  a_Parameters; \
     2480    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pev86)    a_Parameters; \
     2481    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16)     a_Parameters; \
     2482    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16_32)  a_Parameters; \
     2483    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16_v86) a_Parameters; \
     2484    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32)     a_Parameters; \
     2485    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32_16)  a_Parameters; \
     2486    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_ppv86)    a_Parameters; \
     2487    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16)    a_Parameters; \
     2488    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16_32) a_Parameters; \
     2489    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16_v86)a_Parameters; \
     2490    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32)    a_Parameters; \
     2491    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32_16) a_Parameters; \
     2492    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_paev86)   a_Parameters; \
     2493    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_lm16)     a_Parameters; \
     2494    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_lm32)     a_Parameters; \
     2495    BS3_DECL_NEAR(a_RetType) RT_CONCAT(a_BaseFnNm,_lm64)     a_Parameters
    28902496
    28912497/**
     
    29652571
    29662572/** The return value of #Bs3CpuDetect_mmm. (Initial value is BS3CPU_TYPE_MASK.) */
    2967 #ifndef DOXYGEN_RUNNING
    2968 # define g_uBs3CpuDetected BS3_DATA_NM(g_uBs3CpuDetected)
    2969 #endif
    29702573extern uint16_t g_uBs3CpuDetected;
    29712574
     
    29912594
    29922595
    2993 #endif
    2994 
     2596/*
     2597 * Include default function symbol mangling.
     2598 */
     2599#include "bs3kit-mangling-code.h"
     2600
     2601
     2602#endif
     2603
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac

    r60439 r60527  
    138138%endmacro
    139139
    140 ; Default to register aliases for ARCH_BITS.
    141 BS3_SET_REG_ALIASES ARCH_BITS
    142 
    143 
    144 ;; Wrapper around BITS.
    145 ; Updates __BITS__ (built-in variable in nasm, we work it for yasm) as well
    146 ; a number of convenient macros and register aliases.
    147 ;
    148 ; @param    %1      The CPU bit count: 16, 32 or 64
    149 ; @remarks ARCH_BITS is not modified and will remain what it was on the
    150 ;          assembler command line.
    151 %macro BS3_SET_BITS 1
    152  BITS %1
    153 
     140;;
     141; Redefines macros that follows __BITS__.
     142%macro BS3_SET_BITS_MACROS 1
     143 ;; Emulate the __BITS__ macro in NASM 2.0+. Follows BS3_SET_BITS.
    154144 %ifdef __YASM__
    155145  %undef  __BITS__
     
    157147 %endif
    158148
     149 ;; Mostly internal macro. Follows BS3_SET_BITS.
    159150 %undef  BS3_NAME_UNDERSCORE
    160151 %if %1 == 64
     
    164155 %endif
    165156
     157 ;; For segment overrides and stuff. Follows BS3_SET_BITS.
    166158 %undef   BS3_ONLY_16BIT
    167159 %if %1 == 16
     
    171163 %endif
    172164
     165 ;; For odd 64-bit stuff. Follows BS3_SET_BITS.
    173166 %undef   BS3_ONLY_64BIT
    174167 %if %1 == 64
     
    178171 %endif
    179172
     173 ;; For segment overrides and stuff. Follows BS3_SET_BITS.
    180174 %undef   BS3_NOT_64BIT
    181175 %if %1 == 64
     
    185179 %endif
    186180
     181 ;; For stack cleanups and similar where each bit mode is different. Follows BS3_SET_BITS.
    187182 %undef   BS3_IF_16_32_64BIT
    188183 %if %1 == 16
     
    194189 %endif
    195190
     191 ;; For RIP relative addressing in 64-bit mode and absolute addressing in
     192 ; other modes. Follows BS3_SET_BITS.
    196193 %undef   BS3_WRT_RIP
    197194 %if %1 == 64
     
    241238 %endif
    242239
     240 ;;
     241 ; Same as BS3_CMN_NM except in 16-bit mode, it will generate the far name.
     242 ; (16-bit code generally have both near and far callable symbols, so we won't
     243 ; be restricted to 64KB test code.)
     244 %if %1 == 16
     245  %define BS3_CMN_NM_FAR(a_Name) BS3_NAME_UNDERSCORE %+ a_Name %+ _f %+ __BITS__
     246 %else
     247  %define BS3_CMN_NM_FAR(a_Name) BS3_CMN_NM(a_Name)
     248 %endif
     249
     250%endmacro
     251
     252; Default to register aliases for ARCH_BITS.
     253BS3_SET_REG_ALIASES ARCH_BITS
     254
     255; Define macros for ARCH_BITS.
     256BS3_SET_BITS_MACROS ARCH_BITS
     257
     258
     259;; Wrapper around BITS.
     260; Updates __BITS__ (built-in variable in nasm, we work it for yasm) as well
     261; a number of convenient macros and register aliases.
     262;
     263; @param    %1      The CPU bit count: 16, 32 or 64
     264; @remarks ARCH_BITS is not modified and will remain what it was on the
     265;          assembler command line.
     266%macro BS3_SET_BITS 1
     267 BITS %1
     268 BS3_SET_BITS_MACROS %1
    243269 BS3_SET_REG_ALIASES %1
    244270%endmacro
    245 
    246 
    247 ;; Emulate the __BITS__ macro in NASM 2.0+. Follows BS3_SET_BITS.
    248 %ifdef __YASM__
    249  %define __BITS__                   ARCH_BITS
    250 %endif
    251 
    252 ;; Mostly internal macro. Follows BS3_SET_BITS.
    253 %if ARCH_BITS == 64
    254  %define BS3_NAME_UNDERSCORE
    255 %else
    256  %define BS3_NAME_UNDERSCORE        _
    257 %endif
    258 
    259 ;; For RIP relative addressing in 64-bit mode and absolute addressing in
    260 ; other modes. Follows BS3_SET_BITS.
    261 %if ARCH_BITS == 64
    262  %ifdef __YASM__
    263   %define BS3_WRT_RIP(a_Sym)        a_Sym wrt rip
    264  %else
    265   %define BS3_WRT_RIP(a_Sym)        rel a_Sym       ; Baka! Why couldn't they do 'wrt rip' like yasm?
    266  %endif
    267 %else
    268  %define BS3_WRT_RIP(a_Sym)         a_Sym
    269 %endif
    270 
    271 ;; For segment overrides and stuff. Follows BS3_SET_BITS.
    272 %if ARCH_BITS == 16
    273  %define BS3_ONLY_16BIT(a_Expr)     a_Expr
    274 %else
    275  %define BS3_ONLY_16BIT(a_Expr)
    276 %endif
    277 
    278 ;; For odd 64-bit stuff. Follows BS3_SET_BITS.
    279 %if ARCH_BITS == 64
    280  %define BS3_ONLY_64BIT(a_Expr)     a_Expr
    281 %else
    282  %define BS3_ONLY_64BIT(a_Expr)
    283 %endif
    284 
    285 ;; For segment overrides and stuff. Follows BS3_SET_BITS.
    286 %if ARCH_BITS == 64
    287  %define BS3_NOT_64BIT(a_Expr)
    288 %else
    289  %define BS3_NOT_64BIT(a_Expr)     a_Expr
    290 %endif
    291 
    292 ;; For stack cleanups and similar where each bit mode is different. Follows BS3_SET_BITS.
    293 %if ARCH_BITS == 16
    294  %define BS3_IF_16_32_64BIT(a_16BitExpr, a_32BitExpr, a_64BitExpr) a_16BitExpr
    295 %elif ARCH_BITS == 32
    296  %define BS3_IF_16_32_64BIT(a_16BitExpr, a_32BitExpr, a_64BitExpr) a_32BitExpr
    297 %else
    298  %define BS3_IF_16_32_64BIT(a_16BitExpr, a_32BitExpr, a_64BitExpr) a_64BitExpr
    299 %endif
    300 
    301271
    302272;;
     
    358328        section BS3TEXT16
    359329 %endif
     330 %undef   BS3_CUR_SEG_BEGIN_MACRO
     331 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_TEXT16
     332        BS3_SET_BITS 16
     333%endmacro
     334
     335%macro BS3_BEGIN_TEXT16_NEARSTUBS 0
     336 %ifndef  BS3_BEGIN_TEXT16_NEARSTUBS_NOT_FIRST
     337  %define BS3_BEGIN_TEXT16_NEARSTUBS_NOT_FIRST
     338  %ifdef ASM_FORMAT_ELF
     339        section BS3TEXT16_NEARSTUBS align=1 progbits alloc exec nowrite
     340  %else
     341        section BS3TEXT16_NEARSTUBS align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
     342  %endif
     343 %else
     344        section BS3TEXT16_NEARSTUBS
     345 %endif
     346 %undef   BS3_CUR_SEG_BEGIN_MACRO
     347 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_TEXT16_NEARSTUBS
     348        BS3_SET_BITS 16
     349%endmacro
     350
     351%macro BS3_BEGIN_TEXT16_FARSTUBS 0
     352 %ifndef  BS3_BEGIN_TEXT16_FARSTUBS_NOT_FIRST
     353  %define BS3_BEGIN_TEXT16_FARSTUBS_NOT_FIRST
     354  %ifdef ASM_FORMAT_ELF
     355        section BS3TEXT16_FARSTUBS align=1 progbits alloc exec nowrite
     356  %else
     357        section BS3TEXT16_FARSTUBS align=1 CLASS=BS3CLASS16CODE PUBLIC USE16
     358  %endif
     359 %else
     360        section BS3TEXT16_FARSTUBS
     361 %endif
     362 %undef   BS3_CUR_SEG_BEGIN_MACRO
     363 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_TEXT16_FARSTUBS
     364        BS3_SET_BITS 16
     365%endmacro
     366
     367%macro BS3_BEGIN_RMTEXT16 0
     368 %ifndef  BS3_BEGIN_RMTEXT16_NOT_FIRST
     369  %define BS3_BEGIN_RMTEXT16_NOT_FIRST
     370  %ifdef ASM_FORMAT_ELF
     371        section BS3RMTEXT16 align=2 progbits alloc exec nowrite
     372  %else
     373        section BS3RMTEXT16 align=2 CLASS=BS3CLASS16RMCODE PUBLIC USE16
     374  %endif
     375 %else
     376        section BS3RMTEXT16
     377 %endif
     378 %undef   BS3_CUR_SEG_BEGIN_MACRO
     379 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_RMTEXT16
    360380        BS3_SET_BITS 16
    361381%endmacro
     
    375395        section BS3DATA16
    376396 %endif
     397 %undef   BS3_CUR_SEG_BEGIN_MACRO
     398 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_DATA16
    377399        BS3_SET_BITS 16
    378400%endmacro
     
    389411        section BS3TEXT32
    390412 %endif
     413 %undef   BS3_CUR_SEG_BEGIN_MACRO
     414 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_TEXT32
    391415        BS3_SET_BITS 32
    392416%endmacro
     
    403427        section BS3DATA32
    404428 %endif
     429 %undef   BS3_CUR_SEG_BEGIN_MACRO
     430 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_DATA32
    405431        BS3_SET_BITS 32
    406432%endmacro
     
    417443        section BS3TEXT64
    418444 %endif
     445 %undef   BS3_CUR_SEG_BEGIN_MACRO
     446 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_TEXT64
    419447        BS3_SET_BITS 64
    420448%endmacro
     
    431459        section BS3DATA64
    432460 %endif
     461 %undef   BS3_CUR_SEG_BEGIN_MACRO
     462 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_DATA64
    433463        BS3_SET_BITS 64
    434464%endmacro
     
    446476        section BS3SYSTEM16
    447477 %endif
     478 %undef   BS3_CUR_SEG_BEGIN_MACRO
     479 %xdefine BS3_CUR_SEG_BEGIN_MACRO   BS3_BEGIN_SYSTEM16
    448480        BS3_SET_BITS 16
    449481%endmacro
     
    515547%endmacro
    516548
     549;;
     550; Same as BS3_EXTERN_CMN except it picks the far variant in 16-bit code.
     551;
     552; @param    %1  The unmangled common name.
     553;
     554; @remarks  Must enter the segment in which this name is defined.
     555;
     556%macro BS3_EXTERN_CMN_FAR 1
     557 extern BS3_CMN_NM_FAR(%1)
     558 %undef  %1
     559 %define %1 BS3_CMN_NM_FAR(%1)
     560%endmacro
     561
    517562;; @def BS3_EXTERN_TMPL
    518563; Mangles the given name into a template specific one.  For ease of use, the
     
    629674
    630675
     676;; @name BS3_PBC_XXX - For use as the 2nd parameter to BS3_PROC_BEGIN_CMN.
     677;; @{
     678%define BS3_PBC_NEAR          0 ;;< Only near.
     679%define BS3_PBC_FAR           1 ;;< Only far.
     680%define BS3_PBC_HYBRID        2 ;;< Hybrid near/far procedure, trashing AX
     681%define BS3_PBC_HYBRID_SAFE   3 ;;< Hybrid near/far procedure, no trashing but slower.
     682%define BS3_PBC_HYBRID_0_ARGS 4 ;;< Hybrid near/far procedure, no parameters so separate far stub, no trashing, fast near calls.
     683;; @}
     684
    631685;; Convenience macro for defining common procedures.
    632 %macro BS3_PROC_BEGIN_CMN 1
    633  BS3_PROC_BEGIN     BS3_CMN_NM(%1)
     686; This will emit both near and far 16-bit symbols according to parameter %2 (BS3_PBC_XXX).
     687%macro BS3_PROC_BEGIN_CMN 2
     688 %undef BS3_CUR_PROC_FLAGS
     689 %if __BITS__ == 16
     690  %if %2 == BS3_PBC_NEAR
     691   %define BS3_CUR_PROC_FLAGS   BS3_PBC_NEAR
     692   %xdefine cbCurRetAddr        2
     693   BS3_PROC_BEGIN       BS3_CMN_NM(%1)
     694
     695  %elif %2 == BS3_PBC_FAR
     696   %define BS3_CUR_PROC_FLAGS   BS3_PBC_FAR
     697   %xdefine cbCurRetAddr        4
     698   BS3_PROC_BEGIN       BS3_CMN_NM_FAR(%1)
     699
     700  %elif %2 == BS3_PBC_HYBRID
     701   %define BS3_CUR_PROC_FLAGS   BS3_PBC_HYBRID
     702   %xdefine cbCurRetAddr        4
     703   BS3_GLOBAL_NAME_EX   BS3_CMN_NM(%1), function, 3
     704        pop     ax
     705        push    cs
     706        push    ax
     707   BS3_PROC_BEGIN       BS3_CMN_NM_FAR(%1)
     708
     709  %elif %2 == BS3_PBC_HYBRID_SAFE
     710   %define BS3_CUR_PROC_FLAGS   BS3_PBC_HYBRID_SAFE
     711   %xdefine cbCurRetAddr        4
     712   BS3_GLOBAL_NAME_EX   BS3_CMN_NM(%1), function, 3
     713        extern  Bs3CreateHybridFarRet_c16
     714        call    Bs3CreateHybridFarRet_c16
     715   BS3_PROC_BEGIN       BS3_CMN_NM_FAR(%1)
     716
     717  %elif %2 == BS3_PBC_HYBRID_0_ARGS
     718   %define BS3_CUR_PROC_FLAGS   BS3_PBC_NEAR
     719   %xdefine cbCurRetAddr        2
     720   %undef  TMP_BEGIN_PREV_SEG
     721   %xdefine TMP_BEGIN_PREV_SEG   BS3_CUR_SEG_BEGIN_MACRO
     722
     723   BS3_BEGIN_TEXT16_FARSTUBS
     724   BS3_PROC_BEGIN       BS3_CMN_NM_FAR(%1)
     725        call    BS3_CMN_NM(%1)
     726        retf
     727   BS3_PROC_END         BS3_CMN_NM_FAR(%1)
     728
     729   TMP_BEGIN_PREV_SEG
     730   BS3_PROC_BEGIN       BS3_CMN_NM(%1)
     731
     732  %else
     733   %error BS3_PROC_BEGIN_CMN parameter 2 value %2 is not recognized.
     734
     735   %define BS3_CUR_PROC_FLAGS    BS3_PBC_NEAR
     736   %xdefine cbCurRetAddr         4
     737   BS3_PROC_BEGIN       BS3_CMN_NM(%1)
     738  %endif
     739 %else
     740  %define BS3_CUR_PROC_FLAGS    BS3_PBC_NEAR
     741  %xdefine cbCurRetAddr         xCB
     742  BS3_PROC_BEGIN        BS3_CMN_NM(%1)
     743 %endif
    634744%endmacro
    635745
    636746;; Convenience macro for defining common procedures.
    637747%macro BS3_PROC_END_CMN 1
    638  BS3_PROC_END       BS3_CMN_NM(%1)
    639 %endmacro
    640 
     748 %if __BITS__ == 16
     749  %if BS3_CUR_PROC_FLAGS == BS3_PBC_NEAR
     750   BS3_PROC_END      BS3_CMN_NM(%1)
     751  %else
     752   BS3_PROC_END      BS3_CMN_NM_FAR(%1)
     753  %endif
     754 %else
     755  BS3_PROC_END       BS3_CMN_NM(%1)
     756 %endif
     757 %undef cbCurRetAddr
     758%endmacro
     759
     760;; Does a far return in 16-bit code, near return in 32-bit and 64-bit.
     761; This is for use with BS3_PBC_XXX
     762%macro BS3_HYBRID_RET 0-1
     763 %if __BITS__ == 16
     764  %if %0 > 0
     765   %if BS3_CUR_PROC_FLAGS == BS3_PBC_NEAR || BS3_CUR_PROC_FLAGS == BS3_PBC_HYBRID_0_ARGS
     766        ret    %1
     767   %else
     768        retf    %1
     769   %endif
     770  %else
     771   %if BS3_CUR_PROC_FLAGS == BS3_PBC_NEAR || BS3_CUR_PROC_FLAGS == BS3_PBC_HYBRID_0_ARGS
     772        ret
     773   %else
     774        retf
     775   %endif
     776  %endif
     777 %else
     778  %if BS3_CUR_PROC_FLAGS != BS3_PBC_NEAR
     779   %error Expected BS3_CUR_PROC_FLAGS to be BS3_PBC_NEAR in non-16-bit code.
     780  %endif
     781  %if %0 > 0
     782        ret     %1
     783  %else
     784        ret
     785  %endif
     786 %endif
     787%endmacro
     788
     789;;
     790; Generate a safe 16-bit far stub for function %1, shuffling %2 bytes of parameters.
     791;
     792; This does absolutely nothing in 32-bit and 64-bit mode.
     793;
     794; @param    1   The function basename.
     795; @param    2   The number of bytes of parameters on the stack, must be a multiple of 2.
     796; @remarks  Changes the segment to TEXT16.
     797;
     798%macro BS3_CMN_FAR_STUB 2
     799 %if %2 <= 1 || (%2 & 1)
     800  %error Invalid parameter frame size passed to BS3_CMN_FAR_STUB: %2
     801 %endif
     802 %if __BITS__ == 16
     803BS3_BEGIN_TEXT16_FARSTUBS
     804BS3_PROC_BEGIN_CMN %1, BS3_PBC_FAR
     805        CPU 8086
     806        push    bp
     807        mov     bp, sp
     808  %assign offParam %2
     809  %rep %2/2
     810        push    word [bp + xCB + cbCurRetAddr + offParam - 2]
     811  %assign offParam offParam - 2
     812  %endrep
     813        call    BS3_CMN_NM(%1)
     814        add     sp, %2
     815        pop     bp
     816        retf
     817BS3_PROC_END_CMN   %1
     818BS3_BEGIN_TEXT16
     819 %endif
     820%endmacro
    641821
    642822;; Convenience macro for defining mode specific procedures.
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