VirtualBox

Changeset 102277 in vbox


Ignore:
Timestamp:
Nov 23, 2023 3:43:31 PM (12 months ago)
Author:
vboxsync
Message:

bs3kit: Speed up high DLL loading by using a larger buffer. Extended the linker to process the segment table as well and output more appropriate address symbols in the base module assembly file. TODO: missing 16-bit selector setup in the bs3kit loader code. bugref:10371

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3Linker.cpp

    r102270 r102277  
    7272
    7373
     74#define BS3LNK_MAX_SEGMENTS 24
     75
    7476typedef struct BS3LNKIMPORTSTATE
    7577{
     
    7981    unsigned        cExports;
    8082    size_t          cbStrings;
     83    unsigned        cSegments;
     84    uint8_t        *pbBits;
     85    size_t          cbBits;
     86    BS3HIGHDLLSEGMENT aSegments[BS3LNK_MAX_SEGMENTS];
    8187} BS3LNKIMPORTSTATE;
    8288
     
    9096
    9197
     98
    9299/**
    93  * @callback_method_impl{FNRTLDRENUMSYMS}
     100 * @callback_method_impl{FNRTLDRENUMSEGS,
     101 *  Construct a BS3LNKIMPORTSTATE::aSegments entry and adds it to the assembly.}
     102 */
     103static DECLCALLBACK(int) GenerateHighDllAsmOutputSegmentTable(RTLDRMOD hLdrMod, PCRTLDRSEG pSeg, void *pvUser)
     104{
     105    BS3LNKIMPORTSTATE * const pState = (BS3LNKIMPORTSTATE *)pvUser;
     106    RT_NOREF(hLdrMod);
     107
     108    uint32_t const iSegment = pState->cSegments;
     109    AssertReturn(iSegment < RT_ELEMENTS(pState->aSegments), VERR_OUT_OF_RANGE);
     110    pState->cSegments++;
     111
     112    /* Address and size. */
     113    if (pSeg->cbMapped != NIL_RTLDRADDR)
     114    {
     115        pState->aSegments[iSegment].uAddr = (uint32_t)(pSeg->RVA + BS3HIGHDLL_LOAD_ADDRESS);
     116        pState->aSegments[iSegment].cb    = (uint32_t)pSeg->cbMapped;
     117    }
     118    else
     119    {
     120        pState->aSegments[iSegment].uAddr = UINT32_MAX;
     121        pState->aSegments[iSegment].cb    = 0;
     122    }
     123
     124    /* The selector is just the segment index at this point. We'll resolve it during linking. */
     125    pState->aSegments[iSegment].idxSel = (uint16_t)iSegment;
     126
     127    /* Determine the flags. */
     128    pState->aSegments[iSegment].fFlags = 0;
     129    if (pSeg->fProt & RTMEM_PROT_EXEC)
     130        pState->aSegments[iSegment].fFlags |= BS3HIGHDLLSEGMENT_F_EXEC;
     131    if (pSeg->fFlags & RTLDRSEG_FLAG_16BIT)
     132        pState->aSegments[iSegment].fFlags |= BS3HIGHDLLSEGMENT_F_16BIT;
     133    else if (pSeg->RVA == NIL_RTLDRADDR)
     134    {
     135        /* Have to check the eyecatcher string to see if it's a 32-bit or 64-bit segment. */
     136        Assert(pSeg->RVA + 16 < pState->cbBits);
     137        char * const pchSeg    = (char *)&pState->pbBits[pSeg->RVA];
     138        char const   chSaved32 = pchSeg[32];
     139        pchSeg[32] = '\0';
     140        if (RTStrStr(pchSeg, "32"))
     141            pState->aSegments[iSegment].fFlags |= BS3HIGHDLLSEGMENT_F_32BIT;
     142        else if (RTStrStr(pchSeg, "64"))
     143            pState->aSegments[iSegment].fFlags |= BS3HIGHDLLSEGMENT_F_64BIT;
     144        pchSeg[32] = chSaved32;
     145    }
     146
     147    // BS3HIGHDLLSEGMENT
     148    fprintf(pState->pOutput,
     149            "        dd      %#010x ; %u - %.*s\n"
     150            "        dd      %#010x\n"
     151            "        dw      %#x\n"
     152            "        dw      %#x\n",
     153            pState->aSegments[iSegment].uAddr, iSegment, pSeg->cchName, pSeg->pszName,
     154            pState->aSegments[iSegment].cb,
     155            pState->aSegments[iSegment].idxSel,
     156            pState->aSegments[iSegment].fFlags);
     157
     158    return VINF_SUCCESS;
     159}
     160
     161
     162/**
     163 * @callback_method_impl{FNRTLDRENUMSYMS, Outputs an export table entry.}
    94164 */
    95165static DECLCALLBACK(int) GenerateHighDllAsmOutputExportTable(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol,
     
    100170        return RTMsgErrorRc(VERR_LDR_BAD_FIXUP, "All exports must be by name. uSymbol=%#x Value=%RX64", uSymbol, (uint64_t)Value);
    101171
     172    /* Translate it to segment+offset. We popuplate the table with indexes
     173       here, later we'll replace them with BS3Kit selector values once
     174       these are handed out during the linking phase. */
     175    uint32_t  iSeg   = UINT32_MAX;
     176    RTLDRADDR offSeg = NIL_RTLDRADDR;
     177    int rc = RTLdrRvaToSegOffset(hLdrMod, Value - BS3HIGHDLL_LOAD_ADDRESS, &iSeg, &offSeg);
     178    if (RT_SUCCESS(rc))
     179    {
     180        if (iSeg >= pState->cSegments || offSeg >= pState->aSegments[iSeg].cb)
     181            return RTMsgErrorRc(VERR_ADDRESS_TOO_BIG, "Bogus segment + offset translation of '%s' at %#RX64: %x:%RX64",
     182                                pszSymbol, (uint64_t)Value, iSeg, (uint64_t)offSeg);
     183    }
     184    else
     185        return RTMsgErrorRc(rc, "Failed to translate '%s' at %#RX64 into segment + offset: %Rrc", pszSymbol, (uint64_t)Value);
     186
    102187    // BS3HIGHDLLEXPORTENTRY
    103 
    104     fprintf(pState->pOutput,
    105             "BS3_GLOBAL_DATA g_pfn%s, 8\n"
    106             "        dd      0\n"
    107             "        dd      0\n"
    108             "BS3_GLOBAL_DATA g_fpfn48%s, 6\n"
    109             "        dd      0\n"
    110             "        dw      0\n"
    111             "        dw      %#08x\n",
    112             pszSymbol + (*pszSymbol == '_'),
    113             pszSymbol + (*pszSymbol == '_'),
    114             (unsigned)pState->cbStrings);
     188    const char *pszCSymbol = *pszSymbol == '_' ? &pszSymbol[1] : pszSymbol;
     189    if (pState->aSegments[iSeg].fFlags & BS3HIGHDLLSEGMENT_F_EXEC)
     190        fprintf(pState->pOutput,
     191                "BS3_GLOBAL_DATA g_pfn%s, 8\n"
     192                "        dd      0\n"
     193                "        dd      0\n"
     194                "BS3_GLOBAL_DATA g_fpfn48%s, 6\n"
     195                "        dd      %#010x\n"
     196                "        dw      %#06x\n"
     197                "        dw      %#08x\n",
     198                pszCSymbol,
     199                pszCSymbol,
     200                (uint32_t)offSeg,
     201                (uint16_t)iSeg,
     202                (unsigned)pState->cbStrings);
     203    else
     204        fprintf(pState->pOutput,
     205                "BS3_GLOBAL_DATA g_p%s, 8\n"
     206                "        dd      0\n"
     207                "        dd      0\n"
     208                "BS3_GLOBAL_DATA g_fp48%s, 6\n"
     209                "        dd      %#010x\n"
     210                "        dw      %#06x\n"
     211                "        dw      %#08x\n",
     212                pszCSymbol,
     213                pszCSymbol,
     214                (uint32_t)offSeg,
     215                (uint16_t)iSeg,
     216                (unsigned)pState->cbStrings);
     217
    115218    pState->cbStrings += strlen(pszSymbol) + 1;
    116219    pState->cExports  += 1;
     
    122225
    123226/**
    124  * @callback_method_impl{FNRTSTRSPACECALLBACK}
     227 * @callback_method_impl{FNRTSTRSPACECALLBACK, Outputs an import table entry.}
    125228 */
    126229static DECLCALLBACK(int) GenerateHighDllAsmOutputImportTable(PRTSTRSPACECORE pStr, void *pvUser)
     
    133236            "        dw      %#06x\n"
    134237            "        dw      seg %s\n"
     238            "        dd      %s\n"
    135239            "        dd      %s wrt BS3FLAT\n"
    136             , (unsigned)pName->offString, pName->szName, pName->szName);
     240            , (unsigned)pName->offString, pName->szName, pName->szName, pName->szName);
    137241
    138242    return VINF_SUCCESS;
     
    141245
    142246/**
    143  * @callback_method_impl{FNRTLDRENUMSYMS}
     247 * @callback_method_impl{FNRTLDRENUMSYMS, Outputs export name string.}
    144248 */
    145249static DECLCALLBACK(int) GenerateHighDllAsmOutputExportStrings(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol,
     
    159263
    160264/**
    161  * @callback_method_impl{FNRTSTRSPACECALLBACK}
     265 * @callback_method_impl{FNRTSTRSPACECALLBACK, Outputs import name string.}
    162266 */
    163267static DECLCALLBACK(int) GenerateHighDllAsmOutputImportStrings(PRTSTRSPACECORE pStr, void *pvUser)
     
    175279
    176280/**
    177  * @callback_method_impl{FNRTLDRIMPORT}
     281 * @callback_method_impl{FNRTLDRIMPORT, Adds import to the import strings.}
     282 *
     283 * Since LX doesn't have a single import table as such, we collect imported in a
     284 * string space while doing RTLdrGetBits.
    178285 */
    179286static DECLCALLBACK(int) GenerateHighDllAsmImportCallback(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol,
     
    204311
    205312
     313/**
     314 * @callback_method_impl{FNRTLDRENUMSEGS, For counting segments.}
     315 */
     316static DECLCALLBACK(int) GenerateHighDllAsmCountSegments(RTLDRMOD hLdrMod, PCRTLDRSEG pSeg, void *pvUser)
     317{
     318    RT_NOREF(hLdrMod, pSeg);
     319    *(uint32_t *)pvUser += 1;
     320    return VINF_SUCCESS;
     321}
     322
     323
     324/**
     325 * Main worker function for --generate-high-dll-import-table.
     326 *
     327 * @returns Exit status.
     328 * @param   pOutput         The assembly output file.
     329 * @param   pszGenAsmFor    The name of the DLL to generate info for.
     330 */
    206331static RTEXITCODE GenerateHighDllImportTableAssembly(FILE *pOutput, const char *pszGenAsmFor)
    207332{
     
    216341    if (cbImage != ~(size_t)0)
    217342    {
    218         void *pbBits = (uint8_t *)RTMemAlloc(cbImage);
    219         if (pbBits)
     343        uint32_t cSegments = 0;
     344        rc = RTLdrEnumSegments(hLdrMod, GenerateHighDllAsmCountSegments, &cSegments);
     345        if (RT_SUCCESS(rc) && cSegments >= 1 && cSegments <= BS3LNK_MAX_SEGMENTS)
    220346        {
    221             BS3LNKIMPORTSTATE State = { pOutput, NULL, 0, 0, 0 };
    222             rc = RTLdrGetBits(hLdrMod, pbBits, BS3HIGHDLL_LOAD_ADDRESS, GenerateHighDllAsmImportCallback, pOutput);
    223             if (RT_SUCCESS(rc))
     347            uint8_t *pbBits = (uint8_t *)RTMemAlloc(cbImage);
     348            if (pbBits)
    224349            {
    225                 /** @todo move more of this to bs3kit*.h?    */
    226                 fprintf(pOutput,
    227                         ";\n"
    228                         "; Automatically generated - DO NOT MODIFY!\n"
    229                         ";\n"
    230                         "%%include \"bs3kit.mac\"\n"
    231                         "\n"
    232                         "section BS3HIGHDLLEXPORTS   align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
    233                         "section BS3HIGHDLLIMPORTS   align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
    234                         "section BS3HIGHDLLSTRINGS   align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
    235                         "section BS3HIGHDLLTABLE     align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
    236                         "section BS3HIGHDLLTABLE_END align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
    237                         "GROUP BS3HIGHDLLGROUP  BS3HIGHDLLIMPORTS BS3HIGHDLLEXPORTS BS3HIGHDLLSTRINGS BS3HIGHDLLTABLE BS3HIGHDLLTABLE_END\n"
    238                         "\n");
    239 
    240                 /* Populate the string table with imports. */
    241                 const char *pszFilename = RTPathFilename(pszGenAsmFor);
    242                 fprintf(pOutput,
    243                         "section BS3HIGHDLLSTRINGS\n"
    244                         "start_strings:\n"
    245                         "        db      0\n"
    246                         "        db      '%s', 0    ; module name\n"
    247                         "        ; imports\n",
    248                         pszFilename);
    249                 State.cbStrings = 1 + strlen(pszFilename) + 1;
    250                 rc = RTStrSpaceEnumerate(&State.hImportNames, GenerateHighDllAsmOutputImportStrings, &State);
    251                 AssertRC(rc);
    252                 fprintf(pOutput, "        ; exports\n");
    253 
    254                 /* Populate the string table with exports. */
    255                 size_t const offExportStrings = State.cbStrings;
    256                 rc = RTLdrEnumSymbols(hLdrMod, 0, pbBits, BS3HIGHDLL_LOAD_ADDRESS, GenerateHighDllAsmOutputExportStrings, &State);
    257                 size_t const cbStrings        = State.cbStrings;
    258                 if (RT_SUCCESS(rc) && cbStrings < _64K)
     350                BS3LNKIMPORTSTATE State = { pOutput, NULL, 0, 0, 0, 0, pbBits, cbImage };
     351                rc = RTLdrGetBits(hLdrMod, pbBits, BS3HIGHDLL_LOAD_ADDRESS, GenerateHighDllAsmImportCallback, pOutput);
     352                if (RT_SUCCESS(rc))
    259353                {
    260                     /* Output the import table. */
     354                    /** @todo move more of this to bs3kit*.h?    */
    261355                    fprintf(pOutput,
    262                             "section BS3HIGHDLLIMPORTS\n"
    263                             "start_imports:\n");
    264                     rc = RTStrSpaceEnumerate(&State.hImportNames, GenerateHighDllAsmOutputImportTable, &State);
     356                            ";\n"
     357                            "; Automatically generated - DO NOT MODIFY!\n"
     358                            ";\n"
     359                            "%%include \"bs3kit.mac\"\n"
     360                            "\n"
     361                            "section BS3HIGHDLLSEGMENTS  align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
     362                            "section BS3HIGHDLLEXPORTS   align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
     363                            "section BS3HIGHDLLIMPORTS   align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
     364                            "section BS3HIGHDLLSTRINGS   align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
     365                            "section BS3HIGHDLLTABLE     align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
     366                            "section BS3HIGHDLLTABLE_END align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT\n"
     367                            "GROUP BS3HIGHDLLGROUP  BS3HIGHDLLSEGMENTS BS3HIGHDLLEXPORTS BS3HIGHDLLIMPORTS BS3HIGHDLLSTRINGS BS3HIGHDLLTABLE BS3HIGHDLLTABLE_END\n"
     368                            "\n");
     369
     370                    /* Populate the string table with imports. */
     371                    const char *pszFilename = RTPathFilename(pszGenAsmFor);
     372                    fprintf(pOutput,
     373                            "section BS3HIGHDLLSTRINGS\n"
     374                            "start_strings:\n"
     375                            "        db      0\n"
     376                            "        db      '%s', 0    ; module name\n"
     377                            "        ; imports\n",
     378                            pszFilename);
     379                    State.cbStrings = 1 + strlen(pszFilename) + 1;
     380                    rc = RTStrSpaceEnumerate(&State.hImportNames, GenerateHighDllAsmOutputImportStrings, &State);
    265381                    AssertRC(rc);
    266                     fprintf(pOutput, "\n");
    267 
    268                     /* Output the export table (ASSUMES stable enumeration order). */
    269                     fprintf(pOutput,
    270                             "section BS3HIGHDLLEXPORTS\n"
    271                             "start_exports:\n");
    272                     State.cbStrings = offExportStrings;
    273                     rc = RTLdrEnumSymbols(hLdrMod, 0, pbBits, BS3HIGHDLL_LOAD_ADDRESS, GenerateHighDllAsmOutputExportTable, &State);
    274                     AssertRC(rc);
    275                     fprintf(pOutput, "\n");
    276 
    277                     /* Generate the table entry. */
    278                     fprintf(pOutput,
    279                             "section BS3HIGHDLLTABLE\n"
    280                             "start_entry: ; struct BS3HIGHDLLENTRY \n"
    281                             "        db      '%s', 0    ; achMagic[8]\n"
    282                             "        dd      0               ; uLoadAddress\n"
    283                             "        dd      %#08zx        ; cbLoaded\n"
    284                             "        dd      0               ; offInImage\n"
    285                             "        dd      %#08zx        ; cbInImage\n"
    286                             "        dd      %#04x            ; cImports\n"
    287                             "        dd      start_imports - start_entry\n"
    288                             "        dd      %#04x            ; cExports\n"
    289                             "        dd      start_exports - start_entry\n"
    290                             "        dd      %#05x           ; cbStrings\n"
    291                             "        dd      start_strings - start_entry\n"
    292                             "        dd      1               ; offDllName\n"
    293                             "        dd      0               ; uChecksum\n"
    294                             , BS3HIGHDLLENTRY_MAGIC, cbImage, cbImage, State.cImports, State.cExports, (unsigned)cbStrings);
    295                     rcExit = RTEXITCODE_SUCCESS;
     382                    fprintf(pOutput, "        ; exports\n");
     383
     384                    /* Populate the string table with exports. */
     385                    size_t const offExportStrings = State.cbStrings;
     386                    rc = RTLdrEnumSymbols(hLdrMod, 0, pbBits, BS3HIGHDLL_LOAD_ADDRESS, GenerateHighDllAsmOutputExportStrings, &State);
     387                    size_t const cbStrings        = State.cbStrings;
     388                    if (RT_SUCCESS(rc) && cbStrings < _64K)
     389                    {
     390                        rcExit = RTEXITCODE_SUCCESS;
     391
     392                        /* Output the import table. */
     393                        fprintf(pOutput,
     394                                "section BS3HIGHDLLIMPORTS\n"
     395                                "start_imports:\n");
     396                        rc = RTStrSpaceEnumerate(&State.hImportNames, GenerateHighDllAsmOutputImportTable, &State);
     397                        AssertRCStmt(rc, rcExit = RTEXITCODE_FAILURE);
     398                        fprintf(pOutput, "\n");
     399
     400                        /* Output the segment table (before exports, so we get the segment info). */
     401                        fprintf(pOutput,
     402                                "section BS3HIGHDLLSEGMENTS\n"
     403                                "start_segments:\n");
     404                        rc = RTLdrEnumSegments(hLdrMod, GenerateHighDllAsmOutputSegmentTable, &State);
     405                        AssertRCStmt(rc, rcExit = RTEXITCODE_FAILURE);
     406
     407                        /* Output the export table (ASSUMES stable enumeration order). */
     408                        fprintf(pOutput,
     409                                "section BS3HIGHDLLEXPORTS\n"
     410                                "start_exports:\n");
     411                        State.cbStrings = offExportStrings;
     412                        rc = RTLdrEnumSymbols(hLdrMod, 0, pbBits, BS3HIGHDLL_LOAD_ADDRESS, GenerateHighDllAsmOutputExportTable, &State);
     413                        AssertRCStmt(rc, rcExit = RTEXITCODE_FAILURE);
     414                        fprintf(pOutput, "\n");
     415
     416                        /* Generate the table entry. */
     417                        fprintf(pOutput,
     418                                "section BS3HIGHDLLTABLE\n"
     419                                "start_entry: ; struct BS3HIGHDLLENTRY\n"
     420                                "        db      '%s', 0    ; achMagic[8]\n"
     421                                "        dd      0               ; uLoadAddress\n"
     422                                "        dd      %#08zx        ; cbLoaded\n"
     423                                "        dd      0               ; offInImage\n"
     424                                "        dd      %#08zx        ; cbInImage\n"
     425                                "        dd      %#04x            ; cImports\n"
     426                                "        dd      start_imports  - start_entry\n"
     427                                "        dd      %#04x            ; cExports\n"
     428                                "        dd      start_exports  - start_entry\n"
     429                                "        dd      %#04x            ; cSegments\n"
     430                                "        dd      start_segments - start_entry\n"
     431                                "        dd      %#05x           ; cbStrings\n"
     432                                "        dd      start_strings  - start_entry\n"
     433                                "        dd      1               ; offDllName\n"
     434                                "        dd      0               ; uChecksum\n"
     435                                , BS3HIGHDLLENTRY_MAGIC, cbImage, cbImage,
     436                                State.cImports, State.cExports, State.cSegments,
     437                                (unsigned)cbStrings);
     438                    }
     439                    else if (RT_FAILURE(rc))
     440                        rcExit = RTMsgErrorExitFailure("RTLdrEnumSymbols failed: %Rrc", rc);
     441                    else
     442                        rcExit = RTMsgErrorExitFailure("Too many import/export strings: %#x bytes, max 64KiB", cbStrings);
    296443                }
    297                 else if (RT_FAILURE(rc))
    298                     rcExit = RTMsgErrorExitFailure("RTLdrEnumSymbols failed: %Rrc", rc);
    299444                else
    300                     rcExit = RTMsgErrorExitFailure("Too many import/export strings: %#x bytes, max 64KiB", cbStrings);
     445                    rcExit = RTMsgErrorExitFailure("RTLdrGetBits failed: %Rrc", rc);
     446                RTMemFree(pbBits);
    301447            }
    302448            else
    303                 rcExit = RTMsgErrorExitFailure("RTLdrGetBits failed: %Rrc", rc);
    304             RTMemFree(pbBits);
     449                rcExit = RTMsgErrorExitFailure("Out of memory!");
    305450        }
     451        else if (RT_FAILURE(rc))
     452            rcExit = RTMsgErrorExitFailure("RTLdrEnumSegment failed: %Rrc", rc);
    306453        else
    307             rcExit = RTMsgErrorExitFailure("Out of memory!");
     454            rcExit = RTMsgErrorExitFailure("Bogus segment count: %#x (min 1, max 24)\n", cSegments);
    308455    }
    309456    else
     
    372519        if (strcmp(pszSymbol, &pszzStrings[paImports[i].offName]) == 0)
    373520        {
     521            /** @todo the import interface isn't good enough for segmented fixups like LX
     522             *        uses. So we need to fix that at some point... */
    374523            *pValue = paImports[i].offFlat;
    375524            return VINF_SUCCESS;
     
    381530
    382531
     532/**
     533 * Main worker for linking a floppy image.
     534 */
    383535static RTEXITCODE DoTheLinking(FILE *pOutput, BS3LNKINPUT *paInputs, unsigned cInputs)
    384536{
     
    392544     * Any additional files are DLLs and we need to do linking.
    393545     */
    394     uint32_t uHiLoadAddr = BS3HIGHDLL_LOAD_ADDRESS;
    395     uint32_t off         = 0;
     546    uint32_t uHiLoadAddr  = BS3HIGHDLL_LOAD_ADDRESS;
     547    uint16_t idxHi16BitCs = 0;
     548    uint16_t idxHi16BitDs = 0;
     549    uint32_t off          = 0;
    396550    for (unsigned i = 0; i < cInputs; i++)
    397551    {
     
    399553        if (i < 2)
    400554        {
     555            /* Bootsector or the base image. */
    401556            paInputs[i].cbBits = RT_ALIGN_32(paInputs[i].cbFile, 512);
    402557            paInputs[i].pbBits = (uint8_t *)RTMemAllocZ(paInputs[i].cbBits);
     
    411566        else
    412567        {
     568            /*
     569             * A DLL that will be loaded above 1MB.
     570             */
    413571            RTERRINFOSTATIC ErrInfo;
    414572            int rc = RTLdrOpenEx(paInputs[i].pszFile, 0, RTLDRARCH_X86_32, &paInputs[i].hLdrMod, RTErrInfoInitStatic(&ErrInfo));
     
    437595                                             pHighDllEntry->cbLoaded, pHighDllEntry->cbInImage, paInputs[i].cbBits);
    438596
    439             /* Get the fixed up image bits. */
    440             rc = RTLdrGetBits(paInputs[i].hLdrMod, paInputs[i].pbBits, uHiLoadAddr, ResolveHighDllImportCallback, pHighDllEntry);
    441             if (RT_FAILURE(rc))
    442                 return RTMsgErrorExitFailure("RTLdrGetBits failed on '%s': %Rrc", paInputs[i].pszFile, rc);
     597            /* Update the segment table with actual selectors. */
     598            uint32_t const     cSegments  = pHighDllEntry->cSegments;
     599            BS3HIGHDLLSEGMENT *paSegments = (BS3HIGHDLLSEGMENT *)((uintptr_t)pHighDllEntry + pHighDllEntry->offSegments);
     600            if (cSegments < 1 || cSegments > 32)
     601                return RTMsgErrorExitFailure("Bogus segment count for '%s': %u", paInputs[i].pszFile, cSegments);
     602            for (unsigned iSeg = 0; iSeg < cSegments; iSeg++)
     603            {
     604                if (paSegments[iSeg].fFlags & BS3HIGHDLLSEGMENT_F_16BIT)
     605                {
     606                    if (paSegments[iSeg].fFlags & BS3HIGHDLLSEGMENT_F_EXEC)
     607                    {
     608                        if (idxHi16BitCs >= BS3_SEL_HIGH16_CS_COUNT)
     609                            return RTMsgErrorExitFailure("Out of 16-bit CS selectors ('%s')!", paInputs[i].pszFile);
     610                        paSegments[iSeg].idxSel = BS3_SEL_HIGH16_CS_FIRST + idxHi16BitCs * 8;
     611                        idxHi16BitCs++;
     612                        rc = RTLdrLxSetSegmentSelectors(paInputs[i].hLdrMod, iSeg, paSegments[iSeg].idxSel, BS3_SEL_HIGH32_CS);
     613                    }
     614                    else
     615                    {
     616                        if (idxHi16BitDs >= BS3_SEL_HIGH16_DS_COUNT)
     617                            return RTMsgErrorExitFailure("Out of 16-bit DS selectors ('%s')!", paInputs[i].pszFile);
     618                        paSegments[iSeg].idxSel = BS3_SEL_HIGH16_DS_FIRST + idxHi16BitDs * 8;
     619                        idxHi16BitDs++;
     620                        rc = RTLdrLxSetSegmentSelectors(paInputs[i].hLdrMod, iSeg, paSegments[iSeg].idxSel, BS3_SEL_HIGH32_DS);
     621                    }
     622                }
     623                else
     624                {
     625                    if (paSegments[iSeg].fFlags & BS3HIGHDLLSEGMENT_F_32BIT)
     626                        paSegments[iSeg].idxSel = paSegments[iSeg].fFlags & BS3HIGHDLLSEGMENT_F_EXEC
     627                                                ? BS3_SEL_HIGH32_CS : BS3_SEL_HIGH32_DS;
     628                    else if (paSegments[iSeg].fFlags & BS3HIGHDLLSEGMENT_F_64BIT)
     629                        paSegments[iSeg].idxSel = paSegments[iSeg].fFlags & BS3HIGHDLLSEGMENT_F_EXEC
     630                                                ? BS3_SEL_HIGH64_CS : BS3_SEL_HIGH64_DS;
     631                    else
     632                        paSegments[iSeg].idxSel = 0;
     633                    rc = RTLdrLxSetSegmentSelectors(paInputs[i].hLdrMod, iSeg, 4, paSegments[iSeg].idxSel);
     634                }
     635                if (RT_FAILURE(rc))
     636                    return RTMsgErrorExitFailure("RTLdrLxSetSegmentSelectors failed segment #%u in '%s': %Rrc",
     637                                                 iSeg, paInputs[i].pszFile, rc);
     638                paSegments[iSeg].uAddr += uHiLoadAddr - BS3HIGHDLL_LOAD_ADDRESS; /* Was RVA + BS3HIGHDLL_LOAD_ADDRESS. */
     639            }
    443640
    444641            /* Update the export addresses. */
     
    449646            {
    450647                const char * const pszSymbol = (const char *)&pszzStrings[paExports[iExport].offName];
    451                 RTLDRADDR          Value     = 0;
     648                uint16_t const     idxSeg    = paExports[iExport].idxSel;
     649                if (idxSeg >= cSegments)
     650                    return RTMsgErrorExitFailure("Bogus idxSel for '%s' in '%s': %#x(:%#x)",
     651                                                 pszSymbol, paInputs[i].pszFile, idxSeg, paExports[iExport].offSeg);
     652                RTLDRADDR Value = 0;
    452653                rc = RTLdrGetSymbolEx(paInputs[i].hLdrMod, paInputs[i].pbBits, uHiLoadAddr, UINT32_MAX, pszSymbol, &Value);
    453654                if (RT_SUCCESS(rc))
     655                {
     656                    if (Value != paExports[iExport].offSeg + paSegments[idxSeg].uAddr)
     657                        return RTMsgErrorExitFailure("Bogus value for '%s' in '%s': %#RX64, expected %#RX64",
     658                                                     pszSymbol, paInputs[i].pszFile, Value,
     659                                                     paExports[iExport].offSeg + paSegments[idxSeg].uAddr);
    454660                    paExports[iExport].offFlat = (uint32_t)Value;
     661                    paExports[iExport].idxSel = paSegments[idxSeg].idxSel;
     662                    if (paSegments[idxSeg].fFlags & (BS3HIGHDLLSEGMENT_F_32BIT | BS3HIGHDLLSEGMENT_F_64BIT))
     663                        paExports[iExport].offSeg = (uint32_t)Value; /* 32-bit and 64-bit uses FLAT selectors, so FLAT addresses too. */
     664                }
    455665                else
    456666                    return RTMsgErrorExitFailure("Failed to resolve '%s' in '%s': %Rrc", pszSymbol, paInputs[i].pszFile, rc);
    457                 /** @todo Do BS3HIGHDLLEXPORTENTRY::offSeg and idxSel. */
    458667            }
     668
     669            /* Get the fixed up image bits. */
     670            rc = RTLdrGetBits(paInputs[i].hLdrMod, paInputs[i].pbBits, uHiLoadAddr, ResolveHighDllImportCallback, pHighDllEntry);
     671            if (RT_FAILURE(rc))
     672                return RTMsgErrorExitFailure("RTLdrGetBits failed on '%s': %Rrc", paInputs[i].pszFile, rc);
    459673
    460674            /* Update the DLL entry with the load address and file address: */
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac

    r102157 r102277  
    290290; The high dll table segment.
    291291;
     292section BS3HIGHDLLSEGMENTS  align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT
    292293section BS3HIGHDLLEXPORTS   align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT ;; @todo Consider moving this to DATA16...
    293294section BS3HIGHDLLIMPORTS   align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT
     
    297298section BS3HIGHDLLTABLE_END align=4 CLASS=BS3HIGHDLLCLASS PUBLIC USE32 FLAT
    298299BS3_GLOBAL_DATA g_Bs3HighDllTable_End, 0
    299 GROUP BS3HIGHDLLGROUP  BS3HIGHDLLIMPORTS BS3HIGHDLLEXPORTS BS3HIGHDLLSTRINGS BS3HIGHDLLTABLE BS3HIGHDLLTABLE_END
     300GROUP BS3HIGHDLLGROUP  BS3HIGHDLLSEGMENTS BS3HIGHDLLEXPORTS BS3HIGHDLLIMPORTS BS3HIGHDLLSTRINGS BS3HIGHDLLTABLE BS3HIGHDLLTABLE_END
    300301
    301302;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c

    r102270 r102277  
    101101     */
    102102    Bs3CpuDetect_rm_far();
    103 Bs3TestPrintf("#1\n");
    104103    Bs3InitMemory_rm_far();
    105 Bs3TestPrintf("#2\n");
    106104    Bs3InitGdt_rm_far();
    107 Bs3TestPrintf("#3\n");
    108105
    109106#ifdef BS3_INIT_ALL_WITH_HIGH_DLLS
     
    114111    Bs3InitHighDlls_rm_far();
    115112#endif
    116 Bs3TestPrintf("#4\n");
    117113
    118114    /*
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitHighDlls.c

    r102270 r102277  
    5252{
    5353    unsigned const cHighDlls = (unsigned)(&g_Bs3HighDllTable_End - &g_aBs3HighDllTable[0]);
    54     Bs3TestPrintf("cHighDlls=%d g_uBs3CpuDetected=%#x Bs3InitHighDlls_rm_far=%p\n", cHighDlls, g_uBs3CpuDetected, &Bs3InitHighDlls_rm_far);
     54    //Bs3TestPrintf("cHighDlls=%d g_uBs3CpuDetected=%#x Bs3InitHighDlls_rm_far=%p\n", cHighDlls, g_uBs3CpuDetected, &Bs3InitHighDlls_rm_far);
    5555
    5656    if (   cHighDlls > 0
     
    6565        uint8_t       uMaxSector   = 0;
    6666        int rc = Bs3DiskQueryGeometry_rm(bDrive, &uMaxCylinder, &uMaxHead, &uMaxSector);
    67         Bs3TestPrintf("Bs3DiskQueryGeometry(%#x)-> C=%#x H=%#x S=%#x\n", bDrive, uMaxCylinder, uMaxHead, uMaxSector);
     67        //Bs3TestPrintf("Bs3DiskQueryGeometry(%#x)-> C=%#x H=%#x S=%#x\n", bDrive, uMaxCylinder, uMaxHead, uMaxSector);
    6868        if (rc == 0)
    6969        {
     
    7777            uint32_t         uFlatBuf;
    7878            uint8_t          cBufSectors;
    79             uint16_t         cbBuf = 12*_1K; /* This is typically enough for a track (512*18 = 0x2400 (9216)). */
    80             uint8_t BS3_FAR *pbBuf = (uint8_t BS3_FAR *)Bs3MemAlloc(BS3MEMKIND_REAL, cbBuf);
     79            uint8_t BS3_FAR *pbBuf;
     80            uint16_t         cbBuf          = uMaxSector >= 72U ? 72U * 512U : uMaxSector * 512U;
     81            void BS3_FAR    *pvBufAllocated = Bs3MemAlloc(BS3MEMKIND_REAL, cbBuf);
    8182            if (!pbBuf)
    8283            {
    8384                cbBuf = _4K;
    84                 pbBuf = (uint8_t BS3_FAR *)Bs3MemAlloc(BS3MEMKIND_REAL, cbBuf);
    85                 if (!pbBuf)
     85                pvBufAllocated = Bs3MemAlloc(BS3MEMKIND_REAL, cbBuf);
     86                if (!pvBufAllocated)
    8687                {
    8788                    Bs3TestPrintf("Failed to allocate 4 KiB memory buffer for loading high DLL(s)!\n");
     
    8990                }
    9091            }
    91             cBufSectors = (uint8_t)(cbBuf / 512);
    92             uFlatBuf    = BS3_FP_REAL_TO_FLAT(pbBuf);
     92            cBufSectors = (uint8_t)(cbBuf / 512U);
     93            uFlatBuf    = BS3_FP_REAL_TO_FLAT(pvBufAllocated);
     94            pbBuf = (uint8_t BS3_FAR *)BS3_FP_MAKE(uFlatBuf >> 4, 0); /* make sure the whole buffer is within a segment.  */
     95            /** @todo Is the above pbBuf hack necessary? */
     96            //Bs3TestPrintf("pvBufAllocated=%p pbBuf=%p uFlatBuf=%RX32 cbBuf=%#x\n", pvBufAllocated, pbBuf, uFlatBuf, cbBuf);
    9397
    9498            /*
     
    101105                uint16_t const            cPagesToLoad = (uint16_t)(g_aBs3HighDllTable[i].cbLoaded / _4K);
    102106                uint16_t                  iPage;
    103                 Bs3Printf("Loading dll '%s' at %#RX32 ...", pszFilename, g_aBs3HighDllTable[i].uLoadAddr);
     107                Bs3Printf("Loading dll '%s' at %#RX32..%#RX32 ...", pszFilename, g_aBs3HighDllTable[i].uLoadAddr,
     108                          g_aBs3HighDllTable[i].uLoadAddr + g_aBs3HighDllTable[i].cbLoaded - 1);
    104109
    105110                /*
     
    134139                        uint32_t       uChecksum          = BS3_CALC_CHECKSUM_INITIAL_VALUE;
    135140#endif
    136                         uint32_t       cSectorsLeftToLoad = g_aBs3HighDllTable[i].cbInImage  / 512;
     141                        uint32_t       cSectorsLeftToLoad = g_aBs3HighDllTable[i].cbInImage  / 512U;
    137142                        uint32_t       uCurFlatLoadAddr   = g_aBs3HighDllTable[i].uLoadAddr;
    138143                        /* Calculate the current CHS position: */
    139                         uint32_t const uCurSectorInImage  = g_aBs3HighDllTable[i].offInImage / 512;
     144                        uint32_t const uCurSectorInImage  = g_aBs3HighDllTable[i].offInImage / 512U;
    140145                        uint16_t       uCylinder          = uCurSectorInImage / cSectorsPerCylinder;
    141146                        uint16_t const uRemainder         = uCurSectorInImage % cSectorsPerCylinder;
     
    151156                                cSectors = (uint8_t)(cSectorsLeftToLoad);
    152157
    153                             Bs3TestPrintf("Calling Bs3DiskRead(%#x,%#x,%#x,%#x,%#x,%p) [uCurFlatLoadAddr=%RX32]\n",
    154                                           bDrive, uCylinder, uHead, uSector, cSectors, pbBuf, uCurFlatLoadAddr);
     158                            //Bs3TestPrintf("Calling Bs3DiskRead(%#x,%#x,%#x,%#x,%#x,%p) [uCurFlatLoadAddr=%RX32]\n",
     159                            //              bDrive, uCylinder, uHead, uSector, cSectors, pbBuf, uCurFlatLoadAddr);
    155160                            rc = Bs3DiskRead_rm(bDrive, uCylinder, uHead, uSector, cSectors, pbBuf);
    156161                            if (rc != 0)
     
    169174                                for (j = 0; j < cSectors; j++, iCurSector++)
    170175                                    Bs3TestPrintf("sector #%RU32:  %#RX32 %#010RX32\n", iCurSector,
    171                                                   uChecksumTmp = Bs3CalcChecksum(uChecksumTmp, &pbBuf[j * 512], 512),
    172                                                   Bs3CalcChecksum(BS3_CALC_CHECKSUM_INITIAL_VALUE, &pbBuf[j * 512], 512));
    173                                 uChecksum = Bs3CalcChecksum(uChecksum, pbBuf, 512 * cSectors);
     176                                                  uChecksumTmp = Bs3CalcChecksum(uChecksumTmp, &pbBuf[j * 512U], 512U),
     177                                                  Bs3CalcChecksum(BS3_CALC_CHECKSUM_INITIAL_VALUE, &pbBuf[j * 512U], 512U));
     178                                uChecksum = Bs3CalcChecksum(uChecksum, pbBuf, 512U * cSectors);
    174179                                if (uChecksum != uChecksumTmp)
    175180                                    Bs3TestPrintf("Checksum error: %#RX32, expected %#RX32!\n", uChecksum, uChecksumTmp);
    176181                            }
    177182# else
    178                             uChecksum = Bs3CalcChecksum(uChecksum, pbBuf, 512 * cSectors);
     183                            uChecksum = Bs3CalcChecksum(uChecksum, pbBuf, 512U * cSectors);
    179184# endif
    180185#endif
    181186
    182187                            /* Copy the page to where the DLL is being loaded.  */
    183                             Bs3MemCopyFlat_rm_far(uCurFlatLoadAddr, uFlatBuf, 512 * cSectors);
     188                            Bs3MemCopyFlat_rm_far(uCurFlatLoadAddr, uFlatBuf, 512U * cSectors);
    184189                            Bs3PrintChr('.');
    185190
    186191                            /* Advance */
    187                             uCurFlatLoadAddr   += cSectors * 512;
     192                            uCurFlatLoadAddr   += cSectors * 512U;
    188193                            cSectorsLeftToLoad -= cSectors;
    189194                            uSector            += cSectors;
     
    214219
    215220            Bs3Printf("\n");
    216             Bs3MemFree(pbBuf, cbBuf);
     221            Bs3MemFree(pvBufAllocated, cbBuf);
    217222        }
    218223        else
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-system-data.asm

    r98103 r102277  
    445445
    446446        ;
     447        ; 2908..29b0h - High DLL CSes.
     448        ;
     449BS3GdtAssertOffset 02908h
     450BS3_GLOBAL_DATA Bs3GdteHighDllCSes, 0c0h
     451        times 0c0h db 0
     452
     453        ;
     454        ; 29b8..29f0h - High DLL DSes.
     455        ;
     456BS3GdtAssertOffset 029c8h
     457BS3_GLOBAL_DATA Bs3GdteHighDllDSes, 40h
     458        times 40h db 0
     459
     460        ;
    447461        ; 2908..2f98h - Free GDTEs.
    448462        ;
    449 BS3GdtAssertOffset 02908h
    450 BS3_GLOBAL_DATA Bs3GdteFreePart4, 698h
    451         times 698h db 0
     463BS3GdtAssertOffset 02a08h
     464BS3_GLOBAL_DATA Bs3GdteFreePart4, 598h
     465        times 598h db 0
    452466
    453467        ;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-linker.h

    r102270 r102277  
    101101    uint32_t    cExports;           /**< Number of exports. */
    102102    int32_t     offExports;         /**< Relative address (to entry start) of the export table. */
     103    uint32_t    cSegments;          /**< Number of segments. */
     104    int32_t     offSegments;        /**< Relative address (to entry start) of the segment table. */
    103105    uint32_t    cbStrings;          /**< Size of the string table in bytes. */
    104106    int32_t     offStrings;         /**< Relative address (to entry start) of the string table. */
     
    113115    uint16_t    offName;
    114116    uint16_t    uSeg;
     117    uint32_t    offSeg;             /**< We'll see... */
    115118    uint32_t    offFlat;
    116119} BS3HIGHDLLIMPORTENTRY;
     
    124127    uint16_t    offName;            /**< The string table offset. */
    125128} BS3HIGHDLLEXPORTENTRY;
     129
     130typedef struct BS3HIGHDLLSEGMENT
     131{
     132    uint32_t    uAddr;
     133    uint32_t    cb;
     134    uint16_t    idxSel;
     135    uint16_t    fFlags;
     136} BS3HIGHDLLSEGMENT;
     137#define BS3HIGHDLLSEGMENT_F_EXEC    1
     138#define BS3HIGHDLLSEGMENT_F_16BIT   2
     139#define BS3HIGHDLLSEGMENT_F_32BIT   4
     140#define BS3HIGHDLLSEGMENT_F_64BIT   8
     141
     142
     143/** @name High DLL selector ranges.
     144 * @{ */
     145#define BS3_SEL_HIGH16_CS_FIRST     0x2908
     146#define BS3_SEL_HIGH16_CS_COUNT     0x18
     147#define BS3_SEL_HIGH16_DS_FIRST     0x29c8
     148#define BS3_SEL_HIGH16_DS_COUNT     0x08
     149#define BS3_SEL_HIGH32_CS           0x0118
     150#define BS3_SEL_HIGH32_DS           0x0120
     151#define BS3_SEL_HIGH64_CS           0x0130
     152#define BS3_SEL_HIGH64_DS           0x0138
     153#ifdef BS3KIT_INCLUDED_bs3kit_h
     154AssertCompile(BS3_SEL_HIGH16_CS_00 == BS3_SEL_HIGH16_CS_FIRST);
     155AssertCompile(BS3_SEL_HIGH16_DS_00 == BS3_SEL_HIGH16_DS_FIRST);
     156AssertCompile(BS3_SEL_HIGH32_CS    == BS3_SEL_R0_CS32);
     157AssertCompile(BS3_SEL_HIGH32_DS    == BS3_SEL_R0_DS32);
     158AssertCompile(BS3_SEL_HIGH64_CS    == BS3_SEL_R0_CS64);
     159AssertCompile(BS3_SEL_HIGH64_DS    == BS3_SEL_R0_DS64);
     160#endif
     161/** @} */
    126162
    127163
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r102157 r102277  
    501501#define BS3_SEL_DATA16              0x2900 /**< The BS3DATA16/BS3KIT_GRPNM_DATA16 selector. */
    502502
    503 #define BS3_SEL_FREE_PART4          0x2908 /**< Free selector space - part \#4. */
     503#define BS3_SEL_HIGH16_CS_00        0x2908 /**< 16-bit CS for high DLLs. */
     504#define BS3_SEL_HIGH16_CS_01        0x2910 /**< 16-bit CS for high DLLs. */
     505#define BS3_SEL_HIGH16_CS_02        0x2918 /**< 16-bit CS for high DLLs. */
     506#define BS3_SEL_HIGH16_CS_03        0x2920 /**< 16-bit CS for high DLLs. */
     507#define BS3_SEL_HIGH16_CS_04        0x2928 /**< 16-bit CS for high DLLs. */
     508#define BS3_SEL_HIGH16_CS_05        0x2930 /**< 16-bit CS for high DLLs. */
     509#define BS3_SEL_HIGH16_CS_06        0x2938 /**< 16-bit CS for high DLLs. */
     510#define BS3_SEL_HIGH16_CS_07        0x2940 /**< 16-bit CS for high DLLs. */
     511#define BS3_SEL_HIGH16_CS_08        0x2948 /**< 16-bit CS for high DLLs. */
     512#define BS3_SEL_HIGH16_CS_09        0x2950 /**< 16-bit CS for high DLLs. */
     513#define BS3_SEL_HIGH16_CS_0a        0x2958 /**< 16-bit CS for high DLLs. */
     514#define BS3_SEL_HIGH16_CS_0b        0x2960 /**< 16-bit CS for high DLLs. */
     515#define BS3_SEL_HIGH16_CS_0c        0x2968 /**< 16-bit CS for high DLLs. */
     516#define BS3_SEL_HIGH16_CS_0d        0x2970 /**< 16-bit CS for high DLLs. */
     517#define BS3_SEL_HIGH16_CS_0e        0x2978 /**< 16-bit CS for high DLLs. */
     518#define BS3_SEL_HIGH16_CS_0f        0x2980 /**< 16-bit CS for high DLLs. */
     519#define BS3_SEL_HIGH16_CS_10        0x2988 /**< 16-bit CS for high DLLs. */
     520#define BS3_SEL_HIGH16_CS_11        0x2990 /**< 16-bit CS for high DLLs. */
     521#define BS3_SEL_HIGH16_CS_12        0x2998 /**< 16-bit CS for high DLLs. */
     522#define BS3_SEL_HIGH16_CS_13        0x29a0 /**< 16-bit CS for high DLLs. */
     523#define BS3_SEL_HIGH16_CS_14        0x29a8 /**< 16-bit CS for high DLLs. */
     524#define BS3_SEL_HIGH16_CS_15        0x29b0 /**< 16-bit CS for high DLLs. */
     525#define BS3_SEL_HIGH16_CS_16        0x29b8 /**< 16-bit CS for high DLLs. */
     526#define BS3_SEL_HIGH16_CS_17        0x29c0 /**< 16-bit CS for high DLLs. */
     527
     528#define BS3_SEL_HIGH16_DS_00        0x29c8 /**< 16-bit DS for high DLLs. */
     529#define BS3_SEL_HIGH16_DS_01        0x29d0 /**< 16-bit DS for high DLLs. */
     530#define BS3_SEL_HIGH16_DS_02        0x29d8 /**< 16-bit DS for high DLLs. */
     531#define BS3_SEL_HIGH16_DS_03        0x29e0 /**< 16-bit DS for high DLLs. */
     532#define BS3_SEL_HIGH16_DS_04        0x29e8 /**< 16-bit DS for high DLLs. */
     533#define BS3_SEL_HIGH16_DS_05        0x29f0 /**< 16-bit DS for high DLLs. */
     534#define BS3_SEL_HIGH16_DS_06        0x29f8 /**< 16-bit DS for high DLLs. */
     535#define BS3_SEL_HIGH16_DS_07        0x2a00 /**< 16-bit DS for high DLLs. */
     536
     537#define BS3_SEL_FREE_PART4          0x2a08 /**< Free selector space - part \#4. */
    504538#define BS3_SEL_FREE_PART4_LAST     0x2f98 /**< Free selector space - part \#4, last entry. */
    505539
     
    10551089extern X86DESC BS3_FAR_DATA Bs3Gdte_DATA16;
    10561090
     1091/** 16-bit CSes for high DLLs. */
     1092extern X86DESC BS3_FAR_DATA Bs3GdteHighDllCSes[24];
     1093/** 16-bit DSes for high DLLs. */
     1094extern X86DESC BS3_FAR_DATA Bs3GdteHighDllDSes[8];
     1095
    10571096/** Free GDTes, part \#4. */
    1058 extern X86DESC BS3_FAR_DATA Bs3GdteFreePart4[211];
     1097extern X86DESC BS3_FAR_DATA Bs3GdteFreePart4[179];
    10591098
    10601099extern X86DESC BS3_FAR_DATA Bs3GdtePreTestPage08; /**< GDT entry 8 selectors prior to the test page, testcase resource. @see BS3_SEL_PRE_TEST_PAGE_08 */
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac

    r102157 r102277  
    17031703%define BS3_SEL_DATA16              2900h ;;< The BS3DATA16/BS3KIT_GRPNM_DATA16 selector.
    17041704
    1705 %define BS3_SEL_FREE_PART4          2908h ;;< Free selector space - part \#4.
     1705%define BS3_SEL_HIGH16_CS_00        2908h ;;< 16-bit CS for high DLLs.
     1706%define BS3_SEL_HIGH16_CS_01        2910h ;;< 16-bit CS for high DLLs.
     1707%define BS3_SEL_HIGH16_CS_02        2918h ;;< 16-bit CS for high DLLs.
     1708%define BS3_SEL_HIGH16_CS_03        2920h ;;< 16-bit CS for high DLLs.
     1709%define BS3_SEL_HIGH16_CS_04        2928h ;;< 16-bit CS for high DLLs.
     1710%define BS3_SEL_HIGH16_CS_05        2930h ;;< 16-bit CS for high DLLs.
     1711%define BS3_SEL_HIGH16_CS_06        2938h ;;< 16-bit CS for high DLLs.
     1712%define BS3_SEL_HIGH16_CS_07        2940h ;;< 16-bit CS for high DLLs.
     1713%define BS3_SEL_HIGH16_CS_08        2948h ;;< 16-bit CS for high DLLs.
     1714%define BS3_SEL_HIGH16_CS_09        2950h ;;< 16-bit CS for high DLLs.
     1715%define BS3_SEL_HIGH16_CS_0a        2958h ;;< 16-bit CS for high DLLs.
     1716%define BS3_SEL_HIGH16_CS_0b        2960h ;;< 16-bit CS for high DLLs.
     1717%define BS3_SEL_HIGH16_CS_0c        2968h ;;< 16-bit CS for high DLLs.
     1718%define BS3_SEL_HIGH16_CS_0d        2970h ;;< 16-bit CS for high DLLs.
     1719%define BS3_SEL_HIGH16_CS_0e        2978h ;;< 16-bit CS for high DLLs.
     1720%define BS3_SEL_HIGH16_CS_0f        2980h ;;< 16-bit CS for high DLLs.
     1721%define BS3_SEL_HIGH16_CS_10        2988h ;;< 16-bit CS for high DLLs.
     1722%define BS3_SEL_HIGH16_CS_11        2990h ;;< 16-bit CS for high DLLs.
     1723%define BS3_SEL_HIGH16_CS_12        2998h ;;< 16-bit CS for high DLLs.
     1724%define BS3_SEL_HIGH16_CS_13        29a0h ;;< 16-bit CS for high DLLs.
     1725%define BS3_SEL_HIGH16_CS_14        29a8h ;;< 16-bit CS for high DLLs.
     1726%define BS3_SEL_HIGH16_CS_15        29b0h ;;< 16-bit CS for high DLLs.
     1727%define BS3_SEL_HIGH16_CS_16        29b8h ;;< 16-bit CS for high DLLs.
     1728%define BS3_SEL_HIGH16_CS_17        29c0h ;;< 16-bit CS for high DLLs.
     1729
     1730%define BS3_SEL_HIGH16_DS_00        29c8h ;;< 16-bit DS for high DLLs.
     1731%define BS3_SEL_HIGH16_DS_01        29d0h ;;< 16-bit DS for high DLLs.
     1732%define BS3_SEL_HIGH16_DS_02        29d8h ;;< 16-bit DS for high DLLs.
     1733%define BS3_SEL_HIGH16_DS_03        29e0h ;;< 16-bit DS for high DLLs.
     1734%define BS3_SEL_HIGH16_DS_04        29e8h ;;< 16-bit DS for high DLLs.
     1735%define BS3_SEL_HIGH16_DS_05        29f0h ;;< 16-bit DS for high DLLs.
     1736%define BS3_SEL_HIGH16_DS_06        29f8h ;;< 16-bit DS for high DLLs.
     1737%define BS3_SEL_HIGH16_DS_07        2a00h ;;< 16-bit DS for high DLLs.
     1738
     1739%define BS3_SEL_FREE_PART4          2a08h ;;< Free selector space - part \#4.
    17061740%define BS3_SEL_FREE_PART4_LAST     2f98h ;;< Free selector space - part \#4, last entry.
    17071741
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