- Timestamp:
- Sep 24, 2024 9:43:50 PM (2 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompBltIn.cpp
r106125 r106144 206 206 */ 207 207 template<bool const a_fCheckTimers, bool const a_fCheckIrqs> 208 DECL_FORCE_INLINE (uint32_t) iemNativeRecompFunc_BltIn_CheckTimersAndIrqsCommon(PIEMRECOMPILERSTATE pReNative, uint32_t off)208 DECL_FORCE_INLINE_THROW(uint32_t) iemNativeRecompFunc_BltIn_CheckTimersAndIrqsCommon(PIEMRECOMPILERSTATE pReNative, uint32_t off) 209 209 { 210 210 uint8_t const idxEflReg = !a_fCheckIrqs ? UINT8_MAX … … 275 275 /* OR in VM::fGlobalForcedActions. We access the member via pVCpu. 276 276 No need to mask anything here. Unfortunately, it's a 32-bit 277 variable, so we can't OR it directly on x86. */ 277 variable, so we can't OR it directly on x86. 278 279 Note! We take a tiny liberty here and ASSUME that the VM and associated 280 VMCPU mappings are less than 2 GiB away from one another, so we 281 can access VM::fGlobalForcedActions via a 32-bit signed displacement. 282 283 This is _only_ a potential issue with VMs using the _support_ _driver_ 284 for manging the structure, as it maps the individual bits separately 285 and the mapping order differs between host platforms. Linux may 286 map the VM structure higher than the VMCPU ones, whereas windows may 287 do put the VM structure in the lowest address. On all hosts there 288 is a chance that virtual memory fragmentation could cause the bits to 289 end up at a greater distance from one another, but it is rather 290 doubtful and we just ASSUME it won't happen for now... 291 292 When the VM structure is allocated in userland, there is one 293 allocation for it and all the associated VMCPU components, thus no 294 problems. */ 278 295 AssertCompile(VM_FF_ALL_MASK == UINT32_MAX); 279 296 intptr_t const offGlobalForcedActions = (intptr_t)&pReNative->pVCpu->CTX_SUFF(pVM)->fGlobalForcedActions 280 297 - (intptr_t)pReNative->pVCpu; 281 Assert((int32_t)offGlobalForcedActions == offGlobalForcedActions); 298 if (RT_LIKELY((int32_t)offGlobalForcedActions == offGlobalForcedActions)) 299 { /* likely */ } 300 else 301 { 302 LogRelMax(16, ("!!WARNING!! offGlobalForcedActions=%#zx pVM=%p pVCpu=%p - CheckTimersAndIrqsCommon\n", 303 offGlobalForcedActions, pReNative->pVCpu->CTX_SUFF(pVM), pReNative->pVCpu)); 304 # ifdef IEM_WITH_THROW_CATCH 305 AssertFailedStmt(IEMNATIVE_DO_LONGJMP(NULL, VERR_IEM_IPE_9)); 306 # else 307 AssertReleaseFailed(); 308 # endif 309 } 282 310 283 311 # ifdef RT_ARCH_AMD64 … … 295 323 296 324 # elif defined(RT_ARCH_ARM64) 325 Assert(offGlobalForcedActions < 0); 297 326 off = iemNativeEmitGprBySignedVCpuLdStEx(pCodeBuf, off, idxTmpReg2, (int32_t)offGlobalForcedActions, 298 327 kArmv8A64InstrLdStType_Ld_Word, sizeof(uint32_t)); -
trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h
r106125 r106144 509 509 iemNativeEmitGprByVCpuSignedDisp(uint8_t *pbCodeBuf, uint32_t off, uint8_t iGprReg, int32_t offVCpu) 510 510 { 511 Assert(offVCpu < 0);512 511 if (offVCpu < 128 && offVCpu >= -128) 513 512 { … … 621 620 ARMV8A64INSTRLDSTTYPE enmOperation, unsigned cbData, uint8_t iGprTmp = UINT8_MAX) 622 621 { 623 Assert(offVCpu < 0); 624 Assert((uint32_t)-offVCpu < RT_BIT_32(28)); /* we should be way out of range for problematic sign extending issues. */ 625 Assert(!((uint32_t)-offVCpu & (cbData - 1))); 622 Assert((uint32_t)RT_ABS(offVCpu) < RT_BIT_32(28)); /* we should be way out of range for problematic sign extending issues. */ 623 Assert(!((uint32_t)RT_ABS(offVCpu) & (cbData - 1))); 626 624 627 625 /*
Note:
See TracChangeset
for help on using the changeset viewer.