VirtualBox

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


Ignore:
Timestamp:
Oct 26, 2020 12:04:05 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141088
Message:

VMM/DBGF: Updates to the new breakpoint manager, L2 table management groundwork, bugref:9837

File:
1 edited

Legend:

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

    r86701 r86704  
    5656
    5757#ifdef VBOX_WITH_LOTS_OF_DBGF_BPS
    58 /** @name Breakpoint handling defines.
     58/** @name Global breakpoint table handling defines.
    5959 * @{ */
    6060/** Maximum number of breakpoints supported (power of two). */
     
    6666/** Number of chunks required to support all breakpoints. */
    6767#define DBGF_BP_CHUNK_COUNT                 (DBGF_BP_COUNT_MAX / DBGF_BP_COUNT_PER_CHUNK)
     68/** @} */
     69
     70/** @name L2 lookup table limit defines.
     71 * @{ */
     72/** Maximum number of entreis in the L2 lookup table. */
     73#define DBGF_BP_L2_TBL_ENTRY_COUNT_MAX      _512K
     74/** Number of L2 entries handled in one chunk. */
     75#define DBGF_BP_L2_TBL_ENTRIES_PER_CHUNK    _64K
     76/** Number of chunks required tp support all L2 lookup table entries. */
     77#define DBGF_BP_L2_TBL_CHUNK_COUNT          (DBGF_BP_L2_TBL_ENTRY_COUNT_MAX / DBGF_BP_L2_TBL_ENTRIES_PER_CHUNK)
    6878/** @} */
    6979#endif
     
    916926/** Pointer to a breakpoint table chunk - Ring-0 Ptr. */
    917927typedef R0PTRTYPE(DBGFBPCHUNKR0 *) PDBGFBPCHUNKR0;
     928
     929
     930/**
     931 * L2 lookup table entry.
     932 *
     933 * @remark The order of the members matters to be able to atomically update
     934 *         the AVL left/right pointers and depth with a single 64bit atomic write.
     935 * @verbatim
     936 *         7         6        5        4        3        2        1        0
     937 *     +--------+--------+--------+--------+--------+--------+--------+--------+
     938 *     |    hBp[15:0]    |                   GCPtrKey[63:16]                   |
     939 *     +--------+--------+--------+--------+--------+--------+--------+--------+
     940 *     | hBp[27:16] | iDepth |     idxRight[21:0]     |      idxLeft[21:0]     |
     941 *     +--------+--------+--------+--------+--------+--------+--------+--------+
     942 *                  \_8 bits_/
     943 * @endverbatim
     944 */
     945typedef struct DBGFBPL2ENTRY
     946{
     947    /** The upper 6 bytes of the breakpoint address and the low 16 bits of the breakpoint handle. */
     948    volatile uint64_t           u64GCPtrKeyAndBpHnd1;
     949    /** Left/right lower index, tree depth and remaining 12 bits of the breakpoint handle. */
     950    volatile uint64_t           u64LeftRightIdxDepthBpHnd2;
     951} DBGFBPL2ENTRY;
     952AssertCompileSize(DBGFBPL2ENTRY, 16);
     953/** Pointer to a L2 lookup table entry. */
     954typedef DBGFBPL2ENTRY *PDBGFBPL2ENTRY;
     955/** Pointer to a const L2 lookup table entry. */
     956typedef const DBGFBPL2ENTRY *PCDBGFBPL2ENTRY;
     957
     958/** An invalid breakpoint chunk ID. */
     959#define DBGF_BP_L2_IDX_CHUNK_ID_INVALID             UINT32_MAX
     960/** Generates a unique breakpoint handle from the given chunk ID and entry inside the chunk. */
     961#define DBGF_BP_L2_IDX_CREATE(a_idChunk, a_idEntry) RT_MAKE_U32(a_idEntry, a_idChunk);
     962/** Returns the chunk ID from the given breakpoint handle. */
     963#define DBGF_BP_L2_IDX_GET_CHUNK_ID(a_idxL2)        ((uint32_t)RT_HI_U16(a_idxL2))
     964/** Returns the entry index inside a chunk from the given breakpoint handle. */
     965#define DBGF_BP_L2_IDX_GET_ENTRY(a_idxL2)           ((uint32_t)RT_LO_U16(a_idxL2))
     966
     967/** Number of bits for the left/right index pointers. */
     968#define DBGF_BP_L2_ENTRY_LEFT_RIGHT_IDX_BITS            22
     969/** Index mask. */
     970#define DBGF_BP_L2_ENTRY_LEFT_RIGHT_IDX_MASK            (RT_BIT_32(DBGF_BP_L2_ENTRY_LEFT_RIGHT_IDX_BITS) - 1)
     971/** Returns the upper 6 bytes of the GC pointer from the given breakpoint entry. */
     972#define DBGF_BP_L2_ENTRY_GET_GCPTR(a_u64GCPtrKeyAndBpHnd1) ((a_u64GCPtrKeyAndBpHnd1) & UINT64_C(0x0000ffffffffffff))
     973/** Returns the breakpoint handle from both L2 entry members. */
     974#define DBGF_BP_L2_ENTRY_GET_BP_HND(a_u64GCPtrKeyAndBpHnd1, a_u64LeftRightIdxDepthBpHnd2) \
     975    ((DBGFBP)(((a_u64GCPtrKeyAndBpHnd1) >> 48) | (((a_u64LeftRightIdxDepthBpHnd2) >> 52) << 16)))
     976/** Extracts the depth of the second 64bit L2 entry value. */
     977#define DBGF_BP_L2_ENTRY_GET_DEPTH(a_u64LeftRightIdxDepthBpHnd2) ((uint8_t)(((a_u64LeftRightIdxDepthBpHnd2) >> 44) & UINT8_MAX))
     978/** Extracts the lower right index value from the L2 entry value. */
     979#define DBGF_BP_L2_ENTRY_GET_IDX_RIGHT(a_u64LeftRightIdxDepthBpHnd2) \
     980    ((uint32_t)(((a_u64LeftRightIdxDepthBpHnd2) >> 22) & DBGF_BP_L2_ENTRY_LEFT_RIGHT_IDX_MASK))
     981/** Extracts the lower left index value from the L2 entry value. */
     982#define DBGF_BP_L2_ENTRY_GET_IDX_LEFT(a_u64LeftRightIdxDepthBpHnd2) \
     983    ((uint32_t)((a_u64LeftRightIdxDepthBpHnd2) & DBGF_BP_L2_ENTRY_LEFT_RIGHT_IDX_MASK))
     984
     985
     986/**
     987 * A breakpoint L2 lookup table chunk, ring-3 state.
     988 */
     989typedef struct DBGFBPL2TBLCHUNKR3
     990{
     991    /** Pointer to the R3 base of the chunk. */
     992    R3PTRTYPE(PDBGFBPL2ENTRY)   pL2BaseR3;
     993    /** Bitmap of free/occupied breakpoint entries. */
     994    R3PTRTYPE(volatile void *)  pbmAlloc;
     995    /** Number of free entries in the chunk. */
     996    volatile uint32_t           cFree;
     997    /** The chunk index this tracking structure refers to. */
     998    uint32_t                    idChunk;
     999} DBGFBPL2TBLCHUNKR3;
     1000/** Pointer to a breakpoint L2 lookup table chunk - Ring-3 Ptr. */
     1001typedef DBGFBPL2TBLCHUNKR3 *PDBGFBPL2TBLCHUNKR3;
     1002/** Pointer to a const breakpoint L2 lookup table chunk - Ring-3 Ptr. */
     1003typedef const DBGFBPL2TBLCHUNKR3 *PCDBGFBPL2TBLCHUNKR3;
     1004
     1005
     1006/**
     1007 * Breakpoint L2 lookup table chunk, ring-0 state.
     1008 */
     1009typedef struct DBGFBPL2TBLCHUNKR0
     1010{
     1011    /** The chunks memory. */
     1012    RTR0MEMOBJ                  hMemObj;
     1013    /** The ring-3 mapping object. */
     1014    RTR0MEMOBJ                  hMapObj;
     1015    /** Pointer to the breakpoint entries base. */
     1016    R0PTRTYPE(PDBGFBPL2ENTRY)   paBpL2TblBaseSharedR0;
     1017} DBGFBPL2TBLCHUNKR0;
     1018/** Pointer to a breakpoint L2 lookup table chunk - Ring-0 Ptr. */
     1019typedef R0PTRTYPE(DBGFBPL2TBLCHUNKR0 *) PDBGFBPL2TBLCHUNKR0;
    9181020#endif
    9191021
     
    11581260    /** Global breakpoint table chunk array. */
    11591261    DBGFBPCHUNKR0                       aBpChunks[DBGF_BP_CHUNK_COUNT];
     1262    /** Breakpoint L2 lookup table chunk array. */
     1263    DBGFBPL2TBLCHUNKR0                  aBpL2TblChunks[DBGF_BP_L2_TBL_CHUNK_COUNT];
    11601264    /** The L1 lookup tables memory object. */
    11611265    RTR0MEMOBJ                          hMemObjBpLocL1;
     
    12471351    /** Global breakpoint table chunk array. */
    12481352    DBGFBPCHUNKR3                   aBpChunks[DBGF_BP_CHUNK_COUNT];
     1353    /** Breakpoint L2 lookup table chunk array. */
     1354    DBGFBPL2TBLCHUNKR3              aBpL2TblChunks[DBGF_BP_L2_TBL_CHUNK_COUNT];
    12491355    /** Base pointer to the L1 locator table. */
    12501356    R3PTRTYPE(volatile uint32_t *)  paBpLocL1R3;
     1357    /** Fast mutex protecting the L2 table from concurrent write accesses (EMTs
     1358     * can still do read accesses without holding it while traversing the trees). */
     1359    RTSEMFASTMUTEX                  hMtxBpL2Wr;
    12511360    /** @} */
    12521361#endif
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