VirtualBox

Changeset 102096 in vbox


Ignore:
Timestamp:
Nov 15, 2023 11:11:59 AM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160217
Message:

ValKit/bootsectors: Need to make sure Visual C++ doesn't make use of SSE instructions.

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

Legend:

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

    r99040 r102096  
    341341# Visual C++ tool variant that runs the object converter afterwards.
    342342#
     343# We also run SED on the assembly listing looking for SSE instructions, since
     344# the compiler doesn't have any known option to suppress SSE optimization. When
     345# the SED script finds something, the source code needs to be tweaked to work
     346# around it. See r160217 for examples.
     347#
    343348TOOL_Bs3Vcc64 := Visual C++ 64-bit
    344349TOOL_Bs3Vcc64_CC  = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CC)
     
    356361TOOL_Bs3Vcc64_COMPILE_C_OUTPUT         = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT)
    357362TOOL_Bs3Vcc64_COMPILE_C_OUTPUT_MAYBE   = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT_MAYBE) $(obj).original
     363TOOL_Bs3Vcc64_COMPILE_C_OUTPUT_MAYBE_PRECIOUS = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT_MAYBE_PRECIOUS) $(outbase)-obj.asm
    358364define TOOL_Bs3Vcc64_COMPILE_C_CMDS
    359 $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_CMDS)
     365$(subst -Fo,-Fa$(outbase)-obj.asm -Fo,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_CMDS))
    360366        $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
     367        $(QUIET)$(SED) -e '/xmm[0-9]/!d' -e 'q11' $(outbase)-obj.asm
    361368endef
    362369
     
    389396TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT       = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT)
    390397TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT_MAYBE) $(obj).original
     398TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT_MAYBE_PRECIOUS = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT_MAYBE_PRECIOUS) $(outbase)-obj.asm
    391399define TOOL_Bs3Vcc64_COMPILE_CXX_CMDS
    392 $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_CMDS)
     400$(subst -Fo,-Fa$(outbase)-obj.asm -Fo,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_CMDS))
    393401        $(QUIET)$(VBOX_BS3KIT_KSUBMIT_OBJ_CONV) $(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
     402        $(QUIET)$(SED) -e '/xmm[0-9]/!d' -e 'q11' $(outbase)-obj.asm
    394403endef
    395404
  • TabularUnified trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c

    r98103 r102096  
    936936    for (; i <= k; i++, g_usBs3TestStep++)
    937937    {
    938         Idtr = IdtrSaved;
    939         Idtr.cbIdt  = i;
     938        Idtr.pIdt  = IdtrSaved.pIdt;
     939        Idtr.cbIdt = i;
    940940        ASMSetIDTR(&Idtr);
    941941        Bs3TrapSetJmpAndRestore(&Ctx81, &TrapCtx);
  • TabularUnified trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxGetXmm.c

    r98103 r102096  
    4545BS3_CMN_DEF(PRTUINT128U, Bs3ExtCtxGetXmm,(PCBS3EXTCTX pExtCtx, uint8_t iReg, PRTUINT128U pValue))
    4646{
     47#ifdef _MSC_VER /* No-SSE hack */
     48    RTUINT128U volatile RT_FAR *pValueNoSseHack = (RTUINT128U volatile RT_FAR *)pValue;
     49# define pValue pValueNoSseHack
     50#endif
    4751    AssertCompileMembersAtSameOffset(BS3EXTCTX, Ctx.x87.aXMM, BS3EXTCTX, Ctx.x.x87.aXMM);
    4852    switch (pExtCtx->enmMethod)
     
    5256            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x87.aXMM))
    5357            {
    54                 pValue->u = pExtCtx->Ctx.x87.aXMM[iReg].xmm;
     58                pValue->au64[0] = pExtCtx->Ctx.x87.aXMM[iReg].au64[0];
     59                pValue->au64[1] = pExtCtx->Ctx.x87.aXMM[iReg].au64[1];
    5560                return pValue;
    5661            }
     
    6065    pValue->au64[0] = 0;
    6166    pValue->au64[1] = 0;
    62     return pValue;
     67    return (PRTUINT128U)pValue;
    6368}
    6469
  • TabularUnified trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxGetYmm.c

    r98103 r102096  
    4545BS3_CMN_DEF(PRTUINT256U, Bs3ExtCtxGetYmm,(PCBS3EXTCTX pExtCtx, uint8_t iReg, PRTUINT256U pValue))
    4646{
    47     pValue->au128[0].au64[0] = 0;
    48     pValue->au128[0].au64[1] = 0;
    49     pValue->au128[1].au64[0] = 0;
    50     pValue->au128[1].au64[1] = 0;
     47#ifdef _MSC_VER /* No-SSE hack */
     48    RTUINT256U volatile RT_FAR *pValueNoSseHack = (RTUINT256U volatile RT_FAR *)pValue; /* No-SSE hack */
     49# define pValue pValueNoSseHack
     50#endif
     51    pValue->au64[0] = 0;
     52    pValue->au64[1] = 0;
     53    pValue->au64[2] = 0;
     54    pValue->au64[3] = 0;
    5155
    5256    switch (pExtCtx->enmMethod)
     
    5458        case BS3EXTCTXMETHOD_FXSAVE:
    5559            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x87.aXMM))
    56                 pValue->au128[0] = pExtCtx->Ctx.x87.aXMM[iReg].uXmm;
     60            {
     61                pValue->au64[0] = pExtCtx->Ctx.x87.aXMM[iReg].uXmm.au64[0];
     62                pValue->au64[1] = pExtCtx->Ctx.x87.aXMM[iReg].uXmm.au64[1];
     63            }
    5764            break;
    5865
     
    6067            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x.x87.aXMM))
    6168            {
    62                 pValue->au128[0] = pExtCtx->Ctx.x87.aXMM[iReg].uXmm;
     69                pValue->au64[0] = pExtCtx->Ctx.x87.aXMM[iReg].uXmm.au64[0];
     70                pValue->au64[1] = pExtCtx->Ctx.x87.aXMM[iReg].uXmm.au64[1];
    6371                if (pExtCtx->fXcr0Nominal & XSAVE_C_YMM)
    64                     pValue->au128[1] = pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].uXmm;
     72                {
     73                    pValue->au64[2] = pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].uXmm.au64[0];
     74                    pValue->au64[3] = pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].uXmm.au64[1];
     75                }
    6576            }
    6677            break;
    6778    }
    68     return pValue;
     79    return (PRTUINT256U)pValue;
    6980}
    7081
  • TabularUnified trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxSetXmm.c

    r98103 r102096  
    5252            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x87.aXMM))
    5353            {
    54                 pExtCtx->Ctx.x87.aXMM[iReg].xmm = pValue->u;
     54                pExtCtx->Ctx.x87.aXMM[iReg].au64[0] = pValue->au64[0];
     55                pExtCtx->Ctx.x87.aXMM[iReg].au64[1] = pValue->au64[1];
    5556                return true;
    5657            }
  • TabularUnified trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxSetYmm.c

    r98103 r102096  
    4545BS3_CMN_DEF(bool, Bs3ExtCtxSetYmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT256U pValue, uint8_t cbValue))
    4646{
     47#ifdef _MSC_VER /* No-SSE hack */
     48    BS3EXTCTX volatile RT_FAR *pExtCtxNoSseHack = (BS3EXTCTX volatile RT_FAR *)pExtCtx;
     49# define pExtCtx pExtCtxNoSseHack
     50#endif
    4751    BS3_ASSERT(cbValue == 16 || cbValue == 32);
    4852    switch (pExtCtx->enmMethod)
     
    5155            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x87.aXMM))
    5256            {
    53                 pExtCtx->Ctx.x87.aXMM[iReg].uXmm = pValue->DQWords.dqw0;
     57                pExtCtx->Ctx.x87.aXMM[iReg].au64[0] = pValue->DQWords.dqw0.au64[0];
     58                pExtCtx->Ctx.x87.aXMM[iReg].au64[1] = pValue->DQWords.dqw0.au64[1];
    5459                return true;
    5560            }
     
    5964            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x.x87.aXMM))
    6065            {
    61                 pExtCtx->Ctx.x87.aXMM[iReg].uXmm = pValue->DQWords.dqw0;
     66                pExtCtx->Ctx.x87.aXMM[iReg].au64[0] = pValue->DQWords.dqw0.au64[0];
     67                pExtCtx->Ctx.x87.aXMM[iReg].au64[1] = pValue->DQWords.dqw0.au64[1];
    6268                if (pExtCtx->fXcr0Nominal & XSAVE_C_YMM)
    6369                {
    6470                    if (cbValue >= 32)
    65                         pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].uXmm = pValue->DQWords.dqw1;
     71                    {
     72                        pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].au64[0] = pValue->DQWords.dqw1.au64[0];
     73                        pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].au64[1] = pValue->DQWords.dqw1.au64[1];
     74                    }
    6675                    else
    6776                    {
  • TabularUnified trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingQueryAddressInfo.c

    r98103 r102096  
    4747BS3_CMN_DEF(int, Bs3PagingQueryAddressInfo,(uint64_t uFlat, PBS3PAGINGINFO4ADDR pPgInfo))
    4848{
     49#ifdef _MSC_VER
     50    BS3PAGINGINFO4ADDR volatile BS3_FAR *pPgInfoNoSseHack = (BS3PAGINGINFO4ADDR volatile BS3_FAR *)pPgInfo;
     51# define pPgInfo pPgInfoNoSseHack
     52#endif
    4953    RTCCUINTXREG const  cr3        = ASMGetCR3();
    5054    RTCCUINTXREG const  cr4        = g_uBs3CpuDetected & BS3CPU_F_CPUID ? ASMGetCR4() : 0;
  • TabularUnified trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64Init.c

    r98103 r102096  
    7676        /* [X86_XCPT_CP] = */   6,
    7777    };
     78#ifdef _MSC_VER /* No-SSE hack */
     79    X86TSS64 BS3_FAR volatile *pTss;
     80#else
    7881    X86TSS64 BS3_FAR *pTss;
     82#endif
    7983    unsigned iIdt;
    8084
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