VirtualBox

Changeset 29521 in vbox for trunk/src/VBox/VMM/VMMR0


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

PDM: Added PDMDevHlpCallR0 and PDMDEV_VALIDATE_CONFIG_RETURN.

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 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
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r29458 r29521  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    10151015        }
    10161016
     1017        case VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER:
     1018        {
     1019            if (!pVM || !pReqHdr || u64Arg || idCpu != NIL_VMCPUID)
     1020                return VERR_INVALID_PARAMETER;
     1021            return PDMR0DeviceCallReqHandler(pVM, (PPDMDEVICECALLREQHANDLERREQ)pReqHdr);
     1022        }
     1023
    10171024        /*
    10181025         * Requests to the internal networking service.
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