VirtualBox

Changeset 91283 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Sep 16, 2021 1:58:36 PM (3 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Moved the host's extended state (XState) from the hyper heap and into CPUMCTX. bugref:10093

Location:
trunk/src/VBox/VMM/include
Files:
2 edited

Legend:

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

    r91271 r91283  
    203203typedef struct CPUMHOSTCTX
    204204{
     205    /** The extended state (FPU/SSE/AVX/AVX-2/XXXX). Must be aligned on 64 bytes. */
     206    union /* no tag */
     207    {
     208        X86XSAVEAREA    XState;
     209        /** Byte view for simple indexing and space allocation.
     210         * @note Must match or exceed the size of CPUMCTX::abXState. */
     211        uint8_t         abXState[0x4000 - 0x300];
     212    } CPUM_UNION_NM(u);
     213
    205214    /** General purpose register, selectors, flags and more
    206215     * @{ */
     
    284293    /** @} */
    285294
     295    /** The XCR0 register. */
     296    uint64_t        xcr0;
     297    /** The mask to pass to XSAVE/XRSTOR in EDX:EAX.  If zero we use
     298     *  FXSAVE/FXRSTOR (since bit 0 will always be set, we only need to test it). */
     299    uint64_t        fXStateMask;
     300
    286301    /* padding to get 64byte aligned size */
    287     uint8_t         auPadding[8];
    288 
     302    uint8_t         auPadding[24];
    289303#if HC_ARCH_BITS != 64
    290304# error HC_ARCH_BITS not defined or unsupported
    291305#endif
    292 
    293     /** Pointer to the FPU/SSE/AVX/XXXX state ring-0 mapping. */
    294     R0PTRTYPE(PX86XSAVEAREA)    pXStateR0;
    295     /** Pointer to the FPU/SSE/AVX/XXXX state ring-3 mapping. */
    296     R3PTRTYPE(PX86XSAVEAREA)    pXStateR3;
    297     /** The XCR0 register. */
    298     uint64_t                    xcr0;
    299     /** The mask to pass to XSAVE/XRSTOR in EDX:EAX.  If zero we use
    300      *  FXSAVE/FXRSTOR (since bit 0 will always be set, we only need to test it). */
    301     uint64_t                    fXStateMask;
    302306} CPUMHOSTCTX;
    303307#ifndef VBOX_FOR_DTRACE_LIB
     
    481485#endif
    482486} CPUMCPU;
     487#ifndef VBOX_FOR_DTRACE_LIB
     488AssertCompileMemberAlignment(CPUMCPU, Host, 64);
     489#endif
    483490/** Pointer to the CPUMCPU instance data residing in the shared VMCPU structure. */
    484491typedef CPUMCPU *PCPUMCPU;
  • trunk/src/VBox/VMM/include/CPUMInternal.mac

    r91281 r91283  
    286286    alignb 64
    287287    .Host                resb    0
     288    .Host.abXState          resb    0x4000-0x300
     289    .Host.XState            EQU     .Host.abXState
    288290    ;.Host.rax            resq    1 - scratch
    289291    .Host.rbx            resq    1
     
    346348    .Host.GSbase         resq    1
    347349    .Host.efer           resq    1
    348     .Host.auPadding      resb    4
    349     alignb RTR0PTR_CB
    350     .Host.pXStateR0 RTR0PTR_RES  1
    351     .Host.pXStateR3 RTR3PTR_RES  1
    352350    alignb 8
    353351    .Host.xcr0           resq    1
     
    478476        ; Load a couple of registers we'll use later in all branches.
    479477        ;
    480  %ifdef IN_RING0
    481         mov     pXState, [pCpumCpu + CPUMCPU.Host.pXStateR0]
    482  %else
    483   %error "Unsupported context!"
    484  %endif
     478        lea     pXState, [pCpumCpu + CPUMCPU.Host.XState]
    485479        mov     eax, [pCpumCpu + CPUMCPU.Host.fXStateMask]
    486480
     
    523517        ; Load a couple of registers we'll use later in all branches.
    524518        ;
    525  %ifdef IN_RING0
    526         mov     pXState, [pCpumCpu + CPUMCPU.Host.pXStateR0]
    527  %else
    528   %error "Unsupported context!"
    529  %endif
     519        lea     pXState, [pCpumCpu + CPUMCPU.Host.XState]
    530520        mov     eax, [pCpumCpu + CPUMCPU.Host.fXStateMask]
    531521
     
    679669        ; Load a couple of registers we'll use later in all branches.
    680670        ;
    681  %ifdef IN_RING0
    682671        lea     pXState, [pCpumCpu + CPUMCPU.Guest.XState]
    683  %else
    684   %error "Unsupported context!"
    685  %endif
    686672        mov     eax, [pCpumCpu + CPUMCPU.Guest.fXStateMask]
    687673
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