- Timestamp:
- Jan 3, 2024 8:09:41 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r102756 r102757 10806 10806 off = iemNativeRegFlushPendingWrites(pReNative, off); 10807 10807 10808 #ifdef IEMNATIVE_WITH_FREE_AND_FLUSH_VOLATILE_REGS_AT_TLB_LOOKUP 10808 10809 /* 10809 10810 * Move/spill/flush stuff out of call-volatile registers. … … 10811 10812 * by saving and restoring active stuff here. 10812 10813 */ 10813 /** @todo save+restore active registers and maybe guest shadows in tlb-miss. */10814 10814 off = iemNativeRegMoveAndFreeAndFlushAtCall(pReNative, off, 0 /* vacate all non-volatile regs */); 10815 #endif 10815 10816 10816 10817 /* … … 10854 10855 #endif 10855 10856 10857 #ifndef IEMNATIVE_WITH_FREE_AND_FLUSH_VOLATILE_REGS_AT_TLB_LOOKUP 10858 /* Save variables in volatile registers. */ 10859 uint32_t const fHstRegsNotToSave = TlbState.getRegsNotToSave() 10860 | (idxRegMemResult != UINT8_MAX ? RT_BIT_32(idxRegMemResult) : 0) 10861 | (idxRegValueFetch != UINT8_MAX ? RT_BIT_32(idxRegValueFetch) : 0); 10862 off = iemNativeVarSaveVolatileRegsPreHlpCall(pReNative, off, fHstRegsNotToSave); 10863 #endif 10864 10856 10865 /* IEMNATIVE_CALL_ARG2/3_GREG = uValue (idxVarValue) - if store */ 10866 uint32_t fVolGregMask = IEMNATIVE_CALL_VOLATILE_GREG_MASK; 10857 10867 if (enmOp == kIemNativeEmitMemOp_Store) 10858 10868 { 10859 10869 uint8_t const idxRegArgValue = iSegReg == UINT8_MAX ? IEMNATIVE_CALL_ARG2_GREG : IEMNATIVE_CALL_ARG3_GREG; 10860 if (pReNative->Core.aVars[idxVarValue].enmKind == kIemNativeVarKind_Immediate) 10861 off = iemNativeEmitLoadGprImm64(pReNative, off, idxRegArgValue, pReNative->Core.aVars[idxVarValue].u.uValue); 10862 else 10863 { 10864 uint8_t const idxRegVarValue = pReNative->Core.aVars[idxVarValue].idxReg; 10865 if (idxRegVarValue < RT_ELEMENTS(pReNative->Core.aHstRegs)) 10866 { 10867 Assert(!(RT_BIT_32(idxRegVarValue) & IEMNATIVE_CALL_VOLATILE_GREG_MASK)); 10868 off = iemNativeEmitLoadGprFromGpr(pReNative, off, idxRegArgValue, idxRegVarValue); 10869 } 10870 else 10871 { 10872 uint8_t const idxStackSlot = pReNative->Core.aVars[idxVarValue].idxStackSlot; 10873 AssertStmt(idxStackSlot != UINT8_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_NOT_INITIALIZED)); 10874 off = iemNativeEmitLoadGprByBp(pReNative, off, idxRegArgValue, iemNativeStackCalcBpDisp(idxStackSlot)); 10875 } 10876 } 10870 off = iemNativeEmitLoadArgGregFromImmOrStackVar(pReNative, off, idxRegArgValue, idxVarValue, 0 /*cbAppend*/, 10871 #ifdef IEMNATIVE_WITH_FREE_AND_FLUSH_VOLATILE_REGS_AT_TLB_LOOKUP 10872 IEMNATIVE_CALL_VOLATILE_GREG_MASK); 10873 #else 10874 IEMNATIVE_CALL_VOLATILE_GREG_MASK, true /*fSpilledVarsInvolatileRegs*/); 10875 fVolGregMask &= ~RT_BIT_32(idxRegArgValue); 10876 #endif 10877 10877 } 10878 10878 10879 10879 /* IEMNATIVE_CALL_ARG1_GREG = GCPtrMem */ 10880 if (pReNative->Core.aVars[idxVarGCPtrMem].enmKind == kIemNativeVarKind_Immediate) 10881 off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, 10882 pReNative->Core.aVars[idxVarGCPtrMem].u.uValue + offDisp); 10883 else 10884 { 10885 uint8_t const idxRegVarGCPtrMem = pReNative->Core.aVars[idxVarGCPtrMem].idxReg; 10886 if (idxRegVarGCPtrMem < RT_ELEMENTS(pReNative->Core.aHstRegs)) 10887 { 10888 Assert(!(RT_BIT_32(idxRegVarGCPtrMem) & IEMNATIVE_CALL_VOLATILE_GREG_MASK)); 10889 if (!offDisp) 10890 off = iemNativeEmitLoadGprFromGpr(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, idxRegVarGCPtrMem); 10891 else 10892 off = iemNativeEmitLoadGprFromGprWithAddend(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, idxRegVarGCPtrMem, offDisp); 10893 } 10894 else 10895 { 10896 uint8_t const idxStackSlot = pReNative->Core.aVars[idxVarGCPtrMem].idxStackSlot; 10897 AssertStmt(idxStackSlot != UINT8_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_NOT_INITIALIZED)); 10898 AssertFailed(); /** @todo This was probably caused by iemNativeRegMoveAndFreeAndFlushAtCall above. Improve... */ 10899 off = iemNativeEmitLoadGprByBp(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, iemNativeStackCalcBpDisp(idxStackSlot)); 10900 if (offDisp) 10901 off = iemNativeEmitAddGprImm(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, offDisp); 10902 } 10903 } 10880 off = iemNativeEmitLoadArgGregFromImmOrStackVar(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, idxVarGCPtrMem, offDisp /*cbAppend*/, 10881 #ifdef IEMNATIVE_WITH_FREE_AND_FLUSH_VOLATILE_REGS_AT_TLB_LOOKUP 10882 fVolGregMask); 10883 #else 10884 fVolGregMask, true /*fSpilledVarsInvolatileRegs*/); 10885 #endif 10904 10886 10905 10887 if (iSegReg != UINT8_MAX) … … 10925 10907 off = iemNativeEmitLoadGprFromGpr(pReNative, off, idxRegValueFetch, IEMNATIVE_CALL_RET_GREG); 10926 10908 } 10909 10910 #ifndef IEMNATIVE_WITH_FREE_AND_FLUSH_VOLATILE_REGS_AT_TLB_LOOKUP 10911 /* Restore variables and guest shadow registers to volatile registers. */ 10912 off = iemNativeVarRestoreVolatileRegsPostHlpCall(pReNative, off, fHstRegsNotToSave); 10913 off = iemNativeRegRestoreGuestShadowsInVolatileRegs(pReNative, off, TlbState.getActiveRegsWithShadows()); 10914 #endif 10927 10915 10928 10916 #ifdef IEMNATIVE_WITH_TLB_LOOKUP
Note:
See TracChangeset
for help on using the changeset viewer.