VirtualBox

Ignore:
Timestamp:
May 17, 2010 10:14:22 AM (15 years ago)
Author:
vboxsync
Message:

PDM: Added PDMDevHlpCallR0 and PDMDEV_VALIDATE_CONFIG_RETURN.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r28800 r29521  
    718718
    719719/**
    720  * The Raw-Mode Context Driver Helper Callbacks.
     720 * The Ring-0 Context Driver Helper Callbacks.
    721721 */
    722722extern DECLEXPORT(const PDMDRVHLPR0) g_pdmR0DrvHlp =
     
    809809    }
    810810}
     811
     812
     813/**
     814 * PDMDevHlpCallR0 helper.
     815 *
     816 * @returns See PFNPDMDEVREQHANDLERR0.
     817 * @param   pVM                 The VM handle (for validation).
     818 * @param   pReq                The request buffer.
     819 */
     820VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PVM pVM, PPDMDEVICECALLREQHANDLERREQ pReq)
     821{
     822    /*
     823     * Validate input and make the call.
     824     */
     825    AssertPtrReturn(pVM, VERR_INVALID_POINTER);
     826    AssertPtrReturn(pReq, VERR_INVALID_POINTER);
     827    AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER);
     828
     829    PPDMDEVINS pDevIns = pReq->pDevInsR0;
     830    AssertPtrReturn(pDevIns, VERR_INVALID_POINTER);
     831    AssertReturn(pDevIns->Internal.s.pVMR0 == pVM, VERR_INVALID_PARAMETER);
     832
     833    PFNPDMDEVREQHANDLERR0 pfnReqHandlerR0 = pReq->pfnReqHandlerR0;
     834    AssertPtrReturn(pfnReqHandlerR0, VERR_INVALID_POINTER);
     835
     836    return pfnReqHandlerR0(pDevIns, pReq->uOperation, pReq->u64Arg);
     837}
     838
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