VirtualBox

Changeset 61162 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 24, 2016 12:49:54 PM (9 years ago)
Author:
vboxsync
Message:

CPUMInternal.mac: Apply FPUCS/DS hack to xsave just like we already do for fxsave. Kudos to quentin buathier for this fix.

File:
1 edited

Legend:

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

    r61144 r61162  
    713713
    714714
    715 ;; Macro for FXSAVE for the guest FPU but tries to figure out whether to
     715;; Macro for XSAVE/FXSAVE for the guest FPU but tries to figure out whether to
    716716;  save the 32-bit FPU state or 64-bit FPU state.
    717717;
     
    719719; @param    %2      Pointer to XState.
    720720; @param    %3      Force AMD64
     721; @param    %4      The instruction to use (xsave or fxsave)
    721722; @uses     xAX, xDX, EFLAGS, 20h of stack.
    722723;
    723 %macro SAVE_32_OR_64_FPU 3
     724%macro SAVE_32_OR_64_FPU 4
    724725%if CPUM_IS_AMD64 || %3
    725726        ; Save the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
     
    727728        jnz     short %%save_long_mode_guest
    728729%endif
    729         fxsave  [pXState]
     730        %4      [pXState]
    730731%if CPUM_IS_AMD64 || %3
    731732        jmp     %%save_done_32bit_cs_ds
    732733
    733734%%save_long_mode_guest:
    734         o64 fxsave [pXState]
     735        o64 %4 [pXState]
    735736
    736737        xor     edx, edx
     
    784785        and     eax, ~CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS ; Already saved in HMR0A.asm.
    785786 %endif
    786  %ifdef RT_ARCH_AMD64
    787         o64 xsave [pXState]
    788  %else
    789         xsave   [pXState]
    790  %endif
     787        SAVE_32_OR_64_FPU pCpumCpu, pXState, 0, xsave
    791788        jmp     %%guest_done
    792789
    793790        ; FXSAVE
    794791%%guest_fxsave:
    795         SAVE_32_OR_64_FPU pCpumCpu, pXState, 0
     792        SAVE_32_OR_64_FPU pCpumCpu, pXState, 0, fxsave
    796793
    797794%%guest_done:
     
    800797
    801798;;
    802 ; Wrapper for selecting 32-bit or 64-bit FXRSTOR according to what SAVE_32_OR_64_FPU did.
     799; Wrapper for selecting 32-bit or 64-bit XRSTOR/FXRSTOR according to what SAVE_32_OR_64_FPU did.
    803800;
    804801; @param    %1      Pointer to CPUMCPU.
    805802; @param    %2      Pointer to XState.
    806803; @param    %3      Force AMD64.
     804; @param    %4      The instruction to use (xrstor or fxrstor).
    807805; @uses     xAX, xDX, EFLAGS
    808806;
    809 %macro RESTORE_32_OR_64_FPU 3
     807%macro RESTORE_32_OR_64_FPU 4
    810808%if CPUM_IS_AMD64 || %3
    811809        ; Restore the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
     
    816814%%restore_32bit_fpu:
    817815%endif
    818         fxrstor [pXState]
     816        %4      [pXState]
    819817%if CPUM_IS_AMD64 || %3
    820818        ; TODO: Restore XMM8-XMM15!
    821819        jmp     short %%restore_fpu_done
    822820%%restore_64bit_fpu:
    823         o64 fxrstor [pXState]
     821        o64 %4 [pXState]
    824822%%restore_fpu_done:
    825823%endif
     
    858856        and     eax, ~CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS ; Will be loaded by HMR0A.asm.
    859857 %endif
    860  %ifdef RT_ARCH_AMD64
    861         o64 xrstor [pXState]
    862  %else
    863         xrstor  [pXState]
    864  %endif
     858        RESTORE_32_OR_64_FPU pCpumCpu, pXState, 0, xrstor
    865859        jmp     %%guest_done
    866860
    867861        ; FXRSTOR
    868862%%guest_fxrstor:
    869         RESTORE_32_OR_64_FPU pCpumCpu, pXState, 0
     863        RESTORE_32_OR_64_FPU pCpumCpu, pXState, 0, fxrstor
    870864
    871865%%guest_done:
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