VirtualBox

Ignore:
Timestamp:
Jun 27, 2022 5:49:40 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151994
Message:

ValKit/bs3kit,bs3-cpu-instr-3: 128 and 256 bit wide vxorps, alignment checks. bugref:9898

Location:
trunk/src/VBox/ValidationKit/bootsectors/bs3kit
Files:
6 edited
2 copied

Legend:

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

    r95376 r95397  
    151151       bs3-cmn-ExtCtxGetMm.c \
    152152       bs3-cmn-ExtCtxSetMm.c \
     153       bs3-cmn-ExtCtxGetXmm.c \
     154       bs3-cmn-ExtCtxSetXmm.c \
    153155       bs3-cmn-ExtCtxGetYmm.c \
    154156       bs3-cmn-ExtCtxSetYmm.c \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxGetXmm.c

    r95372 r95397  
    11/* $Id$ */
    22/** @file
    3  * BS3Kit - Bs3ExtCtxGetYmm
     3 * BS3Kit - Bs3ExtCtxGetXmm
    44 */
    55
     
    3232
    3333
    34 #undef Bs3ExtCtxGetYmm
    35 BS3_CMN_DEF(PRTUINT256U, Bs3ExtCtxGetYmm,(PCBS3EXTCTX pExtCtx, uint8_t iReg, PRTUINT256U pValue))
     34#undef Bs3ExtCtxGetXmm
     35BS3_CMN_DEF(PRTUINT128U, Bs3ExtCtxGetXmm,(PCBS3EXTCTX pExtCtx, uint8_t iReg, PRTUINT128U pValue))
    3636{
    37     pValue->au128[0].au64[0] = 0;
    38     pValue->au128[0].au64[1] = 0;
    39     pValue->au128[1].au64[0] = 0;
    40     pValue->au128[1].au64[1] = 0;
    41 
     37    AssertCompileMembersAtSameOffset(BS3EXTCTX, Ctx.x87.aXMM, BS3EXTCTX, Ctx.x.x87.aXMM);
    4238    switch (pExtCtx->enmMethod)
    4339    {
    4440        case BS3EXTCTXMETHOD_FXSAVE:
     41        case BS3EXTCTXMETHOD_XSAVE:
    4542            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x87.aXMM))
    46                 pValue->au128[0] = pExtCtx->Ctx.x87.aXMM[iReg].uXmm;
    47             break;
    48 
    49         case BS3EXTCTXMETHOD_XSAVE:
    50             if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x.x87.aXMM))
    5143            {
    52                 pValue->au128[0] = pExtCtx->Ctx.x87.aXMM[iReg].uXmm;
    53                 if (pExtCtx->fXcr0Nominal & XSAVE_C_YMM)
    54                     pValue->au128[1] = pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].uXmm;
     44                pValue->u = pExtCtx->Ctx.x87.aXMM[iReg].xmm;
     45                return pValue;
    5546            }
    5647            break;
    5748    }
     49
     50    pValue->au64[0] = 0;
     51    pValue->au64[1] = 0;
    5852    return pValue;
    5953}
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxSetXmm.c

    r95374 r95397  
    11/* $Id$ */
    22/** @file
    3  * BS3Kit - Bs3ExtCtxSetYmm
     3 * BS3Kit - Bs3ExtCtxSetXmm
    44 */
    55
     
    3232
    3333
    34 #undef Bs3ExtCtxSetYmm
    35 BS3_CMN_DEF(bool, Bs3ExtCtxSetYmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT256U pValue, bool f128Bit))
     34#undef Bs3ExtCtxSetXmm
     35BS3_CMN_DEF(bool, Bs3ExtCtxSetXmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT128U pValue))
    3636{
     37    AssertCompileMembersAtSameOffset(BS3EXTCTX, Ctx.x87.aXMM, BS3EXTCTX, Ctx.x.x87.aXMM);
    3738    switch (pExtCtx->enmMethod)
    3839    {
    3940        case BS3EXTCTXMETHOD_FXSAVE:
     41        case BS3EXTCTXMETHOD_XSAVE:
    4042            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x87.aXMM))
    4143            {
    42                 pExtCtx->Ctx.x87.aXMM[iReg].uXmm = pValue->au128[0];
    43                 return true;
    44             }
    45             break;
    46 
    47         case BS3EXTCTXMETHOD_XSAVE:
    48             if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x.x87.aXMM))
    49             {
    50                 pExtCtx->Ctx.x87.aXMM[iReg].uXmm = pValue->au128[0];
    51                 if ((pExtCtx->fXcr0Nominal & XSAVE_C_YMM) && !f128Bit)
    52                     pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].uXmm = pValue->au128[1];
     44                pExtCtx->Ctx.x87.aXMM[iReg].xmm = pValue->u;
    5345                return true;
    5446            }
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxSetYmm.c

    r95374 r95397  
    3333
    3434#undef Bs3ExtCtxSetYmm
    35 BS3_CMN_DEF(bool, Bs3ExtCtxSetYmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT256U pValue, bool f128Bit))
     35BS3_CMN_DEF(bool, Bs3ExtCtxSetYmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT256U pValue, uint8_t cbValue))
    3636{
     37    BS3_ASSERT(cbValue == 16 || cbValue == 32);
    3738    switch (pExtCtx->enmMethod)
    3839    {
     
    4041            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x87.aXMM))
    4142            {
    42                 pExtCtx->Ctx.x87.aXMM[iReg].uXmm = pValue->au128[0];
     43                pExtCtx->Ctx.x87.aXMM[iReg].uXmm = pValue->DQWords.dqw0;
    4344                return true;
    4445            }
     
    4849            if (iReg < RT_ELEMENTS(pExtCtx->Ctx.x.x87.aXMM))
    4950            {
    50                 pExtCtx->Ctx.x87.aXMM[iReg].uXmm = pValue->au128[0];
    51                 if ((pExtCtx->fXcr0Nominal & XSAVE_C_YMM) && !f128Bit)
    52                     pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].uXmm = pValue->au128[1];
     51                pExtCtx->Ctx.x87.aXMM[iReg].uXmm = pValue->DQWords.dqw0;
     52                if (pExtCtx->fXcr0Nominal & XSAVE_C_YMM)
     53                {
     54                    if (cbValue >= 32)
     55                        pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].uXmm = pValue->DQWords.dqw1;
     56                    else
     57                    {
     58                        pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].au64[0] = 0;
     59                        pExtCtx->Ctx.x.u.YmmHi.aYmmHi[iReg].au64[1] = 0;
     60                    }
     61                    /** @todo zero high ZMM part. */
     62                }
    5363                return true;
    5464            }
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk

    r95376 r95397  
    3838$(call BS3KIT_FN_GEN_CMN_FARSTUB,bs3kit-common-16,Bs3RegCtxSaveEx,8)
    3939$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxSetMm)
     40$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxSetXmm)
    4041$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxSetYmm)
    4142$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestCheckExtCtx)
     
    6364$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxInit)
    6465$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetHandler)
     66$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxGetXmm)
    6567$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxGetYmm)
    6668$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Printf)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h

    r95376 r95397  
    3737#define Bs3ExtCtxGetMxCsr BS3_CMN_MANGLER(Bs3ExtCtxGetMxCsr)
    3838#define Bs3ExtCtxGetSize BS3_CMN_MANGLER(Bs3ExtCtxGetSize)
     39#define Bs3ExtCtxGetXmm BS3_CMN_MANGLER(Bs3ExtCtxGetXmm)
    3940#define Bs3ExtCtxGetYmm BS3_CMN_MANGLER(Bs3ExtCtxGetYmm)
    4041#define Bs3ExtCtxInit BS3_CMN_MANGLER(Bs3ExtCtxInit)
     
    4344#define Bs3ExtCtxSetMm BS3_CMN_MANGLER(Bs3ExtCtxSetMm)
    4445#define Bs3ExtCtxSetMxCsr BS3_CMN_MANGLER(Bs3ExtCtxSetMxCsr)
     46#define Bs3ExtCtxSetXmm BS3_CMN_MANGLER(Bs3ExtCtxSetXmm)
    4547#define Bs3ExtCtxSetYmm BS3_CMN_MANGLER(Bs3ExtCtxSetYmm)
    4648#define Bs3GetCpuVendor BS3_CMN_MANGLER(Bs3GetCpuVendor)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h

    r95376 r95397  
    3737#undef Bs3ExtCtxGetMxCsr
    3838#undef Bs3ExtCtxGetSize
     39#undef Bs3ExtCtxGetXmm
    3940#undef Bs3ExtCtxGetYmm
    4041#undef Bs3ExtCtxInit
     
    4344#undef Bs3ExtCtxSetMm
    4445#undef Bs3ExtCtxSetMxCsr
     46#undef Bs3ExtCtxSetXmm
    4547#undef Bs3ExtCtxSetYmm
    4648#undef Bs3GetCpuVendor
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r95376 r95397  
    29162916
    29172917/**
     2918 * Gets the value of XMM register number @a iReg from @a pExtCtx.
     2919 *
     2920 * @returns pValue
     2921 * @param   pExtCtx         The extended CPU context.
     2922 * @param   iReg            The register to get.
     2923 * @param   pValue          Where to return the value. Zeroed if the state
     2924 *                          doesn't support SSE or if @a iReg is invalid.
     2925 */
     2926BS3_CMN_PROTO_STUB(PRTUINT128U, Bs3ExtCtxGetXmm,(PCBS3EXTCTX pExtCtx, uint8_t iReg, PRTUINT128U pValue));
     2927
     2928/**
     2929 * Sets the value of XMM register number @a iReg in @a pExtCtx to @a pValue.
     2930 *
     2931 * @returns True if set, false if not set (not supported by state format or
     2932 *          invalid iReg).
     2933 * @param   pExtCtx         The extended CPU context.
     2934 * @param   iReg            The register to set.
     2935 * @param   pValue          The new register value.
     2936 */
     2937BS3_CMN_PROTO_STUB(bool, Bs3ExtCtxSetXmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT128U pValue));
     2938
     2939/**
    29182940 * Gets the value of YMM register number @a iReg from @a pExtCtx.
    29192941 *
     
    29352957 * @param   iReg            The register to set.
    29362958 * @param   pValue          The new register value.
    2937  * @param   f128Bit         A little peculiarity grown from mixing SSE and AVX
    2938  *                          tests:  When set to true only the lower 128 bits of
    2939  *                          the YMM register will be set. The upper bits are
    2940  *                          untouched.  When false, the whole 256-bits value
    2941  *                          will be set.
    2942  */
    2943 BS3_CMN_PROTO_STUB(bool, Bs3ExtCtxSetYmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT256U pValue, bool f128Bit));
     2959 * @param   cbValue         Number of bytes to take from @a pValue, either 16 or
     2960 *                          32. If 16, the high part will be zeroed when present
     2961 *                          in the state.
     2962 */
     2963BS3_CMN_PROTO_STUB(bool, Bs3ExtCtxSetYmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT256U pValue, uint8_t cbValue));
    29442964
    29452965
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