VirtualBox

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


Ignore:
Timestamp:
Jul 19, 2011 5:15:29 PM (14 years ago)
Author:
vboxsync
Message:

IEM: Implemented LAHF/SAHF.

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

Legend:

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

    r38074 r38077  
    46304630#define IEM_MC_FETCH_CR0_U64(a_u64Dst)                  (a_u64Dst) = (pIemCpu)->CTX_SUFF(pCtx)->cr0
    46314631#define IEM_MC_FETCH_EFLAGS(a_EFlags)                   (a_EFlags) = (pIemCpu)->CTX_SUFF(pCtx)->eflags.u
     4632#define IEM_MC_FETCH_EFLAGS_U8(a_EFlags)                (a_EFlags) = (uint8_t)(pIemCpu)->CTX_SUFF(pCtx)->eflags.u
    46324633#define IEM_MC_FETCH_FSW(a_u16Fsw)                      (a_u16Fsw) = iemFRegFetchFsw(pIemCpu)
    46334634
     
    46784679#define IEM_MC_ADD_LOCAL_S64_TO_EFF_ADDR(a_EffAddr, a_i64) do { (a_EffAddr) += (a_i64); } while (0)
    46794680
     4681#define IEM_MC_AND_LOCAL_U8(a_u8Local, a_u8Mask)        do { (a_u8Local)  &= (a_u8Mask);  } while (0)
    46804682#define IEM_MC_AND_LOCAL_U16(a_u16Local, a_u16Mask)     do { (a_u16Local) &= (a_u16Mask); } while (0)
    46814683#define IEM_MC_AND_LOCAL_U32(a_u32Local, a_u32Mask)     do { (a_u32Local) &= (a_u32Mask); } while (0)
     
    46864688#define IEM_MC_AND_ARG_U64(a_u64Arg, a_u64Mask)         do { (a_u64Arg) &= (a_u64Mask); } while (0)
    46874689
     4690#define IEM_MC_OR_LOCAL_U8(a_u8Local, a_u8Mask)         do { (a_u8Local)  |= (a_u8Mask);  } while (0)
     4691#define IEM_MC_OR_LOCAL_U32(a_u32Local, a_u32Mask)      do { (a_u32Local) |= (a_u32Mask); } while (0)
     4692
    46884693#define IEM_MC_SAR_LOCAL_S16(a_i16Local, a_cShift)      do { (a_i16Local) >>= (a_cShift);  } while (0)
    46894694#define IEM_MC_SAR_LOCAL_S32(a_i32Local, a_cShift)      do { (a_i32Local) >>= (a_cShift);  } while (0)
     
    46934698#define IEM_MC_SHL_LOCAL_S32(a_i32Local, a_cShift)      do { (a_i32Local) <<= (a_cShift);  } while (0)
    46944699#define IEM_MC_SHL_LOCAL_S64(a_i64Local, a_cShift)      do { (a_i64Local) <<= (a_cShift);  } while (0)
     4700
     4701#define IEM_MC_AND_2LOCS_U32(a_u32Local, a_u32Mask)     do { (a_u32Local) &= (a_u32Mask); } while (0)
     4702
     4703#define IEM_MC_OR_2LOCS_U32(a_u32Local, a_u32Mask)      do { (a_u32Local) |= (a_u32Mask); } while (0)
    46954704
    46964705#define IEM_MC_AND_GREG_U8(a_iGReg, a_u8Value)          *(uint8_t  *)iemGRegRef(pIemCpu, (a_iGReg)) &= (a_u8Value)
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h

    r38074 r38077  
    78187818
    78197819/** Opcode 0x9e. */
    7820 FNIEMOP_STUB(iemOp_sahf);
     7820FNIEMOP_DEF(iemOp_sahf)
     7821{
     7822    IEMOP_MNEMONIC("sahf");
     7823    IEMOP_HLP_NO_LOCK_PREFIX();
     7824    IEMOP_HLP_NO_64BIT();
     7825    IEM_MC_BEGIN(0, 2);
     7826    IEM_MC_LOCAL(uint32_t, u32Flags);
     7827    IEM_MC_LOCAL(uint32_t, EFlags);
     7828    IEM_MC_FETCH_EFLAGS(EFlags);
     7829    IEM_MC_FETCH_GREG_U8_ZX_U32(u32Flags, X86_GREG_xSP/*=AH*/);
     7830    IEM_MC_AND_LOCAL_U32(u32Flags, UINT32_C(0xd7));
     7831    IEM_MC_AND_LOCAL_U32(EFlags, UINT32_C(0xffffff00));
     7832    IEM_MC_OR_LOCAL_U32(u32Flags, UINT32_C(0x00000002));
     7833    IEM_MC_OR_2LOCS_U32(EFlags, u32Flags);
     7834    IEM_MC_COMMIT_EFLAGS(EFlags);
     7835    IEM_MC_ADVANCE_RIP();
     7836    IEM_MC_END();
     7837    return VINF_SUCCESS;
     7838}
     7839
     7840
    78217841/** Opcode 0x9f. */
    7822 FNIEMOP_STUB(iemOp_lahf);
     7842FNIEMOP_DEF(iemOp_lahf)
     7843{
     7844    IEMOP_MNEMONIC("lahf");
     7845    IEMOP_HLP_NO_LOCK_PREFIX();
     7846    IEMOP_HLP_NO_64BIT();
     7847    IEM_MC_BEGIN(0, 1);
     7848    IEM_MC_LOCAL(uint8_t, u8Flags);
     7849    IEM_MC_FETCH_EFLAGS_U8(u8Flags);
     7850    IEM_MC_STORE_GREG_U8(X86_GREG_xSP/*=AH*/, u8Flags);
     7851    IEM_MC_ADVANCE_RIP();
     7852    IEM_MC_END();
     7853    return VINF_SUCCESS;
     7854}
     7855
    78237856
    78247857/**
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