VirtualBox

Changeset 66450 in vbox


Ignore:
Timestamp:
Apr 5, 2017 7:06:04 PM (8 years ago)
Author:
vboxsync
Message:

IEM: More vstmxcsr tests.

Location:
trunk/src/VBox
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsPython.py

    r66419 r66450  
    159159    'X86_CR4_PKE':          0x00400000, # RT_BIT_32(22)
    160160};
     161
     162## XSAVE components (XCR0).
     163g_kdX86XSaveCConstants = {
     164    'XSAVE_C_X87':          0x00000001,
     165    'XSAVE_C_SSE':          0x00000002,
     166    'XSAVE_C_YMM':          0x00000004,
     167    'XSAVE_C_BNDREGS':      0x00000008,
     168    'XSAVE_C_BNDCSR':       0x00000010,
     169    'XSAVE_C_OPMASK':       0x00000020,
     170    'XSAVE_C_ZMM_HI256':    0x00000040,
     171    'XSAVE_C_ZMM_16HI':     0x00000080,
     172    'XSAVE_C_PKRU':         0x00000200,
     173    'XSAVE_C_LWP':          0x4000000000000000,
     174    'XSAVE_C_X':            0x8000000000000000,
     175    'XSAVE_C_ALL_AVX':      0x000000c4, # For clearing all AVX bits.
     176    'XSAVE_C_ALL_AVX_SSE':  0x000000c6, # For clearing all AVX and SSE bits.
     177};
     178
    161179
    162180## \@op[1-4] locations
     
    824842        'cr0':   TestTypeFromDict('cr0', g_kdX86Cr0Constants, 'X86_CR0_'),
    825843        'cr4':   TestTypeFromDict('cr4', g_kdX86Cr4Constants, 'X86_CR4_'),
     844        'xcr0':  TestTypeFromDict('xcr0', g_kdX86XSaveCConstants, 'XSAVE_C_'),
    826845    };
    827846    ## CPU context fields.
     
    924943        'cr0':          ( 'cr0',  'both',   ),
    925944        'cr4':          ( 'cr4',  'both',   ),
     945        'xcr0':         ( 'xcr0', 'both',   ),
    926946        # FPU Registers
    927947        'fcw':          ( 'uint', 'both',   ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h

    r66419 r66450  
    59055905 * @opcpuid     avx
    59065906 * @opgroup     og_avx_mxcsrsm
    5907  * @optest         mxcsr=0      -> op1=0
    5908  * @optest         mxcsr=0x2083 -> op1=0x2083
    5909  * @optestign      mxcsr=0x2084 cr0|=ts -> value.xcpt=0x7
    5910  * @optestign      mxcsr=0x2085 cr0|=em -> value.xcpt=0x6
    5911  * @optestign      mxcsr=0x2086 cr0|=mp -> op1=0x2086
    5912  * @optestign      mxcsr=0x2087 cr4&~=osfxsr -> value.xcpt=0x6
    5913  * @optestign      mxcsr=0x2088 cr0|=ts,em -> value.xcpt=0x6
    5914  * @optestign      mxcsr=0x2089 cr0|=em cr4&~=osfxsr -> value.xcpt=0x6
    5915  * @optestign      mxcsr=0x208a cr0|=ts,em cr4&~=osfxsr -> value.xcpt=0x6
    5916  * @optestign      mxcsr=0x208b cr0|=ts,em,mp cr4&~=osfxsr -> value.xcpt=0x6
     5907 * @optest      mxcsr=0      -> op1=0
     5908 * @optest      mxcsr=0x2083 -> op1=0x2083
     5909 * @optest      mxcsr=0x2084 cr0|=ts -> value.xcpt=0x7
     5910 * @optest      mxcsr=0x2085 cr0|=em -> op1=0x2085
     5911 * @optest      mxcsr=0x2086 cr0|=mp -> op1=0x2086
     5912 * @optest      mxcsr=0x2087 cr4&~=osfxsr -> op1=0x2087
     5913 * @optest      mxcsr=0x2088 cr0|=ts,em -> value.xcpt=0x7
     5914 * @optest      mxcsr=0x2089 cr0|=em cr4&~=osfxsr -> op1=0x2089
     5915 * @optest      mxcsr=0x208a cr0|=ts,em cr4&~=osfxsr -> value.xcpt=0x7
     5916 * @optest      mxcsr=0x208b cr0|=ts,em,mp cr4&~=osfxsr -> value.xcpt=0x7
     5917 * @optest      mxcsr=0x208c xcr0&~=all_avx -> value.xcpt=0x6
     5918 * @optest      mxcsr=0x208d xcr0&~=all_avx_sse -> value.xcpt=0x6
     5919 * @optest      mxcsr=0x208e xcr0&~=all_avx cr0|=ts -> value.xcpt=0x6
     5920 * @optest      mxcsr=0x208f cr4&~=osxsave -> value.xcpt=0x6
     5921 * @optest      mxcsr=0x2082 cr0|=ts cr4&~=osxsave -> value.xcpt=0x6
     5922 * @optest      mxcsr=0x2081 xcr0&~=all_avx cr0|=ts cr4&~=osxsave
     5923 *              -> value.xcpt=0x6
    59175924 * @oponlytest
    59185925 */
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c

    r66446 r66450  
    400400    /* [BS3CG1DST_CR0] = */     4,
    401401    /* [BS3CG1DST_CR4] = */     4,
     402    /* [BS3CG1DST_XCR0] = */    8,
    402403
    403404    /* [BS3CG1DST_FCW] = */         2,
     
    630631    /* [BS3CG1DST_CR0] = */         RT_OFFSETOF(BS3REGCTX, cr0),
    631632    /* [BS3CG1DST_CR4] = */         RT_OFFSETOF(BS3REGCTX, cr4),
     633    /* [BS3CG1DST_XCR0] = */        sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, fXcr0Saved),
    632634
    633635    /* [BS3CG1DST_FCW] = */         sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.FCW),
     
    862864    { "CR0" },
    863865    { "CR4" },
     866    { "XCR0" },
    864867
    865868    { "FCW" },
     
    22262229            cr4 |= X86_CR4_OSFXSR | X86_CR4_OSXMMEEXCPT | X86_CR4_OSXSAVE;
    22272230            ASMSetCR4(cr4);
    2228             ASMSetXcr0(pThis->pExtCtx->fXcr0);
     2231            ASMSetXcr0(pThis->pExtCtx->fXcr0Nominal);
    22292232        }
    22302233        else
     
    33973400            pExtCtx->Ctx.x87.aXMM[i].au16[7] = i;
    33983401        }
    3399         if (pExtCtx->fXcr0 & XSAVE_C_YMM)
     3402        if (pExtCtx->fXcr0Nominal & XSAVE_C_YMM)
    34003403            for (i = 0; i < RT_ELEMENTS(pExtCtx->Ctx.x.u.Intel.YmmHi.aYmmHi); i++)
    34013404            {
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1.h

    r66419 r66450  
    418418    BS3CG1DST_CR0,
    419419    BS3CG1DST_CR4,
     420    BS3CG1DST_XCR0,
    420421
    421422    /* FPU registers. */
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxCopy.c

    r66226 r66450  
    3636BS3_CMN_DEF(PBS3EXTCTX, Bs3ExtCtxCopy,(PBS3EXTCTX pDst, PCBS3EXTCTX pSrc))
    3737{
    38     BS3_ASSERT(pDst->cb == pSrc->cb && pDst->enmMethod == pSrc->enmMethod && pDst->fXcr0 == pSrc->fXcr0);
     38    BS3_ASSERT(pDst->cb == pSrc->cb && pDst->enmMethod == pSrc->enmMethod && pDst->fXcr0Nominal == pSrc->fXcr0Nominal);
    3939    Bs3MemCpy(&pDst->Ctx, &pSrc->Ctx, pDst->cb - RT_OFFSETOF(BS3EXTCTX, Ctx));
     40    pDst->fXcr0Saved = pSrc->fXcr0Saved;
    4041    return pDst;
    4142}
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxInit.c

    r66226 r66450  
    5454        pExtCtx->enmMethod = BS3EXTCTXMETHOD_ANCIENT;
    5555    }
    56     pExtCtx->cb       = cbExtCtx;
    57     pExtCtx->u16Magic = BS3EXTCTX_MAGIC;
    58     pExtCtx->fXcr0    = fFlags;
     56    pExtCtx->cb             = cbExtCtx;
     57    pExtCtx->u16Magic       = BS3EXTCTX_MAGIC;
     58    pExtCtx->fXcr0Nominal   = fFlags;
     59    pExtCtx->fXcr0Saved     = fFlags;
    5960    return pExtCtx;
    6061}
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxRestore.asm

    r66214 r66450  
    3636        push    xBP
    3737        mov     xBP, xSP
    38         push    xAX
    39 BONLY32 push    xCX
     38        push    sAX
     39        push    sCX
     40        push    sDX
     41        push    xBX
    4042BONLY16 push    es
    41 BONLY16 push    bx
    4243
    4344%if ARCH_BITS == 16
     
    5657        jmp     .return
    5758
    58 .do_16_xsave:
    59         xrstor  [es:bx + BS3EXTCTX.Ctx]
     59.do_16_fxsave:
     60        fxrstor  [es:bx + BS3EXTCTX.Ctx]
    6061        jmp     .return
    6162
    62 .do_16_fxsave:
    63         fxrstor  [es:bx + BS3EXTCTX.Ctx]
     63.do_16_xsave:
     64        xor     ecx, ecx
     65        mov     eax, [es:bx + BS3EXTCTX.fXcr0Nominal]
     66        mov     edx, [es:bx + BS3EXTCTX.fXcr0Nominal + 4]
     67        xsetbv
     68
     69        xrstor  [es:bx + BS3EXTCTX.Ctx]
     70
     71        mov     eax, [es:bx + BS3EXTCTX.fXcr0Saved]
     72        mov     edx, [es:bx + BS3EXTCTX.fXcr0Saved + 4]
     73        xsetbv
    6474        ;jmp     .return
    6575
    6676%else
    67 BONLY32 mov     ecx, [xBP + xCB + cbCurRetAddr]
     77BONLY32 mov     ebx, [xBP + xCB + cbCurRetAddr]
     78BONLY64 mov     rbx, rcx
    6879
    69         mov     al, [xCX + BS3EXTCTX.enmMethod]
     80        mov     al, [xBX + BS3EXTCTX.enmMethod]
    7081        cmp     al, BS3EXTCTXMETHOD_XSAVE
    7182        je      .do_xsave
     
    7788
    7889.do_ancient:
    79         frstor  [xCX + BS3EXTCTX.Ctx]
     90        frstor  [xBX + BS3EXTCTX.Ctx]
     91        jmp     .return
     92
     93.do_fxsave:
     94BONLY32 fxrstor [xBX + BS3EXTCTX.Ctx]
     95BONLY64 fxrstor64 [xBX + BS3EXTCTX.Ctx]
    8096        jmp     .return
    8197
    8298.do_xsave:
    83 BONLY32 xrstor  [xCX + BS3EXTCTX.Ctx]
    84 BONLY64 xrstor64 [xCX + BS3EXTCTX.Ctx]
    85         jmp     .return
     99        xor     ecx, ecx
     100        mov     eax, [xBX + BS3EXTCTX.fXcr0Nominal]
     101        mov     edx, [xBX + BS3EXTCTX.fXcr0Nominal + 4]
     102        xsetbv
    86103
    87 .do_fxsave:
    88 BONLY32 fxrstor [xCX + BS3EXTCTX.Ctx]
    89 BONLY64 fxrstor64 [xCX + BS3EXTCTX.Ctx]
     104BONLY32 xrstor  [xBX + BS3EXTCTX.Ctx]
     105BONLY64 xrstor64 [xBX + BS3EXTCTX.Ctx]
     106
     107        mov     eax, [xBX + BS3EXTCTX.fXcr0Saved]
     108        mov     edx, [xBX + BS3EXTCTX.fXcr0Saved + 4]
     109        xsetbv
    90110        ;jmp     .return
    91111
     
    93113
    94114.return:
    95 BONLY16 pop     bx
    96115BONLY16 pop     es
    97 BONLY32 pop     xCX
    98         pop     xAX
     116        pop     xBX
     117        pop     sDX
     118        pop     sCX
     119        pop     sAX
    99120        mov     xSP, xBP
    100121        pop     xBP
     
    102123BS3_PROC_END_CMN   Bs3ExtCtxRestore
    103124
    104 
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxSave.asm

    r66214 r66450  
    3636        push    xBP
    3737        mov     xBP, xSP
    38         push    xAX
    39 BONLY32 push    xCX
     38        push    sAX
     39        push    sCX
     40        push    sDX
     41        push    xBX
    4042BONLY16 push    es
    41 BONLY16 push    bx
    4243
    4344%if ARCH_BITS == 16
     
    5657        jmp     .return
    5758
    58 .do_16_xsave:
    59         xsave   [es:bx + BS3EXTCTX.Ctx]
     59.do_16_fxsave:
     60        fxsave  [es:bx + BS3EXTCTX.Ctx]
    6061        jmp     .return
    6162
    62 .do_16_fxsave:
    63         fxsave  [es:bx + BS3EXTCTX.Ctx]
     63.do_16_xsave:
     64        xor     ecx, ecx
     65        xgetbv
     66        mov     [es:bx + BS3EXTCTX.fXcr0Saved], eax
     67        mov     [es:bx + BS3EXTCTX.fXcr0Saved + 4], edx
     68        mov     eax, [es:bx + BS3EXTCTX.fXcr0Nominal]
     69        mov     edx, [es:bx + BS3EXTCTX.fXcr0Nominal + 4]
     70        xsetbv
     71
     72        xsave   [es:bx + BS3EXTCTX.Ctx]
     73
     74        mov     eax, [es:bx + BS3EXTCTX.fXcr0Saved]
     75        mov     edx, [es:bx + BS3EXTCTX.fXcr0Saved + 4]
     76        xsetbv
    6477        ;jmp     .return
    6578
    6679%else
    67 BONLY32 mov     ecx, [xBP + xCB + cbCurRetAddr]
     80BONLY32 mov     ebx, [xBP + xCB + cbCurRetAddr]
     81BONLY64 mov     rbx, rcx
    6882
    69         mov     al, [xCX + BS3EXTCTX.enmMethod]
     83        mov     al, [xBX + BS3EXTCTX.enmMethod]
    7084        cmp     al, BS3EXTCTXMETHOD_XSAVE
    7185        je      .do_xsave
     
    7791
    7892.do_ancient:
    79         fnsave  [xCX + BS3EXTCTX.Ctx]
     93        fnsave  [xBX + BS3EXTCTX.Ctx]
     94        jmp     .return
     95
     96.do_fxsave:
     97BONLY32 fxsave  [xBX + BS3EXTCTX.Ctx]
     98BONLY64 fxsave64 [xBX + BS3EXTCTX.Ctx]
    8099        jmp     .return
    81100
    82101.do_xsave:
    83 BONLY32 xsave   [xCX + BS3EXTCTX.Ctx]
    84 BONLY64 xsave64 [xCX + BS3EXTCTX.Ctx]
    85         jmp     .return
     102        xor     ecx, ecx
     103        xgetbv
     104        mov     [xBX + BS3EXTCTX.fXcr0Saved], eax
     105        mov     [xBX + BS3EXTCTX.fXcr0Saved + 4], edx
     106        mov     eax, [xBX + BS3EXTCTX.fXcr0Nominal]
     107        mov     edx, [xBX + BS3EXTCTX.fXcr0Nominal + 4]
     108        xsetbv
    86109
    87 .do_fxsave:
    88 BONLY32 fxsave  [xCX + BS3EXTCTX.Ctx]
    89 BONLY64 fxsave64 [xCX + BS3EXTCTX.Ctx]
     110BONLY32 xsave   [xBX + BS3EXTCTX.Ctx]
     111BONLY64 xsave64 [xBX + BS3EXTCTX.Ctx]
     112
     113        mov     eax, [xBX + BS3EXTCTX.fXcr0Saved]
     114        mov     edx, [xBX + BS3EXTCTX.fXcr0Saved + 4]
     115        xsetbv
    90116        ;jmp     .return
    91117
     
    93119
    94120.return:
    95 BONLY16 pop     bx
    96121BONLY16 pop     es
    97 BONLY32 pop     xCX
    98         pop     xAX
     122        pop     xBX
     123        pop     sDX
     124        pop     sCX
     125        pop     sAX
    99126        mov     xSP, xBP
    100127        pop     xBP
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r66446 r66450  
    26862686    uint8_t             enmMethod;
    26872687    uint8_t             abPadding0[3];
    2688     /** XSAVE_C_XXX. */
    2689     uint64_t            fXcr0;
     2688    /** Nominal XSAVE_C_XXX. */
     2689    uint64_t            fXcr0Nominal;
     2690    /** The saved XCR0 mask (restored after xrstor).  */
     2691    uint64_t            fXcr0Saved;
    26902692
    26912693    /** Explicit alignment padding. */
    2692     uint8_t             abPadding[64 - 2 - 2 - 1 - 3 - 8];
     2694    uint8_t             abPadding[64 - 2 - 2 - 1 - 3 - 8 - 8];
    26932695
    26942696    /** The context, variable size (see above).
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac

    r66226 r66450  
    14221422;
    14231423struc BS3EXTCTX
    1424         .u16Magic   resw 1              ; uint16_t            u16Magic;
    1425         .cb         resw 1              ; uint16_t            cb;
    1426         .enmMethod  resb 1              ; uint8_t             enmMethod;
     1424        .u16Magic       resw 1          ; uint16_t            u16Magic;
     1425        .cb             resw 1          ; uint16_t            cb;
     1426        .enmMethod      resb 1          ; uint8_t             enmMethod;
    14271427        alignb           8
    1428         .fXcr0      resq 1
     1428        .fXcr0Nominal   resq 1          ; uint64_t            fXcr0Nominal;
     1429        .fXcr0Saved     resq 1          ; uint64_t            fXcr0Saved;
    14291430        alignb           64
    1430         .Ctx        resb 512
     1431        .Ctx            resb 512
    14311432endstruc
    14321433%define BS3EXTCTXMETHOD_ANCIENT     1
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