diff options
Diffstat (limited to 'src/VBox/VMM/VMMR3/PDMDevice.cpp')
| -rw-r--r-- | src/VBox/VMM/VMMR3/PDMDevice.cpp | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/src/VBox/VMM/VMMR3/PDMDevice.cpp b/src/VBox/VMM/VMMR3/PDMDevice.cpp index 23c39ccb..e7e33ceb 100644 --- a/src/VBox/VMM/VMMR3/PDMDevice.cpp +++ b/src/VBox/VMM/VMMR3/PDMDevice.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2010 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -25,12 +25,14 @@ #include <VBox/vmm/mm.h> #include <VBox/vmm/pgm.h> #include <VBox/vmm/iom.h> +#include <VBox/vmm/hm.h> #include <VBox/vmm/cfgm.h> #ifdef VBOX_WITH_REM # include <VBox/vmm/rem.h> #endif #include <VBox/vmm/dbgf.h> #include <VBox/vmm/vm.h> +#include <VBox/vmm/uvm.h> #include <VBox/vmm/vmm.h> #include <VBox/version.h> @@ -128,9 +130,12 @@ int pdmR3DevInit(PVM pVM) /* * Get the RC & R0 devhlps and create the devhlp R3 task queue. */ - PCPDMDEVHLPRC pHlpRC; - rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDevHlp", &pHlpRC); - AssertReleaseRCReturn(rc, rc); + PCPDMDEVHLPRC pHlpRC = NIL_RTRCPTR; + if (!HMIsEnabled(pVM)) + { + rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_pdmRCDevHlp", &pHlpRC); + AssertReleaseRCReturn(rc, rc); + } PCPDMDEVHLPR0 pHlpR0; rc = PDMR3LdrGetSymbolR0(pVM, NULL, "g_pdmR0DevHlp", &pHlpR0); @@ -352,7 +357,7 @@ int pdmR3DevInit(PVM pVM) ? MMHyperR3ToR0(pVM, pCritSect) : NIL_RTR0PTR; rc = pdmR3CritSectInitDeviceAuto(pVM, pDevIns, pCritSect, RT_SRC_POS, - "%s#%u Auto", pDevIns->pReg->szName, pDevIns->iInstance); + "%s#%uAuto", pDevIns->pReg->szName, pDevIns->iInstance); AssertLogRelRCReturn(rc, rc); /* @@ -775,7 +780,7 @@ int pdmR3DevFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned * This is used to change drivers and suchlike at runtime. * * @returns VBox status code. - * @param pVM Pointer to the VM. + * @param pUVM The user mode VM handle. * @param pszDevice Device name. * @param iInstance Device instance. * @param iLun The Logical Unit to obtain the interface of. @@ -783,8 +788,11 @@ int pdmR3DevFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned * @param ppBase Where to store the base interface pointer. Optional. * @thread EMT */ -VMMR3DECL(int) PDMR3DeviceAttach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags, PPPDMIBASE ppBase) +VMMR3DECL(int) PDMR3DeviceAttach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags, PPPDMIBASE ppBase) { + UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); + PVM pVM = pUVM->pVM; + VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); VM_ASSERT_EMT(pVM); LogFlow(("PDMR3DeviceAttach: pszDevice=%p:{%s} iInstance=%d iLun=%d fFlags=%#x ppBase=%p\n", pszDevice, pszDevice, iInstance, iLun, fFlags, ppBase)); @@ -834,16 +842,16 @@ VMMR3DECL(int) PDMR3DeviceAttach(PVM pVM, const char *pszDevice, unsigned iInsta * This is used to change drivers and suchlike at runtime. * * @returns VBox status code. - * @param pVM Pointer to the VM. + * @param pUVM The user mode VM handle. * @param pszDevice Device name. * @param iInstance Device instance. * @param iLun The Logical Unit to obtain the interface of. * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. * @thread EMT */ -VMMR3DECL(int) PDMR3DeviceDetach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags) +VMMR3DECL(int) PDMR3DeviceDetach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags) { - return PDMR3DriverDetach(pVM, pszDevice, iInstance, iLun, NULL, 0, fFlags); + return PDMR3DriverDetach(pUVM, pszDevice, iInstance, iLun, NULL, 0, fFlags); } @@ -879,7 +887,7 @@ VMMR3_INT_DECL(PPDMCRITSECT) PDMR3DevGetCritSect(PVM pVM, PPDMDEVINS pDevIns) * below it. * * @returns VBox status code. - * @param pVM Pointer to the VM. + * @param pUVM The user mode VM handle. * @param pszDevice Device name. * @param iInstance Device instance. * @param iLun The Logical Unit to obtain the interface of. @@ -888,11 +896,14 @@ VMMR3_INT_DECL(PPDMCRITSECT) PDMR3DevGetCritSect(PVM pVM, PPDMDEVINS pDevIns) * * @thread EMT */ -VMMR3DECL(int) PDMR3DriverAttach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags, PPPDMIBASE ppBase) +VMMR3DECL(int) PDMR3DriverAttach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags, PPPDMIBASE ppBase) { - VM_ASSERT_EMT(pVM); LogFlow(("PDMR3DriverAttach: pszDevice=%p:{%s} iInstance=%d iLun=%d fFlags=%#x ppBase=%p\n", pszDevice, pszDevice, iInstance, iLun, fFlags, ppBase)); + UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); + PVM pVM = pUVM->pVM; + VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); + VM_ASSERT_EMT(pVM); if (ppBase) *ppBase = NULL; @@ -961,7 +972,7 @@ VMMR3DECL(int) PDMR3DriverAttach(PVM pVM, const char *pszDevice, unsigned iInsta * pfnDetach callback (PDMDRVREG / PDMDEVREG). * * @returns VBox status code. - * @param pVM Pointer to the VM. + * @param pUVM The user mode VM handle. * @param pszDevice Device name. * @param iDevIns Device instance. * @param iLun The Logical Unit in which to look for the driver. @@ -972,11 +983,14 @@ VMMR3DECL(int) PDMR3DriverAttach(PVM pVM, const char *pszDevice, unsigned iInsta * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. * @thread EMT */ -VMMR3DECL(int) PDMR3DriverDetach(PVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, +VMMR3DECL(int) PDMR3DriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, const char *pszDriver, unsigned iOccurance, uint32_t fFlags) { LogFlow(("PDMR3DriverDetach: pszDevice=%p:{%s} iDevIns=%u iLun=%u pszDriver=%p:{%s} iOccurance=%u fFlags=%#x\n", pszDevice, pszDevice, iDevIns, iLun, pszDriver, iOccurance, fFlags)); + UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); + PVM pVM = pUVM->pVM; + VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); VM_ASSERT_EMT(pVM); AssertPtr(pszDevice); AssertPtrNull(pszDriver); @@ -1032,7 +1046,7 @@ VMMR3DECL(int) PDMR3DriverDetach(PVM pVM, const char *pszDevice, unsigned iDevIn * thread. * * @returns VBox status code. - * @param pVM Pointer to the VM. + * @param pUVM The user mode VM handle. * @param pszDevice Device name. * @param iDevIns Device instance. * @param iLun The Logical Unit in which to look for the driver. @@ -1053,11 +1067,11 @@ VMMR3DECL(int) PDMR3DriverDetach(PVM pVM, const char *pszDevice, unsigned iDevIn * * @thread Any thread. The EMTs will be involved at some point though. */ -VMMR3DECL(int) PDMR3DriverReattach(PVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, +VMMR3DECL(int) PDMR3DriverReattach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, const char *pszDriver, unsigned iOccurance, uint32_t fFlags, PCFGMNODE pCfg, PPPDMIBASE ppBase) { - NOREF(pVM); NOREF(pszDevice); NOREF(iDevIns); NOREF(iLun); NOREF(pszDriver); NOREF(iOccurance); + NOREF(pUVM); NOREF(pszDevice); NOREF(iDevIns); NOREF(iLun); NOREF(pszDriver); NOREF(iOccurance); NOREF(fFlags); NOREF(pCfg); NOREF(ppBase); return VERR_NOT_IMPLEMENTED; } |
