VirtualBox

Changeset 80274 in vbox for trunk/include


Ignore:
Timestamp:
Aug 14, 2019 2:34:38 PM (5 years ago)
Author:
vboxsync
Message:

VMM: Refactoring VMMR0/* and VMMRZ/* to use VMCC & VMMCPUCC. bugref:9217

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

Legend:

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

    r80268 r80274  
    5656
    5757    /** VCPU id (0 - (pVM->cCpus - 1). */
    58 #ifdef VBOX_BUGREF_9217
    59     VMCPUID         idCpuSafe;
    60 #else
    6158    VMCPUID         idCpu;
    62 #endif
    6359    /** Padding. */
    6460    uint32_t        uPadding;
     
    7773    /** Pointer to the GVM structure, for CTX_SUFF use in VMMAll code.  */
    7874    PGVM            pVMR0;
     75    /** The ring-3 address of this structure (only VMCPU part). */
     76    PVMCPUR3        pVCpuR3;
    7977#endif
    8078
    8179    /** Padding so gvmm starts on a 64 byte boundrary.
    8280     * @note Keeping this working for 32-bit header syntax checking.  */
    83 #ifdef VBOX_BUGREF_9217
    84     uint8_t         abPadding[HC_ARCH_BITS == 32 ? 44 : 32];
    85 #else
    8681    uint8_t         abPadding[HC_ARCH_BITS == 32 ? 40 : 24];
    87 #endif
    8882
    8983    /** The GVMM per vcpu data. */
     
    158152    uint32_t        u32Magic;
    159153    /** The global VM handle for this VM. */
    160 #ifdef VBOX_BUGREF_9217
    161     uint32_t        hSelfSafe;
    162 #else
    163154    uint32_t        hSelf;
    164 #endif
    165 #ifndef VBOX_BUGREF_9217
     155#ifdef VBOX_BUGREF_9217
     156    /** Pointer to this structure (for validation purposes). */
     157    PGVM            pSelf;
     158#else
    166159    /** The ring-0 mapping of the VM structure. */
    167160    PVM             pVM;
     
    170163    PVMR3           pVMR3;
    171164    /** The support driver session the VM is associated with. */
    172 #ifdef VBOX_BUGREF_9217
    173     PSUPDRVSESSION  pSessionSafe;
    174 #else
    175165    PSUPDRVSESSION  pSession;
    176 #endif
    177166    /** Number of Virtual CPUs, i.e. how many entries there are in aCpus.
    178167     * Same same as VM::cCpus. */
    179168    uint32_t        cCpus;
    180169    /** Padding so gvmm starts on a 64 byte boundrary.   */
    181 #ifdef VBOX_BUGREF_9217
    182     uint8_t         abPadding[HC_ARCH_BITS == 32 ? 12 + 28 + 4 : 28 + 8];
    183 #else
    184170    uint8_t         abPadding[HC_ARCH_BITS == 32 ? 12 + 28 : 28];
    185 #endif
    186171
    187172    /** The GVMM per vm data. */
  • trunk/include/VBox/vmm/gvmm.h

    r76585 r80274  
    162162GVMMR0DECL(int)     GVMMR0QueryConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t *pu64Value);
    163163
    164 GVMMR0DECL(int)     GVMMR0CreateVM(PSUPDRVSESSION pSession, uint32_t cCpus, PVM *ppVM);
     164GVMMR0DECL(int)     GVMMR0CreateVM(PSUPDRVSESSION pSession, uint32_t cCpus, PVMCC *ppVM);
    165165GVMMR0DECL(int)     GVMMR0InitVM(PGVM pGVM);
    166166GVMMR0DECL(void)    GVMMR0DoneInitVM(PGVM pGVM);
     
    173173GVMMR0DECL(int)     GVMMR0ValidateGVMandVM(PGVM pGVM, PVM pVM);
    174174GVMMR0DECL(int)     GVMMR0ValidateGVMandVMandEMT(PGVM pGVM, PVM pVM, VMCPUID idCpu);
    175 GVMMR0DECL(PVM   GVMMR0GetVMByEMT(RTNATIVETHREAD hEMT);
     175GVMMR0DECL(PVMCC)   GVMMR0GetVMByEMT(RTNATIVETHREAD hEMT);
    176176GVMMR0DECL(PGVMCPU) GVMMR0GetGVCpuByEMT(RTNATIVETHREAD hEMT);
    177177GVMMR0DECL(int)     GVMMR0SchedHalt(PGVM pGVM, PVM pVM, PGVMCPU pGVCpu, uint64_t u64ExpireGipTime);
  • trunk/include/VBox/vmm/vm.h

    r80268 r80274  
    167167    /** The CPU ID.
    168168     * This is the index into the VM::aCpu array. */
     169#ifdef VBOX_BUGREF_9217
     170    VMCPUID                 idCpuUnsafe;
     171#else
    169172    VMCPUID                 idCpu;
     173#endif
    170174
    171175    /** Align the structures below bit on a 64-byte boundary and make sure it starts
     
    11561160    R3PTRTYPE(PSUPPAGE)         paVMPagesR3;
    11571161    /** Session handle. For use when calling SUPR0 APIs. */
     1162#ifdef VBOX_BUGREF_9217
     1163    PSUPDRVSESSION              pSessionUnsafe;
     1164#else
    11581165    PSUPDRVSESSION              pSession;
     1166#endif
    11591167    /** Pointer to the ring-3 VM structure. */
    11601168    PUVM                        pUVM;
     
    11731181
    11741182    /** The GVM VM handle. Only the GVM should modify this field. */
     1183#ifdef VBOX_BUGREF_9217
     1184    uint32_t                    hSelfUnsafe;
     1185#else
    11751186    uint32_t                    hSelf;
     1187#endif
    11761188    /** Number of virtual CPUs. */
    11771189#if defined(VBOX_BUGREF_9217) && defined(IN_RING0)
  • trunk/include/VBox/vmm/vmcc.h

    r80268 r80274  
    7676 * For enumerating VCpus in ascending order, avoiding unnecessary apCpusR0
    7777 * access in ring-0, caching the CPU count and not checking for CPU \#0.
    78  * @note Close loop with VMCC_FOR_EACH_VMCPU_END. */
    79 /** @def VMCC_FOR_EACH_VMCPU_END
    80  * Ends a VMCC_FOR_EACH_VMCPU loop. */
     78 *
     79 * Defines local variables @c idCpu, @c pVCpu and @c cCpus.
     80 *
     81 * @param   a_pVM   The VM handle.
     82 *
     83 * @note    Close loop with VMCC_FOR_EACH_VMCPU_END.
     84 */
    8185#define VMCC_FOR_EACH_VMCPU(a_pVM) \
    82     { \
     86    do { \
    8387        VMCPUID         idCpu = 0; \
    8488        VMCPUID const   cCpus = (a_pVM)->cCpus; \
     
    8690        for (;;) \
    8791        {
     92
     93/** @def VMCC_FOR_EACH_VMCPU_END
     94 * Ends a VMCC_FOR_EACH_VMCPU loop.
     95 * @param   a_pVM   The VM handle.
     96 */
    8897#define VMCC_FOR_EACH_VMCPU_END(a_pVM) \
    8998            /* advance */ \
     
    92101            pVCpu = VMCC_GET_CPU(pVM, idCpu); \
    93102        } \
    94     } do { } while(0)
     103    } while (0)
     104
     105/**
     106 * Execute the given statement for each virtual CPU in an environment with
     107 * @c pVCpu and @c idCpu variables.
     108 *
     109 * @param   a_pVM   The VM handle.
     110 * @param   a_Stmt  The statement to execute.
     111 */
     112#define VMCC_FOR_EACH_VMCPU_STMT(a_pVM, a_Stmt) VMCC_FOR_EACH_VMCPU(pVM) { a_Stmt; } VMCC_FOR_EACH_VMCPU_END(pVM)
    95113
    96114#endif /* !VBOX_INCLUDED_vmm_vmcc_h */
  • trunk/include/VBox/vmm/vmm.h

    r80268 r80274  
    100100 * @param   pvUser          The user argument.
    101101 */
    102 typedef DECLCALLBACK(int) FNVMMR0CALLRING3NOTIFICATION(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser);
     102typedef DECLCALLBACK(int) FNVMMR0CALLRING3NOTIFICATION(PVMCPUCC pVCpu, VMMCALLRING3 enmOperation, void *pvUser);
    103103/** Pointer to a FNRTMPNOTIFICATION(). */
    104104typedef FNVMMR0CALLRING3NOTIFICATION *PFNVMMR0CALLRING3NOTIFICATION;
     
    530530 * @{
    531531 */
    532 VMMRZDECL(int)      VMMRZCallRing3(PVM pVM, PVMCPU pVCpu, VMMCALLRING3 enmOperation, uint64_t uArg);
    533 VMMRZDECL(int)      VMMRZCallRing3NoCpu(PVM pVM, VMMCALLRING3 enmOperation, uint64_t uArg);
    534 VMMRZDECL(void)     VMMRZCallRing3Disable(PVMCPU pVCpu);
    535 VMMRZDECL(void)     VMMRZCallRing3Enable(PVMCPU pVCpu);
    536 VMMRZDECL(bool)     VMMRZCallRing3IsEnabled(PVMCPU pVCpu);
    537 VMMRZDECL(int)      VMMRZCallRing3SetNotification(PVMCPU pVCpu, R0PTRTYPE(PFNVMMR0CALLRING3NOTIFICATION) pfnCallback, RTR0PTR pvUser);
    538 VMMRZDECL(void)     VMMRZCallRing3RemoveNotification(PVMCPU pVCpu);
    539 VMMRZDECL(bool)     VMMRZCallRing3IsNotificationSet(PVMCPU pVCpu);
     532VMMRZDECL(int)      VMMRZCallRing3(PVMCC pVMCC, PVMCPU pVCpu, VMMCALLRING3 enmOperation, uint64_t uArg);
     533VMMRZDECL(int)      VMMRZCallRing3NoCpu(PVMCC pVM, VMMCALLRING3 enmOperation, uint64_t uArg);
     534VMMRZDECL(void)     VMMRZCallRing3Disable(PVMCPUCC pVCpu);
     535VMMRZDECL(void)     VMMRZCallRing3Enable(PVMCPUCC pVCpu);
     536VMMRZDECL(bool)     VMMRZCallRing3IsEnabled(PVMCPUCC pVCpu);
     537VMMRZDECL(int)      VMMRZCallRing3SetNotification(PVMCPUCC pVCpu, R0PTRTYPE(PFNVMMR0CALLRING3NOTIFICATION) pfnCallback, RTR0PTR pvUser);
     538VMMRZDECL(void)     VMMRZCallRing3RemoveNotification(PVMCPUCC pVCpu);
     539VMMRZDECL(bool)     VMMRZCallRing3IsNotificationSet(PVMCPUCC pVCpu);
    540540/** @} */
    541541#endif
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