VirtualBox

Ignore:
Timestamp:
Jul 28, 2023 10:22:22 PM (17 months ago)
Author:
vboxsync
Message:

VMM/IEM: More on recompiling branch instruction. bugref:10369

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r100695 r100731  
    8181 * Linux, but it should be quite a bit faster for normal code.
    8282 */
    83 #if (defined(IEM_WITH_SETJMP) && defined(IN_RING3) && (defined(__GNUC__) || defined(_MSC_VER))) \
     83#if (defined(__cplusplus) && defined(IEM_WITH_SETJMP) && defined(IN_RING3) && (defined(__GNUC__) || defined(_MSC_VER))) \
    8484 || defined(DOXYGEN_RUNNING)
    8585# define IEM_WITH_THROW_CATCH
     
    843843typedef IEMTB const *PCIEMTB;
    844844
     845/** @name IEMBRANCHED_F_XXX - Branched indicator (IEMCPU::fTbBranched).
     846 *
     847 * These flags parallels IEM_CIMPL_F_BRANCH_XXX.
     848 *
     849 * @{ */
     850/** Value if no branching happened recently. */
     851#define IEMBRANCHED_F_NO            UINT8_C(0x00)
     852/** Flag set if direct branch, clear if absolute or indirect. */
     853#define IEMBRANCHED_F_DIRECT        UINT8_C(0x01)
     854/** Flag set if indirect branch, clear if direct or relative. */
     855#define IEMBRANCHED_F_INDIRECT      UINT8_C(0x02)
     856/** Flag set if relative branch, clear if absolute or indirect. */
     857#define IEMBRANCHED_F_RELATIVE      UINT8_C(0x04)
     858/** Flag set if conditional branch, clear if unconditional. */
     859#define IEMBRANCHED_F_CONDITIONAL   UINT8_C(0x08)
     860/** Flag set if it's a far branch. */
     861#define IEMBRANCHED_F_FAR           UINT8_C(0x10)
     862/** Flag set (by IEM_MC_REL_JMP_XXX) if it's a zero bytes relative jump. */
     863#define IEMBRANCHED_F_ZERO          UINT8_C(0x20)
     864/** @} */
     865
    845866
    846867/**
     
    11391160     * This is set by a previous instruction if it modified memory or similar.  */
    11401161    bool                    fTbCheckOpcodes;
    1141     /** Whether we just branched and need to start a new opcode range and emit code
    1142      * to do a TLB load and check them again. */
    1143     bool                    fTbBranched;
     1162    /** Indicates whether and how we just branched - IEMBRANCHED_F_XXX. */
     1163    uint8_t                 fTbBranched;
    11441164    /** Set when GCPhysInstrBuf is updated because of a page crossing. */
    11451165    bool                    fTbCrossedPage;
     
    11481168    /** Spaced reserved for recompiler data / alignment. */
    11491169    bool                    afRecompilerStuff1[4];
     1170    /** Previous GCPhysInstrBuf value - only valid if fTbCrossedPage is set.   */
     1171    RTGCPHYS                GCPhysInstrBufPrev;
     1172    /** Copy of IEMCPU::GCPhysInstrBuf after decoding a branch instruction.
     1173     * This is used together with fTbBranched and GCVirtTbBranchSrcBuf to determin
     1174     * whether a branch instruction jumps to a new page or stays within the
     1175     * current one. */
     1176    RTGCPHYS                GCPhysTbBranchSrcBuf;
     1177    /** Copy of IEMCPU::uInstrBufPc after decoding a branch instruction.  */
     1178    uint64_t                GCVirtTbBranchSrcBuf;
     1179    /* Alignment. */
     1180    uint64_t                au64RecompilerStuff2[5];
    11501181    /** Threaded TB statistics: Number of instructions per TB. */
    11511182    STAMPROFILE             StatTbThreadedInstr;
     
    43864417
    43874418/**
    4388  * Macro for calling iemCImplRaiseInvalidOpcode().
    4389  *
    4390  * This enables us to add/remove arguments and force different levels of
    4391  * inlining as we wish.
     4419 * Macro for calling iemCImplRaiseInvalidOpcode() for decode/static \#UDs.
     4420 *
     4421 * This is for things that will _always_ decode to an \#UD, taking the
     4422 * recompiler into consideration and everything.
    43924423 *
    43934424 * @return  Strict VBox status code.
    43944425 */
    43954426#define IEMOP_RAISE_INVALID_OPCODE_RET()    IEM_MC_DEFER_TO_CIMPL_0_RET(IEM_CIMPL_F_XCPT, iemCImplRaiseInvalidOpcode)
     4427
     4428/**
     4429 * Macro for calling iemCImplRaiseInvalidOpcode() for runtime-style \#UDs.
     4430 *
     4431 * Using this macro means you've got _buggy_ _code_ and are doing things that
     4432 * belongs exclusively in IEMAllCImpl.cpp during decoding.
     4433 *
     4434 * @return  Strict VBox status code.
     4435 * @see     IEMOP_RAISE_INVALID_OPCODE_RET
     4436 */
     4437#define IEMOP_RAISE_INVALID_OPCODE_RUNTIME_RET()   IEM_MC_DEFER_TO_CIMPL_0_RET(IEM_CIMPL_F_XCPT, iemCImplRaiseInvalidOpcode)
     4438
    43964439/** @} */
    43974440
     
    48994942
    49004943void            iemThreadedTbObsolete(PVMCPUCC pVCpu, PIEMTB pTb);
     4944
    49014945IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckMode,
    49024946                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    49034947IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLim,
    49044948                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
     4949
    49054950IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndOpcodes,
    4906                     (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    4907 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndOpcodesAcrossPageLoadingTlb,
    4908                     (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    4909 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndOpcodesLoadingTlb,
    4910                     (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    4911 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndOpcodesOnNextPageLoadingTlb,
    49124951                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    49134952IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckOpcodes,
    49144953                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    4915 IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckOpcodesAcrossPageLoadingTlb,
     4954
     4955/* Branching: */
     4956IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndPcAndOpcodes,
     4957                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
     4958IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckPcAndOpcodes,
     4959                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
     4960
     4961IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndOpcodesLoadingTlb,
    49164962                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    49174963IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckOpcodesLoadingTlb,
    49184964                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
     4965
     4966/* Natural page crossing: */
     4967IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndOpcodesAcrossPageLoadingTlb,
     4968                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
     4969IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckOpcodesAcrossPageLoadingTlb,
     4970                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
     4971
     4972IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndOpcodesOnNextPageLoadingTlb,
     4973                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    49194974IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckOpcodesOnNextPageLoadingTlb,
    49204975                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
    49214976
     4977IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckCsLimAndOpcodesOnNewPageLoadingTlb,
     4978                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
     4979IEM_DECL_IMPL_PROTO(VBOXSTRICTRC, iemThreadedFunc_BltIn_CheckOpcodesOnNewPageLoadingTlb,
     4980                    (PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2));
     4981
     4982
    49224983
    49234984extern const PFNIEMOP g_apfnIemInterpretOnlyOneByteMap[256];
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette