DisasmFormatBytes.cpp revision e64031e20c39650a7bc902a3e1aba613b9415dee
/* $Id$ */
/** @file
* VBox Disassembler - Helper for formatting the opcode bytes.
*/
/*
* 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 *
*******************************************************************************/
#include "DisasmInternal.h"
/**
* Helper function for formatting the opcode bytes.
*
* @returns The number of output bytes.
*
* @param pCpu Pointer to the disassembler cpu state.
* @param pszDst The output buffer.
* @param cchDst The size of the output buffer.
* @param fFlags The flags passed to the formatter.
*/
{
/*
* Read the bytes first.
*/
if (cb > 16)
cb = 16;
if (pCpu->pfnReadBytes)
{
if (RT_FAILURE(rc))
{
{
if (RT_FAILURE(rc2))
ab[i] = 0xcc;
}
}
}
else
{
}
/*
* Now for the output.
*/
do { \
cchOutput++; \
if (cchDst > 1) \
{ \
cchDst--; \
} \
} while (0)
do { \
if (cchDst > 1) \
{ \
} \
} while (0)
PUT_C('[');
{
if (i != 0 && (fFlags & DIS_FMT_FLAGS_BYTES_SPACED))
else
}
PUT_C(']');
/* Terminate it just in case. */
if (cchDst >= 1)
*pszDst = '\0';
return cchOutput;
}