1 | /* $Id: PDMR0Driver.cpp 80346 2019-08-19 19:36:29Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * PDM - Pluggable Device and Driver Manager, R0 Driver parts.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2019 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/vmcc.h>
|
---|
26 | #include <VBox/vmm/gvmm.h>
|
---|
27 |
|
---|
28 | #include <VBox/log.h>
|
---|
29 | #include <iprt/errcore.h>
|
---|
30 | #include <iprt/assert.h>
|
---|
31 |
|
---|
32 |
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * PDMDrvHlpCallR0 helper.
|
---|
36 | *
|
---|
37 | * @returns See PFNPDMDRVREQHANDLERR0.
|
---|
38 | * @param pGVM The global (ring-0) VM structure. (For validation.)
|
---|
39 | * @param pReq Pointer to the request buffer.
|
---|
40 | */
|
---|
41 | VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PGVM pGVM, PPDMDRIVERCALLREQHANDLERREQ pReq)
|
---|
42 | {
|
---|
43 | /*
|
---|
44 | * Validate input and make the call.
|
---|
45 | */
|
---|
46 | int rc = GVMMR0ValidateGVM(pGVM);
|
---|
47 | if (RT_SUCCESS(rc))
|
---|
48 | {
|
---|
49 | AssertPtrReturn(pReq, VERR_INVALID_POINTER);
|
---|
50 | AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER);
|
---|
51 |
|
---|
52 | PPDMDRVINS pDrvIns = pReq->pDrvInsR0;
|
---|
53 | AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);
|
---|
54 | AssertReturn(pDrvIns->Internal.s.pVMR0 == pGVM, VERR_INVALID_PARAMETER);
|
---|
55 |
|
---|
56 | PFNPDMDRVREQHANDLERR0 pfnReqHandlerR0 = pDrvIns->Internal.s.pfnReqHandlerR0;
|
---|
57 | AssertPtrReturn(pfnReqHandlerR0, VERR_INVALID_POINTER);
|
---|
58 |
|
---|
59 | rc = pfnReqHandlerR0(pDrvIns, pReq->uOperation, pReq->u64Arg);
|
---|
60 | }
|
---|
61 | return rc;
|
---|
62 | }
|
---|
63 |
|
---|