VirtualBox

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


Ignore:
Timestamp:
Oct 9, 2007 12:32:03 PM (17 years ago)
Author:
vboxsync
Message:

Experiment with call recording for CSAM

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

Legend:

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

    r4959 r5198  
    233233    pVM->csam.s.cDangerousInstr = 0;
    234234    pVM->csam.s.iDangerousInstr  = 0;
     235
     236    memset(pVM->csam.s.pvCallInstruction, 0, sizeof(pVM->csam.s.pvCallInstruction));
     237    pVM->csam.s.iCallInstruction = 0;
    235238
    236239    /** @note never mess with the pgdir bitmap here! */
     
    22482251
    22492252    if (cGates != 1)
     2253    {
    22502254        pVM->csam.s.fGatesChecked = true;
     2255        for (unsigned i=0;i<RT_ELEMENTS(pVM->csam.s.pvCallInstruction);i++)
     2256        {
     2257            RTGCPTR pHandler = pVM->csam.s.pvCallInstruction[i];
     2258            CSAMP2GLOOKUPREC cacheRec = {0};            /* Cache record for PATMGCVirtToHCVirt. */
     2259            PCSAMPAGE pPage = NULL;
     2260
     2261            Log(("CSAMCheckGates: checking previous call instruction %VGv\n", pHandler));
     2262            STAM_PROFILE_START(&pVM->csam.s.StatTime, a);
     2263            rc = csamAnalyseCodeStream(pVM, pHandler, pHandler, true, CSAMR3AnalyseCallback, pPage, &cacheRec);
     2264            STAM_PROFILE_STOP(&pVM->csam.s.StatTime, a);
     2265            if (rc != VINF_SUCCESS)
     2266            {
     2267                Log(("CSAMCheckGates: csamAnalyseCodeStream failed with %d\n", rc));
     2268                continue;
     2269            }
     2270        }
     2271    }
    22512272
    22522273    /* Determine valid upper boundary. */
     
    24122433
    24132434/**
     2435 * Record previous call instruction addresses
     2436 *
     2437 * @returns VBox status code.
     2438 * @param   pVM         The VM to operate on.
     2439 * @param   GCPtrCall   Call address
     2440 */
     2441CSAMR3DECL(int) CSAMR3RecordCallAddress(PVM pVM, RTGCPTR GCPtrCall)
     2442{
     2443    for (unsigned i=0;i<RT_ELEMENTS(pVM->csam.s.pvCallInstruction);i++)
     2444    {
     2445        if (pVM->csam.s.pvCallInstruction[i] == GCPtrCall)
     2446            return VINF_SUCCESS;
     2447    }
     2448
     2449    Log(("CSAMR3RecordCallAddress %VGv\n", GCPtrCall));
     2450
     2451    pVM->csam.s.pvCallInstruction[pVM->csam.s.iCallInstruction++] = GCPtrCall;
     2452    if (pVM->csam.s.iCallInstruction >= RT_ELEMENTS(pVM->csam.s.pvCallInstruction))
     2453        pVM->csam.s.iCallInstruction = 0;
     2454
     2455    return VINF_SUCCESS;
     2456}
     2457
     2458
     2459/**
    24142460 * Query CSAM state (enabled/disabled)
    24152461 *
  • trunk/src/VBox/VMM/PATM/CSAMInternal.h

    r4776 r5198  
    176176    uint32_t            cPossibleCodePages;
    177177    RTGCPTR             pvPossibleCodePage[CSAM_MAX_CODE_PAGES_FLUSH];
     178
     179    /* call addresses reported by the recompiler */
     180    RTGCPTR             pvCallInstruction[128];
     181    RTUINT              iCallInstruction;
    178182
    179183    /* Set when scanning has started. */
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