cosmetic changes

This commit is contained in:
flobernd 2015-03-18 16:53:49 +01:00
parent 48fd678632
commit 0df2deb78a
2 changed files with 131 additions and 95 deletions

View File

@ -79,7 +79,8 @@ typedef struct _VXMemoryDataSource
uint64_t inputBufferPos; uint64_t inputBufferPos;
} VXMemoryDataSource; } VXMemoryDataSource;
static void VXMemoryDataSource_Construct(VXBaseDataSourceContext *ctx, const void* buffer, size_t bufferLen); static void VXMemoryDataSource_Construct(VXBaseDataSourceContext *ctx, const void* buffer,
size_t bufferLen);
static void VXMemoryDataSource_Destruct(VXBaseDataSourceContext *ctx); static void VXMemoryDataSource_Destruct(VXBaseDataSourceContext *ctx);
VXBaseDataSourceContext* VXMemoryDataSource_Create(const void* buffer, size_t bufferLen); VXBaseDataSourceContext* VXMemoryDataSource_Create(const void* buffer, size_t bufferLen);
static uint8_t VXMemoryDataSource_InternalInputPeek(VXBaseDataSourceContext *ctx); static uint8_t VXMemoryDataSource_InternalInputPeek(VXBaseDataSourceContext *ctx);
@ -108,37 +109,70 @@ typedef enum _VXRegisterClass /* : uint8_t */
RC_XMM RC_XMM
} VXRegisterClass; } VXRegisterClass;
static uint8_t VXInstructionDecoder_InputPeek(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); static uint8_t VXInstructionDecoder_InputPeek(VXInstructionDecoderContext *ctx,
static uint8_t VXInstructionDecoder_InputNext8(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); VXInstructionInfo *info);
static uint16_t VXInstructionDecoder_InputNext16(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); static uint8_t VXInstructionDecoder_InputNext8(VXInstructionDecoderContext *ctx,
static uint32_t VXInstructionDecoder_InputNext32(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); VXInstructionInfo *info);
static uint64_t VXInstructionDecoder_InputNext64(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); static uint16_t VXInstructionDecoder_InputNext16(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
static uint32_t VXInstructionDecoder_InputNext32(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
static uint64_t VXInstructionDecoder_InputNext64(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
static uint8_t VXInstructionDecoder_InputCurrent(const VXInstructionDecoderContext *ctx); static uint8_t VXInstructionDecoder_InputCurrent(const VXInstructionDecoderContext *ctx);
VXBaseDataSourceContext* VXInstructionDecoder_GetDataSource(const VXInstructionDecoderContext *ctx); VXBaseDataSourceContext* VXInstructionDecoder_GetDataSource(
void VXInstructionDecoder_SetDataSource(VXInstructionDecoderContext *ctx, VXBaseDataSourceContext *input); const VXInstructionDecoderContext *ctx);
VXDisassemblerMode VXInstructionDecoder_GetDisassemblerMode(const VXInstructionDecoderContext *ctx); void VXInstructionDecoder_SetDataSource(VXInstructionDecoderContext *ctx,
void VXInstructionDecoder_SetDisassemblerMode(VXInstructionDecoderContext *ctx, VXDisassemblerMode disassemblerMode); VXBaseDataSourceContext *input);
VXInstructionSetVendor VXInstructionDecoder_GetPreferredVendor(const VXInstructionDecoderContext *ctx); VXDisassemblerMode VXInstructionDecoder_GetDisassemblerMode(
void VXInstructionDecoder_SetPreferredVendor(VXInstructionDecoderContext *ctx, VXInstructionSetVendor preferredVendor); const VXInstructionDecoderContext *ctx);
void VXInstructionDecoder_SetDisassemblerMode(VXInstructionDecoderContext *ctx,
VXDisassemblerMode disassemblerMode);
VXInstructionSetVendor VXInstructionDecoder_GetPreferredVendor(
const VXInstructionDecoderContext *ctx);
void VXInstructionDecoder_SetPreferredVendor(VXInstructionDecoderContext *ctx,
VXInstructionSetVendor preferredVendor);
uint64_t VXInstructionDecoder_GetInstructionPointer(const VXInstructionDecoderContext *ctx); uint64_t VXInstructionDecoder_GetInstructionPointer(const VXInstructionDecoderContext *ctx);
void VXInstructionDecoder_SetInstructionPointer(VXInstructionDecoderContext *ctx, uint64_t instructionPointer); void VXInstructionDecoder_SetInstructionPointer(VXInstructionDecoderContext *ctx,
static bool VXInstructionDecoder_DecodeRegisterOperand(const VXInstructionDecoderContext *ctx, VXInstructionInfo *info, VXOperandInfo *operand, VXRegisterClass registerClass, uint8_t registerId, VXDefinedOperandSize operandSize); uint64_t instructionPointer);
static bool VXInstructionDecoder_DecodeRegisterMemoryOperand(VXInstructionDecoderContext *ctx, VXInstructionInfo *info, VXOperandInfo *operand, VXRegisterClass registerClass, VXDefinedOperandSize operandSize); static bool VXInstructionDecoder_DecodeRegisterOperand(const VXInstructionDecoderContext *ctx,
static bool VXInstructionDecoder_DecodeImmediate(VXInstructionDecoderContext *ctx, VXInstructionInfo *info, VXOperandInfo *operand, VXDefinedOperandSize operandSize); VXInstructionInfo *info, VXOperandInfo *operand, VXRegisterClass registerClass,
static bool VXInstructionDecoder_DecodeDisplacement(VXInstructionDecoderContext *ctx, VXInstructionInfo *info, VXOperandInfo *operand, uint8_t size); uint8_t registerId, VXDefinedOperandSize operandSize);
static bool VXInstructionDecoder_DecodeModrm(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); static bool VXInstructionDecoder_DecodeRegisterMemoryOperand(VXInstructionDecoderContext *ctx,
static bool VXInstructionDecoder_DecodeSIB(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); VXInstructionInfo *info, VXOperandInfo *operand, VXRegisterClass registerClass,
static bool VXInstructionDecoder_DecodeVex(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); VXDefinedOperandSize operandSize);
static uint16_t VXInstructionDecoder_GetEffectiveOperandSize(const VXInstructionDecoderContext *ctx, const VXInstructionInfo *info, VXDefinedOperandSize operandSize); static bool VXInstructionDecoder_DecodeImmediate(VXInstructionDecoderContext *ctx,
static bool VXInstructionDecoder_DecodeOperands(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); VXInstructionInfo *info, VXOperandInfo *operand, VXDefinedOperandSize operandSize);
static bool VXInstructionDecoder_DecodeOperand(VXInstructionDecoderContext *ctx, VXInstructionInfo *info, VXOperandInfo *operand, VXDefinedOperandType operandType, VXDefinedOperandSize operandSize); static bool VXInstructionDecoder_DecodeDisplacement(VXInstructionDecoderContext *ctx,
static void VXInstructionDecoder_ResolveOperandAndAddressMode(const VXInstructionDecoderContext *ctx, VXInstructionInfo *info); VXInstructionInfo *info, VXOperandInfo *operand, uint8_t size);
static void VXInstructionDecoder_CalculateEffectiveRexVexValues(const VXInstructionDecoderContext *ctx, VXInstructionInfo *info); static bool VXInstructionDecoder_DecodeModrm(VXInstructionDecoderContext *ctx,
static bool VXInstructionDecoder_DecodePrefixes(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); VXInstructionInfo *info);
static bool VXInstructionDecoder_DecodeOpcode(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); static bool VXInstructionDecoder_DecodeSIB(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
static bool VXInstructionDecoder_DecodeVex(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
static uint16_t VXInstructionDecoder_GetEffectiveOperandSize(
const VXInstructionDecoderContext *ctx, const VXInstructionInfo *info,
VXDefinedOperandSize operandSize);
static bool VXInstructionDecoder_DecodeOperands(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
static bool VXInstructionDecoder_DecodeOperand(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info, VXOperandInfo *operand, VXDefinedOperandType operandType,
VXDefinedOperandSize operandSize);
static void VXInstructionDecoder_ResolveOperandAndAddressMode(
const VXInstructionDecoderContext *ctx, VXInstructionInfo *info);
static void VXInstructionDecoder_CalculateEffectiveRexVexValues(
const VXInstructionDecoderContext *ctx, VXInstructionInfo *info);
static bool VXInstructionDecoder_DecodePrefixes(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
static bool VXInstructionDecoder_DecodeOpcode(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
VXInstructionDecoderContext* VXInstructionDecoder_Create(void); VXInstructionDecoderContext* VXInstructionDecoder_Create(void);
VXInstructionDecoderContext* VXInstructionDecoder_CreateEx(VXBaseDataSourceContext *input, VXDisassemblerMode disassemblerMode, VXInstructionSetVendor preferredVendor, uint64_t instructionPointer); VXInstructionDecoderContext* VXInstructionDecoder_CreateEx(
bool VXInstructionDecoder_DecodeInstruction(VXInstructionDecoderContext *ctx, VXInstructionInfo *info); VXBaseDataSourceContext *input, VXDisassemblerMode disassemblerMode,
VXInstructionSetVendor preferredVendor, uint64_t instructionPointer);
bool VXInstructionDecoder_DecodeInstruction(VXInstructionDecoderContext *ctx,
VXInstructionInfo *info);
/* Implementation ============================================================================== */ /* Implementation ============================================================================== */
@ -330,12 +364,9 @@ static bool VXMemoryDataSource_SetPosition(VXBaseDataSourceContext *ctx, uint64_
/* VXInstructionDecoder ------------------------------------------------------------------------ */ /* VXInstructionDecoder ------------------------------------------------------------------------ */
void VXInstructionDecoder_Construct( void VXInstructionDecoder_Construct(VXInstructionDecoderContext *ctx,
VXInstructionDecoderContext *ctx, VXBaseDataSourceContext *input, VXDisassemblerMode disassemblerMode,
VXBaseDataSourceContext *input, VXInstructionSetVendor preferredVendor, uint64_t instructionPointer)
VXDisassemblerMode disassemblerMode,
VXInstructionSetVendor preferredVendor,
uint64_t instructionPointer)
{ {
VXInstructionDecoder *thiz = VXInstructionDecoder_thiz(ctx); VXInstructionDecoder *thiz = VXInstructionDecoder_thiz(ctx);
@ -355,10 +386,8 @@ VXInstructionDecoderContext* VXInstructionDecoder_Create(void)
return VXInstructionDecoder_CreateEx(NULL, DM_M32BIT, ISV_ANY, 0); return VXInstructionDecoder_CreateEx(NULL, DM_M32BIT, ISV_ANY, 0);
} }
VXInstructionDecoderContext* VXInstructionDecoder_CreateEx( VXInstructionDecoderContext* VXInstructionDecoder_CreateEx(VXBaseDataSourceContext *input,
VXBaseDataSourceContext *input, VXDisassemblerMode disassemblerMode, VXInstructionSetVendor preferredVendor,
VXDisassemblerMode disassemblerMode,
VXInstructionSetVendor preferredVendor,
uint64_t instructionPointer) uint64_t instructionPointer)
{ {
VXInstructionDecoder *thiz = malloc(sizeof(VXInstructionDecoder)); VXInstructionDecoder *thiz = malloc(sizeof(VXInstructionDecoder));
@ -1679,8 +1708,7 @@ static bool VXInstructionDecoder_DecodeOpcode(VXInstructionDecoderContext *ctx,
return false; return false;
} }
bool VXInstructionDecoder_DecodeInstruction( bool VXInstructionDecoder_DecodeInstruction(VXInstructionDecoderContext *ctx,
VXInstructionDecoderContext *ctx,
VXInstructionInfo *info) VXInstructionInfo *info)
{ {
VXInstructionDecoder *thiz = VXInstructionDecoder_thiz(ctx); VXInstructionDecoder *thiz = VXInstructionDecoder_thiz(ctx);

View File

@ -62,7 +62,8 @@ typedef struct _VXBaseSymbolResolver
static void VXBaseSymbolResolver_Construct(VXBaseSymbolResolverContext *ctx); static void VXBaseSymbolResolver_Construct(VXBaseSymbolResolverContext *ctx);
static void VXBaseSymbolResolver_Destruct(VXBaseSymbolResolverContext *ctx); static void VXBaseSymbolResolver_Destruct(VXBaseSymbolResolverContext *ctx);
void VXBaseSymbolResolver_Release(VXBaseSymbolResolverContext *ctx); void VXBaseSymbolResolver_Release(VXBaseSymbolResolverContext *ctx);
const char* VXBaseSymbolResolver_ResolveSymbol(VXBaseSymbolResolverContext *ctx, const VXInstructionInfo *info, uint64_t address, uint64_t *offset); const char* VXBaseSymbolResolver_ResolveSymbol(VXBaseSymbolResolverContext *ctx,
const VXInstructionInfo *info, uint64_t address, uint64_t *offset);
/* VXBaseInstructionFormatter ------------------------------------------------------------------ */ /* VXBaseInstructionFormatter ------------------------------------------------------------------ */
@ -82,22 +83,36 @@ typedef struct _VXBaseInstructionFormatter
bool outputUppercase; bool outputUppercase;
} VXBaseInstructionFormatter; } VXBaseInstructionFormatter;
static void VXBaseInstructionFormatter_Construct(VXBaseInstructionFormatterContext *ctx, VXBaseSymbolResolverContext *symbolResolver); static void VXBaseInstructionFormatter_Construct(VXBaseInstructionFormatterContext *ctx,
VXBaseSymbolResolverContext *symbolResolver);
static void VXBaseInstructionFormatter_Destruct(VXBaseInstructionFormatterContext *ctx); static void VXBaseInstructionFormatter_Destruct(VXBaseInstructionFormatterContext *ctx);
void VXBaseInstructionFormatter_Release(VXBaseInstructionFormatterContext *ctx); void VXBaseInstructionFormatter_Release(VXBaseInstructionFormatterContext *ctx);
/*static void VXBaseInstructionFormatter_OutputSetUppercase(VXBaseInstructionFormatterContext *ctx, bool uppercase);*/ /*static void VXBaseInstructionFormatter_OutputSetUppercase(VXBaseInstructionFormatterContext *ctx, bool uppercase);*/
static char const* VXBaseInstructionFormatter_RegisterToString(const VXBaseInstructionFormatterContext *ctx, VXRegister reg); static char const* VXBaseInstructionFormatter_RegisterToString(
static char const* VXBaseInstructionFormatter_ResolveSymbol(const VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, uint64_t address, uint64_t *offset); const VXBaseInstructionFormatterContext *ctx, VXRegister reg);
VXBaseSymbolResolverContext* VXBaseInstructionFormatter_GetSymbolResolver(const VXBaseInstructionFormatterContext *ctx); static char const* VXBaseInstructionFormatter_ResolveSymbol(
void VXBaseInstructionFormatter_SetSymbolResolver(VXBaseInstructionFormatterContext *ctx, VXBaseSymbolResolverContext *symbolResolver); const VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, uint64_t address,
const char* VXBaseInstructionFormatter_FormatInstruction(VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info); uint64_t *offset);
VXBaseSymbolResolverContext* VXBaseInstructionFormatter_GetSymbolResolver(
const VXBaseInstructionFormatterContext *ctx);
void VXBaseInstructionFormatter_SetSymbolResolver(VXBaseInstructionFormatterContext *ctx,
VXBaseSymbolResolverContext *symbolResolver);
const char* VXBaseInstructionFormatter_FormatInstruction(VXBaseInstructionFormatterContext *ctx,
const VXInstructionInfo *info);
static void VXBaseInstructionFormatter_OutputClear(VXBaseInstructionFormatterContext *ctx); static void VXBaseInstructionFormatter_OutputClear(VXBaseInstructionFormatterContext *ctx);
static char const* VXBaseInstructionFormatter_OutputString(VXBaseInstructionFormatterContext *ctx); static char const* VXBaseInstructionFormatter_OutputString(VXBaseInstructionFormatterContext *ctx);
static void VXBaseInstructionFormatter_OutputAppend(VXBaseInstructionFormatterContext *ctx, char const *text); static void VXBaseInstructionFormatter_OutputAppend(VXBaseInstructionFormatterContext *ctx,
static void VXBaseInstructionFormatter_OutputAppendFormatted(VXBaseInstructionFormatterContext *ctx, char const *format, ...); char const *text);
static void VXBaseInstructionFormatter_OutputAppendAddress(VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, uint64_t address, bool resolveSymbols); static void VXBaseInstructionFormatter_OutputAppendFormatted(
static void VXBaseInstructionFormatter_OutputAppendImmediate(VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, const VXOperandInfo *operand, bool resolveSymbols); VXBaseInstructionFormatterContext *ctx, char const *format, ...);
static void VXBaseInstructionFormatter_OutputAppendDisplacement(VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, const VXOperandInfo *operand); static void VXBaseInstructionFormatter_OutputAppendAddress(VXBaseInstructionFormatterContext *ctx,
const VXInstructionInfo *info, uint64_t address, bool resolveSymbols);
static void VXBaseInstructionFormatter_OutputAppendImmediate(
VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info,
const VXOperandInfo *operand, bool resolveSymbols);
static void VXBaseInstructionFormatter_OutputAppendDisplacement(
VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info,
const VXOperandInfo *operand);
/* VXCustomSymbolResolver ---------------------------------------------------------------------- */ /* VXCustomSymbolResolver ---------------------------------------------------------------------- */
@ -108,10 +123,13 @@ typedef struct _VXCustomSymbolResolver
void *userData; void *userData;
} VXCustomSymbolResolver; } VXCustomSymbolResolver;
static void VXCustomSymbolResolver_Construct(VXBaseSymbolResolverContext *ctx, VXCustomSymbolResolver_ResolveSymbolCallback resolverCb, void *userData); static void VXCustomSymbolResolver_Construct(VXBaseSymbolResolverContext *ctx,
VXCustomSymbolResolver_ResolveSymbolCallback resolverCb, void *userData);
static void VXCustomSymbolResolver_Destruct(VXBaseSymbolResolverContext *ctx); static void VXCustomSymbolResolver_Destruct(VXBaseSymbolResolverContext *ctx);
VXBaseSymbolResolverContext* VXCustomSymbolResolver_Create(VXCustomSymbolResolver_ResolveSymbolCallback resolverCb, void *userData); VXBaseSymbolResolverContext* VXCustomSymbolResolver_Create(
static const char* VXCustomSymbolResolver_Resolve(VXBaseSymbolResolverContext *ctx, const VXInstructionInfo *info, uint64_t address, uint64_t *offset); VXCustomSymbolResolver_ResolveSymbolCallback resolverCb, void *userData);
static const char* VXCustomSymbolResolver_Resolve(VXBaseSymbolResolverContext *ctx,
const VXInstructionInfo *info, uint64_t address, uint64_t *offset);
/* VXIntelInstructionFormatter ----------------------------------------------------------------- */ /* VXIntelInstructionFormatter ----------------------------------------------------------------- */
@ -121,12 +139,18 @@ typedef struct _VXIntelInstructionFormatter
} VXIntelInstructionFormatter; } VXIntelInstructionFormatter;
VXBaseInstructionFormatterContext* VXIntelInstructionFormatter_Create(void); VXBaseInstructionFormatterContext* VXIntelInstructionFormatter_Create(void);
VXBaseInstructionFormatterContext* VXIntelInstructionFormatter_CreateEx(VXBaseSymbolResolverContext *resolver); VXBaseInstructionFormatterContext* VXIntelInstructionFormatter_CreateEx(
static void VXIntelInstructionFormatter_Construct(VXBaseInstructionFormatterContext *ctx, VXBaseSymbolResolverContext *symbolResolver); VXBaseSymbolResolverContext *resolver);
static void VXIntelInstructionFormatter_Construct(VXBaseInstructionFormatterContext *ctx,
VXBaseSymbolResolverContext *symbolResolver);
static void VXIntelInstructionFormatter_Destruct(VXBaseInstructionFormatterContext *ctx); static void VXIntelInstructionFormatter_Destruct(VXBaseInstructionFormatterContext *ctx);
static void VXIntelInstructionFormatter_OutputAppendOperandCast(VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, const VXOperandInfo *operand); static void VXIntelInstructionFormatter_OutputAppendOperandCast(
static void VXIntelInstructionFormatter_FormatOperand(VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, const VXOperandInfo *operand); VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info,
static void VXIntelInstructionFormatter_InternalFormatInstruction(VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info); const VXOperandInfo *operand);
static void VXIntelInstructionFormatter_FormatOperand(VXBaseInstructionFormatterContext *ctx,
const VXInstructionInfo *info, const VXOperandInfo *operand);
static void VXIntelInstructionFormatter_InternalFormatInstruction(
VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info);
/* Implementation ============================================================================== */ /* Implementation ============================================================================== */
@ -142,8 +166,7 @@ void VXBaseSymbolResolver_Destruct(VXBaseSymbolResolverContext *ctx)
} }
void VXBaseSymbolResolver_Release( void VXBaseSymbolResolver_Release(VXBaseSymbolResolverContext *ctx)
VXBaseSymbolResolverContext *ctx)
{ {
VXBaseSymbolResolver *thiz = VXBaseSymbolResolver_thiz(ctx); VXBaseSymbolResolver *thiz = VXBaseSymbolResolver_thiz(ctx);
@ -156,11 +179,8 @@ void VXBaseSymbolResolver_Release(
free(ctx); free(ctx);
} }
const char* VXBaseSymbolResolver_ResolveSymbol( const char* VXBaseSymbolResolver_ResolveSymbol(VXBaseSymbolResolverContext *ctx,
VXBaseSymbolResolverContext *ctx, const VXInstructionInfo *info, uint64_t address, uint64_t *offset)
const VXInstructionInfo *info,
uint64_t address,
uint64_t *offset)
{ {
assert(VXBaseSymbolResolver_thiz(ctx)->resolveCallback); assert(VXBaseSymbolResolver_thiz(ctx)->resolveCallback);
return VXBaseSymbolResolver_thiz(ctx)->resolveCallback(ctx, info, address, offset); return VXBaseSymbolResolver_thiz(ctx)->resolveCallback(ctx, info, address, offset);
@ -168,10 +188,8 @@ const char* VXBaseSymbolResolver_ResolveSymbol(
/* VXCustomSymbolResolver ---------------------------------------------------------------------- */ /* VXCustomSymbolResolver ---------------------------------------------------------------------- */
static void VXCustomSymbolResolver_Construct( static void VXCustomSymbolResolver_Construct(VXBaseSymbolResolverContext *ctx,
VXBaseSymbolResolverContext *ctx, VXCustomSymbolResolver_ResolveSymbolCallback resolverCb, void *userData)
VXCustomSymbolResolver_ResolveSymbolCallback resolverCb,
void *userData)
{ {
VXBaseSymbolResolver_Construct(ctx); VXBaseSymbolResolver_Construct(ctx);
VXCustomSymbolResolver *thiz = VXCustomSymbolResolver_thiz(ctx); VXCustomSymbolResolver *thiz = VXCustomSymbolResolver_thiz(ctx);
@ -189,8 +207,7 @@ static void VXCustomSymbolResolver_Destruct(VXBaseSymbolResolverContext *ctx)
} }
VXBaseSymbolResolverContext* VXCustomSymbolResolver_Create( VXBaseSymbolResolverContext* VXCustomSymbolResolver_Create(
VXCustomSymbolResolver_ResolveSymbolCallback resolverCb, VXCustomSymbolResolver_ResolveSymbolCallback resolverCb, void *userData)
void *userData)
{ {
VXCustomSymbolResolver *thiz = malloc(sizeof(VXCustomSymbolResolver)); VXCustomSymbolResolver *thiz = malloc(sizeof(VXCustomSymbolResolver));
VXBaseSymbolResolverContext *ctx = malloc(sizeof(VXBaseSymbolResolverContext)); VXBaseSymbolResolverContext *ctx = malloc(sizeof(VXBaseSymbolResolverContext));
@ -208,11 +225,8 @@ VXBaseSymbolResolverContext* VXCustomSymbolResolver_Create(
return ctx; return ctx;
} }
static const char* VXCustomSymbolResolver_Resolve( static const char* VXCustomSymbolResolver_Resolve(VXBaseSymbolResolverContext *ctx,
VXBaseSymbolResolverContext *ctx, const VXInstructionInfo *info, uint64_t address, uint64_t *offset)
const VXInstructionInfo *info,
uint64_t address,
uint64_t *offset)
{ {
VXCustomSymbolResolver *thiz = VXCustomSymbolResolver_thiz(ctx); VXCustomSymbolResolver *thiz = VXCustomSymbolResolver_thiz(ctx);
return thiz->resolve(info, address, offset, thiz->userData); return thiz->resolve(info, address, offset, thiz->userData);
@ -276,8 +290,8 @@ static const char* VXBaseInstructionFormatter_registerStrings[] =
"rip" "rip"
}; };
static void VXBaseInstructionFormatter_Construct( static void VXBaseInstructionFormatter_Construct(VXBaseInstructionFormatterContext *ctx,
VXBaseInstructionFormatterContext *ctx, VXBaseSymbolResolverContext *symbolResolver) VXBaseSymbolResolverContext *symbolResolver)
{ {
VXBaseInstructionFormatter *thiz = VXBaseInstructionFormatter_thiz(ctx); VXBaseInstructionFormatter *thiz = VXBaseInstructionFormatter_thiz(ctx);
@ -301,8 +315,7 @@ static void VXBaseInstructionFormatter_Destruct(VXBaseInstructionFormatterContex
} }
} }
void VXBaseInstructionFormatter_Release( void VXBaseInstructionFormatter_Release(VXBaseInstructionFormatterContext *ctx)
VXBaseInstructionFormatterContext *ctx)
{ {
VXBaseInstructionFormatter *thiz = VXBaseInstructionFormatter_thiz(ctx); VXBaseInstructionFormatter *thiz = VXBaseInstructionFormatter_thiz(ctx);
@ -485,8 +498,8 @@ static void VXBaseInstructionFormatter_OutputAppendFormatted(
} }
static void VXBaseInstructionFormatter_OutputAppendAddress( static void VXBaseInstructionFormatter_OutputAppendAddress(
VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, uint64_t address,
uint64_t address, bool resolveSymbols) bool resolveSymbols)
{ {
uint64_t offset = 0; uint64_t offset = 0;
const char* name = NULL; const char* name = NULL;
@ -529,10 +542,8 @@ static void VXBaseInstructionFormatter_OutputAppendAddress(
} }
static void VXBaseInstructionFormatter_OutputAppendImmediate( static void VXBaseInstructionFormatter_OutputAppendImmediate(
VXBaseInstructionFormatterContext *ctx, VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info,
const VXInstructionInfo *info, const VXOperandInfo *operand, bool resolveSymbols)
const VXOperandInfo *operand,
bool resolveSymbols)
{ {
assert(operand->type == OPTYPE_IMMEDIATE); assert(operand->type == OPTYPE_IMMEDIATE);
uint64_t value = 0; uint64_t value = 0;
@ -695,8 +706,7 @@ VXBaseInstructionFormatterContext* VXIntelInstructionFormatter_CreateEx(
} }
static void VXIntelInstructionFormatter_OutputAppendOperandCast( static void VXIntelInstructionFormatter_OutputAppendOperandCast(
VXBaseInstructionFormatterContext *ctx, VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info,
const VXInstructionInfo *info,
const VXOperandInfo *operand) const VXOperandInfo *operand)
{ {
switch(operand->size) switch(operand->size)
@ -727,10 +737,8 @@ static void VXIntelInstructionFormatter_OutputAppendOperandCast(
} }
} }
static void VXIntelInstructionFormatter_FormatOperand( static void VXIntelInstructionFormatter_FormatOperand(VXBaseInstructionFormatterContext *ctx,
VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info, const VXOperandInfo *operand)
const VXInstructionInfo *info,
const VXOperandInfo *operand)
{ {
switch (operand->type) switch (operand->type)
{ {