VirtualBox

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


Ignore:
Timestamp:
Oct 21, 2021 6:45:26 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
147725
Message:

VMM,Devices: Eliminate direct calls to VMMR3 and VMR3 APIs and introduce callbacks in the device helper callback table, bugref:10074

File:
1 edited

Legend:

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

    r91909 r91920  
    24242424
    24252425/** Current PDMDEVHLPR3 version number. */
    2426 #define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 52, 0)
     2426#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 53, 0)
    24272427
    24282428/**
     
    31293129
    31303130    /**
     3131     * Checks if a GC physical address is a normal page,
     3132     * i.e. not ROM, MMIO or reserved.
     3133     *
     3134     * @returns true if normal.
     3135     * @returns false if invalid, ROM, MMIO or reserved page.
     3136     * @param   pDevIns             The device instance.
     3137     * @param   GCPhys              The physical address to check.
     3138     */
     3139    DECLR3CALLBACKMEMBER(bool, pfnPhysIsGCPhysNormal,(PPDMDEVINS pDevIns, RTGCPHYS GCPhys));
     3140
     3141    /**
    31313142     * Allocate memory which is associated with current VM instance
    31323143     * and automatically freed on it's destruction.
     
    32343245    DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId,
    32353246                                                     const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
     3247
     3248    /**
     3249     * Special interface for implementing a HLT-like port on a device.
     3250     *
     3251     * This can be called directly from device code, provide the device is trusted
     3252     * to access the VMM directly.  Since we may not have an accurate register set
     3253     * and the caller certainly shouldn't (device code does not access CPU
     3254     * registers), this function will return when interrupts are pending regardless
     3255     * of the actual EFLAGS.IF state.
     3256     *
     3257     * @returns VBox error status (never informational statuses).
     3258     * @param   pDevIns             The device instance.
     3259     * @param   idCpu               The id of the calling EMT.
     3260     */
     3261    DECLR3CALLBACKMEMBER(int, pfnVMWaitForDeviceReady,(PPDMDEVINS pDevIns, VMCPUID idCpu));
     3262
     3263    /**
     3264     * Wakes up a CPU that has called PDMDEVHLPR3::pfnVMWaitForDeviceReady.
     3265     *
     3266     * @returns VBox error status (never informational statuses).
     3267     * @param   pDevIns             The device instance.
     3268     * @param   idCpu               The id of the calling EMT.
     3269     */
     3270    DECLR3CALLBACKMEMBER(int, pfnVMNotifyCpuDeviceReady,(PPDMDEVINS pDevIns, VMCPUID idCpu));
     3271
     3272    /**
     3273     * Convenience wrapper for VMR3ReqCallU.
     3274     *
     3275     * This assumes (1) you're calling a function that returns an VBox status code
     3276     * and that you do not wish to wait for it to complete.
     3277     *
     3278     * @returns VBox status code returned by VMR3ReqCallVU.
     3279     *
     3280     * @param   pDevIns             The device instance.
     3281     * @param   idDstCpu            The destination CPU(s). Either a specific CPU ID or
     3282     *                              one of the following special values:
     3283     *                                  VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
     3284     * @param   pfnFunction         Pointer to the function to call.
     3285     * @param   cArgs               Number of arguments following in the ellipsis.
     3286     * @param   Args                Argument vector.
     3287     *
     3288     * @remarks See remarks on VMR3ReqCallVU.
     3289     */
     3290    DECLR3CALLBACKMEMBER(int, pfnVMReqCallNoWaitV,(PPDMDEVINS pDevIns, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, va_list Args));
     3291
     3292    /**
     3293     * Convenience wrapper for VMR3ReqCallU.
     3294     *
     3295     * This assumes (1) you're calling a function that returns void, (2) that you
     3296     * wish to wait for ever for it to return, and (3) that it's priority request
     3297     * that can be safely be handled during async suspend and power off.
     3298     *
     3299     * @returns VBox status code of VMR3ReqCallVU.
     3300     *
     3301     * @param   pDevIns             The device instance.
     3302     * @param   idDstCpu            The destination CPU(s). Either a specific CPU ID or
     3303     *                              one of the following special values:
     3304     *                                  VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
     3305     * @param   pfnFunction         Pointer to the function to call.
     3306     * @param   cArgs               Number of arguments following in the ellipsis.
     3307     * @param   Args                Argument vector.
     3308     *
     3309     * @remarks See remarks on VMR3ReqCallVU.
     3310     */
     3311    DECLR3CALLBACKMEMBER(int, pfnVMReqPriorityCallWaitV,(PPDMDEVINS pDevIns, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, va_list Args));
    32363312
    32373313    /**
     
    45714647                                                                  const char *pszHandlerRC, const char *pszPfHandlerRC,
    45724648                                                                  const char *pszDesc, PPGMPHYSHANDLERTYPE phType));
     4649
     4650    /**
     4651     * Registers the guest memory range that can be used for patching.
     4652     *
     4653     * @returns VBox status code.
     4654     * @param   pDevIns             The device instance.
     4655     * @param   GCPtrPatchMem       Patch memory range.
     4656     * @param   cbPatchMem          Size of the memory range.
     4657     */
     4658    DECLR3CALLBACKMEMBER(int, pfnVMMRegisterPatchMemory, (PPDMDEVINS pDevIns, RTGCPTR GCPtrPatchMem, uint32_t cbPatchMem));
     4659
     4660    /**
     4661     * Deregisters the guest memory range that can be used for patching.
     4662     *
     4663     * @returns VBox status code.
     4664     * @param   pDevIns             The device instance.
     4665     * @param   GCPtrPatchMem       Patch memory range.
     4666     * @param   cbPatchMem          Size of the memory range.
     4667     */
     4668    DECLR3CALLBACKMEMBER(int, pfnVMMDeregisterPatchMemory, (PPDMDEVINS pDevIns, RTGCPTR GCPtrPatchMem, uint32_t cbPatchMem));
    45734669
    45744670    /** @} */
     
    66586754
    66596755/**
     6756 * @copydoc PDMDEVHLPR3::pfnPhysIsGCPhysNormal
     6757 */
     6758DECLINLINE(bool) PDMDevHlpPhysIsGCPhysNormal(PPDMDEVINS pDevIns, RTGCPHYS GCPhys)
     6759{
     6760    return pDevIns->CTX_SUFF(pHlp)->pfnPhysIsGCPhysNormal(pDevIns, GCPhys);
     6761}
     6762
     6763/**
    66606764 * @copydoc PDMDEVHLPR3::pfnCpuGetGuestMicroarch
    66616765 */
     
    68236927    rc = pDevIns->CTX_SUFF(pHlp)->pfnVMSetRuntimeErrorV(pDevIns, fFlags, pszErrorId, pszFormat, va);
    68246928    va_end(va);
     6929    return rc;
     6930}
     6931
     6932/**
     6933 * @copydoc PDMDEVHLPR3::pfnVMWaitForDeviceReady
     6934 */
     6935DECLINLINE(int) PDMDevHlpVMWaitForDeviceReady(PPDMDEVINS pDevIns, VMCPUID idCpu)
     6936{
     6937    return pDevIns->CTX_SUFF(pHlp)->pfnVMWaitForDeviceReady(pDevIns, idCpu);
     6938}
     6939
     6940/**
     6941 * @copydoc PDMDEVHLPR3::pfnVMNotifyCpuDeviceReady
     6942 */
     6943DECLINLINE(int) PDMDevHlpVMNotifyCpuDeviceReady(PPDMDEVINS pDevIns, VMCPUID idCpu)
     6944{
     6945    return pDevIns->CTX_SUFF(pHlp)->pfnVMNotifyCpuDeviceReady(pDevIns, idCpu);
     6946}
     6947
     6948/**
     6949 * Convenience wrapper for VMR3ReqCallU.
     6950 *
     6951 * This assumes (1) you're calling a function that returns an VBox status code
     6952 * and that you do not wish to wait for it to complete.
     6953 *
     6954 * @returns VBox status code returned by VMR3ReqCallVU.
     6955 *
     6956 * @param   pDevIns             The device instance.
     6957 * @param   idDstCpu            The destination CPU(s). Either a specific CPU ID or
     6958 *                              one of the following special values:
     6959 *                                  VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
     6960 * @param   pfnFunction         Pointer to the function to call.
     6961 * @param   cArgs               Number of arguments following in the ellipsis.
     6962 * @param   ...                 Argument list.
     6963 *
     6964 * @remarks See remarks on VMR3ReqCallVU.
     6965 */
     6966DECLINLINE(int) PDMDevHlpVMReqCallNoWait(PPDMDEVINS pDevIns, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
     6967{
     6968    va_list Args;
     6969    va_start(Args, cArgs);
     6970    int rc = pDevIns->CTX_SUFF(pHlp)->pfnVMReqCallNoWaitV(pDevIns, idDstCpu, pfnFunction, cArgs, Args);
     6971    va_end(Args);
     6972    return rc;
     6973}
     6974
     6975/**
     6976 * Convenience wrapper for VMR3ReqCallU.
     6977 *
     6978 * This assumes (1) you're calling a function that returns void, (2) that you
     6979 * wish to wait for ever for it to return, and (3) that it's priority request
     6980 * that can be safely be handled during async suspend and power off.
     6981 *
     6982 * @returns VBox status code of VMR3ReqCallVU.
     6983 *
     6984 * @param   pDevIns             The device instance.
     6985 * @param   idDstCpu            The destination CPU(s). Either a specific CPU ID or
     6986 *                              one of the following special values:
     6987 *                                  VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
     6988 * @param   pfnFunction         Pointer to the function to call.
     6989 * @param   cArgs               Number of arguments following in the ellipsis.
     6990 * @param   ...                 Argument list.
     6991 *
     6992 * @remarks See remarks on VMR3ReqCallVU.
     6993 */
     6994DECLINLINE(int) PDMDevHlpVMReqPriorityCallWait(PPDMDEVINS pDevIns, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
     6995{
     6996    va_list Args;
     6997    va_start(Args, cArgs);
     6998    int rc = pDevIns->CTX_SUFF(pHlp)->pfnVMReqPriorityCallWaitV(pDevIns, idDstCpu, pfnFunction, cArgs, Args);
     6999    va_end(Args);
    68257000    return rc;
    68267001}
     
    86608835}
    86618836
     8837/**
     8838 * @copydoc PDMDEVHLPR3::pfnVMMRegisterPatchMemory
     8839 */
     8840DECLINLINE(int) PDMDevHlpVMMRegisterPatchMemory(PPDMDEVINS pDevIns, RTGCPTR GCPtrPatchMem, uint32_t cbPatchMem)
     8841{
     8842    return pDevIns->pHlpR3->pfnVMMRegisterPatchMemory(pDevIns, GCPtrPatchMem, cbPatchMem);
     8843}
     8844
     8845/**
     8846 * @copydoc PDMDEVHLPR3::pfnVMMDeregisterPatchMemory
     8847 */
     8848DECLINLINE(int) PDMDevHlpVMMDeregisterPatchMemory(PPDMDEVINS pDevIns, RTGCPTR GCPtrPatchMem, uint32_t cbPatchMem)
     8849{
     8850    return pDevIns->pHlpR3->pfnVMMDeregisterPatchMemory(pDevIns, GCPtrPatchMem, cbPatchMem);
     8851}
     8852
    86628853/** Wrapper around SSMR3GetU32 for simplifying getting enum values saved as uint32_t. */
    86638854# define PDMDEVHLP_SSM_GET_ENUM32_RET(a_pHlp, a_pSSM, a_enmDst, a_EnumType) \
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