VirtualBox

Changeset 93635 in vbox for trunk/include/VBox/vmm


Ignore:
Timestamp:
Feb 7, 2022 10:43:45 AM (3 years ago)
Author:
vboxsync
Message:

VMM/PGM,VMM/PDM,VGA: Consolidate the user parameters of the physical access handlers into a single uint64_t value that shouldn't be a pointer, at least not for ring-0 callbacks. Special hack for devices where it's translated from a ring-0 device instance index into a current context PPDMDEVINS (not really tested yet). bugref:10094

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

Legend:

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

    r93609 r93635  
    5353VMM_INT_DECL(bool)      PDMHasIoApic(PVM pVM);
    5454VMM_INT_DECL(bool)      PDMHasApic(PVM pVM);
     55VMM_INT_DECL(PPDMDEVINS) PDMDeviceRing0IdxToInstance(PVMCC pVM, uint64_t idxR0Device);
    5556VMM_INT_DECL(int)       PDMIoApicSetIrq(PVM pVM, PCIBDF uBusDevFn, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
    5657VMM_INT_DECL(void)      PDMIoApicBroadcastEoi(PVMCC pVM, uint8_t uVector);
  • trunk/include/VBox/vmm/pdmdev.h

    r93609 r93635  
    48954895     * @param   GCPhysLast          Last physical address. (inclusive)
    48964896     * @param   hType               The handler type registration handle.
    4897      * @param   pvUserR3            User argument to the R3 handler.
    4898      * @param   pvUserR0            User argument to the R0 handler.
    4899      * @param   pvUserRC            User argument to the RC handler. This can be a value
    4900      *                              less that 0x10000 or a (non-null) pointer that is
    4901      *                              automatically relocated.
    49024897     * @param   pszDesc             Description of this handler.  If NULL, the type
    49034898     *                              description will be used instead.
     4899     * @note    There is no @a uUser argument, because it will be set to the pDevIns
     4900     *          in the context the handler is called.
    49044901     */
    49054902    DECLR3CALLBACKMEMBER(int, pfnPGMHandlerPhysicalRegister, (PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
    4906                                                               PGMPHYSHANDLERTYPE hType, RTR3PTR pvUserR3, RTR0PTR pvUserR0,
    4907                                                               RTRCPTR pvUserRC, R3PTRTYPE(const char *) pszDesc));
     4903                                                              PGMPHYSHANDLERTYPE hType, R3PTRTYPE(const char *) pszDesc));
    49084904
    49094905    /**
     
    94799475 */
    94809476DECLINLINE(int) PDMDevHlpPGMHandlerPhysicalRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
    9481                                                     PGMPHYSHANDLERTYPE hType, RTR3PTR pvUserR3, RTR0PTR pvUserR0,
    9482                                                     RTRCPTR pvUserRC, R3PTRTYPE(const char *) pszDesc)
    9483 {
    9484     return pDevIns->pHlpR3->pfnPGMHandlerPhysicalRegister(pDevIns, GCPhys, GCPhysLast, hType,
    9485                                                           pvUserR3, pvUserR0, pvUserRC, pszDesc);
     9477                                                    PGMPHYSHANDLERTYPE hType, R3PTRTYPE(const char *) pszDesc)
     9478{
     9479    return pDevIns->pHlpR3->pfnPGMHandlerPhysicalRegister(pDevIns, GCPhys, GCPhysLast, hType, pszDesc);
    94869480}
    94879481
     
    94939487    return pDevIns->pHlpR3->pfnPGMHandlerPhysicalDeregister(pDevIns, GCPhys);
    94949488}
    9495 #endif
     9489
     9490#endif /* IN_RING3 */
    94969491
    94979492/**
     
    95049499
    95059500#ifdef IN_RING3
     9501
    95069502/**
    95079503 * @copydoc PDMDEVHLPR3::pfnPGMHandlerPhysicalReset
     
    95889584    return pDevIns->pHlpR3->pfnGIMGetDebugSetup(pDevIns, pDbgSetup);
    95899585}
    9590 #endif
     9586
     9587#endif /* IN_RING3 */
    95919588
    95929589/**
     
    95999596
    96009597#ifdef IN_RING3
     9598
    96019599/** Wrapper around SSMR3GetU32 for simplifying getting enum values saved as uint32_t. */
    96029600# define PDMDEVHLP_SSM_GET_ENUM32_RET(a_pHlp, a_pSSM, a_enmDst, a_EnumType) \
  • trunk/include/VBox/vmm/pgm.h

    r93596 r93635  
    195195 * @param   pvFault     The fault address (cr2).
    196196 * @param   GCPhysFault The GC physical address corresponding to pvFault.
    197  * @param   pvUser      User argument.
     197 * @param   uUser       User argument (not a pointer).
    198198 * @thread  EMT(pVCpu)
    199199 */
    200200typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNPGMRZPHYSPFHANDLER,(PVMCC pVM, PVMCPUCC pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
    201                                                              RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser));
     201                                                             RTGCPTR pvFault, RTGCPHYS GCPhysFault, uint64_t uUser));
    202202/** Pointer to PGM access callback. */
    203203typedef FNPGMRZPHYSPFHANDLER *PFNPGMRZPHYSPFHANDLER;
     
    226226 * @param   enmAccessType   The access type.
    227227 * @param   enmOrigin       The origin of this call.
    228  * @param   pvUser          User argument.
     228 * @param   uUser           User argument (not a pointer).
    229229 * @thread  EMT(pVCpu)
    230230 */
    231231typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNPGMPHYSHANDLER,(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, void *pvPhys,
    232232                                                         void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType,
    233                                                          PGMACCESSORIGIN enmOrigin, void *pvUser));
     233                                                         PGMACCESSORIGIN enmOrigin, uint64_t uUser));
    234234/** Pointer to PGM access callback. */
    235235typedef FNPGMPHYSHANDLER *PFNPGMPHYSHANDLER;
     
    634634
    635635VMMDECL(int)        PGMHandlerPhysicalRegister(PVMCC pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast, PGMPHYSHANDLERTYPE hType,
    636                                                RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC,
    637                                                R3PTRTYPE(const char *) pszDesc);
     636                                               uint64_t uUser, R3PTRTYPE(const char *) pszDesc);
    638637VMMDECL(int)        PGMHandlerPhysicalModify(PVMCC pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast);
    639638VMMDECL(int)        PGMHandlerPhysicalDeregister(PVMCC pVM, RTGCPHYS GCPhys);
    640 VMMDECL(int)        PGMHandlerPhysicalChangeUserArgs(PVMCC pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0);
     639VMMDECL(int)        PGMHandlerPhysicalChangeUserArg(PVMCC pVM, RTGCPHYS GCPhys, uint64_t uUser);
    641640VMMDECL(int)        PGMHandlerPhysicalSplit(PVMCC pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysSplit);
    642641VMMDECL(int)        PGMHandlerPhysicalJoin(PVMCC pVM, RTGCPHYS GCPhys1, RTGCPHYS GCPhys2);
     
    960959
    961960VMMR3DECL(int)      PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
    962                                           RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc);
     961                                          uint64_t uUser, const char *pszDesc);
    963962VMMR3DECL(int)      PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
    964963
     
    10061005VMMDECL(void)       PGMR3PhysSetA20(PVMCPU pVCpu, bool fEnable);
    10071006
    1008 VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind, bool fKeepPgmLock,
     1007VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind, uint32_t fFlags,
    10091008                                                       PFNPGMPHYSHANDLER pfnHandlerR3,
    10101009                                                       R0PTRTYPE(PFNPGMPHYSHANDLER)     pfnHandlerR0,
    10111010                                                       R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0,
    10121011                                                       const char *pszDesc, PPGMPHYSHANDLERTYPE phType);
    1013 VMMR3DECL(int)      PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, bool fKeepPgmLock,
     1012VMMR3DECL(int)      PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, uint32_t fFlags,
    10141013                                                     R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
    10151014                                                     const char *pszModR0, const char *pszHandlerR0, const char *pszPfHandlerR0,
     
    10171016                                                     const char *pszDesc,
    10181017                                                     PPGMPHYSHANDLERTYPE phType);
     1018/** @name PGMPHYSHANDLER_F_XXX - flags for PGMR3HandlerPhysicalTypeRegister
     1019 * @{ */
     1020/** Whether to hold the PGM lock while calling the handler or not.
     1021 *  Mainly an optimization for PGM callers. */
     1022#define PGMPHYSHANDLER_F_KEEP_PGM_LOCK  RT_BIT_32(0)
     1023/** The uUser value is a ring-0 device instance index that needs translating
     1024 * into a PDMDEVINS pointer before calling the handler.  This is a hack to make
     1025 * it possible to use access handlers in devices. */
     1026#define PGMPHYSHANDLER_F_R0_DEVINS_IDX  RT_BIT_32(1)
     1027/** Mask of valid bits.   */
     1028#define PGMPHYSHANDLER_F_VALID_MASK     UINT32_C(3)
     1029/** @} */
     1030
    10191031VMMR3_INT_DECL(int) PGMR3PoolGrow(PVM pVM, PVMCPU pVCpu);
    10201032
  • trunk/include/VBox/vmm/vm.h

    r93628 r93635  
    13231323        struct PDM s;
    13241324#endif
    1325         uint8_t     padding[20864];     /* multiple of 64 */
     1325        uint8_t     padding[22400];     /* multiple of 64 */
    13261326    } pdm;
    13271327
     
    14581458
    14591459    /** Padding for aligning the structure size on a page boundrary. */
    1460     uint8_t         abAlignment2[10456 - sizeof(PVMCPUR3) * VMM_MAX_CPU_COUNT];
     1460    uint8_t         abAlignment2[8920 - sizeof(PVMCPUR3) * VMM_MAX_CPU_COUNT];
    14611461
    14621462    /* ---- end small stuff ---- */
  • trunk/include/VBox/vmm/vm.mac

    r93628 r93635  
    143143    .mm                     resb 192
    144144    alignb 64
    145     .pdm                    resb 20864
     145    .pdm                    resb 22400
    146146    alignb 64
    147147    .iom                    resb 1152
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