VirtualBox

Changeset 40453 in vbox


Ignore:
Timestamp:
Mar 13, 2012 6:38:06 PM (13 years ago)
Author:
vboxsync
Message:

EM/IEM/PATM: some refactoring.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/em.h

    r40451 r40453  
    161161VMMDECL(VBOXSTRICTRC)   EMInterpretInstructionDisasState(PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pCoreCtx, RTGCPTR pvFault, EMCODETYPE enmCodeType);
    162162
     163#ifdef IN_RC
     164VMMDECL(int)            EMInterpretIretV86ForPatm(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
     165#endif
     166
    163167#ifndef VBOX_WITH_IEM
    164168VMMDECL(int)            EMInterpretCpuId(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
     
    167171VMMDECL(int)            EMInterpretRdtscp(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
    168172VMMDECL(VBOXSTRICTRC)   EMInterpretInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pAddrGC);
    169 VMMDECL(int)            EMInterpretIret(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
    170173VMMDECL(VBOXSTRICTRC)   EMInterpretMWait(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
    171174VMMDECL(int)            EMInterpretMonitor(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
  • trunk/include/VBox/vmm/iem.h

    r40274 r40453  
    4040
    4141VMMDECL(VBOXSTRICTRC)       IEMExecOne(PVMCPU pVCpu);
     42VMMDECL(VBOXSTRICTRC)       IEMExecOneEx(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint32_t *pcbWritten);
    4243VMMDECL(VBOXSTRICTRC)       IEMExecLots(PVMCPU pVCpu);
    4344VMM_INT_DECL(VBOXSTRICTRC)  IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType, uint16_t uErrCode, RTGCPTR uCr2);
     
    4546VMM_INT_DECL(int)           IEMBreakpointSet(PVM pVM, RTGCPTR GCPtrBp);
    4647VMM_INT_DECL(int)           IEMBreakpointClear(PVM pVM, RTGCPTR GCPtrBp);
     48
     49/** @name Given Instruction Interpreters
     50 * @{ */
     51
     52/** @}  */
    4753
    4854#if defined(IEM_VERIFICATION_MODE) && defined(IN_RING3)
  • trunk/include/VBox/vmm/patm.h

    r35361 r40453  
    314314 * @param   pCtxCore    The relevant core context.
    315315 */
    316 VMMDECL(int) PATMGCHandleIllegalInstrTrap(PVM pVM, PCPUMCTXCORE pRegFrame);
     316VMMDECL(int) PATMRCHandleIllegalInstrTrap(PVM pVM, PCPUMCTXCORE pRegFrame);
    317317
    318318/** @} */
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r40451 r40453  
    2626#include <VBox/vmm/csam.h>
    2727#include <VBox/vmm/pgm.h>
     28#ifdef VBOX_WITH_IEM
     29# include <VBox/vmm/iem.h>
     30#endif
    2831#include <VBox/vmm/iom.h>
    2932#include <VBox/vmm/stam.h>
     
    488491    LogFlow(("EMInterpretInstruction %RGv fault %RGv\n", (RTGCPTR)pRegFrame->rip, pvFault));
    489492#ifdef VBOX_WITH_IEM
    490     int rc = IEMExecOneEx(pVCpu, pRegFrame, IEM_EXEC_ONE_EX_FLAGS_, pcbSize);
    491     if (RT_FAILURE(rc))
    492         switch (rc)
    493         {
    494             case VERR_IEM_ASPECT_NOT_IMPLEMENTED:
    495             case VERR_IEM_INSTR_NOT_IMPLEMENTED:
    496                 return VERR_EM_INTERPRETER;
    497         }
     493    NOREF(pvFault);
     494    VBOXSTRICTRC rc = IEMExecOneEx(pVCpu, pRegFrame, NULL);
     495    if (RT_UNLIKELY(   rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED
     496                    || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED))
     497        return VERR_EM_INTERPRETER;
    498498    return rc;
    499499#else
     
    545545    LogFlow(("EMInterpretInstructionEx %RGv fault %RGv\n", (RTGCPTR)pRegFrame->rip, pvFault));
    546546#ifdef VBOX_WITH_IEM
    547     int rc = IEMExecOneEx(pVCpu, pRegFrame, IEM_EXEC_ONE_EX_FLAGS_, pcbWritten);
    548     if (RT_FAILURE(rc))
    549         switch (rc)
    550         {
    551             case VERR_IEM_ASPECT_NOT_IMPLEMENTED:
    552             case VERR_IEM_INSTR_NOT_IMPLEMENTED:
    553                 return VERR_EM_INTERPRETER;
    554         }
     547    NOREF(pvFault);
     548    VBOXSTRICTRC rc = IEMExecOneEx(pVCpu, pRegFrame, pcbWritten);
     549    if (RT_UNLIKELY(   rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED
     550                    || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED))
     551        return VERR_EM_INTERPRETER;
    555552    return rc;
    556553#else
     
    609606                                                       RTGCPTR pvFault, EMCODETYPE enmCodeType)
    610607{
    611     STAM_PROFILE_START(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,Emulate), a);
     608    LogFlow(("EMInterpretInstructionDisasState %RGv fault %RGv\n", (RTGCPTR)pRegFrame->rip, pvFault));
     609#ifdef VBOX_WITH_IEM
     610    NOREF(pDis); NOREF(pvFault); NOREF(enmCodeType);
     611    VBOXSTRICTRC rc = IEMExecOneEx(pVCpu, pRegFrame, NULL);
     612    if (RT_UNLIKELY(   rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED
     613                    || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED))
     614        return VERR_EM_INTERPRETER;
     615    return rc;
     616#else
    612617    uint32_t cbIgnored;
    613618    VBOXSTRICTRC rc = emInterpretInstructionCPUOuter(pVCpu, pDis, pRegFrame, pvFault, enmCodeType, &cbIgnored);
    614     STAM_PROFILE_STOP(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,Emulate), a);
    615619    if (RT_SUCCESS(rc))
    616     {
    617620        pRegFrame->rip += pDis->opsize; /* Move on to the next instruction. */
    618         STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,InterpretSucceeded));
    619     }
    620     else
    621         STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,InterpretFailed));
    622621    return rc;
    623 }
    624 
     622#endif
     623}
     624
     625#if defined(IN_RC) /*&& defined(VBOX_WITH_PATM)*/
     626
     627DECLINLINE(int) emRCStackRead(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCPTR GCPtrSrc, uint32_t cb)
     628{
     629    int rc = MMGCRamRead(pVM, pvDst, (void *)(uintptr_t)GCPtrSrc, cb);
     630    if (RT_LIKELY(rc != VERR_ACCESS_DENIED))
     631        return rc;
     632    return PGMPhysInterpretedReadNoHandlers(pVCpu, pCtxCore, pvDst, GCPtrSrc, cb, /*fMayTrap*/ false);
     633}
     634
     635
     636/**
     637 * Interpret IRET (currently only to V86 code) - PATM only.
     638 *
     639 * @returns VBox status code.
     640 * @param   pVM         The VM handle.
     641 * @param   pVCpu       The VMCPU handle.
     642 * @param   pRegFrame   The register frame.
     643 *
     644 */
     645VMMDECL(int) EMInterpretIretV86ForPatm(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)
     646{
     647    RTGCUINTPTR pIretStack = (RTGCUINTPTR)pRegFrame->esp;
     648    RTGCUINTPTR eip, cs, esp, ss, eflags, ds, es, fs, gs, uMask;
     649    int         rc;
     650
     651    Assert(!CPUMIsGuestIn64BitCode(pVCpu, pRegFrame));
     652    /** @todo Rainy day: Test what happens when VERR_EM_INTERPRETER is returned by
     653     *        this function.  Faire that it may guru on us, thus not converted to
     654     *        IEM. */
     655
     656    rc  = emRCStackRead(pVM, pVCpu, pRegFrame, &eip,      (RTGCPTR)pIretStack      , 4);
     657    rc |= emRCStackRead(pVM, pVCpu, pRegFrame, &cs,       (RTGCPTR)(pIretStack + 4), 4);
     658    rc |= emRCStackRead(pVM, pVCpu, pRegFrame, &eflags,   (RTGCPTR)(pIretStack + 8), 4);
     659    AssertRCReturn(rc, VERR_EM_INTERPRETER);
     660    AssertReturn(eflags & X86_EFL_VM, VERR_EM_INTERPRETER);
     661
     662    rc |= emRCStackRead(pVM, pVCpu, pRegFrame, &esp,      (RTGCPTR)(pIretStack + 12), 4);
     663    rc |= emRCStackRead(pVM, pVCpu, pRegFrame, &ss,       (RTGCPTR)(pIretStack + 16), 4);
     664    rc |= emRCStackRead(pVM, pVCpu, pRegFrame, &es,       (RTGCPTR)(pIretStack + 20), 4);
     665    rc |= emRCStackRead(pVM, pVCpu, pRegFrame, &ds,       (RTGCPTR)(pIretStack + 24), 4);
     666    rc |= emRCStackRead(pVM, pVCpu, pRegFrame, &fs,       (RTGCPTR)(pIretStack + 28), 4);
     667    rc |= emRCStackRead(pVM, pVCpu, pRegFrame, &gs,       (RTGCPTR)(pIretStack + 32), 4);
     668    AssertRCReturn(rc, VERR_EM_INTERPRETER);
     669
     670    pRegFrame->eip = eip & 0xffff;
     671    pRegFrame->cs  = cs;
     672
     673    /* Mask away all reserved bits */
     674    uMask = X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_TF | X86_EFL_IF | X86_EFL_DF | X86_EFL_OF | X86_EFL_IOPL | X86_EFL_NT | X86_EFL_RF | X86_EFL_VM | X86_EFL_AC | X86_EFL_VIF | X86_EFL_VIP | X86_EFL_ID;
     675    eflags &= uMask;
     676
     677    CPUMRawSetEFlags(pVCpu, pRegFrame, eflags);
     678    Assert((pRegFrame->eflags.u32 & (X86_EFL_IF|X86_EFL_IOPL)) == X86_EFL_IF);
     679
     680    pRegFrame->esp = esp;
     681    pRegFrame->ss  = ss;
     682    pRegFrame->ds  = ds;
     683    pRegFrame->es  = es;
     684    pRegFrame->fs  = fs;
     685    pRegFrame->gs  = gs;
     686
     687    return VINF_SUCCESS;
     688}
     689
     690#endif /* IN_RC && VBOX_WITH_PATM */
    625691#ifndef VBOX_WITH_IEM
    626692
     
    19251991    return VERR_EM_INTERPRETER;
    19261992#endif
    1927 }
    1928 #endif /* IN_RC */
    1929 
    1930 
    1931 #ifdef IN_RC
    1932 /**
    1933  * Interpret IRET (currently only to V86 code)
    1934  *
    1935  * @returns VBox status code.
    1936  * @param   pVM         The VM handle.
    1937  * @param   pVCpu       The VMCPU handle.
    1938  * @param   pRegFrame   The register frame.
    1939  *
    1940  */
    1941 VMMDECL(int) EMInterpretIret(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)
    1942 {
    1943     RTGCUINTPTR pIretStack = (RTGCUINTPTR)pRegFrame->esp;
    1944     RTGCUINTPTR eip, cs, esp, ss, eflags, ds, es, fs, gs, uMask;
    1945     int         rc;
    1946 
    1947     Assert(!CPUMIsGuestIn64BitCode(pVCpu, pRegFrame));
    1948 
    1949     rc  = emRamRead(pVM, pVCpu, pRegFrame, &eip,      (RTGCPTR)pIretStack      , 4);
    1950     rc |= emRamRead(pVM, pVCpu, pRegFrame, &cs,       (RTGCPTR)(pIretStack + 4), 4);
    1951     rc |= emRamRead(pVM, pVCpu, pRegFrame, &eflags,   (RTGCPTR)(pIretStack + 8), 4);
    1952     AssertRCReturn(rc, VERR_EM_INTERPRETER);
    1953     AssertReturn(eflags & X86_EFL_VM, VERR_EM_INTERPRETER);
    1954 
    1955     rc |= emRamRead(pVM, pVCpu, pRegFrame, &esp,      (RTGCPTR)(pIretStack + 12), 4);
    1956     rc |= emRamRead(pVM, pVCpu, pRegFrame, &ss,       (RTGCPTR)(pIretStack + 16), 4);
    1957     rc |= emRamRead(pVM, pVCpu, pRegFrame, &es,       (RTGCPTR)(pIretStack + 20), 4);
    1958     rc |= emRamRead(pVM, pVCpu, pRegFrame, &ds,       (RTGCPTR)(pIretStack + 24), 4);
    1959     rc |= emRamRead(pVM, pVCpu, pRegFrame, &fs,       (RTGCPTR)(pIretStack + 28), 4);
    1960     rc |= emRamRead(pVM, pVCpu, pRegFrame, &gs,       (RTGCPTR)(pIretStack + 32), 4);
    1961     AssertRCReturn(rc, VERR_EM_INTERPRETER);
    1962 
    1963     pRegFrame->eip = eip & 0xffff;
    1964     pRegFrame->cs  = cs;
    1965 
    1966     /* Mask away all reserved bits */
    1967     uMask = X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_TF | X86_EFL_IF | X86_EFL_DF | X86_EFL_OF | X86_EFL_IOPL | X86_EFL_NT | X86_EFL_RF | X86_EFL_VM | X86_EFL_AC | X86_EFL_VIF | X86_EFL_VIP | X86_EFL_ID;
    1968     eflags &= uMask;
    1969 
    1970 #ifndef IN_RING0
    1971     CPUMRawSetEFlags(pVCpu, pRegFrame, eflags);
    1972 #endif
    1973     Assert((pRegFrame->eflags.u32 & (X86_EFL_IF|X86_EFL_IOPL)) == X86_EFL_IF);
    1974 
    1975     pRegFrame->esp = esp;
    1976     pRegFrame->ss  = ss;
    1977     pRegFrame->ds  = ds;
    1978     pRegFrame->es  = es;
    1979     pRegFrame->fs  = fs;
    1980     pRegFrame->gs  = gs;
    1981 
    1982     return VINF_SUCCESS;
    19831993}
    19841994#endif /* IN_RC */
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r40381 r40453  
    79187918}
    79197919
     7920
     7921/**
     7922 * Updates the real CPU context structure with the context core (from the trap
     7923 * stack frame) before interpreting any instructions.
     7924 *
     7925 * @param   pCtx        The real CPU context.
     7926 * @param   pCtxCore    The trap stack CPU core context.
     7927 */
     7928DECLINLINE(void) iemCtxCoreToCtx(PCPUMCTX pCtx, PCCPUMCTXCORE pCtxCore)
     7929{
     7930    PCPUMCTXCORE pDst = CPUMCTX2CORE(pCtx);
     7931    if (pDst != pCtxCore)
     7932        *pDst = *pCtxCore;
     7933}
     7934
     7935
     7936/**
     7937 * Updates the context core (from the trap stack frame) with the updated values
     7938 * from the real CPU context structure after instruction emulation.
     7939 *
     7940 * @param   pCtx        The real CPU context.
     7941 * @param   pCtxCore    The trap stack CPU core context.
     7942 */
     7943DECLINLINE(void) iemCtxToCtxCore(PCPUMCTXCORE pCtxCore, PCCPUMCTX pCtx)
     7944{
     7945    PCCPUMCTXCORE pSrc = CPUMCTX2CORE(pCtx);
     7946    if (pSrc != pCtxCore)
     7947        *pCtxCore = *pSrc;
     7948}
     7949
     7950
     7951#if 0 /* The IRET-to-v8086 mode in PATM is very optimistic, so I don't dare do this yet. */
     7952/**
     7953 * Executes a IRET instruction with default operand size.
     7954 *
     7955 * This is for PATM.
     7956 *
     7957 * @returns VBox status code.
     7958 * @param   pVCpu               The current virtual CPU.
     7959 * @param   pCtxCore            The register frame.
     7960 */
     7961VMM_INT_DECL(int) IEMExecInstr_iret(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore)
     7962{
     7963    PIEMCPU  pIemCpu = &pVCpu->iem.s;
     7964    PCPUMCTX pCtx    = pVCpu->iem.s.CTX_SUFF(pCtx);
     7965
     7966    iemCtxCoreToCtx(pCtx, pCtxCore);
     7967    iemInitDecoder(pIemCpu);
     7968    VBOXSTRICTRC rcStrict = iemCImpl_iret(pIemCpu, 1, pIemCpu->enmDefOpSize);
     7969    if (rcStrict == VINF_SUCCESS)
     7970        iemCtxToCtxCore(pCtxCore, pCtx);
     7971    else
     7972        LogFlow(("IEMExecInstr_iret: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x - rcStrict=%Rrc\n",
     7973                 pCtx->cs, pCtx->rip, pCtx->ss, pCtx->rsp, pCtx->eflags.u, VBOXSTRICTRC_VAL(rcStrict)));
     7974    return rcStrict;
     7975}
     7976#endif
     7977
  • trunk/src/VBox/VMM/VMMRC/PATMRC.cpp

    r40451 r40453  
    148148 * @param   pCtxCore    The relevant core context.
    149149 */
    150 VMMDECL(int) PATMGCHandleIllegalInstrTrap(PVM pVM, PCPUMCTXCORE pRegFrame)
     150VMMDECL(int) PATMRCHandleIllegalInstrTrap(PVM pVM, PCPUMCTXCORE pRegFrame)
    151151{
    152152    PPATMPATCHREC pRec;
     153    PVMCPU pVCpu = VMMGetCpu0(pVM);
    153154    int rc;
    154155
     
    160161    if (CTXSUFF(pVM->patm.s.pGCState)->uPendingAction)
    161162    {
    162         LogFlow(("PATMGC: Pending action %x at %x\n", CTXSUFF(pVM->patm.s.pGCState)->uPendingAction, pRegFrame->eip));
     163        LogFlow(("PATMRC: Pending action %x at %x\n", CTXSUFF(pVM->patm.s.pGCState)->uPendingAction, pRegFrame->eip));
    163164
    164165        /* Private PATM interface (@todo hack due to lack of anything generic). */
     
    183184                AssertMsg(!pRegFrame->edi || PATMIsPatchGCAddr(pVM, pRegFrame->edi), ("edx = %x\n", pRegFrame->edi));
    184185
    185                 Log(("PATMGC: lookup %x jump table=%x\n", pRegFrame->edx, pRegFrame->edi));
     186                Log(("PATMRC: lookup %x jump table=%x\n", pRegFrame->edx, pRegFrame->edi));
    186187
    187188                pRec = PATMQueryFunctionPatch(pVM, (RTRCPTR)(pRegFrame->edx));
     
    231232                 *  edi = GC address to jump to
    232233                 */
    233                 Log(("PATMGC: Dispatch pending interrupt; eip=%x->%x\n", pRegFrame->eip, pRegFrame->edi));
     234                Log(("PATMRC: Dispatch pending interrupt; eip=%x->%x\n", pRegFrame->eip, pRegFrame->edi));
    234235
    235236                /* Change EIP to the guest address the patch would normally jump to after setting IF. */
     
    257258                 *  edi = GC address to jump to
    258259                 */
    259                 Log(("PATMGC: Dispatch pending interrupt (iret); eip=%x->%x\n", pRegFrame->eip, pRegFrame->edi));
     260                Log(("PATMRC: Dispatch pending interrupt (iret); eip=%x->%x\n", pRegFrame->eip, pRegFrame->edi));
    260261                Assert(pVM->patm.s.CTXSUFF(pGCState)->Restore.uFlags == (PATM_RESTORE_EAX|PATM_RESTORE_ECX|PATM_RESTORE_EDI));
    261262                Assert(pVM->patm.s.CTXSUFF(pGCState)->fPIF == 0);
     
    276277            case PATM_ACTION_DO_V86_IRET:
    277278            {
    278                 Log(("PATMGC: Do iret to V86 code; eip=%x\n", pRegFrame->eip));
     279                Log(("PATMRC: Do iret to V86 code; eip=%x\n", pRegFrame->eip));
    279280                Assert(pVM->patm.s.CTXSUFF(pGCState)->Restore.uFlags == (PATM_RESTORE_EAX|PATM_RESTORE_ECX));
    280281                Assert(pVM->patm.s.CTXSUFF(pGCState)->fPIF == 0);
     
    284285                pVM->patm.s.CTXSUFF(pGCState)->Restore.uFlags = 0;
    285286
    286                 rc = EMInterpretIret(pVM, VMMGetCpu0(pVM), pRegFrame);
     287                rc = EMInterpretIretV86ForPatm(pVM, pVCpu, pRegFrame);
    287288                if (RT_SUCCESS(rc))
    288289                {
     
    291292                    /* We are no longer executing PATM code; set PIF again. */
    292293                    pVM->patm.s.CTXSUFF(pGCState)->fPIF = 1;
    293                     PGMRZDynMapReleaseAutoSet(VMMGetCpu0(pVM));
     294                    PGMRZDynMapReleaseAutoSet(pVCpu);
    294295                    CPUMGCCallV86Code(pRegFrame);
    295296                    /* does not return */
     
    302303#ifdef DEBUG
    303304            case PATM_ACTION_LOG_CLI:
    304                 Log(("PATMGC: CLI at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags) ));
     305                Log(("PATMRC: CLI at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags) ));
    305306                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    306307                return VINF_SUCCESS;
    307308
    308309            case PATM_ACTION_LOG_STI:
    309                 Log(("PATMGC: STI at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags) ));
     310                Log(("PATMRC: STI at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags) ));
    310311                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    311312                return VINF_SUCCESS;
    312313
    313314            case PATM_ACTION_LOG_POPF_IF1:
    314                 Log(("PATMGC: POPF setting IF at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags)));
     315                Log(("PATMRC: POPF setting IF at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags)));
    315316                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    316317                return VINF_SUCCESS;
    317318
    318319            case PATM_ACTION_LOG_POPF_IF0:
    319                 Log(("PATMGC: POPF at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags)));
     320                Log(("PATMRC: POPF at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags)));
    320321                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    321322                return VINF_SUCCESS;
    322323
    323324            case PATM_ACTION_LOG_PUSHF:
    324                 Log(("PATMGC: PUSHF at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags) ));
     325                Log(("PATMRC: PUSHF at %x (current IF=%d iopl=%d)\n", pRegFrame->eip, !!(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & X86_EFL_IF), X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags) ));
    325326                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    326327                return VINF_SUCCESS;
    327328
    328329            case PATM_ACTION_LOG_IF1:
    329                 Log(("PATMGC: IF=1 escape from %x\n", pRegFrame->eip));
     330                Log(("PATMRC: IF=1 escape from %x\n", pRegFrame->eip));
    330331                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    331332                return VINF_SUCCESS;
     
    358359                            if (rc == VINF_SUCCESS)
    359360                            {
    360                                 Log(("PATMGC: IRET->VM stack frame: return address %04X:%x eflags=%08x ss:esp=%04X:%x\n", selCS, eip, uEFlags, selSS, esp));
    361                                 Log(("PATMGC: IRET->VM stack frame: DS=%04X ES=%04X FS=%04X GS=%04X\n", selDS, selES, selFS, selGS));
     361                                Log(("PATMRC: IRET->VM stack frame: return address %04X:%x eflags=%08x ss:esp=%04X:%x\n", selCS, eip, uEFlags, selSS, esp));
     362                                Log(("PATMRC: IRET->VM stack frame: DS=%04X ES=%04X FS=%04X GS=%04X\n", selDS, selES, selFS, selGS));
    362363                            }
    363364                        }
    364365                        else
    365                             Log(("PATMGC: IRET stack frame: return address %04X:%x eflags=%08x ss:esp=%04X:%x\n", selCS, eip, uEFlags, selSS, esp));
     366                            Log(("PATMRC: IRET stack frame: return address %04X:%x eflags=%08x ss:esp=%04X:%x\n", selCS, eip, uEFlags, selSS, esp));
    366367                    }
    367368                    else
    368                         Log(("PATMGC: IRET stack frame: return address %04X:%x eflags=%08x\n", selCS, eip, uEFlags));
     369                        Log(("PATMRC: IRET stack frame: return address %04X:%x eflags=%08x\n", selCS, eip, uEFlags));
    369370                }
    370                 Log(("PATMGC: IRET from %x (IF->1) current eflags=%x\n", pRegFrame->eip, pVM->patm.s.CTXSUFF(pGCState)->uVMFlags));
     371                Log(("PATMRC: IRET from %x (IF->1) current eflags=%x\n", pRegFrame->eip, pVM->patm.s.CTXSUFF(pGCState)->uVMFlags));
    371372                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    372373                return VINF_SUCCESS;
     
    400401                            if (rc == VINF_SUCCESS)
    401402                            {
    402                                 Log(("PATMGC: GATE->VM stack frame: return address %04X:%x eflags=%08x ss:esp=%04X:%x\n", selCS, eip, uEFlags, selSS, esp));
    403                                 Log(("PATMGC: GATE->VM stack frame: DS=%04X ES=%04X FS=%04X GS=%04X\n", selDS, selES, selFS, selGS));
     403                                Log(("PATMRC: GATE->VM stack frame: return address %04X:%x eflags=%08x ss:esp=%04X:%x\n", selCS, eip, uEFlags, selSS, esp));
     404                                Log(("PATMRC: GATE->VM stack frame: DS=%04X ES=%04X FS=%04X GS=%04X\n", selDS, selES, selFS, selGS));
    404405                            }
    405406                        }
    406407                        else
    407                             Log(("PATMGC: GATE stack frame: return address %04X:%x eflags=%08x ss:esp=%04X:%x\n", selCS, eip, uEFlags, selSS, esp));
     408                            Log(("PATMRC: GATE stack frame: return address %04X:%x eflags=%08x ss:esp=%04X:%x\n", selCS, eip, uEFlags, selSS, esp));
    408409                    }
    409410                    else
    410                         Log(("PATMGC: GATE stack frame: return address %04X:%x eflags=%08x\n", selCS, eip, uEFlags));
     411                        Log(("PATMRC: GATE stack frame: return address %04X:%x eflags=%08x\n", selCS, eip, uEFlags));
    411412                }
    412413                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
     
    415416
    416417            case PATM_ACTION_LOG_RET:
    417                 Log(("PATMGC: RET from %x to %x ESP=%x iopl=%d\n", pRegFrame->eip, pRegFrame->edx, pRegFrame->ebx, X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags)));
     418                Log(("PATMRC: RET from %x to %x ESP=%x iopl=%d\n", pRegFrame->eip, pRegFrame->edx, pRegFrame->ebx, X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags)));
    418419                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    419420                return VINF_SUCCESS;
    420421
    421422            case PATM_ACTION_LOG_CALL:
    422                 Log(("PATMGC: CALL to %RRv return addr %RRv ESP=%x iopl=%d\n", pVM->patm.s.CTXSUFF(pGCState)->GCCallPatchTargetAddr, pVM->patm.s.CTXSUFF(pGCState)->GCCallReturnAddr, pRegFrame->edx, X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags)));
     423                Log(("PATMRC: CALL to %RRv return addr %RRv ESP=%x iopl=%d\n", pVM->patm.s.CTXSUFF(pGCState)->GCCallPatchTargetAddr, pVM->patm.s.CTXSUFF(pGCState)->GCCallReturnAddr, pRegFrame->edx, X86_EFL_GET_IOPL(pVM->patm.s.CTXSUFF(pGCState)->uVMFlags)));
    423424                pRegFrame->eip += PATM_ILLEGAL_INSTR_SIZE;
    424425                return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp

    r40451 r40453  
    521521            &&  PATMIsPatchGCAddr(pVM, pRegFrame->eip))
    522522        {
    523             LogFlow(("TRPMGCTrap06Handler: -> PATMGCHandleIllegalInstrTrap\n"));
    524             rc = PATMGCHandleIllegalInstrTrap(pVM, pRegFrame);
     523            LogFlow(("TRPMGCTrap06Handler: -> PATMRCHandleIllegalInstrTrap\n"));
     524            rc = PATMRCHandleIllegalInstrTrap(pVM, pRegFrame);
    525525            /** @todo  These tests are completely unnecessary, should just follow the
    526526             *         flow and return at the end of the function. */
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