Changeset 87440 in vbox
- Timestamp:
- Jan 26, 2021 6:18:57 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMR0A.asm
r87439 r87440 778 778 %define frm_saved_gdtr -02ah ; 16+64: Only used when VMX_SKIP_GDTR isn't defined 779 779 %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. 781 781 %define frm_saved_idtr -03ah ; 16+64: Only used when VMX_SKIP_IDTR isn't defined 782 782 %define frm_saved_ldtr -03ch ; 16-bit: always saved. … … 888 888 .wrote_host_rsp: 889 889 890 %if %3 & CPUMCTX_WSF_IBPB_EXIT890 ; 891 891 ; 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] 893 908 %endif 894 909 … … 1018 1033 mov rdx, rcx 1019 1034 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 1024 1042 %endif 1025 1043 %endif … … 1461 1479 %endif 1462 1480 1463 ; Fight spectre. Note! Trashes rax, rdx and rcx!1464 1481 %if %3 & CPUMCTX_WSF_IBPB_EXIT 1465 1482 ; Fight spectre (trashes rax, rdx and rcx).
Note:
See TracChangeset
for help on using the changeset viewer.