VirtualBox

Changeset 72569 in vbox for trunk/include


Ignore:
Timestamp:
Jun 15, 2018 7:04:01 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123063
Message:

EM,IEM,NEM: Started working on optimizing adjacent exits using IEM. Keep track of frequent exits, after 256 hits do a trial run in IEM to look for adjacent exits. Proof of concept using CPUID in NEMR3/win. bugref:9044

Location:
trunk/include/VBox/vmm
Files:
4 edited

Legend:

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

    r72565 r72569  
    238238#define EMEXIT_F_KIND_XCPT      UINT32_C(0x00004000)    /**< Exception numbers (raw-mode). */
    239239#define EMEXIT_F_KIND_MASK      UINT32_C(0x00007000)
    240 #define EMEXIT_F_CS_EIP         UINT32_C(0x00008000)    /**< The PC is EIP in the low dword and CS in the high. */
    241 #define EMEXIT_F_UNFLATTENED_PC UINT32_C(0x00010000)    /**< The PC hasn't had CS.BASE added to it. */
     240#define EMEXIT_F_CS_EIP         UINT32_C(0x00010000)    /**< The PC is EIP in the low dword and CS in the high. */
     241#define EMEXIT_F_UNFLATTENED_PC UINT32_C(0x00020000)    /**< The PC hasn't had CS.BASE added to it. */
    242242/** Combines flags and exit type into EMHistoryAddExit() input. */
    243243#define EMEXIT_MAKE_FLAGS_AND_TYPE(a_fFlags, a_uType)   ((a_fFlags) | (uint32_t)(a_uType))
     
    246246typedef enum EMEXITACTION
    247247{
     248    /** The record is free. */
     249    EMEXITACTION_FREE_RECORD = 0,
    248250    /** Take normal action on the exit. */
    249     EMEXITACTION_NORMAL = 0,
    250     EMEXITACTION_TODO
     251    EMEXITACTION_NORMAL,
     252    /** Take normal action on the exit, already probed and found nothing. */
     253    EMEXITACTION_NORMAL_PROBED,
     254    /** Do a probe execution. */
     255    EMEXITACTION_EXEC_PROBE,
     256    /** Execute using EMEXITREC::cMaxInstructionsWithoutExit. */
     257    EMEXITACTION_EXEC_WITH_MAX
    251258} EMEXITACTION;
    252259AssertCompileSize(EMEXITACTION, 4);
    253260
    254 VMM_INT_DECL(EMEXITACTION)      EMHistoryAddExit(PVMCPU pVCpu, uint32_t uFlagsAndType, uint64_t uFlatPC, uint64_t uTimestamp);
     261/**
     262 * Accumulative exit record.
     263 *
     264 * This could perhaps be squeezed down a bit, but there isn't too much point.
     265 * We'll probably need more data as time goes by.
     266 */
     267typedef struct EMEXITREC
     268{
     269    /** The flat PC of the exit. */
     270    uint64_t            uFlatPC;
     271    /** Flags and type, see EMEXIT_MAKE_FLAGS_AND_TYPE. */
     272    uint32_t            uFlagsAndType;
     273    /** The action to take (EMEXITACTION). */
     274    uint8_t             enmAction;
     275    uint8_t             bUnused;
     276    /** Maximum number of instructions to execute without hitting an exit. */
     277    uint16_t            cMaxInstructionsWithoutExit;
     278    /** The exit number (EMCPU::iNextExit) at which it was last updated. */
     279    uint64_t            uLastExitNo;
     280    /** Number of hits. */
     281    uint64_t            cHits;
     282} EMEXITREC;
     283AssertCompileSize(EMEXITREC, 32);
     284/** Pointer to an accumulative exit record. */
     285typedef EMEXITREC *PEMEXITREC;
     286/** Pointer to a const accumulative exit record. */
     287typedef EMEXITREC const *PCEMEXITREC;
     288
     289VMM_INT_DECL(PCEMEXITREC)       EMHistoryAddExit(PVMCPU pVCpu, uint32_t uFlagsAndType, uint64_t uFlatPC, uint64_t uTimestamp);
    255290#ifdef IN_RC
    256291VMMRC_INT_DECL(void)            EMRCHistoryAddExitCsEip(PVMCPU pVCpu, uint32_t uFlagsAndType, uint16_t uCs, uint32_t uEip,
     
    260295VMMR0_INT_DECL(void)            EMR0HistoryUpdatePC(PVMCPU pVCpu, uint64_t uFlatPC, bool fFlattened);
    261296#endif
    262 VMM_INT_DECL(EMEXITACTION)      EMHistoryUpdateFlagsAndType(PVMCPU pVCpu, uint32_t uFlagsAndType);
    263 VMM_INT_DECL(EMEXITACTION)      EMHistoryUpdateFlagsAndTypeAndPC(PVMCPU pVCpu, uint32_t uFlagsAndType, uint64_t uFlatPC);
     297VMM_INT_DECL(PCEMEXITREC)       EMHistoryUpdateFlagsAndType(PVMCPU pVCpu, uint32_t uFlagsAndType);
     298VMM_INT_DECL(PCEMEXITREC)       EMHistoryUpdateFlagsAndTypeAndPC(PVMCPU pVCpu, uint32_t uFlagsAndType, uint64_t uFlatPC);
     299VMM_INT_DECL(VBOXSTRICTRC)      EMHistoryExec(PVMCPU pVCpu, PCEMEXITREC pExitRec, uint32_t fWillExit);
    264300
    265301
  • trunk/include/VBox/vmm/iem.h

    r72493 r72569  
    210210                                                                      uint32_t *pcbWritten);
    211211VMMDECL(VBOXSTRICTRC)       IEMExecLots(PVMCPU pVCpu, uint32_t *pcInstructions);
     212/** Statistics returned by IEMExecForExits. */
     213typedef struct IEMEXECFOREXITSTATS
     214{
     215    uint32_t cInstructions;
     216    uint32_t cExits;
     217    uint32_t cMaxExitDistance;
     218    uint32_t cReserved;
     219} IEMEXECFOREXITSTATS;
     220/** Pointer to statistics returned by IEMExecForExits. */
     221typedef IEMEXECFOREXITSTATS *PIEMEXECFOREXITSTATS;
     222VMMDECL(VBOXSTRICTRC)       IEMExecForExits(PVMCPU pVCpu, uint32_t fWillExit, uint32_t cMinInstructions, uint32_t cMaxInstructions,
     223                                            uint32_t cMaxInstructionsWithoutExits, PIEMEXECFOREXITSTATS pStats);
    212224VMMDECL(VBOXSTRICTRC)       IEMInjectTrpmEvent(PVMCPU pVCpu);
    213225VMM_INT_DECL(VBOXSTRICTRC)  IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType, uint16_t uErrCode, RTGCPTR uCr2,
  • trunk/include/VBox/vmm/vm.h

    r72555 r72569  
    290290        struct EMCPU        s;
    291291#endif
    292         uint8_t             padding[8192];      /* multiple of 4096 */
     292        uint8_t             padding[40960];      /* multiple of 4096 */
    293293    } em;
    294294} VMCPU;
  • trunk/include/VBox/vmm/vm.mac

    r72555 r72569  
    8383    .cpum                   resb 4096
    8484    alignb 4096
    85     .em                     resb 8192
     85    .em                     resb 40960
    8686    alignb 4096
    8787endstruc
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