DBGFOS.cpp revision e86538a7bc028e823f16f8982e90f0c7ef5d4ece
/* $Id$ */
/** @file
* DBGF - Debugger Facility, Guest OS Diggers.
*/
/*
* Copyright (C) 2008 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_DBGF
#include "DBGFInternal.h"
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
#define DBGF_OS_READ_LOCK(pVM) do { } while (0)
#define DBGF_OS_READ_UNLOCK(pVM) do { } while (0)
#define DBGF_OS_WRITE_LOCK(pVM) do { } while (0)
#define DBGF_OS_WRITE_UNLOCK(pVM) do { } while (0)
/**
* Internal cleanup routine called by DBGFR3Term().
*
* @param pVM Pointer to the shared VM structure.
*/
{
/*
* Terminate the current one.
*/
{
}
/*
* Destroy all the instances.
*/
{
}
}
/**
* EMT worker function for DBGFR3OSRegister.
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pReg The registration structure.
*/
{
/* more validations. */
{
return VERR_ALREADY_LOADED;
}
/*
* Allocate a new structure, call the constructor and link it into the list.
*/
if (RT_SUCCESS(rc))
{
}
else
{
}
return VINF_SUCCESS;
}
/**
* Registers a guest OS digger.
*
* This will instantiate an instance of the digger and add it
* to the list for us in the next call to DBGFR3OSDetect().
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pReg The registration structure.
* @thread Any.
*/
{
/*
* Validate intput.
*/
/*
* Pass it on to EMT(0).
*/
}
/**
* EMT worker function for DBGFR3OSDeregister.
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pReg The registration structure.
*/
{
/*
* Unlink it.
*/
bool fWasCurOS = false;
{
if (pOSPrev)
else
{
fWasCurOS = true;
}
break;
}
if (!pOS)
{
return VERR_NOT_FOUND;
}
/*
* Terminate it if it was the current OS, then invoke the
* destructor and clean up.
*/
if (fWasCurOS)
return VINF_SUCCESS;
}
/**
* Deregisters a guest OS digger previously registered by DBGFR3OSRegister.
*
* @returns VBox status code.
*
* @param pVM Pointer to the shared VM structure.
* @param pReg The registration structure.
* @thread Any.
*/
{
/*
* Validate input.
*/
break;
if (!pOS)
{
return VERR_NOT_FOUND;
}
/*
* Pass it on to EMT(0).
*/
}
/**
* EMT worker function for DBGFR3OSDetect.
*
* @returns VBox status code.
* @retval VINF_SUCCESS if successfully detected.
* @retval VINF_DBGF_OS_NOT_DETCTED if we cannot figure it out.
*
* @param pVM Pointer to the shared VM structure.
* @param pszName Where to store the OS name. Empty string if not detected.
* @param cchName Size of the buffer.
*/
{
/*
* Cycle thru the detection routines.
*/
{
int rc;
else
{
if (pOldOS)
}
return rc;
}
/* not found */
if (pOldOS)
return VINF_DBGF_OS_NOT_DETCTED;
}
/**
* Detectes the guest OS and try dig out symbols and useful stuff.
*
* When called the 2nd time, symbols will be updated that if the OS
* is the same.
*
* @returns VBox status code.
* @retval VINF_SUCCESS if successfully detected.
* @retval VINF_DBGF_OS_NOT_DETCTED if we cannot figure it out.
*
* @param pVM Pointer to the shared VM structure.
* @param pszName Where to store the OS name. Empty string if not detected.
* @param cchName Size of the buffer.
* @thread Any.
*/
{
*pszName = '\0';
/*
* Pass it on to EMT(0).
*/
return VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)dbgfR3OSDetect, 3, pVM, pszName, cchName);
}
/**
* EMT worker function for DBGFR3OSQueryNameAndVersion
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pszName Where to store the OS name. Optional.
* @param cchName The size of the name buffer.
* @param pszVersion Where to store the version string. Optional.
* @param cchVersion The size of the version buffer.
*/
static DECLCALLBACK(int) dbgfR3OSQueryNameAndVersion(PVM pVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion)
{
/*
* Any known OS?
*/
{
int rc = VINF_SUCCESS;
{
else
{
}
}
if (pszVersion && cchVersion)
{
int rc2 = pVM->dbgf.s.pCurOS->pReg->pfnQueryVersion(pVM, pVM->dbgf.s.pCurOS->abData, pszVersion, cchVersion);
}
return rc;
}
return VERR_DBGF_OS_NOT_DETCTED;
}
/**
*
* It goes without saying that this querying is done using the current
* guest OS digger and not additions or user configuration.
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pszName Where to store the OS name. Optional.
* @param cchName The size of the name buffer.
* @param pszVersion Where to store the version string. Optional.
* @param cchVersion The size of the version buffer.
* @thread Any.
*/
VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PVM pVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion)
{
/*
* Initialize the output up front.
*/
*pszName = '\0';
if (pszVersion && cchVersion)
*pszVersion = '\0';
/*
* Pass it on to EMT(0).
*/
}
/**
* EMT worker for DBGFR3OSQueryInterface.
*
* @param pVM Pointer to the shared VM structure.
* @param enmIf The interface identifier.
* @param ppvIf Where to store the interface pointer on success.
*/
{
{
if (*ppvIf)
{
/** @todo Create EMT wrapper for the returned interface once we've defined one...
* Just keep a list of wrapper together with the OS instance. */
}
}
else
}
/**
* Query an optional digger interface.
*
* @returns Pointer to the digger interface on success, NULL if the interfaces isn't
* available or no active guest OS digger.
* @param pVM Pointer to the shared VM structure.
* @param enmIf The interface identifier.
* @thread Any.
*/
{
AssertMsgReturn(enmIf > DBGFOSINTERFACE_INVALID && enmIf < DBGFOSINTERFACE_END, ("%d\n", enmIf), NULL);
/*
* Pass it on to an EMT.
*/
return pvIf;
}