VirtualBox

Changeset 86699 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Oct 25, 2020 10:44:39 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141083
Message:

VMM/DBGF: Updates to the new breakpoint manager, implement global breakpoint table chunk allocation and register breakpoints which should work again, bugref:9837

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/DBGFInternal.h

    r86683 r86699  
    5454#define DBGF_TRACER_EVT_SZ               (DBGF_TRACER_EVT_HDR_SZ + DBGF_TRACER_EVT_PAYLOAD_SZ)
    5555
     56
     57#ifdef VBOX_WITH_LOTS_OF_DBGF_BPS
     58/** @name Breakpoint handling defines.
     59 * @{ */
     60/** Maximum number of breakpoints supported (power of two). */
     61#define DBGF_BP_COUNT_MAX                   _1M
     62/** Size of a single breakpoint structure in bytes. */
     63#define DBGF_BP_ENTRY_SZ                    64
     64/** Number of breakpoints handled in one chunk (power of two). */
     65#define DBGF_BP_COUNT_PER_CHUNK             _64K
     66/** Number of chunks required to support all breakpoints. */
     67#define DBGF_BP_CHUNK_COUNT                 (DBGF_BP_COUNT_MAX / DBGF_BP_COUNT_PER_CHUNK)
     68/** @} */
     69#endif
    5670
    5771
     
    763777typedef DBGFBPSEARCHOPT *PDBGFBPSEARCHOPT;
    764778#else
     779
     780/** An invalid breakpoint chunk ID. */
     781#define DBGF_BP_CHUNK_ID_INVALID                    UINT32_MAX
     782/** Generates a unique breakpoint handle from the given chunk ID and entry inside the chunk. */
     783#define DBGF_BP_HND_CREATE(a_idChunk, a_idEntry)    RT_MAKE_U32(a_idEntry, a_idChunk);
     784/** Returns the chunk ID from the given breakpoint handle. */
     785#define DBGF_BP_HND_GET_CHUNK_ID(a_hBp)             ((uint32_t)RT_HI_U16(a_hBp))
     786/** Returns the entry index inside a chunk from the given breakpoint handle. */
     787#define DBGF_BP_HND_GET_ENTRY(a_hBp)                ((uint32_t)RT_LO_U16(a_hBp))
     788
     789
     790/**
     791 * The internal breakpoint state, shared part.
     792 */
     793typedef struct DBGFBPINT
     794{
     795    /** The publicly visible part. */
     796    DBGFBPPUB                   Pub;
     797    /** The opaque user argument for the owner callback, Ring-3 Ptr. */
     798    R3PTRTYPE(void *)           pvUserR3;
     799} DBGFBPINT;
     800AssertCompileSize(DBGFBPINT, DBGF_BP_ENTRY_SZ);
     801/** Pointer to an internal breakpoint state. */
     802typedef DBGFBPINT *PDBGFBPINT;
     803/** Pointer to an const internal breakpoint state. */
     804typedef const DBGFBPINT *PCDBGFBPINT;
     805
     806
     807/**
     808 * The internal breakpoint state, R0 part.
     809 */
     810typedef struct DBGFBPINTR0
     811{
     812    /** The owner handle. */
     813    DBGFBPOWNER                 hOwner;
     814    /** Flag whether the breakpoint is in use. */
     815    bool                        fInUse;
     816    /** Padding to 8 byte alignment. */
     817    bool                        afPad[3];
     818    /** Opaque user data for the owner callback, Ring-0 Ptr. */
     819    R0PTRTYPE(void *)           pvUserR0;
     820} DBGFBPINTR0;
     821AssertCompileMemberAlignment(DBGFBPINTR0, pvUserR0, 8);
     822AssertCompileSize(DBGFBPINTR0, 16);
     823/** Pointer to an internal breakpoint state - Ring-0 Ptr. */
     824typedef R0PTRTYPE(DBGFBPINTR0 *) PDBGFBPINTR0;
     825
     826
    765827/**
    766828 * Hardware breakpoint state.
     
    769831{
    770832    /** The flat GC address of the breakpoint. */
    771     RTGCUINTPTR     GCPtr;
    772     /** The breakpoint handle if active, NIL_DBGFBP if disabled. */
    773     DBGFBP          hBp;
     833    RTGCUINTPTR                 GCPtr;
     834    /** The breakpoint handle if active, NIL_DBGFBP if not in use. */
     835    volatile DBGFBP             hBp;
    774836    /** The access type (one of the X86_DR7_RW_* value). */
    775     uint8_t         fType;
     837    uint8_t                     fType;
    776838    /** The access size. */
    777     uint8_t         cb;
     839    uint8_t                     cb;
    778840    /** Flag whether the breakpoint is currently enabled. */
    779     bool            fEnabled;
     841    volatile bool               fEnabled;
    780842    /** Padding. */
    781     uint8_t         bPad;
     843    uint8_t                     bPad;
    782844} DBGFBPHW;
    783845AssertCompileSize(DBGFBPHW, 16);
     
    786848/** Pointer to a const hardware breakpoint state. */
    787849typedef const DBGFBPHW *PCDBGFBPHW;
     850
     851
     852/**
     853 * A breakpoint table chunk, ring-3 state.
     854 */
     855typedef struct DBGFBPCHUNKR3
     856{
     857    /** Pointer to the R3 base of the chunk. */
     858    R3PTRTYPE(PDBGFBPINT)       pBpBaseR3;
     859    /** Bitmap of free/occupied breakpoint entries. */
     860    R3PTRTYPE(volatile void *)  pbmAlloc;
     861    /** Number of free breakpoints in the chunk. */
     862    volatile uint32_t           cBpsFree;
     863    /** The chunk index this tracking structure refers to. */
     864    uint32_t                    idChunk;
     865} DBGFBPCHUNKR3;
     866/** Pointer to a breakpoint table chunk - Ring-3 Ptr. */
     867typedef DBGFBPCHUNKR3 *PDBGFBPCHUNKR3;
     868/** Pointer to a const breakpoint table chunk - Ring-3 Ptr. */
     869typedef const DBGFBPCHUNKR3 *PCDBGFBPCHUNKR3;
     870
     871
     872/**
     873 * Breakpoint table chunk, ring-0 state.
     874 */
     875typedef struct DBGFBPCHUNKR0
     876{
     877    /** The chunks memory. */
     878    RTR0MEMOBJ                  hMemObj;
     879    /** The ring-3 mapping object. */
     880    RTR0MEMOBJ                  hMapObj;
     881    /** Pointer to the breakpoint entries base. */
     882    R0PTRTYPE(PDBGFBPINT)       paBpBaseSharedR0;
     883    /** Pointer to the Ring-0 only part of the breakpoints. */
     884    PDBGFBPINTR0                paBpBaseR0Only;
     885} DBGFBPCHUNKR0;
     886/** Pointer to a breakpoint table chunk - Ring-0 Ptr. */
     887typedef R0PTRTYPE(DBGFBPCHUNKR0 *) PDBGFBPCHUNKR0;
    788888#endif
    789889
     
    875975    DBGFBPSEARCHOPT             Int3;
    876976#else
     977    /** @name Breakpoint handling related state.
     978     * @{ */
    877979    /** Array of hardware breakpoints (0..3).
    878980     * This is shared among all the CPUs because life is much simpler that way. */
    879     DBGFBPHW                    aHwBreakpoints[4];
     981    DBGFBPHW                        aHwBreakpoints[4];
     982    /** @} */
    880983#endif
    881984
     
    10171120    /** Pointer to the tracer instance if enabled. */
    10181121    R0PTRTYPE(struct DBGFTRACERINSR0 *) pTracerR0;
     1122
     1123#ifdef VBOX_WITH_LOTS_OF_DBGF_BPS
     1124    /** @name Breakpoint handling related state, Ring-0 only part.
     1125     * @{ */
     1126    /** Global breakpoint table chunk array. */
     1127    DBGFBPCHUNKR0                       aBpChunks[DBGF_BP_CHUNK_COUNT];
     1128    /** The L1 lookup tables memory object. */
     1129    RTR0MEMOBJ                          hMemObjBpLocL1;
     1130    /** The L1 lookup tables mapping object. */
     1131    RTR0MEMOBJ                          hMapObjBpLocL1;
     1132    /** Base pointer to the L1 locator table. */
     1133    R0PTRTYPE(volatile uint32_t *)      paBpLocL1R0;
     1134    /** Flag whether the breakpoint manager was initialized (on demand). */
     1135    bool                                fInit;
     1136    /** @} */
     1137#endif
    10191138} DBGFR0PERVM;
    10201139
     
    10911210    /** @} */
    10921211
     1212#ifdef VBOX_WITH_LOTS_OF_DBGF_BPS
     1213    /** @name Breakpoint handling related state.
     1214     * @{ */
     1215    /** Global breakpoint table chunk array. */
     1216    DBGFBPCHUNKR3                   aBpChunks[DBGF_BP_CHUNK_COUNT];
     1217    /** Base pointer to the L1 locator table. */
     1218    R3PTRTYPE(volatile uint32_t *)  paBpLocL1R3;
     1219    /** @} */
     1220#endif
     1221
    10931222    /** The type database lock. */
    10941223    RTSEMRW                     hTypeDbLock;
     
    11381267void dbgfR3AsRelocate(PUVM pUVM, RTGCUINTPTR offDelta);
    11391268#ifdef VBOX_WITH_LOTS_OF_DBGF_BPS
    1140 DECLHIDDEN(int) dbgfR3BpInit(PVM pVM);
    1141 DECLHIDDEN(int) dbgfR3BpTerm(PVM pVM);
     1269DECLHIDDEN(int) dbgfR3BpInit(PUVM pUVM);
     1270DECLHIDDEN(int) dbgfR3BpTerm(PUVM pUVM);
    11421271#else
    11431272int  dbgfR3BpInit(PVM pVM);
     
    11881317#ifdef IN_RING0
    11891318DECLHIDDEN(void) dbgfR0TracerDestroy(PGVM pGVM, PDBGFTRACERINSR0 pTracer);
     1319DECLHIDDEN(void) dbgfR0BpInit(PGVM pGVM);
     1320DECLHIDDEN(void) dbgfR0BpDestroy(PGVM pGVM);
    11901321#endif /* !IN_RING0 */
    11911322
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