VirtualBox

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


Ignore:
Timestamp:
Sep 29, 2024 1:14:19 AM (2 months ago)
Author:
vboxsync
Message:

VMM/IEM: Reworked the div, idiv, mul and imul assembly workers and how we raise division error exceptions. The latter is to simplify eflags management. bugref:10720

Location:
trunk/src/VBox/VMM/include
Files:
2 edited

Legend:

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

    r106125 r106179  
    23662366    /** Native recompiler: Number of times status flags calc has been skipped. */
    23672367    STAMCOUNTER             StatNativeEflSkippedArithmetic;
     2368    /** Native recompiler: Number of times status flags calc has been postponed. */
     2369    STAMCOUNTER             StatNativeEflPostponedArithmetic;
    23682370    /** Native recompiler: Total number instructions in this category. */
    23692371    STAMCOUNTER             StatNativeEflTotalArithmetic;
     
    23712373    /** Native recompiler: Number of times status flags calc has been skipped. */
    23722374    STAMCOUNTER             StatNativeEflSkippedLogical;
     2375    /** Native recompiler: Number of times status flags calc has been postponed. */
     2376    STAMCOUNTER             StatNativeEflPostponedLogical;
    23732377    /** Native recompiler: Total number instructions in this category. */
    23742378    STAMCOUNTER             StatNativeEflTotalLogical;
     
    23762380    /** Native recompiler: Number of times status flags calc has been skipped. */
    23772381    STAMCOUNTER             StatNativeEflSkippedShift;
     2382    /** Native recompiler: Number of times status flags calc has been postponed. */
     2383    STAMCOUNTER             StatNativeEflPostponedShift;
    23782384    /** Native recompiler: Total number instructions in this category. */
    23792385    STAMCOUNTER             StatNativeEflTotalShift;
     
    25502556
    25512557#ifdef IEM_WITH_TLB_TRACE
    2552     //uint64_t                au64Padding[0];
     2558    uint64_t                au64Padding[5];
    25532559#else
    2554     uint64_t                au64Padding[2];
     2560    uint64_t                au64Padding[7];
    25552561#endif
    25562562
     
    35383544/** @name Multiplication and division operations.
    35393545 * @{ */
    3540 typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU8,(uint16_t *pu16AX, uint8_t u8FactorDivisor, uint32_t *pEFlags));
     3546typedef IEM_DECL_IMPL_TYPE(uint32_t, FNIEMAIMPLMULDIVU8,(uint16_t *pu16AX, uint8_t u8FactorDivisor, uint32_t fEFlags));
    35413547typedef FNIEMAIMPLMULDIVU8  *PFNIEMAIMPLMULDIVU8;
    35423548FNIEMAIMPLMULDIVU8 iemAImpl_mul_u8,  iemAImpl_mul_u8_amd,  iemAImpl_mul_u8_intel;
     
    35453551FNIEMAIMPLMULDIVU8 iemAImpl_idiv_u8, iemAImpl_idiv_u8_amd, iemAImpl_idiv_u8_intel;
    35463552
    3547 typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU16,(uint16_t *pu16AX, uint16_t *pu16DX, uint16_t u16FactorDivisor, uint32_t *pEFlags));
     3553typedef IEM_DECL_IMPL_TYPE(uint32_t, FNIEMAIMPLMULDIVU16,(uint16_t *pu16AX, uint16_t *pu16DX, uint16_t u16FactorDivisor, uint32_t fEFlags));
    35483554typedef FNIEMAIMPLMULDIVU16  *PFNIEMAIMPLMULDIVU16;
    35493555FNIEMAIMPLMULDIVU16 iemAImpl_mul_u16,  iemAImpl_mul_u16_amd,  iemAImpl_mul_u16_intel;
     
    35523558FNIEMAIMPLMULDIVU16 iemAImpl_idiv_u16, iemAImpl_idiv_u16_amd, iemAImpl_idiv_u16_intel;
    35533559
    3554 typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU32,(uint32_t *pu32EAX, uint32_t *pu32EDX, uint32_t u32FactorDivisor, uint32_t *pEFlags));
     3560typedef IEM_DECL_IMPL_TYPE(uint32_t, FNIEMAIMPLMULDIVU32,(uint32_t *pu32EAX, uint32_t *pu32EDX, uint32_t u32FactorDivisor, uint32_t fEFlags));
    35553561typedef FNIEMAIMPLMULDIVU32  *PFNIEMAIMPLMULDIVU32;
    35563562FNIEMAIMPLMULDIVU32 iemAImpl_mul_u32,  iemAImpl_mul_u32_amd,  iemAImpl_mul_u32_intel;
     
    35593565FNIEMAIMPLMULDIVU32 iemAImpl_idiv_u32, iemAImpl_idiv_u32_amd, iemAImpl_idiv_u32_intel;
    35603566
    3561 typedef IEM_DECL_IMPL_TYPE(int, FNIEMAIMPLMULDIVU64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64FactorDivisor, uint32_t *pEFlags));
     3567typedef IEM_DECL_IMPL_TYPE(uint32_t, FNIEMAIMPLMULDIVU64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64FactorDivisor, uint32_t fEFlags));
    35623568typedef FNIEMAIMPLMULDIVU64  *PFNIEMAIMPLMULDIVU64;
    35633569FNIEMAIMPLMULDIVU64 iemAImpl_mul_u64,  iemAImpl_mul_u64_amd,  iemAImpl_mul_u64_intel;
  • trunk/src/VBox/VMM/include/IEMMc.h

    r106097 r106179  
    109109
    110110
    111 #define IEM_MC_RAISE_DIVIDE_ERROR()                     return iemRaiseDivideError(pVCpu)
     111#define IEM_MC_RAISE_DIVIDE_ERROR_IF_LOCAL_IS_ZERO(a_uVar) \
     112    do { \
     113        if (RT_LIKELY((a_uVar) != 0)) \
     114        { /* probable */ } \
     115        else return iemRaiseDivideError(pVCpu); \
     116    } while (0)
    112117#define IEM_MC_MAYBE_RAISE_DEVICE_NOT_AVAILABLE()       \
    113118    do { \
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