VirtualBox

Changeset 99353 in vbox


Ignore:
Timestamp:
Apr 8, 2023 12:27:03 AM (20 months ago)
Author:
vboxsync
Message:

VMM/IEM: Mojo improvments for IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT. bugref:10369

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/IEMMc.h

    r99352 r99353  
    9494#define IEM_MC_MAYBE_RAISE_AVX_RELATED_XCPT() \
    9595    do { \
    96         if (   (pVCpu->cpum.GstCtx.aXcr[0] & (XSAVE_C_YMM | XSAVE_C_SSE)) == (XSAVE_C_YMM | XSAVE_C_SSE) \
    97             && (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXSAVE)) { /* probable */ } \
    98         else return iemRaiseUndefinedOpcode(pVCpu); \
    99         \
    100         if (!(pVCpu->cpum.GstCtx.cr0 & X86_CR0_TS)) { /* probable */ } \
    101         else return iemRaiseDeviceNotAvailable(pVCpu); \
    102     } while (0)
     96        /* Since none of the bits we compare from XCR0, CR4 and CR0 overlap, it can \
     97           be reduced to a single compare branch in the more probably code path. */ \
     98        if (RT_LIKELY(   (  (pVCpu->cpum.GstCtx.aXcr[0] & (XSAVE_C_YMM | XSAVE_C_SSE)) \
     99                          | (pVCpu->cpum.GstCtx.cr4     & X86_CR4_OSXSAVE) \
     100                          | (pVCpu->cpum.GstCtx.cr0     & X86_CR0_TS)) \
     101                      == (XSAVE_C_YMM | XSAVE_C_SSE | X86_CR4_OSXSAVE))) \
     102        { /* probable */ } \
     103        else if (   (pVCpu->cpum.GstCtx.aXcr[0] & (XSAVE_C_YMM | XSAVE_C_SSE)) != (XSAVE_C_YMM | XSAVE_C_SSE) \
     104                 || !(pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSXSAVE)) \
     105            return iemRaiseUndefinedOpcode(pVCpu); \
     106        else \
     107            return iemRaiseDeviceNotAvailable(pVCpu); \
     108    } while (0)
     109AssertCompile(!((XSAVE_C_YMM | XSAVE_C_SSE) & X86_CR4_OSXSAVE));
     110AssertCompile(!((XSAVE_C_YMM | XSAVE_C_SSE) & X86_CR0_TS));
     111AssertCompile(!(X86_CR4_OSXSAVE & X86_CR0_TS));
    103112#define IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT() \
    104113    do { \
    105114        /* Since the CR4 and CR0 bits doesn't overlap, it can be reduced to a
    106115           single compare branch in the more probable code path. */ \
    107         AssertCompile(!((X86_CR0_EM | X86_CR0_TS) & X86_CR4_OSFXSR)); \
    108116        if (RT_LIKELY(  (  (pVCpu->cpum.GstCtx.cr0 & (X86_CR0_EM | X86_CR0_TS)) \
    109117                         | (pVCpu->cpum.GstCtx.cr4 & X86_CR4_OSFXSR)) \
     
    116124            return iemRaiseDeviceNotAvailable(pVCpu); \
    117125    } while (0)
     126AssertCompile(!((X86_CR0_EM | X86_CR0_TS) & X86_CR4_OSFXSR));
    118127#define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT() \
    119128    do { \
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