VirtualBox

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


Ignore:
Timestamp:
Oct 23, 2023 12:50:37 AM (15 months ago)
Author:
vboxsync
Message:

VMM/IEM: More TB disassembly and TB debuginfo. bugref:10371

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

Legend:

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

    r101543 r101547  
    879879{
    880880    kIemTbDbgEntryType_Invalid = 0,
     881    /** The entry is for marking a native code position.
     882     * Entries following this all apply to this position. */
     883    kIemTbDbgEntryType_NativeOffset,
    881884    /** The entry is for a new guest instruction. */
    882885    kIemTbDbgEntryType_GuestInstruction,
    883     /** Marks the start of a native call. */
    884     kIemTbDbgEntryType_ThreadedCall1,
    885     /** 2nd entry for the start of a native call. */
    886     kIemTbDbgEntryType_ThreadedCall2,
     886    /** Marks the start of a threaded call. */
     887    kIemTbDbgEntryType_ThreadedCall,
     888    /** Marks the location of a label. */
     889    kIemTbDbgEntryType_Label,
    887890    /** Info about a host register shadowing a guest register. */
    888     kIemTbDbgEntryType_GuestRegShadow,
     891    kIemTbDbgEntryType_GuestRegShadowing,
    889892    kIemTbDbgEntryType_End
    890893} IEMTBDBGENTRYTYPE;
     
    908911    struct
    909912    {
    910         /** kIemTbDbgEntryType_GuestInstruction. */
    911         uint32_t    uType      : 4;
    912         /** Index into IEMTB::aRanges. */
    913         uint32_t    idxRange   : 4;
    914         /** Offset relative to the start of the range. */
    915         uint32_t    offOpcodes : 12;
    916         /** Number of opcode bytes for the instruction. */
    917         uint32_t    cbOpcodes  : 4;
    918         /** Basic CPU mode for the disassembler (low 8 bits IEM_F_XXX). */
    919         uint32_t    fCpuMode   : 8;
    920     } GuestInstruction;
    921 
    922     struct
    923     {
    924913        /** kIemTbDbgEntryType_ThreadedCall1. */
    925914        uint32_t    uType      : 4;
    926915        /** Native code offset. */
    927916        uint32_t    offNative  : 28;
    928     } ThreadedCall1;
     917    } NativeOffset;
    929918
    930919    struct
    931920    {
    932         /* kIemTbDbgEntryType_ThreadedCall2. */
     921        /** kIemTbDbgEntryType_GuestInstruction. */
    933922        uint32_t    uType      : 4;
     923        uint32_t    uUnused    : 4;
     924        /** The IEM_F_XXX flags. */
     925        uint32_t    fExec      : 24;
     926    } GuestInstruction;
     927
     928    struct
     929    {
     930        /* kIemTbDbgEntryType_ThreadedCall. */
     931        uint32_t    uType      : 4;
     932        uint32_t    uUnused    : 12;
    934933        /** The threaded call number (IEMTHREADEDFUNCS). */
    935934        uint32_t    enmCall    : 16;
    936     } ThreadedCall2;
     935    } ThreadedCall;
    937936
    938937    struct
    939938    {
    940         /* kIemTbDbgEntryType_GuestRegShadow. */
     939        /* kIemTbDbgEntryType_Label. */
    941940        uint32_t    uType      : 4;
    942         uint32_t    uPadding   : 4;
    943         /** The host register number. */
    944         uint32_t    idxHstReg  : 8;
     941        uint32_t    uUnused    : 4;
     942        /** The label type (IEMNATIVELABELTYPE).   */
     943        uint32_t    enmLabel   : 8;
     944        /** The label data. */
     945        uint32_t    uData      : 16;
     946    } Label;
     947
     948    struct
     949    {
     950        /* kIemTbDbgEntryType_GuestRegShadowing. */
     951        uint32_t    uType         : 4;
     952        uint32_t    uUnused       : 4;
    945953        /** The guest register being shadowed (IEMNATIVEGSTREG). */
    946         uint32_t    idxGstReg  : 8;
    947         uint32_t    uUnused    : 8;
    948     } GuestRegShadow;
     954        uint32_t    idxGstReg     : 8;
     955        /** The host new register number, UINT8_MAX if dropped. */
     956        uint32_t    idxHstReg     : 8;
     957        /** The previous host register number, UINT8_MAX if new.   */
     958        uint32_t    idxHstRegPrev : 8;
     959    } GuestRegShadowing;
    949960} IEMTBDBGENTRY;
    950961AssertCompileSize(IEMTBDBGENTRY, sizeof(uint32_t));
     962/** Pointer to a debug info entry. */
     963typedef IEMTBDBGENTRY *PIEMTBDBGENTRY;
     964/** Pointer to a const debug info entry. */
     965typedef IEMTBDBGENTRY const *PCIEMTBDBGENTRY;
    951966
    952967/**
     
    957972    /** Number of entries in aEntries. */
    958973    uint32_t        cEntries;
    959     /** Number of entries we've allocated. */
    960     uint32_t        cAllocated;
    961974    /** Debug info entries. */
    962975    RT_FLEXIBLE_ARRAY_EXTENSION
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r101537 r101547  
    3737 * @{
    3838 */
     39
     40/** @def IEMNATIVE_WITH_TB_DEBUG_INFO
     41 * Enables generating internal debug info for better TB disassembly dumping. */
     42#if defined(DEBUG) || defined(DOXYGEN_RUNNING)
     43# define IEMNATIVE_WITH_TB_DEBUG_INFO
     44#endif
     45
    3946
    4047/** @name Stack Frame Layout
     
    518525    PIEMNATIVEFIXUP             paFixups;
    519526
     527#ifdef IEMNATIVE_WITH_TB_DEBUG_INFO
     528    /** Number of debug info entries allocated for pDbgInfo. */
     529    uint32_t                    cDbgInfoAlloc;
     530    uint32_t                    uPadding;
     531    /** Debug info. */
     532    PIEMTBDBG                   pDbgInfo;
     533#else
     534    uint32_t                    abPadding1[2];
     535    uintptr_t                   uPtrPadding2;
     536#endif
     537
    520538    /** The translation block being recompiled. */
    521539    PCIEMTB                     pTbOrg;
     
    586604
    587605
    588 DECLHIDDEN(uint32_t)        iemNativeMakeLabel(PIEMRECOMPILERSTATE pReNative, IEMNATIVELABELTYPE enmType,
    589                                                uint32_t offWhere = UINT32_MAX, uint16_t uData = 0) RT_NOEXCEPT;
     606DECLHIDDEN(uint32_t)        iemNativeLabelCreate(PIEMRECOMPILERSTATE pReNative, IEMNATIVELABELTYPE enmType,
     607                                                 uint32_t offWhere = UINT32_MAX, uint16_t uData = 0) RT_NOEXCEPT;
     608DECLHIDDEN(void)            iemNativeLabelDefine(PIEMRECOMPILERSTATE pReNative, uint32_t idxLabel, uint32_t offWhere) RT_NOEXCEPT;
    590609DECLHIDDEN(bool)            iemNativeAddFixup(PIEMRECOMPILERSTATE pReNative, uint32_t offWhere, uint32_t idxLabel,
    591610                                              IEMNATIVEFIXUPTYPE enmType, int8_t offAddend = 0) RT_NOEXCEPT;
     
    17621781            pbCodeBuf[off++] = 0xeb;                /* jmp rel8 */
    17631782            pbCodeBuf[off++] = (uint8_t)offRel;
    1764             off++;
    17651783        }
    17661784        else
     
    18101828                                                IEMNATIVELABELTYPE enmLabelType, uint16_t uData = 0)
    18111829{
    1812     uint32_t const idxLabel = iemNativeMakeLabel(pReNative, enmLabelType, UINT32_MAX /*offWhere*/, uData);
     1830    uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmLabelType, UINT32_MAX /*offWhere*/, uData);
    18131831    AssertReturn(idxLabel != UINT32_MAX, UINT32_MAX);
    18141832    return iemNativeEmitJmpToLabel(pReNative, off, idxLabel);
     
    18831901                                                IEMNATIVELABELTYPE enmLabelType, uint16_t uData, IEMNATIVEINSTRCOND enmCond)
    18841902{
    1885     uint32_t const idxLabel = iemNativeMakeLabel(pReNative, enmLabelType, UINT32_MAX /*offWhere*/, uData);
     1903    uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmLabelType, UINT32_MAX /*offWhere*/, uData);
    18861904    AssertReturn(idxLabel != UINT32_MAX, UINT32_MAX);
    18871905    return iemNativeEmitJccToLabel(pReNative, off, idxLabel, enmCond);
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