- Timestamp:
- Dec 12, 2023 10:56:20 AM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 160732
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllInstPython.py
r102583 r102584 2790 2790 'IEM_MC_ACTUALIZE_SSE_STATE_FOR_CHANGE': (McBlock.parseMcGeneric, False, True, ), 2791 2791 'IEM_MC_ACTUALIZE_SSE_STATE_FOR_READ': (McBlock.parseMcGeneric, False, True, ), 2792 'IEM_MC_ADD_GREG_U16': (McBlock.parseMcGeneric, True, False,),2792 'IEM_MC_ADD_GREG_U16': (McBlock.parseMcGeneric, True, True, ), 2793 2793 'IEM_MC_ADD_GREG_U16_TO_LOCAL': (McBlock.parseMcGeneric, False, False, ), 2794 'IEM_MC_ADD_GREG_U32': (McBlock.parseMcGeneric, True, False,),2794 'IEM_MC_ADD_GREG_U32': (McBlock.parseMcGeneric, True, True, ), 2795 2795 'IEM_MC_ADD_GREG_U32_TO_LOCAL': (McBlock.parseMcGeneric, False, False, ), 2796 'IEM_MC_ADD_GREG_U64': (McBlock.parseMcGeneric, True, False,),2796 'IEM_MC_ADD_GREG_U64': (McBlock.parseMcGeneric, True, True, ), 2797 2797 'IEM_MC_ADD_GREG_U64_TO_LOCAL': (McBlock.parseMcGeneric, False, False, ), 2798 2798 'IEM_MC_ADD_GREG_U8_TO_LOCAL': (McBlock.parseMcGeneric, False, False, ), -
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r102583 r102584 8280 8280 *********************************************************************************************************************************/ 8281 8281 8282 #define IEM_MC_ADD_GREG_U16(a_iGReg, a_u8SubtrahendConst) \ 8283 off = iemNativeEmitAddGregU16(pReNative, off, a_iGReg, a_u8SubtrahendConst) 8284 8285 /** Emits code for IEM_MC_ADD_GREG_U16. */ 8286 DECL_INLINE_THROW(uint32_t) 8287 iemNativeEmitAddGregU16(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iGReg, uint8_t uAddend) 8288 { 8289 uint8_t const idxGstTmpReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(iGReg), 8290 kIemNativeGstRegUse_ForUpdate); 8291 8292 #ifdef RT_ARCH_AMD64 8293 uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 6); 8294 pbCodeBuf[off++] = X86_OP_PRF_SIZE_OP; 8295 if (idxGstTmpReg >= 8) 8296 pbCodeBuf[off++] = X86_OP_REX_B; 8297 if (uAddend == 1) 8298 { 8299 pbCodeBuf[off++] = 0xff; /* inc */ 8300 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, idxGstTmpReg & 7); 8301 } 8302 else 8303 { 8304 pbCodeBuf[off++] = 0x81; 8305 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, idxGstTmpReg & 7); 8306 pbCodeBuf[off++] = uAddend; 8307 pbCodeBuf[off++] = 0; 8308 } 8309 8310 #else 8311 uint8_t const idxTmpReg = iemNativeRegAllocTmp(pReNative, &off); 8312 uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 2); 8313 8314 /* sub tmp, gstgrp, uAddend */ 8315 pu32CodeBuf[off++] = Armv8A64MkInstrAddSubUImm12(false /*fSub*/, idxTmpReg, idxGstTmpReg, uAddend, false /*f64Bit*/); 8316 8317 /* bfi w1, w2, 0, 16 - moves bits 15:0 from tmpreg2 to tmpreg. */ 8318 pu32CodeBuf[off++] = Armv8A64MkInstrBfi(idxGstTmpReg, idxTmpReg, 0, 16); 8319 8320 iemNativeRegFreeTmp(pReNative, idxTmpReg); 8321 #endif 8322 8323 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 8324 8325 off = iemNativeEmitStoreGprToVCpuU64(pReNative, off, idxGstTmpReg, RT_UOFFSETOF_DYN(VMCPU, cpum.GstCtx.aGRegs[iGReg])); 8326 8327 iemNativeRegFreeTmp(pReNative, idxGstTmpReg); 8328 return off; 8329 } 8330 8331 8332 #define IEM_MC_ADD_GREG_U32(a_iGReg, a_u8Const) \ 8333 off = iemNativeEmitAddGregU32U64(pReNative, off, a_iGReg, a_u8Const, false /*f64Bit*/) 8334 8335 #define IEM_MC_ADD_GREG_U64(a_iGReg, a_u8Const) \ 8336 off = iemNativeEmitAddGregU32U64(pReNative, off, a_iGReg, a_u8Const, true /*f64Bit*/) 8337 8338 /** Emits code for IEM_MC_ADD_GREG_U32 and IEM_MC_ADD_GREG_U64. */ 8339 DECL_INLINE_THROW(uint32_t) 8340 iemNativeEmitAddGregU32U64(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iGReg, uint8_t uAddend, bool f64Bit) 8341 { 8342 uint8_t const idxGstTmpReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, IEMNATIVEGSTREG_GPR(iGReg), 8343 kIemNativeGstRegUse_ForUpdate); 8344 8345 #ifdef RT_ARCH_AMD64 8346 uint8_t *pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 7); 8347 if (f64Bit) 8348 pbCodeBuf[off++] = X86_OP_REX_W | (idxGstTmpReg >= 8 ? X86_OP_REX_B : 0); 8349 else if (idxGstTmpReg >= 8) 8350 pbCodeBuf[off++] = X86_OP_REX_B; 8351 if (uAddend == 1) 8352 { 8353 pbCodeBuf[off++] = 0xff; /* inc */ 8354 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, idxGstTmpReg & 7); 8355 } 8356 else if (uAddend < 128) 8357 { 8358 pbCodeBuf[off++] = 0x83; /* add */ 8359 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, idxGstTmpReg & 7); 8360 pbCodeBuf[off++] = RT_BYTE1(uAddend); 8361 } 8362 else 8363 { 8364 pbCodeBuf[off++] = 0x81; /* add */ 8365 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 0, idxGstTmpReg & 7); 8366 pbCodeBuf[off++] = RT_BYTE1(uAddend); 8367 pbCodeBuf[off++] = 0; 8368 pbCodeBuf[off++] = 0; 8369 pbCodeBuf[off++] = 0; 8370 } 8371 8372 #else 8373 /* sub tmp, gstgrp, uAddend */ 8374 uint32_t *pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1); 8375 pu32CodeBuf[off++] = Armv8A64MkInstrAddSubUImm12(false /*fSub*/, idxGstTmpReg, idxGstTmpReg, uAddend, f64Bit); 8376 8377 #endif 8378 8379 IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off); 8380 8381 off = iemNativeEmitStoreGprToVCpuU64(pReNative, off, idxGstTmpReg, RT_UOFFSETOF_DYN(VMCPU, cpum.GstCtx.aGRegs[iGReg])); 8382 8383 iemNativeRegFreeTmp(pReNative, idxGstTmpReg); 8384 return off; 8385 } 8386 8387 8388 8282 8389 #define IEM_MC_SUB_GREG_U16(a_iGReg, a_u8SubtrahendConst) \ 8283 8390 off = iemNativeEmitSubGregU16(pReNative, off, a_iGReg, a_u8SubtrahendConst) … … 8291 8398 8292 8399 #ifdef RT_ARCH_AMD64 8293 uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 4);8400 uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 6); 8294 8401 pbCodeBuf[off++] = X86_OP_PRF_SIZE_OP; 8295 8402 if (idxGstTmpReg >= 8) 8296 8403 pbCodeBuf[off++] = X86_OP_REX_B; 8297 if (uSubtrahend )8404 if (uSubtrahend == 1) 8298 8405 { 8299 8406 pbCodeBuf[off++] = 0xff; /* dec */ … … 8344 8451 8345 8452 #ifdef RT_ARCH_AMD64 8346 uint8_t *pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 6);8453 uint8_t *pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 7); 8347 8454 if (f64Bit) 8348 8455 pbCodeBuf[off++] = X86_OP_REX_W | (idxGstTmpReg >= 8 ? X86_OP_REX_B : 0); … … 8351 8458 if (uSubtrahend == 1) 8352 8459 { 8353 /* dec */ 8354 pbCodeBuf[off++] = 0xff; 8460 pbCodeBuf[off++] = 0xff; /* dec */ 8355 8461 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 1, idxGstTmpReg & 7); 8356 8462 }
Note:
See TracChangeset
for help on using the changeset viewer.