VirtualBox

Changeset 108994 in vbox


Ignore:
Timestamp:
Apr 16, 2025 6:34:54 AM (4 days ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168517
Message:

VMM/TRPM: bugref:3409 Add TRPMGetTrapAll to allow fetching existing trap info without a failure path.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/trpm.h

    r106061 r108994  
    8484VMMDECL(int)        TRPMQueryTrapAll(PVMCPU pVCpu, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType, uint32_t *puErrorCode,
    8585                                     PRTGCUINTPTR puCR2, uint8_t *pcbInstr, bool *pfIcebp);
     86VMMDECL(uint8_t)    TRPMGetTrapAll(PVMCPU pVCpu, PTRPMEVENT pEnmType, uint32_t *puErrorCode, PRTGCUINTPTR puCR2,
     87                                   uint8_t *pcbInstr, bool *pfIcebp);
    8688
    8789#ifdef IN_RING3
  • trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp

    r106061 r108994  
    440440}
    441441
     442
     443/**
     444 * Gets all info about the current trap.
     445 * This must be used only when the caller has determined that a trap is active.
     446 *
     447 * @returns The active vector.
     448 * @param   pVCpu           The cross context virtual CPU structure.
     449 * @param   pEnmType        Where to store the trap type.
     450 * @param   puErrorCode     Where to store the error code associated with some
     451 *                          traps.
     452 * @param   puCR2           Where to store the CR2 associated with a trap 0E.
     453 * @param   pcbInstr        Where to store the instruction-length associated with
     454 *                          some traps. Optional, can be NULL.
     455 * @param   pfIcebp         Where to store whether the trap is a \#DB caused by an
     456 *                          INT1/ICEBP instruction. Optional, can be NULL.
     457 */
     458VMMDECL(uint8_t) TRPMGetTrapAll(PVMCPU pVCpu, TRPMEVENT *pEnmType, uint32_t *puErrorCode, PRTGCUINTPTR puCR2, uint8_t *pcbInstr,
     459                                bool *pfIcebp)
     460{
     461    Assert(pVCpu->trpm.s.uActiveVector != ~0U);
     462    Assert(pEnmType);
     463    Assert(puErrorCode);
     464    Assert(puCR2);
     465    *pEnmType    = pVCpu->trpm.s.enmActiveType;
     466    *puErrorCode = pVCpu->trpm.s.uActiveErrorCode;
     467    *puCR2       = pVCpu->trpm.s.uActiveCR2;
     468    if (pcbInstr)
     469        *pcbInstr = pVCpu->trpm.s.cbInstr;
     470    if (pfIcebp)
     471        *pfIcebp  = pVCpu->trpm.s.fIcebp;
     472    return pVCpu->trpm.s.uActiveVector;
     473}
     474
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