1 | /* $Id: PDMR0Driver.cpp 62478 2016-07-22 18:29:06Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * PDM - Pluggable Device and Driver Manager, R0 Driver parts.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2016 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*********************************************************************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *********************************************************************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_PDM_DRIVER
|
---|
23 | #include "PDMInternal.h"
|
---|
24 | #include <VBox/vmm/pdm.h>
|
---|
25 | #include <VBox/vmm/vm.h>
|
---|
26 |
|
---|
27 | #include <VBox/log.h>
|
---|
28 | #include <VBox/err.h>
|
---|
29 | #include <iprt/assert.h>
|
---|
30 |
|
---|
31 |
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * PDMDrvHlpCallR0 helper.
|
---|
35 | *
|
---|
36 | * @returns See PFNPDMDRVREQHANDLERR0.
|
---|
37 | * @param pVM The cross context VM structure. (For validation.)
|
---|
38 | * @param pReq Pointer to the request buffer.
|
---|
39 | */
|
---|
40 | VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PVM pVM, PPDMDRIVERCALLREQHANDLERREQ pReq)
|
---|
41 | {
|
---|
42 | /*
|
---|
43 | * Validate input and make the call.
|
---|
44 | */
|
---|
45 | AssertPtrReturn(pVM, VERR_INVALID_POINTER);
|
---|
46 | AssertPtrReturn(pReq, VERR_INVALID_POINTER);
|
---|
47 | AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER);
|
---|
48 |
|
---|
49 | PPDMDRVINS pDrvIns = pReq->pDrvInsR0;
|
---|
50 | AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);
|
---|
51 | AssertReturn(pDrvIns->Internal.s.pVMR0 == pVM, VERR_INVALID_PARAMETER);
|
---|
52 |
|
---|
53 | PFNPDMDRVREQHANDLERR0 pfnReqHandlerR0 = pDrvIns->Internal.s.pfnReqHandlerR0;
|
---|
54 | AssertPtrReturn(pfnReqHandlerR0, VERR_INVALID_POINTER);
|
---|
55 |
|
---|
56 | return pfnReqHandlerR0(pDrvIns, pReq->uOperation, pReq->u64Arg);
|
---|
57 | }
|
---|
58 |
|
---|