VirtualBox

Changeset 48170 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Aug 29, 2013 7:12:35 PM (11 years ago)
Author:
vboxsync
Message:

IEM: Implemented 64-bit inc, dec, not and neg for 32-bit hosts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllAImplC.cpp

    r48159 r48170  
    756756/* Unary operands. */
    757757
    758 IEM_DECL_IMPL_DEF(void, iemAImpl_inc_u64,(uint64_t  *puDst,  uint32_t *pEFlags))
    759 {
    760     AssertFailed();
    761 }
    762 
    763 
    764 IEM_DECL_IMPL_DEF(void, iemAImpl_dec_u64,(uint64_t  *puDst,  uint32_t *pEFlags))
    765 {
    766     AssertFailed();
    767 }
    768 
    769 
    770 IEM_DECL_IMPL_DEF(void, iemAImpl_not_u64,(uint64_t  *puDst,  uint32_t *pEFlags))
    771 {
    772     AssertFailed();
    773 }
    774 
    775 
    776 IEM_DECL_IMPL_DEF(void, iemAImpl_neg_u64,(uint64_t  *puDst,  uint32_t *pEFlags))
    777 {
    778     AssertFailed();
     758IEM_DECL_IMPL_DEF(void, iemAImpl_inc_u64,(uint64_t  *puDst,  uint32_t *pfEFlags))
     759{
     760    uint64_t uDst    = *puDst;
     761    uint64_t uResult = uDst + 1;
     762    *puDst = uResult;
     763
     764    /*
     765     * Calc EFLAGS.
     766     * CF is NOT modified for hysterical raisins (allegedly for carrying and
     767     * borrowing in arithmetic loops on intel 8008).
     768     */
     769    uint32_t fEfl = *pfEFlags & ~(X86_EFL_STATUS_BITS & ~X86_EFL_CF);
     770    fEfl |= g_afParity[uResult & 0xff];
     771    fEfl |= ((uint32_t)uResult ^ (uint32_t)uDst) & X86_EFL_AF;
     772    fEfl |= X86_EFL_CALC_ZF(uResult);
     773    fEfl |= X86_EFL_CALC_SF(uResult, 64);
     774    fEfl |= (((uDst ^ RT_BIT_64(63)) & uResult) >> (64 - X86_EFL_OF_BIT)) & X86_EFL_OF;
     775    *pfEFlags = fEfl;
     776}
     777
     778
     779IEM_DECL_IMPL_DEF(void, iemAImpl_dec_u64,(uint64_t  *puDst,  uint32_t *pfEFlags))
     780{
     781    uint64_t uDst    = *puDst;
     782    uint64_t uResult = uDst - 1;
     783    *puDst = uResult;
     784
     785    /*
     786     * Calc EFLAGS.
     787     * CF is NOT modified for hysterical raisins (allegedly for carrying and
     788     * borrowing in arithmetic loops on intel 8008).
     789     */
     790    uint32_t fEfl = *pfEFlags & ~(X86_EFL_STATUS_BITS & ~X86_EFL_CF);
     791    fEfl |= g_afParity[uResult & 0xff];
     792    fEfl |= ((uint32_t)uResult ^ (uint32_t)uDst) & X86_EFL_AF;
     793    fEfl |= X86_EFL_CALC_ZF(uResult);
     794    fEfl |= X86_EFL_CALC_SF(uResult, 64);
     795    fEfl |= ((uDst & (uResult ^ RT_BIT_64(63))) >> (64 - X86_EFL_OF_BIT)) & X86_EFL_OF;
     796    *pfEFlags = fEfl;
     797}
     798
     799
     800IEM_DECL_IMPL_DEF(void, iemAImpl_not_u64,(uint64_t  *puDst,  uint32_t *pfEFlags))
     801{
     802    uint64_t uDst    = *puDst;
     803    uint64_t uResult = ~uDst;
     804    *puDst = uResult;
     805    /* EFLAGS are not modified. */
     806}
     807
     808
     809IEM_DECL_IMPL_DEF(void, iemAImpl_neg_u64,(uint64_t  *puDst,  uint32_t *pfEFlags))
     810{
     811    uint64_t uDst    = 0;
     812    uint64_t uSrc    = *puDst;
     813    uint64_t uResult = uDst - uSrc;
     814    *puDst = uResult;
     815
     816    /* Calc EFLAGS. */
     817    uint32_t fEfl = *pfEFlags & ~X86_EFL_STATUS_BITS;
     818    fEfl |= (uSrc != 0) << X86_EFL_CF_BIT;
     819    fEfl |= g_afParity[uResult & 0xff];
     820    fEfl |= ((uint32_t)uResult ^ (uint32_t)uDst) & X86_EFL_AF;
     821    fEfl |= X86_EFL_CALC_ZF(uResult);
     822    fEfl |= X86_EFL_CALC_SF(uResult, 64);
     823    fEfl |= ((uSrc & uResult) >> (64 - X86_EFL_OF_BIT)) & X86_EFL_OF;
     824    *pfEFlags = fEfl;
    779825}
    780826
     
    949995
    950996
    951 IEM_DECL_IMPL_DEF(void, iemAImpl_arpl,(uint16_t *pu16Dst, uint16_t u16Src, uint32_t *pEFlags))
     997IEM_DECL_IMPL_DEF(void, iemAImpl_arpl,(uint16_t *pu16Dst, uint16_t u16Src, uint32_t *pfEFlags))
    952998{
    953999    if ((*pu16Dst & X86_SEL_RPL) < (u16Src & X86_SEL_RPL))
     
    9561002        *pu16Dst |= u16Src & X86_SEL_RPL;
    9571003
    958         *pEFlags |= X86_EFL_ZF;
     1004        *pfEFlags |= X86_EFL_ZF;
    9591005    }
    9601006    else
    961         *pEFlags &= ~X86_EFL_ZF;
    962 }
    963 
     1007        *pfEFlags &= ~X86_EFL_ZF;
     1008}
     1009
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