VirtualBox

Changeset 99930 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
May 23, 2023 9:53:04 AM (21 months ago)
Author:
vboxsync
Message:

VMM/IEM: More recompiler work. bugref:10369

File:
1 edited

Legend:

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

    r99832 r99930  
    957957# define IEM_GET_INSTR_LEN(a_pVCpu)     ((a_pVCpu)->iem.s.offOpcode)
    958958#endif
     959
     960/** @def IEM_TRY_SETJMP
     961 * Wrapper around setjmp / try, hiding all the ugly differences.
     962 *
     963 * @note Use with extreme care as this is a fragile macro.
     964 * @param   a_pVCpu     The cross context virtual CPU structure of the calling EMT.
     965 * @param   a_rcTarget  The variable that should receive the status code in case
     966 *                      of a longjmp/throw.
     967 */
     968/** @def IEM_TRY_SETJMP_AGAIN
     969 * For when setjmp / try is used again in the same variable scope as a previous
     970 * IEM_TRY_SETJMP invocation.
     971 */
     972/** @def IEM_CATCH_LONGJMP_BEGIN
     973 * Start wrapper for catch / setjmp-else.
     974 *
     975 * This will set up a scope.
     976 *
     977 * @note Use with extreme care as this is a fragile macro.
     978 * @param   a_pVCpu     The cross context virtual CPU structure of the calling EMT.
     979 * @param   a_rcTarget  The variable that should receive the status code in case
     980 *                      of a longjmp/throw.
     981 */
     982/** @def IEM_CATCH_LONGJMP_END
     983 * End wrapper for catch / setjmp-else.
     984 *
     985 * This will close the scope set up by IEM_CATCH_LONGJMP_BEGIN and clean up the
     986 * state.
     987 *
     988 * @note Use with extreme care as this is a fragile macro.
     989 * @param   a_pVCpu     The cross context virtual CPU structure of the calling EMT.
     990 */
     991#if defined(IEM_WITH_SETJMP) || defined(DOXYGEN_RUNNING)
     992# ifdef IEM_WITH_THROW_CATCH
     993#  define IEM_TRY_SETJMP(a_pVCpu, a_rcTarget) \
     994        a_rcTarget = VINF_SUCCESS; \
     995        try
     996#  define IEM_TRY_SETJMP_AGAIN(a_pVCpu, a_rcTarget) \
     997        IEM_TRY_SETJMP(a_pVCpu, a_rcTarget)
     998#  define IEM_CATCH_LONGJMP_BEGIN(a_pVCpu, a_rcTarget) \
     999        catch (int rcThrown) \
     1000        { \
     1001            a_rcTarget = rcThrown
     1002#  define IEM_CATCH_LONGJMP_END(a_pVCpu) \
     1003        } \
     1004        ((void)0)
     1005# else  /* !IEM_WITH_THROW_CATCH */
     1006#  define IEM_TRY_SETJMP(a_pVCpu, a_rcTarget) \
     1007        jmp_buf  JmpBuf; \
     1008        jmp_buf * volatile pSavedJmpBuf = pVCpu->iem.s.CTX_SUFF(pJmpBuf); \
     1009        pVCpu->iem.s.CTX_SUFF(pJmpBuf) = &JmpBuf; \
     1010        if ((rcStrict = setjmp(JmpBuf)) == 0)
     1011#  define IEM_TRY_SETJMP_AGAIN(a_pVCpu, a_rcTarget) \
     1012        pSavedJmpBuf = pVCpu->iem.s.CTX_SUFF(pJmpBuf); \
     1013        pVCpu->iem.s.CTX_SUFF(pJmpBuf) = &JmpBuf; \
     1014        if ((rcStrict = setjmp(JmpBuf)) == 0)
     1015#  define IEM_CATCH_LONGJMP_BEGIN(a_pVCpu, a_rcTarget) \
     1016        else \
     1017        { \
     1018            ((void)0)
     1019#  define IEM_CATCH_LONGJMP_END(a_pVCpu) \
     1020        } \
     1021        (a_pVCpu)->iem.s.CTX_SUFF(pJmpBuf) = pSavedJmpBuf
     1022# endif /* !IEM_WITH_THROW_CATCH */
     1023#endif  /* IEM_WITH_SETJMP */
    9591024
    9601025
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