VirtualBox

Changeset 62076 in vbox for trunk


Ignore:
Timestamp:
Jul 6, 2016 4:37:04 PM (9 years ago)
Author:
vboxsync
Message:

IEM: Make use of the direct CPUMCTX access (VMCPU_INCL_CPUM_GST_CTX).

Location:
trunk/src/VBox/VMM
Files:
5 edited

Legend:

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

    r62027 r62076  
    8383#define IEM_IMPLEMENTS_TASKSWITCH
    8484
     85
    8586/*********************************************************************************************************************************
    8687*   Header Files                                                                                                                 *
    8788*********************************************************************************************************************************/
    8889#define LOG_GROUP   LOG_GROUP_IEM
     90#define VMCPU_INCL_CPUM_GST_CTX
    8991#include <VBox/vmm/iem.h>
    9092#include <VBox/vmm/cpum.h>
     
    292294 * @param   a_pVCpu         The IEM state of the current CPU.
    293295 */
    294 #define IEM_IS_REAL_OR_V86_MODE(a_pVCpu)    (CPUMIsGuestInRealOrV86ModeEx((a_pVCpu)->iem.s.CTX_SUFF(pCtx)))
     296#define IEM_IS_REAL_OR_V86_MODE(a_pVCpu)    (CPUMIsGuestInRealOrV86ModeEx(IEM_GET_CTX(a_pVCpu)))
    295297
    296298/**
     
    298300 *
    299301 * @returns @c true if it is, @c false if not.
    300  * @param   a_pVCpu         The IEM state of the current CPU.
    301  */
    302 #define IEM_IS_V86_MODE(a_pVCpu)            (CPUMIsGuestInV86ModeEx((a_pVCpu)->iem.s.CTX_SUFF(pCtx)))
     302 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
     303 */
     304#define IEM_IS_V86_MODE(a_pVCpu)            (CPUMIsGuestInV86ModeEx(IEM_GET_CTX(a_pVCpu)))
    303305
    304306/**
     
    306308 *
    307309 * @returns @c true if it is, @c false if not.
    308  * @param   a_pVCpu         The IEM state of the current CPU.
    309  */
    310 #define IEM_IS_LONG_MODE(a_pVCpu)           (CPUMIsGuestInLongModeEx((a_pVCpu)->iem.s.CTX_SUFF(pCtx)))
     310 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
     311 */
     312#define IEM_IS_LONG_MODE(a_pVCpu)           (CPUMIsGuestInLongModeEx(IEM_GET_CTX(a_pVCpu)))
    311313
    312314/**
     
    314316 *
    315317 * @returns @c true if it is, @c false if not.
    316  * @param   a_pVCpu         The IEM state of the current CPU.
    317  */
    318 #define IEM_IS_REAL_MODE(a_pVCpu)           (CPUMIsGuestInRealModeEx((a_pVCpu)->iem.s.CTX_SUFF(pCtx)))
     318 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
     319 */
     320#define IEM_IS_REAL_MODE(a_pVCpu)           (CPUMIsGuestInRealModeEx(IEM_GET_CTX(a_pVCpu)))
    319321
    320322/**
    321323 * Returns a (const) pointer to the CPUMFEATURES for the guest CPU.
    322324 * @returns PCCPUMFEATURES
    323  * @param   a_pVCpu         The IEM state of the current CPU.
     325 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
    324326 */
    325327#define IEM_GET_GUEST_CPU_FEATURES(a_pVCpu) (&((a_pVCpu)->CTX_SUFF(pVM)->cpum.ro.GuestFeatures))
     
    328330 * Returns a (const) pointer to the CPUMFEATURES for the host CPU.
    329331 * @returns PCCPUMFEATURES
    330  * @param   a_pVCpu         The IEM state of the current CPU.
     332 * @param   a_pVCpu         The cross context virtual CPU structure of the calling thread.
    331333 */
    332334#define IEM_GET_HOST_CPU_FEATURES(a_pVCpu)  (&((a_pVCpu)->CTX_SUFF(pVM)->cpum.ro.HostFeatures))
     
    821823DECLINLINE(void) iemInitExec(PVMCPU pVCpu, bool fBypassHandlers)
    822824{
    823     PCPUMCTX pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     825    PCPUMCTX const pCtx = IEM_GET_CTX(pVCpu);
    824826
    825827    Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_IEM));
     
    906908DECLINLINE(void) iemInitDecoder(PVMCPU pVCpu, bool fBypassHandlers)
    907909{
    908     PCPUMCTX pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     910    PCPUMCTX const pCtx = IEM_GET_CTX(pVCpu);
    909911
    910912    Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_IEM));
     
    989991DECLINLINE(void) iemReInitDecoder(PVMCPU pVCpu)
    990992{
    991     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     993    PCPUMCTX const pCtx = IEM_GET_CTX(pVCpu);
    992994
    993995    Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_IEM));
     
    10921094     * First translate CS:rIP to a physical address.
    10931095     */
    1094     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     1096    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
    10951097    uint32_t    cbToTryRead;
    10961098    RTGCPTR     GCPtrPC;
     
    12521254     * First translate CS:rIP to a physical address.
    12531255     */
    1254     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     1256    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
    12551257    uint8_t     cbLeft = pVCpu->iem.s.cbOpcode - pVCpu->iem.s.offOpcode; Assert(cbLeft < cbMin);
    12561258    uint32_t    cbToTryRead;
     
    43574359                  uint64_t    uCr2)
    43584360{
    4359     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4361    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    43604362#ifdef IN_RING0
    43614363    int rc = HMR0EnsureCompleteBasicContext(pVCpu, pCtx);
     
    45174519{
    45184520    /** @todo set/clear RF. */
    4519     pVCpu->iem.s.CTX_SUFF(pCtx)->dr[7] &= ~X86_DR7_GD;
     4521    IEM_GET_CTX(pVCpu)->dr[7] &= ~X86_DR7_GD;
    45204522    return iemRaiseXcptOrInt(pVCpu, 0, X86_XCPT_DB, IEM_XCPT_FLAGS_T_CPU_XCPT, 0, 0);
    45214523}
     
    45474549{
    45484550    return iemRaiseXcptOrInt(pVCpu, 0, X86_XCPT_TS, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR,
    4549                              pVCpu->iem.s.CTX_SUFF(pCtx)->tr.Sel, 0);
     4551                             IEM_GET_CTX(pVCpu)->tr.Sel, 0);
    45504552}
    45514553
     
    47214723
    47224724    if (   (fAccess & IEM_ACCESS_WHAT_MASK) == IEM_ACCESS_WHAT_CODE
    4723         && (   (pVCpu->iem.s.CTX_SUFF(pCtx)->cr4 & X86_CR4_PAE)
    4724             && (pVCpu->iem.s.CTX_SUFF(pCtx)->msrEFER & MSR_K6_EFER_NXE) ) )
     4725        && (   (IEM_GET_CTX(pVCpu)->cr4 & X86_CR4_PAE)
     4726            && (IEM_GET_CTX(pVCpu)->msrEFER & MSR_K6_EFER_NXE) ) )
    47254727        uErr |= X86_TRAP_PF_ID;
    47264728
     
    49224924    RTAssertMsg2Weak("%s%s\n", szRegs, szInstr);
    49234925#else
    4924     RTAssertMsg2Weak("cs:rip=%04x:%RX64\n", pVCpu->iem.s.CTX_SUFF(pCtx)->cs, pVCpu->iem.s.CTX_SUFF(pCtx)->rip);
     4926    RTAssertMsg2Weak("cs:rip=%04x:%RX64\n", IEM_GET_CTX(pVCpu)->cs, IEM_GET_CTX(pVCpu)->rip);
    49254927#endif
    49264928}
     
    49964998IEM_STATIC PCPUMSELREG iemSRegGetHid(PVMCPU pVCpu, uint8_t iSegReg)
    49974999{
    4998     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
    4999 
    50005000    Assert(iSegReg < X86_SREG_COUNT);
    5001     AssertCompileAdjacentMembers(CPUMCTX, es, cs);
    5002     AssertCompileAdjacentMembers(CPUMCTX, cs, ss);
    5003     AssertCompileAdjacentMembers(CPUMCTX, ss, ds);
    5004     AssertCompileAdjacentMembers(CPUMCTX, ds, fs);
    5005     AssertCompileAdjacentMembers(CPUMCTX, fs, gs);
    5006     PCPUMSELREG pSReg = &pCtx->es + iSegReg;
     5001    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
     5002    PCPUMSELREG pSReg = &pCtx->aSRegs[iSegReg];
    50075003
    50085004#ifdef VBOX_WITH_RAW_MODE_NOT_R0
     
    50485044IEM_STATIC uint16_t *iemSRegRef(PVMCPU pVCpu, uint8_t iSegReg)
    50495045{
    5050     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5046    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
     5047#if 0
     5048    Assert(iSegReg < X86_SREG_COUNT);
     5049    return &pCtx->aSRegs[iSegReg].Sel;
     5050#else
    50515051    switch (iSegReg)
    50525052    {
     
    50595059    }
    50605060    AssertFailedReturn(NULL);
     5061#endif
    50615062}
    50625063
     
    50715072IEM_STATIC uint16_t iemSRegFetchU16(PVMCPU pVCpu, uint8_t iSegReg)
    50725073{
    5073     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5074    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
     5075#if 0
     5076    Assert(iSegReg < X86_SREG_COUNT);
     5077    return pCtx->aSRegs[iSegReg].Sel;
     5078#else
    50745079    switch (iSegReg)
    50755080    {
     
    50825087    }
    50835088    AssertFailedReturn(0xffff);
     5089#endif
    50845090}
    50855091
     
    50945100IEM_STATIC void *iemGRegRef(PVMCPU pVCpu, uint8_t iReg)
    50955101{
    5096     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5102    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
     5103#if 0
     5104    Assert(iReg < 16);
     5105    return &pCtx->aGRegs[iReg];
     5106#else
    50975107    switch (iReg)
    50985108    {
     
    51155125    }
    51165126    AssertFailedReturn(NULL);
     5127#endif
    51175128}
    51185129
     
    52035214IEM_STATIC VBOXSTRICTRC iemRegRipRelativeJumpS8(PVMCPU pVCpu, int8_t offNextInstr)
    52045215{
    5205     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5216    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    52065217    switch (pVCpu->iem.s.enmEffOpSize)
    52075218    {
     
    52635274IEM_STATIC VBOXSTRICTRC iemRegRipRelativeJumpS16(PVMCPU pVCpu, int16_t offNextInstr)
    52645275{
    5265     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5276    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    52665277    Assert(pVCpu->iem.s.enmEffOpSize == IEMMODE_16BIT);
    52675278
     
    52935304IEM_STATIC VBOXSTRICTRC iemRegRipRelativeJumpS32(PVMCPU pVCpu, int32_t offNextInstr)
    52945305{
    5295     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5306    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    52965307    Assert(pVCpu->iem.s.enmEffOpSize != IEMMODE_16BIT);
    52975308
     
    53345345IEM_STATIC VBOXSTRICTRC iemRegRipJump(PVMCPU pVCpu, uint64_t uNewRip)
    53355346{
    5336     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5347    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    53375348    switch (pVCpu->iem.s.enmEffOpSize)
    53385349    {
     
    54095420IEM_STATIC void iemRegAddToRipKeepRF(PVMCPU pVCpu, uint8_t cbInstr)
    54105421{
    5411     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5422    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    54125423    switch (pVCpu->iem.s.enmCpuMode)
    54135424    {
     
    54535464IEM_STATIC void iemRegAddToRipAndClearRF(PVMCPU pVCpu, uint8_t cbInstr)
    54545465{
    5455     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5466    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    54565467
    54575468    pCtx->eflags.Bits.u1RF = 0;
     
    60256036IEM_STATIC void iemFpuPushResult(PVMCPU pVCpu, PIEMFPURESULT pResult)
    60266037{
    6027     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6038    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    60286039    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    60296040    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    60436054IEM_STATIC void iemFpuPushResultWithMemOp(PVMCPU pVCpu, PIEMFPURESULT pResult, uint8_t iEffSeg, RTGCPTR GCPtrEff)
    60446055{
    6045     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6056    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    60466057    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    60476058    iemFpuUpdateDP(pVCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
     
    60606071IEM_STATIC void iemFpuPushResultTwo(PVMCPU pVCpu, PIEMFPURESULTTWO pResult)
    60616072{
    6062     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6073    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    60636074    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    60646075    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    61156126IEM_STATIC void iemFpuStoreResult(PVMCPU pVCpu, PIEMFPURESULT pResult, uint8_t iStReg)
    61166127{
    6117     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6128    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    61186129    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    61196130    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    61326143IEM_STATIC void iemFpuStoreResultThenPop(PVMCPU pVCpu, PIEMFPURESULT pResult, uint8_t iStReg)
    61336144{
    6134     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6145    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    61356146    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    61366147    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    61536164                                           uint8_t iEffSeg, RTGCPTR GCPtrEff)
    61546165{
    6155     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6166    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    61566167    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    61576168    iemFpuUpdateDP(pVCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
     
    61746185                                                  uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff)
    61756186{
    6176     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6187    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    61776188    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    61786189    iemFpuUpdateDP(pVCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
     
    61906201IEM_STATIC void iemFpuUpdateOpcodeAndIp(PVMCPU pVCpu)
    61916202{
    6192     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6203    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    61936204    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    61946205    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    62056216{
    62066217    Assert(iStReg < 8);
    6207     PX86FXSTATE pFpuCtx = &pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
     6218    PX86FXSTATE pFpuCtx = &IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87;
    62086219    uint8_t     iReg    = (X86_FSW_TOP_GET(pFpuCtx->FSW) + iStReg) & X86_FSW_TOP_SMASK;
    62096220    pFpuCtx->FTW &= ~RT_BIT(iReg);
     
    62186229IEM_STATIC void iemFpuStackIncTop(PVMCPU pVCpu)
    62196230{
    6220     PX86FXSTATE pFpuCtx = &pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
     6231    PX86FXSTATE pFpuCtx = &IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87;
    62216232    uint16_t    uFsw    = pFpuCtx->FSW;
    62226233    uint16_t    uTop    = uFsw & X86_FSW_TOP_MASK;
     
    62356246IEM_STATIC void iemFpuStackDecTop(PVMCPU pVCpu)
    62366247{
    6237     PX86FXSTATE pFpuCtx = &pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
     6248    PX86FXSTATE pFpuCtx = &IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87;
    62386249    uint16_t    uFsw    = pFpuCtx->FSW;
    62396250    uint16_t    uTop    = uFsw & X86_FSW_TOP_MASK;
     
    62536264IEM_STATIC void iemFpuUpdateFSW(PVMCPU pVCpu, uint16_t u16FSW)
    62546265{
    6255     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6266    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    62566267    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    62576268    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    62686279IEM_STATIC void iemFpuUpdateFSWThenPop(PVMCPU pVCpu, uint16_t u16FSW)
    62696280{
    6270     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6281    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    62716282    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    62726283    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    62866297IEM_STATIC void iemFpuUpdateFSWWithMemOp(PVMCPU pVCpu, uint16_t u16FSW, uint8_t iEffSeg, RTGCPTR GCPtrEff)
    62876298{
    6288     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6299    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    62896300    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    62906301    iemFpuUpdateDP(pVCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
     
    63026313IEM_STATIC void iemFpuUpdateFSWThenPopPop(PVMCPU pVCpu, uint16_t u16FSW)
    63036314{
    6304     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6315    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    63056316    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    63066317    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    63216332IEM_STATIC void iemFpuUpdateFSWWithMemOpThenPop(PVMCPU pVCpu, uint16_t u16FSW, uint8_t iEffSeg, RTGCPTR GCPtrEff)
    63226333{
    6323     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6334    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    63246335    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    63256336    iemFpuUpdateDP(pVCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
     
    63706381DECL_NO_INLINE(IEM_STATIC, void) iemFpuStackUnderflow(PVMCPU pVCpu, uint8_t iStReg)
    63716382{
    6372     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6383    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    63736384    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    63746385    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    63806391iemFpuStackUnderflowWithMemOp(PVMCPU pVCpu, uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff)
    63816392{
    6382     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6393    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    63836394    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    63846395    iemFpuUpdateDP(pVCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
     
    63906401DECL_NO_INLINE(IEM_STATIC, void) iemFpuStackUnderflowThenPop(PVMCPU pVCpu, uint8_t iStReg)
    63916402{
    6392     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6403    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    63936404    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    63946405    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    64016412iemFpuStackUnderflowWithMemOpThenPop(PVMCPU pVCpu, uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff)
    64026413{
    6403     PCPUMCTX    pCtx      = pVCpu->iem.s.CTX_SUFF(pCtx);
     6414    PCPUMCTX    pCtx      = IEM_GET_CTX(pVCpu);
    64046415    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    64056416    iemFpuUpdateDP(pVCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
     
    64126423DECL_NO_INLINE(IEM_STATIC, void) iemFpuStackUnderflowThenPopPop(PVMCPU pVCpu)
    64136424{
    6414     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6425    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    64156426    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    64166427    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    64246435iemFpuStackPushUnderflow(PVMCPU pVCpu)
    64256436{
    6426     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6437    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    64276438    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    64286439    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    64516462iemFpuStackPushUnderflowTwo(PVMCPU pVCpu)
    64526463{
    6453     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6464    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    64546465    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    64556466    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    65106521DECL_NO_INLINE(IEM_STATIC, void) iemFpuStackPushOverflow(PVMCPU pVCpu)
    65116522{
    6512     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6523    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    65136524    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    65146525    iemFpuUpdateOpcodeAndIpWorker(pVCpu, pCtx, pFpuCtx);
     
    65276538iemFpuStackPushOverflowWithMemOp(PVMCPU pVCpu, uint8_t iEffSeg, RTGCPTR GCPtrEff)
    65286539{
    6529     PCPUMCTX    pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     6540    PCPUMCTX    pCtx    = IEM_GET_CTX(pVCpu);
    65306541    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
    65316542    iemFpuUpdateDP(pVCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
     
    65376548IEM_STATIC int iemFpuStRegNotEmpty(PVMCPU pVCpu, uint8_t iStReg)
    65386549{
    6539     PX86FXSTATE pFpuCtx = &pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
     6550    PX86FXSTATE pFpuCtx = &IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87;
    65406551    uint16_t    iReg    = (X86_FSW_TOP_GET(pFpuCtx->FSW) + iStReg) & X86_FSW_TOP_SMASK;
    65416552    if (pFpuCtx->FTW & RT_BIT(iReg))
     
    65476558IEM_STATIC int iemFpuStRegNotEmptyRef(PVMCPU pVCpu, uint8_t iStReg, PCRTFLOAT80U *ppRef)
    65486559{
    6549     PX86FXSTATE pFpuCtx = &pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
     6560    PX86FXSTATE pFpuCtx = &IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87;
    65506561    uint16_t    iReg    = (X86_FSW_TOP_GET(pFpuCtx->FSW) + iStReg) & X86_FSW_TOP_SMASK;
    65516562    if (pFpuCtx->FTW & RT_BIT(iReg))
     
    65616572                                        uint8_t iStReg1, PCRTFLOAT80U *ppRef1)
    65626573{
    6563     PX86FXSTATE pFpuCtx = &pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
     6574    PX86FXSTATE pFpuCtx = &IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87;
    65646575    uint16_t    iTop    = X86_FSW_TOP_GET(pFpuCtx->FSW);
    65656576    uint16_t    iReg0   = (iTop + iStReg0) & X86_FSW_TOP_SMASK;
     
    65776588IEM_STATIC int iemFpu2StRegsNotEmptyRefFirst(PVMCPU pVCpu, uint8_t iStReg0, PCRTFLOAT80U *ppRef0, uint8_t iStReg1)
    65786589{
    6579     PX86FXSTATE pFpuCtx = &pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
     6590    PX86FXSTATE pFpuCtx = &IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87;
    65806591    uint16_t    iTop    = X86_FSW_TOP_GET(pFpuCtx->FSW);
    65816592    uint16_t    iReg0   = (iTop + iStReg0) & X86_FSW_TOP_SMASK;
     
    69026913            && !(fFlags & X86_PTE_RW)
    69036914            && (   pVCpu->iem.s.uCpl != 0
    6904                 || (pVCpu->iem.s.CTX_SUFF(pCtx)->cr0 & X86_CR0_WP)))
     6915                || (IEM_GET_CTX(pVCpu)->cr0 & X86_CR0_WP)))
    69056916        {
    69066917            Log(("iemMemPageTranslateAndCheckAccess: GCPtrMem=%RGv - read-only page -> #PF\n", GCPtrMem));
     
    69226933        if (   (fAccess & IEM_ACCESS_TYPE_EXEC)
    69236934            && (fFlags & X86_PTE_PAE_NX)
    6924             && (pVCpu->iem.s.CTX_SUFF(pCtx)->msrEFER & MSR_K6_EFER_NXE) )
     6935            && (IEM_GET_CTX(pVCpu)->msrEFER & MSR_K6_EFER_NXE) )
    69256936        {
    69266937            Log(("iemMemPageTranslateAndCheckAccess: GCPtrMem=%RGv - NX -> #PF\n", GCPtrMem));
     
    83778388    /** @todo testcase: Ordering of \#SS(0) vs \#GP() vs \#PF on SSE stuff. */
    83788389    if (   (GCPtrMem & 15)
    8379         && !(pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
     8390        && !(IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
    83808391        return iemRaiseGeneralProtectionFault0(pVCpu);
    83818392
     
    84098420    /** @todo testcase: Ordering of \#SS(0) vs \#GP() vs \#PF on SSE stuff. */
    84108421    if (   (GCPtrMem & 15) == 0
    8411         || (pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
     8422        || (IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
    84128423    {
    84138424        uint128_t const *pu128Src = (uint128_t const *)iemMemMapJmp(pVCpu, sizeof(*pu128Src), iSegReg, GCPtrMem,
     
    87328743    /* The lazy approach for now... */
    87338744    if (   (GCPtrMem & 15)
    8734         && !(pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
     8745        && !(IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
    87358746        return iemRaiseGeneralProtectionFault0(pVCpu);
    87368747
     
    87628773    /* The lazy approach for now... */
    87638774    if (   (GCPtrMem & 15) == 0
    8764         || (pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
     8775        || (IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
    87658776    {
    87668777        uint128_t *pu128Dst = (uint128_t *)iemMemMapJmp(pVCpu, sizeof(*pu128Dst), iSegReg, GCPtrMem, IEM_ACCESS_DATA_W);
     
    88218832    /* Increment the stack pointer. */
    88228833    uint64_t    uNewRsp;
    8823     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     8834    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    88248835    RTGCPTR     GCPtrTop = iemRegGetRspForPush(pVCpu, pCtx, 2, &uNewRsp);
    88258836
     
    88528863    /* Increment the stack pointer. */
    88538864    uint64_t    uNewRsp;
    8854     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     8865    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    88558866    RTGCPTR     GCPtrTop = iemRegGetRspForPush(pVCpu, pCtx, 4, &uNewRsp);
    88568867
     
    88838894    /* Increment the stack pointer. */
    88848895    uint64_t    uNewRsp;
    8885     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     8896    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    88868897    RTGCPTR     GCPtrTop = iemRegGetRspForPush(pVCpu, pCtx, 4, &uNewRsp);
    88878898
     
    89388949    /* Increment the stack pointer. */
    89398950    uint64_t    uNewRsp;
    8940     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     8951    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    89418952    RTGCPTR     GCPtrTop = iemRegGetRspForPush(pVCpu, pCtx, 8, &uNewRsp);
    89428953
     
    89698980    /* Increment the stack pointer. */
    89708981    uint64_t    uNewRsp;
    8971     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     8982    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    89728983    RTGCPTR     GCPtrTop = iemRegGetRspForPop(pVCpu, pCtx, 2, &uNewRsp);
    89738984
     
    90009011    /* Increment the stack pointer. */
    90019012    uint64_t    uNewRsp;
    9002     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     9013    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    90039014    RTGCPTR     GCPtrTop = iemRegGetRspForPop(pVCpu, pCtx, 4, &uNewRsp);
    90049015
     
    90319042    /* Increment the stack pointer. */
    90329043    uint64_t    uNewRsp;
    9033     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     9044    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    90349045    RTGCPTR     GCPtrTop = iemRegGetRspForPop(pVCpu, pCtx, 8, &uNewRsp);
    90359046
     
    90629073{
    90639074    /* Increment the stack pointer. */
    9064     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     9075    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
    90659076    RTUINT64U   NewRsp = *pTmpRsp;
    90669077    RTGCPTR     GCPtrTop = iemRegGetRspForPushEx(pVCpu, pCtx, &NewRsp, 2);
     
    90949105{
    90959106    /* Increment the stack pointer. */
    9096     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     9107    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
    90979108    RTUINT64U   NewRsp = *pTmpRsp;
    90989109    RTGCPTR     GCPtrTop = iemRegGetRspForPushEx(pVCpu, pCtx, &NewRsp, 4);
     
    91269137{
    91279138    /* Increment the stack pointer. */
    9128     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     9139    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
    91299140    RTUINT64U   NewRsp = *pTmpRsp;
    91309141    RTGCPTR     GCPtrTop = iemRegGetRspForPushEx(pVCpu, pCtx, &NewRsp, 8);
     
    91589169{
    91599170    /* Increment the stack pointer. */
    9160     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     9171    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
    91619172    RTUINT64U   NewRsp = *pTmpRsp;
    91629173    RTGCPTR     GCPtrTop = iemRegGetRspForPopEx(pVCpu, pCtx, &NewRsp, 2);
     
    91909201{
    91919202    /* Increment the stack pointer. */
    9192     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     9203    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
    91939204    RTUINT64U   NewRsp = *pTmpRsp;
    91949205    RTGCPTR     GCPtrTop = iemRegGetRspForPopEx(pVCpu, pCtx, &NewRsp, 4);
     
    92229233{
    92239234    /* Increment the stack pointer. */
    9224     PCPUMCTX    pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     9235    PCPUMCTX    pCtx = IEM_GET_CTX(pVCpu);
    92259236    RTUINT64U   NewRsp = *pTmpRsp;
    92269237    RTGCPTR     GCPtrTop = iemRegGetRspForPopEx(pVCpu, pCtx, &NewRsp, 8);
     
    92639274{
    92649275    Assert(cbMem < UINT8_MAX);
    9265     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     9276    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    92669277    RTGCPTR     GCPtrTop = iemRegGetRspForPush(pVCpu, pCtx, (uint8_t)cbMem, puNewRsp);
    92679278    return iemMemMap(pVCpu, ppvMem, cbMem, X86_SREG_SS, GCPtrTop, IEM_ACCESS_STACK_W);
     
    92859296    VBOXSTRICTRC rcStrict = iemMemCommitAndUnmap(pVCpu, pvMem, IEM_ACCESS_STACK_W);
    92869297    if (rcStrict == VINF_SUCCESS)
    9287         pVCpu->iem.s.CTX_SUFF(pCtx)->rsp = uNewRsp;
     9298        IEM_GET_CTX(pVCpu)->rsp = uNewRsp;
    92889299    return rcStrict;
    92899300}
     
    93079318{
    93089319    Assert(cbMem < UINT8_MAX);
    9309     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     9320    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    93109321    RTGCPTR     GCPtrTop = iemRegGetRspForPop(pVCpu, pCtx, (uint8_t)cbMem, puNewRsp);
    93119322    return iemMemMap(pVCpu, (void **)ppvMem, cbMem, X86_SREG_SS, GCPtrTop, IEM_ACCESS_STACK_R);
     
    93309341{
    93319342    Assert(cbMem < UINT8_MAX);
    9332     PCPUMCTX    pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     9343    PCPUMCTX    pCtx     = IEM_GET_CTX(pVCpu);
    93339344    RTUINT64U   NewRsp;
    93349345    NewRsp.u = *puNewRsp;
     
    93559366    VBOXSTRICTRC rcStrict = iemMemCommitAndUnmap(pVCpu, (void *)pvMem, IEM_ACCESS_STACK_R);
    93569367    if (rcStrict == VINF_SUCCESS)
    9357         pVCpu->iem.s.CTX_SUFF(pCtx)->rsp = uNewRsp;
     9368        IEM_GET_CTX(pVCpu)->rsp = uNewRsp;
    93589369    return rcStrict;
    93599370}
     
    94889499{
    94899500    AssertPtr(pDesc);
    9490     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     9501    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    94919502
    94929503    /** @todo did the 286 require all 8 bytes to be accessible? */
     
    95889599IEM_STATIC VBOXSTRICTRC iemMemMarkSelDescAccessed(PVMCPU pVCpu, uint16_t uSel)
    95899600{
    9590     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     9601    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    95919602
    95929603    /*
     
    96849695#define IEM_MC_MAYBE_RAISE_SSE2_RELATED_XCPT() \
    96859696    do { \
    9686         if (   (pVCpu->iem.s.CTX_SUFF(pCtx)->cr0 & X86_CR0_EM) \
    9687             || !(pVCpu->iem.s.CTX_SUFF(pCtx)->cr4 & X86_CR4_OSFXSR) \
     9697        if (   (IEM_GET_CTX(pVCpu)->cr0 & X86_CR0_EM) \
     9698            || !(IEM_GET_CTX(pVCpu)->cr4 & X86_CR4_OSFXSR) \
    96889699            || !IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSse2) \
    96899700            return iemRaiseUndefinedOpcode(pVCpu); \
    9690         if (pVCpu->iem.s.CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \
     9701        if (IEM_GET_CTX(pVCpu)->cr0 & X86_CR0_TS) \
    96919702            return iemRaiseDeviceNotAvailable(pVCpu); \
    96929703    } while (0)
    96939704#define IEM_MC_MAYBE_RAISE_SSE_RELATED_XCPT() \
    96949705    do { \
    9695         if (   (pVCpu->iem.s.CTX_SUFF(pCtx)->cr0 & X86_CR0_EM) \
    9696             || !(pVCpu->iem.s.CTX_SUFF(pCtx)->cr4 & X86_CR4_OSFXSR) \
     9706        if (   (IEM_GET_CTX(pVCpu)->cr0 & X86_CR0_EM) \
     9707            || !(IEM_GET_CTX(pVCpu)->cr4 & X86_CR4_OSFXSR) \
    96979708            || !IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSse) \
    96989709            return iemRaiseUndefinedOpcode(pVCpu); \
    9699         if (pVCpu->iem.s.CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \
     9710        if (IEM_GET_CTX(pVCpu)->cr0 & X86_CR0_TS) \
    97009711            return iemRaiseDeviceNotAvailable(pVCpu); \
    97019712    } while (0)
     
    97059716            || !IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fMmx) \
    97069717            return iemRaiseUndefinedOpcode(pVCpu); \
    9707         if (pVCpu->iem.s.CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \
     9718        if (IEM_GET_CTX(pVCpu)->cr0 & X86_CR0_TS) \
    97089719            return iemRaiseDeviceNotAvailable(pVCpu); \
    97099720    } while (0)
     
    97149725                && !IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fAmdMmxExts) ) \
    97159726            return iemRaiseUndefinedOpcode(pVCpu); \
    9716         if (pVCpu->iem.s.CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \
     9727        if (IEM_GET_CTX(pVCpu)->cr0 & X86_CR0_TS) \
    97179728            return iemRaiseDeviceNotAvailable(pVCpu); \
    97189729    } while (0)
     
    97719782#define IEM_MC_FETCH_EFLAGS(a_EFlags)                   (a_EFlags) = (pVCpu)->iem.s.CTX_SUFF(pCtx)->eflags.u
    97729783#define IEM_MC_FETCH_EFLAGS_U8(a_EFlags)                (a_EFlags) = (uint8_t)(pVCpu)->iem.s.CTX_SUFF(pCtx)->eflags.u
    9773 #define IEM_MC_FETCH_FSW(a_u16Fsw)                      (a_u16Fsw) = pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FSW
    9774 #define IEM_MC_FETCH_FCW(a_u16Fcw)                      (a_u16Fcw) = pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FCW
     9784#define IEM_MC_FETCH_FSW(a_u16Fsw)                      (a_u16Fsw) = IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.FSW
     9785#define IEM_MC_FETCH_FCW(a_u16Fcw)                      (a_u16Fcw) = IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.FCW
    97759786
    97769787#define IEM_MC_STORE_GREG_U8(a_iGReg, a_u8Value)        *iemGRegRefU8(pVCpu, (a_iGReg)) = (a_u8Value)
     
    97859796#define IEM_MC_CLEAR_HIGH_GREG_U64_BY_REF(a_pu32Dst)    do { (a_pu32Dst)[1] = 0; } while (0)
    97869797#define IEM_MC_STORE_FPUREG_R80_SRC_REF(a_iSt, a_pr80Src) \
    9787     do { pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[a_iSt].r80 = *(a_pr80Src); } while (0)
     9798    do { IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aRegs[a_iSt].r80 = *(a_pr80Src); } while (0)
    97889799
    97899800#define IEM_MC_REF_GREG_U8(a_pu8Dst, a_iGReg)           (a_pu8Dst) = iemGRegRefU8(pVCpu, (a_iGReg))
     
    98829893
    98839894#define IEM_MC_FETCH_MREG_U64(a_u64Value, a_iMReg) \
    9884     do { (a_u64Value) = pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx; } while (0)
     9895    do { (a_u64Value) = IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx; } while (0)
    98859896#define IEM_MC_FETCH_MREG_U32(a_u32Value, a_iMReg) \
    9886     do { (a_u32Value) = pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].au32[0]; } while (0)
     9897    do { (a_u32Value) = IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].au32[0]; } while (0)
    98879898#define IEM_MC_STORE_MREG_U64(a_iMReg, a_u64Value) \
    9888     do { pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx = (a_u64Value); } while (0)
     9899    do { IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx = (a_u64Value); } while (0)
    98899900#define IEM_MC_STORE_MREG_U32_ZX_U64(a_iMReg, a_u32Value) \
    9890     do { pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx = (uint32_t)(a_u32Value); } while (0)
     9901    do { IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx = (uint32_t)(a_u32Value); } while (0)
    98919902#define IEM_MC_REF_MREG_U64(a_pu64Dst, a_iMReg)         \
    9892         (a_pu64Dst) = (&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
     9903        (a_pu64Dst) = (&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
    98939904#define IEM_MC_REF_MREG_U64_CONST(a_pu64Dst, a_iMReg) \
    9894         (a_pu64Dst) = ((uint64_t const *)&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
     9905        (a_pu64Dst) = ((uint64_t const *)&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
    98959906#define IEM_MC_REF_MREG_U32_CONST(a_pu32Dst, a_iMReg) \
    9896         (a_pu32Dst) = ((uint32_t const *)&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
     9907        (a_pu32Dst) = ((uint32_t const *)&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
    98979908
    98989909#define IEM_MC_FETCH_XREG_U128(a_u128Value, a_iXReg) \
    9899     do { (a_u128Value) = pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm; } while (0)
     9910    do { (a_u128Value) = IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm; } while (0)
    99009911#define IEM_MC_FETCH_XREG_U64(a_u64Value, a_iXReg) \
    9901     do { (a_u64Value) = pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0]; } while (0)
     9912    do { (a_u64Value) = IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0]; } while (0)
    99029913#define IEM_MC_FETCH_XREG_U32(a_u32Value, a_iXReg) \
    9903     do { (a_u32Value) = pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au32[0]; } while (0)
     9914    do { (a_u32Value) = IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au32[0]; } while (0)
    99049915#define IEM_MC_STORE_XREG_U128(a_iXReg, a_u128Value) \
    9905     do { pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm = (a_u128Value); } while (0)
     9916    do { IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm = (a_u128Value); } while (0)
    99069917#define IEM_MC_STORE_XREG_U64(a_iXReg, a_u64Value) \
    9907     do { pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0] = (a_u64Value); } while (0)
     9918    do { IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0] = (a_u64Value); } while (0)
    99089919#define IEM_MC_STORE_XREG_U64_ZX_U128(a_iXReg, a_u64Value) \
    9909     do { pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0] = (a_u64Value); \
    9910          pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[1] = 0; \
     9920    do { IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0] = (a_u64Value); \
     9921         IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[1] = 0; \
    99119922    } while (0)
    99129923#define IEM_MC_STORE_XREG_U32_ZX_U128(a_iXReg, a_u32Value) \
    9913     do { pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0] = (uint32_t)(a_u32Value); \
    9914          pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[1] = 0; \
     9924    do { IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0] = (uint32_t)(a_u32Value); \
     9925         IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[1] = 0; \
    99159926    } while (0)
    99169927#define IEM_MC_REF_XREG_U128(a_pu128Dst, a_iXReg)       \
    9917     (a_pu128Dst) = (&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm)
     9928    (a_pu128Dst) = (&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm)
    99189929#define IEM_MC_REF_XREG_U128_CONST(a_pu128Dst, a_iXReg) \
    9919     (a_pu128Dst) = ((uint128_t const *)&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm)
     9930    (a_pu128Dst) = ((uint128_t const *)&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm)
    99209931#define IEM_MC_REF_XREG_U64_CONST(a_pu64Dst, a_iXReg) \
    9921     (a_pu64Dst) = ((uint64_t const *)&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0])
     9932    (a_pu64Dst) = ((uint64_t const *)&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0])
    99229933#define IEM_MC_COPY_XREG_U128(a_iXRegDst, a_iXRegSrc) \
    9923     do { pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXRegDst)].xmm \
    9924             = pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXRegSrc)].xmm; } while (0)
     9934    do { IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXRegDst)].xmm \
     9935            = IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.aXMM[(a_iXRegSrc)].xmm; } while (0)
    99259936
    99269937#ifndef IEM_WITH_SETJMP
     
    1024510256        if (   !(a_u16FSW & X86_FSW_ES) \
    1024610257            || !(  (a_u16FSW & (X86_FSW_UE | X86_FSW_OE | X86_FSW_IE)) \
    10247                  & ~(pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FCW & X86_FCW_MASK_ALL) ) ) \
     10258                 & ~(IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.FCW & X86_FCW_MASK_ALL) ) ) \
    1024810259            IEM_MC_RETURN_ON_FAILURE(iemMemCommitAndUnmap(pVCpu, (a_pvMem), (a_fAccess))); \
    1024910260    } while (0)
     
    1038510396#define IEM_MC_CALL_FPU_AIMPL_1(a_pfnAImpl, a0) \
    1038610397    do { \
    10387         a_pfnAImpl(&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0)); \
     10398        a_pfnAImpl(&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87, (a0)); \
    1038810399    } while (0)
    1038910400
     
    1039710408#define IEM_MC_CALL_FPU_AIMPL_2(a_pfnAImpl, a0, a1) \
    1039810409    do { \
    10399         a_pfnAImpl(&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
     10410        a_pfnAImpl(&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
    1040010411    } while (0)
    1040110412
     
    1041010421#define IEM_MC_CALL_FPU_AIMPL_3(a_pfnAImpl, a0, a1, a2) \
    1041110422    do { \
    10412         a_pfnAImpl(&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
     10423        a_pfnAImpl(&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
    1041310424    } while (0)
    1041410425
     
    1054110552    do { \
    1054210553        IEM_MC_PREPARE_FPU_USAGE(); \
    10543         a_pfnAImpl(&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
     10554        a_pfnAImpl(&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
    1054410555    } while (0)
    1054510556
     
    1055510566    do { \
    1055610567        IEM_MC_PREPARE_FPU_USAGE(); \
    10557         a_pfnAImpl(&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
     10568        a_pfnAImpl(&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
    1055810569    } while (0)
    1055910570
     
    1056910580    do { \
    1057010581        IEM_MC_PREPARE_SSE_USAGE(); \
    10571         a_pfnAImpl(&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
     10582        a_pfnAImpl(&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
    1057210583    } while (0)
    1057310584
     
    1058310594    do { \
    1058410595        IEM_MC_PREPARE_SSE_USAGE(); \
    10585         a_pfnAImpl(&pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
     10596        a_pfnAImpl(&IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
    1058610597    } while (0)
    1058710598
    1058810599/** @note Not for IOPL or IF testing. */
    10589 #define IEM_MC_IF_EFL_BIT_SET(a_fBit)                   if (pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit)) {
     10600#define IEM_MC_IF_EFL_BIT_SET(a_fBit)                   if (IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit)) {
    1059010601/** @note Not for IOPL or IF testing. */
    10591 #define IEM_MC_IF_EFL_BIT_NOT_SET(a_fBit)               if (!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit))) {
     10602#define IEM_MC_IF_EFL_BIT_NOT_SET(a_fBit)               if (!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit))) {
    1059210603/** @note Not for IOPL or IF testing. */
    10593 #define IEM_MC_IF_EFL_ANY_BITS_SET(a_fBits)             if (pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBits)) {
     10604#define IEM_MC_IF_EFL_ANY_BITS_SET(a_fBits)             if (IEM_GET_CTX(pVCpu)->eflags.u & (a_fBits)) {
    1059410605/** @note Not for IOPL or IF testing. */
    10595 #define IEM_MC_IF_EFL_NO_BITS_SET(a_fBits)              if (!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBits))) {
     10606#define IEM_MC_IF_EFL_NO_BITS_SET(a_fBits)              if (!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBits))) {
    1059610607/** @note Not for IOPL or IF testing. */
    1059710608#define IEM_MC_IF_EFL_BITS_NE(a_fBit1, a_fBit2)         \
    10598     if (   !!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit1)) \
    10599         != !!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit2)) ) {
     10609    if (   !!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit1)) \
     10610        != !!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit2)) ) {
    1060010611/** @note Not for IOPL or IF testing. */
    1060110612#define IEM_MC_IF_EFL_BITS_EQ(a_fBit1, a_fBit2)         \
    10602     if (   !!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit1)) \
    10603         == !!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit2)) ) {
     10613    if (   !!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit1)) \
     10614        == !!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit2)) ) {
    1060410615/** @note Not for IOPL or IF testing. */
    1060510616#define IEM_MC_IF_EFL_BIT_SET_OR_BITS_NE(a_fBit, a_fBit1, a_fBit2) \
    10606     if (   (pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit)) \
    10607         ||    !!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit1)) \
    10608            != !!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit2)) ) {
     10617    if (   (IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit)) \
     10618        ||    !!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit1)) \
     10619           != !!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit2)) ) {
    1060910620/** @note Not for IOPL or IF testing. */
    1061010621#define IEM_MC_IF_EFL_BIT_NOT_SET_AND_BITS_EQ(a_fBit, a_fBit1, a_fBit2) \
    10611     if (   !(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit)) \
    10612         &&    !!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit1)) \
    10613            == !!(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & (a_fBit2)) ) {
    10614 #define IEM_MC_IF_CX_IS_NZ()                            if (pVCpu->iem.s.CTX_SUFF(pCtx)->cx != 0) {
    10615 #define IEM_MC_IF_ECX_IS_NZ()                           if (pVCpu->iem.s.CTX_SUFF(pCtx)->ecx != 0) {
    10616 #define IEM_MC_IF_RCX_IS_NZ()                           if (pVCpu->iem.s.CTX_SUFF(pCtx)->rcx != 0) {
     10622    if (   !(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit)) \
     10623        &&    !!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit1)) \
     10624           == !!(IEM_GET_CTX(pVCpu)->eflags.u & (a_fBit2)) ) {
     10625#define IEM_MC_IF_CX_IS_NZ()                            if (IEM_GET_CTX(pVCpu)->cx != 0) {
     10626#define IEM_MC_IF_ECX_IS_NZ()                           if (IEM_GET_CTX(pVCpu)->ecx != 0) {
     10627#define IEM_MC_IF_RCX_IS_NZ()                           if (IEM_GET_CTX(pVCpu)->rcx != 0) {
    1061710628/** @note Not for IOPL or IF testing. */
    1061810629#define IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_SET(a_fBit) \
    10619         if (   pVCpu->iem.s.CTX_SUFF(pCtx)->cx != 0 \
    10620             && (pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & a_fBit)) {
     10630        if (   IEM_GET_CTX(pVCpu)->cx != 0 \
     10631            && (IEM_GET_CTX(pVCpu)->eflags.u & a_fBit)) {
    1062110632/** @note Not for IOPL or IF testing. */
    1062210633#define IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_SET(a_fBit) \
    10623         if (   pVCpu->iem.s.CTX_SUFF(pCtx)->ecx != 0 \
    10624             && (pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & a_fBit)) {
     10634        if (   IEM_GET_CTX(pVCpu)->ecx != 0 \
     10635            && (IEM_GET_CTX(pVCpu)->eflags.u & a_fBit)) {
    1062510636/** @note Not for IOPL or IF testing. */
    1062610637#define IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_SET(a_fBit) \
    10627         if (   pVCpu->iem.s.CTX_SUFF(pCtx)->rcx != 0 \
    10628             && (pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & a_fBit)) {
     10638        if (   IEM_GET_CTX(pVCpu)->rcx != 0 \
     10639            && (IEM_GET_CTX(pVCpu)->eflags.u & a_fBit)) {
    1062910640/** @note Not for IOPL or IF testing. */
    1063010641#define IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_NOT_SET(a_fBit) \
    10631         if (   pVCpu->iem.s.CTX_SUFF(pCtx)->cx != 0 \
    10632             && !(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & a_fBit)) {
     10642        if (   IEM_GET_CTX(pVCpu)->cx != 0 \
     10643            && !(IEM_GET_CTX(pVCpu)->eflags.u & a_fBit)) {
    1063310644/** @note Not for IOPL or IF testing. */
    1063410645#define IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_NOT_SET(a_fBit) \
    10635         if (   pVCpu->iem.s.CTX_SUFF(pCtx)->ecx != 0 \
    10636             && !(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & a_fBit)) {
     10646        if (   IEM_GET_CTX(pVCpu)->ecx != 0 \
     10647            && !(IEM_GET_CTX(pVCpu)->eflags.u & a_fBit)) {
    1063710648/** @note Not for IOPL or IF testing. */
    1063810649#define IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_NOT_SET(a_fBit) \
    10639         if (   pVCpu->iem.s.CTX_SUFF(pCtx)->rcx != 0 \
    10640             && !(pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.u & a_fBit)) {
     10650        if (   IEM_GET_CTX(pVCpu)->rcx != 0 \
     10651            && !(IEM_GET_CTX(pVCpu)->eflags.u & a_fBit)) {
    1064110652#define IEM_MC_IF_LOCAL_IS_Z(a_Local)                   if ((a_Local) == 0) {
    1064210653#define IEM_MC_IF_GREG_BIT_SET(a_iGReg, a_iBitNo)       if (*(uint64_t *)iemGRegRef(pVCpu, (a_iGReg)) & RT_BIT_64(a_iBitNo)) {
     
    1065310664    if (iemFpu2StRegsNotEmptyRefFirst(pVCpu, (a_iSt0), &(a_pr80Dst0), (a_iSt1)) == VINF_SUCCESS) {
    1065410665#define IEM_MC_IF_FCW_IM() \
    10655     if (pVCpu->iem.s.CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FCW & X86_FCW_IM) {
     10666    if (IEM_GET_CTX(pVCpu)->CTX_SUFF(pXState)->x87.FCW & X86_FCW_IM) {
    1065610667
    1065710668#define IEM_MC_ELSE()                                   } else {
     
    1066610677#ifdef DEBUG
    1066710678# define IEMOP_MNEMONIC(a_szMnemonic) \
    10668     Log4(("decode - %04x:%RGv %s%s [#%u]\n", pVCpu->iem.s.CTX_SUFF(pCtx)->cs.Sel, pVCpu->iem.s.CTX_SUFF(pCtx)->rip, \
     10679    Log4(("decode - %04x:%RGv %s%s [#%u]\n", IEM_GET_CTX(pVCpu)->cs.Sel, IEM_GET_CTX(pVCpu)->rip, \
    1066910680          pVCpu->iem.s.fPrefixes & IEM_OP_PRF_LOCK ? "lock " : "", a_szMnemonic, pVCpu->iem.s.cInstructions))
    1067010681# define IEMOP_MNEMONIC2(a_szMnemonic, a_szOps) \
    10671     Log4(("decode - %04x:%RGv %s%s %s [#%u]\n", pVCpu->iem.s.CTX_SUFF(pCtx)->cs.Sel, pVCpu->iem.s.CTX_SUFF(pCtx)->rip, \
     10682    Log4(("decode - %04x:%RGv %s%s %s [#%u]\n", IEM_GET_CTX(pVCpu)->cs.Sel, IEM_GET_CTX(pVCpu)->rip, \
    1067210683          pVCpu->iem.s.fPrefixes & IEM_OP_PRF_LOCK ? "lock " : "", a_szMnemonic, a_szOps, pVCpu->iem.s.cInstructions))
    1067310684#else
     
    1081110822        { \
    1081210823            Log5((a_szPrf ": Overriding REX prefix at %RX16! fPrefixes=%#x\n", \
    10813                   pVCpu->iem.s.CTX_SUFF(pCtx)->rip, pVCpu->iem.s.fPrefixes)); \
     10824                  IEM_GET_CTX(pVCpu)->rip, pVCpu->iem.s.fPrefixes)); \
    1081410825            pVCpu->iem.s.fPrefixes &= ~IEM_OP_PRF_REX_MASK; \
    1081510826            pVCpu->iem.s.uRexB     = 0; \
     
    1089210903{
    1089310904    Log5(("iemOpHlpCalcRmEffAddr: bRm=%#x\n", bRm));
    10894     PCCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     10905    PCCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1089510906# define SET_SS_DEF() \
    1089610907    do \
     
    1119511206{
    1119611207    Log5(("iemOpHlpCalcRmEffAddrJmp: bRm=%#x\n", bRm));
    11197     PCCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     11208    PCCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1119811209# define SET_SS_DEF() \
    1119911210    do \
     
    1149711508{
    1149811509    PVMCPU   pVCpu   = pVCpu;
    11499     PCPUMCTX pOrgCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     11510    PCPUMCTX pOrgCtx = IEM_GET_CTX(pVCpu);
    1150011511
    1150111512    /*
     
    1161011621
    1161111622        s_DebugCtx = *pOrgCtx;
    11612         pVCpu->iem.s.CTX_SUFF(pCtx) = &s_DebugCtx;
     11623        IEM_GET_CTX(pVCpu) = &s_DebugCtx;
    1161311624    }
    1161411625
     
    1186611877IEM_STATIC void iemVerifyAssertMsg2(PVMCPU pVCpu)
    1186711878{
    11868     PCPUMCTX pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     11879    PCPUMCTX pCtx  = IEM_GET_CTX(pVCpu);
    1186911880    PVM      pVM   = pVCpu->CTX_SUFF(pVM);
    1187011881    PVMCPU   pVCpu = pVCpu;
     
    1205712068     */
    1205812069    PCPUMCTX    pOrgCtx   = CPUMQueryGuestCtxPtr(pVCpu);
    12059     PCPUMCTX    pDebugCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     12070    PCPUMCTX    pDebugCtx = IEM_GET_CTX(pVCpu);
    1206012071    Assert(pOrgCtx != pDebugCtx);
    12061     pVCpu->iem.s.CTX_SUFF(pCtx) = pOrgCtx;
     12072    IEM_GET_CTX(pVCpu) = pOrgCtx;
    1206212073
    1206312074    /*
     
    1211212123    if (rcStrictIem == VERR_IEM_INSTR_NOT_IMPLEMENTED)
    1211312124    {
    12114         pVCpu->iem.s.CTX_SUFF(pCtx) = pOrgCtx;
     12125        IEM_GET_CTX(pVCpu) = pOrgCtx;
    1211512126        if (rc == VINF_EM_DBG_STEPPED)
    1211612127            return VINF_SUCCESS;
     
    1244312454            iemVerifyAssertRecord(pVCpu, pOtherRec, "Extra Other record!");
    1244412455    }
    12445     pVCpu->iem.s.CTX_SUFF(pCtx) = pOrgCtx;
     12456    IEM_GET_CTX(pVCpu) = pOrgCtx;
    1244612457
    1244712458    return rcStrictIem;
     
    1265312664        && rcStrict == VINF_SUCCESS
    1265412665        && VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)
    12655         && EMGetInhibitInterruptsPC(pVCpu) == pVCpu->iem.s.CTX_SUFF(pCtx)->rip )
     12666        && EMGetInhibitInterruptsPC(pVCpu) == IEM_GET_CTX(pVCpu)->rip )
    1265612667    {
    1265712668        rcStrict = iemInitDecoderAndPrefetchOpcodes(pVCpu, pVCpu->iem.s.fBypassHandlers);
     
    1265912670        {
    1266012671#ifdef LOG_ENABLED
    12661             iemLogCurInstr(pVCpu, pVCpu->iem.s.CTX_SUFF(pCtx), false);
     12672            iemLogCurInstr(pVCpu, IEM_GET_CTX(pVCpu), false);
    1266212673#endif
    1266312674#ifdef IEM_WITH_SETJMP
     
    1269112702    rcStrict = iemExecStatusCodeFiddling(pVCpu, rcStrict);
    1269212703
    12693     Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->cs));
    12694     Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->ss));
     12704    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->cs));
     12705    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->ss));
    1269512706#if defined(IEM_VERIFICATION_MODE_FULL)
    12696     Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->es));
    12697     Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->ds));
    12698     Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->fs));
    12699     Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->gs));
     12707    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->es));
     12708    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->ds));
     12709    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->fs));
     12710    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->gs));
    1270012711#endif
    1270112712    return rcStrict;
     
    1274512756#endif
    1274612757#ifdef LOG_ENABLED
    12747     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     12758    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1274812759    iemLogCurInstr(pVCpu, pCtx, true);
    1274912760#endif
     
    1276512776#endif
    1276612777#ifdef IN_RC
    12767     rcStrict = iemRCRawMaybeReenter(pVCpu, pVCpu->iem.s.CTX_SUFF(pCtx), rcStrict);
     12778    rcStrict = iemRCRawMaybeReenter(pVCpu, IEM_GET_CTX(pVCpu), rcStrict);
    1276812779#endif
    1276912780    if (rcStrict != VINF_SUCCESS)
     
    1277612787VMMDECL(VBOXSTRICTRC)       IEMExecOneEx(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint32_t *pcbWritten)
    1277712788{
    12778     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     12789    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1277912790    AssertReturn(CPUMCTX2CORE(pCtx) == pCtxCore, VERR_IEM_IPE_3);
    1278012791
     
    1279812809                                                         const void *pvOpcodeBytes, size_t cbOpcodeBytes)
    1279912810{
    12800     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     12811    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1280112812    AssertReturn(CPUMCTX2CORE(pCtx) == pCtxCore, VERR_IEM_IPE_3);
    1280212813
     
    1282612837VMMDECL(VBOXSTRICTRC)       IEMExecOneBypassEx(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint32_t *pcbWritten)
    1282712838{
    12828     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     12839    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1282912840    AssertReturn(CPUMCTX2CORE(pCtx) == pCtxCore, VERR_IEM_IPE_3);
    1283012841
     
    1284812859                                                               const void *pvOpcodeBytes, size_t cbOpcodeBytes)
    1284912860{
    12850     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     12861    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1285112862    AssertReturn(CPUMCTX2CORE(pCtx) == pCtxCore, VERR_IEM_IPE_3);
    1285212863
     
    1288912900                                                                      uint32_t *pcbWritten)
    1289012901{
    12891     PCPUMCTX pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     12902    PCPUMCTX pCtx    = IEM_GET_CTX(pVCpu);
    1289212903    AssertReturn(CPUMCTX2CORE(pCtx) == pCtxCore, VERR_IEM_IPE_3);
    1289312904
     
    1292612937     * See if there is an interrupt pending in TRPM, inject it if we can.
    1292712938     */
    12928     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     12939    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1292912940# ifdef IEM_VERIFICATION_MODE_FULL
    1293012941    pVCpu->iem.s.uInjectCpl = UINT8_MAX;
     
    1297812989     * See if there is an interrupt pending in TRPM, inject it if we can.
    1297912990     */
    12980     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     12991    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1298112992# ifdef IEM_VERIFICATION_MODE_FULL
    1298212993    pVCpu->iem.s.uInjectCpl = UINT8_MAX;
     
    1306213073         * Assert hidden register sanity (also done in iemInitDecoder and iemReInitDecoder).
    1306313074         */
    13064         Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->cs));
    13065         Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->ss));
     13075        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->cs));
     13076        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->ss));
    1306613077# if defined(IEM_VERIFICATION_MODE_FULL)
    13067         Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->es));
    13068         Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->ds));
    13069         Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->fs));
    13070         Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pVCpu->iem.s.CTX_SUFF(pCtx)->gs));
     13078        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->es));
     13079        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->ds));
     13080        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->fs));
     13081        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &IEM_GET_CTX(pVCpu)->gs));
    1307113082# endif
    1307213083    }
     
    1307613087     */
    1307713088# ifdef IN_RC
    13078     rcStrict = iemRCRawMaybeReenter(pVCpu, pVCpu->iem.s.CTX_SUFF(pCtx), rcStrict);
     13089    rcStrict = iemRCRawMaybeReenter(pVCpu, IEM_GET_CTX(pVCpu), rcStrict);
    1307913090# endif
    1308013091    if (rcStrict != VINF_SUCCESS)
     
    1321513226VMM_INT_DECL(int) IEMExecInstr_iret(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore)
    1321613227{
    13217     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     13228    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    1321813229
    1321913230    iemCtxCoreToCtx(pCtx, pCtxCore);
     
    1325613267    iemUninitExec(pVCpu);
    1325713268#ifdef IN_RC
    13258     return iemRCRawMaybeReenter(pVCpu, pVCpu->iem.s.CTX_SUFF(pCtx),
     13269    return iemRCRawMaybeReenter(pVCpu, IEM_GET_CTX(pVCpu),
    1325913270                                iemExecStatusCodeFiddling(pVCpu, rcStrict));
    1326013271#else
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h

    r62015 r62076  
    176176static void iemHlpUpdateArithEFlagsU8(PVMCPU pVCpu, uint8_t u8Result, uint32_t fToUpdate, uint32_t fUndefined)
    177177{
    178     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     178    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    179179
    180180    uint32_t fEFlags = pCtx->eflags.u;
     
    232232IEM_CIMPL_DEF_0(iemCImpl_popa_16)
    233233{
    234     PCPUMCTX        pCtx        = pVCpu->iem.s.CTX_SUFF(pCtx);
     234    PCPUMCTX        pCtx        = IEM_GET_CTX(pVCpu);
    235235    RTGCPTR         GCPtrStart  = iemRegGetEffRsp(pVCpu, pCtx);
    236236    RTGCPTR         GCPtrLast   = GCPtrStart + 15;
     
    304304IEM_CIMPL_DEF_0(iemCImpl_popa_32)
    305305{
    306     PCPUMCTX        pCtx        = pVCpu->iem.s.CTX_SUFF(pCtx);
     306    PCPUMCTX        pCtx        = IEM_GET_CTX(pVCpu);
    307307    RTGCPTR         GCPtrStart  = iemRegGetEffRsp(pVCpu, pCtx);
    308308    RTGCPTR         GCPtrLast   = GCPtrStart + 31;
     
    385385IEM_CIMPL_DEF_0(iemCImpl_pusha_16)
    386386{
    387     PCPUMCTX        pCtx        = pVCpu->iem.s.CTX_SUFF(pCtx);
     387    PCPUMCTX        pCtx        = IEM_GET_CTX(pVCpu);
    388388    RTGCPTR         GCPtrTop    = iemRegGetEffRsp(pVCpu, pCtx);
    389389    RTGCPTR         GCPtrBottom = GCPtrTop - 15;
     
    457457IEM_CIMPL_DEF_0(iemCImpl_pusha_32)
    458458{
    459     PCPUMCTX        pCtx        = pVCpu->iem.s.CTX_SUFF(pCtx);
     459    PCPUMCTX        pCtx        = IEM_GET_CTX(pVCpu);
    460460    RTGCPTR         GCPtrTop    = iemRegGetEffRsp(pVCpu, pCtx);
    461461    RTGCPTR         GCPtrBottom = GCPtrTop - 31;
     
    532532IEM_CIMPL_DEF_1(iemCImpl_pushf, IEMMODE, enmEffOpSize)
    533533{
    534     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     534    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    535535
    536536    /*
     
    588588IEM_CIMPL_DEF_1(iemCImpl_popf, IEMMODE, enmEffOpSize)
    589589{
    590     PCPUMCTX        pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     590    PCPUMCTX        pCtx    = IEM_GET_CTX(pVCpu);
    591591    uint32_t const  fEflOld = IEMMISC_GET_EFL(pVCpu, pCtx);
    592592    VBOXSTRICTRC    rcStrict;
     
    748748IEM_CIMPL_DEF_1(iemCImpl_call_16, uint16_t, uNewPC)
    749749{
    750     PCPUMCTX pCtx   = pVCpu->iem.s.CTX_SUFF(pCtx);
     750    PCPUMCTX pCtx   = IEM_GET_CTX(pVCpu);
    751751    uint16_t uOldPC = pCtx->ip + cbInstr;
    752752    if (uNewPC > pCtx->cs.u32Limit)
     
    773773IEM_CIMPL_DEF_1(iemCImpl_call_rel_16, int16_t, offDisp)
    774774{
    775     PCPUMCTX pCtx   = pVCpu->iem.s.CTX_SUFF(pCtx);
     775    PCPUMCTX pCtx   = IEM_GET_CTX(pVCpu);
    776776    uint16_t uOldPC = pCtx->ip + cbInstr;
    777777    uint16_t uNewPC = uOldPC + offDisp;
     
    801801IEM_CIMPL_DEF_1(iemCImpl_call_32, uint32_t, uNewPC)
    802802{
    803     PCPUMCTX pCtx   = pVCpu->iem.s.CTX_SUFF(pCtx);
     803    PCPUMCTX pCtx   = IEM_GET_CTX(pVCpu);
    804804    uint32_t uOldPC = pCtx->eip + cbInstr;
    805805    if (uNewPC > pCtx->cs.u32Limit)
     
    843843IEM_CIMPL_DEF_1(iemCImpl_call_rel_32, int32_t, offDisp)
    844844{
    845     PCPUMCTX pCtx   = pVCpu->iem.s.CTX_SUFF(pCtx);
     845    PCPUMCTX pCtx   = IEM_GET_CTX(pVCpu);
    846846    uint32_t uOldPC = pCtx->eip + cbInstr;
    847847    uint32_t uNewPC = uOldPC + offDisp;
     
    871871IEM_CIMPL_DEF_1(iemCImpl_call_64, uint64_t, uNewPC)
    872872{
    873     PCPUMCTX pCtx   = pVCpu->iem.s.CTX_SUFF(pCtx);
     873    PCPUMCTX pCtx   = IEM_GET_CTX(pVCpu);
    874874    uint64_t uOldPC = pCtx->rip + cbInstr;
    875875    if (!IEM_IS_CANONICAL(uNewPC))
     
    896896IEM_CIMPL_DEF_1(iemCImpl_call_rel_64, int64_t, offDisp)
    897897{
    898     PCPUMCTX pCtx   = pVCpu->iem.s.CTX_SUFF(pCtx);
     898    PCPUMCTX pCtx   = IEM_GET_CTX(pVCpu);
    899899    uint64_t uOldPC = pCtx->rip + cbInstr;
    900900    uint64_t uNewPC = uOldPC + offDisp;
     
    951951    }
    952952
    953     PCPUMCTX pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     953    PCPUMCTX pCtx     = IEM_GET_CTX(pVCpu);
    954954    uint32_t uNextEip = pCtx->eip + cbInstr;
    955     return iemTaskSwitch(pVCpu, pVCpu->iem.s.CTX_SUFF(pCtx), enmBranch == IEMBRANCH_JUMP ? IEMTASKSWITCH_JUMP : IEMTASKSWITCH_CALL,
     955    return iemTaskSwitch(pVCpu, pCtx, enmBranch == IEMBRANCH_JUMP ? IEMTASKSWITCH_JUMP : IEMTASKSWITCH_CALL,
    956956                         uNextEip, 0 /* fFlags */, 0 /* uErr */, 0 /* uCr2 */, uSel, pDesc);
    957957#endif
     
    10201020    }
    10211021
    1022     PCPUMCTX pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     1022    PCPUMCTX pCtx     = IEM_GET_CTX(pVCpu);
    10231023    uint32_t uNextEip = pCtx->eip + cbInstr;
    1024     return iemTaskSwitch(pVCpu, pVCpu->iem.s.CTX_SUFF(pCtx), enmBranch == IEMBRANCH_JUMP ? IEMTASKSWITCH_JUMP : IEMTASKSWITCH_CALL,
     1024    return iemTaskSwitch(pVCpu, pCtx, enmBranch == IEMBRANCH_JUMP ? IEMTASKSWITCH_JUMP : IEMTASKSWITCH_CALL,
    10251025                         uNextEip, 0 /* fFlags */, 0 /* uErr */, 0 /* uCr2 */, uSelTss, &TssDesc);
    10261026#endif
     
    10611061    RTSEL           uNewCS;
    10621062    IEMSELDESC      DescCS;
    1063     PCPUMCTX        pCtx;
    10641063
    10651064    AssertCompile(X86_SEL_TYPE_SYS_386_CALL_GATE == AMD64_SEL_TYPE_SYS_CALL_GATE);
     
    11631162    }
    11641163
    1165     pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     1164    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    11661165
    11671166    if (enmBranch == IEMBRANCH_JUMP)
     
    17231722IEM_CIMPL_DEF_3(iemCImpl_FarJmp, uint16_t, uSel, uint64_t, offSeg, IEMMODE, enmEffOpSize)
    17241723{
    1725     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     1724    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    17261725    NOREF(cbInstr);
    17271726    Assert(offSeg <= UINT32_MAX);
     
    18881887IEM_CIMPL_DEF_3(iemCImpl_callf, uint16_t, uSel, uint64_t, offSeg, IEMMODE, enmEffOpSize)
    18891888{
    1890     PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     1889    PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);
    18911890    VBOXSTRICTRC    rcStrict;
    18921891    uint64_t        uNewRsp;
     
    21092108IEM_CIMPL_DEF_2(iemCImpl_retf, IEMMODE, enmEffOpSize, uint16_t, cbPop)
    21102109{
    2111     PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     2110    PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);
    21122111    VBOXSTRICTRC    rcStrict;
    21132112    RTCPTRUNION     uPtrFrame;
     
    25152514IEM_CIMPL_DEF_2(iemCImpl_retn, IEMMODE, enmEffOpSize, uint16_t, cbPop)
    25162515{
    2517     PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     2516    PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);
    25182517    NOREF(cbInstr);
    25192518
     
    25872586IEM_CIMPL_DEF_3(iemCImpl_enter, IEMMODE, enmEffOpSize, uint16_t, cbFrame, uint8_t, cParameters)
    25882587{
    2589     PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     2588    PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);
    25902589
    25912590    /* Push RBP, saving the old value in TmpRbp. */
     
    27032702IEM_CIMPL_DEF_1(iemCImpl_leave, IEMMODE, enmEffOpSize)
    27042703{
    2705     PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     2704    PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);
    27062705
    27072706    /* Calculate the intermediate RSP from RBP and the stack attributes. */
     
    27742773IEM_CIMPL_DEF_1(iemCImpl_iret_real_v8086, IEMMODE, enmEffOpSize)
    27752774{
    2776     PCPUMCTX  pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     2775    PCPUMCTX  pCtx  = IEM_GET_CTX(pVCpu);
    27772776    X86EFLAGS Efl;
    27782777    Efl.u = IEMMISC_GET_EFL(pVCpu, pCtx);
     
    29942993     */
    29952994    RTSEL        uSelRet;
    2996     PCPUMCTX     pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     2995    PCPUMCTX     pCtx = IEM_GET_CTX(pVCpu);
    29972996    VBOXSTRICTRC rcStrict = iemMemFetchSysU16(pVCpu, &uSelRet, UINT8_MAX, pCtx->tr.u64Base);
    29982997    if (rcStrict != VINF_SUCCESS)
     
    30333032
    30343033    uint32_t uNextEip = pCtx->eip + cbInstr;
    3035     return iemTaskSwitch(pVCpu, pVCpu->iem.s.CTX_SUFF(pCtx), IEMTASKSWITCH_IRET, uNextEip, 0 /* fFlags */, 0 /* uErr */,
     3034    return iemTaskSwitch(pVCpu, pCtx, IEMTASKSWITCH_IRET, uNextEip, 0 /* fFlags */, 0 /* uErr */,
    30363035                         0 /* uCr2 */, uSelRet, &TssDesc);
    30373036#endif
     
    30463045IEM_CIMPL_DEF_1(iemCImpl_iret_prot, IEMMODE, enmEffOpSize)
    30473046{
    3048     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     3047    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    30493048    NOREF(cbInstr);
    30503049    Assert(enmEffOpSize == IEMMODE_32BIT || enmEffOpSize == IEMMODE_16BIT);
     
    34213420IEM_CIMPL_DEF_1(iemCImpl_iret_64bit, IEMMODE, enmEffOpSize)
    34223421{
    3423     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     3422    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    34243423    NOREF(cbInstr);
    34253424
     
    37443743IEM_CIMPL_DEF_0(iemCImpl_syscall)
    37453744{
    3746     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     3745    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    37473746
    37483747    /*
     
    38463845
    38473846{
    3848     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     3847    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    38493848
    38503849    /*
     
    39523951IEM_CIMPL_DEF_2(iemCImpl_LoadSReg, uint8_t, iSegReg, uint16_t, uSel)
    39533952{
    3954     /*PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);*/
     3953    /*PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);*/
    39553954    uint16_t       *pSel = iemSRegRef(pVCpu, iSegReg);
    39563955    PCPUMSELREGHID  pHid = iemSRegGetHid(pVCpu, iSegReg);
     
    41424141        if (iSegReg == X86_SREG_SS)
    41434142        {
    4144             PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4143            PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    41454144            EMSetInhibitInterruptsPC(pVCpu, pCtx->rip);
    41464145        }
     
    41584157IEM_CIMPL_DEF_2(iemCImpl_pop_Sreg, uint8_t, iSegReg, IEMMODE, enmEffOpSize)
    41594158{
    4160     PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4159    PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);
    41614160    VBOXSTRICTRC    rcStrict;
    41624161
     
    42204219                IEMMODE,  enmEffOpSize)
    42214220{
    4222     /*PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);*/
     4221    /*PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);*/
    42234222    VBOXSTRICTRC    rcStrict;
    42244223
     
    42714270
    42724271    /* Within the table limits? */
    4273     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4272    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    42744273    RTGCPTR GCPtrBase;
    42754274    if (uSel & X86_SEL_LDT)
     
    43514350
    43524351    /* commit */
    4353     pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.Bits.u1ZF = fAccessible;
     4352    IEM_GET_CTX(pVCpu)->eflags.Bits.u1ZF = fAccessible;
    43544353
    43554354    iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     
    43834382        if (!Desc.Legacy.Gen.u1DescType)
    43844383        {
    4385             if (CPUMIsGuestInLongModeEx(pVCpu->iem.s.CTX_SUFF(pCtx)))
     4384            if (CPUMIsGuestInLongModeEx(IEM_GET_CTX(pVCpu)))
    43864385            {
    43874386                if (Desc.Long.Gen.u5Zeros)
     
    44584457
    44594458    /* commit flags value and advance rip. */
    4460     pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.Bits.u1ZF = fDescOk;
     4459    IEM_GET_CTX(pVCpu)->eflags.Bits.u1ZF = fDescOk;
    44614460    iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    44624461
     
    44944493    if (pVCpu->iem.s.uCpl != 0)
    44954494        return iemRaiseGeneralProtectionFault0(pVCpu);
    4496     Assert(!pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.Bits.u1VM);
     4495    Assert(!IEM_GET_CTX(pVCpu)->eflags.Bits.u1VM);
    44974496
    44984497    /*
     
    45114510            else
    45124511            {
    4513                 PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4512                PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    45144513                pCtx->gdtr.cbGdt = cbLimit;
    45154514                pCtx->gdtr.pGdt  = GCPtrBase;
     
    45414540     *       you really must know.
    45424541     */
    4543     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4542    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    45444543    VBOXSTRICTRC rcStrict = iemMemStoreDataXdtr(pVCpu, pCtx->gdtr.cbGdt, pCtx->gdtr.pGdt, iEffSeg, GCPtrEffDst);
    45454544    if (rcStrict == VINF_SUCCESS)
     
    45604559    if (pVCpu->iem.s.uCpl != 0)
    45614560        return iemRaiseGeneralProtectionFault0(pVCpu);
    4562     Assert(!pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.Bits.u1VM);
     4561    Assert(!IEM_GET_CTX(pVCpu)->eflags.Bits.u1VM);
    45634562
    45644563    /*
     
    45774576            else
    45784577            {
    4579                 PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4578                PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    45804579                pCtx->idtr.cbIdt = cbLimit;
    45814580                pCtx->idtr.pIdt  = GCPtrBase;
     
    46064605     *       you really must know.
    46074606     */
    4608     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4607    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    46094608    VBOXSTRICTRC rcStrict = iemMemStoreDataXdtr(pVCpu, pCtx->idtr.cbIdt, pCtx->idtr.pIdt, iEffSeg, GCPtrEffDst);
    46104609    if (rcStrict == VINF_SUCCESS)
     
    46214620IEM_CIMPL_DEF_1(iemCImpl_lldt, uint16_t, uNewLdt)
    46224621{
    4623     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4622    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    46244623
    46254624    /*
     
    47474746IEM_CIMPL_DEF_1(iemCImpl_ltr, uint16_t, uNewTr)
    47484747{
    4749     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4748    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    47504749
    47514750    /*
     
    48694868IEM_CIMPL_DEF_2(iemCImpl_mov_Rd_Cd, uint8_t, iGReg, uint8_t, iCrReg)
    48704869{
    4871     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     4870    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    48724871    if (pVCpu->iem.s.uCpl != 0)
    48734872        return iemRaiseGeneralProtectionFault0(pVCpu);
     
    49184917IEM_CIMPL_DEF_2(iemCImpl_load_CrX, uint8_t, iCrReg, uint64_t, uNewCrX)
    49194918{
    4920     PCPUMCTX        pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     4919    PCPUMCTX        pCtx  = IEM_GET_CTX(pVCpu);
    49214920    VBOXSTRICTRC    rcStrict;
    49224921    int             rc;
     
    52335232    if (pVCpu->iem.s.uCpl != 0)
    52345233        return iemRaiseGeneralProtectionFault0(pVCpu);
    5235     Assert(!pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.Bits.u1VM);
     5234    Assert(!IEM_GET_CTX(pVCpu)->eflags.Bits.u1VM);
    52365235
    52375236    /*
     
    52545253IEM_CIMPL_DEF_1(iemCImpl_lmsw, uint16_t, u16NewMsw)
    52555254{
    5256     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5255    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    52575256
    52585257    if (pVCpu->iem.s.uCpl != 0)
     
    52775276        return iemRaiseGeneralProtectionFault0(pVCpu);
    52785277
    5279     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5278    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    52805279    uint64_t uNewCr0 = pCtx->cr0;
    52815280    uNewCr0 &= ~X86_CR0_TS;
     
    52925291IEM_CIMPL_DEF_2(iemCImpl_mov_Rd_Dd, uint8_t, iGReg, uint8_t, iDrReg)
    52935292{
    5294     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5293    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    52955294
    52965295    /*
     
    53605359IEM_CIMPL_DEF_2(iemCImpl_mov_Dd_Rd, uint8_t, iDrReg, uint8_t, iGReg)
    53615360{
    5362     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5361    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    53635362
    53645363    /*
     
    54595458    if (pVCpu->iem.s.uCpl != 0)
    54605459        return iemRaiseGeneralProtectionFault0(pVCpu);
    5461     Assert(!pVCpu->iem.s.CTX_SUFF(pCtx)->eflags.Bits.u1VM);
     5460    Assert(!IEM_GET_CTX(pVCpu)->eflags.Bits.u1VM);
    54625461
    54635462    int rc = PGMInvalidatePage(pVCpu, GCPtrPage);
     
    54805479IEM_CIMPL_DEF_0(iemCImpl_rdtsc)
    54815480{
    5482     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5481    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    54835482
    54845483    /*
     
    55155514IEM_CIMPL_DEF_0(iemCImpl_rdmsr)
    55165515{
    5517     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5516    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    55185517
    55195518    /*
     
    55645563IEM_CIMPL_DEF_0(iemCImpl_wrmsr)
    55655564{
    5566     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5565    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    55675566
    55685567    /*
     
    56305629IEM_CIMPL_DEF_2(iemCImpl_in, uint16_t, u16Port, uint8_t, cbReg)
    56315630{
    5632     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5631    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    56335632
    56345633    /*
     
    56885687IEM_CIMPL_DEF_1(iemCImpl_in_eAX_DX, uint8_t, cbReg)
    56895688{
    5690     return IEM_CIMPL_CALL_2(iemCImpl_in, pVCpu->iem.s.CTX_SUFF(pCtx)->dx, cbReg);
     5689    return IEM_CIMPL_CALL_2(iemCImpl_in, IEM_GET_CTX(pVCpu)->dx, cbReg);
    56915690}
    56925691
     
    57005699IEM_CIMPL_DEF_2(iemCImpl_out, uint16_t, u16Port, uint8_t, cbReg)
    57015700{
    5702     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5701    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    57035702
    57045703    /*
     
    57575756IEM_CIMPL_DEF_1(iemCImpl_out_DX_eAX, uint8_t, cbReg)
    57585757{
    5759     return IEM_CIMPL_CALL_2(iemCImpl_out, pVCpu->iem.s.CTX_SUFF(pCtx)->dx, cbReg);
     5758    return IEM_CIMPL_CALL_2(iemCImpl_out, IEM_GET_CTX(pVCpu)->dx, cbReg);
    57605759}
    57615760
     
    57665765IEM_CIMPL_DEF_0(iemCImpl_cli)
    57675766{
    5768     PCPUMCTX        pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     5767    PCPUMCTX        pCtx    = IEM_GET_CTX(pVCpu);
    57695768    uint32_t        fEfl    = IEMMISC_GET_EFL(pVCpu, pCtx);
    57705769    uint32_t const  fEflOld = fEfl;
     
    58085807IEM_CIMPL_DEF_0(iemCImpl_sti)
    58095808{
    5810     PCPUMCTX        pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     5809    PCPUMCTX        pCtx    = IEM_GET_CTX(pVCpu);
    58115810    uint32_t        fEfl    = IEMMISC_GET_EFL(pVCpu, pCtx);
    58125811    uint32_t const  fEflOld = fEfl;
     
    58845883     * Gather the operands and validate them.
    58855884     */
    5886     PCPUMCTX pCtx       = pVCpu->iem.s.CTX_SUFF(pCtx);
     5885    PCPUMCTX pCtx       = IEM_GET_CTX(pVCpu);
    58875886    RTGCPTR  GCPtrMem   = pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT ? pCtx->rax : pCtx->eax;
    58885887    uint32_t uEcx       = pCtx->ecx;
     
    59405939     * Gather the operands and validate them.
    59415940     */
    5942     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5941    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    59435942    uint32_t uEax = pCtx->eax;
    59445943    uint32_t uEcx = pCtx->ecx;
     
    59915990     * Do the job.
    59925991     */
    5993     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     5992    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    59945993    uint64_t uOtherGsBase = pCtx->msrKERNELGSBASE;
    59955994    pCtx->msrKERNELGSBASE = pCtx->gs.u64Base;
     
    60066005IEM_CIMPL_DEF_0(iemCImpl_cpuid)
    60076006{
    6008     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6007    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    60096008
    60106009    CPUMGetGuestCpuId(pVCpu, pCtx->eax, pCtx->ecx, &pCtx->eax, &pCtx->ebx, &pCtx->ecx, &pCtx->edx);
     
    60266025IEM_CIMPL_DEF_1(iemCImpl_aad, uint8_t, bImm)
    60276026{
    6028     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6027    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    60296028
    60306029    uint16_t const ax = pCtx->ax;
     
    60476046IEM_CIMPL_DEF_1(iemCImpl_aam, uint8_t, bImm)
    60486047{
    6049     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6048    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    60506049    Assert(bImm != 0); /* #DE on 0 is handled in the decoder. */
    60516050
     
    60686067IEM_CIMPL_DEF_0(iemCImpl_daa)
    60696068{
    6070     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6069    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    60716070
    60726071    uint8_t const  al       = pCtx->al;
     
    61016100IEM_CIMPL_DEF_0(iemCImpl_das)
    61026101{
    6103     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6102    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    61046103
    61056104    uint8_t const  uInputAL = pCtx->al;
     
    61806179IEM_CIMPL_DEF_0(iemCImpl_xgetbv)
    61816180{
    6182     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6181    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    61836182    if (pCtx->cr4 & X86_CR4_OSXSAVE)
    61846183    {
     
    62116210IEM_CIMPL_DEF_0(iemCImpl_xsetbv)
    62126211{
    6213     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6212    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    62146213    if (pCtx->cr4 & X86_CR4_OSXSAVE)
    62156214    {
     
    62586257IEM_CIMPL_DEF_1(iemCImpl_finit, bool, fCheckXcpts)
    62596258{
    6260     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6259    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    62616260
    62626261    if (pCtx->cr0 & (X86_CR0_EM | X86_CR0_TS))
     
    62956294IEM_CIMPL_DEF_3(iemCImpl_fxsave, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, enmEffOpSize)
    62966295{
    6297     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6296    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    62986297
    62996298    /*
     
    63996398IEM_CIMPL_DEF_3(iemCImpl_fxrstor, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, enmEffOpSize)
    64006399{
    6401     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6400    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    64026401
    64036402    /*
     
    66476646IEM_CIMPL_DEF_3(iemCImpl_fnstenv, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst)
    66486647{
    6649     PCPUMCTX     pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6648    PCPUMCTX     pCtx = IEM_GET_CTX(pVCpu);
    66506649    RTPTRUNION   uPtr;
    66516650    VBOXSTRICTRC rcStrict = iemMemMap(pVCpu, &uPtr.pv, enmEffOpSize == IEMMODE_16BIT ? 14 : 28,
     
    66746673IEM_CIMPL_DEF_3(iemCImpl_fnsave, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst)
    66756674{
    6676     PCPUMCTX     pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6675    PCPUMCTX     pCtx = IEM_GET_CTX(pVCpu);
    66776676    RTPTRUNION   uPtr;
    66786677    VBOXSTRICTRC rcStrict = iemMemMap(pVCpu, &uPtr.pv, enmEffOpSize == IEMMODE_16BIT ? 94 : 108,
     
    67256724IEM_CIMPL_DEF_3(iemCImpl_fldenv, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPTR, GCPtrEffSrc)
    67266725{
    6727     PCPUMCTX     pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6726    PCPUMCTX     pCtx = IEM_GET_CTX(pVCpu);
    67286727    RTCPTRUNION  uPtr;
    67296728    VBOXSTRICTRC rcStrict = iemMemMap(pVCpu, (void **)&uPtr.pv, enmEffOpSize == IEMMODE_16BIT ? 14 : 28,
     
    67526751IEM_CIMPL_DEF_3(iemCImpl_frstor, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPTR, GCPtrEffSrc)
    67536752{
    6754     PCPUMCTX     pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6753    PCPUMCTX     pCtx = IEM_GET_CTX(pVCpu);
    67556754    RTCPTRUNION  uPtr;
    67566755    VBOXSTRICTRC rcStrict = iemMemMap(pVCpu, (void **)&uPtr.pv, enmEffOpSize == IEMMODE_16BIT ? 94 : 108,
     
    67876786IEM_CIMPL_DEF_1(iemCImpl_fldcw, uint16_t, u16Fcw)
    67886787{
    6789     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6788    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    67906789
    67916790    /** @todo Testcase: Check what happens when trying to load X86_FCW_PC_RSVD. */
     
    68136812IEM_CIMPL_DEF_1(iemCImpl_fxch_underflow, uint8_t, iStReg)
    68146813{
    6815     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6814    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    68166815
    68176816    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
     
    68626861IEM_CIMPL_DEF_3(iemCImpl_fcomi_fucomi, uint8_t, iStReg, PFNIEMAIMPLFPUR80EFL, pfnAImpl, bool, fPop)
    68636862{
    6864     PCPUMCTX pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     6863    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    68656864    Assert(iStReg < 8);
    68666865
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h

    r62015 r62076  
    156156{
    157157    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    158     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     158    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    159159
    160160    /*
     
    325325{
    326326    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    327     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     327    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    328328
    329329    /*
     
    494494{
    495495    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    496     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     496    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    497497
    498498    /*
     
    626626{
    627627    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    628     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     628    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    629629
    630630    /*
     
    759759{
    760760    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    761     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     761    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    762762
    763763    /*
     
    933933{
    934934    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    935     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     935    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    936936
    937937    /*
     
    10661066{
    10671067    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    1068     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     1068    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    10691069
    10701070    /*
     
    11941194{
    11951195    PVM             pVM  = pVCpu->CTX_SUFF(pVM);
    1196     PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     1196    PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);
    11971197    VBOXSTRICTRC    rcStrict;
    11981198
     
    12571257{
    12581258    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    1259     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     1259    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    12601260
    12611261    /*
     
    14401440{
    14411441    PVM             pVM  = pVCpu->CTX_SUFF(pVM);
    1442     PCPUMCTX        pCtx = pVCpu->iem.s.CTX_SUFF(pCtx);
     1442    PCPUMCTX        pCtx = IEM_GET_CTX(pVCpu);
    14431443    VBOXSTRICTRC    rcStrict;
    14441444
     
    14841484{
    14851485    PVM         pVM   = pVCpu->CTX_SUFF(pVM);
    1486     PCPUMCTX    pCtx  = pVCpu->iem.s.CTX_SUFF(pCtx);
     1486    PCPUMCTX    pCtx  = IEM_GET_CTX(pVCpu);
    14871487
    14881488    /*
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h

    r62015 r62076  
    1078010780    pVCpu->iem.s.offOpcode = offOpcodeSaved;
    1078110781
    10782     PCPUMCTX        pCtx     = pVCpu->iem.s.CTX_SUFF(pCtx);
     10782    PCPUMCTX        pCtx     = IEM_GET_CTX(pVCpu);
    1078310783    uint64_t const  RspSaved = pCtx->rsp;
    1078410784    switch (pVCpu->iem.s.enmEffOpSize)
     
    1765817658{
    1765917659    /* Registers? How?? */
    17660     if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT))
     17660    if (RT_LIKELY((bRm & X86_MODRM_MOD_MASK) != (3 << X86_MODRM_MOD_SHIFT)))
     17661    { /* likely */ }
     17662    else
    1766117663        return IEMOP_RAISE_INVALID_OPCODE(); /* callf eax is not legal */
    1766217664
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r62017 r62076  
    635635
    636636
     637/** @def IEM_GET_CTX
     638 * Gets the guest CPU context for the calling EMT.
     639 * @returns PCPUMCTX
     640 * @param   a_pVCpu The cross context virtual CPU structure of the calling thread.
     641 */
     642#if !defined(IEM_VERIFICATION_MODE_FULL) && !defined(IEM_VERIFICATION_MODE) \
     643 && !defined(IEM_VERIFICATION_MODE_MINIMAL) && defined(VMCPU_INCL_CPUM_GST_CTX)
     644# define IEM_GET_CTX(a_pVCpu) (&(a_pVCpu)->cpum.GstCtx)
     645#else
     646# define IEM_GET_CTX(a_pVCpu) ((a_pVCpu)->iem.s.CTX_SUFF(pCtx))
     647#endif
     648
    637649/** Gets the current IEMTARGETCPU value.
    638650 * @returns IEMTARGETCPU value.
    639  * @param   a_pVCpu         The IEM per CPU instance data.
     651 * @param   a_pVCpu The cross context virtual CPU structure of the calling thread.
    640652 */
    641653#if IEM_CFG_TARGET_CPU != IEMTARGETCPU_DYNAMIC
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