mirror of https://github.com/x64dbg/zydis
Improved C-bindings
* Moved C-bindings from seperate project to the core library * Added type checks * Added error checks to the C-bindings SimpleDemo.c
This commit is contained in:
parent
5400ff3772
commit
292b9ea037
|
@ -1,40 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef _ZYDIS_DISASSEMBLER_H_
|
||||
#define _ZYDIS_DISASSEMBLER_H_
|
||||
|
||||
#include "ZydisTypes.h"
|
||||
#include "ZydisInstructionDecoder.h"
|
||||
#include "ZydisInstructionFormatter.h"
|
||||
#include "ZydisSymbolResolver.h"
|
||||
#include "ZydisUtils.h"
|
||||
|
||||
#endif /* _ZYDIS_DISASSEMBLER_H_ */
|
|
@ -1,259 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include "ZydisInstructionDecoder.h"
|
||||
#include "ZydisInstructionDecoder.hpp"
|
||||
#include "ZydisTypes.hpp"
|
||||
|
||||
/* Helpers ===================================================================================== */
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
inline Zydis::BaseInput* ZydisBaseInput_CppPtr(
|
||||
ZydisBaseInputContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<Zydis::BaseInput*>(ctx);
|
||||
}
|
||||
|
||||
inline const Zydis::BaseInput* ZydisBaseInput_CppPtr(
|
||||
const ZydisBaseInputContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<const Zydis::BaseInput*>(ctx);
|
||||
}
|
||||
|
||||
inline ZydisBaseInputContext* ZydisBaseInput_CPtr(
|
||||
Zydis::BaseInput *ptr)
|
||||
{
|
||||
return reinterpret_cast<ZydisBaseInputContext*>(ptr);
|
||||
}
|
||||
|
||||
inline const ZydisBaseInputContext* ZydisBaseInput_CPtr(
|
||||
const Zydis::BaseInput *ptr)
|
||||
{
|
||||
return reinterpret_cast<const ZydisBaseInputContext*>(ptr);
|
||||
}
|
||||
|
||||
inline Zydis::InstructionInfo* ZydisInstructionInfo_CppPtr(
|
||||
ZydisInstructionInfo *ptr)
|
||||
{
|
||||
static_assert(sizeof(*ptr) == sizeof(Zydis::InstructionInfo), "broken struct");
|
||||
return reinterpret_cast<Zydis::InstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline const Zydis::InstructionInfo* ZydisInstructionInfo_CppPtr(
|
||||
const ZydisInstructionInfo *ptr)
|
||||
{
|
||||
static_assert(sizeof(*ptr) == sizeof(Zydis::InstructionInfo), "broken struct");
|
||||
return reinterpret_cast<const Zydis::InstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline ZydisInstructionDecoderContext* ZydisInstructionDecoder_CPtr(
|
||||
Zydis::InstructionDecoder *ptr)
|
||||
{
|
||||
return reinterpret_cast<ZydisInstructionDecoderContext*>(ptr);
|
||||
}
|
||||
|
||||
inline const ZydisInstructionDecoderContext* ZydisInstructionDecoder_CPtr(
|
||||
const Zydis::InstructionDecoder *ptr)
|
||||
{
|
||||
return reinterpret_cast<const ZydisInstructionDecoderContext*>(ptr);
|
||||
}
|
||||
|
||||
inline Zydis::InstructionDecoder* ZydisInstructionDecoder_CppPtr(
|
||||
ZydisInstructionDecoderContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<Zydis::InstructionDecoder*>(ctx);
|
||||
}
|
||||
|
||||
inline const Zydis::InstructionDecoder* ZydisInstructionDecoder_CppPtr(
|
||||
const ZydisInstructionDecoderContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<const Zydis::InstructionDecoder*>(ctx);
|
||||
}
|
||||
|
||||
inline Zydis::DisassemblerMode ZydisDisassemblerMode_CppRepr(
|
||||
ZydisDisassemblerMode val)
|
||||
{
|
||||
return static_cast<Zydis::DisassemblerMode>(val);
|
||||
}
|
||||
|
||||
inline ZydisDisassemblerMode ZydisDisassemblerMode_CRepr(
|
||||
Zydis::DisassemblerMode val)
|
||||
{
|
||||
return static_cast<ZydisDisassemblerMode>(val);
|
||||
}
|
||||
|
||||
inline Zydis::InstructionSetVendor ZydisInstructionSetVendor_CppRepr(
|
||||
ZydisInstructionSetVendor val)
|
||||
{
|
||||
return static_cast<Zydis::InstructionSetVendor>(val);
|
||||
}
|
||||
|
||||
inline ZydisInstructionSetVendor ZydisInstructionSetVendor_CRepr(
|
||||
Zydis::InstructionSetVendor val)
|
||||
{
|
||||
return static_cast<ZydisInstructionSetVendor>(val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* BaseInput ============================================================================ */
|
||||
|
||||
void ZydisBaseInput_Release(ZydisBaseInputContext *ctx)
|
||||
{
|
||||
delete ZydisBaseInput_CppPtr(ctx);
|
||||
}
|
||||
|
||||
uint8_t ZydisBaseInput_InputPeek(ZydisBaseInputContext *ctx, ZydisInstructionInfo *info)
|
||||
{
|
||||
return ZydisBaseInput_CppPtr(ctx)->inputPeek(*ZydisInstructionInfo_CppPtr(info));
|
||||
}
|
||||
|
||||
uint8_t ZydisBaseInput_InputNext(ZydisBaseInputContext *ctx, ZydisInstructionInfo *info)
|
||||
{
|
||||
return ZydisBaseInput_CppPtr(ctx)->inputNext(*ZydisInstructionInfo_CppPtr(info));
|
||||
}
|
||||
|
||||
uint8_t ZydisBaseInput_InputCurrent(const ZydisBaseInputContext *ctx)
|
||||
{
|
||||
return ZydisBaseInput_CppPtr(ctx)->inputCurrent();
|
||||
}
|
||||
|
||||
bool ZydisBaseInput_IsEndOfInput(const ZydisBaseInputContext *ctx)
|
||||
{
|
||||
return ZydisBaseInput_CppPtr(ctx)->isEndOfInput();
|
||||
}
|
||||
|
||||
uint64_t ZydisBaseInput_GetPosition(const ZydisBaseInputContext *ctx)
|
||||
{
|
||||
return ZydisBaseInput_CppPtr(ctx)->getPosition();
|
||||
}
|
||||
|
||||
bool ZydisBaseInput_SetPosition(ZydisBaseInputContext *ctx, uint64_t position)
|
||||
{
|
||||
return ZydisBaseInput_CppPtr(ctx)->setPosition(position);
|
||||
}
|
||||
|
||||
/* MemoryInput ========================================================================== */
|
||||
|
||||
ZydisBaseInputContext* ZydisMemoryInput_Create(const void* buffer, size_t bufferLen)
|
||||
{
|
||||
return reinterpret_cast<ZydisBaseInputContext*>(
|
||||
new Zydis::MemoryInput(buffer, bufferLen));
|
||||
}
|
||||
|
||||
/* InstructionDecoder ======================================================================== */
|
||||
|
||||
ZydisInstructionDecoderContext* ZydisInstructionDecoder_Create()
|
||||
{
|
||||
return reinterpret_cast<ZydisInstructionDecoderContext*>(new Zydis::InstructionDecoder);
|
||||
}
|
||||
|
||||
ZydisInstructionDecoderContext* ZydisInstructionDecoder_CreateEx(
|
||||
ZydisBaseInputContext *input,
|
||||
ZydisDisassemblerMode disassemblerMode,
|
||||
ZydisInstructionSetVendor preferredVendor,
|
||||
uint64_t instructionPointer)
|
||||
{
|
||||
return ZydisInstructionDecoder_CPtr(new Zydis::InstructionDecoder(
|
||||
ZydisBaseInput_CppPtr(input),
|
||||
ZydisDisassemblerMode_CppRepr(disassemblerMode),
|
||||
ZydisInstructionSetVendor_CppRepr(preferredVendor),
|
||||
instructionPointer));
|
||||
}
|
||||
|
||||
void ZydisInstructionDecoder_Release(ZydisInstructionDecoderContext *ctx)
|
||||
{
|
||||
delete ZydisInstructionDecoder_CppPtr(ctx);
|
||||
}
|
||||
|
||||
bool ZydisInstructionDecoder_DecodeInstruction(
|
||||
ZydisInstructionDecoderContext *ctx, ZydisInstructionInfo *info)
|
||||
{
|
||||
return ZydisInstructionDecoder_CppPtr(ctx)->decodeInstruction(
|
||||
*ZydisInstructionInfo_CppPtr(info));
|
||||
}
|
||||
|
||||
ZydisBaseInputContext* ZydisInstructionDecoder_GetDataSource(
|
||||
const ZydisInstructionDecoderContext *ctx)
|
||||
{
|
||||
return ZydisBaseInput_CPtr(ZydisInstructionDecoder_CppPtr(ctx)->getDataSource());
|
||||
}
|
||||
|
||||
void ZydisInstructionDecoder_SetDataSource(
|
||||
ZydisInstructionDecoderContext *ctx, ZydisBaseInputContext *input)
|
||||
{
|
||||
ZydisInstructionDecoder_CppPtr(ctx)->setDataSource(ZydisBaseInput_CppPtr(input));
|
||||
}
|
||||
|
||||
ZydisDisassemblerMode ZydisInstructionDecoder_GetDisassemblerMode(
|
||||
ZydisInstructionDecoderContext *ctx)
|
||||
{
|
||||
return ZydisDisassemblerMode_CRepr(ZydisInstructionDecoder_CppPtr(ctx)->getDisassemblerMode());
|
||||
}
|
||||
|
||||
void ZydisInstructionDecoder_SetDisassemblerMode(
|
||||
ZydisInstructionDecoderContext *ctx,
|
||||
ZydisDisassemblerMode disassemblerMode)
|
||||
{
|
||||
ZydisInstructionDecoder_CppPtr(ctx)->setDisassemblerMode(
|
||||
ZydisDisassemblerMode_CppRepr(disassemblerMode));
|
||||
}
|
||||
|
||||
ZydisInstructionSetVendor ZydisInstructionDecoder_GetPreferredVendor(
|
||||
const ZydisInstructionDecoderContext *ctx)
|
||||
{
|
||||
return ZydisInstructionSetVendor_CRepr(
|
||||
ZydisInstructionDecoder_CppPtr(ctx)->getPreferredVendor());
|
||||
}
|
||||
|
||||
void ZydisInstructionDecoder_SetPreferredVendor(
|
||||
ZydisInstructionDecoderContext *ctx,
|
||||
ZydisInstructionSetVendor preferredVendor)
|
||||
{
|
||||
return ZydisInstructionDecoder_CppPtr(ctx)->setPreferredVendor(
|
||||
ZydisInstructionSetVendor_CppRepr(preferredVendor));
|
||||
}
|
||||
|
||||
uint64_t ZydisInstructionDecoder_GetInstructionPointer(
|
||||
ZydisInstructionDecoderContext *ctx)
|
||||
{
|
||||
return ZydisInstructionDecoder_CppPtr(ctx)->getInstructionPointer();
|
||||
}
|
||||
|
||||
void ZydisInstructionDecoder_SetInstructionPointer(
|
||||
ZydisInstructionDecoderContext *ctx,
|
||||
uint64_t instructionPointer)
|
||||
{
|
||||
ZydisInstructionDecoder_CppPtr(ctx)->setInstructionPointer(instructionPointer);
|
||||
}
|
||||
|
||||
/* ============================================================================================= */
|
|
@ -1,253 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef _ZYDIS_INSTRUCTIONDECODER_H_
|
||||
#define _ZYDIS_INSTRUCTIONDECODER_H_
|
||||
|
||||
#include "ZydisTypes.h"
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* BaseInput ============================================================================ */
|
||||
|
||||
typedef struct _ZydisBaseInputContext { int a; } ZydisBaseInputContext;
|
||||
|
||||
/**
|
||||
* @brief Releases a data source.
|
||||
* @param ctx The context to release.
|
||||
* The context may no longer be used after it was released.
|
||||
*/
|
||||
void ZydisBaseInput_Release(ZydisBaseInputContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Reads the next byte from the data source without altering the current input position
|
||||
* or the @c length field of the @c info parameter.
|
||||
* @param ctx The data source context.
|
||||
* @param info The instruction info struct.
|
||||
* @return The current input byte. If the result is zero, you should always check the @c flags
|
||||
* field of the @c info parameter for error flags. Possible error values are
|
||||
* @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
|
||||
*/
|
||||
uint8_t ZydisBaseInput_InputPeek(ZydisBaseInputContext *ctx, ZydisInstructionInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Reads the next byte from the data source.
|
||||
* @param ctx The data soruce context.
|
||||
* @param info The instruction info.
|
||||
* @return The current input byte. If the result is zero, you should always check the
|
||||
* @c flags field of the @c info parameter for error flags.
|
||||
* Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
|
||||
* This method increases the current input position and the @c length field of the @c info
|
||||
* parameter. This function also appends the new byte to to @c data field of the @c info
|
||||
* parameter.
|
||||
*/
|
||||
uint8_t ZydisBaseInput_InputNext(ZydisBaseInputContext *ctx, ZydisInstructionInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Returns the current input byte.
|
||||
* @param ctx The data soruce context.
|
||||
* @return The current input byte.
|
||||
* The current input byte is set everytime the @c inputPeek or @c inputNext method is called.
|
||||
*/
|
||||
// TODO: check long descr
|
||||
uint8_t ZydisBaseInput_InputCurrent(const ZydisBaseInputContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Queries if the end of the data source is reached.
|
||||
* @param ctx The data soruce context.
|
||||
* @return @c true if end of input, @c false if not.
|
||||
*/
|
||||
bool ZydisBaseInput_IsEndOfInput(const ZydisBaseInputContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Returns the current input position.
|
||||
* @param ctx The data soruce context.
|
||||
* @return The current input position.
|
||||
*/
|
||||
uint64_t ZydisBaseInput_GetPosition(const ZydisBaseInputContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Sets a new input position.
|
||||
* @param ctx The data soruce context.
|
||||
* @param position The new input position.
|
||||
* @return @c false if the new position exceeds the maximum input length.
|
||||
*/
|
||||
bool ZydisBaseInput_SetPosition(ZydisBaseInputContext *ctx, uint64_t position);
|
||||
|
||||
/* MemoryInput ========================================================================== */
|
||||
|
||||
/**
|
||||
* @brief Creates a memory data source.
|
||||
* @param buffer The input buffer.
|
||||
* @param bufferLen THe length of the input buffer.
|
||||
* @return @c NULL if it fails, else a data source context.
|
||||
* @see BaseInput_Release
|
||||
*/
|
||||
// TODO: verify return value
|
||||
ZydisBaseInputContext* ZydisMemoryInput_Create(const void* buffer, size_t bufferLen);
|
||||
|
||||
/* Enums ======================================================================================= */
|
||||
|
||||
/**
|
||||
* @brief Values that represent a disassembler mode.
|
||||
*/
|
||||
typedef enum _ZydisDisassemblerMode /* : uint8_t */
|
||||
{
|
||||
DM_M16BIT,
|
||||
DM_M32BIT,
|
||||
DM_M64BIT
|
||||
} ZydisDisassemblerMode;
|
||||
|
||||
/**
|
||||
* @brief Values that represent an instruction-set vendor.
|
||||
*/
|
||||
typedef enum _ZydisInstructionSetVendor /* : uint8_t */
|
||||
{
|
||||
ISV_ANY,
|
||||
ISV_INTEL,
|
||||
ISV_AMD
|
||||
} ZydisInstructionSetVendor;
|
||||
|
||||
/* InstructionDecoder ======================================================================== */
|
||||
|
||||
typedef struct _ZydisInstructionDecoderContext { int a; } ZydisInstructionDecoderContext;
|
||||
|
||||
/**
|
||||
* @brief Creates an instruction decoder.
|
||||
* @return @c NULL if it fails, else an instruction decoder context.
|
||||
* @see InstructionDecoder_Release
|
||||
*/
|
||||
// TODO: verify return value
|
||||
ZydisInstructionDecoderContext* ZydisInstructionDecoder_Create(void);
|
||||
|
||||
/**
|
||||
* @brief Creates an instruction decoder.
|
||||
* @param input A reference to the input data source.
|
||||
* @param disassemblerMode The disassembler mode.
|
||||
* @param preferredVendor The preferred instruction-set vendor.
|
||||
* @param instructionPointer The initial instruction pointer.
|
||||
* @return @c NULL if it fails, else an instruction decoder context.
|
||||
* @see InstructionDecoder_Release
|
||||
*/
|
||||
ZydisInstructionDecoderContext* ZydisInstructionDecoder_CreateEx(ZydisBaseInputContext *input,
|
||||
ZydisDisassemblerMode disassemblerMode, ZydisInstructionSetVendor preferredVendor,
|
||||
uint64_t instructionPointer);
|
||||
|
||||
/**
|
||||
* @brief Releases an instruction decoder.
|
||||
* @param ctx The context of the instruction decoder to release.
|
||||
*/
|
||||
void ZydisInstructionDecoder_Release(ZydisInstructionDecoderContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Decodes the next instruction from the input data source.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @param info The @c ZydisInstructionInfo struct that receives the information about the decoded
|
||||
* instruction.
|
||||
* @return This function returns @c false if the current position exceeds the maximum input
|
||||
* length. In all other cases (valid and invalid instructions) the return value is
|
||||
* @c true.
|
||||
*/
|
||||
bool ZydisInstructionDecoder_DecodeInstruction(ZydisInstructionDecoderContext *ctx,
|
||||
ZydisInstructionInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to the current data source.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @return The context of the data source.
|
||||
*/
|
||||
ZydisBaseInputContext* ZydisInstructionDecoder_GetDataSource(const ZydisInstructionDecoderContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Sets a new data source.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @param input The context of the new input data source.
|
||||
*/
|
||||
void ZydisInstructionDecoder_SetDataSource(ZydisInstructionDecoderContext *ctx,
|
||||
ZydisBaseInputContext *input);
|
||||
|
||||
/**
|
||||
* @brief Returns the current disassembler mode.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @return The current disassembler mode.
|
||||
*/
|
||||
ZydisDisassemblerMode ZydisInstructionDecoder_GetDisassemblerMode(ZydisInstructionDecoderContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Sets the current disassembler mode.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @param disassemblerMode The new disassembler mode.
|
||||
*/
|
||||
void ZydisInstructionDecoder_SetDisassemblerMode(ZydisInstructionDecoderContext *ctx,
|
||||
ZydisDisassemblerMode disassemblerMode);
|
||||
|
||||
/**
|
||||
* @brief Returns the preferred instruction-set vendor.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @return The preferred instruction-set vendor.
|
||||
*/
|
||||
ZydisInstructionSetVendor ZydisInstructionDecoder_GetPreferredVendor(
|
||||
const ZydisInstructionDecoderContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Sets the preferred instruction-set vendor.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @param preferredVendor The new preferred instruction-set vendor.
|
||||
*/
|
||||
void ZydisInstructionDecoder_SetPreferredVendor(ZydisInstructionDecoderContext *ctx,
|
||||
ZydisInstructionSetVendor preferredVendor);
|
||||
|
||||
/**
|
||||
* @brief Returns the current instruction pointer.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @return The current instruction pointer.
|
||||
*/
|
||||
uint64_t ZydisInstructionDecoder_GetInstructionPointer(ZydisInstructionDecoderContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Sets a new instruction pointer.
|
||||
* @param ctx The instruction decoder context.
|
||||
* @param instructionPointer The new instruction pointer.
|
||||
*/
|
||||
void ZydisInstructionDecoder_SetInstructionPointer(ZydisInstructionDecoderContext *ctx,
|
||||
uint64_t instructionPointer);
|
||||
|
||||
/* ============================================================================================= */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ZYDIS_INSTRUCTIONDECODER_H_ */
|
|
@ -1,251 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include "ZydisInstructionFormatter.h"
|
||||
#include "ZydisInstructionFormatter.hpp"
|
||||
|
||||
/* Helpers ===================================================================================== */
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
inline Zydis::BaseSymbolResolver* ZydisBaseSymbolResolver_CppPtr(
|
||||
ZydisBaseSymbolResolverContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<Zydis::BaseSymbolResolver*>(ctx);
|
||||
}
|
||||
|
||||
inline const Zydis::BaseSymbolResolver* ZydisBaseSymbolResolver_CppPtr(
|
||||
const ZydisBaseSymbolResolverContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<const Zydis::BaseSymbolResolver*>(ctx);
|
||||
}
|
||||
|
||||
inline ZydisBaseSymbolResolverContext* ZydisBaseSymbolResolver_CPtr(
|
||||
Zydis::BaseSymbolResolver *ptr)
|
||||
{
|
||||
return reinterpret_cast<ZydisBaseSymbolResolverContext*>(ptr);
|
||||
}
|
||||
|
||||
inline const ZydisBaseSymbolResolverContext* ZydisBaseSymbolResolver_CPtr(
|
||||
const Zydis::BaseSymbolResolver *ptr)
|
||||
{
|
||||
return reinterpret_cast<const ZydisBaseSymbolResolverContext*>(ptr);
|
||||
}
|
||||
|
||||
inline Zydis::ExactSymbolResolver* ZydisExactSymbolResolver_CppPtr(
|
||||
ZydisBaseSymbolResolverContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<Zydis::ExactSymbolResolver*>(ctx);
|
||||
}
|
||||
|
||||
inline const Zydis::ExactSymbolResolver* ZydisExactSymbolResolver_CppPtr(
|
||||
const ZydisBaseSymbolResolverContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<const Zydis::ExactSymbolResolver*>(ctx);
|
||||
}
|
||||
|
||||
inline ZydisBaseSymbolResolverContext* ZydisExactSymbolResolver_CPtr(
|
||||
Zydis::ExactSymbolResolver *ptr)
|
||||
{
|
||||
return reinterpret_cast<ZydisBaseSymbolResolverContext*>(ptr);
|
||||
}
|
||||
|
||||
inline const ZydisBaseSymbolResolverContext* ZydisExactSymbolResolver_CPtr(
|
||||
const Zydis::ExactSymbolResolver *ptr)
|
||||
{
|
||||
return reinterpret_cast<const ZydisBaseSymbolResolverContext*>(ptr);
|
||||
}
|
||||
|
||||
inline Zydis::InstructionInfo* ZydisInstructionInfo_CppPtr(
|
||||
ZydisInstructionInfo *ptr)
|
||||
{
|
||||
static_assert(sizeof(*ptr) == sizeof(Zydis::InstructionInfo), "broken struct");
|
||||
return reinterpret_cast<Zydis::InstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline const Zydis::InstructionInfo* ZydisInstructionInfo_CppPtr(
|
||||
const ZydisInstructionInfo *ptr)
|
||||
{
|
||||
static_assert(sizeof(*ptr) == sizeof(Zydis::InstructionInfo), "broken struct");
|
||||
return reinterpret_cast<const Zydis::InstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline ZydisInstructionInfo* ZydisInstructionInfo_CPtr(
|
||||
Zydis::InstructionInfo *ptr)
|
||||
{
|
||||
return reinterpret_cast<ZydisInstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline const ZydisInstructionInfo* ZydisInstructionInfo_CPtr(
|
||||
const Zydis::InstructionInfo *ptr)
|
||||
{
|
||||
return reinterpret_cast<const ZydisInstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline Zydis::BaseInstructionFormatter* ZydisBaseInstructionFormatter_CppPtr(
|
||||
ZydisBaseInstructionFormatterContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<Zydis::BaseInstructionFormatter*>(ctx);
|
||||
}
|
||||
|
||||
inline const Zydis::BaseInstructionFormatter* ZydisBaseInstructionFormatter_CppPtr(
|
||||
const ZydisBaseInstructionFormatterContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<const Zydis::BaseInstructionFormatter*>(ctx);
|
||||
}
|
||||
|
||||
inline Zydis::BaseInstructionFormatter* ZydisIntelInstructionFormatter_CppPtr(
|
||||
ZydisBaseInstructionFormatterContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<Zydis::BaseInstructionFormatter*>(ctx);
|
||||
}
|
||||
|
||||
inline const Zydis::BaseInstructionFormatter* ZydisIntelInstructionFormatter_CppPtr(
|
||||
const ZydisBaseInstructionFormatterContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<const Zydis::BaseInstructionFormatter*>(ctx);
|
||||
}
|
||||
|
||||
inline ZydisBaseInstructionFormatterContext* ZydisIntelInstructionFormatter_CPtr(
|
||||
Zydis::BaseInstructionFormatter *ctx)
|
||||
{
|
||||
return reinterpret_cast<ZydisBaseInstructionFormatterContext*>(ctx);
|
||||
}
|
||||
|
||||
inline const ZydisBaseInstructionFormatterContext* ZydisIntelInstructionFormatter_CPtr(
|
||||
const Zydis::BaseInstructionFormatter *ctx)
|
||||
{
|
||||
return reinterpret_cast<const ZydisBaseInstructionFormatterContext*>(ctx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* BaseSymbolResolver ======================================================================== */
|
||||
|
||||
void ZydisBaseSymbolResolver_Release(
|
||||
ZydisBaseSymbolResolverContext *ctx)
|
||||
{
|
||||
delete ZydisBaseSymbolResolver_CppPtr(ctx);
|
||||
}
|
||||
|
||||
const char* ZydisBaseSymbolResolver_ResolveSymbol(
|
||||
ZydisBaseSymbolResolverContext *ctx,
|
||||
const ZydisInstructionInfo *info,
|
||||
uint64_t address,
|
||||
uint64_t *offset)
|
||||
{
|
||||
return ZydisBaseSymbolResolver_CppPtr(ctx)->resolveSymbol(
|
||||
*ZydisInstructionInfo_CppPtr(info),
|
||||
address,
|
||||
*offset);
|
||||
}
|
||||
|
||||
/* ExactSymbolResolver ======================================================================= */
|
||||
|
||||
ZydisBaseSymbolResolverContext* ZydisExactSymbolResolver_Create(void)
|
||||
{
|
||||
return ZydisExactSymbolResolver_CPtr(new Zydis::ExactSymbolResolver);
|
||||
}
|
||||
|
||||
bool EZydisxactSymbolResolver_ContainsSymbol(
|
||||
ZydisBaseSymbolResolverContext *ctx,
|
||||
uint64_t address)
|
||||
{
|
||||
return ZydisExactSymbolResolver_CppPtr(ctx)->containsSymbol(address);
|
||||
}
|
||||
|
||||
void ZydisExactSymbolResolverContext_SetSymbol(
|
||||
ZydisBaseSymbolResolverContext *ctx,
|
||||
uint64_t address,
|
||||
const char* name)
|
||||
{
|
||||
ZydisExactSymbolResolver_CppPtr(ctx)->setSymbol(address, name);
|
||||
}
|
||||
|
||||
void ZydisExactSymbolResolverContext_RemoveSymbol(
|
||||
ZydisBaseSymbolResolverContext *ctx,
|
||||
uint64_t address)
|
||||
{
|
||||
ZydisExactSymbolResolver_CppPtr(ctx)->removeSymbol(address);
|
||||
}
|
||||
|
||||
void ZydisExactSymbolResolverContext_Clear(
|
||||
ZydisBaseSymbolResolverContext *ctx)
|
||||
{
|
||||
ZydisExactSymbolResolver_CppPtr(ctx)->clear();
|
||||
}
|
||||
|
||||
/* BaseInstructionFormatter ================================================================== */
|
||||
|
||||
const char* ZydisBaseInstructionFormatter_FormatInstruction(
|
||||
ZydisBaseInstructionFormatterContext *ctx,
|
||||
const ZydisInstructionInfo *info)
|
||||
{
|
||||
return ZydisBaseInstructionFormatter_CppPtr(ctx)->formatInstruction(
|
||||
*ZydisInstructionInfo_CppPtr(info));
|
||||
}
|
||||
|
||||
ZydisBaseSymbolResolverContext* ZydisBaseInstructionFormatter_GetSymbolResolver(
|
||||
const ZydisBaseInstructionFormatterContext *ctx)
|
||||
{
|
||||
return ZydisBaseSymbolResolver_CPtr(
|
||||
ZydisBaseInstructionFormatter_CppPtr(ctx)->getSymbolResolver());
|
||||
}
|
||||
|
||||
void ZydisBaseInstructionFormatter_SetSymbolResolver(
|
||||
ZydisBaseInstructionFormatterContext *ctx,
|
||||
ZydisBaseSymbolResolverContext *resolver)
|
||||
{
|
||||
ZydisBaseInstructionFormatter_CppPtr(ctx)->setSymbolResolver(
|
||||
ZydisBaseSymbolResolver_CppPtr(resolver));
|
||||
}
|
||||
|
||||
void ZydisBaseInstructionFormatter_Release(
|
||||
ZydisBaseInstructionFormatterContext *ctx)
|
||||
{
|
||||
delete ZydisBaseInstructionFormatter_CppPtr(ctx);
|
||||
}
|
||||
|
||||
/* IntelInstructionFormatter ================================================================ */
|
||||
|
||||
ZydisBaseInstructionFormatterContext* ZydisIntelInstructionFormatter_Create(void)
|
||||
{
|
||||
return ZydisIntelInstructionFormatter_CPtr(new Zydis::IntelInstructionFormatter);
|
||||
}
|
||||
|
||||
ZydisBaseInstructionFormatterContext* ZydisIntelInstructionFormatter_CreateEx(
|
||||
ZydisBaseSymbolResolverContext *resolver)
|
||||
{
|
||||
return ZydisIntelInstructionFormatter_CPtr(new Zydis::IntelInstructionFormatter(
|
||||
ZydisBaseSymbolResolver_CppPtr(resolver)));
|
||||
}
|
||||
|
||||
/* ============================================================================================= */
|
|
@ -1,104 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef _ZYDIS_INSTRUCTIONFORMATTER_H_
|
||||
#define _ZYDIS_INSTRUCTIONFORMATTER_H_
|
||||
|
||||
#include "ZydisTypes.h"
|
||||
#include "ZydisSymbolResolver.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* BaseInstructionFormatter ================================================================== */
|
||||
|
||||
typedef struct _ZydisBaseInstructionFormatterContext {int a;} ZydisBaseInstructionFormatterContext;
|
||||
|
||||
/**
|
||||
* @brief Formats a decoded instruction.
|
||||
* @param ctx The instruction formatter context.
|
||||
* @param info The instruction info.
|
||||
* @return Pointer to the formatted instruction string. This pointer remains valid until
|
||||
* this function is called again or the context is released.
|
||||
*/
|
||||
const char* ZydisBaseInstructionFormatter_FormatInstruction(
|
||||
ZydisBaseInstructionFormatterContext *ctx, const ZydisInstructionInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to the current symbol resolver.
|
||||
* @param ctx The instruction formatter context.
|
||||
* @return Pointer to the current symbol resolver or @c NULL if no symbol resolver is used.
|
||||
*/
|
||||
ZydisBaseSymbolResolverContext* ZydisBaseInstructionFormatter_GetSymbolResolver(
|
||||
const ZydisBaseInstructionFormatterContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Sets a new symbol resolver.
|
||||
* @param ctx The instruction formatter context.
|
||||
* @param symbolResolver Pointer to a symbol resolver instance or @c NULL, if no smybol
|
||||
* resolver should be used.
|
||||
*/
|
||||
void ZydisBaseInstructionFormatter_SetSymbolResolver(ZydisBaseInstructionFormatterContext *ctx,
|
||||
ZydisBaseSymbolResolverContext *resolver);
|
||||
|
||||
/**
|
||||
* @brief Releases an instruction formatter.
|
||||
* @param ctx The context of the instruction formatter to release.
|
||||
* The context may no longer used after it has been released.
|
||||
*/
|
||||
void ZydisBaseInstructionFormatter_Release(ZydisBaseInstructionFormatterContext *ctx);
|
||||
|
||||
/* IntelInstructionFormatter ================================================================ */
|
||||
|
||||
/**
|
||||
* @brief Creates an Intel-syntax instruction formatter.
|
||||
* @return @c NULL if it fails, else an Intel instruction formatter context.
|
||||
* @see BaseInstructionFormatter_Release
|
||||
*/
|
||||
ZydisBaseInstructionFormatterContext* ZydisIntelInstructionFormatter_Create(void);
|
||||
|
||||
/**
|
||||
* @brief Creates an Intel-syntax instruction formatter.
|
||||
* @param resolver The symbol resolver consulted to resolve symbols on formatting.
|
||||
* @return @c NULL if it fails, else an Intel instruction formatter context.
|
||||
* @see BaseInstructionFormatter_Release
|
||||
*/
|
||||
ZydisBaseInstructionFormatterContext* ZydisIntelInstructionFormatter_CreateEx(
|
||||
ZydisBaseSymbolResolverContext *resolver);
|
||||
|
||||
/* ============================================================================================= */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ZYDIS_INSTRUCTIONFORMATTER_H_ */
|
|
@ -1,32 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include "ZydisOpcodeTable.h"
|
||||
#include "ZydisOpcodeTable.hpp"
|
|
@ -1,961 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef _ZYDIS_OPCODETABLE_H_
|
||||
#define _ZYDIS_OPCODETABLE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Values that represent an instruction mnemonic.
|
||||
*/
|
||||
typedef enum _ZydisInstructionMnemonic /* : uint16_t */
|
||||
{
|
||||
/* 000 */ ZYDIS_MNEM_INVALID,
|
||||
/* 001 */ ZYDIS_MNEM_AAA,
|
||||
/* 002 */ ZYDIS_MNEM_AAD,
|
||||
/* 003 */ ZYDIS_MNEM_AAM,
|
||||
/* 004 */ ZYDIS_MNEM_AAS,
|
||||
/* 005 */ ZYDIS_MNEM_ADC,
|
||||
/* 006 */ ZYDIS_MNEM_ADD,
|
||||
/* 007 */ ZYDIS_MNEM_ADDPD,
|
||||
/* 008 */ ZYDIS_MNEM_ADDPS,
|
||||
/* 009 */ ZYDIS_MNEM_ADDSD,
|
||||
/* 00A */ ZYDIS_MNEM_ADDSS,
|
||||
/* 00B */ ZYDIS_MNEM_ADDSUBPD,
|
||||
/* 00C */ ZYDIS_MNEM_ADDSUBPS,
|
||||
/* 00D */ ZYDIS_MNEM_AESDEC,
|
||||
/* 00E */ ZYDIS_MNEM_AESDECLAST,
|
||||
/* 00F */ ZYDIS_MNEM_AESENC,
|
||||
/* 010 */ ZYDIS_MNEM_AESENCLAST,
|
||||
/* 011 */ ZYDIS_MNEM_AESIMC,
|
||||
/* 012 */ ZYDIS_MNEM_AESKEYGENASSIST,
|
||||
/* 013 */ ZYDIS_MNEM_AND,
|
||||
/* 014 */ ZYDIS_MNEM_ANDNPD,
|
||||
/* 015 */ ZYDIS_MNEM_ANDNPS,
|
||||
/* 016 */ ZYDIS_MNEM_ANDPD,
|
||||
/* 017 */ ZYDIS_MNEM_ANDPS,
|
||||
/* 018 */ ZYDIS_MNEM_ARPL,
|
||||
/* 019 */ ZYDIS_MNEM_BLENDPD,
|
||||
/* 01A */ ZYDIS_MNEM_BLENDPS,
|
||||
/* 01B */ ZYDIS_MNEM_BLENDVPD,
|
||||
/* 01C */ ZYDIS_MNEM_BLENDVPS,
|
||||
/* 01D */ ZYDIS_MNEM_BOUND,
|
||||
/* 01E */ ZYDIS_MNEM_BSF,
|
||||
/* 01F */ ZYDIS_MNEM_BSR,
|
||||
/* 020 */ ZYDIS_MNEM_BSWAP,
|
||||
/* 021 */ ZYDIS_MNEM_BT,
|
||||
/* 022 */ ZYDIS_MNEM_BTC,
|
||||
/* 023 */ ZYDIS_MNEM_BTR,
|
||||
/* 024 */ ZYDIS_MNEM_BTS,
|
||||
/* 025 */ ZYDIS_MNEM_CALL,
|
||||
/* 026 */ ZYDIS_MNEM_CBW,
|
||||
/* 027 */ ZYDIS_MNEM_CDQ,
|
||||
/* 028 */ ZYDIS_MNEM_CDQE,
|
||||
/* 029 */ ZYDIS_MNEM_CLC,
|
||||
/* 02A */ ZYDIS_MNEM_CLD,
|
||||
/* 02B */ ZYDIS_MNEM_CLFLUSH,
|
||||
/* 02C */ ZYDIS_MNEM_CLGI,
|
||||
/* 02D */ ZYDIS_MNEM_CLI,
|
||||
/* 02E */ ZYDIS_MNEM_CLTS,
|
||||
/* 02F */ ZYDIS_MNEM_CMC,
|
||||
/* 030 */ ZYDIS_MNEM_CMOVA,
|
||||
/* 031 */ ZYDIS_MNEM_CMOVAE,
|
||||
/* 032 */ ZYDIS_MNEM_CMOVB,
|
||||
/* 033 */ ZYDIS_MNEM_CMOVBE,
|
||||
/* 034 */ ZYDIS_MNEM_CMOVE,
|
||||
/* 035 */ ZYDIS_MNEM_CMOVG,
|
||||
/* 036 */ ZYDIS_MNEM_CMOVGE,
|
||||
/* 037 */ ZYDIS_MNEM_CMOVL,
|
||||
/* 038 */ ZYDIS_MNEM_CMOVLE,
|
||||
/* 039 */ ZYDIS_MNEM_CMOVNE,
|
||||
/* 03A */ ZYDIS_MNEM_CMOVNO,
|
||||
/* 03B */ ZYDIS_MNEM_CMOVNP,
|
||||
/* 03C */ ZYDIS_MNEM_CMOVNS,
|
||||
/* 03D */ ZYDIS_MNEM_CMOVO,
|
||||
/* 03E */ ZYDIS_MNEM_CMOVP,
|
||||
/* 03F */ ZYDIS_MNEM_CMOVS,
|
||||
/* 040 */ ZYDIS_MNEM_CMP,
|
||||
/* 041 */ ZYDIS_MNEM_CMPPD,
|
||||
/* 042 */ ZYDIS_MNEM_CMPPS,
|
||||
/* 043 */ ZYDIS_MNEM_CMPSB,
|
||||
/* 044 */ ZYDIS_MNEM_CMPSD,
|
||||
/* 045 */ ZYDIS_MNEM_CMPSQ,
|
||||
/* 046 */ ZYDIS_MNEM_CMPSS,
|
||||
/* 047 */ ZYDIS_MNEM_CMPSW,
|
||||
/* 048 */ ZYDIS_MNEM_CMPXCHG,
|
||||
/* 049 */ ZYDIS_MNEM_CMPXCHG16B,
|
||||
/* 04A */ ZYDIS_MNEM_CMPXCHG8B,
|
||||
/* 04B */ ZYDIS_MNEM_COMISD,
|
||||
/* 04C */ ZYDIS_MNEM_COMISS,
|
||||
/* 04D */ ZYDIS_MNEM_CPUID,
|
||||
/* 04E */ ZYDIS_MNEM_CQO,
|
||||
/* 04F */ ZYDIS_MNEM_CRC32,
|
||||
/* 050 */ ZYDIS_MNEM_CVTDQ2PD,
|
||||
/* 051 */ ZYDIS_MNEM_CVTDQ2PS,
|
||||
/* 052 */ ZYDIS_MNEM_CVTPD2DQ,
|
||||
/* 053 */ ZYDIS_MNEM_CVTPD2PI,
|
||||
/* 054 */ ZYDIS_MNEM_CVTPD2PS,
|
||||
/* 055 */ ZYDIS_MNEM_CVTPI2PD,
|
||||
/* 056 */ ZYDIS_MNEM_CVTPI2PS,
|
||||
/* 057 */ ZYDIS_MNEM_CVTPS2DQ,
|
||||
/* 058 */ ZYDIS_MNEM_CVTPS2PD,
|
||||
/* 059 */ ZYDIS_MNEM_CVTPS2PI,
|
||||
/* 05A */ ZYDIS_MNEM_CVTSD2SI,
|
||||
/* 05B */ ZYDIS_MNEM_CVTSD2SS,
|
||||
/* 05C */ ZYDIS_MNEM_CVTSI2SD,
|
||||
/* 05D */ ZYDIS_MNEM_CVTSI2SS,
|
||||
/* 05E */ ZYDIS_MNEM_CVTSS2SD,
|
||||
/* 05F */ ZYDIS_MNEM_CVTSS2SI,
|
||||
/* 060 */ ZYDIS_MNEM_CVTTPD2DQ,
|
||||
/* 061 */ ZYDIS_MNEM_CVTTPD2PI,
|
||||
/* 062 */ ZYDIS_MNEM_CVTTPS2DQ,
|
||||
/* 063 */ ZYDIS_MNEM_CVTTPS2PI,
|
||||
/* 064 */ ZYDIS_MNEM_CVTTSD2SI,
|
||||
/* 065 */ ZYDIS_MNEM_CVTTSS2SI,
|
||||
/* 066 */ ZYDIS_MNEM_CWD,
|
||||
/* 067 */ ZYDIS_MNEM_CWDE,
|
||||
/* 068 */ ZYDIS_MNEM_DAA,
|
||||
/* 069 */ ZYDIS_MNEM_DAS,
|
||||
/* 06A */ ZYDIS_MNEM_DEC,
|
||||
/* 06B */ ZYDIS_MNEM_DIV,
|
||||
/* 06C */ ZYDIS_MNEM_DIVPD,
|
||||
/* 06D */ ZYDIS_MNEM_DIVPS,
|
||||
/* 06E */ ZYDIS_MNEM_DIVSD,
|
||||
/* 06F */ ZYDIS_MNEM_DIVSS,
|
||||
/* 070 */ ZYDIS_MNEM_DPPD,
|
||||
/* 071 */ ZYDIS_MNEM_DPPS,
|
||||
/* 072 */ ZYDIS_MNEM_EMMS,
|
||||
/* 073 */ ZYDIS_MNEM_ENTER,
|
||||
/* 074 */ ZYDIS_MNEM_EXTRACTPS,
|
||||
/* 075 */ ZYDIS_MNEM_F2XM1,
|
||||
/* 076 */ ZYDIS_MNEM_FABS,
|
||||
/* 077 */ ZYDIS_MNEM_FADD,
|
||||
/* 078 */ ZYDIS_MNEM_FADDP,
|
||||
/* 079 */ ZYDIS_MNEM_FBLD,
|
||||
/* 07A */ ZYDIS_MNEM_FBSTP,
|
||||
/* 07B */ ZYDIS_MNEM_FCHS,
|
||||
/* 07C */ ZYDIS_MNEM_FCLEX,
|
||||
/* 07D */ ZYDIS_MNEM_FCMOVB,
|
||||
/* 07E */ ZYDIS_MNEM_FCMOVBE,
|
||||
/* 07F */ ZYDIS_MNEM_FCMOVE,
|
||||
/* 080 */ ZYDIS_MNEM_FCMOVNB,
|
||||
/* 081 */ ZYDIS_MNEM_FCMOVNBE,
|
||||
/* 082 */ ZYDIS_MNEM_FCMOVNE,
|
||||
/* 083 */ ZYDIS_MNEM_FCMOVNU,
|
||||
/* 084 */ ZYDIS_MNEM_FCMOVU,
|
||||
/* 085 */ ZYDIS_MNEM_FCOM,
|
||||
/* 086 */ ZYDIS_MNEM_FCOM2,
|
||||
/* 087 */ ZYDIS_MNEM_FCOMI,
|
||||
/* 088 */ ZYDIS_MNEM_FCOMIP,
|
||||
/* 089 */ ZYDIS_MNEM_FCOMP,
|
||||
/* 08A */ ZYDIS_MNEM_FCOMP3,
|
||||
/* 08B */ ZYDIS_MNEM_FCOMP5,
|
||||
/* 08C */ ZYDIS_MNEM_FCOMPP,
|
||||
/* 08D */ ZYDIS_MNEM_FCOS,
|
||||
/* 08E */ ZYDIS_MNEM_FDECSTP,
|
||||
/* 08F */ ZYDIS_MNEM_FDIV,
|
||||
/* 090 */ ZYDIS_MNEM_FDIVP,
|
||||
/* 091 */ ZYDIS_MNEM_FDIVR,
|
||||
/* 092 */ ZYDIS_MNEM_FDIVRP,
|
||||
/* 093 */ ZYDIS_MNEM_FEMMS,
|
||||
/* 094 */ ZYDIS_MNEM_FFREE,
|
||||
/* 095 */ ZYDIS_MNEM_FFREEP,
|
||||
/* 096 */ ZYDIS_MNEM_FIADD,
|
||||
/* 097 */ ZYDIS_MNEM_FICOM,
|
||||
/* 098 */ ZYDIS_MNEM_FICOMP,
|
||||
/* 099 */ ZYDIS_MNEM_FIDIV,
|
||||
/* 09A */ ZYDIS_MNEM_FIDIVR,
|
||||
/* 09B */ ZYDIS_MNEM_FILD,
|
||||
/* 09C */ ZYDIS_MNEM_FIMUL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 0FC */ ZYDIS_MNEM_JGE,
|
||||
/* 0FD */ ZYDIS_MNEM_JL,
|
||||
/* 0FE */ ZYDIS_MNEM_JLE,
|
||||
/* 0FF */ ZYDIS_MNEM_JMP,
|
||||
/* 100 */ ZYDIS_MNEM_JNB,
|
||||
/* 101 */ ZYDIS_MNEM_JNE,
|
||||
/* 102 */ ZYDIS_MNEM_JNO,
|
||||
/* 103 */ ZYDIS_MNEM_JNP,
|
||||
/* 104 */ ZYDIS_MNEM_JNS,
|
||||
/* 105 */ ZYDIS_MNEM_JO,
|
||||
/* 106 */ ZYDIS_MNEM_JP,
|
||||
/* 107 */ ZYDIS_MNEM_JRCXZ,
|
||||
/* 108 */ ZYDIS_MNEM_JS,
|
||||
/* 109 */ ZYDIS_MNEM_LAHF,
|
||||
/* 10A */ ZYDIS_MNEM_LAR,
|
||||
/* 10B */ ZYDIS_MNEM_LDDQU,
|
||||
/* 10C */ ZYDIS_MNEM_LDMXCSR,
|
||||
/* 10D */ ZYDIS_MNEM_LDS,
|
||||
/* 10E */ ZYDIS_MNEM_LEA,
|
||||
/* 10F */ ZYDIS_MNEM_LEAVE,
|
||||
/* 110 */ ZYDIS_MNEM_LES,
|
||||
/* 111 */ ZYDIS_MNEM_LFENCE,
|
||||
/* 112 */ ZYDIS_MNEM_LFS,
|
||||
/* 113 */ ZYDIS_MNEM_LGDT,
|
||||
/* 114 */ ZYDIS_MNEM_LGS,
|
||||
/* 115 */ ZYDIS_MNEM_LIDT,
|
||||
/* 116 */ ZYDIS_MNEM_LLDT,
|
||||
/* 117 */ ZYDIS_MNEM_LMSW,
|
||||
/* 118 */ ZYDIS_MNEM_LOCK,
|
||||
/* 119 */ ZYDIS_MNEM_LODSB,
|
||||
/* 11A */ ZYDIS_MNEM_LODSD,
|
||||
/* 11B */ ZYDIS_MNEM_LODSQ,
|
||||
/* 11C */ ZYDIS_MNEM_LODSW,
|
||||
/* 11D */ ZYDIS_MNEM_LOOP,
|
||||
/* 11E */ ZYDIS_MNEM_LOOPE,
|
||||
/* 11F */ ZYDIS_MNEM_LOOPNE,
|
||||
/* 120 */ ZYDIS_MNEM_LSL,
|
||||
/* 121 */ ZYDIS_MNEM_LSS,
|
||||
/* 122 */ ZYDIS_MNEM_LTR,
|
||||
/* 123 */ ZYDIS_MNEM_MASKMOVDQU,
|
||||
/* 124 */ ZYDIS_MNEM_MASKMOVQ,
|
||||
/* 125 */ ZYDIS_MNEM_MAXPD,
|
||||
/* 126 */ ZYDIS_MNEM_MAXPS,
|
||||
/* 127 */ ZYDIS_MNEM_MAXSD,
|
||||
/* 128 */ ZYDIS_MNEM_MAXSS,
|
||||
/* 129 */ ZYDIS_MNEM_MFENCE,
|
||||
/* 12A */ ZYDIS_MNEM_MINPD,
|
||||
/* 12B */ ZYDIS_MNEM_MINPS,
|
||||
/* 12C */ ZYDIS_MNEM_MINSD,
|
||||
/* 12D */ ZYDIS_MNEM_MINSS,
|
||||
/* 12E */ ZYDIS_MNEM_MONITOR,
|
||||
/* 12F */ ZYDIS_MNEM_MONTMUL,
|
||||
/* 130 */ ZYDIS_MNEM_MOV,
|
||||
/* 131 */ ZYDIS_MNEM_MOVAPD,
|
||||
/* 132 */ ZYDIS_MNEM_MOVAPS,
|
||||
/* 133 */ ZYDIS_MNEM_MOVBE,
|
||||
/* 134 */ ZYDIS_MNEM_MOVD,
|
||||
/* 135 */ ZYDIS_MNEM_MOVDDUP,
|
||||
/* 136 */ ZYDIS_MNEM_MOVDQ2Q,
|
||||
/* 137 */ ZYDIS_MNEM_MOVDQA,
|
||||
/* 138 */ ZYDIS_MNEM_MOVDQU,
|
||||
/* 139 */ ZYDIS_MNEM_MOVHLPS,
|
||||
/* 13A */ ZYDIS_MNEM_MOVHPD,
|
||||
/* 13B */ ZYDIS_MNEM_MOVHPS,
|
||||
/* 13C */ ZYDIS_MNEM_MOVLHPS,
|
||||
/* 13D */ ZYDIS_MNEM_MOVLPD,
|
||||
/* 13E */ ZYDIS_MNEM_MOVLPS,
|
||||
/* 13F */ ZYDIS_MNEM_MOVMSKPD,
|
||||
/* 140 */ ZYDIS_MNEM_MOVMSKPS,
|
||||
/* 141 */ ZYDIS_MNEM_MOVNTDQ,
|
||||
/* 142 */ ZYDIS_MNEM_MOVNTDQA,
|
||||
/* 143 */ ZYDIS_MNEM_MOVNTI,
|
||||
/* 144 */ ZYDIS_MNEM_MOVNTPD,
|
||||
/* 145 */ ZYDIS_MNEM_MOVNTPS,
|
||||
/* 146 */ ZYDIS_MNEM_MOVNTQ,
|
||||
/* 147 */ ZYDIS_MNEM_MOVQ,
|
||||
/* 148 */ ZYDIS_MNEM_MOVQ2DQ,
|
||||
/* 149 */ ZYDIS_MNEM_MOVSB,
|
||||
/* 14A */ ZYDIS_MNEM_MOVSD,
|
||||
/* 14B */ ZYDIS_MNEM_MOVSHDUP,
|
||||
/* 14C */ ZYDIS_MNEM_MOVSLDUP,
|
||||
/* 14D */ ZYDIS_MNEM_MOVSQ,
|
||||
/* 14E */ ZYDIS_MNEM_MOVSS,
|
||||
/* 14F */ ZYDIS_MNEM_MOVSW,
|
||||
/* 150 */ ZYDIS_MNEM_MOVSX,
|
||||
/* 151 */ ZYDIS_MNEM_MOVSXD,
|
||||
/* 152 */ ZYDIS_MNEM_MOVUPD,
|
||||
/* 153 */ ZYDIS_MNEM_MOVUPS,
|
||||
/* 154 */ ZYDIS_MNEM_MOVZX,
|
||||
/* 155 */ ZYDIS_MNEM_MPSADBW,
|
||||
/* 156 */ ZYDIS_MNEM_MUL,
|
||||
/* 157 */ ZYDIS_MNEM_MULPD,
|
||||
/* 158 */ ZYDIS_MNEM_MULPS,
|
||||
/* 159 */ ZYDIS_MNEM_MULSD,
|
||||
/* 15A */ ZYDIS_MNEM_MULSS,
|
||||
/* 15B */ ZYDIS_MNEM_MWAIT,
|
||||
/* 15C */ ZYDIS_MNEM_NEG,
|
||||
/* 15D */ ZYDIS_MNEM_NOP,
|
||||
/* 15E */ ZYDIS_MNEM_NOT,
|
||||
/* 15F */ ZYDIS_MNEM_OR,
|
||||
/* 160 */ ZYDIS_MNEM_ORPD,
|
||||
/* 161 */ ZYDIS_MNEM_ORPS,
|
||||
/* 162 */ ZYDIS_MNEM_OUT,
|
||||
/* 163 */ ZYDIS_MNEM_OUTSB,
|
||||
/* 164 */ ZYDIS_MNEM_OUTSD,
|
||||
/* 165 */ ZYDIS_MNEM_OUTSW,
|
||||
/* 166 */ ZYDIS_MNEM_PABSB,
|
||||
/* 167 */ ZYDIS_MNEM_PABSD,
|
||||
/* 168 */ ZYDIS_MNEM_PABSW,
|
||||
/* 169 */ ZYDIS_MNEM_PACKSSDW,
|
||||
/* 16A */ ZYDIS_MNEM_PACKSSWB,
|
||||
/* 16B */ ZYDIS_MNEM_PACKUSDW,
|
||||
/* 16C */ ZYDIS_MNEM_PACKUSWB,
|
||||
/* 16D */ ZYDIS_MNEM_PADDB,
|
||||
/* 16E */ ZYDIS_MNEM_PADDD,
|
||||
/* 16F */ ZYDIS_MNEM_PADDQ,
|
||||
/* 170 */ ZYDIS_MNEM_PADDSB,
|
||||
/* 171 */ ZYDIS_MNEM_PADDSW,
|
||||
/* 172 */ ZYDIS_MNEM_PADDUSB,
|
||||
/* 173 */ ZYDIS_MNEM_PADDUSW,
|
||||
/* 174 */ ZYDIS_MNEM_PADDW,
|
||||
/* 175 */ ZYDIS_MNEM_PALIGNR,
|
||||
/* 176 */ ZYDIS_MNEM_PAND,
|
||||
/* 177 */ ZYDIS_MNEM_PANDN,
|
||||
/* 178 */ ZYDIS_MNEM_PAUSE,
|
||||
/* 179 */ ZYDIS_MNEM_PAVGB,
|
||||
/* 17A */ ZYDIS_MNEM_PAVGUSB,
|
||||
/* 17B */ ZYDIS_MNEM_PAVGW,
|
||||
/* 17C */ ZYDIS_MNEM_PBLENDVB,
|
||||
/* 17D */ ZYDIS_MNEM_PBLENDW,
|
||||
/* 17E */ ZYDIS_MNEM_PCLMULQDQ,
|
||||
/* 17F */ ZYDIS_MNEM_PCMPEQB,
|
||||
/* 180 */ ZYDIS_MNEM_PCMPEQD,
|
||||
/* 181 */ ZYDIS_MNEM_PCMPEQQ,
|
||||
/* 182 */ ZYDIS_MNEM_PCMPEQW,
|
||||
/* 183 */ ZYDIS_MNEM_PCMPESTRI,
|
||||
/* 184 */ ZYDIS_MNEM_PCMPESTRM,
|
||||
/* 185 */ ZYDIS_MNEM_PCMPGTB,
|
||||
/* 186 */ ZYDIS_MNEM_PCMPGTD,
|
||||
/* 187 */ ZYDIS_MNEM_PCMPGTQ,
|
||||
/* 188 */ ZYDIS_MNEM_PCMPGTW,
|
||||
/* 189 */ ZYDIS_MNEM_PCMPISTRI,
|
||||
/* 18A */ ZYDIS_MNEM_PCMPISTRM,
|
||||
/* 18B */ ZYDIS_MNEM_PEXTRB,
|
||||
/* 18C */ ZYDIS_MNEM_PEXTRD,
|
||||
/* 18D */ ZYDIS_MNEM_PEXTRQ,
|
||||
/* 18E */ ZYDIS_MNEM_PEXTRW,
|
||||
/* 18F */ ZYDIS_MNEM_PF2ID,
|
||||
/* 190 */ ZYDIS_MNEM_PF2IW,
|
||||
/* 191 */ ZYDIS_MNEM_PFACC,
|
||||
/* 192 */ ZYDIS_MNEM_PFADD,
|
||||
/* 193 */ ZYDIS_MNEM_PFCMPEQ,
|
||||
/* 194 */ ZYDIS_MNEM_PFCMPGE,
|
||||
/* 195 */ ZYDIS_MNEM_PFCMPGT,
|
||||
/* 196 */ ZYDIS_MNEM_PFMAX,
|
||||
/* 197 */ ZYDIS_MNEM_PFMIN,
|
||||
/* 198 */ ZYDIS_MNEM_PFMUL,
|
||||
/* 199 */ ZYDIS_MNEM_PFNACC,
|
||||
/* 19A */ ZYDIS_MNEM_PFPNACC,
|
||||
/* 19B */ ZYDIS_MNEM_PFRCP,
|
||||
/* 19C */ ZYDIS_MNEM_PFRCPIT1,
|
||||
/* 19D */ ZYDIS_MNEM_PFRCPIT2,
|
||||
/* 19E */ ZYDIS_MNEM_PFRSQIT1,
|
||||
/* 19F */ ZYDIS_MNEM_PFRS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PD,
|
||||
/* 1FB */ ZYDIS_MNEM_PTEST,
|
||||
/* 1FC */ ZYDIS_MNEM_PUNPCKHBW,
|
||||
/* 1FD */ ZYDIS_MNEM_PUNPCKHDQ,
|
||||
/* 1FE */ ZYDIS_MNEM_PUNPCKHQDQ,
|
||||
/* 1FF */ ZYDIS_MNEM_PUNPCKHWD,
|
||||
/* 200 */ ZYDIS_MNEM_PUNPCKLBW,
|
||||
/* 201 */ ZYDIS_MNEM_PUNPCKLDQ,
|
||||
/* 202 */ ZYDIS_MNEM_PUNPCKLQDQ,
|
||||
/* 203 */ ZYDIS_MNEM_PUNPCKLWD,
|
||||
/* 204 */ ZYDIS_MNEM_PUSH,
|
||||
/* 205 */ ZYDIS_MNEM_PUSHA,
|
||||
/* 206 */ ZYDIS_MNEM_PUSHAD,
|
||||
/* 207 */ ZYDIS_MNEM_PUSHFD,
|
||||
/* 208 */ ZYDIS_MNEM_PUSHFQ,
|
||||
/* 209 */ ZYDIS_MNEM_PUSHFW,
|
||||
/* 20A */ ZYDIS_MNEM_PXOR,
|
||||
/* 20B */ ZYDIS_MNEM_RCL,
|
||||
/* 20C */ ZYDIS_MNEM_RCPPS,
|
||||
/* 20D */ ZYDIS_MNEM_RCPSS,
|
||||
/* 20E */ ZYDIS_MNEM_RCR,
|
||||
/* 20F */ ZYDIS_MNEM_RDMSR,
|
||||
/* 210 */ ZYDIS_MNEM_RDPMC,
|
||||
/* 211 */ ZYDIS_MNEM_RDRAND,
|
||||
/* 212 */ ZYDIS_MNEM_RDTSC,
|
||||
/* 213 */ ZYDIS_MNEM_RDTSCP,
|
||||
/* 214 */ ZYDIS_MNEM_REP,
|
||||
/* 215 */ ZYDIS_MNEM_REPNE,
|
||||
/* 216 */ ZYDIS_MNEM_RET,
|
||||
/* 217 */ ZYDIS_MNEM_RETF,
|
||||
/* 218 */ ZYDIS_MNEM_ROL,
|
||||
/* 219 */ ZYDIS_MNEM_ROR,
|
||||
/* 21A */ ZYDIS_MNEM_ROUNDPD,
|
||||
/* 21B */ ZYDIS_MNEM_ROUNDPS,
|
||||
/* 21C */ ZYDIS_MNEM_ROUNDSD,
|
||||
/* 21D */ ZYDIS_MNEM_ROUNDSS,
|
||||
/* 21E */ ZYDIS_MNEM_RSM,
|
||||
/* 21F */ ZYDIS_MNEM_RSQRTPS,
|
||||
/* 220 */ ZYDIS_MNEM_RSQRTSS,
|
||||
/* 221 */ ZYDIS_MNEM_SAHF,
|
||||
/* 222 */ ZYDIS_MNEM_SALC,
|
||||
/* 223 */ ZYDIS_MNEM_SAR,
|
||||
/* 224 */ ZYDIS_MNEM_SBB,
|
||||
/* 225 */ ZYDIS_MNEM_SCASB,
|
||||
/* 226 */ ZYDIS_MNEM_SCASD,
|
||||
/* 227 */ ZYDIS_MNEM_SCASQ,
|
||||
/* 228 */ ZYDIS_MNEM_SCASW,
|
||||
/* 229 */ ZYDIS_MNEM_SETA,
|
||||
/* 22A */ ZYDIS_MNEM_SETAE,
|
||||
/* 22B */ ZYDIS_MNEM_SETB,
|
||||
/* 22C */ ZYDIS_MNEM_SETBE,
|
||||
/* 22D */ ZYDIS_MNEM_SETE,
|
||||
/* 22E */ ZYDIS_MNEM_SETG,
|
||||
/* 22F */ ZYDIS_MNEM_SETGE,
|
||||
/* 230 */ ZYDIS_MNEM_SETL,
|
||||
/* 231 */ ZYDIS_MNEM_SETLE,
|
||||
/* 232 */ ZYDIS_MNEM_SETNE,
|
||||
/* 233 */ ZYDIS_MNEM_SETNO,
|
||||
/* 234 */ ZYDIS_MNEM_SETNP,
|
||||
/* 235 */ ZYDIS_MNEM_SETNS,
|
||||
/* 236 */ ZYDIS_MNEM_SETO,
|
||||
/* 237 */ ZYDIS_MNEM_SETP,
|
||||
/* 238 */ ZYDIS_MNEM_SETS,
|
||||
/* 239 */ ZYDIS_MNEM_SFENCE,
|
||||
/* 23A */ ZYDIS_MNEM_SGDT,
|
||||
/* 23B */ ZYDIS_MNEM_SHL,
|
||||
/* 23C */ ZYDIS_MNEM_SHLD,
|
||||
/* 23D */ ZYDIS_MNEM_SHR,
|
||||
/* 23E */ ZYDIS_MNEM_SHRD,
|
||||
/* 23F */ ZYDIS_MNEM_SHUFPD,
|
||||
/* 240 */ ZYDIS_MNEM_SHUFPS,
|
||||
/* 241 */ ZYDIS_MNEM_SIDT,
|
||||
/* 242 */ ZYDIS_MNEM_SKINIT,
|
||||
/* 243 */ ZYDIS_MNEM_SLDT,
|
||||
/* 244 */ ZYDIS_MNEM_SMSW,
|
||||
/* 245 */ ZYDIS_MNEM_SQRTPD,
|
||||
/* 246 */ ZYDIS_MNEM_SQRTPS,
|
||||
/* 247 */ ZYDIS_MNEM_SQRTSD,
|
||||
/* 248 */ ZYDIS_MNEM_SQRTSS,
|
||||
/* 249 */ ZYDIS_MNEM_STC,
|
||||
/* 24A */ ZYDIS_MNEM_STD,
|
||||
/* 24B */ ZYDIS_MNEM_STGI,
|
||||
/* 24C */ ZYDIS_MNEM_STI,
|
||||
/* 24D */ ZYDIS_MNEM_STMXCSR,
|
||||
/* 24E */ ZYDIS_MNEM_STOSB,
|
||||
/* 24F */ ZYDIS_MNEM_STOSD,
|
||||
/* 250 */ ZYDIS_MNEM_STOSQ,
|
||||
/* 251 */ ZYDIS_MNEM_STOSW,
|
||||
/* 252 */ ZYDIS_MNEM_STR,
|
||||
/* 253 */ ZYDIS_MNEM_SUB,
|
||||
/* 254 */ ZYDIS_MNEM_SUBPD,
|
||||
/* 255 */ ZYDIS_MNEM_SUBPS,
|
||||
/* 256 */ ZYDIS_MNEM_SUBSD,
|
||||
/* 257 */ ZYDIS_MNEM_SUBSS,
|
||||
/* 258 */ ZYDIS_MNEM_SWAPGS,
|
||||
/* 259 */ ZYDIS_MNEM_SYSCALL,
|
||||
/* 25A */ ZYDIS_MNEM_SYSENTER,
|
||||
/* 25B */ ZYDIS_MNEM_SYSEXIT,
|
||||
/* 25C */ ZYDIS_MNEM_SYSRET,
|
||||
/* 25D */ ZYDIS_MNEM_TEST,
|
||||
/* 25E */ ZYDIS_MNEM_UCOMISD,
|
||||
/* 25F */ ZYDIS_MNEM_UCOMISS,
|
||||
/* 260 */ ZYDIS_MNEM_UD2,
|
||||
/* 261 */ ZYDIS_MNEM_UNPCKHPD,
|
||||
/* 262 */ ZYDIS_MNEM_UNPCKHPS,
|
||||
/* 263 */ ZYDIS_MNEM_UNPCKLPD,
|
||||
/* 264 */ ZYDIS_MNEM_UNPCKLPS,
|
||||
/* 265 */ ZYDIS_MNEM_VADDPD,
|
||||
/* 266 */ ZYDIS_MNEM_VADDPS,
|
||||
/* 267 */ ZYDIS_MNEM_VADDSD,
|
||||
/* 268 */ ZYDIS_MNEM_VADDSS,
|
||||
/* 269 */ ZYDIS_MNEM_VADDSUBPD,
|
||||
/* 26A */ ZYDIS_MNEM_VADDSUBPS,
|
||||
/* 26B */ ZYDIS_MNEM_VAESDEC,
|
||||
/* 26C */ ZYDIS_MNEM_VAESDECLAST,
|
||||
/* 26D */ ZYDIS_MNEM_VAESENC,
|
||||
/* 26E */ ZYDIS_MNEM_VAESENCLAST,
|
||||
/* 26F */ ZYDIS_MNEM_VAESIMC,
|
||||
/* 270 */ ZYDIS_MNEM_VAESKEYGENASSIST,
|
||||
/* 271 */ ZYDIS_MNEM_VANDNPD,
|
||||
/* 272 */ ZYDIS_MNEM_VANDNPS,
|
||||
/* 273 */ ZYDIS_MNEM_VANDPD,
|
||||
/* 274 */ ZYDIS_MNEM_VANDPS,
|
||||
/* 275 */ ZYDIS_MNEM_VBLENDPD,
|
||||
/* 276 */ ZYDIS_MNEM_VBLENDPS,
|
||||
/* 277 */ ZYDIS_MNEM_VBLENDVPD,
|
||||
/* 278 */ ZYDIS_MNEM_VBLENDVPS,
|
||||
/* 279 */ ZYDIS_MNEM_VBROADCASTSD,
|
||||
/* 27A */ ZYDIS_MNEM_VBROADCASTSS,
|
||||
/* 27B */ ZYDIS_MNEM_VCMPPD,
|
||||
/* 27C */ ZYDIS_MNEM_VCMPPS,
|
||||
/* 27D */ ZYDIS_MNEM_VCMPSD,
|
||||
/* 27E */ ZYDIS_MNEM_VCMPSS,
|
||||
/* 27F */ ZYDIS_MNEM_VCOMISD,
|
||||
/* 280 */ ZYDIS_MNEM_VCOMISS,
|
||||
/* 281 */ ZYDIS_MNEM_VCVTDQ2PD,
|
||||
/* 282 */ ZYDIS_MNEM_VCVTDQ2PS,
|
||||
/* 283 */ ZYDIS_MNEM_VCVTPD2DQ,
|
||||
/* 284 */ ZYDIS_MNEM_VCVTPD2PS,
|
||||
/* 285 */ ZYDIS_MNEM_VCVTPS2DQ,
|
||||
/* 286 */ ZYDIS_MNEM_VCVTPS2PD,
|
||||
/* 287 */ ZYDIS_MNEM_VCVTSD2SI,
|
||||
/* 288 */ ZYDIS_MNEM_VCVTSD2SS,
|
||||
/* 289 */ ZYDIS_MNEM_VCVTSI2SD,
|
||||
/* 28A */ ZYDIS_MNEM_VCVTSI2SS,
|
||||
/* 28B */ ZYDIS_MNEM_VCVTSS2SD,
|
||||
/* 28C */ ZYDIS_MNEM_VCVTSS2SI,
|
||||
/* 28D */ ZYDIS_MNEM_VCVTTPD2DQ,
|
||||
/* 28E */ ZYDIS_MNEM_VCVTTPS2DQ,
|
||||
/* 28F */ ZYDIS_MNEM_VCVTTSD2SI,
|
||||
/* 290 */ ZYDIS_MNEM_VCVTTSS2SI,
|
||||
/* 291 */ ZYDIS_MNEM_VDIVPD,
|
||||
/* 292 */ ZYDIS_MNEM_VDIVPS,
|
||||
/* 293 */ ZYDIS_MNEM_VDIVSD,
|
||||
/* 294 */ ZYDIS_MNEM_VDIVSS,
|
||||
/* 295 */ ZYDIS_MNEM_VDPPD,
|
||||
/* 296 */ ZYDIS_MNEM_VDPPS,
|
||||
/* 297 */ ZYDIS_MNEM_VERR,
|
||||
/* 298 */ ZYDIS_MNEM_VERW,
|
||||
/* 299 */ ZYDIS_MNEM_VEXTRACTF128,
|
||||
/* 29A */ ZYDIS_MNEM_VEXTRACTPS,
|
||||
/* 29B */ ZYDIS_MNEM_VHADDP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VPCMPEQW,
|
||||
/* 2F6 */ ZYDIS_MNEM_VPCMPESTRI,
|
||||
/* 2F7 */ ZYDIS_MNEM_VPCMPESTRM,
|
||||
/* 2F8 */ ZYDIS_MNEM_VPCMPGTB,
|
||||
/* 2F9 */ ZYDIS_MNEM_VPCMPGTD,
|
||||
/* 2FA */ ZYDIS_MNEM_VPCMPGTQ,
|
||||
/* 2FB */ ZYDIS_MNEM_VPCMPGTW,
|
||||
/* 2FC */ ZYDIS_MNEM_VPCMPISTRI,
|
||||
/* 2FD */ ZYDIS_MNEM_VPCMPISTRM,
|
||||
/* 2FE */ ZYDIS_MNEM_VPERM2F128,
|
||||
/* 2FF */ ZYDIS_MNEM_VPERMILPD,
|
||||
/* 300 */ ZYDIS_MNEM_VPERMILPS,
|
||||
/* 301 */ ZYDIS_MNEM_VPEXTRB,
|
||||
/* 302 */ ZYDIS_MNEM_VPEXTRD,
|
||||
/* 303 */ ZYDIS_MNEM_VPEXTRQ,
|
||||
/* 304 */ ZYDIS_MNEM_VPEXTRW,
|
||||
/* 305 */ ZYDIS_MNEM_VPHADDD,
|
||||
/* 306 */ ZYDIS_MNEM_VPHADDSW,
|
||||
/* 307 */ ZYDIS_MNEM_VPHADDW,
|
||||
/* 308 */ ZYDIS_MNEM_VPHMINPOSUW,
|
||||
/* 309 */ ZYDIS_MNEM_VPHSUBD,
|
||||
/* 30A */ ZYDIS_MNEM_VPHSUBSW,
|
||||
/* 30B */ ZYDIS_MNEM_VPHSUBW,
|
||||
/* 30C */ ZYDIS_MNEM_VPINSRB,
|
||||
/* 30D */ ZYDIS_MNEM_VPINSRD,
|
||||
/* 30E */ ZYDIS_MNEM_VPINSRQ,
|
||||
/* 30F */ ZYDIS_MNEM_VPINSRW,
|
||||
/* 310 */ ZYDIS_MNEM_VPMADDUBSW,
|
||||
/* 311 */ ZYDIS_MNEM_VPMADDWD,
|
||||
/* 312 */ ZYDIS_MNEM_VPMAXSB,
|
||||
/* 313 */ ZYDIS_MNEM_VPMAXSD,
|
||||
/* 314 */ ZYDIS_MNEM_VPMAXSW,
|
||||
/* 315 */ ZYDIS_MNEM_VPMAXUB,
|
||||
/* 316 */ ZYDIS_MNEM_VPMAXUD,
|
||||
/* 317 */ ZYDIS_MNEM_VPMAXUW,
|
||||
/* 318 */ ZYDIS_MNEM_VPMINSB,
|
||||
/* 319 */ ZYDIS_MNEM_VPMINSD,
|
||||
/* 31A */ ZYDIS_MNEM_VPMINSW,
|
||||
/* 31B */ ZYDIS_MNEM_VPMINUB,
|
||||
/* 31C */ ZYDIS_MNEM_VPMINUD,
|
||||
/* 31D */ ZYDIS_MNEM_VPMINUW,
|
||||
/* 31E */ ZYDIS_MNEM_VPMOVMSKB,
|
||||
/* 31F */ ZYDIS_MNEM_VPMOVSXBD,
|
||||
/* 320 */ ZYDIS_MNEM_VPMOVSXBQ,
|
||||
/* 321 */ ZYDIS_MNEM_VPMOVSXBW,
|
||||
/* 322 */ ZYDIS_MNEM_VPMOVSXWD,
|
||||
/* 323 */ ZYDIS_MNEM_VPMOVSXWQ,
|
||||
/* 324 */ ZYDIS_MNEM_VPMOVZXBD,
|
||||
/* 325 */ ZYDIS_MNEM_VPMOVZXBQ,
|
||||
/* 326 */ ZYDIS_MNEM_VPMOVZXBW,
|
||||
/* 327 */ ZYDIS_MNEM_VPMOVZXDQ,
|
||||
/* 328 */ ZYDIS_MNEM_VPMOVZXWD,
|
||||
/* 329 */ ZYDIS_MNEM_VPMOVZXWQ,
|
||||
/* 32A */ ZYDIS_MNEM_VPMULDQ,
|
||||
/* 32B */ ZYDIS_MNEM_VPMULHRSW,
|
||||
/* 32C */ ZYDIS_MNEM_VPMULHUW,
|
||||
/* 32D */ ZYDIS_MNEM_VPMULHW,
|
||||
/* 32E */ ZYDIS_MNEM_VPMULLD,
|
||||
/* 32F */ ZYDIS_MNEM_VPMULLW,
|
||||
/* 330 */ ZYDIS_MNEM_VPOR,
|
||||
/* 331 */ ZYDIS_MNEM_VPSADBW,
|
||||
/* 332 */ ZYDIS_MNEM_VPSHUFB,
|
||||
/* 333 */ ZYDIS_MNEM_VPSHUFD,
|
||||
/* 334 */ ZYDIS_MNEM_VPSHUFHW,
|
||||
/* 335 */ ZYDIS_MNEM_VPSHUFLW,
|
||||
/* 336 */ ZYDIS_MNEM_VPSIGNB,
|
||||
/* 337 */ ZYDIS_MNEM_VPSIGND,
|
||||
/* 338 */ ZYDIS_MNEM_VPSIGNW,
|
||||
/* 339 */ ZYDIS_MNEM_VPSLLD,
|
||||
/* 33A */ ZYDIS_MNEM_VPSLLDQ,
|
||||
/* 33B */ ZYDIS_MNEM_VPSLLQ,
|
||||
/* 33C */ ZYDIS_MNEM_VPSLLW,
|
||||
/* 33D */ ZYDIS_MNEM_VPSRAD,
|
||||
/* 33E */ ZYDIS_MNEM_VPSRAW,
|
||||
/* 33F */ ZYDIS_MNEM_VPSRLD,
|
||||
/* 340 */ ZYDIS_MNEM_VPSRLDQ,
|
||||
/* 341 */ ZYDIS_MNEM_VPSRLQ,
|
||||
/* 342 */ ZYDIS_MNEM_VPSRLW,
|
||||
/* 343 */ ZYDIS_MNEM_VPSUBB,
|
||||
/* 344 */ ZYDIS_MNEM_VPSUBD,
|
||||
/* 345 */ ZYDIS_MNEM_VPSUBQ,
|
||||
/* 346 */ ZYDIS_MNEM_VPSUBSB,
|
||||
/* 347 */ ZYDIS_MNEM_VPSUBSW,
|
||||
/* 348 */ ZYDIS_MNEM_VPSUBUSB,
|
||||
/* 349 */ ZYDIS_MNEM_VPSUBUSW,
|
||||
/* 34A */ ZYDIS_MNEM_VPSUBW,
|
||||
/* 34B */ ZYDIS_MNEM_VPTEST,
|
||||
/* 34C */ ZYDIS_MNEM_VPUNPCKHBW,
|
||||
/* 34D */ ZYDIS_MNEM_VPUNPCKHDQ,
|
||||
/* 34E */ ZYDIS_MNEM_VPUNPCKHQDQ,
|
||||
/* 34F */ ZYDIS_MNEM_VPUNPCKHWD,
|
||||
/* 350 */ ZYDIS_MNEM_VPUNPCKLBW,
|
||||
/* 351 */ ZYDIS_MNEM_VPUNPCKLDQ,
|
||||
/* 352 */ ZYDIS_MNEM_VPUNPCKLQDQ,
|
||||
/* 353 */ ZYDIS_MNEM_VPUNPCKLWD,
|
||||
/* 354 */ ZYDIS_MNEM_VPXOR,
|
||||
/* 355 */ ZYDIS_MNEM_VRCPPS,
|
||||
/* 356 */ ZYDIS_MNEM_VRCPSS,
|
||||
/* 357 */ ZYDIS_MNEM_VROUNDPD,
|
||||
/* 358 */ ZYDIS_MNEM_VROUNDPS,
|
||||
/* 359 */ ZYDIS_MNEM_VROUNDSD,
|
||||
/* 35A */ ZYDIS_MNEM_VROUNDSS,
|
||||
/* 35B */ ZYDIS_MNEM_VRSQRTPS,
|
||||
/* 35C */ ZYDIS_MNEM_VRSQRTSS,
|
||||
/* 35D */ ZYDIS_MNEM_VSHUFPD,
|
||||
/* 35E */ ZYDIS_MNEM_VSHUFPS,
|
||||
/* 35F */ ZYDIS_MNEM_VSQRTPD,
|
||||
/* 360 */ ZYDIS_MNEM_VSQRTPS,
|
||||
/* 361 */ ZYDIS_MNEM_VSQRTSD,
|
||||
/* 362 */ ZYDIS_MNEM_VSQRTSS,
|
||||
/* 363 */ ZYDIS_MNEM_VSTMXCSR,
|
||||
/* 364 */ ZYDIS_MNEM_VSUBPD,
|
||||
/* 365 */ ZYDIS_MNEM_VSUBPS,
|
||||
/* 366 */ ZYDIS_MNEM_VSUBSD,
|
||||
/* 367 */ ZYDIS_MNEM_VSUBSS,
|
||||
/* 368 */ ZYDIS_MNEM_VTESTPD,
|
||||
/* 369 */ ZYDIS_MNEM_VTESTPS,
|
||||
/* 36A */ ZYDIS_MNEM_VUCOMISD,
|
||||
/* 36B */ ZYDIS_MNEM_VUCOMISS,
|
||||
/* 36C */ ZYDIS_MNEM_VUNPCKHPD,
|
||||
/* 36D */ ZYDIS_MNEM_VUNPCKHPS,
|
||||
/* 36E */ ZYDIS_MNEM_VUNPCKLPD,
|
||||
/* 36F */ ZYDIS_MNEM_VUNPCKLPS,
|
||||
/* 370 */ ZYDIS_MNEM_VXORPD,
|
||||
/* 371 */ ZYDIS_MNEM_VXORPS,
|
||||
/* 372 */ ZYDIS_MNEM_VZEROALL,
|
||||
/* 373 */ ZYDIS_MNEM_VZEROUPPER,
|
||||
/* 374 */ ZYDIS_MNEM_WAIT,
|
||||
/* 375 */ ZYDIS_MNEM_WBINVD,
|
||||
/* 376 */ ZYDIS_MNEM_WRMSR,
|
||||
/* 377 */ ZYDIS_MNEM_XADD,
|
||||
/* 378 */ ZYDIS_MNEM_XCHG,
|
||||
/* 379 */ ZYDIS_MNEM_XCRYPTCBC,
|
||||
/* 37A */ ZYDIS_MNEM_XCRYPTCFB,
|
||||
/* 37B */ ZYDIS_MNEM_XCRYPTCTR,
|
||||
/* 37C */ ZYDIS_MNEM_XCRYPTECB,
|
||||
/* 37D */ ZYDIS_MNEM_XCRYPTOFB,
|
||||
/* 37E */ ZYDIS_MNEM_XGETBV,
|
||||
/* 37F */ ZYDIS_MNEM_XLATB,
|
||||
/* 380 */ ZYDIS_MNEM_XOR,
|
||||
/* 381 */ ZYDIS_MNEM_XORPD,
|
||||
/* 382 */ ZYDIS_MNEM_XORPS,
|
||||
/* 383 */ ZYDIS_MNEM_XRSTOR,
|
||||
/* 384 */ ZYDIS_MNEM_XSAVE,
|
||||
/* 385 */ ZYDIS_MNEM_XSETBV,
|
||||
/* 386 */ ZYDIS_MNEM_XSHA1,
|
||||
/* 387 */ ZYDIS_MNEM_XSHA256,
|
||||
/* 388 */ ZYDIS_MNEM_XSTORE,
|
||||
|
||||
ZYDIS_MNEM_FORCE_WORD = 0x7FFF
|
||||
} ZydisInstructionMnemonic;
|
||||
|
||||
/* TODO: Port instruction definition types */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _ZYDIS_OPCODETABLE_H_
|
|
@ -1,144 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include "ZydisSymbolResolver.h"
|
||||
#include <ZydisSymbolResolver.hpp>
|
||||
|
||||
/* CustomSymbolResolver ========================================================================= */
|
||||
|
||||
inline Zydis::BaseSymbolResolver* ZydisBaseSymbolResolver_CppPtr(
|
||||
ZydisBaseSymbolResolverContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<Zydis::BaseSymbolResolver*>(ctx);
|
||||
}
|
||||
|
||||
inline const Zydis::BaseSymbolResolver* ZydisBaseSymbolResolver_CppPtr(
|
||||
const ZydisBaseSymbolResolverContext *ctx)
|
||||
{
|
||||
return reinterpret_cast<const Zydis::BaseSymbolResolver*>(ctx);
|
||||
}
|
||||
|
||||
inline ZydisBaseSymbolResolverContext* ZydisBaseSymbolResolver_CPtr(
|
||||
Zydis::BaseSymbolResolver *ptr)
|
||||
{
|
||||
return reinterpret_cast<ZydisBaseSymbolResolverContext*>(ptr);
|
||||
}
|
||||
|
||||
inline const ZydisBaseSymbolResolverContext* ZydisBaseSymbolResolver_CPtr(
|
||||
const Zydis::BaseSymbolResolver *ptr)
|
||||
{
|
||||
return reinterpret_cast<const ZydisBaseSymbolResolverContext*>(ptr);
|
||||
}
|
||||
|
||||
inline Zydis::InstructionInfo* ZydisInstructionInfo_CppPtr(
|
||||
ZydisInstructionInfo *ptr)
|
||||
{
|
||||
static_assert(sizeof(*ptr) == sizeof(Zydis::InstructionInfo), "broken struct");
|
||||
return reinterpret_cast<Zydis::InstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline const Zydis::InstructionInfo* ZydisInstructionInfo_CppPtr(
|
||||
const ZydisInstructionInfo *ptr)
|
||||
{
|
||||
static_assert(sizeof(*ptr) == sizeof(Zydis::InstructionInfo), "broken struct");
|
||||
return reinterpret_cast<const Zydis::InstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline ZydisInstructionInfo* ZydisInstructionInfo_CPtr(
|
||||
Zydis::InstructionInfo *ptr)
|
||||
{
|
||||
return reinterpret_cast<ZydisInstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
inline const ZydisInstructionInfo* ZydisInstructionInfo_CPtr(
|
||||
const Zydis::InstructionInfo *ptr)
|
||||
{
|
||||
return reinterpret_cast<const ZydisInstructionInfo*>(ptr);
|
||||
}
|
||||
|
||||
/* Internal helper class ----------------------------------------------------------------------- */
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class ZydisCustomSymbolResolver : public Zydis::BaseSymbolResolver
|
||||
{
|
||||
ZydisResolveSymbol_t m_resolverCb;
|
||||
void* m_userData;
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor.
|
||||
* @param resolverCb The resolver callback.
|
||||
* @param userData User provided pointer to arbitrary data passed to resolve callback.
|
||||
*/
|
||||
ZydisCustomSymbolResolver(ZydisResolveSymbol_t resolverCb, void *userData);
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
~ZydisCustomSymbolResolver() override = default;
|
||||
public:
|
||||
/**
|
||||
* @brief Resolves a symbol.
|
||||
* @param info The instruction info.
|
||||
* @param address The address.
|
||||
* @param offset Reference to an unsigned 64 bit integer that receives an offset
|
||||
* relative to the base address of the symbol.
|
||||
* @return The name of the symbol, if the symbol was found, @c NULL if not.
|
||||
*/
|
||||
const char* resolveSymbol(const Zydis::InstructionInfo &info, uint64_t address,
|
||||
uint64_t &offset) override;
|
||||
};
|
||||
|
||||
ZydisCustomSymbolResolver::ZydisCustomSymbolResolver(ZydisResolveSymbol_t resolverCb,
|
||||
void *userData)
|
||||
: m_resolverCb(resolverCb)
|
||||
, m_userData(userData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const char* ZydisCustomSymbolResolver::resolveSymbol(
|
||||
const Zydis::InstructionInfo &info, uint64_t address, uint64_t &offset)
|
||||
{
|
||||
return m_resolverCb(ZydisInstructionInfo_CPtr(&info), address, &offset, m_userData);
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
/* C API implementation ------------------------------------------------------------------------ */
|
||||
|
||||
ZydisBaseSymbolResolverContext* ZydisCustomSymbolResolver_Create(
|
||||
ZydisResolveSymbol_t resolverCb,
|
||||
void *userData)
|
||||
{
|
||||
return ZydisBaseSymbolResolver_CPtr(new ZydisCustomSymbolResolver(resolverCb, userData));
|
||||
}
|
||||
|
||||
/* ============================================================================================= */
|
|
@ -1,126 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef _ZYDIS_SYMBOLRESOLVER_H_
|
||||
#define _ZYDIS_SYMBOLRESOLVER_H_
|
||||
|
||||
#include "ZydisTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* BaseSymbolResolver ======================================================================== */
|
||||
|
||||
typedef struct _ZydisBaseSymbolResolverContext { int a; } ZydisBaseSymbolResolverContext;
|
||||
|
||||
/**
|
||||
* @brief Releases a symbol resolver.
|
||||
* @param ctx The context of the symbol resolver to free.
|
||||
* The context may no longer used after it was released.
|
||||
*/
|
||||
void ZydisBaseSymbolResolver_Release(ZydisBaseSymbolResolverContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Resolves a symbol.
|
||||
* @param ctx The symbol resolver context.
|
||||
* @param info The instruction info.
|
||||
* @param address The address.
|
||||
* @param offset Pointer to an unsigned 64 bit integer that receives an offset relative to
|
||||
* the base address of the symbol.
|
||||
* @return The name of the symbol if the symbol was found, else @c NULL.
|
||||
*/
|
||||
const char* ZydisBaseSymbolResolver_ResolveSymbol(ZydisBaseSymbolResolverContext *ctx,
|
||||
const ZydisInstructionInfo *info, uint64_t address, uint64_t *offset);
|
||||
|
||||
/* ExactSymbolResolver ======================================================================= */
|
||||
|
||||
/**
|
||||
* @brief Creates an exact symbol resolver.
|
||||
* @return @c NULL if it fails, else a symbol resolver context.
|
||||
* @see BaseSymbolResolver_Release
|
||||
* An exact resolver is a simple symbol resolver that only matches exact addresses.
|
||||
*/
|
||||
// TODO: verify return value
|
||||
ZydisBaseSymbolResolverContext* ZydisExactSymbolResolver_Create(void);
|
||||
|
||||
/**
|
||||
* @brief Query if the given address is a known symbol.
|
||||
* @param ctx The exact symbol resolver context.
|
||||
* @param address The address.
|
||||
* @return @c true if the address is known, @c false if not.
|
||||
*/
|
||||
bool ZydisExactSymbolResolver_ContainsSymbol(ZydisBaseSymbolResolverContext *ctx, uint64_t address);
|
||||
|
||||
/**
|
||||
* @brief Adds or changes a symbol.
|
||||
* @param ctx The exact symbol resolver context.
|
||||
* @param address The address.
|
||||
* @param name The symbol name.
|
||||
*/
|
||||
void ZydisExactSymbolResolverContext_SetSymbol(ZydisBaseSymbolResolverContext *ctx,
|
||||
uint64_t address, const char* name);
|
||||
|
||||
/**
|
||||
* @brief Removes the symbol described by address.
|
||||
* @param ctx The exact symbol resolver context.
|
||||
* @param address The address.
|
||||
* This will invalidate all char-pointers to the affected symbol name.
|
||||
*/
|
||||
void ZydisExactSymbolResolverContext_RemoveSymbol(ZydisBaseSymbolResolverContext *ctx,
|
||||
uint64_t address);
|
||||
|
||||
/**
|
||||
* @brief Clears the symbol tree.
|
||||
* @param ctx The exact symbol resolver context.
|
||||
*/
|
||||
void ExactSymbolResolverContext_Clear(ZydisBaseSymbolResolverContext *ctx);
|
||||
|
||||
/* CustomSymbolResolver ====================================================================== */
|
||||
|
||||
typedef const char* (*ZydisResolveSymbol_t)(const ZydisInstructionInfo *info, uint64_t address,
|
||||
uint64_t *offset, void *userData);
|
||||
|
||||
/**
|
||||
* @brief Creates a custom symbol resolver.
|
||||
* @param resolverCb The resolver callback consulted when symbols need to be resolved.
|
||||
* @param userData A pointer to arbitrary data passed to the resolver callback.
|
||||
* May also be @c NULL.
|
||||
* @return @c NULL if it fails, else a symbol resolver context.
|
||||
*/
|
||||
ZydisBaseSymbolResolverContext* CustomSymbolResolver_Create(ZydisResolveSymbol_t resolverCb,
|
||||
void *userData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ZYDIS_SYMBOLRESOLVER_H_ */
|
|
@ -1,46 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include "ZydisUtils.h"
|
||||
#include "ZydisUtils.hpp"
|
||||
|
||||
static_assert(
|
||||
sizeof(ZydisInstructionInfo) == sizeof(Zydis::InstructionInfo),
|
||||
"struct size mismatch");
|
||||
static_assert(
|
||||
sizeof(ZydisOperandInfo) == sizeof(Zydis::OperandInfo),
|
||||
"struct size mismatch");
|
||||
|
||||
uint64_t ZydisCalcAbsoluteTarget(const ZydisInstructionInfo *info, const ZydisOperandInfo *operand)
|
||||
{
|
||||
return Zydis::CalcAbsoluteTarget(
|
||||
*reinterpret_cast<const Zydis::InstructionInfo*>(info),
|
||||
*reinterpret_cast<const Zydis::OperandInfo*>(operand));
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef _ZYDIS_UTILS_H_
|
||||
#define _ZYDIS_UTILS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ZydisTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Calculates the absolute target address of a relative instruction operand.
|
||||
* @param info The instruction info.
|
||||
* @param operand The operand.
|
||||
* @return The absolute target address.
|
||||
*/
|
||||
uint64_t ZydisCalcAbsoluteTarget(const ZydisInstructionInfo* info, const ZydisOperandInfo* operand);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ZYDIS_UTILS_H_ */
|
|
@ -44,54 +44,40 @@ endif ()
|
|||
|
||||
# Library
|
||||
set(headers
|
||||
"ZyDis/ZydisSymbolResolver.hpp"
|
||||
"ZyDis/ZydisOpcodeTable.hpp"
|
||||
"ZyDis/ZydisInstructionDecoder.hpp"
|
||||
"ZyDis/ZydisInstructionFormatter.hpp"
|
||||
"ZyDis/ZydisTypes.hpp"
|
||||
"ZyDis/ZydisUtils.hpp"
|
||||
"ZyDis/Zydis.hpp")
|
||||
"Zydis/Zydis.hpp"
|
||||
"Zydis/ZydisInstructionDecoder.hpp"
|
||||
"Zydis/ZydisInstructionFormatter.hpp"
|
||||
"Zydis/ZydisOpcodeTable.hpp"
|
||||
"Zydis/ZydisSymbolResolver.hpp"
|
||||
"Zydis/ZydisTypes.hpp"
|
||||
"Zydis/ZydisUtils.hpp")
|
||||
set(sources
|
||||
"ZyDis/ZydisInstructionDecoder.cpp"
|
||||
"ZyDis/ZydisInstructionFormatter.cpp"
|
||||
"ZyDis/ZydisOpcodeTable.cpp"
|
||||
"ZyDis/ZydisSymbolResolver.cpp"
|
||||
"ZyDis/ZydisUtils.cpp")
|
||||
"Zydis/ZydisInstructionDecoder.cpp"
|
||||
"Zydis/ZydisInstructionFormatter.cpp"
|
||||
"Zydis/ZydisOpcodeTable.cpp"
|
||||
"Zydis/ZydisSymbolResolver.cpp"
|
||||
"Zydis/ZydisUtils.cpp")
|
||||
|
||||
if (BUILD_C_BINDINGS)
|
||||
set(headers ${headers}
|
||||
"Zydis/ZydisAPI.h")
|
||||
set(sources ${sources}
|
||||
"Zydis/ZydisAPI.cpp")
|
||||
endif ()
|
||||
|
||||
add_library("Zydis" ${headers} ${sources})
|
||||
generate_export_header(
|
||||
"Zydis"
|
||||
BASE_NAME "Zydis"
|
||||
BASE_NAME "ZYDIS"
|
||||
EXPORT_FILE_NAME "ZydisExportConfig.h")
|
||||
include_directories(${PROJECT_BINARY_DIR})
|
||||
|
||||
# C bindings
|
||||
if (BUILD_C_BINDINGS)
|
||||
set(c_headers
|
||||
"Bindings/C/Zydis.h"
|
||||
"Bindings/C/ZydisInstructionDecoder.h"
|
||||
"Bindings/C/ZydisTypes.h"
|
||||
"Bindings/C/ZydisInstructionFormatter.h"
|
||||
"Bindings/C/ZydisUtils.h"
|
||||
"Bindings/C/ZydisSymbolResolver.h"
|
||||
"Bindings/C/ZydisOpcodeTable.h")
|
||||
set(c_sources
|
||||
"Bindings/C/ZydisSymbolResolver.cpp"
|
||||
"Bindings/C/ZydisOpcodeTable.cpp"
|
||||
"Bindings/C/ZydisInstructionFormatter.cpp"
|
||||
"Bindings/C/ZydisInstructionDecoder.cpp"
|
||||
"Bindings/C/ZydisUtils.cpp")
|
||||
add_library("ZydisC" ${c_headers} ${c_sources})
|
||||
include_directories("Zydis")
|
||||
target_link_libraries("ZydisC" "Zydis")
|
||||
endif ()
|
||||
|
||||
# Examples
|
||||
if (BUILD_EXAMPLES)
|
||||
include_directories("Bindings/C")
|
||||
include_directories("Zydis")
|
||||
|
||||
add_executable("C_SimpleDemo" "Examples/C/SimpleDemo/SimpleDemo.c")
|
||||
target_link_libraries("C_SimpleDemo" "ZydisC")
|
||||
target_link_libraries("C_SimpleDemo" "Zydis")
|
||||
endif ()
|
||||
|
||||
set(CONFIGURED_ONCE TRUE CACHE INTERNAL "CMake has configured at least once.")
|
||||
|
|
|
@ -1,8 +1,58 @@
|
|||
#include <Zydis.h>
|
||||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <ZydisAPI.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void PrintZydisError()
|
||||
{
|
||||
puts("Zydis error: ");
|
||||
switch (ZydisGetLastError())
|
||||
{
|
||||
case ZYDIS_ERROR_SUCCESS:
|
||||
puts("success");
|
||||
break;
|
||||
case ZYDIS_ERROR_UNKNOWN:
|
||||
puts("unknown error");
|
||||
break;
|
||||
case ZYDIS_ERROR_NOT_ENOUGH_MEMORY:
|
||||
puts("not enough memory");
|
||||
break;
|
||||
case ZYDIS_ERROR_INVALID_PARAMETER:
|
||||
puts("invalid parameter");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
uint8_t data32[] =
|
||||
|
@ -34,22 +84,42 @@ int main()
|
|||
|
||||
ZydisInstructionInfo info;
|
||||
ZydisInstructionDecoderContext* decoder = NULL;
|
||||
ZydisBaseInstructionFormatterContext* formatter = NULL;
|
||||
ZydisBaseInputContext* input32 = NULL;
|
||||
ZydisBaseInputContext* input64 = NULL;
|
||||
ZydisInstructionFormatterContext* formatter = NULL;
|
||||
ZydisInputContext* input32 = NULL;
|
||||
ZydisInputContext* input64 = NULL;
|
||||
|
||||
decoder = ZydisInstructionDecoder_Create();
|
||||
formatter = ZydisIntelInstructionFormatter_Create();
|
||||
// Create decoder and formatter instances
|
||||
decoder = ZydisCreateInstructionDecoder();
|
||||
if (!decoder)
|
||||
{
|
||||
goto FreeZydisDecoder;
|
||||
}
|
||||
formatter = ZydisCreateIntelInstructionFormatter();
|
||||
if (!formatter)
|
||||
{
|
||||
goto FreeZydisFormatter;
|
||||
}
|
||||
|
||||
input32 = ZydisMemoryInput_Create(&data32[0], sizeof(data32));
|
||||
input64 = ZydisMemoryInput_Create(&data64[0], sizeof(data64));
|
||||
// Create memory data sources
|
||||
input32 = ZydisCreateMemoryInput(&data32[0], sizeof(data32));
|
||||
if (!input32)
|
||||
{
|
||||
goto FreeZydisInput32;
|
||||
}
|
||||
input64 = ZydisCreateMemoryInput(&data64[0], sizeof(data64));
|
||||
if (!input64)
|
||||
{
|
||||
goto FreeZydisInput64;
|
||||
}
|
||||
|
||||
ZydisInstructionDecoder_SetDisassemblerMode(decoder, DM_M32BIT);
|
||||
ZydisInstructionDecoder_SetDataSource(decoder, input32);
|
||||
ZydisInstructionDecoder_SetInstructionPointer(decoder, 0x77091852);
|
||||
// Set decoder properties
|
||||
ZydisSetDisassemblerMode(decoder, ZYDIS_DM_M32BIT);
|
||||
ZydisSetDataSource(decoder, input32);
|
||||
ZydisSetInstructionPointer(decoder, 0x77091852);
|
||||
|
||||
// Decode and format all instructions
|
||||
puts("32 bit test ...\n\n");
|
||||
while (ZydisInstructionDecoder_DecodeInstruction(decoder, &info))
|
||||
while (ZydisDecodeInstruction(decoder, &info))
|
||||
{
|
||||
printf("%08X ", (uint32_t)(info.instrAddress & 0xFFFFFFFF));
|
||||
if (info.flags & ZYDIS_IF_ERROR_MASK)
|
||||
|
@ -58,17 +128,28 @@ int main()
|
|||
}
|
||||
else
|
||||
{
|
||||
printf("%s\n", ZydisBaseInstructionFormatter_FormatInstruction(formatter, &info));
|
||||
const char* instructionText;
|
||||
if (!ZydisFormatInstruction(formatter, &info, &instructionText))
|
||||
{
|
||||
goto FreeZydisInput64;
|
||||
}
|
||||
printf("%s\n", instructionText);
|
||||
}
|
||||
}
|
||||
// Check if an error occured in ZydisDecodeInstruction or the end of the input was reached.
|
||||
if (ZydisGetLastError() != ZYDIS_ERROR_SUCCESS)
|
||||
{
|
||||
goto FreeZydisInput64;
|
||||
}
|
||||
|
||||
puts("\n");
|
||||
|
||||
ZydisInstructionDecoder_SetDisassemblerMode(decoder, DM_M64BIT);
|
||||
ZydisInstructionDecoder_SetDataSource(decoder, input64);
|
||||
ZydisInstructionDecoder_SetInstructionPointer(decoder, 0x00007FFA39A81930ull);
|
||||
// Set decoder properties
|
||||
ZydisSetDisassemblerMode(decoder, ZYDIS_DM_M64BIT);
|
||||
ZydisSetDataSource(decoder, input64);
|
||||
ZydisSetInstructionPointer(decoder, 0x00007FFA39A81930ull);
|
||||
puts("64 bit test ...\n\n");
|
||||
while (ZydisInstructionDecoder_DecodeInstruction(decoder, &info))
|
||||
while (ZydisDecodeInstruction(decoder, &info))
|
||||
{
|
||||
printf("%016llX ", info.instrAddress);
|
||||
if (info.flags & ZYDIS_IF_ERROR_MASK)
|
||||
|
@ -77,10 +158,38 @@ int main()
|
|||
}
|
||||
else
|
||||
{
|
||||
printf("%s\n", ZydisBaseInstructionFormatter_FormatInstruction(formatter, &info));
|
||||
const char* instructionText;
|
||||
if (!ZydisFormatInstruction(formatter, &info, &instructionText))
|
||||
{
|
||||
goto FreeZydisInput64;
|
||||
}
|
||||
printf("%s\n", instructionText);
|
||||
}
|
||||
}
|
||||
// Check if an error occured in ZydisDecodeInstruction or the end of the input was reached.
|
||||
if (ZydisGetLastError() != ZYDIS_ERROR_SUCCESS)
|
||||
{
|
||||
goto FreeZydisInput64;
|
||||
}
|
||||
|
||||
// Cleanup code
|
||||
FreeZydisInput64:
|
||||
ZydisFreeInput(input64);
|
||||
FreeZydisInput32:
|
||||
ZydisFreeInput(input32);
|
||||
FreeZydisFormatter:
|
||||
ZydisFreeInstructionFormatter(formatter);
|
||||
FreeZydisDecoder:
|
||||
ZydisFreeInstructionDecoder(decoder);
|
||||
|
||||
if (ZydisGetLastError() != ZYDIS_ERROR_SUCCESS)
|
||||
{
|
||||
PrintZydisError();
|
||||
getchar();
|
||||
return 1;
|
||||
}
|
||||
|
||||
getchar();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,421 @@
|
|||
/***************************************************************************************************
|
||||
|
||||
Zyan Disassembler Engine
|
||||
Version 1.0
|
||||
|
||||
Remarks : Freeware, Copyright must be included
|
||||
|
||||
Original Author : Florian Bernd
|
||||
Modifications : Joel Höner
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include "ZydisAPI.h"
|
||||
#include "ZydisInstructionDecoder.hpp"
|
||||
#include "ZydisInstructionFormatter.hpp"
|
||||
|
||||
static_assert(
|
||||
sizeof(ZydisOperandInfo) == sizeof(Zydis::OperandInfo),
|
||||
"struct size mismatch");
|
||||
|
||||
static_assert(
|
||||
sizeof(ZydisInstructionInfo) == sizeof(Zydis::InstructionInfo),
|
||||
"struct size mismatch");
|
||||
|
||||
/* Error Handling =============================================================================== */
|
||||
|
||||
static uint32_t g_zydisLastError = ZYDIS_ERROR_SUCCESS;
|
||||
|
||||
uint32_t ZydisGetLastError()
|
||||
{
|
||||
return g_zydisLastError;
|
||||
}
|
||||
|
||||
void ZydisSetLastError(uint32_t errorCode)
|
||||
{
|
||||
g_zydisLastError = errorCode;
|
||||
}
|
||||
|
||||
/* Conversion Helper ============================================================================ */
|
||||
|
||||
template <typename ContextT, typename InstanceT, typename... InstanceCtorArgsT>
|
||||
ContextT* ZydisCreateContextInplace(uint8_t contextType, InstanceCtorArgsT... args)
|
||||
{
|
||||
ContextT* context = new (std::nothrow) ContextT;
|
||||
if (!context)
|
||||
{
|
||||
ZydisSetLastError(ZYDIS_ERROR_NOT_ENOUGH_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
context->type = contextType;
|
||||
context->object = new (std::nothrow) InstanceT(args...);
|
||||
if (!context->object)
|
||||
{
|
||||
delete context;
|
||||
ZydisSetLastError(ZYDIS_ERROR_NOT_ENOUGH_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
template <typename ContextT, typename InstanceT>
|
||||
ContextT* ZydisCreateContext(uint8_t contextType, InstanceT* instance)
|
||||
{
|
||||
ContextT* context = new (std::nothrow) ContextT;
|
||||
if (!context)
|
||||
{
|
||||
ZydisSetLastError(ZYDIS_ERROR_NOT_ENOUGH_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
context->type = contextType;
|
||||
context->object = instance;
|
||||
return context;
|
||||
}
|
||||
|
||||
template <typename ContextT, typename InstanceT>
|
||||
bool ZydisFreeContext(const ContextT* context, uint8_t expectedType)
|
||||
{
|
||||
InstanceT* instance = ZydisCast<ContextT, InstanceT>(context, expectedType);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
delete instance;
|
||||
delete context;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename ContextT, typename InstanceT>
|
||||
InstanceT* ZydisCast(const ContextT* input, uint8_t expectedType)
|
||||
{
|
||||
if (!input || !input->object || ((input->type & expectedType) != expectedType))
|
||||
{
|
||||
ZydisSetLastError(ZYDIS_ERROR_INVALID_PARAMETER);
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<InstanceT*>(input->object);
|
||||
}
|
||||
|
||||
/* Input ======================================================================================== */
|
||||
|
||||
ZydisInputContext* ZydisCreateCustomInput(/* TODO */)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ZydisInputContext* ZydisCreateMemoryInput(const void* buffer, size_t bufferLen)
|
||||
{
|
||||
return ZydisCreateContextInplace<ZydisInputContext, Zydis::MemoryInput>(
|
||||
ZYDIS_CONTEXT_INPUT | ZYDIS_CONTEXT_INPUT_MEMORY, buffer, bufferLen);
|
||||
}
|
||||
|
||||
bool ZydisIsEndOfInput(const ZydisInputContext* input, bool* isEndOfInput)
|
||||
{
|
||||
Zydis::BaseInput* instance =
|
||||
ZydisCast<ZydisInputContext, Zydis::BaseInput>(input, ZYDIS_CONTEXT_INPUT);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*isEndOfInput = instance->isEndOfInput();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisGetInputPosition(const ZydisInputContext* input, uint64_t* position)
|
||||
{
|
||||
Zydis::BaseInput* instance =
|
||||
ZydisCast<ZydisInputContext, Zydis::BaseInput>(input, ZYDIS_CONTEXT_INPUT);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*position = instance->getPosition();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisSetInputPosition(const ZydisInputContext* input, uint64_t position)
|
||||
{
|
||||
Zydis::BaseInput* instance =
|
||||
ZydisCast<ZydisInputContext, Zydis::BaseInput>(input, ZYDIS_CONTEXT_INPUT);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ZydisSetLastError(ZYDIS_ERROR_SUCCESS);
|
||||
return instance->setPosition(position);
|
||||
}
|
||||
|
||||
bool ZydisFreeInput(const ZydisInputContext* input)
|
||||
{
|
||||
return ZydisFreeContext<ZydisInputContext, Zydis::BaseInput>(input, ZYDIS_CONTEXT_INPUT);
|
||||
}
|
||||
|
||||
/* InstructionDecoder =========================================================================== */
|
||||
|
||||
ZydisInstructionDecoderContext* ZydisCreateInstructionDecoder()
|
||||
{
|
||||
return ZydisCreateContextInplace<ZydisInstructionDecoderContext, Zydis::InstructionDecoder>(
|
||||
ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
}
|
||||
|
||||
bool ZydisDecodeInstruction(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInstructionInfo* info)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ZydisSetLastError(ZYDIS_ERROR_SUCCESS);
|
||||
return instance->decodeInstruction(*reinterpret_cast<Zydis::InstructionInfo*>(info));
|
||||
}
|
||||
|
||||
bool ZydisGetDataSource(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInputContext** input)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*input = ZydisCreateContext<ZydisInputContext,
|
||||
Zydis::BaseInput>(ZYDIS_CONTEXT_INPUT, instance->getDataSource());
|
||||
if (!input)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisSetDataSource(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInputContext* input)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Zydis::BaseInput* object =
|
||||
ZydisCast<ZydisInputContext, Zydis::BaseInput>(input, ZYDIS_CONTEXT_INPUT);
|
||||
if (!object)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
instance->setDataSource(object);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisGetDisassemblerMode(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisDisassemblerMode* disassemblerMode)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*disassemblerMode = static_cast<ZydisDisassemblerMode>(instance->getDisassemblerMode());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisSetDisassemblerMode(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisDisassemblerMode disassemblerMode)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
instance->setDisassemblerMode(static_cast<Zydis::DisassemblerMode>(disassemblerMode));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisGetPreferredVendor(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInstructionSetVendor* preferredVendor)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*preferredVendor = static_cast<ZydisInstructionSetVendor>(instance->getPreferredVendor());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisSetPreferredVendor(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInstructionSetVendor preferredVendor)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
instance->setPreferredVendor(static_cast<Zydis::InstructionSetVendor>(preferredVendor));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisGetInstructionPointer(const ZydisInstructionDecoderContext* decoder,
|
||||
uint64_t* instructionPointer)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*instructionPointer = instance->getInstructionPointer();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisSetInstructionPointer(const ZydisInstructionDecoderContext* decoder,
|
||||
uint64_t instructionPointer)
|
||||
{
|
||||
Zydis::InstructionDecoder* instance =
|
||||
ZydisCast<ZydisInstructionDecoderContext,
|
||||
Zydis::InstructionDecoder>(decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
instance->setInstructionPointer(instructionPointer);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisFreeInstructionDecoder(const ZydisInstructionDecoderContext* decoder)
|
||||
{
|
||||
return ZydisFreeContext<
|
||||
ZydisInstructionDecoderContext, Zydis::InstructionDecoder>(
|
||||
decoder, ZYDIS_CONTEXT_INSTRUCTIONDECODER);
|
||||
}
|
||||
|
||||
/* InstructionFormatter ========================================================================= */
|
||||
|
||||
ZydisInstructionFormatterContext* ZydisCreateCustomInstructionFormatter(/* TODO */)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ZydisInstructionFormatterContext* ZydisCreateIntelInstructionFormatter()
|
||||
{
|
||||
return ZydisCreateContextInplace<ZydisInstructionFormatterContext,
|
||||
Zydis::IntelInstructionFormatter>(
|
||||
ZYDIS_CONTEXT_INSTRUCTIONFORMATTER | ZYDIS_CONTEXT_INSTRUCTIONFORMATTER_INTEL);
|
||||
}
|
||||
|
||||
bool ZydisFormatInstruction(const ZydisInstructionFormatterContext* formatter,
|
||||
const ZydisInstructionInfo* info, const char** instructionText)
|
||||
{
|
||||
Zydis::IntelInstructionFormatter* instance =
|
||||
ZydisCast<ZydisInstructionFormatterContext,
|
||||
Zydis::IntelInstructionFormatter>(formatter, ZYDIS_CONTEXT_INSTRUCTIONFORMATTER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*instructionText =
|
||||
instance->formatInstruction(*reinterpret_cast<const Zydis::InstructionInfo*>(info));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisGetSymbolResolver(const ZydisInstructionFormatterContext* formatter,
|
||||
ZydisSymbolResolverContext** resolver)
|
||||
{
|
||||
Zydis::IntelInstructionFormatter* instance =
|
||||
ZydisCast<ZydisInstructionFormatterContext,
|
||||
Zydis::IntelInstructionFormatter>(formatter, ZYDIS_CONTEXT_INSTRUCTIONFORMATTER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*resolver = ZydisCreateContext<ZydisSymbolResolverContext,
|
||||
Zydis::BaseSymbolResolver>(ZYDIS_CONTEXT_SYMBOLRESOLVER, instance->getSymbolResolver());
|
||||
if (!resolver)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisSetSymbolResolver(const ZydisInstructionFormatterContext* formatter,
|
||||
ZydisSymbolResolverContext* resolver)
|
||||
{
|
||||
Zydis::IntelInstructionFormatter* instance =
|
||||
ZydisCast<ZydisInstructionFormatterContext,
|
||||
Zydis::IntelInstructionFormatter>(formatter, ZYDIS_CONTEXT_INSTRUCTIONFORMATTER);
|
||||
if (!instance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Zydis::BaseSymbolResolver* object =
|
||||
ZydisCast<ZydisSymbolResolverContext,
|
||||
Zydis::BaseSymbolResolver>(resolver, ZYDIS_CONTEXT_SYMBOLRESOLVER);
|
||||
if (!object)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
instance->setSymbolResolver(object);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZydisFreeInstructionFormatter(const ZydisInstructionFormatterContext* formatter)
|
||||
{
|
||||
return ZydisFreeContext<
|
||||
ZydisInstructionFormatterContext, Zydis::BaseInstructionFormatter>(
|
||||
formatter, ZYDIS_CONTEXT_INSTRUCTIONFORMATTER);
|
||||
}
|
||||
|
||||
/* SymbolResolver =============================================================================== */
|
||||
|
||||
ZYDIS_EXPORT ZydisSymbolResolverContext* ZydisCreateCustomSymbolResolver(/*TODO*/);
|
||||
|
||||
ZYDIS_EXPORT ZydisSymbolResolverContext* ZydisCreateExactSymbolResolver();
|
||||
|
||||
ZYDIS_EXPORT bool ZydisResolveSymbol(const ZydisSymbolResolverContext* resolver,
|
||||
const ZydisInstructionInfo* info, uint64_t address, const char** symbol, uint64_t* offset);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisExactSymbolResolverContainsSymbol(
|
||||
const ZydisSymbolResolverContext* resolver, uint64_t address, bool* containsSymbol);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisExactSymbolResolverSetSymbol(const ZydisSymbolResolverContext* resolver,
|
||||
uint64_t address, const char* symbol);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisExactSymbolResolverRemoveSymbol(const ZydisSymbolResolverContext* resolver,
|
||||
uint64_t address);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisExactSymbolResolverClear(const ZydisSymbolResolverContext* resolver);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisFreeSymbolResolver(const ZydisSymbolResolverContext* resolver);
|
||||
|
||||
/* ============================================================================================== */
|
|
@ -28,18 +28,22 @@
|
|||
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef _ZYDIS_TYPES_H_
|
||||
#define _ZYDIS_TYPES_H_
|
||||
#ifndef _ZYDIS_API_H_
|
||||
#define _ZYDIS_API_H_
|
||||
|
||||
#define Zydis_EXPORTS
|
||||
|
||||
#include <cstdbool>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "ZydisOpcodeTable.h"
|
||||
#include "ZydisExportConfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Types ======================================================================================== */
|
||||
|
||||
/**
|
||||
* @brief Values that represent additional flags of a decoded instruction.
|
||||
*/
|
||||
|
@ -539,8 +543,168 @@ typedef struct _ZydisInstructionInfo
|
|||
uint64_t instrPointer;
|
||||
} ZydisInstructionInfo;
|
||||
|
||||
/* Context Types ================================================================================ */
|
||||
|
||||
typedef enum _ZydisContextType
|
||||
{
|
||||
ZYDIS_CONTEXT_INPUT = 0x0080,
|
||||
ZYDIS_CONTEXT_INPUT_CUSTOM = 0x0001,
|
||||
ZYDIS_CONTEXT_INPUT_MEMORY = 0x0002,
|
||||
ZYDIS_CONTEXT_INSTRUCTIONDECODER = 0x0040,
|
||||
ZYDIS_CONTEXT_INSTRUCTIONFORMATTER = 0x0020,
|
||||
ZYDIS_CONTEXT_INSTRUCTIONFORMATTER_CUSTOM = 0x0001,
|
||||
ZYDIS_CONTEXT_INSTRUCTIONFORMATTER_INTEL = 0x0002,
|
||||
ZYDIS_CONTEXT_SYMBOLRESOLVER = 0x0010,
|
||||
ZYDIS_CONTEXT_SYMBOLRESOLVER_CUSTOM = 0x0001,
|
||||
ZYDIS_CONTEXT_SYMBOLRESOLVER_EXACT = 0x0002
|
||||
} ZydisContextType;
|
||||
|
||||
typedef struct _ZydisInputContext
|
||||
{
|
||||
uint8_t type;
|
||||
void* object;
|
||||
} ZydisInputContext;
|
||||
|
||||
typedef struct _ZydisInstructionDecoderContext
|
||||
{
|
||||
uint8_t type;
|
||||
void* object;
|
||||
} ZydisInstructionDecoderContext;
|
||||
|
||||
typedef struct _ZydisInstructionFormatterContext
|
||||
{
|
||||
uint8_t type;
|
||||
void* object;
|
||||
} ZydisInstructionFormatterContext;
|
||||
|
||||
typedef struct _ZydisSymbolResolverContext
|
||||
{
|
||||
uint8_t type;
|
||||
void* object;
|
||||
} ZydisSymbolResolverContext;
|
||||
|
||||
/* Error Handling =============================================================================== */
|
||||
|
||||
typedef enum _ZydisErrorCode /* : uint8_t */
|
||||
{
|
||||
ZYDIS_ERROR_SUCCESS,
|
||||
ZYDIS_ERROR_UNKNOWN,
|
||||
ZYDIS_ERROR_NOT_ENOUGH_MEMORY,
|
||||
ZYDIS_ERROR_INVALID_PARAMETER
|
||||
} ZydisErrorCode;
|
||||
|
||||
ZYDIS_EXPORT uint32_t ZydisGetLastError();
|
||||
|
||||
/* Input ======================================================================================== */
|
||||
|
||||
ZYDIS_EXPORT ZydisInputContext* ZydisCreateCustomInput(/* TODO */);
|
||||
|
||||
ZYDIS_EXPORT ZydisInputContext* ZydisCreateMemoryInput(const void* buffer, size_t bufferLen);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisIsEndOfInput(const ZydisInputContext* input, bool* isEndOfInput);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisGetInputPosition(const ZydisInputContext* input, uint64_t* position);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisSetInputPosition(const ZydisInputContext* input, uint64_t position);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisFreeInput(const ZydisInputContext* input);
|
||||
|
||||
/* InstructionDecoder =========================================================================== */
|
||||
|
||||
/**
|
||||
* @brief Values that represent a disassembler mode.
|
||||
*/
|
||||
typedef enum _ZydisDisassemblerMode /* : uint8_t */
|
||||
{
|
||||
ZYDIS_DM_M16BIT,
|
||||
ZYDIS_DM_M32BIT,
|
||||
ZYDIS_DM_M64BIT
|
||||
} ZydisDisassemblerMode;
|
||||
|
||||
/**
|
||||
* @brief Values that represent an instruction-set vendor.
|
||||
*/
|
||||
typedef enum _ZydisInstructionSetVendor /* : uint8_t */
|
||||
{
|
||||
ZYDIS_ISV_ANY,
|
||||
ZYDIS_ISV_INTEL,
|
||||
ZYDIS_ISV_AMD
|
||||
} ZydisInstructionSetVendor;
|
||||
|
||||
ZYDIS_EXPORT ZydisInstructionDecoderContext* ZydisCreateInstructionDecoder();
|
||||
|
||||
ZYDIS_EXPORT bool ZydisDecodeInstruction(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInstructionInfo* info);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisGetDataSource(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInputContext** input);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisSetDataSource(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInputContext* input);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisGetDisassemblerMode(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisDisassemblerMode* disassemblerMode);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisSetDisassemblerMode(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisDisassemblerMode disassemblerMode);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisGetPreferredVendor(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInstructionSetVendor* preferredVendor);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisSetPreferredVendor(const ZydisInstructionDecoderContext* decoder,
|
||||
ZydisInstructionSetVendor preferredVendor);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisGetInstructionPointer(const ZydisInstructionDecoderContext* decoder,
|
||||
uint64_t* instructionPointer);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisSetInstructionPointer(const ZydisInstructionDecoderContext* decoder,
|
||||
uint64_t instructionPointer);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisFreeInstructionDecoder(const ZydisInstructionDecoderContext* decoder);
|
||||
|
||||
/* InstructionFormatter ========================================================================= */
|
||||
|
||||
ZYDIS_EXPORT ZydisInstructionFormatterContext* ZydisCreateCustomInstructionFormatter(/*TODO*/);
|
||||
|
||||
ZYDIS_EXPORT ZydisInstructionFormatterContext* ZydisCreateIntelInstructionFormatter();
|
||||
|
||||
ZYDIS_EXPORT bool ZydisFormatInstruction(const ZydisInstructionFormatterContext* formatter,
|
||||
const ZydisInstructionInfo* info, const char** instructionText);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisGetSymbolResolver(const ZydisInstructionFormatterContext* formatter,
|
||||
ZydisSymbolResolverContext** resolver);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisSetSymbolResolver(const ZydisInstructionFormatterContext* formatter,
|
||||
ZydisSymbolResolverContext* resolver);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisFreeInstructionFormatter(const ZydisInstructionFormatterContext* formatter);
|
||||
|
||||
/* SymbolResolver =============================================================================== */
|
||||
|
||||
ZYDIS_EXPORT ZydisSymbolResolverContext* ZydisCreateCustomSymbolResolver(/*TODO*/);
|
||||
|
||||
ZYDIS_EXPORT ZydisSymbolResolverContext* ZydisCreateExactSymbolResolver();
|
||||
|
||||
ZYDIS_EXPORT bool ZydisResolveSymbol(const ZydisSymbolResolverContext* resolver,
|
||||
const ZydisInstructionInfo* info, uint64_t address, const char** symbol, uint64_t* offset);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisExactSymbolResolverContainsSymbol(
|
||||
const ZydisSymbolResolverContext* resolver, uint64_t address, bool* containsSymbol);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisExactSymbolResolverSetSymbol(const ZydisSymbolResolverContext* resolver,
|
||||
uint64_t address, const char** symbol);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisExactSymbolResolverRemoveSymbol(const ZydisSymbolResolverContext* resolver,
|
||||
uint64_t address);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisExactSymbolResolverClear(const ZydisSymbolResolverContext* resolver);
|
||||
|
||||
ZYDIS_EXPORT bool ZydisFreeSymbolResolver(const ZydisSymbolResolverContext* resolver);
|
||||
|
||||
/* ============================================================================================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ZYDIS_TYPES_H_ */
|
||||
#endif /* _ZYDIS_API_H_ */
|
|
@ -117,7 +117,7 @@ BaseInstructionFormatter::BaseInstructionFormatter(
|
|||
|
||||
}
|
||||
|
||||
const char *BaseInstructionFormatter::formatInstruction(const InstructionInfo& info)
|
||||
const char* BaseInstructionFormatter::formatInstruction(const InstructionInfo& info)
|
||||
{
|
||||
// Clears the internal string buffer
|
||||
outputClear();
|
||||
|
@ -202,8 +202,7 @@ char const *BaseInstructionFormatter::outputString()
|
|||
}
|
||||
// Write the formatted text to the output buffer
|
||||
assert((bufLen - offset) > 0);
|
||||
strLen =
|
||||
vsnprintf_s(&m_outputBuffer[offset], bufLen - offset, _TRUNCATE, format, arguments);
|
||||
strLen = std::vsnprintf(&m_outputBuffer[offset], bufLen - offset, format, arguments);
|
||||
} while (strLen < 0);
|
||||
// Increase the string length
|
||||
m_outputStringLen = offset + strLen + 1;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
* relative to the base address of the symbol.
|
||||
* @return The name of the symbol, if the symbol was found, @c NULL if not.
|
||||
*/
|
||||
virtual const char *resolveSymbol(const InstructionInfo& info, uint64_t address,
|
||||
virtual const char* resolveSymbol(const InstructionInfo& info, uint64_t address,
|
||||
uint64_t& offset);
|
||||
};
|
||||
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
* @param address The address.
|
||||
* @param name The symbol name.
|
||||
*/
|
||||
void setSymbol(uint64_t address, const char *name);
|
||||
void setSymbol(uint64_t address, const char* name);
|
||||
/**
|
||||
* @brief Removes the symbol described by address. This will invalidate all char pointers
|
||||
* to the specific symbol name.
|
||||
|
|
Loading…
Reference in New Issue