Changeset 101523 in vbox for trunk/src/VBox/VMM/include
- Timestamp:
- Oct 20, 2023 2:46:13 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
r101518 r101523 574 574 DECLHIDDEN(uint32_t) iemNativeRegFlushPendingWrites(PIEMRECOMPILERSTATE pReNative, uint32_t off) RT_NOEXCEPT; 575 575 576 DECLHIDDEN(uint32_t) iemNativeEmitLoadGprWithGstShadowReg(PIEMRECOMPILERSTATE pReNative, uint32_t off, 577 uint8_t idxHstReg, IEMNATIVEGSTREG enmGstReg) RT_NOEXCEPT; 576 578 DECLHIDDEN(uint32_t) iemNativeEmitCheckCallRetAndPassUp(PIEMRECOMPILERSTATE pReNative, uint32_t off, 577 579 uint8_t idxInstr) RT_NOEXCEPT; … … 1645 1647 1646 1648 /** 1647 * Emits a JMP rel32 / B imm19 to the given label (ASSUMED requiring fixup).1649 * Emits a JMP rel32 / B imm19 to the given label. 1648 1650 */ 1649 1651 DECLINLINE(uint32_t) iemNativeEmitJmpToLabel(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t idxLabel) 1650 1652 { 1651 #ifdef RT_ARCH_AMD64 1652 /* jnz rel32 */ 1653 uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5); 1654 AssertReturn(pbCodeBuf, UINT32_MAX); 1655 pbCodeBuf[off++] = 0xe9; 1656 AssertReturn(iemNativeAddFixup(pReNative, off, idxLabel, kIemNativeFixupType_Rel32, -4), UINT32_MAX); 1657 pbCodeBuf[off++] = 0xfe; 1658 pbCodeBuf[off++] = 0xff; 1659 pbCodeBuf[off++] = 0xff; 1660 pbCodeBuf[off++] = 0xff; 1653 Assert(idxLabel < pReNative->cLabels); 1654 1655 #ifdef RT_ARCH_AMD64 1656 uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 6); 1657 AssertReturn(pbCodeBuf, UINT32_MAX); 1658 if (pReNative->paLabels[idxLabel].off != UINT32_MAX) 1659 { 1660 uint32_t offRel = pReNative->paLabels[idxLabel].off - (off + 2); 1661 if ((int32_t)offRel < 128 && (int32_t)offRel >= -128) 1662 { 1663 pbCodeBuf[off++] = 0xeb; /* jmp rel8 */ 1664 pbCodeBuf[off++] = (uint8_t)offRel; 1665 off++; 1666 } 1667 else 1668 { 1669 offRel -= 3; 1670 pbCodeBuf[off++] = 0xe9; /* jmp rel32 */ 1671 pbCodeBuf[off++] = RT_BYTE1(offRel); 1672 pbCodeBuf[off++] = RT_BYTE2(offRel); 1673 pbCodeBuf[off++] = RT_BYTE3(offRel); 1674 pbCodeBuf[off++] = RT_BYTE4(offRel); 1675 } 1676 } 1677 else 1678 { 1679 pbCodeBuf[off++] = 0xe9; /* jmp rel32 */ 1680 AssertReturn(iemNativeAddFixup(pReNative, off, idxLabel, kIemNativeFixupType_Rel32, -4), UINT32_MAX); 1681 pbCodeBuf[off++] = 0xfe; 1682 pbCodeBuf[off++] = 0xff; 1683 pbCodeBuf[off++] = 0xff; 1684 pbCodeBuf[off++] = 0xff; 1685 } 1686 pbCodeBuf[off++] = 0xcc; /* int3 poison */ 1661 1687 1662 1688 #elif defined(RT_ARCH_ARM64) 1663 1689 uint32_t *pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1); 1664 1690 AssertReturn(pu32CodeBuf, UINT32_MAX); 1665 AssertReturn(iemNativeAddFixup(pReNative, off, idxLabel, kIemNativeFixupType_RelImm19At5), UINT32_MAX); 1666 pu32CodeBuf[off++] = Armv8A64MkInstrB(-1); 1691 if (pReNative->paLabels[idxLabel].off != UINT32_MAX) 1692 pu32CodeBuf[off++] = Armv8A64MkInstrB(pReNative->paLabels[idxReturnLabel].off - off); 1693 else 1694 { 1695 AssertReturn(iemNativeAddFixup(pReNative, off, idxLabel, kIemNativeFixupType_RelImm19At5), UINT32_MAX); 1696 pu32CodeBuf[off++] = Armv8A64MkInstrB(-1); 1697 } 1667 1698 1668 1699 #else … … 1700 1731 uint32_t idxLabel, IEMNATIVEINSTRCOND enmCond) 1701 1732 { 1733 Assert(idxLabel < pReNative->cLabels); 1734 1702 1735 #ifdef RT_ARCH_AMD64 1703 1736 /* jcc rel32 */ … … 1937 1970 1938 1971 1972 /** 1973 * Emits a call to a 64-bit address. 1974 */ 1975 DECLINLINE(uint32_t) iemNativeEmitCallImm(PIEMRECOMPILERSTATE pReNative, uint32_t off, uintptr_t uPfn) 1976 { 1977 #ifdef RT_ARCH_AMD64 1978 off = iemNativeEmitLoadGprImm64(pReNative, off, X86_GREG_xAX, uPfn); 1979 1980 /* call rax */ 1981 uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 2); 1982 AssertReturn(pbCodeBuf, UINT32_MAX); 1983 pbCodeBuf[off++] = 0xff; 1984 pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, 2, X86_GREG_xAX); 1985 1986 #elif defined(RT_ARCH_ARM64) 1987 off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_REG_FIXED_TMP0, uPfn); 1988 1989 uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1); 1990 AssertReturn(pu32CodeBuf, UINT32_MAX); 1991 pu32CodeBuf[off++] = Armv8A64MkInstrBlr(IEMNATIVE_REG_FIXED_TMP0); 1992 #else 1993 # error "port me" 1994 #endif 1995 return off; 1996 } 1997 1998 1939 1999 1940 2000 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.