VirtualBox

Changeset 882 in vbox


Ignore:
Timestamp:
Feb 13, 2007 5:26:15 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18594
Message:

CSAMR3CheckCode added

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

Legend:

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

    r880 r882  
    15151515        &&  pCtx->eflags.Bits.u1VM == 0)
    15161516    {
    1517         RTGCPTR pInstrGC;
    15181517        Assert(!PATMIsPatchGCAddr(pVM, pCtx->eip));
    1519 
    1520         pInstrGC = SELMToFlat(pVM, pCtx->cs, &pCtx->csHid, (RTGCPTR)pCtx->eip);
    1521 
    1522         CSAMR3CheckEIP(pVM, pInstrGC, SELMIsSelector32Bit(pVM, pCtx->cs, &pCtx->csHid));
     1518        CSAMR3CheckCode(pVM, pCtx, pCtx->eip);
    15231519    }
    15241520
     
    24862482        {
    24872483            STAM_PROFILE_ADV_SUSPEND(&pVM->em.s.StatRAWEntry, b);
    2488             CSAMR3CheckEIP(pVM, pCtx->eip, SELMIsSelector32Bit(pVM, pCtx->cs, &pCtx->csHid));
     2484            CSAMR3CheckCode(pVM, pCtx, pCtx->eip);
    24892485            STAM_PROFILE_ADV_RESUME(&pVM->em.s.StatRAWEntry, b);
    24902486        }
     
    30213017        if (VM_FF_ISSET(pVM, VM_FF_CSAM_SCAN_PAGE))
    30223018        {
     3019            PCPUMCTX pCtx = pVM->em.s.pCtx;
     3020
    30233021            /** @todo: check for 16 or 32 bits code! (D bit in the code selector) */
    30243022            Log(("Forced action VM_FF_CSAM_SCAN_PAGE\n"));
    3025             CSAMR3CheckEIP(pVM, CPUMGetGuestEIP(pVM), true);
     3023
     3024            CSAMR3CheckCode(pVM, pCtx, pCtx->eip);
    30263025            VM_FF_CLEAR(pVM, VM_FF_CSAM_SCAN_PAGE);
    30273026        }
  • trunk/src/VBox/VMM/PATM/CSAM.cpp

    r846 r882  
    20282028
    20292029/**
    2030  * Scan and analyse code starting at specified EIP
    2031  *
    2032  * @returns VBox status code. (trap handled or not)
     2030 * Scan and analyse code
     2031 *
     2032 * @returns VBox status code.
    20332033 * @param   pVM         The VM to operate on.
    2034  * @param   pEip        Instruction pointer
    2035  * @param   fCode32     16 of 32 bits code
    2036  */
    2037 CSAMR3DECL(int) CSAMR3CheckEIP(PVM pVM, RTGCPTR pEip, bool fCode32)
     2034 * @param   pCtx        CPU context
     2035 * @param   pInstrGC    Instruction pointer
     2036 */
     2037CSAMR3DECL(int) CSAMR3CheckCode(PVM pVM, PCPUMCTX pCtx, RTGCPTR pInstrGC)
    20382038{
    20392039    int rc;
    20402040    PCSAMPAGE pPage = NULL;
    20412041
    2042     if (EMIsRawRing0Enabled(pVM) == false || PATMIsPatchGCAddr(pVM, pEip) == true)
     2042    if (EMIsRawRing0Enabled(pVM) == false || PATMIsPatchGCAddr(pVM, pInstrGC) == true)
    20432043    {
    20442044        // No use
     
    20502050        // Cache record for PATMGCVirtToHCVirt
    20512051        CSAMP2GLOOKUPREC cacheRec = {0};
     2052        bool fCode32 = SELMIsSelector32Bit(pVM, pCtx->cs, &pCtx->csHid);
    20522053
    20532054        //assuming 32 bits code for now
    20542055        Assert(fCode32);
    20552056
     2057        pInstrGC = SELMToFlat(pVM, pCtx->cs, &pCtx->csHid, pInstrGC);
     2058
    20562059        STAM_PROFILE_START(&pVM->csam.s.StatTime, a);
    2057         rc = csamAnalyseCallCodeStream(pVM, pEip, pEip, fCode32, CSAMR3AnalyseCallback, pPage, &cacheRec);
     2060        rc = csamAnalyseCallCodeStream(pVM, pInstrGC, pInstrGC, fCode32, CSAMR3AnalyseCallback, pPage, &cacheRec);
    20582061        STAM_PROFILE_STOP(&pVM->csam.s.StatTime, a);
    20592062        if (rc != VINF_SUCCESS)
     
    20612064            Log(("csamAnalyseCodeStream failed with %d\n", rc));
    20622065            return rc;
    2063         }
    2064         else
    2065         {
    2066     //        Log(("CSAMR3CheckEIP: already scanned page at %VGv\n", pEip));
    20672066        }
    20682067    }
  • trunk/src/VBox/VMM/PATM/PATM.cpp

    r838 r882  
    39093909{
    39103910    DISCPUSTATE cpu;
     3911    PCPUMCTX    pCtx;
    39113912    HCPTRTYPE(uint8_t *) pInstrHC;
    39123913    uint32_t opsize;
     
    39243925        return VERR_PATCHING_REFUSED;
    39253926
     3927    CPUMQueryGuestCtxPtr(pVM, &pCtx);
     3928
    39263929    /* Test for patch conflict only with patches that actually change guest code. */
    39273930    if (!(flags & (PATMFL_GUEST_SPECIFIC|PATMFL_IDTHANDLER|PATMFL_INTHANDLER|PATMFL_TRAMPOLINE)))
     
    39483951    {
    39493952        /* New code. Make sure CSAM has a go at it first. */
    3950         CSAMR3CheckEIP(pVM, pInstrGC, !!(flags & PATMFL_CODE32));
     3953        CSAMR3CheckCode(pVM, pCtx, pInstrGC);
    39513954    }
    39523955
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette