- Timestamp:
- Jan 9, 2024 12:28:38 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r102791 r102793 11894 11894 11895 11895 DECL_FORCE_INLINE_THROW(uint32_t) 11896 iemNativeEmitStackPopUse16Sp(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t idxRegRsp, uint8_t idxRegEffSp, uint8_t cbMem) 11896 iemNativeEmitStackPopUse16Sp(PIEMNATIVEINSTR pCodeBuf, uint32_t off, uint8_t idxRegRsp, uint8_t idxRegEffSp, uint8_t cbMem, 11897 uint8_t idxRegTmp) 11897 11898 { 11898 11899 /* Use16BitSp: */ … … 11900 11901 off = iemNativeEmitLoadGprFromGpr16Ex(pCodeBuf, off, idxRegEffSp, idxRegRsp); 11901 11902 off = iemNativeEmitAddGpr16ImmEx(pCodeBuf, off, idxRegRsp, cbMem); /* ASSUMES this does NOT modify bits [63:16]! */ 11903 RT_NOREF(idxRegTmp); 11902 11904 #else 11903 /* bfi regrsp, regeff, #0, #16 - moves bits 15:0 from idxVarReg to idxGstTmpReg bits 15:0. */11904 pCodeBuf[off++] = Armv8A64MkInstr Bfi(idxRegRsp, idxRegEffSp, 0, 16, false /*f64Bit*/);11905 /* add regeff, regrsp, #cbMem */11906 pCodeBuf[off++] = Armv8A64MkInstrAddUImm12(idxReg EffSp, idxRegRsp, cbMem, false /*f64Bit*/);11907 /* and regeff, regeff, #0xffff */11905 /* ubfiz regeff, regrsp, #0, #16 - copies bits 15:0 from RSP to EffSp bits 15:0, zeroing bits 63:16. */ 11906 pCodeBuf[off++] = Armv8A64MkInstrUbfiz(idxRegEffSp, idxRegRsp, 0, 16, false /*f64Bit*/); 11907 /* add tmp, regrsp, #cbMem */ 11908 pCodeBuf[off++] = Armv8A64MkInstrAddUImm12(idxRegTmp, idxRegRsp, cbMem, false /*f64Bit*/); 11909 /* and tmp, tmp, #0xffff */ 11908 11910 Assert(Armv8A64ConvertImmRImmS2Mask32(15, 0) == 0xffff); 11909 pCodeBuf[off++] = Armv8A64MkInstrAndImm(idxRegEffSp, idxRegEffSp, 15, 0, false /*f64Bit*/); 11911 pCodeBuf[off++] = Armv8A64MkInstrAndImm(idxRegTmp, idxRegTmp, 15, 0, false /*f64Bit*/); 11912 /* bfi regrsp, regeff, #0, #16 - moves bits 15:0 from tmp to RSP bits 15:0, keeping the other RSP bits as is. */ 11913 pCodeBuf[off++] = Armv8A64MkInstrBfi(idxRegRsp, idxRegTmp, 0, 16, false /*f64Bit*/); 11910 11914 #endif 11911 11915 return off; … … 11972 11976 * (Code structure is very similar to that of PUSH) 11973 11977 */ 11974 uint8_t const cbMem = RT_BYTE1(cBitsVarAndFlat) / 8; 11975 uint8_t const cBitsFlat = RT_BYTE2(cBitsVarAndFlat); RT_NOREF(cBitsFlat); 11976 uint8_t const idxRegRsp = iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(X86_GREG_xSP), 11977 kIemNativeGstRegUse_ForUpdate, true /*fNoVolatileRegs*/); 11978 uint8_t const idxRegEffSp = cBitsFlat != 0 ? idxRegRsp : iemNativeRegAllocTmp(pReNative, &off); 11978 uint8_t const cbMem = RT_BYTE1(cBitsVarAndFlat) / 8; 11979 uint8_t const cBitsFlat = RT_BYTE2(cBitsVarAndFlat); RT_NOREF(cBitsFlat); 11980 uint8_t const idxRegRsp = iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(X86_GREG_xSP), 11981 kIemNativeGstRegUse_ForUpdate, true /*fNoVolatileRegs*/); 11982 uint8_t const idxRegEffSp = cBitsFlat != 0 ? idxRegRsp : iemNativeRegAllocTmp(pReNative, &off); 11983 /** @todo can do a better job picking the register here. For cbMem >= 4 this 11984 * will be the resulting register value. */ 11985 uint8_t const idxRegMemResult = iemNativeRegAllocTmp(pReNative, &off); /* pointer then value; arm64 SP += 2/4 helper too. */ 11986 11979 11987 uint32_t offFixupJumpToUseOtherBitSp = UINT32_MAX; 11980 11988 if (cBitsFlat != 0) … … 12006 12014 { 12007 12015 off = iemNativeEmitJccToFixedEx(pCodeBuf, off, off /*8-bit suffices*/, kIemNativeInstrCond_ne); /* jump if not zero */ 12008 off = iemNativeEmitStackPopUse16Sp(pCodeBuf, off, idxRegRsp, idxRegEffSp, cbMem );12016 off = iemNativeEmitStackPopUse16Sp(pCodeBuf, off, idxRegRsp, idxRegEffSp, cbMem, idxRegMemResult); 12009 12017 } 12010 12018 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); … … 12024 12032 ? iemNativeLabelCreate(pReNative, kIemNativeLabelType_TlbLookup, UINT32_MAX, uTlbSeqNo) 12025 12033 : UINT32_MAX; 12026 /** @todo can do a better job picking the register here. For cbMem >= 4 this12027 * will be the resulting register value. */12028 uint8_t const idxRegMemResult = iemNativeRegAllocTmp(pReNative, &off); /* pointer then value */12029 12034 12030 12035 if (!TlbState.fSkip) … … 12045 12050 iemNativeFixupFixedJump(pReNative, offFixupJumpToUseOtherBitSp, off); 12046 12051 if ((pReNative->fExec & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_32BIT) 12047 off = iemNativeEmitStackPopUse16Sp(pCodeBuf, off, idxRegRsp, idxRegEffSp, cbMem );12052 off = iemNativeEmitStackPopUse16Sp(pCodeBuf, off, idxRegRsp, idxRegEffSp, cbMem, idxRegMemResult); 12048 12053 else 12049 12054 off = iemNativeEmitStackPopUse32Sp(pCodeBuf, off, idxRegRsp, idxRegEffSp, cbMem);
Note:
See TracChangeset
for help on using the changeset viewer.