DBGPlugInOS2.cpp revision c4dae796b4e3ea6e109f57c3ed6038532d27d0db
/* $Id$ */
/** @file
* DBGPlugInOS2 - Debugger and Guest OS Digger Plugin For OS/2.
*/
/*
* Copyright (C) 2009-2012 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 *
*******************************************************************************/
#include "DBGPlugIns.h"
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/** @name Internal OS/2 structures */
/** @} */
typedef enum DBGDIGGEROS2VER
{
/**
* OS/2 guest OS digger instance data.
*/
typedef struct DBGDIGGEROS2
{
/** Whether the information is valid or not.
* (For fending off illegal interface method calls.) */
bool fValid;
/** 32-bit (true) or 16-bit (false) */
bool f32Bit;
/** The OS/2 guest version. */
/** Guest's Global Info Segment selector. */
} DBGDIGGEROS2;
/** Pointer to the OS/2 guest OS digger instance data. */
typedef DBGDIGGEROS2 *PDBGDIGGEROS2;
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** The 'SAS ' signature. */
/** OS/2Warp on little endian ASCII systems. */
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/*******************************************************************************
* Global Variables *
*******************************************************************************/
/**
* Process a PE image found in guest memory.
*
* @param pThis The instance data.
* @param pVM The VM handle.
* @param pszName The image name.
* @param pImageAddr The image address.
* @param cbImage The size of the image.
* @param pbBuf Scratch buffer containing the first
* RT_MIN(cbBuf, cbImage) bytes of the image.
* @param cbBuf The scratch buffer size.
*/
{
/* To be implemented.*/
}
/**
* @copydoc DBGFOSREG::pfnQueryInterface
*/
static DECLCALLBACK(void *) dbgDiggerOS2QueryInterface(PVM pVM, void *pvData, DBGFOSINTERFACE enmIf)
{
return NULL;
}
/**
* @copydoc DBGFOSREG::pfnQueryVersion
*/
static DECLCALLBACK(int) dbgDiggerOS2QueryVersion(PVM pVM, void *pvData, char *pszVersion, size_t cchVersion)
{
char *achOS2ProductType[32];
char *pszOS2ProductType = (char *)achOS2ProductType;
{
}
{
{
}
{
}
{
}
else
{
}
}
RTStrPrintf(pszVersion, cchVersion, "%u.%u (%s)", pThis->OS2MajorVersion, pThis->OS2MinorVersion, pszOS2ProductType);
return VINF_SUCCESS;
}
/**
* @copydoc DBGFOSREG::pfnTerm
*/
{
}
/**
* @copydoc DBGFOSREG::pfnRefresh
*/
{
/*
* For now we'll flush and reload everything.
*/
if (hDbgAs != NIL_RTDBGAS)
{
while (iMod-- > 0)
{
if (hMod != NIL_RTDBGMOD)
{
{
}
}
}
}
}
/**
* @copydoc DBGFOSREG::pfnInit
*/
{
union
{
} u;
int rc;
/*
* Determine the OS/2 version.
*/
do {
if (RT_FAILURE(rc))
break;
if (RT_FAILURE(rc))
break;
return VINF_SUCCESS;
} while (0);
return VERR_NOT_SUPPORTED;
}
/**
* @copydoc DBGFOSREG::pfnProbe
*/
{
int rc;
union
{
} u;
/*
* If the DWORD at 70:0 contains 'SAS ' it's quite unlikely that this wouldn't be OS/2.
* Note: The SAS layout is similar between 16-bit and 32-bit OS/2, but not identical.
* 32-bit OS/2 will have the flat kernel data selector at SAS:06. The selector is 168h
* or similar. For 16-bit OS/2 the field contains a table offset into the SAS which will
* be much smaller. Fun fact: The global infoseg selector in the SAS is bimodal in 16-bit
* OS/2 and will work in real mode as well.
*/
do {
if (RT_FAILURE(rc))
break;
if (RT_FAILURE(rc))
break;
if (u.au32[0] != DIG_OS2_SAS_SIG)
break;
/* This sure looks like OS/2, but a bit of paranoia won't hurt. */
break;
/* If 4th word is bigger than 5th, it's the flat kernel mode selector. */
/* Offset into info table is either at SAS:14h or SAS:16h. */
else
/* The global infoseg selector is the first entry in the info table. */
return true;
} while (0);
return false;
}
/**
* @copydoc DBGFOSREG::pfnDestruct
*/
{
}
/**
* @copydoc DBGFOSREG::pfnConstruct
*/
{
return VINF_SUCCESS;
}
const DBGFOSREG g_DBGDiggerOS2 =
{
/* .u32Magic = */ DBGFOSREG_MAGIC,
/* .fFlags = */ 0,
/* .cbData = */ sizeof(DBGDIGGEROS2),
/* .szName = */ "OS/2",
/* .pfnConstruct = */ dbgDiggerOS2Construct,
/* .pfnDestruct = */ dbgDiggerOS2Destruct,
/* .pfnProbe = */ dbgDiggerOS2Probe,
/* .pfnInit = */ dbgDiggerOS2Init,
/* .pfnRefresh = */ dbgDiggerOS2Refresh,
/* .pfnTerm = */ dbgDiggerOS2Term,
/* .pfnQueryVersion = */ dbgDiggerOS2QueryVersion,
/* .pfnQueryInterface = */ dbgDiggerOS2QueryInterface,
/* .u32EndMagic = */ DBGFOSREG_MAGIC
};