Changeset 102558 in vbox
- Timestamp:
- Dec 8, 2023 10:59:19 PM (12 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r102557 r102558 2980 2980 uint32_t const idxVar = ASMBitFirstSetU32(fVars) - 1; 2981 2981 uint8_t const idxReg = pReNative->Core.aVars[idxVar].idxReg; 2982 /** @todo Prevent active variables from changing here... */2983 2982 if ( idxReg < RT_ELEMENTS(pReNative->Core.aHstRegs) 2984 2983 && (RT_BIT_32(idxReg) & fRegMask) 2985 2984 && ( iLoop == 0 2986 2985 ? pReNative->Core.aVars[idxVar].enmKind != kIemNativeVarKind_Stack 2987 : pReNative->Core.aVars[idxVar].enmKind == kIemNativeVarKind_Stack)) 2986 : pReNative->Core.aVars[idxVar].enmKind == kIemNativeVarKind_Stack) 2987 && !pReNative->Core.aVars[idxVar].fRegAcquired) 2988 2988 { 2989 2989 Assert(pReNative->Core.bmHstRegs & RT_BIT_32(idxReg)); … … 3080 3080 uint32_t fForbiddenRegs = IEMNATIVE_CALL_VOLATILE_GREG_MASK) 3081 3081 { 3082 Assert(idxVar < RT_ELEMENTS(pReNative->Core.aVars));3082 IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVar); 3083 3083 Assert(pReNative->Core.aVars[idxVar].enmKind == kIemNativeVarKind_Stack); 3084 Assert(!pReNative->Core.aVars[idxVar].fRegAcquired); 3084 3085 3085 3086 uint8_t const idxRegOld = pReNative->Core.aVars[idxVar].idxReg; … … 5971 5972 pReNative->Core.aVars[idxVar].idxReferrerVar = UINT8_MAX; 5972 5973 pReNative->Core.aVars[idxVar].enmGstReg = kIemNativeGstReg_End; 5974 pReNative->Core.aVars[idxVar].fRegAcquired = false; 5973 5975 pReNative->Core.aVars[idxVar].u.uValue = 0; 5974 5976 return idxVar; … … 6260 6262 6261 6263 /** 6262 * Makes sure variable @a idxVar has a register assigned to it. 6264 * Releases the variable's register. 6265 * 6266 * The register must have been previously acquired calling 6267 * iemNativeVarRegisterAcquire(), iemNativeVarRegisterAcquireForGuestReg() or 6268 * iemNativeVarRegisterSetAndAcquire(). 6269 */ 6270 DECL_INLINE_THROW(void) iemNativeVarRegisterRelease(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar) 6271 { 6272 IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVar); 6273 Assert(pReNative->Core.aVars[idxVar].fRegAcquired); 6274 pReNative->Core.aVars[idxVar].fRegAcquired = false; 6275 } 6276 6277 6278 /** 6279 * Makes sure variable @a idxVar has a register assigned to it and that it stays 6280 * fixed till we call iemNativeVarRegisterRelease. 6263 6281 * 6264 6282 * @returns The host register number. … … 6272 6290 * the case. 6273 6291 */ 6274 DECL_HIDDEN_THROW(uint8_t) iemNativeVar AllocRegister(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar,6275 uint32_t *poff, bool fInitialized = false)6292 DECL_HIDDEN_THROW(uint8_t) iemNativeVarRegisterAcquire(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar, 6293 uint32_t *poff, bool fInitialized = false) 6276 6294 { 6277 6295 IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVar); 6278 6296 Assert(pReNative->Core.aVars[idxVar].cbVar <= 8); 6279 /** @todo we must mark the variable as active and add a release function to 6280 * mark it as inactive, otherwise temporary register allocations may 6281 * cause the variable to be spilled onto the stack. */ 6297 Assert(!pReNative->Core.aVars[idxVar].fRegAcquired); 6282 6298 6283 6299 uint8_t idxReg = pReNative->Core.aVars[idxVar].idxReg; … … 6286 6302 Assert( pReNative->Core.aVars[idxVar].enmKind > kIemNativeVarKind_Invalid 6287 6303 && pReNative->Core.aVars[idxVar].enmKind < kIemNativeVarKind_End); 6304 pReNative->Core.aVars[idxVar].fRegAcquired = true; 6288 6305 return idxReg; 6289 6306 } … … 6321 6338 idxReg = g_aidxIemNativeCallRegs[uArgNo]; 6322 6339 iemNativeRegClearGstRegShadowing(pReNative, idxReg, *poff); 6323 Log11(("iemNativeVar AllocRegister: idxVar=%u idxReg=%u (matching arg %u)\n", idxVar, idxReg, uArgNo));6340 Log11(("iemNativeVarRegisterAcquire: idxVar=%u idxReg=%u (matching arg %u)\n", idxVar, idxReg, uArgNo)); 6324 6341 } 6325 6342 else … … 6337 6354 Assert(pReNative->Core.aHstRegs[idxReg].fGstRegShadows == 0); 6338 6355 Assert(!(pReNative->Core.bmHstRegsWithGstShadow & RT_BIT_32(idxReg))); 6339 Log11(("iemNativeVar AllocRegister: idxVar=%u idxReg=%u (uArgNo=%u)\n", idxVar, idxReg, uArgNo));6356 Log11(("iemNativeVarRegisterAcquire: idxVar=%u idxReg=%u (uArgNo=%u)\n", idxVar, idxReg, uArgNo)); 6340 6357 } 6341 6358 else … … 6344 6361 IEMNATIVE_HST_GREG_MASK & ~IEMNATIVE_REG_FIXED_MASK & fNotArgsMask); 6345 6362 AssertStmt(idxReg != UINT8_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_REG_ALLOCATOR_NO_FREE_VAR)); 6346 Log11(("iemNativeVar AllocRegister: idxVar=%u idxReg=%u (slow, uArgNo=%u)\n", idxVar, idxReg, uArgNo));6363 Log11(("iemNativeVarRegisterAcquire: idxVar=%u idxReg=%u (slow, uArgNo=%u)\n", idxVar, idxReg, uArgNo)); 6347 6364 } 6348 6365 } … … 6372 6389 AssertStmt(!fInitialized, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_NOT_INITIALIZED)); 6373 6390 } 6391 pReNative->Core.aVars[idxVar].fRegAcquired = true; 6374 6392 return idxReg; 6375 6393 } … … 6397 6415 */ 6398 6416 DECL_HIDDEN_THROW(uint8_t) 6399 iemNativeVar AllocRegisterForGuestReg(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar, IEMNATIVEGSTREG enmGstReg, uint32_t *poff)6417 iemNativeVarRegisterAcquireForGuestReg(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar, IEMNATIVEGSTREG enmGstReg, uint32_t *poff) 6400 6418 { 6401 6419 IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVar); 6420 Assert(!pReNative->Core.aVars[idxVar].fRegAcquired); 6402 6421 AssertMsgStmt( pReNative->Core.aVars[idxVar].cbVar <= 8 6403 6422 && ( pReNative->Core.aVars[idxVar].enmKind == kIemNativeVarKind_Immediate … … 6415 6434 * ensure we get a register suitable for the intended argument number. 6416 6435 */ 6417 AssertStmt(pReNative->Core.aVars[idxVar].uArgNo == UINT8_MAX, iemNativeVar AllocRegister(pReNative, idxVar, poff));6436 AssertStmt(pReNative->Core.aVars[idxVar].uArgNo == UINT8_MAX, iemNativeVarRegisterAcquire(pReNative, idxVar, poff)); 6418 6437 6419 6438 /* … … 6428 6447 uint8_t const idxRegOld = pReNative->Core.aidxGstRegShadows[enmGstReg]; 6429 6448 iemNativeRegTransferGstRegShadowing(pReNative, idxRegOld, idxReg, enmGstReg, *poff); 6430 Log12(("iemNativeVar AllocRegisterForGuestReg: Moved %s for guest %s into %s for full write\n",6449 Log12(("iemNativeVarRegisterAcquireForGuestReg: Moved %s for guest %s into %s for full write\n", 6431 6450 g_apszIemNativeHstRegNames[idxRegOld], g_aGstShadowInfo[enmGstReg].pszName, g_apszIemNativeHstRegNames[idxReg])); 6432 6451 } … … 6434 6453 { 6435 6454 iemNativeRegMarkAsGstRegShadow(pReNative, idxReg, enmGstReg, *poff); 6436 Log12(("iemNativeVar AllocRegisterForGuestReg: Marking %s as copy of guest %s (full write)\n",6455 Log12(("iemNativeVarRegisterAcquireForGuestReg: Marking %s as copy of guest %s (full write)\n", 6437 6456 g_apszIemNativeHstRegNames[idxReg], g_aGstShadowInfo[enmGstReg].pszName)); 6438 6457 } 6439 6458 /** @todo figure this one out. We need some way of making sure the register isn't 6440 6459 * modified after this point, just in case we start writing crappy MC code. */ 6441 pReNative->Core.aVars[idxVar].enmGstReg = enmGstReg; 6460 pReNative->Core.aVars[idxVar].enmGstReg = enmGstReg; 6461 pReNative->Core.aVars[idxVar].fRegAcquired = true; 6442 6462 return idxReg; 6443 6463 } … … 6483 6503 } 6484 6504 6505 pReNative->Core.aVars[idxVar].fRegAcquired = true; 6485 6506 return idxReg; 6486 6507 } … … 6505 6526 * @throws VERR_IEM_VAR_IPE_10, VERR_IEM_VAR_IPE_11 6506 6527 */ 6507 DECL_INLINE_THROW(uint8_t) iemNativeVar SetRegister(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar, uint8_t idxReg, uint32_t off)6528 DECL_INLINE_THROW(uint8_t) iemNativeVarRegisterSet(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar, uint8_t idxReg, uint32_t off) 6508 6529 { 6509 6530 IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVar); 6531 Assert(!pReNative->Core.aVars[idxVar].fRegAcquired); 6510 6532 Assert(idxReg < RT_ELEMENTS(pReNative->Core.aHstRegs)); 6511 6533 AssertStmt(pReNative->Core.aVars[idxVar].idxReg == UINT8_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_IPE_10)); … … 6518 6540 pReNative->Core.aVars[idxVar].idxReg = idxReg; 6519 6541 6542 return idxReg; 6543 } 6544 6545 6546 /** 6547 * A convenient helper function. 6548 */ 6549 DECL_INLINE_THROW(uint8_t) iemNativeVarRegisterSetAndAcquire(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar, 6550 uint8_t idxReg, uint32_t *poff) 6551 { 6552 idxReg = iemNativeVarRegisterSet(pReNative, idxVar, idxReg, *poff); 6553 pReNative->Core.aVars[idxVar].fRegAcquired = true; 6520 6554 return idxReg; 6521 6555 } … … 6694 6728 * variable passed to IEM_MC_ASSIGN_TO_SMALLER is not used after the 6695 6729 * statement. Then we could just transfer the register assignments. */ 6696 uint8_t const idxRegDst = iemNativeVar AllocRegister(pReNative, idxVarDst, &off);6697 uint8_t const idxRegSrc = iemNativeVar AllocRegister(pReNative, idxVarSrc, &off);6730 uint8_t const idxRegDst = iemNativeVarRegisterAcquire(pReNative, idxVarDst, &off); 6731 uint8_t const idxRegSrc = iemNativeVarRegisterAcquire(pReNative, idxVarSrc, &off); 6698 6732 switch (pReNative->Core.aVars[idxVarDst].cbVar) 6699 6733 { … … 6706 6740 default: AssertFailed(); break; 6707 6741 } 6742 iemNativeVarRegisterRelease(pReNative, idxVarSrc); 6743 iemNativeVarRegisterRelease(pReNative, idxVarDst); 6708 6744 } 6709 6745 return off; … … 7293 7329 { 7294 7330 pReNative->pInstrBuf[off++] = 0xcc; /** @todo test IEM_MC_CALL_AIMPL_3 and IEM_MC_CALL_AIMPL_4 return codes. */ 7295 iemNativeVar SetRegister(pReNative, idxVarRc, IEMNATIVE_CALL_RET_GREG, off);7331 iemNativeVarRegisterSet(pReNative, idxVarRc, IEMNATIVE_CALL_RET_GREG, off); 7296 7332 } 7297 7333 … … 7416 7452 7417 7453 iemNativeVarSetKindToStack(pReNative, idxDstVar); 7418 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxDstVar, &off);7454 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off); 7419 7455 7420 7456 /* The value is zero-extended to the full 64-bit host register width. */ … … 7424 7460 off = iemNativeEmitLoadGprFromGpr8Hi(pReNative, off, idxVarReg, idxGstFullReg); 7425 7461 7462 iemNativeVarRegisterRelease(pReNative, idxDstVar); 7426 7463 iemNativeRegFreeTmp(pReNative, idxGstFullReg); 7427 7464 return off; … … 7451 7488 7452 7489 iemNativeVarSetKindToStack(pReNative, idxDstVar); 7453 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxDstVar, &off);7490 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off); 7454 7491 7455 7492 if (iGRegEx < 16) … … 7487 7524 } 7488 7525 7526 iemNativeVarRegisterRelease(pReNative, idxDstVar); 7489 7527 iemNativeRegFreeTmp(pReNative, idxGstFullReg); 7490 7528 return off; … … 7521 7559 7522 7560 iemNativeVarSetKindToStack(pReNative, idxDstVar); 7523 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxDstVar, &off);7561 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off); 7524 7562 off = iemNativeEmitLoadGprFromGpr16(pReNative, off, idxVarReg, idxGstFullReg); 7563 iemNativeVarRegisterRelease(pReNative, idxDstVar); 7525 7564 7526 7565 iemNativeRegFreeTmp(pReNative, idxGstFullReg); … … 7554 7593 7555 7594 iemNativeVarSetKindToStack(pReNative, idxDstVar); 7556 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxDstVar, &off);7595 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off); 7557 7596 if (cbSignExtended == sizeof(uint32_t)) 7558 7597 off = iemNativeEmitLoadGpr32SignExtendedFromGpr16(pReNative, off, idxVarReg, idxGstFullReg); … … 7562 7601 off = iemNativeEmitLoadGprSignExtendedFromGpr16(pReNative, off, idxVarReg, idxGstFullReg); 7563 7602 } 7603 iemNativeVarRegisterRelease(pReNative, idxDstVar); 7564 7604 7565 7605 iemNativeRegFreeTmp(pReNative, idxGstFullReg); … … 7593 7633 7594 7634 iemNativeVarSetKindToStack(pReNative, idxDstVar); 7595 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxDstVar, &off);7635 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off); 7596 7636 off = iemNativeEmitLoadGprFromGpr32(pReNative, off, idxVarReg, idxGstFullReg); 7637 iemNativeVarRegisterRelease(pReNative, idxDstVar); 7597 7638 7598 7639 iemNativeRegFreeTmp(pReNative, idxGstFullReg); … … 7623 7664 7624 7665 iemNativeVarSetKindToStack(pReNative, idxDstVar); 7625 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxDstVar, &off);7666 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off); 7626 7667 off = iemNativeEmitLoadGprSignExtendedFromGpr32(pReNative, off, idxVarReg, idxGstFullReg); 7668 iemNativeVarRegisterRelease(pReNative, idxDstVar); 7627 7669 7628 7670 iemNativeRegFreeTmp(pReNative, idxGstFullReg); … … 7650 7692 7651 7693 iemNativeVarSetKindToStack(pReNative, idxDstVar); 7652 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxDstVar, &off);7694 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxDstVar, &off); 7653 7695 off = iemNativeEmitLoadGprFromGpr(pReNative, off, idxVarReg, idxGstFullReg); 7654 7696 /** @todo name the register a shadow one already? */ 7697 iemNativeVarRegisterRelease(pReNative, idxDstVar); 7655 7698 7656 7699 iemNativeRegFreeTmp(pReNative, idxGstFullReg); … … 7765 7808 uint8_t const idxGstTmpReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(iGRegEx & 15), 7766 7809 kIemNativeGstRegUse_ForUpdate); 7767 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxValueVar, &off, true /*fInitialized*/);7810 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxValueVar, &off, true /*fInitialized*/); 7768 7811 7769 7812 #ifdef RT_ARCH_AMD64 … … 7825 7868 # error "Port me!" 7826 7869 #endif 7827 7828 7870 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 7871 7872 iemNativeVarRegisterRelease(pReNative, idxValueVar); 7829 7873 7830 7874 off = iemNativeEmitStoreGprToVCpuU64(pReNative, off, idxGstTmpReg, RT_UOFFSETOF_DYN(VMCPU, cpum.GstCtx.aGRegs[iGRegEx & 15])); … … 7922 7966 #elif defined(RT_ARCH_ARM64) 7923 7967 /* bfi w1, w2, 0, 16 - moves bits 15:0 from idxVarReg to idxGstTmpReg bits 15:0. */ 7924 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxValueVar, &off, true /*fInitialized*/);7968 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxValueVar, &off, true /*fInitialized*/); 7925 7969 uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1); 7926 7970 pu32CodeBuf[off++] = Armv8A64MkInstrBfi(idxGstTmpReg, idxVarReg, 0, 16); 7971 iemNativeVarRegisterRelease(pReNative, idxValueVar); 7927 7972 7928 7973 #else … … 7982 8027 * it to the CPUMCTX structure. 7983 8028 */ 7984 uint8_t const idxVarReg = iemNativeVar AllocRegisterForGuestReg(pReNative, idxValueVar, IEMNATIVEGSTREG_GPR(iGReg), &off);8029 uint8_t const idxVarReg = iemNativeVarRegisterAcquireForGuestReg(pReNative, idxValueVar, IEMNATIVEGSTREG_GPR(iGReg), &off); 7985 8030 off = iemNativeEmitStoreGprToVCpuU64(pReNative, off, idxVarReg, RT_UOFFSETOF_DYN(VMCPU, cpum.GstCtx.aGRegs[iGReg])); 7986 8031 #ifdef VBOX_STRICT 7987 8032 off = iemNativeEmitTop32BitsClearCheck(pReNative, off, idxVarReg); 7988 8033 #endif 8034 iemNativeVarRegisterRelease(pReNative, idxValueVar); 7989 8035 return off; 7990 8036 } … … 8035 8081 * it to the CPUMCTX structure. 8036 8082 */ 8037 uint8_t const idxVarReg = iemNativeVar AllocRegisterForGuestReg(pReNative, idxValueVar, IEMNATIVEGSTREG_GPR(iGReg), &off);8083 uint8_t const idxVarReg = iemNativeVarRegisterAcquireForGuestReg(pReNative, idxValueVar, IEMNATIVEGSTREG_GPR(iGReg), &off); 8038 8084 off = iemNativeEmitStoreGprToVCpuU64(pReNative, off, idxVarReg, RT_UOFFSETOF_DYN(VMCPU, cpum.GstCtx.aGRegs[iGReg])); 8085 iemNativeVarRegisterRelease(pReNative, idxValueVar); 8039 8086 return off; 8040 8087 } … … 8184 8231 Assert(pReNative->Core.aVars[idxVarEFlags].cbVar == sizeof(uint32_t)); 8185 8232 8186 uint8_t const idxReg = iemNativeVar AllocRegister(pReNative, idxVarEFlags, &off, false /*fInitialized*/);8233 uint8_t const idxReg = iemNativeVarRegisterAcquire(pReNative, idxVarEFlags, &off, false /*fInitialized*/); 8187 8234 iemNativeRegClearAndMarkAsGstRegShadow(pReNative, idxReg, kIemNativeGstReg_EFlags, off); 8188 return iemNativeEmitLoadGprFromVCpuU32(pReNative, off, idxReg, RT_UOFFSETOF(VMCPUCC, cpum.GstCtx.eflags)); 8235 off = iemNativeEmitLoadGprFromVCpuU32(pReNative, off, idxReg, RT_UOFFSETOF(VMCPUCC, cpum.GstCtx.eflags)); 8236 iemNativeVarRegisterRelease(pReNative, idxVarEFlags); 8237 return off; 8189 8238 } 8190 8239 … … 8200 8249 Assert(pReNative->Core.aVars[idxVarEFlags].cbVar == sizeof(uint32_t)); 8201 8250 8202 uint8_t const idxReg = iemNativeVar AllocRegister(pReNative, idxVarEFlags, &off, true /*fInitialized*/);8251 uint8_t const idxReg = iemNativeVarRegisterAcquire(pReNative, idxVarEFlags, &off, true /*fInitialized*/); 8203 8252 8204 8253 #ifdef VBOX_STRICT … … 8213 8262 8214 8263 iemNativeRegClearAndMarkAsGstRegShadow(pReNative, idxReg, kIemNativeGstReg_EFlags, off); 8215 return iemNativeEmitStoreGprToVCpuU32(pReNative, off, idxReg, RT_UOFFSETOF_DYN(VMCPUCC, cpum.GstCtx.eflags)); 8264 off = iemNativeEmitStoreGprToVCpuU32(pReNative, off, idxReg, RT_UOFFSETOF_DYN(VMCPUCC, cpum.GstCtx.eflags)); 8265 iemNativeVarRegisterRelease(pReNative, idxVarEFlags); 8266 return off; 8216 8267 } 8217 8268 … … 8406 8457 * Now emit code that calculates: idxRegRet = (uint16_t)(u16EffAddr + idxGstRegBase [+ idxGstRegIndex]) 8407 8458 */ 8408 uint8_t const idxRegRet = iemNativeVar AllocRegister(pReNative, idxVarRet, &off);8459 uint8_t const idxRegRet = iemNativeVarRegisterAcquire(pReNative, idxVarRet, &off); 8409 8460 uint8_t const idxRegBase = iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(idxGstRegBase), 8410 8461 kIemNativeGstRegUse_ReadOnly); … … 8505 8556 iemNativeRegFreeTmp(pReNative, idxRegIndex); 8506 8557 iemNativeRegFreeTmp(pReNative, idxRegBase); 8558 iemNativeVarRegisterRelease(pReNative, idxVarRet); 8507 8559 return off; 8508 8560 } … … 8612 8664 * Now emit code that calculates: idxRegRet = (uint32_t)(u32EffAddr [+ idxGstRegBase] [+ (idxGstRegIndex << cShiftIndex)]) 8613 8665 */ 8614 uint8_t const idxRegRet = iemNativeVar AllocRegister(pReNative, idxVarRet, &off);8666 uint8_t const idxRegRet = iemNativeVarRegisterAcquire(pReNative, idxVarRet, &off); 8615 8667 uint8_t idxRegBase = idxGstRegBase == UINT8_MAX ? UINT8_MAX 8616 8668 : iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(idxGstRegBase), … … 8765 8817 if (idxRegBase != UINT8_MAX) 8766 8818 iemNativeRegFreeTmp(pReNative, idxRegBase); 8819 iemNativeVarRegisterRelease(pReNative, idxVarRet); 8767 8820 return off; 8768 8821 } … … 8815 8868 if ((bRmEx & (X86_MODRM_MOD_MASK | X86_MODRM_RM_MASK)) == 5) 8816 8869 { 8817 uint8_t const idxRegRet = iemNativeVar AllocRegister(pReNative, idxVarRet, &off);8870 uint8_t const idxRegRet = iemNativeVarRegisterAcquire(pReNative, idxVarRet, &off); 8818 8871 uint8_t const idxRegPc = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Pc, 8819 8872 kIemNativeGstRegUse_ReadOnly); … … 8845 8898 #endif 8846 8899 iemNativeRegFreeTmp(pReNative, idxRegPc); 8900 iemNativeVarRegisterRelease(pReNative, idxVarRet); 8847 8901 return off; 8848 8902 } … … 8913 8967 * idxRegRet = (uint32_t)(i64EffAddr [+ idxGstRegBase] [+ (idxGstRegIndex << cShiftIndex)]) 8914 8968 */ 8915 uint8_t const idxRegRet = iemNativeVar AllocRegister(pReNative, idxVarRet, &off);8969 uint8_t const idxRegRet = iemNativeVarRegisterAcquire(pReNative, idxVarRet, &off); 8916 8970 uint8_t idxRegBase = idxGstRegBase == UINT8_MAX ? UINT8_MAX 8917 8971 : iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(idxGstRegBase), … … 9099 9153 if (idxRegBase != UINT8_MAX) 9100 9154 iemNativeRegFreeTmp(pReNative, idxRegBase); 9155 iemNativeVarRegisterRelease(pReNative, idxVarRet); 9101 9156 return off; 9102 9157 } … … 9267 9322 uint8_t const idxRegValueFetch = enmOp == kIemNativeEmitMemOp_Store ? UINT8_MAX /* special case value storing below */ 9268 9323 : !(pReNative->Core.bmHstRegs & RT_BIT_32(IEMNATIVE_CALL_RET_GREG)) 9269 ? iemNativeVar SetRegister(pReNative, idxVarValue, IEMNATIVE_CALL_RET_GREG,off)9270 : iemNativeVar AllocRegister(pReNative, idxVarValue, &off);9324 ? iemNativeVarRegisterSetAndAcquire(pReNative, idxVarValue, IEMNATIVE_CALL_RET_GREG, &off) 9325 : iemNativeVarRegisterAcquire(pReNative, idxVarValue, &off); 9271 9326 9272 9327 /* … … 9363 9418 if (idxRegValueFetch != IEMNATIVE_CALL_RET_GREG) 9364 9419 off = iemNativeEmitLoadGprFromGpr(pReNative, off, idxRegValueFetch, IEMNATIVE_CALL_RET_GREG); 9420 iemNativeVarRegisterRelease(pReNative, idxVarValue); 9365 9421 } 9366 9422 … … 10002 10058 uint32_t const idxLabelTlbDone = iemNativeLabelCreate(pReNative, kIemNativeLabelType_TlbDone, UINT32_MAX, uTlbSeqNo); 10003 10059 uint8_t const idxRegMemResult = !(pReNative->Core.bmHstRegs & RT_BIT_32(IEMNATIVE_CALL_RET_GREG)) 10004 ? iemNativeVar SetRegister(pReNative, idxVarMem, IEMNATIVE_CALL_RET_GREG,off)10005 : iemNativeVar AllocRegister(pReNative, idxVarMem, &off);10060 ? iemNativeVarRegisterSetAndAcquire(pReNative, idxVarMem, IEMNATIVE_CALL_RET_GREG, &off) 10061 : iemNativeVarRegisterAcquire(pReNative, idxVarMem, &off); 10006 10062 10007 10063 /* … … 10050 10106 if (idxRegMemResult != IEMNATIVE_CALL_RET_GREG) 10051 10107 off = iemNativeEmitLoadGprFromGpr(pReNative, off, idxRegMemResult, IEMNATIVE_CALL_RET_GREG); 10108 iemNativeVarRegisterRelease(pReNative, idxVarMem); 10052 10109 10053 10110 iemNativeLabelDefine(pReNative, idxLabelTlbDone, off); … … 10128 10185 #endif 10129 10186 { 10130 uint8_t const idxVarReg = iemNativeVar AllocRegister(pReNative, idxVarUnmapInfo, &off);10187 uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxVarUnmapInfo, &off); 10131 10188 off = iemNativeEmitTestAnyBitsInGpr8(pReNative, off, idxVarReg, 0xff); 10189 iemNativeVarRegisterRelease(pReNative, idxVarUnmapInfo); 10132 10190 } 10133 10191 uint32_t const offJmpFixup = off; -
trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
r102527 r102558 477 477 * @todo not sure what this really is for... */ 478 478 IEMNATIVEGSTREG enmGstReg; 479 uint8_t bAlign; 479 /** Set if the registered is currently used exclusively, false if the 480 * variable is idle and the register can be grabbed. */ 481 bool fRegAcquired; 480 482 481 483 union
Note:
See TracChangeset
for help on using the changeset viewer.