VirtualBox

Changeset 26159 in vbox


Ignore:
Timestamp:
Feb 2, 2010 6:12:40 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57173
Message:

PDMDevHlpR3: Added LdrGetR[C0]InterfaceSymbols.

Location:
trunk
Files:
2 edited

Legend:

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

    r26158 r26159  
    29872987    DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction));
    29882988
     2989    /**
     2990     * Resolves the symbol for a raw-mode context interface.
     2991     *
     2992     * @returns VBox status code.
     2993     * @param   pDevIns             The device instance.
     2994     * @param   pvInterface         The interface structure.
     2995     * @param   cbInterface         The size of the interface structure.
     2996     * @param   pszSymPrefix        What to prefix the symbols in the list with
     2997     *                              before resolving them.  This must start with
     2998     *                              'dev' and contain the driver name.
     2999     * @param   pszSymList          List of symbols corresponding to the interface.
     3000     *                              There is generally a there is generally a define
     3001     *                              holding this list associated with the interface
     3002     *                              definition (INTERFACE_SYM_LIST).  For more
     3003     *                              details see PDMR3LdrGetInterfaceSymbols.
     3004     * @thread  EMT
     3005     */
     3006    DECLR3CALLBACKMEMBER(int, pfnLdrGetRCInterfaceSymbols,(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
     3007                                                           const char *pszSymPrefix, const char *pszSymList));
     3008
     3009    /**
     3010     * Resolves the symbol for a ring-0 context interface.
     3011     *
     3012     * @returns VBox status code.
     3013     * @param   pDevIns             The device instance.
     3014     * @param   pvInterface         The interface structure.
     3015     * @param   cbInterface         The size of the interface structure.
     3016     * @param   pszSymPrefix        What to prefix the symbols in the list with
     3017     *                              before resolving them.  This must start with
     3018     *                              'dev' and contain the driver name.
     3019     * @param   pszSymList          List of symbols corresponding to the interface.
     3020     *                              There is generally a there is generally a define
     3021     *                              holding this list associated with the interface
     3022     *                              definition (INTERFACE_SYM_LIST).  For more
     3023     *                              details see PDMR3LdrGetInterfaceSymbols.
     3024     * @thread  EMT
     3025     */
     3026    DECLR3CALLBACKMEMBER(int, pfnLdrGetR0InterfaceSymbols,(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
     3027                                                           const char *pszSymPrefix, const char *pszSymList));
    29893028
    29903029    /** Space reserved for future members.
  • trunk/src/VBox/VMM/PDMDevHlp.cpp

    r26158 r26159  
    17811781    AssertBreakpoint();
    17821782    return false;
     1783}
     1784
     1785
     1786/** @interface_method_impl{PDMDEVHLP,pfnLdrGetRCInterfaceSymbols} */
     1787static DECLCALLBACK(int) pdmR3DevHlp_LdrGetRCInterfaceSymbols(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
     1788                                                              const char *pszSymPrefix, const char *pszSymList)
     1789{
     1790    PDMDEV_ASSERT_DEVINS(pDevIns);
     1791    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     1792    LogFlow(("pdmR3DevHlp_PDMLdrGetRCInterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
     1793             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
     1794
     1795    int rc;
     1796    if (   strncmp(pszSymPrefix, "dev", 3) == 0
     1797        && RTStrIStr(pszSymPrefix + 3, pDevIns->pDevReg->szDeviceName) != NULL)
     1798    {
     1799        if (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_RC)
     1800            rc = PDMR3LdrGetInterfaceSymbols(pDevIns->Internal.s.pVMR3, pvInterface, cbInterface,
     1801                                             pDevIns->pDevReg->szDeviceName, pszSymPrefix, pszSymList,
     1802                                             false /*fRing0OrRC*/);
     1803        else
     1804        {
     1805            AssertMsgFailed(("Not a raw-mode enabled driver\n"));
     1806            rc = VERR_PERMISSION_DENIED;
     1807        }
     1808    }
     1809    else
     1810    {
     1811        AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'dev' and contain the driver name!\n",
     1812                         pszSymPrefix, pDevIns->pDevReg->szDeviceName));
     1813        rc = VERR_INVALID_NAME;
     1814    }
     1815
     1816    LogFlow(("pdmR3DevHlp_PDMLdrGetRCInterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDevIns->pDevReg->szDeviceName,
     1817             pDevIns->iInstance, rc));
     1818    return rc;
     1819}
     1820
     1821
     1822/** @interface_method_impl{PDMDEVHLP,pfnLdrGetR0InterfaceSymbols} */
     1823static DECLCALLBACK(int) pdmR3DevHlp_LdrGetR0InterfaceSymbols(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface,
     1824                                                              const char *pszSymPrefix, const char *pszSymList)
     1825{
     1826    PDMDEV_ASSERT_DEVINS(pDevIns);
     1827    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     1828    LogFlow(("pdmR3DevHlp_PDMLdrGetR0InterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n",
     1829             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList));
     1830
     1831    int rc;
     1832    if (   strncmp(pszSymPrefix, "dev", 3) == 0
     1833        && RTStrIStr(pszSymPrefix + 3, pDevIns->pDevReg->szDeviceName) != NULL)
     1834    {
     1835        if (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_R0)
     1836            rc = PDMR3LdrGetInterfaceSymbols(pDevIns->Internal.s.pVMR3, pvInterface, cbInterface,
     1837                                             pDevIns->pDevReg->szDeviceName, pszSymPrefix, pszSymList,
     1838                                             true /*fRing0OrRC*/);
     1839        else
     1840        {
     1841            AssertMsgFailed(("Not a ring-0 enabled driver\n"));
     1842            rc = VERR_PERMISSION_DENIED;
     1843        }
     1844    }
     1845    else
     1846    {
     1847        AssertMsgFailed(("Invalid prefix '%s' for '%s'; must start with 'dev' and contain the driver name!\n",
     1848                         pszSymPrefix, pDevIns->pDevReg->szDeviceName));
     1849        rc = VERR_INVALID_NAME;
     1850    }
     1851
     1852    LogFlow(("pdmR3DevHlp_PDMLdrGetR0InterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDevIns->pDevReg->szDeviceName,
     1853             pDevIns->iInstance, rc));
     1854    return rc;
    17831855}
    17841856
     
    28582930    pdmR3DevHlp_AssertEMT,
    28592931    pdmR3DevHlp_AssertOther,
     2932    pdmR3DevHlp_LdrGetRCInterfaceSymbols,
     2933    pdmR3DevHlp_LdrGetR0InterfaceSymbols,
    28602934    0,
    28612935    0,
     
    30513125    pdmR3DevHlp_AssertEMT,
    30523126    pdmR3DevHlp_AssertOther,
     3127    pdmR3DevHlp_LdrGetRCInterfaceSymbols,
     3128    pdmR3DevHlp_LdrGetR0InterfaceSymbols,
    30533129    0,
    30543130    0,
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