VirtualBox

Changeset 87440 in vbox


Ignore:
Timestamp:
Jan 26, 2021 6:18:57 PM (4 years ago)
Author:
vboxsync
Message:

VMM/HMVMX: More hmR0VmxStartVm work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMR0A.asm

    r87439 r87440  
    778778 %define frm_saved_gdtr      -02ah              ; 16+64:  Only used when VMX_SKIP_GDTR isn't defined
    779779 %define frm_saved_tr        -02ch              ; 16-bit: Only used when VMX_SKIP_TR isn't defined
    780  ;%define frm_fNoRestoreXcr0  -030h              ; 32-bit: Non-zero if we should skip XCR0 restoring.
     780 %define frm_MDS_seg         -030h              ; 16-bit: Temporary storage for the MDS flushing.
    781781 %define frm_saved_idtr      -03ah              ; 16+64:  Only used when VMX_SKIP_IDTR isn't defined
    782782 %define frm_saved_ldtr      -03ch              ; 16-bit: always saved.
     
    888888.wrote_host_rsp:
    889889
    890  %if %3 & CPUMCTX_WSF_IBPB_EXIT
     890        ;
    891891        ; Fight spectre and similar. Trashes rax, rcx, and rdx.
    892         INDIRECT_BRANCH_PREDICTION_AND_L1_CACHE_BARRIER rdi, CPUMCTX_WSF_IBPB_ENTRY, CPUMCTX_WSF_L1D_ENTRY, CPUMCTX_WSF_MDS_ENTRY
     892        ;
     893 %if %3 & (CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_L1D_ENTRY)  ; The eax:edx value is the same for the first two.
     894        AssertCompile(MSR_IA32_PRED_CMD_F_IBPB == MSR_IA32_FLUSH_CMD_F_L1D)
     895        mov     eax, MSR_IA32_PRED_CMD_F_IBPB
     896        xor     edx, edx
     897 %endif
     898 %if %3 & CPUMCTX_WSF_IBPB_ENTRY        ; Indirect branch barrier.
     899        mov     ecx, MSR_IA32_PRED_CMD
     900        wrmsr
     901 %endif
     902 %if %3 & CPUMCTX_WSF_L1D_ENTRY         ; Level 1 data cache flush.
     903        mov     ecx, MSR_IA32_FLUSH_CMD
     904        wrmsr
     905 %elif %3 & CPUMCTX_WSF_MDS_ENTRY       ; MDS flushing is included in L1D_FLUSH
     906        mov     word [rbp + frm_MDS_seg], ds
     907        verw    word [rbp + frm_MDS_seg]
    893908 %endif
    894909
     
    10181033        mov     rdx, rcx
    10191034
    1020   %if %1 = 0 ; Skip this in failure branch (=> guru)
    1021    %if %3 & CPUMCTX_WSF_IBPB_EXIT
    1022         ; Fight spectre.
    1023         INDIRECT_BRANCH_PREDICTION_BARRIER_CTX rax, CPUMCTX_WSF_IBPB_EXIT
     1035  %if %3 & CPUMCTX_WSF_IBPB_EXIT
     1036        ; Fight spectre (trashes rax, rdx and rcx).
     1037   %if %1 = 0 ; Skip this in failure branch (=> guru)
     1038        mov     ecx, MSR_IA32_PRED_CMD
     1039        mov     eax, MSR_IA32_PRED_CMD_F_IBPB
     1040        xor     edx, edx
     1041        wrmsr
    10241042   %endif
    10251043  %endif
     
    14611479 %endif
    14621480
    1463         ; Fight spectre.  Note! Trashes rax, rdx and rcx!
    14641481 %if %3 & CPUMCTX_WSF_IBPB_EXIT
    14651482        ; Fight spectre (trashes rax, rdx and rcx).
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