VirtualBox

Ignore:
Timestamp:
Oct 1, 2024 12:57:32 PM (4 months ago)
Author:
vboxsync
Message:

VMM/IEM: Added some basic stats & debug info for postponed EFLAGS calcs. Moved debug info structures from IEMInternal.h and into IEMN8veRecompiler.h. bugref:10720

File:
1 edited

Legend:

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

    r106187 r106192  
    12321232
    12331233/**
     1234 * Translation block debug info entry type.
     1235 */
     1236typedef enum IEMTBDBGENTRYTYPE
     1237{
     1238    kIemTbDbgEntryType_Invalid = 0,
     1239    /** The entry is for marking a native code position.
     1240     * Entries following this all apply to this position. */
     1241    kIemTbDbgEntryType_NativeOffset,
     1242    /** The entry is for a new guest instruction. */
     1243    kIemTbDbgEntryType_GuestInstruction,
     1244    /** Marks the start of a threaded call. */
     1245    kIemTbDbgEntryType_ThreadedCall,
     1246    /** Marks the location of a label. */
     1247    kIemTbDbgEntryType_Label,
     1248    /** Info about a host register shadowing a guest register. */
     1249    kIemTbDbgEntryType_GuestRegShadowing,
     1250#ifdef IEMNATIVE_WITH_SIMD_REG_ALLOCATOR
     1251    /** Info about a host SIMD register shadowing a guest SIMD register. */
     1252    kIemTbDbgEntryType_GuestSimdRegShadowing,
     1253#endif
     1254#ifdef IEMNATIVE_WITH_DELAYED_PC_UPDATING
     1255    /** Info about a delayed RIP update. */
     1256    kIemTbDbgEntryType_DelayedPcUpdate,
     1257#endif
     1258#if defined(IEMNATIVE_WITH_DELAYED_REGISTER_WRITEBACK) || defined(IEMNATIVE_WITH_SIMD_REG_ALLOCATOR)
     1259    /** Info about a shadowed guest register becoming dirty. */
     1260    kIemTbDbgEntryType_GuestRegDirty,
     1261    /** Info about register writeback/flush oepration. */
     1262    kIemTbDbgEntryType_GuestRegWriteback,
     1263#endif
     1264#ifdef IEMNATIVE_WITH_EFLAGS_POSTPONING
     1265    /** Info about a delayed EFLAGS calculation. */
     1266    kIemTbDbgEntryType_PostponedEFlagsCalc,
     1267#endif
     1268    kIemTbDbgEntryType_End
     1269} IEMTBDBGENTRYTYPE;
     1270
     1271/**
     1272 * Translation block debug info entry.
     1273 */
     1274typedef union IEMTBDBGENTRY
     1275{
     1276    /** Plain 32-bit view. */
     1277    uint32_t u;
     1278
     1279    /** Generic view for getting at the type field. */
     1280    struct
     1281    {
     1282        /** IEMTBDBGENTRYTYPE */
     1283        uint32_t    uType : 4;
     1284        uint32_t    uTypeSpecific : 28;
     1285    } Gen;
     1286
     1287    struct
     1288    {
     1289        /** kIemTbDbgEntryType_ThreadedCall1. */
     1290        uint32_t    uType      : 4;
     1291        /** Native code offset. */
     1292        uint32_t    offNative  : 28;
     1293    } NativeOffset;
     1294
     1295    struct
     1296    {
     1297        /** kIemTbDbgEntryType_GuestInstruction. */
     1298        uint32_t    uType      : 4;
     1299        uint32_t    uUnused    : 4;
     1300        /** The IEM_F_XXX flags. */
     1301        uint32_t    fExec      : 24;
     1302    } GuestInstruction;
     1303
     1304    struct
     1305    {
     1306        /* kIemTbDbgEntryType_ThreadedCall. */
     1307        uint32_t    uType       : 4;
     1308        /** Set if the call was recompiled to native code, clear if just calling
     1309         *  threaded function. */
     1310        uint32_t    fRecompiled : 1;
     1311        uint32_t    uUnused     : 11;
     1312        /** The threaded call number (IEMTHREADEDFUNCS). */
     1313        uint32_t    enmCall     : 16;
     1314    } ThreadedCall;
     1315
     1316    struct
     1317    {
     1318        /* kIemTbDbgEntryType_Label. */
     1319        uint32_t    uType      : 4;
     1320        uint32_t    uUnused    : 4;
     1321        /** The label type (IEMNATIVELABELTYPE).   */
     1322        uint32_t    enmLabel   : 8;
     1323        /** The label data. */
     1324        uint32_t    uData      : 16;
     1325    } Label;
     1326
     1327    struct
     1328    {
     1329        /* kIemTbDbgEntryType_GuestRegShadowing. */
     1330        uint32_t    uType         : 4;
     1331        uint32_t    uUnused       : 4;
     1332        /** The guest register being shadowed (IEMNATIVEGSTREG). */
     1333        uint32_t    idxGstReg     : 8;
     1334        /** The host new register number, UINT8_MAX if dropped. */
     1335        uint32_t    idxHstReg     : 8;
     1336        /** The previous host register number, UINT8_MAX if new.   */
     1337        uint32_t    idxHstRegPrev : 8;
     1338    } GuestRegShadowing;
     1339
     1340#ifdef IEMNATIVE_WITH_SIMD_REG_ALLOCATOR
     1341    struct
     1342    {
     1343        /* kIemTbDbgEntryType_GuestSimdRegShadowing. */
     1344        uint32_t    uType             : 4;
     1345        uint32_t    uUnused           : 4;
     1346        /** The guest register being shadowed (IEMNATIVEGSTSIMDREG). */
     1347        uint32_t    idxGstSimdReg     : 8;
     1348        /** The host new register number, UINT8_MAX if dropped. */
     1349        uint32_t    idxHstSimdReg     : 8;
     1350        /** The previous host register number, UINT8_MAX if new.   */
     1351        uint32_t    idxHstSimdRegPrev : 8;
     1352    } GuestSimdRegShadowing;
     1353#endif
     1354
     1355#ifdef IEMNATIVE_WITH_DELAYED_PC_UPDATING
     1356    struct
     1357    {
     1358        /* kIemTbDbgEntryType_DelayedPcUpdate. */
     1359        uint32_t    uType         : 4;
     1360        /** Number of instructions skipped. */
     1361        uint32_t    cInstrSkipped : 8;
     1362        /* The instruction offset added to the program counter. */
     1363        int32_t     offPc         : 20;
     1364    } DelayedPcUpdate;
     1365#endif
     1366
     1367#if defined(IEMNATIVE_WITH_DELAYED_REGISTER_WRITEBACK) || defined(IEMNATIVE_WITH_SIMD_REG_ALLOCATOR)
     1368    struct
     1369    {
     1370        /* kIemTbDbgEntryType_GuestRegDirty. */
     1371        uint32_t    uType         : 4;
     1372        uint32_t    uUnused       : 11;
     1373        /** Flag whether this is about a SIMD (true) or general (false) register. */
     1374        uint32_t    fSimdReg      : 1;
     1375        /** The guest register index being marked as dirty. */
     1376        uint32_t    idxGstReg     : 8;
     1377        /** The host register number this register is shadowed in .*/
     1378        uint32_t    idxHstReg     : 8;
     1379    } GuestRegDirty;
     1380
     1381    struct
     1382    {
     1383        /* kIemTbDbgEntryType_GuestRegWriteback. */
     1384        uint32_t    uType         : 4;
     1385        /** Flag whether this is about a SIMD (true) or general (false) register flush. */
     1386        uint32_t    fSimdReg      : 1;
     1387        /** The mask shift. */
     1388        uint32_t    cShift        : 2;
     1389        /** The guest register mask being written back. */
     1390        uint32_t    fGstReg       : 25;
     1391    } GuestRegWriteback;
     1392#endif
     1393
     1394#ifdef IEMNATIVE_WITH_EFLAGS_POSTPONING
     1395    struct
     1396    {
     1397        /* kIemTbDbgEntryType_PostponedEFlagsCalc. */
     1398        uint32_t    uType         : 4;
     1399        /** The EFLAGS operation (IEMNATIVE_POSTPONED_EFL_OP_T). */
     1400        uint32_t    enmOp         : 4;
     1401        /** The mask shift. */
     1402        uint32_t    cOpBits       : 8;
     1403        /** The emit instance number (0-based). */
     1404        uint32_t    idxEmit       : 8;
     1405        /** Unused. */
     1406        uint32_t    uUnused       : 8;
     1407    } PostponedEflCalc;
     1408#endif
     1409} IEMTBDBGENTRY;
     1410AssertCompileSize(IEMTBDBGENTRY, sizeof(uint32_t));
     1411/** Pointer to a debug info entry. */
     1412typedef IEMTBDBGENTRY *PIEMTBDBGENTRY;
     1413/** Pointer to a const debug info entry. */
     1414typedef IEMTBDBGENTRY const *PCIEMTBDBGENTRY;
     1415
     1416/**
     1417 * Translation block debug info.
     1418 */
     1419typedef struct IEMTBDBG
     1420{
     1421    /** This is the flat PC corresponding to IEMTB::GCPhysPc. */
     1422    RTGCPTR         FlatPc;
     1423    /** Number of entries in aEntries. */
     1424    uint32_t        cEntries;
     1425    /** The offset of the last kIemTbDbgEntryType_NativeOffset record. */
     1426    uint32_t        offNativeLast;
     1427    /** Debug info entries. */
     1428    RT_FLEXIBLE_ARRAY_EXTENSION
     1429    IEMTBDBGENTRY   aEntries[RT_FLEXIBLE_ARRAY];
     1430} IEMTBDBG;
     1431/** Pointer to TB debug info. */
     1432typedef IEMTBDBG *PIEMTBDBG;
     1433/** Pointer to const TB debug info. */
     1434typedef IEMTBDBG const *PCIEMTBDBG;
     1435
     1436/**
    12341437 * Guest registers that can be shadowed in GPRs.
    12351438 *
     
    18472050         *  UINT8_MAX if not in use. */
    18482051        uint8_t                         idxReg2;
     2052# if defined(VBOX_WITH_STATISTICS) || defined(IEMNATIVE_WITH_TB_DEBUG_INFO)
     2053        /** Number of times the delayed calculation was emitted. */
     2054        uint8_t                         cEmits;
     2055# endif
    18492056    } PostponedEfl;
    18502057#endif
     
    20002207DECL_HIDDEN_THROW(void)     iemNativeDbgInfoAddDelayedPcUpdate(PIEMRECOMPILERSTATE pReNative,
    20012208                                                               uint64_t offPc, uint32_t cInstrSkipped);
     2209# ifdef IEMNATIVE_WITH_EFLAGS_POSTPONING
     2210DECL_HIDDEN_THROW(void)     iemNativeDbgInfoAddPostponedEFlagsCalc(PIEMRECOMPILERSTATE pReNative, uint32_t off,
     2211                                                                   IEMNATIVE_POSTPONED_EFL_OP_T enmOp, uint8_t cOpBits,
     2212                                                                   uint8_t idxInstance);
     2213# endif
    20022214#endif /* IEMNATIVE_WITH_TB_DEBUG_INFO */
    20032215
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