VirtualBox

Changeset 2555 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 9, 2007 12:58:47 PM (18 years ago)
Author:
vboxsync
Message:

Added intercept code for rdtsc (not yet enabled).

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

Legend:

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

    r2237 r2555  
    184184    STAM_REG(pVM, &pVM->hwaccm.s.StatExitInvd,      STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Invd",        STAMUNIT_OCCURENCES,    "Nr of occurances");
    185185    STAM_REG(pVM, &pVM->hwaccm.s.StatExitCpuid,     STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Cpuid",       STAMUNIT_OCCURENCES,    "Nr of occurances");
     186    STAM_REG(pVM, &pVM->hwaccm.s.StatExitRdtsc,     STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/Rdtsc",       STAMUNIT_OCCURENCES,    "Nr of occurances");
    186187    STAM_REG(pVM, &pVM->hwaccm.s.StatExitCRxWrite,  STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Write",   STAMUNIT_OCCURENCES,    "Nr of occurances");
    187188    STAM_REG(pVM, &pVM->hwaccm.s.StatExitCRxRead,   STAMTYPE_COUNTER, "/HWACCM/Exit/Instr/CRx/Read",    STAMUNIT_OCCURENCES,    "Nr of occurances");
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r2213 r2555  
    268268    STAMCOUNTER             StatExitInvd;
    269269    STAMCOUNTER             StatExitCpuid;
     270    STAMCOUNTER             StatExitRdtsc;
    270271    STAMCOUNTER             StatExitCRxWrite;
    271272    STAMCOUNTER             StatExitCRxRead;
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r2506 r2555  
    10571057    }
    10581058
     1059    case SVM_EXIT_RDTSC:                /* Guest software attempted to execute RDTSC. */
     1060    {
     1061        Log2(("SVM: Rdtsc\n"));
     1062        STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitRdtsc);
     1063        rc = EMInterpretRdtsc(pVM, CPUMCTX2CORE(pCtx));
     1064        if (rc == VINF_SUCCESS)
     1065        {
     1066            /* Update EIP and continue execution. */
     1067            pCtx->eip += 2;             /** @note hardcoded opcode size! */
     1068            STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1069            goto ResumeExecution;
     1070        }
     1071        AssertMsgFailed(("EMU: rdtsc failed with %Vrc\n", rc));
     1072        rc = VINF_EM_RAW_EMULATE_INSTR;
     1073        break;
     1074    }
     1075
    10591076    case SVM_EXIT_INVLPG:               /* Guest software attempted to execute INVPG. */
    10601077    {
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r2506 r2555  
    14111411        {
    14121412            /* Update EIP and continue execution. */
     1413            Assert(cbInstr == 2);
    14131414            pCtx->eip += cbInstr;
    14141415            STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     
    14161417        }
    14171418        AssertMsgFailed(("EMU: cpuid failed with %Vrc\n", rc));
     1419        rc = VINF_EM_RAW_EMULATE_INSTR;
     1420        break;
     1421    }
     1422
     1423    case VMX_EXIT_RDTSC:                /* 16 Guest software attempted to execute RDTSC. */
     1424    {
     1425        Log2(("VMX: Rdtsc\n"));
     1426        STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitRdtsc);
     1427        rc = EMInterpretRdtsc(pVM, CPUMCTX2CORE(pCtx));
     1428        if (rc == VINF_SUCCESS)
     1429        {
     1430            /* Update EIP and continue execution. */
     1431            Assert(cbInstr == 2);
     1432            pCtx->eip += cbInstr;
     1433            STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1434            goto ResumeExecution;
     1435        }
     1436        AssertMsgFailed(("EMU: rdtsc failed with %Vrc\n", rc));
    14181437        rc = VINF_EM_RAW_EMULATE_INSTR;
    14191438        break;
     
    16861705        break;
    16871706
    1688     case VMX_EXIT_RDTSC:                /* 16 Guest software attempted to execute RDTSC. */
    1689         rc = VERR_EM_INTERNAL_ERROR;
    1690         AssertFailed(); /* we don't let it fault. */
    1691         break;
    1692 
    16931707    case VMX_EXIT_RSM:                  /* 17 Guest software attempted to execute RSM in SMM. */
    16941708        AssertFailed(); /* can't happen. */
     
    17111725
    17121726    case VMX_EXIT_CPUID:                /* 10 Guest software attempted to execute CPUID. */
     1727    case VMX_EXIT_RDTSC:                /* 16 Guest software attempted to execute RDTSC. */
    17131728    case VMX_EXIT_INVPG:                /* 14 Guest software attempted to execute INVPG. */
    17141729    case VMX_EXIT_CRX_MOVE:             /* 28 Control-register accesses. */
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