VirtualBox

Changeset 72559 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 15, 2018 9:52:18 AM (7 years ago)
Author:
vboxsync
Message:

EM,TRPM: Record raw-mode traps (no timestamps). bugref:9044

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r72555 r72559  
    437437    return EMEXITACTION_NORMAL;
    438438}
     439
     440
     441#ifdef IN_RC
     442/**
     443 * Special raw-mode interface for adding an exit to the history.
     444 *
     445 * Currently this is only for recording, not optimizing, so no return value.  If
     446 * we start seriously caring about raw-mode again, we may extend it.
     447 *
     448 * @param   pVCpu           The corss context virtual CPU structure.
     449 * @param   uFlagsAndType   Combined flags and type (see EMEXIT_MAKE_FLAGS_AND_TYPE).
     450 * @param   uCs             The CS.
     451 * @param   uEip            The EIP.
     452 * @thread  EMT(0)
     453 */
     454VMMRC_INT_DECL(void) EMRCHistoryAddExitNoTs(PVMCPU pVCpu, uint32_t uFlagsAndType, uint16_t uCs, uint32_t uEip)
     455{
     456    AssertCompile(RT_ELEMENTS(pVCpu->em.s.aExitHistory) == 256);
     457    PEMEXITENTRY pHistEntry = &pVCpu->em.s.aExitHistory[(uintptr_t)(pVCpu->em.s.iNextExit++) & 0xff];
     458    pHistEntry->uFlatPC       = ((uint64_t)uCs << 32) |  uEip;
     459    pHistEntry->uTimestamp    = 0;
     460    pHistEntry->uFlagsAndType = uFlagsAndType | EMEXIT_F_CS_EIP;
     461    pHistEntry->idxSlot       = UINT32_MAX;
     462}
     463#endif
    439464
    440465
  • trunk/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp

    r72254 r72559  
    333333    LogFlow(("TRPMGC01: cs:eip=%04x:%08x uDr6=%RTreg EFL=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, uDr6, CPUMRawGetEFlags(pVCpu)));
    334334    TRPM_ENTER_DBG_HOOK(1);
     335    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_DB), pRegFrame->cs.Sel, pRegFrame->eip);
    335336
    336337    /*
     
    386387    PVMCPU      pVCpu = TRPMCPU_2_VMCPU(pTrpmCpu);
    387388    TRPM_ENTER_DBG_HOOK_HYPER(1);
     389    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_DB), pRegFrame->cs.Sel, pRegFrame->eip);
    388390    LogFlow(("TRPMGCHyper01: cs:eip=%04x:%08x uDr6=%RTreg\n", pRegFrame->cs.Sel, pRegFrame->eip, uDr6));
    389391
     
    426428{
    427429    LogFlow(("TRPMGCTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip));
     430    EMRCHistoryAddExitNoTs(TRPMCPU_2_VMCPU(pTrpmCpu), EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_NMI),
     431                           pRegFrame->cs.Sel, pRegFrame->eip);
    428432#if 0 /* Enable this iff you have a COM port and really want this debug info. */
    429433    RTLogComPrintf("TRPMGCTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip);
     
    452456{
    453457    LogFlow(("TRPMGCHyperTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip));
     458    EMRCHistoryAddExitNoTs(TRPMCPU_2_VMCPU(pTrpmCpu), EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_NMI),
     459                           pRegFrame->cs.Sel, pRegFrame->eip);
    454460#if 0 /* Enable this iff you have a COM port and really want this debug info. */
    455461    RTLogComPrintf("TRPMGCHyperTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs.Sel, pRegFrame->eip);
     
    478484    LogFlow(("TRPMGC03: %04x:%08x EFL=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, CPUMRawGetEFlags(pVCpu)));
    479485    TRPM_ENTER_DBG_HOOK(3);
     486    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_BP), pRegFrame->cs.Sel, pRegFrame->eip);
    480487    PGMRZDynMapStartAutoSet(pVCpu);
    481488
     
    530537    LogFlow(("TRPMGCHyper03: %04x:%08x EFL=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, CPUMRawGetEFlags(pVCpu)));
    531538    TRPM_ENTER_DBG_HOOK_HYPER(3);
     539    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_BP), pRegFrame->cs.Sel, pRegFrame->eip);
    532540
    533541    /*
     
    561569    LogFlow(("TRPMGC06: %04x:%08x EFL=%#x/%#x\n", pRegFrame->cs.Sel, pRegFrame->eip, pRegFrame->eflags.u32, CPUMRawGetEFlags(pVCpu)));
    562570    TRPM_ENTER_DBG_HOOK(6);
     571    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_UD), pRegFrame->cs.Sel, pRegFrame->eip);
    563572    PGMRZDynMapStartAutoSet(pVCpu);
    564573
     
    697706    LogFlow(("TRPMGC07: %04x:%08x EFL=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, CPUMRawGetEFlags(pVCpu)));
    698707    TRPM_ENTER_DBG_HOOK(7);
     708    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_NM), pRegFrame->cs.Sel, pRegFrame->eip);
    699709    PGMRZDynMapStartAutoSet(pVCpu);
    700710
     
    723733    LogFlow(("TRPMGC0b: %04x:%08x EFL=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, CPUMRawGetEFlags(pVCpu)));
    724734    TRPM_ENTER_DBG_HOOK(0xb);
     735    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_NP), pRegFrame->cs.Sel, pRegFrame->eip);
    725736    PGMRZDynMapStartAutoSet(pVCpu);
    726737
     
    11841195    LogFlow(("TRPMGC0d: %04x:%08x err=%x EFL=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, (uint32_t)pVCpu->trpm.s.uActiveErrorCode, CPUMRawGetEFlags(pVCpu)));
    11851196    TRPM_ENTER_DBG_HOOK(0xd);
     1197    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_GP), pRegFrame->cs.Sel, pRegFrame->eip);
    11861198
    11871199    PGMRZDynMapStartAutoSet(pVCpu);
     
    12491261    LogFlow(("TRPMGC0e: %04x:%08x err=%x cr2=%08x EFL=%x\n", pRegFrame->cs.Sel, pRegFrame->eip, (uint32_t)pVCpu->trpm.s.uActiveErrorCode, (uint32_t)pVCpu->trpm.s.uActiveCR2, CPUMRawGetEFlags(pVCpu)));
    12501262    TRPM_ENTER_DBG_HOOK(0xe);
     1263    EMRCHistoryAddExitNoTs(pVCpu, EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_PF), pRegFrame->cs.Sel, pRegFrame->eip);
    12511264
    12521265    /*
     
    13641377DECLASM(int) TRPMGCHyperTrap0bHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame)
    13651378{
     1379    EMRCHistoryAddExitNoTs(TRPMCPU_2_VMCPU(pTrpmCpu), EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_NP),
     1380                           pRegFrame->cs.Sel, pRegFrame->eip);
    13661381    return trpmGCHyperGeneric(TRPMCPU_2_VM(pTrpmCpu), pRegFrame, g_aTrap0bHandlers, g_aTrap0bHandlersEnd);
    13671382}
     
    13831398DECLASM(int) TRPMGCHyperTrap0dHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame)
    13841399{
     1400    EMRCHistoryAddExitNoTs(TRPMCPU_2_VMCPU(pTrpmCpu), EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_GP),
     1401                           pRegFrame->cs.Sel, pRegFrame->eip);
    13851402    return trpmGCHyperGeneric(TRPMCPU_2_VM(pTrpmCpu), pRegFrame, g_aTrap0dHandlers, g_aTrap0dHandlersEnd);
    13861403}
     
    14021419DECLASM(int) TRPMGCHyperTrap0eHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame)
    14031420{
     1421    EMRCHistoryAddExitNoTs(TRPMCPU_2_VMCPU(pTrpmCpu), EMEXIT_MAKE_FLAGS_AND_TYPE(EMEXIT_F_KIND_XCPT, X86_XCPT_PF),
     1422                           pRegFrame->cs.Sel, pRegFrame->eip);
    14041423    return trpmGCHyperGeneric(TRPMCPU_2_VM(pTrpmCpu), pRegFrame, g_aTrap0dHandlers, g_aTrap0dHandlersEnd);
    14051424}
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