Changeset 100866 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Aug 13, 2023 3:00:44 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllMemRWTmplInline.cpp.h
r100865 r100866 1008 1008 RT_CONCAT3(iemMemFlat64StackPush,TMPL_MEM_FN_SUFF,Jmp)(PVMCPUCC pVCpu, TMPL_MEM_TYPE uValue) IEM_NOEXCEPT_MAY_LONGJMP 1009 1009 { 1010 # if defined(IEM_WITH_DATA_TLB) && defined(IN_RING3) && !defined(TMPL_MEM_NO_INLINE) 1011 /* 1012 * Calculate the new stack pointer and check that the item doesn't cross a page boundrary. 1013 */ 1014 uint64_t const uNewRsp = pVCpu->cpum.GstCtx.rsp - sizeof(TMPL_MEM_TYPE); 1015 # if TMPL_MEM_TYPE_SIZE > 1 1016 if (RT_LIKELY( !(uNewRsp & TMPL_MEM_TYPE_ALIGN) 1017 || TMPL_MEM_CHECK_UNALIGNED_WITHIN_PAGE_OK(pVCpu, uNewRsp, TMPL_MEM_TYPE) )) 1018 # endif 1019 { 1020 /* 1021 * TLB lookup. 1022 */ 1023 uint64_t const uTag = IEMTLB_CALC_TAG( &pVCpu->iem.s.DataTlb, uNewRsp); 1024 PIEMTLBENTRY pTlbe = IEMTLB_TAG_TO_ENTRY(&pVCpu->iem.s.DataTlb, uTag); 1025 if (RT_LIKELY(pTlbe->uTag == uTag)) 1026 { 1027 /* 1028 * Check TLB page table level access flags. 1029 */ 1030 AssertCompile(IEMTLBE_F_PT_NO_USER == 4); 1031 uint64_t const fNoUser = (IEM_GET_CPL(pVCpu) + 1) & IEMTLBE_F_PT_NO_USER; 1032 if (RT_LIKELY( (pTlbe->fFlagsAndPhysRev & ( IEMTLBE_F_PHYS_REV | IEMTLBE_F_NO_MAPPINGR3 1033 | IEMTLBE_F_PG_UNASSIGNED | IEMTLBE_F_PG_NO_WRITE 1034 | IEMTLBE_F_PT_NO_ACCESSED | IEMTLBE_F_PT_NO_DIRTY 1035 | IEMTLBE_F_PT_NO_WRITE | fNoUser)) 1036 == pVCpu->iem.s.DataTlb.uTlbPhysRev)) 1037 { 1038 /* 1039 * Do the push and return. 1040 */ 1041 STAM_STATS({pVCpu->iem.s.DataTlb.cTlbHits++;}); 1042 Assert(pTlbe->pbMappingR3); /* (Only ever cleared by the owning EMT.) */ 1043 Assert(!((uintptr_t)pTlbe->pbMappingR3 & GUEST_PAGE_OFFSET_MASK)); 1044 Log8(("IEM WR " TMPL_MEM_FMT_DESC " SS|%RX64 (<-%RX64): " TMPL_MEM_FMT_TYPE "\n", 1045 uNewRsp, pVCpu->cpum.GstCtx.esp, uValue)); 1046 *(TMPL_MEM_TYPE *)&pTlbe->pbMappingR3[uNewRsp & GUEST_PAGE_OFFSET_MASK] = uValue; 1047 pVCpu->cpum.GstCtx.rsp = uNewRsp; 1048 return; 1049 } 1050 } 1051 } 1052 1053 /* Fall back on the slow careful approach in case of TLB miss, MMIO, exception 1054 outdated page pointer, or other troubles. (This will do a TLB load.) */ 1055 Log10Func(("%RX64 falling back\n", uNewRsp)); 1056 # endif 1010 1057 RT_CONCAT3(iemMemStackPush,TMPL_MEM_FN_SUFF,SafeJmp)(pVCpu, uValue); 1011 1058 } … … 1018 1065 RT_CONCAT3(iemMemFlat64StackPop,TMPL_MEM_FN_SUFF,Jmp)(PVMCPUCC pVCpu) IEM_NOEXCEPT_MAY_LONGJMP 1019 1066 { 1067 # if defined(IEM_WITH_DATA_TLB) && defined(IN_RING3) && !defined(TMPL_MEM_NO_INLINE) 1068 /* 1069 * Calculate the new stack pointer and check that the item doesn't cross a page boundrary. 1070 */ 1071 uint64_t const uOldRsp = pVCpu->cpum.GstCtx.rsp; 1072 # if TMPL_MEM_TYPE_SIZE > 1 1073 if (RT_LIKELY( !(uOldRsp & TMPL_MEM_TYPE_ALIGN) 1074 || TMPL_MEM_CHECK_UNALIGNED_WITHIN_PAGE_OK(pVCpu, uOldRsp, TMPL_MEM_TYPE) )) 1075 # endif 1076 { 1077 /* 1078 * TLB lookup. 1079 */ 1080 uint64_t const uTag = IEMTLB_CALC_TAG( &pVCpu->iem.s.DataTlb, uOldRsp); 1081 PIEMTLBENTRY pTlbe = IEMTLB_TAG_TO_ENTRY(&pVCpu->iem.s.DataTlb, uTag); 1082 if (RT_LIKELY(pTlbe->uTag == uTag)) 1083 { 1084 /* 1085 * Check TLB page table level access flags. 1086 */ 1087 AssertCompile(IEMTLBE_F_PT_NO_USER == 4); 1088 uint64_t const fNoUser = (IEM_GET_CPL(pVCpu) + 1) & IEMTLBE_F_PT_NO_USER; 1089 if (RT_LIKELY( (pTlbe->fFlagsAndPhysRev & ( IEMTLBE_F_PHYS_REV | IEMTLBE_F_NO_MAPPINGR3 1090 | IEMTLBE_F_PG_UNASSIGNED | IEMTLBE_F_PG_NO_READ 1091 | IEMTLBE_F_PT_NO_ACCESSED | fNoUser)) 1092 == pVCpu->iem.s.DataTlb.uTlbPhysRev)) 1093 { 1094 /* 1095 * Do the push and return. 1096 */ 1097 STAM_STATS({pVCpu->iem.s.DataTlb.cTlbHits++;}); 1098 Assert(pTlbe->pbMappingR3); /* (Only ever cleared by the owning EMT.) */ 1099 Assert(!((uintptr_t)pTlbe->pbMappingR3 & GUEST_PAGE_OFFSET_MASK)); 1100 TMPL_MEM_TYPE const uRet = *(TMPL_MEM_TYPE const *)&pTlbe->pbMappingR3[uOldRsp & GUEST_PAGE_OFFSET_MASK]; 1101 pVCpu->cpum.GstCtx.rsp = uOldRsp + sizeof(TMPL_MEM_TYPE); 1102 Log9(("IEM RD " TMPL_MEM_FMT_DESC " SS|%RX64 (->%RX64): " TMPL_MEM_FMT_TYPE "\n", 1103 uOldRsp, uOldRsp + sizeof(TMPL_MEM_TYPE), uRet)); 1104 return uRet; 1105 } 1106 } 1107 } 1108 1109 /* Fall back on the slow careful approach in case of TLB miss, MMIO, exception 1110 outdated page pointer, or other troubles. (This will do a TLB load.) */ 1111 Log10Func(("%RX64 falling back\n", uOldRsp)); 1112 # endif 1020 1113 return RT_CONCAT3(iemMemStackPop,TMPL_MEM_FN_SUFF,SafeJmp)(pVCpu); 1021 1114 }
Note:
See TracChangeset
for help on using the changeset viewer.