2013-08-21 09:37:21 +00:00
|
|
|
/*
|
|
|
|
* \brief VirtualBox pluggable device manager (PDM)
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2013-08-20
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2013-2017 Genode Labs GmbH
|
2013-08-21 09:37:21 +00:00
|
|
|
*
|
|
|
|
* This file is distributed under the terms of the GNU General Public License
|
|
|
|
* version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
#include <base/log.h>
|
2013-08-21 09:37:21 +00:00
|
|
|
#include <util/string.h>
|
|
|
|
|
|
|
|
/* VirtualBox includes */
|
|
|
|
#include <VBox/vmm/pdmapi.h>
|
|
|
|
#include <VBox/vmm/pdmdrv.h>
|
|
|
|
#include <VBox/vmm/pdmdev.h>
|
2015-02-22 18:04:55 +00:00
|
|
|
#include <VBox/vmm/pdmusb.h>
|
2013-08-21 09:37:21 +00:00
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void RCSymbolDummy()
|
|
|
|
{
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::log(__func__, ": unexpected call of RC symbol");
|
2013-08-21 09:37:21 +00:00
|
|
|
for (;;);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PDMR3LdrGetSymbolRC(PVM pVM, const char *pszModule, const char *pszSymbol,
|
|
|
|
PRTRCPTR pRCPtrValue)
|
|
|
|
{
|
|
|
|
*pRCPtrValue = to_rtrcptr(RCSymbolDummy);
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PDMR3LdrGetSymbolRCLazy(PVM pVM, const char *pszModule,
|
|
|
|
const char *pszSearchPath, const char *pszSymbol,
|
|
|
|
PRTRCPTR pRCPtrValue)
|
|
|
|
{
|
|
|
|
*pRCPtrValue = to_rtrcptr(RCSymbolDummy);
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void R0SymbolDummy()
|
|
|
|
{
|
2014-09-23 11:01:47 +00:00
|
|
|
Assert(!"unexpected call of R0 symbol");
|
2013-08-21 09:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PDMR3LdrGetSymbolR0(PVM pVM, const char *pszModule, const char *pszSymbol,
|
|
|
|
PRTR0PTR ppvValue)
|
|
|
|
{
|
|
|
|
*ppvValue = (RTR0PTR)R0SymbolDummy;
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule,
|
|
|
|
const char *pszSearchPath, const char *pszSymbol,
|
|
|
|
PRTR0PTR ppvValue)
|
|
|
|
{
|
|
|
|
*ppvValue = (RTR0PTR)R0SymbolDummy;
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" int VBoxDriversRegister(PCPDMDRVREGCB, uint32_t);
|
|
|
|
extern "C" int VBoxDevicesRegister(PPDMDEVREGCB, uint32_t);
|
2014-09-23 11:01:47 +00:00
|
|
|
extern "C" int VBoxDriversRegister_Main(PCPDMDRVREGCB, uint32_t);
|
2015-02-22 18:04:55 +00:00
|
|
|
extern "C" int VBoxUsbRegister(PCPDMUSBREGCB, uint32_t);
|
2013-08-21 09:37:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
static int dummy_VBoxDriversRegister(PCPDMDRVREGCB, uint32_t) { return VINF_SUCCESS; }
|
|
|
|
static int dummy_VBoxDevicesRegister(PPDMDEVREGCB, uint32_t) { return VINF_SUCCESS; }
|
|
|
|
|
|
|
|
|
|
|
|
int PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol,
|
|
|
|
void **ppvValue)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* This function is called at initialization time via
|
|
|
|
* PDMR3Init -> pdmR3DrvInit -> pdmR3DrvLoad -> PDMR3LdrGetSymbolR3
|
|
|
|
*
|
|
|
|
* In this case, it is expected to return the pointer to the symbol
|
|
|
|
* called 'VBoxDriversRegister', which is normally contained in the
|
|
|
|
* dynamically loaded VBoxDD module. However, we link the driver
|
|
|
|
* statically to the binary. So we return the local pointer.
|
|
|
|
*/
|
|
|
|
if (Genode::strcmp(pszModule, "VBoxDD") == 0) {
|
|
|
|
|
|
|
|
if (Genode::strcmp(pszSymbol, "VBoxDriversRegister") == 0) {
|
|
|
|
*ppvValue = (void *)VBoxDriversRegister;
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Genode::strcmp(pszSymbol, "VBoxDevicesRegister") == 0) {
|
|
|
|
*ppvValue = (void *)VBoxDevicesRegister;
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
2015-02-22 18:04:55 +00:00
|
|
|
if (Genode::strcmp(pszSymbol, "VBoxUsbRegister") == 0) {
|
|
|
|
*ppvValue = (void *)VBoxUsbRegister;
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
2013-08-21 09:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Genode::strcmp(pszModule, "VBoxDD2") == 0) {
|
|
|
|
|
|
|
|
if (Genode::strcmp(pszSymbol, "VBoxDriversRegister") == 0) {
|
|
|
|
*ppvValue = (void *)dummy_VBoxDriversRegister;
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Genode::strcmp(pszSymbol, "VBoxDevicesRegister") == 0) {
|
|
|
|
*ppvValue = (void *)dummy_VBoxDevicesRegister;
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:01:47 +00:00
|
|
|
if (Genode::strcmp(pszModule, "VBoxC") == 0) {
|
|
|
|
if (Genode::strcmp(pszSymbol, "VBoxDriversRegister") == 0) {
|
|
|
|
*ppvValue = (void *)VBoxDriversRegister_Main;
|
|
|
|
return VINF_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
Genode::error("pszModule=", pszModule, " pszSymbol=", pszSymbol);
|
2013-08-21 09:37:21 +00:00
|
|
|
|
|
|
|
return VERR_SYMBOL_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
|