VirtualBox

Changeset 3073 in vbox for trunk/src/VBox/VMM/PATM


Ignore:
Timestamp:
Jun 6, 2007 4:44:04 PM (18 years ago)
Author:
vboxsync
Message:

Fix for faulting push dword ptr [addr] in patch code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PATM/PATM.cpp

    r3020 r3073  
    59785978           )
    59795979        {
     5980            uint64_t fFlags;
     5981
    59805982            STAM_COUNTER_INC(&pVM->patm.s.StatPushTrap);
     5983
     5984            if (Cpu.pCurInstr->opcode == OP_PUSH)
     5985            {
     5986                rc = PGMShwGetPage(pVM, pCtx->esp, &fFlags, NULL);
     5987                if (    rc == VINF_SUCCESS
     5988                    &&  ((fFlags & (X86_PTE_P|X86_PTE_RW)) == (X86_PTE_P|X86_PTE_RW)) )
     5989                {
     5990                    /* The stack address is fine, so the push argument is a pointer -> emulate this instruction */
     5991
     5992                    /* Reset the PATM stack. */
     5993                    CTXSUFF(pVM->patm.s.pGCState)->Psp = PATM_STACK_SIZE;
     5994
     5995                    pVM->patm.s.pGCStateHC->fPIF = 1;
     5996
     5997                    Log(("Faulting push -> go back to the original instruction\n"));
     5998
     5999                    /* continue at the original instruction */
     6000                    *ppNewEip = pNewEip - SELMToFlat(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid, 0);
     6001                    STAM_PROFILE_ADV_STOP(&pVM->patm.s.StatHandleTrap, a);
     6002                    return VINF_SUCCESS;
     6003                }
     6004            }
     6005
    59816006            /* Typical pushf (most patches)/push (call patch) trap because of a monitored page. */
    59826007            rc = PGMShwModifyPage(pVM, pCtx->esp, 1, X86_PTE_RW, ~(uint64_t)X86_PTE_RW);
     
    59846009            if (rc == VINF_SUCCESS)
    59856010            {
    5986                 uint64_t fFlags;
    59876011
    59886012                /* The guest page *must* be present. */
     
    60416065        }
    60426066
    6043         *ppNewEip = pNewEip;
     6067        *ppNewEip = pNewEip - SELMToFlat(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid, 0);
    60446068        STAM_PROFILE_ADV_STOP(&pVM->patm.s.StatHandleTrap, a);
    60456069        return rc;
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