mirror of https://github.com/x64dbg/zydis
				
				
				
			changed VX prefix to ZyDis (scriptually)
This commit is contained in:
		
							parent
							
								
									7e26fa1683
								
							
						
					
					
						commit
						de31261273
					
				
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -32,7 +32,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "VXDisassemblerTypes.hpp"
 | 
					#include "ZyDisDisassemblerTypes.hpp"
 | 
				
			||||||
#include "VXInstructionDecoder.hpp"
 | 
					#include "ZyDisInstructionDecoder.hpp"
 | 
				
			||||||
#include "VXInstructionFormatter.hpp"
 | 
					#include "ZyDisInstructionFormatter.hpp"
 | 
				
			||||||
#include "VXDisassemblerUtils.hpp"
 | 
					#include "ZyDisDisassemblerUtils.hpp"
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include "VXOpcodeTable.hpp"
 | 
					#include "ZyDisOpcodeTable.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Verteron
 | 
					namespace Verteron
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -128,7 +128,7 @@ enum InstructionFlags : uint32_t
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent a cpu register.
 | 
					 * @brief   Values that represent a cpu register.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXRegister : uint16_t
 | 
					enum class ZyDisRegister : uint16_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NONE,
 | 
					    NONE,
 | 
				
			||||||
    /* 8 bit general purpose registers */
 | 
					    /* 8 bit general purpose registers */
 | 
				
			||||||
| 
						 | 
					@ -188,7 +188,7 @@ enum class VXRegister : uint16_t
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the type of a decoded operand.
 | 
					 * @brief   Values that represent the type of a decoded operand.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXOperandType : uint8_t
 | 
					enum class ZyDisOperandType : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The operand is not used.
 | 
					     * @brief   The operand is not used.
 | 
				
			||||||
| 
						 | 
					@ -223,7 +223,7 @@ enum class VXOperandType : uint8_t
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the operand access mode.
 | 
					 * @brief   Values that represent the operand access mode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXOperandAccessMode : uint8_t
 | 
					enum class ZyDisOperandAccessMode : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NA,
 | 
					    NA,
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -243,12 +243,12 @@ enum class VXOperandAccessMode : uint8_t
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   This struct holds information about a decoded operand.
 | 
					 * @brief   This struct holds information about a decoded operand.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct VXOperandInfo
 | 
					struct ZyDisOperandInfo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The type of the operand.
 | 
					     * @brief   The type of the operand.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXOperandType type;
 | 
					    ZyDisOperandType type;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The size of the operand.
 | 
					     * @brief   The size of the operand.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -256,15 +256,15 @@ struct VXOperandInfo
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The operand access mode.
 | 
					     * @brief   The operand access mode.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXOperandAccessMode access_mode;
 | 
					    ZyDisOperandAccessMode access_mode;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The base register.
 | 
					     * @brief   The base register.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXRegister base;
 | 
					    ZyDisRegister base;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The index register.
 | 
					     * @brief   The index register.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXRegister index;
 | 
					    ZyDisRegister index;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The scale factor.
 | 
					     * @brief   The scale factor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -300,7 +300,7 @@ struct VXOperandInfo
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   This struct holds information about a decoded instruction.
 | 
					 * @brief   This struct holds information about a decoded instruction.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct VXInstructionInfo
 | 
					struct ZyDisInstructionInfo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction flags.
 | 
					     * @brief   The instruction flags.
 | 
				
			||||||
| 
						 | 
					@ -309,7 +309,7 @@ struct VXInstructionInfo
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction mnemonic.
 | 
					     * @brief   The instruction mnemonic.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXInstructionMnemonic mnemonic;
 | 
					    ZyDisInstructionMnemonic mnemonic;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The total length of the instruction.
 | 
					     * @brief   The total length of the instruction.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -337,12 +337,12 @@ struct VXInstructionInfo
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The decoded operands.
 | 
					     * @brief   The decoded operands.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXOperandInfo operand[4];
 | 
					    ZyDisOperandInfo operand[4];
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The segment register. This value will default to @c NONE, if no segment register 
 | 
					     * @brief   The segment register. This value will default to @c NONE, if no segment register 
 | 
				
			||||||
     *          prefix is present.
 | 
					     *          prefix is present.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXRegister segment;
 | 
					    ZyDisRegister segment;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The rex prefix byte.
 | 
					     * @brief   The rex prefix byte.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -512,7 +512,7 @@ struct VXInstructionInfo
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction definition.
 | 
					     * @brief   The instruction definition.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    const VXInstructionDefinition *instrDefinition;
 | 
					    const ZyDisInstructionDefinition *instrDefinition;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction address points to the current instruction (relative to the 
 | 
					     * @brief   The instruction address points to the current instruction (relative to the 
 | 
				
			||||||
     *          initial instruction pointer).
 | 
					     *          initial instruction pointer).
 | 
				
			||||||
| 
						 | 
					@ -29,16 +29,16 @@
 | 
				
			||||||
 * SOFTWARE.
 | 
					 * SOFTWARE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
#include "VXDisassemblerUtils.hpp"
 | 
					#include "ZyDisDisassemblerUtils.hpp"
 | 
				
			||||||
#include <cassert>
 | 
					#include <cassert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Verteron
 | 
					namespace Verteron
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
uint64_t VDECalcAbsoluteTarget(const VXInstructionInfo &info, const VXOperandInfo &operand)
 | 
					uint64_t VDECalcAbsoluteTarget(const ZyDisInstructionInfo &info, const ZyDisOperandInfo &operand)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    assert((operand.type == VXOperandType::REL_IMMEDIATE) || 
 | 
					    assert((operand.type == ZyDisOperandType::REL_IMMEDIATE) || 
 | 
				
			||||||
        ((operand.type == VXOperandType::MEMORY) && (operand.base == VXRegister::RIP)));
 | 
					        ((operand.type == ZyDisOperandType::MEMORY) && (operand.base == ZyDisRegister::RIP)));
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    uint64_t truncMask = 0xFFFFFFFFFFFFFFFFull;
 | 
					    uint64_t truncMask = 0xFFFFFFFFFFFFFFFFull;
 | 
				
			||||||
    if (!(info.flags & IF_DISASSEMBLER_MODE_64)) 
 | 
					    if (!(info.flags & IF_DISASSEMBLER_MODE_64)) 
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,7 @@ uint64_t VDECalcAbsoluteTarget(const VXInstructionInfo &info, const VXOperandInf
 | 
				
			||||||
        truncMask >>= (64 - info.operand_mode);
 | 
					        truncMask >>= (64 - info.operand_mode);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    uint16_t size = operand.size;
 | 
					    uint16_t size = operand.size;
 | 
				
			||||||
    if ((operand.type == VXOperandType::MEMORY) && (operand.base == VXRegister::RIP))
 | 
					    if ((operand.type == ZyDisOperandType::MEMORY) && (operand.base == ZyDisRegister::RIP))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        size = operand.offset;
 | 
					        size = operand.offset;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include "VXDisassemblerTypes.hpp"
 | 
					#include "ZyDisDisassemblerTypes.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Verteron
 | 
					namespace Verteron
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -43,6 +43,6 @@ namespace Verteron
 | 
				
			||||||
 * @param   operand The operand.
 | 
					 * @param   operand The operand.
 | 
				
			||||||
 * @return  The absolute target address.
 | 
					 * @return  The absolute target address.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
uint64_t VDECalcAbsoluteTarget(const VXInstructionInfo &info, const VXOperandInfo &operand);
 | 
					uint64_t VDECalcAbsoluteTarget(const ZyDisInstructionInfo &info, const ZyDisOperandInfo &operand);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -33,7 +33,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <type_traits>
 | 
					#include <type_traits>
 | 
				
			||||||
#include <istream>
 | 
					#include <istream>
 | 
				
			||||||
#include "VXDisassemblerTypes.hpp"
 | 
					#include "ZyDisDisassemblerTypes.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Verteron
 | 
					namespace Verteron
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ namespace Verteron
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   The base class for all data-source implementations.
 | 
					 * @brief   The base class for all data-source implementations.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class VXBaseDataSource 
 | 
					class ZyDisBaseDataSource 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    uint8_t m_currentInput;
 | 
					    uint8_t m_currentInput;
 | 
				
			||||||
| 
						 | 
					@ -66,12 +66,12 @@ protected:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Default constructor.
 | 
					     * @brief   Default constructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXBaseDataSource() { };
 | 
					    ZyDisBaseDataSource() { };
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Destructor.
 | 
					     * @brief   Destructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    virtual ~VXBaseDataSource() { };
 | 
					    virtual ~ZyDisBaseDataSource() { };
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Reads the next byte from the data source. This method does NOT increase the 
 | 
					     * @brief   Reads the next byte from the data source. This method does NOT increase the 
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,7 @@ public:
 | 
				
			||||||
     *          @c flags field of the @c info parameter for error flags.
 | 
					     *          @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.
 | 
					     *          Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint8_t inputPeek(VXInstructionInfo &info);
 | 
					    uint8_t inputPeek(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Reads the next byte from the data source. This method increases the current
 | 
					     * @brief   Reads the next byte from the data source. This method increases the current
 | 
				
			||||||
     *          input position and the @c length field of the @c info parameter. 
 | 
					     *          input position and the @c length field of the @c info parameter. 
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,7 @@ public:
 | 
				
			||||||
     *          @c flags field of the @c info parameter for error flags.
 | 
					     *          @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.
 | 
					     *          Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint8_t inputNext(VXInstructionInfo &info);
 | 
					    uint8_t inputNext(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Reads the next byte(s) from the data source. This method increases the current
 | 
					     * @brief   Reads the next byte(s) from the data source. This method increases the current
 | 
				
			||||||
     *          input position and the @c length field of the @c info parameter. 
 | 
					     *          input position and the @c length field of the @c info parameter. 
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ public:
 | 
				
			||||||
     *          Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
					     *          Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    template <typename T>
 | 
					    template <typename T>
 | 
				
			||||||
    T inputNext(VXInstructionInfo &info);
 | 
					    T inputNext(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns the current input byte. The current input byte is set everytime the 
 | 
					     * @brief   Returns the current input byte. The current input byte is set everytime the 
 | 
				
			||||||
     *          @c inputPeek or @c inputNext method is called.
 | 
					     *          @c inputPeek or @c inputNext method is called.
 | 
				
			||||||
| 
						 | 
					@ -133,7 +133,7 @@ public:
 | 
				
			||||||
    virtual bool setPosition(uint64_t position) = 0;
 | 
					    virtual bool setPosition(uint64_t position) = 0;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXBaseDataSource::inputPeek(VXInstructionInfo &info)
 | 
					inline uint8_t ZyDisBaseDataSource::inputPeek(ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (info.length == 15)
 | 
					    if (info.length == 15)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -149,7 +149,7 @@ inline uint8_t VXBaseDataSource::inputPeek(VXInstructionInfo &info)
 | 
				
			||||||
    return m_currentInput;
 | 
					    return m_currentInput;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXBaseDataSource::inputNext(VXInstructionInfo &info)
 | 
					inline uint8_t ZyDisBaseDataSource::inputNext(ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (info.length == 15)
 | 
					    if (info.length == 15)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -168,7 +168,7 @@ inline uint8_t VXBaseDataSource::inputNext(VXInstructionInfo &info)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <typename T>
 | 
					template <typename T>
 | 
				
			||||||
inline T VXBaseDataSource::inputNext(VXInstructionInfo &info)
 | 
					inline T ZyDisBaseDataSource::inputNext(ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    static_assert(std::is_integral<T>::value, "integral type required");
 | 
					    static_assert(std::is_integral<T>::value, "integral type required");
 | 
				
			||||||
    T result = 0;
 | 
					    T result = 0;
 | 
				
			||||||
| 
						 | 
					@ -184,7 +184,7 @@ inline T VXBaseDataSource::inputNext(VXInstructionInfo &info)
 | 
				
			||||||
    return result;
 | 
					    return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXBaseDataSource::inputCurrent() const
 | 
					inline uint8_t ZyDisBaseDataSource::inputCurrent() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_currentInput;
 | 
					    return m_currentInput;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -192,9 +192,9 @@ inline uint8_t VXBaseDataSource::inputCurrent() const
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   A memory-buffer based data source for the @c VXInstructionDecoder class.
 | 
					 * @brief   A memory-buffer based data source for the @c ZyDisInstructionDecoder class.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class VXMemoryDataSource : public VXBaseDataSource
 | 
					class ZyDisMemoryDataSource : public ZyDisBaseDataSource
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    const void *m_inputBuffer;
 | 
					    const void *m_inputBuffer;
 | 
				
			||||||
| 
						 | 
					@ -219,7 +219,7 @@ public:
 | 
				
			||||||
     * @param   buffer      The input buffer.
 | 
					     * @param   buffer      The input buffer.
 | 
				
			||||||
     * @param   bufferLen   The length of the input buffer.
 | 
					     * @param   bufferLen   The length of the input buffer.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXMemoryDataSource(const void* buffer, size_t bufferLen)
 | 
					    ZyDisMemoryDataSource(const void* buffer, size_t bufferLen)
 | 
				
			||||||
        : m_inputBuffer(buffer)
 | 
					        : m_inputBuffer(buffer)
 | 
				
			||||||
        , m_inputBufferLen(bufferLen)
 | 
					        , m_inputBufferLen(bufferLen)
 | 
				
			||||||
        , m_inputBufferPos(0) { };
 | 
					        , m_inputBufferPos(0) { };
 | 
				
			||||||
| 
						 | 
					@ -242,28 +242,28 @@ public:
 | 
				
			||||||
    bool setPosition(uint64_t position) override;
 | 
					    bool setPosition(uint64_t position) override;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXMemoryDataSource::internalInputPeek()
 | 
					inline uint8_t ZyDisMemoryDataSource::internalInputPeek()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return *(static_cast<const uint8_t*>(m_inputBuffer) + m_inputBufferPos);
 | 
					    return *(static_cast<const uint8_t*>(m_inputBuffer) + m_inputBufferPos);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXMemoryDataSource::internalInputNext()
 | 
					inline uint8_t ZyDisMemoryDataSource::internalInputNext()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ++m_inputBufferPos;
 | 
					    ++m_inputBufferPos;
 | 
				
			||||||
    return *(static_cast<const uint8_t*>(m_inputBuffer) + m_inputBufferPos - 1);
 | 
					    return *(static_cast<const uint8_t*>(m_inputBuffer) + m_inputBufferPos - 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline bool VXMemoryDataSource::isEndOfInput() const
 | 
					inline bool ZyDisMemoryDataSource::isEndOfInput() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (m_inputBufferPos >= m_inputBufferLen);
 | 
					    return (m_inputBufferPos >= m_inputBufferLen);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint64_t VXMemoryDataSource::getPosition() const
 | 
					inline uint64_t ZyDisMemoryDataSource::getPosition() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_inputBufferPos;
 | 
					    return m_inputBufferPos;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline bool VXMemoryDataSource::setPosition(uint64_t position)
 | 
					inline bool ZyDisMemoryDataSource::setPosition(uint64_t position)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_inputBufferPos = position;
 | 
					    m_inputBufferPos = position;
 | 
				
			||||||
    return isEndOfInput();
 | 
					    return isEndOfInput();
 | 
				
			||||||
| 
						 | 
					@ -272,9 +272,9 @@ inline bool VXMemoryDataSource::setPosition(uint64_t position)
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   A stream based data source for the @c VXInstructionDecoder class.
 | 
					 * @brief   A stream based data source for the @c ZyDisInstructionDecoder class.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class VXStreamDataSource : public VXBaseDataSource
 | 
					class ZyDisStreamDataSource : public ZyDisBaseDataSource
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    std::istream *m_inputStream;
 | 
					    std::istream *m_inputStream;
 | 
				
			||||||
| 
						 | 
					@ -296,7 +296,7 @@ public:
 | 
				
			||||||
     * @brief   Constructor.
 | 
					     * @brief   Constructor.
 | 
				
			||||||
     * @param   stream  The input stream.
 | 
					     * @param   stream  The input stream.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    explicit VXStreamDataSource(std::istream *stream)
 | 
					    explicit ZyDisStreamDataSource(std::istream *stream)
 | 
				
			||||||
        : m_inputStream(stream) { };
 | 
					        : m_inputStream(stream) { };
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -317,7 +317,7 @@ public:
 | 
				
			||||||
    bool setPosition(uint64_t position) override;
 | 
					    bool setPosition(uint64_t position) override;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXStreamDataSource::internalInputPeek()
 | 
					inline uint8_t ZyDisStreamDataSource::internalInputPeek()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_inputStream)
 | 
					    if (!m_inputStream)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -326,7 +326,7 @@ inline uint8_t VXStreamDataSource::internalInputPeek()
 | 
				
			||||||
    return static_cast<uint8_t>(m_inputStream->peek());
 | 
					    return static_cast<uint8_t>(m_inputStream->peek());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXStreamDataSource::internalInputNext()
 | 
					inline uint8_t ZyDisStreamDataSource::internalInputNext()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_inputStream)
 | 
					    if (!m_inputStream)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -335,7 +335,7 @@ inline uint8_t VXStreamDataSource::internalInputNext()
 | 
				
			||||||
    return static_cast<uint8_t>(m_inputStream->get());
 | 
					    return static_cast<uint8_t>(m_inputStream->get());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline bool VXStreamDataSource::isEndOfInput() const
 | 
					inline bool ZyDisStreamDataSource::isEndOfInput() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_inputStream)
 | 
					    if (!m_inputStream)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -346,7 +346,7 @@ inline bool VXStreamDataSource::isEndOfInput() const
 | 
				
			||||||
    return !m_inputStream->good();
 | 
					    return !m_inputStream->good();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint64_t VXStreamDataSource::getPosition() const
 | 
					inline uint64_t ZyDisStreamDataSource::getPosition() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_inputStream)
 | 
					    if (!m_inputStream)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -355,7 +355,7 @@ inline uint64_t VXStreamDataSource::getPosition() const
 | 
				
			||||||
    return m_inputStream->tellg();
 | 
					    return m_inputStream->tellg();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline bool VXStreamDataSource::setPosition(uint64_t position)
 | 
					inline bool ZyDisStreamDataSource::setPosition(uint64_t position)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_inputStream)
 | 
					    if (!m_inputStream)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -370,7 +370,7 @@ inline bool VXStreamDataSource::setPosition(uint64_t position)
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent a disassembler mode.
 | 
					 * @brief   Values that represent a disassembler mode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXDisassemblerMode : uint8_t
 | 
					enum class ZyDisDisassemblerMode : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    M16BIT,
 | 
					    M16BIT,
 | 
				
			||||||
    M32BIT,
 | 
					    M32BIT,
 | 
				
			||||||
| 
						 | 
					@ -380,7 +380,7 @@ enum class VXDisassemblerMode : uint8_t
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent an instruction-set vendor.
 | 
					 * @brief   Values that represent an instruction-set vendor.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXInstructionSetVendor : uint8_t
 | 
					enum class ZyDisInstructionSetVendor : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ANY,
 | 
					    ANY,
 | 
				
			||||||
    INTEL,
 | 
					    INTEL,
 | 
				
			||||||
| 
						 | 
					@ -388,10 +388,10 @@ enum class VXInstructionSetVendor : uint8_t
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   The @c VXInstructionDecoder class decodes x86/x86-64 assembly instructions from a 
 | 
					 * @brief   The @c ZyDisInstructionDecoder class decodes x86/x86-64 assembly instructions from a 
 | 
				
			||||||
 *          given data source.
 | 
					 *          given data source.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class VXInstructionDecoder
 | 
					class ZyDisInstructionDecoder
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    enum class RegisterClass : uint8_t
 | 
					    enum class RegisterClass : uint8_t
 | 
				
			||||||
| 
						 | 
					@ -404,9 +404,9 @@ private:
 | 
				
			||||||
        XMM
 | 
					        XMM
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    VXBaseDataSource      *m_dataSource;
 | 
					    ZyDisBaseDataSource      *m_dataSource;
 | 
				
			||||||
    VXDisassemblerMode     m_disassemblerMode;
 | 
					    ZyDisDisassemblerMode     m_disassemblerMode;
 | 
				
			||||||
    VXInstructionSetVendor m_preferredVendor;
 | 
					    ZyDisInstructionSetVendor m_preferredVendor;
 | 
				
			||||||
    uint64_t               m_instructionPointer;
 | 
					    uint64_t               m_instructionPointer;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -417,7 +417,7 @@ private:
 | 
				
			||||||
     *          @c flags field of the @c info parameter for error flags.
 | 
					     *          @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.
 | 
					     *          Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint8_t inputPeek(VXInstructionInfo &info);
 | 
					    uint8_t inputPeek(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Reads the next byte from the data source. This method increases the current
 | 
					     * @brief   Reads the next byte from the data source. This method increases the current
 | 
				
			||||||
     *          input position and the @c length field of the @info parameter. 
 | 
					     *          input position and the @c length field of the @info parameter. 
 | 
				
			||||||
| 
						 | 
					@ -428,7 +428,7 @@ private:
 | 
				
			||||||
     *          @c flags field of the @c info parameter for error flags.
 | 
					     *          @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.
 | 
					     *          Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint8_t inputNext(VXInstructionInfo &info);
 | 
					    uint8_t inputNext(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Reads the next byte(s) from the data source. This method increases the current
 | 
					     * @brief   Reads the next byte(s) from the data source. This method increases the current
 | 
				
			||||||
     *          input position and the @c length field of the @info parameter. 
 | 
					     *          input position and the @c length field of the @info parameter. 
 | 
				
			||||||
| 
						 | 
					@ -440,7 +440,7 @@ private:
 | 
				
			||||||
     *          Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
					     *          Possible error values are @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    template <typename T>
 | 
					    template <typename T>
 | 
				
			||||||
    T inputNext(VXInstructionInfo &info);
 | 
					    T inputNext(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns the current input byte. The current input byte is set everytime the 
 | 
					     * @brief   Returns the current input byte. The current input byte is set everytime the 
 | 
				
			||||||
     *          @c inputPeek or @c inputNext method is called.
 | 
					     *          @c inputPeek or @c inputNext method is called.
 | 
				
			||||||
| 
						 | 
					@ -451,64 +451,64 @@ private:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes a register operand.
 | 
					     * @brief   Decodes a register operand.
 | 
				
			||||||
     * @param   info            The instruction info.
 | 
					     * @param   info            The instruction info.
 | 
				
			||||||
     * @param   operand         The @c VXOperandInfo struct that receives the decoded data.
 | 
					     * @param   operand         The @c ZyDisOperandInfo struct that receives the decoded data.
 | 
				
			||||||
     * @param   registerClass   The register class to use.
 | 
					     * @param   registerClass   The register class to use.
 | 
				
			||||||
     * @param   registerId      The register id.
 | 
					     * @param   registerId      The register id.
 | 
				
			||||||
     * @param   operandSize     The defined size of the operand.
 | 
					     * @param   operandSize     The defined size of the operand.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeRegisterOperand(VXInstructionInfo &info, VXOperandInfo &operand, 
 | 
					    bool decodeRegisterOperand(ZyDisInstructionInfo &info, ZyDisOperandInfo &operand, 
 | 
				
			||||||
        RegisterClass registerClass, uint8_t registerId, VXDefinedOperandSize operandSize) const;
 | 
					        RegisterClass registerClass, uint8_t registerId, ZyDisDefinedOperandSize operandSize) const;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes a register/memory operand.
 | 
					     * @brief   Decodes a register/memory operand.
 | 
				
			||||||
     * @param   info            The instruction info.
 | 
					     * @param   info            The instruction info.
 | 
				
			||||||
     * @param   operand         The @c VXOperandInfo struct that receives the decoded data.
 | 
					     * @param   operand         The @c ZyDisOperandInfo struct that receives the decoded data.
 | 
				
			||||||
     * @param   registerClass   The register class to use.
 | 
					     * @param   registerClass   The register class to use.
 | 
				
			||||||
     * @param   operandSize     The defined size of the operand.
 | 
					     * @param   operandSize     The defined size of the operand.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeRegisterMemoryOperand(VXInstructionInfo &info, VXOperandInfo &operand,
 | 
					    bool decodeRegisterMemoryOperand(ZyDisInstructionInfo &info, ZyDisOperandInfo &operand,
 | 
				
			||||||
        RegisterClass registerClass, VXDefinedOperandSize operandSize);
 | 
					        RegisterClass registerClass, ZyDisDefinedOperandSize operandSize);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes an immediate operand.
 | 
					     * @brief   Decodes an immediate operand.
 | 
				
			||||||
     * @param   info        The instruction info.
 | 
					     * @param   info        The instruction info.
 | 
				
			||||||
     * @param   operand     The @c VXOperandInfo struct that receives the decoded data.
 | 
					     * @param   operand     The @c ZyDisOperandInfo struct that receives the decoded data.
 | 
				
			||||||
     * @param   operandSize The defined size of the operand.
 | 
					     * @param   operandSize The defined size of the operand.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeImmediate(VXInstructionInfo &info, VXOperandInfo &operand, 
 | 
					    bool decodeImmediate(ZyDisInstructionInfo &info, ZyDisOperandInfo &operand, 
 | 
				
			||||||
        VXDefinedOperandSize operandSize);
 | 
					        ZyDisDefinedOperandSize operandSize);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes a displacement operand.
 | 
					     * @brief   Decodes a displacement operand.
 | 
				
			||||||
     * @param   info    The instruction info.
 | 
					     * @param   info    The instruction info.
 | 
				
			||||||
     * @param   operand The @c VXOperandInfo struct that receives the decoded data.
 | 
					     * @param   operand The @c ZyDisOperandInfo struct that receives the decoded data.
 | 
				
			||||||
     * @param   size    The size of the displacement data.
 | 
					     * @param   size    The size of the displacement data.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeDisplacement(VXInstructionInfo &info, VXOperandInfo &operand, uint8_t size);
 | 
					    bool decodeDisplacement(ZyDisInstructionInfo &info, ZyDisOperandInfo &operand, uint8_t size);
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes the modrm field of the instruction. This method reads an additional 
 | 
					     * @brief   Decodes the modrm field of the instruction. This method reads an additional 
 | 
				
			||||||
     *          input byte.
 | 
					     *          input byte.
 | 
				
			||||||
     * @param   The @c VXInstructionInfo struct that receives the decoded data.
 | 
					     * @param   The @c ZyDisInstructionInfo struct that receives the decoded data.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeModrm(VXInstructionInfo &info);
 | 
					    bool decodeModrm(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes the sib field of the instruction. This method reads an additional 
 | 
					     * @brief   Decodes the sib field of the instruction. This method reads an additional 
 | 
				
			||||||
     *          input byte.
 | 
					     *          input byte.
 | 
				
			||||||
     * @param   info    The @c VXInstructionInfo struct that receives the decoded data.
 | 
					     * @param   info    The @c ZyDisInstructionInfo struct that receives the decoded data.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeSIB(VXInstructionInfo &info);
 | 
					    bool decodeSIB(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes vex prefix of the instruction. This method takes the current input byte
 | 
					     * @brief   Decodes vex prefix of the instruction. This method takes the current input byte
 | 
				
			||||||
     *          to determine the vex prefix type and reads one or two additional input bytes
 | 
					     *          to determine the vex prefix type and reads one or two additional input bytes
 | 
				
			||||||
     *          on demand.
 | 
					     *          on demand.
 | 
				
			||||||
     * @param   info    The @c VXInstructionInfo struct that receives the decoded data.
 | 
					     * @param   info    The @c ZyDisInstructionInfo struct that receives the decoded data.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeVex(VXInstructionInfo &info);
 | 
					    bool decodeVex(ZyDisInstructionInfo &info);
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns the effective operand size.
 | 
					     * @brief   Returns the effective operand size.
 | 
				
			||||||
| 
						 | 
					@ -516,59 +516,59 @@ private:
 | 
				
			||||||
     * @param   operandSize The defined operand size.
 | 
					     * @param   operandSize The defined operand size.
 | 
				
			||||||
     * @return  The effective operand size.
 | 
					     * @return  The effective operand size.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint16_t getEffectiveOperandSize(const VXInstructionInfo &info, 
 | 
					    uint16_t getEffectiveOperandSize(const ZyDisInstructionInfo &info, 
 | 
				
			||||||
        VXDefinedOperandSize operandSize) const;
 | 
					        ZyDisDefinedOperandSize operandSize) const;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes all instruction operands.
 | 
					     * @brief   Decodes all instruction operands.
 | 
				
			||||||
     * @param   info    The @c VXInstructionInfo struct that receives the decoded data.
 | 
					     * @param   info    The @c ZyDisInstructionInfo struct that receives the decoded data.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeOperands(VXInstructionInfo &info);
 | 
					    bool decodeOperands(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes the specified instruction operand.
 | 
					     * @brief   Decodes the specified instruction operand.
 | 
				
			||||||
     * @param   info        The instruction info.
 | 
					     * @param   info        The instruction info.
 | 
				
			||||||
     * @param   operand     The @c VXOperandInfo struct that receives the decoded data.
 | 
					     * @param   operand     The @c ZyDisOperandInfo struct that receives the decoded data.
 | 
				
			||||||
     * @param   operandType The defined type of the operand.
 | 
					     * @param   operandType The defined type of the operand.
 | 
				
			||||||
     * @param   operandSize The defined size of the operand.
 | 
					     * @param   operandSize The defined size of the operand.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeOperand(VXInstructionInfo &info, VXOperandInfo &operand, 
 | 
					    bool decodeOperand(ZyDisInstructionInfo &info, ZyDisOperandInfo &operand, 
 | 
				
			||||||
        VXDefinedOperandType operandType, VXDefinedOperandSize operandSize);
 | 
					        ZyDisDefinedOperandType operandType, ZyDisDefinedOperandSize operandSize);
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Resolves the effective operand and address mode of the instruction.
 | 
					     * @brief   Resolves the effective operand and address mode of the instruction.
 | 
				
			||||||
     *          This method requires a non-null value in the @c instrDefinition field of the 
 | 
					     *          This method requires a non-null value in the @c instrDefinition field of the 
 | 
				
			||||||
     *          @c info struct.
 | 
					     *          @c info struct.
 | 
				
			||||||
     * @param   info    The @c VXInstructionInfo struct that receives the effective operand and
 | 
					     * @param   info    The @c ZyDisInstructionInfo struct that receives the effective operand and
 | 
				
			||||||
     *                  address mode.
 | 
					     *                  address mode.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void resolveOperandAndAddressMode(VXInstructionInfo &info) const;
 | 
					    void resolveOperandAndAddressMode(ZyDisInstructionInfo &info) const;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Calculates the effective REX/VEX.w, r, x, b, l values.
 | 
					     * @brief   Calculates the effective REX/VEX.w, r, x, b, l values.
 | 
				
			||||||
     *          This method requires a non-null value in the @c instrDefinition field of the 
 | 
					     *          This method requires a non-null value in the @c instrDefinition field of the 
 | 
				
			||||||
     *          @c info struct.
 | 
					     *          @c info struct.
 | 
				
			||||||
     * @param   info    The @c VXInstructionInfo struct that receives the effective operand and
 | 
					     * @param   info    The @c ZyDisInstructionInfo struct that receives the effective operand and
 | 
				
			||||||
     *                  address mode.
 | 
					     *                  address mode.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void calculateEffectiveRexVexValues(VXInstructionInfo &info) const;
 | 
					    void calculateEffectiveRexVexValues(ZyDisInstructionInfo &info) const;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Collects and decodes optional instruction prefixes.
 | 
					     * @brief   Collects and decodes optional instruction prefixes.
 | 
				
			||||||
     * @param   info    The @c VXInstructionInfo struct that receives the decoded data.
 | 
					     * @param   info    The @c ZyDisInstructionInfo struct that receives the decoded data.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodePrefixes(VXInstructionInfo &info);
 | 
					    bool decodePrefixes(ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Collects and decodes the instruction opcodes using the opcode tree.
 | 
					     * @brief   Collects and decodes the instruction opcodes using the opcode tree.
 | 
				
			||||||
     * @param   info    The @c VXInstructionInfo struct that receives the decoded data.
 | 
					     * @param   info    The @c ZyDisInstructionInfo struct that receives the decoded data.
 | 
				
			||||||
     * @return  True if it succeeds, false if it fails.
 | 
					     * @return  True if it succeeds, false if it fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeOpcode(VXInstructionInfo &info);
 | 
					    bool decodeOpcode(ZyDisInstructionInfo &info);
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Default constructor.
 | 
					     * @brief   Default constructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXInstructionDecoder();
 | 
					    ZyDisInstructionDecoder();
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Constructor.
 | 
					     * @brief   Constructor.
 | 
				
			||||||
     * @param   input               A reference to the input data source.
 | 
					     * @param   input               A reference to the input data source.
 | 
				
			||||||
| 
						 | 
					@ -576,51 +576,51 @@ public:
 | 
				
			||||||
     * @param   preferredVendor     The preferred instruction-set vendor.
 | 
					     * @param   preferredVendor     The preferred instruction-set vendor.
 | 
				
			||||||
     * @param   instructionPointer  The initial instruction pointer.                            
 | 
					     * @param   instructionPointer  The initial instruction pointer.                            
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    explicit VXInstructionDecoder(VXBaseDataSource *input, 
 | 
					    explicit ZyDisInstructionDecoder(ZyDisBaseDataSource *input, 
 | 
				
			||||||
        VXDisassemblerMode disassemblerMode = VXDisassemblerMode::M32BIT,
 | 
					        ZyDisDisassemblerMode disassemblerMode = ZyDisDisassemblerMode::M32BIT,
 | 
				
			||||||
        VXInstructionSetVendor preferredVendor = VXInstructionSetVendor::ANY, 
 | 
					        ZyDisInstructionSetVendor preferredVendor = ZyDisInstructionSetVendor::ANY, 
 | 
				
			||||||
        uint64_t instructionPointer = 0);
 | 
					        uint64_t instructionPointer = 0);
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Decodes the next instruction from the input data source.
 | 
					     * @brief   Decodes the next instruction from the input data source.
 | 
				
			||||||
     * @param   info    The @c VXInstructionInfo struct that receives the information about the
 | 
					     * @param   info    The @c ZyDisInstructionInfo struct that receives the information about the
 | 
				
			||||||
     *                  decoded instruction.
 | 
					     *                  decoded instruction.
 | 
				
			||||||
     * @return  This method returns false, if the current position has exceeded the maximum input 
 | 
					     * @return  This method returns false, if the current position has exceeded the maximum input 
 | 
				
			||||||
     *          length.
 | 
					     *          length.
 | 
				
			||||||
     *          In all other cases (valid and invalid instructions) the return value is true.
 | 
					     *          In all other cases (valid and invalid instructions) the return value is true.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    bool decodeInstruction(VXInstructionInfo &info);
 | 
					    bool decodeInstruction(ZyDisInstructionInfo &info);
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns a pointer to the current data source.
 | 
					     * @brief   Returns a pointer to the current data source.
 | 
				
			||||||
     * @return  A pointer to the current data source.
 | 
					     * @return  A pointer to the current data source.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXBaseDataSource* getDataSource() const;
 | 
					    ZyDisBaseDataSource* getDataSource() const;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Sets a new data source.
 | 
					     * @brief   Sets a new data source.
 | 
				
			||||||
     * @param   input   A reference to the new input data source.
 | 
					     * @param   input   A reference to the new input data source.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void setDataSource(VXBaseDataSource *input);
 | 
					    void setDataSource(ZyDisBaseDataSource *input);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns the current disassembler mode.
 | 
					     * @brief   Returns the current disassembler mode.
 | 
				
			||||||
     * @return  The current disassembler mode.
 | 
					     * @return  The current disassembler mode.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXDisassemblerMode getDisassemblerMode() const;
 | 
					    ZyDisDisassemblerMode getDisassemblerMode() const;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Sets the current disassembler mode.
 | 
					     * @brief   Sets the current disassembler mode.
 | 
				
			||||||
     * @param   disassemblerMode    The new disassembler mode.
 | 
					     * @param   disassemblerMode    The new disassembler mode.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void setDisassemblerMode(VXDisassemblerMode disassemblerMode);
 | 
					    void setDisassemblerMode(ZyDisDisassemblerMode disassemblerMode);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns the preferred instruction-set vendor.
 | 
					     * @brief   Returns the preferred instruction-set vendor.
 | 
				
			||||||
     * @return  The preferred instruction-set vendor.
 | 
					     * @return  The preferred instruction-set vendor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXInstructionSetVendor getPreferredVendor() const;
 | 
					    ZyDisInstructionSetVendor getPreferredVendor() const;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Sets the preferred instruction-set vendor.
 | 
					     * @brief   Sets the preferred instruction-set vendor.
 | 
				
			||||||
     * @param   preferredVendor The new preferred instruction-set vendor.
 | 
					     * @param   preferredVendor The new preferred instruction-set vendor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void setPreferredVendor(VXInstructionSetVendor preferredVendor);
 | 
					    void setPreferredVendor(ZyDisInstructionSetVendor preferredVendor);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns the current instruction pointer.
 | 
					     * @brief   Returns the current instruction pointer.
 | 
				
			||||||
     * @return  The current instruction pointer.
 | 
					     * @return  The current instruction pointer.
 | 
				
			||||||
| 
						 | 
					@ -633,7 +633,7 @@ public:
 | 
				
			||||||
    void setInstructionPointer(uint64_t instructionPointer);
 | 
					    void setInstructionPointer(uint64_t instructionPointer);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXInstructionDecoder::inputPeek(VXInstructionInfo &info)
 | 
					inline uint8_t ZyDisInstructionDecoder::inputPeek(ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_dataSource)
 | 
					    if (!m_dataSource)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -643,7 +643,7 @@ inline uint8_t VXInstructionDecoder::inputPeek(VXInstructionInfo &info)
 | 
				
			||||||
    return m_dataSource->inputPeek(info);
 | 
					    return m_dataSource->inputPeek(info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXInstructionDecoder::inputNext(VXInstructionInfo &info)
 | 
					inline uint8_t ZyDisInstructionDecoder::inputNext(ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_dataSource)
 | 
					    if (!m_dataSource)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -654,7 +654,7 @@ inline uint8_t VXInstructionDecoder::inputNext(VXInstructionInfo &info)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <typename T>
 | 
					template <typename T>
 | 
				
			||||||
inline T VXInstructionDecoder::inputNext(VXInstructionInfo &info)
 | 
					inline T ZyDisInstructionDecoder::inputNext(ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_dataSource)
 | 
					    if (!m_dataSource)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -664,7 +664,7 @@ inline T VXInstructionDecoder::inputNext(VXInstructionInfo &info)
 | 
				
			||||||
    return m_dataSource->inputNext<T>(info);
 | 
					    return m_dataSource->inputNext<T>(info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint8_t VXInstructionDecoder::inputCurrent() const
 | 
					inline uint8_t ZyDisInstructionDecoder::inputCurrent() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!m_dataSource)
 | 
					    if (!m_dataSource)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -673,42 +673,42 @@ inline uint8_t VXInstructionDecoder::inputCurrent() const
 | 
				
			||||||
    return m_dataSource->inputCurrent();
 | 
					    return m_dataSource->inputCurrent();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline VXBaseDataSource* VXInstructionDecoder::getDataSource() const
 | 
					inline ZyDisBaseDataSource* ZyDisInstructionDecoder::getDataSource() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_dataSource;
 | 
					    return m_dataSource;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline void VXInstructionDecoder::setDataSource(VXBaseDataSource *input)
 | 
					inline void ZyDisInstructionDecoder::setDataSource(ZyDisBaseDataSource *input)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_dataSource = input;
 | 
					    m_dataSource = input;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline VXDisassemblerMode VXInstructionDecoder::getDisassemblerMode() const
 | 
					inline ZyDisDisassemblerMode ZyDisInstructionDecoder::getDisassemblerMode() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_disassemblerMode;
 | 
					    return m_disassemblerMode;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline void VXInstructionDecoder::setDisassemblerMode(VXDisassemblerMode disassemblerMode)
 | 
					inline void ZyDisInstructionDecoder::setDisassemblerMode(ZyDisDisassemblerMode disassemblerMode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_disassemblerMode = disassemblerMode;
 | 
					    m_disassemblerMode = disassemblerMode;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline VXInstructionSetVendor VXInstructionDecoder::getPreferredVendor() const
 | 
					inline ZyDisInstructionSetVendor ZyDisInstructionDecoder::getPreferredVendor() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_preferredVendor;
 | 
					    return m_preferredVendor;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline void VXInstructionDecoder::setPreferredVendor(VXInstructionSetVendor preferredVendor)
 | 
					inline void ZyDisInstructionDecoder::setPreferredVendor(ZyDisInstructionSetVendor preferredVendor)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_preferredVendor = preferredVendor;
 | 
					    m_preferredVendor = preferredVendor;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline uint64_t VXInstructionDecoder::getInstructionPointer() const
 | 
					inline uint64_t ZyDisInstructionDecoder::getInstructionPointer() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_instructionPointer;
 | 
					    return m_instructionPointer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline void VXInstructionDecoder::setInstructionPointer(uint64_t instructionPointer)
 | 
					inline void ZyDisInstructionDecoder::setInstructionPointer(uint64_t instructionPointer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_instructionPointer = instructionPointer;
 | 
					    m_instructionPointer = instructionPointer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -29,8 +29,8 @@
 | 
				
			||||||
 * SOFTWARE.
 | 
					 * SOFTWARE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
#include "VXInstructionFormatter.hpp"
 | 
					#include "ZyDisInstructionFormatter.hpp"
 | 
				
			||||||
#include "VXDisassemblerUtils.hpp"
 | 
					#include "ZyDisDisassemblerUtils.hpp"
 | 
				
			||||||
#include <cstdarg>
 | 
					#include <cstdarg>
 | 
				
			||||||
#include <cctype>
 | 
					#include <cctype>
 | 
				
			||||||
#include <cstring>
 | 
					#include <cstring>
 | 
				
			||||||
| 
						 | 
					@ -42,12 +42,12 @@ namespace Verteron
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VXBaseSymbolResolver::~VXBaseSymbolResolver()
 | 
					ZyDisBaseSymbolResolver::~ZyDisBaseSymbolResolver()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* VXBaseSymbolResolver::resolveSymbol(const VXInstructionInfo &info, uint64_t address, 
 | 
					const char* ZyDisBaseSymbolResolver::resolveSymbol(const ZyDisInstructionInfo &info, uint64_t address, 
 | 
				
			||||||
    uint64_t &offset)
 | 
					    uint64_t &offset)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return nullptr;
 | 
					    return nullptr;
 | 
				
			||||||
| 
						 | 
					@ -55,7 +55,7 @@ const char* VXBaseSymbolResolver::resolveSymbol(const VXInstructionInfo &info, u
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* VXBaseInstructionFormatter::m_registerStrings[] =
 | 
					const char* ZyDisBaseInstructionFormatter::m_registerStrings[] =
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* 8 bit general purpose registers */
 | 
					    /* 8 bit general purpose registers */
 | 
				
			||||||
    "al",       "cl",       "dl",       "bl",
 | 
					    "al",       "cl",       "dl",       "bl",
 | 
				
			||||||
| 
						 | 
					@ -111,12 +111,12 @@ const char* VXBaseInstructionFormatter::m_registerStrings[] =
 | 
				
			||||||
    "rip"
 | 
					    "rip"
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXBaseInstructionFormatter::internalFormatInstruction(const VXInstructionInfo &info)
 | 
					void ZyDisBaseInstructionFormatter::internalFormatInstruction(const ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // Nothing to do here
 | 
					    // Nothing to do here
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VXBaseInstructionFormatter::VXBaseInstructionFormatter()
 | 
					ZyDisBaseInstructionFormatter::ZyDisBaseInstructionFormatter()
 | 
				
			||||||
    : m_symbolResolver(nullptr)
 | 
					    : m_symbolResolver(nullptr)
 | 
				
			||||||
    , m_outputStringLen(0)
 | 
					    , m_outputStringLen(0)
 | 
				
			||||||
    , m_outputUppercase(false)
 | 
					    , m_outputUppercase(false)
 | 
				
			||||||
| 
						 | 
					@ -124,7 +124,7 @@ VXBaseInstructionFormatter::VXBaseInstructionFormatter()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VXBaseInstructionFormatter::VXBaseInstructionFormatter(VXBaseSymbolResolver *symbolResolver)
 | 
					ZyDisBaseInstructionFormatter::ZyDisBaseInstructionFormatter(ZyDisBaseSymbolResolver *symbolResolver)
 | 
				
			||||||
    : m_symbolResolver(symbolResolver)
 | 
					    : m_symbolResolver(symbolResolver)
 | 
				
			||||||
    , m_outputStringLen(0)
 | 
					    , m_outputStringLen(0)
 | 
				
			||||||
    , m_outputUppercase(false)
 | 
					    , m_outputUppercase(false)
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ VXBaseInstructionFormatter::VXBaseInstructionFormatter(VXBaseSymbolResolver *sym
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* VXBaseInstructionFormatter::formatInstruction(const VXInstructionInfo &info)
 | 
					const char* ZyDisBaseInstructionFormatter::formatInstruction(const ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // Clears the internal string buffer
 | 
					    // Clears the internal string buffer
 | 
				
			||||||
    outputClear();
 | 
					    outputClear();
 | 
				
			||||||
| 
						 | 
					@ -147,22 +147,22 @@ const char* VXBaseInstructionFormatter::formatInstruction(const VXInstructionInf
 | 
				
			||||||
    return outputString();
 | 
					    return outputString();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VXBaseInstructionFormatter::~VXBaseInstructionFormatter()
 | 
					ZyDisBaseInstructionFormatter::~ZyDisBaseInstructionFormatter()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXBaseInstructionFormatter::outputClear()
 | 
					void ZyDisBaseInstructionFormatter::outputClear()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_outputStringLen = 0;
 | 
					    m_outputStringLen = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char const* VXBaseInstructionFormatter::outputString()
 | 
					char const* ZyDisBaseInstructionFormatter::outputString()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return &m_outputBuffer[0];
 | 
					    return &m_outputBuffer[0];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 void VXBaseInstructionFormatter::outputAppend(char const *text)
 | 
					 void ZyDisBaseInstructionFormatter::outputAppend(char const *text)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
    // Get the string length including the null-terminator char
 | 
					    // Get the string length including the null-terminator char
 | 
				
			||||||
    size_t strLen = strlen(text) + 1;
 | 
					    size_t strLen = strlen(text) + 1;
 | 
				
			||||||
| 
						 | 
					@ -191,7 +191,7 @@ char const* VXBaseInstructionFormatter::outputString()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 }
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 void VXBaseInstructionFormatter::outputAppendFormatted(char const *format, ...)
 | 
					 void ZyDisBaseInstructionFormatter::outputAppendFormatted(char const *format, ...)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
    va_list arguments;
 | 
					    va_list arguments;
 | 
				
			||||||
    va_start(arguments, format);
 | 
					    va_start(arguments, format);
 | 
				
			||||||
| 
						 | 
					@ -233,7 +233,7 @@ char const* VXBaseInstructionFormatter::outputString()
 | 
				
			||||||
    va_end(arguments);
 | 
					    va_end(arguments);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXBaseInstructionFormatter::outputAppendAddress(const VXInstructionInfo &info, 
 | 
					void ZyDisBaseInstructionFormatter::outputAppendAddress(const ZyDisInstructionInfo &info, 
 | 
				
			||||||
    uint64_t address, bool resolveSymbols)
 | 
					    uint64_t address, bool resolveSymbols)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    uint64_t offset = 0;
 | 
					    uint64_t offset = 0;
 | 
				
			||||||
| 
						 | 
					@ -269,10 +269,10 @@ void VXBaseInstructionFormatter::outputAppendAddress(const VXInstructionInfo &in
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXBaseInstructionFormatter::outputAppendImmediate(const VXInstructionInfo &info, 
 | 
					void ZyDisBaseInstructionFormatter::outputAppendImmediate(const ZyDisInstructionInfo &info, 
 | 
				
			||||||
    const VXOperandInfo &operand, bool resolveSymbols)
 | 
					    const ZyDisOperandInfo &operand, bool resolveSymbols)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    assert(operand.type == VXOperandType::IMMEDIATE);
 | 
					    assert(operand.type == ZyDisOperandType::IMMEDIATE);
 | 
				
			||||||
    uint64_t value = 0;
 | 
					    uint64_t value = 0;
 | 
				
			||||||
    if (operand.signed_lval && (operand.size != info.operand_mode)) 
 | 
					    if (operand.signed_lval && (operand.size != info.operand_mode)) 
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -329,11 +329,11 @@ void VXBaseInstructionFormatter::outputAppendImmediate(const VXInstructionInfo &
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXBaseInstructionFormatter::outputAppendDisplacement(const VXInstructionInfo &info, 
 | 
					void ZyDisBaseInstructionFormatter::outputAppendDisplacement(const ZyDisInstructionInfo &info, 
 | 
				
			||||||
    const VXOperandInfo &operand)
 | 
					    const ZyDisOperandInfo &operand)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    assert(operand.offset > 0);
 | 
					    assert(operand.offset > 0);
 | 
				
			||||||
    if ((operand.base == VXRegister::NONE) && (operand.index == VXRegister::NONE))
 | 
					    if ((operand.base == ZyDisRegister::NONE) && (operand.index == ZyDisRegister::NONE))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // Assume the displacement value is unsigned
 | 
					        // Assume the displacement value is unsigned
 | 
				
			||||||
        assert(operand.scale == 0);
 | 
					        assert(operand.scale == 0);
 | 
				
			||||||
| 
						 | 
					@ -378,16 +378,16 @@ void VXBaseInstructionFormatter::outputAppendDisplacement(const VXInstructionInf
 | 
				
			||||||
            outputAppendFormatted("-%.2lX", -value);
 | 
					            outputAppendFormatted("-%.2lX", -value);
 | 
				
			||||||
        } else
 | 
					        } else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            outputAppendFormatted("%s%.2lX", (operand.base != VXRegister::NONE || 
 | 
					            outputAppendFormatted("%s%.2lX", (operand.base != ZyDisRegister::NONE || 
 | 
				
			||||||
                operand.index != VXRegister::NONE) ? "+" : "", value);
 | 
					                operand.index != ZyDisRegister::NONE) ? "+" : "", value);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXIntelInstructionFormatter::outputAppendOperandCast(const VXInstructionInfo &info, 
 | 
					void ZyDisIntelInstructionFormatter::outputAppendOperandCast(const ZyDisInstructionInfo &info, 
 | 
				
			||||||
    const VXOperandInfo &operand)
 | 
					    const ZyDisOperandInfo &operand)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    switch(operand.size) 
 | 
					    switch(operand.size) 
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -417,33 +417,33 @@ void VXIntelInstructionFormatter::outputAppendOperandCast(const VXInstructionInf
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXIntelInstructionFormatter::formatOperand(const VXInstructionInfo &info, 
 | 
					void ZyDisIntelInstructionFormatter::formatOperand(const ZyDisInstructionInfo &info, 
 | 
				
			||||||
    const VXOperandInfo &operand)
 | 
					    const ZyDisOperandInfo &operand)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    switch (operand.type)
 | 
					    switch (operand.type)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    case VXOperandType::REGISTER: 
 | 
					    case ZyDisOperandType::REGISTER: 
 | 
				
			||||||
        outputAppend(registerToString(operand.base));
 | 
					        outputAppend(registerToString(operand.base));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case VXOperandType::MEMORY: 
 | 
					    case ZyDisOperandType::MEMORY: 
 | 
				
			||||||
        if (info.flags & IF_PREFIX_SEGMENT)
 | 
					        if (info.flags & IF_PREFIX_SEGMENT)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            outputAppendFormatted("%s:", registerToString(info.segment));    
 | 
					            outputAppendFormatted("%s:", registerToString(info.segment));    
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        outputAppend("[");
 | 
					        outputAppend("[");
 | 
				
			||||||
        if (operand.base == VXRegister::RIP)
 | 
					        if (operand.base == ZyDisRegister::RIP)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // TODO: Add option
 | 
					            // TODO: Add option
 | 
				
			||||||
            outputAppendAddress(info, VDECalcAbsoluteTarget(info, operand), true);   
 | 
					            outputAppendAddress(info, VDECalcAbsoluteTarget(info, operand), true);   
 | 
				
			||||||
        } else
 | 
					        } else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (operand.base != VXRegister::NONE)
 | 
					            if (operand.base != ZyDisRegister::NONE)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                outputAppend(registerToString(operand.base)); 
 | 
					                outputAppend(registerToString(operand.base)); 
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (operand.index != VXRegister::NONE) 
 | 
					            if (operand.index != ZyDisRegister::NONE) 
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                outputAppendFormatted("%s%s", operand.base != VXRegister::NONE ? "+" : "",
 | 
					                outputAppendFormatted("%s%s", operand.base != ZyDisRegister::NONE ? "+" : "",
 | 
				
			||||||
                    registerToString(operand.index));
 | 
					                    registerToString(operand.index));
 | 
				
			||||||
                if (operand.scale) 
 | 
					                if (operand.scale) 
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -457,7 +457,7 @@ void VXIntelInstructionFormatter::formatOperand(const VXInstructionInfo &info,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        outputAppend("]");
 | 
					        outputAppend("]");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case VXOperandType::POINTER:
 | 
					    case ZyDisOperandType::POINTER:
 | 
				
			||||||
        // TODO: resolve symbols
 | 
					        // TODO: resolve symbols
 | 
				
			||||||
        switch (operand.size)
 | 
					        switch (operand.size)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -472,12 +472,12 @@ void VXIntelInstructionFormatter::formatOperand(const VXInstructionInfo &info,
 | 
				
			||||||
            assert(0);
 | 
					            assert(0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case VXOperandType::IMMEDIATE: 
 | 
					    case ZyDisOperandType::IMMEDIATE: 
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            outputAppendImmediate(info, operand, true);
 | 
					            outputAppendImmediate(info, operand, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case VXOperandType::REL_IMMEDIATE: 
 | 
					    case ZyDisOperandType::REL_IMMEDIATE: 
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (operand.size == 8)
 | 
					            if (operand.size == 8)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -486,7 +486,7 @@ void VXIntelInstructionFormatter::formatOperand(const VXInstructionInfo &info,
 | 
				
			||||||
            outputAppendAddress(info, VDECalcAbsoluteTarget(info, operand), true);
 | 
					            outputAppendAddress(info, VDECalcAbsoluteTarget(info, operand), true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case VXOperandType::CONSTANT: 
 | 
					    case ZyDisOperandType::CONSTANT: 
 | 
				
			||||||
        outputAppendFormatted("%.2X", operand.lval.udword);
 | 
					        outputAppendFormatted("%.2X", operand.lval.udword);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    default: 
 | 
					    default: 
 | 
				
			||||||
| 
						 | 
					@ -495,7 +495,7 @@ void VXIntelInstructionFormatter::formatOperand(const VXInstructionInfo &info,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXIntelInstructionFormatter::internalFormatInstruction(const VXInstructionInfo &info)
 | 
					void ZyDisIntelInstructionFormatter::internalFormatInstruction(const ZyDisInstructionInfo &info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // Append string prefixes
 | 
					    // Append string prefixes
 | 
				
			||||||
    if (info.flags & IF_PREFIX_LOCK)
 | 
					    if (info.flags & IF_PREFIX_LOCK)
 | 
				
			||||||
| 
						 | 
					@ -512,30 +512,30 @@ void VXIntelInstructionFormatter::internalFormatInstruction(const VXInstructionI
 | 
				
			||||||
    // Append the instruction mnemonic
 | 
					    // Append the instruction mnemonic
 | 
				
			||||||
    outputAppend(Internal::VDEGetInstructionMnemonicString(info.mnemonic));
 | 
					    outputAppend(Internal::VDEGetInstructionMnemonicString(info.mnemonic));
 | 
				
			||||||
    // Append the first operand
 | 
					    // Append the first operand
 | 
				
			||||||
    if (info.operand[0].type != VXOperandType::NONE)
 | 
					    if (info.operand[0].type != ZyDisOperandType::NONE)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        outputAppend(" ");
 | 
					        outputAppend(" ");
 | 
				
			||||||
        bool cast = false;
 | 
					        bool cast = false;
 | 
				
			||||||
        if (info.operand[0].type == VXOperandType::MEMORY) 
 | 
					        if (info.operand[0].type == ZyDisOperandType::MEMORY) 
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (info.operand[1].type == VXOperandType::IMMEDIATE ||
 | 
					            if (info.operand[1].type == ZyDisOperandType::IMMEDIATE ||
 | 
				
			||||||
                info.operand[1].type == VXOperandType::CONSTANT ||
 | 
					                info.operand[1].type == ZyDisOperandType::CONSTANT ||
 | 
				
			||||||
                info.operand[1].type == VXOperandType::NONE ||
 | 
					                info.operand[1].type == ZyDisOperandType::NONE ||
 | 
				
			||||||
                (info.operand[0].size != info.operand[1].size)) 
 | 
					                (info.operand[0].size != info.operand[1].size)) 
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                cast = true;
 | 
					                cast = true;
 | 
				
			||||||
            } else if (info.operand[1].type == VXOperandType::REGISTER &&
 | 
					            } else if (info.operand[1].type == ZyDisOperandType::REGISTER &&
 | 
				
			||||||
                info.operand[1].base == VXRegister::CL) 
 | 
					                info.operand[1].base == ZyDisRegister::CL) 
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                switch (info.mnemonic) 
 | 
					                switch (info.mnemonic) 
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                case VXInstructionMnemonic::RCL:
 | 
					                case ZyDisInstructionMnemonic::RCL:
 | 
				
			||||||
                case VXInstructionMnemonic::ROL:
 | 
					                case ZyDisInstructionMnemonic::ROL:
 | 
				
			||||||
                case VXInstructionMnemonic::ROR:
 | 
					                case ZyDisInstructionMnemonic::ROR:
 | 
				
			||||||
                case VXInstructionMnemonic::RCR:
 | 
					                case ZyDisInstructionMnemonic::RCR:
 | 
				
			||||||
                case VXInstructionMnemonic::SHL:
 | 
					                case ZyDisInstructionMnemonic::SHL:
 | 
				
			||||||
                case VXInstructionMnemonic::SHR:
 | 
					                case ZyDisInstructionMnemonic::SHR:
 | 
				
			||||||
                case VXInstructionMnemonic::SAR:
 | 
					                case ZyDisInstructionMnemonic::SAR:
 | 
				
			||||||
                    cast = true;
 | 
					                    cast = true;
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                default: 
 | 
					                default: 
 | 
				
			||||||
| 
						 | 
					@ -550,19 +550,19 @@ void VXIntelInstructionFormatter::internalFormatInstruction(const VXInstructionI
 | 
				
			||||||
        formatOperand(info, info.operand[0]);
 | 
					        formatOperand(info, info.operand[0]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // Append the second operand
 | 
					    // Append the second operand
 | 
				
			||||||
    if (info.operand[1].type != VXOperandType::NONE)
 | 
					    if (info.operand[1].type != ZyDisOperandType::NONE)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        outputAppend(", ");
 | 
					        outputAppend(", ");
 | 
				
			||||||
        bool cast = false;
 | 
					        bool cast = false;
 | 
				
			||||||
        if (info.operand[1].type == VXOperandType::MEMORY &&
 | 
					        if (info.operand[1].type == ZyDisOperandType::MEMORY &&
 | 
				
			||||||
            info.operand[0].size != info.operand[1].size &&
 | 
					            info.operand[0].size != info.operand[1].size &&
 | 
				
			||||||
            ((info.operand[0].type != VXOperandType::REGISTER) ||
 | 
					            ((info.operand[0].type != ZyDisOperandType::REGISTER) ||
 | 
				
			||||||
             ((info.operand[0].base != VXRegister::ES) && 
 | 
					             ((info.operand[0].base != ZyDisRegister::ES) && 
 | 
				
			||||||
             (info.operand[0].base != VXRegister::CS) &&
 | 
					             (info.operand[0].base != ZyDisRegister::CS) &&
 | 
				
			||||||
             (info.operand[0].base != VXRegister::SS) &&
 | 
					             (info.operand[0].base != ZyDisRegister::SS) &&
 | 
				
			||||||
             (info.operand[0].base != VXRegister::DS) &&
 | 
					             (info.operand[0].base != ZyDisRegister::DS) &&
 | 
				
			||||||
             (info.operand[0].base != VXRegister::FS) &&
 | 
					             (info.operand[0].base != ZyDisRegister::FS) &&
 | 
				
			||||||
             (info.operand[0].base != VXRegister::GS)))) 
 | 
					             (info.operand[0].base != ZyDisRegister::GS)))) 
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            cast = true;
 | 
					            cast = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -573,11 +573,11 @@ void VXIntelInstructionFormatter::internalFormatInstruction(const VXInstructionI
 | 
				
			||||||
        formatOperand(info, info.operand[1]);
 | 
					        formatOperand(info, info.operand[1]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // Append the third operand
 | 
					    // Append the third operand
 | 
				
			||||||
    if (info.operand[2].type != VXOperandType::NONE)
 | 
					    if (info.operand[2].type != ZyDisOperandType::NONE)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        outputAppend(", ");
 | 
					        outputAppend(", ");
 | 
				
			||||||
        bool cast = false;
 | 
					        bool cast = false;
 | 
				
			||||||
        if (info.operand[2].type == VXOperandType::MEMORY && 
 | 
					        if (info.operand[2].type == ZyDisOperandType::MEMORY && 
 | 
				
			||||||
            (info.operand[2].size != info.operand[1].size)) 
 | 
					            (info.operand[2].size != info.operand[1].size)) 
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            cast = true;
 | 
					            cast = true;
 | 
				
			||||||
| 
						 | 
					@ -589,38 +589,38 @@ void VXIntelInstructionFormatter::internalFormatInstruction(const VXInstructionI
 | 
				
			||||||
        formatOperand(info, info.operand[2]);
 | 
					        formatOperand(info, info.operand[2]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // Append the fourth operand
 | 
					    // Append the fourth operand
 | 
				
			||||||
    if (info.operand[3].type != VXOperandType::NONE)
 | 
					    if (info.operand[3].type != ZyDisOperandType::NONE)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        outputAppend(", ");
 | 
					        outputAppend(", ");
 | 
				
			||||||
        formatOperand(info, info.operand[3]);
 | 
					        formatOperand(info, info.operand[3]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VXIntelInstructionFormatter::VXIntelInstructionFormatter()
 | 
					ZyDisIntelInstructionFormatter::ZyDisIntelInstructionFormatter()
 | 
				
			||||||
    : VXBaseInstructionFormatter()
 | 
					    : ZyDisBaseInstructionFormatter()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VXIntelInstructionFormatter::VXIntelInstructionFormatter(VXBaseSymbolResolver* symbolResolver)
 | 
					ZyDisIntelInstructionFormatter::ZyDisIntelInstructionFormatter(ZyDisBaseSymbolResolver* symbolResolver)
 | 
				
			||||||
    : VXBaseInstructionFormatter(symbolResolver)
 | 
					    : ZyDisBaseInstructionFormatter(symbolResolver)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VXIntelInstructionFormatter::~VXIntelInstructionFormatter()
 | 
					ZyDisIntelInstructionFormatter::~ZyDisIntelInstructionFormatter()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VXExactSymbolResolver::~VXExactSymbolResolver()
 | 
					ZyDisExactSymbolResolver::~ZyDisExactSymbolResolver()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* VXExactSymbolResolver::resolveSymbol(const VXInstructionInfo &info, uint64_t address, 
 | 
					const char* ZyDisExactSymbolResolver::resolveSymbol(const ZyDisInstructionInfo &info, uint64_t address, 
 | 
				
			||||||
    uint64_t &offset)
 | 
					    uint64_t &offset)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    std::unordered_map<uint64_t, std::string>::const_iterator iterator = m_symbolMap.find(address);
 | 
					    std::unordered_map<uint64_t, std::string>::const_iterator iterator = m_symbolMap.find(address);
 | 
				
			||||||
| 
						 | 
					@ -632,23 +632,23 @@ const char* VXExactSymbolResolver::resolveSymbol(const VXInstructionInfo &info,
 | 
				
			||||||
    return nullptr;
 | 
					    return nullptr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool VXExactSymbolResolver::containsSymbol(uint64_t address) const
 | 
					bool ZyDisExactSymbolResolver::containsSymbol(uint64_t address) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    std::unordered_map<uint64_t, std::string>::const_iterator iterator = m_symbolMap.find(address);
 | 
					    std::unordered_map<uint64_t, std::string>::const_iterator iterator = m_symbolMap.find(address);
 | 
				
			||||||
    return (iterator != m_symbolMap.end());
 | 
					    return (iterator != m_symbolMap.end());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXExactSymbolResolver::setSymbol(uint64_t address, const char* name)
 | 
					void ZyDisExactSymbolResolver::setSymbol(uint64_t address, const char* name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_symbolMap[address].assign(name);
 | 
					    m_symbolMap[address].assign(name);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXExactSymbolResolver::removeSymbol(uint64_t address)
 | 
					void ZyDisExactSymbolResolver::removeSymbol(uint64_t address)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_symbolMap.erase(address);
 | 
					    m_symbolMap.erase(address);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VXExactSymbolResolver::clear()
 | 
					void ZyDisExactSymbolResolver::clear()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_symbolMap.clear();
 | 
					    m_symbolMap.clear();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@
 | 
				
			||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
#include <unordered_map>
 | 
					#include <unordered_map>
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
#include "VXDisassemblerTypes.hpp"
 | 
					#include "ZyDisDisassemblerTypes.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Verteron
 | 
					namespace Verteron
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -44,13 +44,13 @@ namespace Verteron
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Base class for all symbol resolver implementations.
 | 
					 * @brief   Base class for all symbol resolver implementations.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class VXBaseSymbolResolver
 | 
					class ZyDisBaseSymbolResolver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Destructor.
 | 
					     * @brief   Destructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    virtual ~VXBaseSymbolResolver();
 | 
					    virtual ~ZyDisBaseSymbolResolver();
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Resolves a symbol.
 | 
					     * @brief   Resolves a symbol.
 | 
				
			||||||
| 
						 | 
					@ -60,7 +60,7 @@ public:
 | 
				
			||||||
     *                      relative to the base address of the symbol.
 | 
					     *                      relative to the base address of the symbol.
 | 
				
			||||||
     * @return  The name of the symbol, if the symbol was found, @c NULL if not.
 | 
					     * @return  The name of the symbol, if the symbol was found, @c NULL if not.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    virtual const char* resolveSymbol(const VXInstructionInfo &info, uint64_t address, 
 | 
					    virtual const char* resolveSymbol(const ZyDisInstructionInfo &info, uint64_t address, 
 | 
				
			||||||
        uint64_t &offset);
 | 
					        uint64_t &offset);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,11 +69,11 @@ public:
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Base class for all instruction formatter implementations.
 | 
					 * @brief   Base class for all instruction formatter implementations.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class VXBaseInstructionFormatter
 | 
					class ZyDisBaseInstructionFormatter
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    static const char    *m_registerStrings[];
 | 
					    static const char    *m_registerStrings[];
 | 
				
			||||||
    VXBaseSymbolResolver *m_symbolResolver;
 | 
					    ZyDisBaseSymbolResolver *m_symbolResolver;
 | 
				
			||||||
    std::vector<char>     m_outputBuffer;
 | 
					    std::vector<char>     m_outputBuffer;
 | 
				
			||||||
    size_t                m_outputStringLen;
 | 
					    size_t                m_outputStringLen;
 | 
				
			||||||
    bool                  m_outputUppercase;
 | 
					    bool                  m_outputUppercase;
 | 
				
			||||||
| 
						 | 
					@ -109,7 +109,7 @@ protected:
 | 
				
			||||||
     * @param   resolveSymbols  If this parameter is true, the method will try to display a
 | 
					     * @param   resolveSymbols  If this parameter is true, the method will try to display a
 | 
				
			||||||
     *                          smybol name instead of the numeric value.
 | 
					     *                          smybol name instead of the numeric value.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void outputAppendAddress(const VXInstructionInfo &info, uint64_t address, 
 | 
					    void outputAppendAddress(const ZyDisInstructionInfo &info, uint64_t address, 
 | 
				
			||||||
        bool resolveSymbols = true);
 | 
					        bool resolveSymbols = true);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Appends a formatted immediate value to the output string buffer.
 | 
					     * @brief   Appends a formatted immediate value to the output string buffer.
 | 
				
			||||||
| 
						 | 
					@ -118,21 +118,21 @@ protected:
 | 
				
			||||||
     * @param   resolveSymbols  If this parameter is true, the method will try to display a
 | 
					     * @param   resolveSymbols  If this parameter is true, the method will try to display a
 | 
				
			||||||
     *                          smybol name instead of the numeric value.
 | 
					     *                          smybol name instead of the numeric value.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void outputAppendImmediate(const VXInstructionInfo &info, const VXOperandInfo &operand,
 | 
					    void outputAppendImmediate(const ZyDisInstructionInfo &info, const ZyDisOperandInfo &operand,
 | 
				
			||||||
        bool resolveSymbols = false);
 | 
					        bool resolveSymbols = false);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Appends a formatted memory displacement value to the output string buffer.
 | 
					     * @brief   Appends a formatted memory displacement value to the output string buffer.
 | 
				
			||||||
     * @param   info    The instruction info.
 | 
					     * @param   info    The instruction info.
 | 
				
			||||||
     * @param   operand The memory operand.
 | 
					     * @param   operand The memory operand.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void outputAppendDisplacement(const VXInstructionInfo &info, const VXOperandInfo &operand);
 | 
					    void outputAppendDisplacement(const ZyDisInstructionInfo &info, const ZyDisOperandInfo &operand);
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns the string representation of a given register.
 | 
					     * @brief   Returns the string representation of a given register.
 | 
				
			||||||
     * @param   reg The register.
 | 
					     * @param   reg The register.
 | 
				
			||||||
     * @return  The string representation of the given register.
 | 
					     * @return  The string representation of the given register.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    const char* registerToString(VXRegister reg) const;
 | 
					    const char* registerToString(ZyDisRegister reg) const;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Resolves a symbol.
 | 
					     * @brief   Resolves a symbol.
 | 
				
			||||||
     * @param   info        The instruction info.
 | 
					     * @param   info        The instruction info.
 | 
				
			||||||
| 
						 | 
					@ -141,7 +141,7 @@ protected:
 | 
				
			||||||
     *                      relative to the base address of the symbol.
 | 
					     *                      relative to the base address of the symbol.
 | 
				
			||||||
     * @return  The name of the symbol, if the symbol was found, @c NULL if not.
 | 
					     * @return  The name of the symbol, if the symbol was found, @c NULL if not.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    const char* resolveSymbol(const VXInstructionInfo &info, uint64_t address, 
 | 
					    const char* resolveSymbol(const ZyDisInstructionInfo &info, uint64_t address, 
 | 
				
			||||||
        uint64_t &offset) const;
 | 
					        uint64_t &offset) const;
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -150,58 +150,58 @@ protected:
 | 
				
			||||||
     *          string buffer.
 | 
					     *          string buffer.
 | 
				
			||||||
     * @param   info    The instruction info.
 | 
					     * @param   info    The instruction info.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    virtual void internalFormatInstruction(const VXInstructionInfo &info);
 | 
					    virtual void internalFormatInstruction(const ZyDisInstructionInfo &info);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Default constructor.
 | 
					     * @brief   Default constructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXBaseInstructionFormatter();
 | 
					    ZyDisBaseInstructionFormatter();
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Constructor.
 | 
					     * @brief   Constructor.
 | 
				
			||||||
     * @param   symbolResolver  Pointer to a symbol resolver instance or @c NULL, if no smybol
 | 
					     * @param   symbolResolver  Pointer to a symbol resolver instance or @c NULL, if no smybol
 | 
				
			||||||
     *                          resolver should be used.
 | 
					     *                          resolver should be used.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    explicit VXBaseInstructionFormatter(VXBaseSymbolResolver *symbolResolver);
 | 
					    explicit ZyDisBaseInstructionFormatter(ZyDisBaseSymbolResolver *symbolResolver);
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Destructor.
 | 
					     * @brief   Destructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    virtual ~VXBaseInstructionFormatter();
 | 
					    virtual ~ZyDisBaseInstructionFormatter();
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Formats a decoded instruction.
 | 
					     * @brief   Formats a decoded instruction.
 | 
				
			||||||
     * @param   info    The instruction info.
 | 
					     * @param   info    The instruction info.
 | 
				
			||||||
     * @return  Pointer to the formatted instruction string.
 | 
					     * @return  Pointer to the formatted instruction string.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    const char* formatInstruction(const VXInstructionInfo &info);
 | 
					    const char* formatInstruction(const ZyDisInstructionInfo &info);
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Returns a pointer to the current symbol resolver.
 | 
					     * @brief   Returns a pointer to the current symbol resolver.
 | 
				
			||||||
     * @return  Pointer to the current symbol resolver or @c NULL, if no symbol resolver is used.
 | 
					     * @return  Pointer to the current symbol resolver or @c NULL, if no symbol resolver is used.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXBaseSymbolResolver* getSymbolResolver() const;
 | 
					    ZyDisBaseSymbolResolver* getSymbolResolver() const;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Sets a new symbol resolver.
 | 
					     * @brief   Sets a new symbol resolver.
 | 
				
			||||||
     * @param   symbolResolver  Pointer to a symbol resolver instance or @c NULL, if no smybol
 | 
					     * @param   symbolResolver  Pointer to a symbol resolver instance or @c NULL, if no smybol
 | 
				
			||||||
     *                          resolver should be used.
 | 
					     *                          resolver should be used.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void setSymbolResolver(VXBaseSymbolResolver *symbolResolver);
 | 
					    void setSymbolResolver(ZyDisBaseSymbolResolver *symbolResolver);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline void VXBaseInstructionFormatter::outputSetUppercase(bool uppercase)
 | 
					inline void ZyDisBaseInstructionFormatter::outputSetUppercase(bool uppercase)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_outputUppercase = uppercase;
 | 
					    m_outputUppercase = uppercase;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline char const* VXBaseInstructionFormatter::registerToString(VXRegister reg) const
 | 
					inline char const* ZyDisBaseInstructionFormatter::registerToString(ZyDisRegister reg) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (reg == VXRegister::NONE)
 | 
					    if (reg == ZyDisRegister::NONE)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return "error";   
 | 
					        return "error";   
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return m_registerStrings[static_cast<uint16_t>(reg) - 1]; 
 | 
					    return m_registerStrings[static_cast<uint16_t>(reg) - 1]; 
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline char const* VXBaseInstructionFormatter::resolveSymbol(const VXInstructionInfo &info, 
 | 
					inline char const* ZyDisBaseInstructionFormatter::resolveSymbol(const ZyDisInstructionInfo &info, 
 | 
				
			||||||
    uint64_t address, uint64_t &offset) const
 | 
					    uint64_t address, uint64_t &offset) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (m_symbolResolver)
 | 
					    if (m_symbolResolver)
 | 
				
			||||||
| 
						 | 
					@ -211,12 +211,12 @@ inline char const* VXBaseInstructionFormatter::resolveSymbol(const VXInstruction
 | 
				
			||||||
    return nullptr;
 | 
					    return nullptr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline VXBaseSymbolResolver* VXBaseInstructionFormatter::getSymbolResolver() const
 | 
					inline ZyDisBaseSymbolResolver* ZyDisBaseInstructionFormatter::getSymbolResolver() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_symbolResolver;
 | 
					    return m_symbolResolver;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline void VXBaseInstructionFormatter::setSymbolResolver(VXBaseSymbolResolver *symbolResolver)
 | 
					inline void ZyDisBaseInstructionFormatter::setSymbolResolver(ZyDisBaseSymbolResolver *symbolResolver)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    m_symbolResolver = symbolResolver;
 | 
					    m_symbolResolver = symbolResolver;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -226,7 +226,7 @@ inline void VXBaseInstructionFormatter::setSymbolResolver(VXBaseSymbolResolver *
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Intel syntax instruction formatter.
 | 
					 * @brief   Intel syntax instruction formatter.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class VXIntelInstructionFormatter : public VXBaseInstructionFormatter
 | 
					class ZyDisIntelInstructionFormatter : public ZyDisBaseInstructionFormatter
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -234,35 +234,35 @@ private:
 | 
				
			||||||
     * @param   info    The instruction info.
 | 
					     * @param   info    The instruction info.
 | 
				
			||||||
     * @param   operand The operand.
 | 
					     * @param   operand The operand.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void outputAppendOperandCast(const VXInstructionInfo &info, const VXOperandInfo &operand);
 | 
					    void outputAppendOperandCast(const ZyDisInstructionInfo &info, const ZyDisOperandInfo &operand);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Formats the specified operand and appends the resulting string to the output
 | 
					     * @brief   Formats the specified operand and appends the resulting string to the output
 | 
				
			||||||
     *          buffer.
 | 
					     *          buffer.
 | 
				
			||||||
     * @param   info    The instruction info.
 | 
					     * @param   info    The instruction info.
 | 
				
			||||||
     * @param   operand The operand.
 | 
					     * @param   operand The operand.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void formatOperand(const VXInstructionInfo &info, const VXOperandInfo &operand);
 | 
					    void formatOperand(const ZyDisInstructionInfo &info, const ZyDisOperandInfo &operand);
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Fills the internal string buffer with an intel style formatted instruction string.
 | 
					     * @brief   Fills the internal string buffer with an intel style formatted instruction string.
 | 
				
			||||||
     * @param   info    The instruction info.
 | 
					     * @param   info    The instruction info.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void internalFormatInstruction(const VXInstructionInfo &info) override;
 | 
					    void internalFormatInstruction(const ZyDisInstructionInfo &info) override;
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Default constructor.
 | 
					     * @brief   Default constructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXIntelInstructionFormatter();
 | 
					    ZyDisIntelInstructionFormatter();
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Constructor.
 | 
					     * @brief   Constructor.
 | 
				
			||||||
     * @param   symbolResolver  Pointer to a symbol resolver instance or @c NULL, if no smybol
 | 
					     * @param   symbolResolver  Pointer to a symbol resolver instance or @c NULL, if no smybol
 | 
				
			||||||
     *                          resolver should be used.
 | 
					     *                          resolver should be used.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    explicit VXIntelInstructionFormatter(VXBaseSymbolResolver *symbolResolver);
 | 
					    explicit ZyDisIntelInstructionFormatter(ZyDisBaseSymbolResolver *symbolResolver);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Destructor.
 | 
					     * @brief   Destructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    ~VXIntelInstructionFormatter() override;
 | 
					    ~ZyDisIntelInstructionFormatter() override;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
| 
						 | 
					@ -270,7 +270,7 @@ public:
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Simple symbol resolver that only matches exact addresses.
 | 
					 * @brief   Simple symbol resolver that only matches exact addresses.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class VXExactSymbolResolver : public VXBaseSymbolResolver
 | 
					class ZyDisExactSymbolResolver : public ZyDisBaseSymbolResolver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    std::unordered_map<uint64_t, std::string> m_symbolMap;
 | 
					    std::unordered_map<uint64_t, std::string> m_symbolMap;
 | 
				
			||||||
| 
						 | 
					@ -278,7 +278,7 @@ public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Destructor.
 | 
					     * @brief   Destructor.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    ~VXExactSymbolResolver() override;
 | 
					    ~ZyDisExactSymbolResolver() override;
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Resolves a symbol.
 | 
					     * @brief   Resolves a symbol.
 | 
				
			||||||
| 
						 | 
					@ -288,7 +288,7 @@ public:
 | 
				
			||||||
     *                      relative to the base address of the symbol.
 | 
					     *                      relative to the base address of the symbol.
 | 
				
			||||||
     * @return  The name of the symbol, if the symbol was found, @c NULL if not.
 | 
					     * @return  The name of the symbol, if the symbol was found, @c NULL if not.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    const char* resolveSymbol(const VXInstructionInfo &info, uint64_t address, 
 | 
					    const char* resolveSymbol(const ZyDisInstructionInfo &info, uint64_t address, 
 | 
				
			||||||
        uint64_t &offset) override;
 | 
					        uint64_t &offset) override;
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -40,7 +40,7 @@ namespace Verteron
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent an instruction mnemonic.
 | 
					 * @brief   Values that represent an instruction mnemonic.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXInstructionMnemonic : uint16_t
 | 
					enum class ZyDisInstructionMnemonic : uint16_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* 000 */ INVALID,
 | 
					    /* 000 */ INVALID,
 | 
				
			||||||
    /* 001 */ AAA,
 | 
					    /* 001 */ AAA,
 | 
				
			||||||
| 
						 | 
					@ -922,8 +922,8 @@ enum class VXInstructionMnemonic : uint16_t
 | 
				
			||||||
    /* 36D */ VUNPCKHPS,
 | 
					    /* 36D */ VUNPCKHPS,
 | 
				
			||||||
    /* 36E */ VUNPCKLPD,
 | 
					    /* 36E */ VUNPCKLPD,
 | 
				
			||||||
    /* 36F */ VUNPCKLPS,
 | 
					    /* 36F */ VUNPCKLPS,
 | 
				
			||||||
    /* 370 */ VXORPD,
 | 
					    /* 370 */ ZyDisORPD,
 | 
				
			||||||
    /* 371 */ VXORPS,
 | 
					    /* 371 */ ZyDisORPS,
 | 
				
			||||||
    /* 372 */ VZEROALL,
 | 
					    /* 372 */ VZEROALL,
 | 
				
			||||||
    /* 373 */ VZEROUPPER,
 | 
					    /* 373 */ VZEROUPPER,
 | 
				
			||||||
    /* 374 */ WAIT,
 | 
					    /* 374 */ WAIT,
 | 
				
			||||||
| 
						 | 
					@ -953,12 +953,12 @@ enum class VXInstructionMnemonic : uint16_t
 | 
				
			||||||
 * @brief   Defines an alias representing an opcode tree node. An opcode tree node is a 16 bit
 | 
					 * @brief   Defines an alias representing an opcode tree node. An opcode tree node is a 16 bit
 | 
				
			||||||
 *          unsigned integer value with its first 4 bits reserved for the node type.
 | 
					 *          unsigned integer value with its first 4 bits reserved for the node type.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef uint16_t VXOpcodeTreeNode;
 | 
					typedef uint16_t ZyDisOpcodeTreeNode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the type of an opcode tree node.
 | 
					 * @brief   Values that represent the type of an opcode tree node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXOpcodeTreeNodeType : uint8_t
 | 
					enum class ZyDisOpcodeTreeNodeType : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Reference to a concrete instruction definition.
 | 
					     * @brief   Reference to a concrete instruction definition.
 | 
				
			||||||
| 
						 | 
					@ -1025,7 +1025,7 @@ enum class VXOpcodeTreeNodeType : uint8_t
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the type of an operand in the instruction definition.
 | 
					 * @brief   Values that represent the type of an operand in the instruction definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXDefinedOperandType : uint8_t
 | 
					enum class ZyDisDefinedOperandType : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * @brief   No operand. 
 | 
					     * @brief   No operand. 
 | 
				
			||||||
| 
						 | 
					@ -1286,7 +1286,7 @@ enum class VXDefinedOperandType : uint8_t
 | 
				
			||||||
 * @brief   Values that represent the size of an operand in the instruction definition.
 | 
					 * @brief   Values that represent the size of an operand in the instruction definition.
 | 
				
			||||||
 *          Do not change the order or the values of this enum! 
 | 
					 *          Do not change the order or the values of this enum! 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum class VXDefinedOperandSize : uint8_t
 | 
					enum class ZyDisDefinedOperandSize : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   No operand.
 | 
					     * @brief   No operand.
 | 
				
			||||||
| 
						 | 
					@ -1386,7 +1386,7 @@ enum class VXDefinedOperandSize : uint8_t
 | 
				
			||||||
 * @brief   Values that represent optional flags in the instruction definition.   
 | 
					 * @brief   Values that represent optional flags in the instruction definition.   
 | 
				
			||||||
 *          Do not change the order or the values of this enum!            
 | 
					 *          Do not change the order or the values of this enum!            
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
enum VXInstructionDefinitionFlags : uint16_t
 | 
					enum ZyDisInstructionDefinitionFlags : uint16_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction accepts the rex.b prefix value.
 | 
					     * @brief   The instruction accepts the rex.b prefix value.
 | 
				
			||||||
| 
						 | 
					@ -1454,30 +1454,30 @@ enum VXInstructionDefinitionFlags : uint16_t
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   An operand definition.
 | 
					 * @brief   An operand definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct VXOperandDefinition     
 | 
					struct ZyDisOperandDefinition     
 | 
				
			||||||
{               
 | 
					{               
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The defined operand type.
 | 
					     * @brief   The defined operand type.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXDefinedOperandType type;
 | 
					    ZyDisDefinedOperandType type;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The defined operand size.
 | 
					     * @brief   The defined operand size.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXDefinedOperandSize size;
 | 
					    ZyDisDefinedOperandSize size;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   An instruction definition.
 | 
					 * @brief   An instruction definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct VXInstructionDefinition
 | 
					struct ZyDisInstructionDefinition
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction mnemonic.
 | 
					     * @brief   The instruction mnemonic.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXInstructionMnemonic mnemonic;
 | 
					    ZyDisInstructionMnemonic mnemonic;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The operand definitions for all four possible operands.
 | 
					     * @brief   The operand definitions for all four possible operands.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXOperandDefinition operand[4];
 | 
					    ZyDisOperandDefinition operand[4];
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Additional flags for the instruction definition.
 | 
					     * @brief   Additional flags for the instruction definition.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -1492,24 +1492,24 @@ namespace Internal
 | 
				
			||||||
 * @brief   Contains all opcode tables.
 | 
					 * @brief   Contains all opcode tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the opcode.
 | 
					 *          Indexed by the numeric value of the opcode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeTable[][256];
 | 
					extern const ZyDisOpcodeTreeNode optreeTable[][256];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all modrm_mod switch tables.
 | 
					 * @brief   Contains all modrm_mod switch tables.
 | 
				
			||||||
 *          Index values:
 | 
					 *          Index values:
 | 
				
			||||||
 *          0 = [modrm_mod == !11]
 | 
					 *          0 = [modrm_mod == !11]
 | 
				
			||||||
 *          1 = [modrm_mod ==  11]
 | 
					 *          1 = [modrm_mod ==  11]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeModrmMod[][2];
 | 
					extern const ZyDisOpcodeTreeNode optreeModrmMod[][2];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all modrm_reg switch tables.
 | 
					 * @brief   Contains all modrm_reg switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the modrm_reg field.
 | 
					 *          Indexed by the numeric value of the modrm_reg field.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeModrmReg[][8];
 | 
					extern const ZyDisOpcodeTreeNode optreeModrmReg[][8];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all modrm_rm switch tables.
 | 
					 * @brief   Contains all modrm_rm switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the modrm_rm field.
 | 
					 *          Indexed by the numeric value of the modrm_rm field.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeModrmRm[][8];
 | 
					extern const ZyDisOpcodeTreeNode optreeModrmRm[][8];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all mandatory-prefix switch tables.
 | 
					 * @brief   Contains all mandatory-prefix switch tables.
 | 
				
			||||||
 *          Index values:
 | 
					 *          Index values:
 | 
				
			||||||
| 
						 | 
					@ -1518,13 +1518,13 @@ extern const VXOpcodeTreeNode optreeModrmRm[][8];
 | 
				
			||||||
 *          2 = F3  
 | 
					 *          2 = F3  
 | 
				
			||||||
 *          3 = 66
 | 
					 *          3 = 66
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeMandatory[][4];
 | 
					extern const ZyDisOpcodeTreeNode optreeMandatory[][4];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all x87 opcode tables.
 | 
					 * @brief   Contains all x87 opcode tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the 6 lowest bits of the modrm byte (modrm_mod should
 | 
					 *          Indexed by the numeric value of the 6 lowest bits of the modrm byte (modrm_mod should
 | 
				
			||||||
 *          always be 11). 
 | 
					 *          always be 11). 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeX87[][64];
 | 
					extern const ZyDisOpcodeTreeNode optreeX87[][64];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all address-size switch tables.
 | 
					 * @brief   Contains all address-size switch tables.
 | 
				
			||||||
 *          Index values:
 | 
					 *          Index values:
 | 
				
			||||||
| 
						 | 
					@ -1532,7 +1532,7 @@ extern const VXOpcodeTreeNode optreeX87[][64];
 | 
				
			||||||
 *          1 = 32  
 | 
					 *          1 = 32  
 | 
				
			||||||
 *          2 = 64
 | 
					 *          2 = 64
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeAddressSize[][3];
 | 
					extern const ZyDisOpcodeTreeNode optreeAddressSize[][3];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all operand-size switch tables.
 | 
					 * @brief   Contains all operand-size switch tables.
 | 
				
			||||||
 *          Index values:
 | 
					 *          Index values:
 | 
				
			||||||
| 
						 | 
					@ -1540,26 +1540,26 @@ extern const VXOpcodeTreeNode optreeAddressSize[][3];
 | 
				
			||||||
 *          1 = 32  
 | 
					 *          1 = 32  
 | 
				
			||||||
 *          2 = 64
 | 
					 *          2 = 64
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeOperandSize[][3];
 | 
					extern const ZyDisOpcodeTreeNode optreeOperandSize[][3];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all cpu-mode switch tables.
 | 
					 * @brief   Contains all cpu-mode switch tables.
 | 
				
			||||||
 *          Index values:
 | 
					 *          Index values:
 | 
				
			||||||
 *          0 = [!= 64]
 | 
					 *          0 = [!= 64]
 | 
				
			||||||
 *          1 = 64
 | 
					 *          1 = 64
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeMode[][2];
 | 
					extern const ZyDisOpcodeTreeNode optreeMode[][2];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all vendor switch tables. 
 | 
					 * @brief   Contains all vendor switch tables. 
 | 
				
			||||||
 *          Index values:
 | 
					 *          Index values:
 | 
				
			||||||
 *          0 = AMD
 | 
					 *          0 = AMD
 | 
				
			||||||
 *          1 = Intel  
 | 
					 *          1 = Intel  
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeVendor[][2];
 | 
					extern const ZyDisOpcodeTreeNode optreeVendor[][2];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all 3dnow! switch tables.
 | 
					 * @brief   Contains all 3dnow! switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the 3dnow! opcode.
 | 
					 *          Indexed by the numeric value of the 3dnow! opcode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optree3dnow[][256];
 | 
					extern const ZyDisOpcodeTreeNode optree3dnow[][256];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all vex switch tables.
 | 
					 * @brief   Contains all vex switch tables.
 | 
				
			||||||
 *          Index values:
 | 
					 *          Index values:
 | 
				
			||||||
| 
						 | 
					@ -1580,21 +1580,21 @@ extern const VXOpcodeTreeNode optree3dnow[][256];
 | 
				
			||||||
 *          E = F2_0F38
 | 
					 *          E = F2_0F38
 | 
				
			||||||
 *          F = F2_0F3A
 | 
					 *          F = F2_0F3A
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeVex[][16];
 | 
					extern const ZyDisOpcodeTreeNode optreeVex[][16];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all vex_w switch tables.
 | 
					 * @brief   Contains all vex_w switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the vex_w field.
 | 
					 *          Indexed by the numeric value of the vex_w field.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeVexW[][2];
 | 
					extern const ZyDisOpcodeTreeNode optreeVexW[][2];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all vex_l switch tables.
 | 
					 * @brief   Contains all vex_l switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the vex_l field.
 | 
					 *          Indexed by the numeric value of the vex_l field.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode optreeVexL[][2];
 | 
					extern const ZyDisOpcodeTreeNode optreeVexL[][2];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all instruction definitions.
 | 
					 * @brief   Contains all instruction definitions.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXInstructionDefinition instrDefinitions[];
 | 
					extern const ZyDisInstructionDefinition instrDefinitions[];
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all instruction mnemonic strings.
 | 
					 * @brief   Contains all instruction mnemonic strings.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
| 
						 | 
					@ -1605,9 +1605,9 @@ extern const char* instrMnemonicStrings[];
 | 
				
			||||||
 * @param   node    The node.
 | 
					 * @param   node    The node.
 | 
				
			||||||
 * @return  The type of the specified opcode tree node.
 | 
					 * @return  The type of the specified opcode tree node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline VXOpcodeTreeNodeType VDEGetOpcodeNodeType(VXOpcodeTreeNode node)
 | 
					inline ZyDisOpcodeTreeNodeType VDEGetOpcodeNodeType(ZyDisOpcodeTreeNode node)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return static_cast<VXOpcodeTreeNodeType>((node >> 12) & 0x0F);
 | 
					    return static_cast<ZyDisOpcodeTreeNodeType>((node >> 12) & 0x0F);
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -1615,7 +1615,7 @@ inline VXOpcodeTreeNodeType VDEGetOpcodeNodeType(VXOpcodeTreeNode node)
 | 
				
			||||||
 * @param   node    The node.
 | 
					 * @param   node    The node.
 | 
				
			||||||
 * @return  The value of the specified opcode tree node.
 | 
					 * @return  The value of the specified opcode tree node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline uint16_t VDEGetOpcodeNodeValue(VXOpcodeTreeNode node)
 | 
					inline uint16_t VDEGetOpcodeNodeValue(ZyDisOpcodeTreeNode node)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (node & 0x0FFF);   
 | 
					    return (node & 0x0FFF);   
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1624,7 +1624,7 @@ inline uint16_t VDEGetOpcodeNodeValue(VXOpcodeTreeNode node)
 | 
				
			||||||
 * @brief   Returns the root node of the opcode tree.
 | 
					 * @brief   Returns the root node of the opcode tree.
 | 
				
			||||||
 * @return  The root node of the opcode tree.
 | 
					 * @return  The root node of the opcode tree.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline VXOpcodeTreeNode VDEGetOpcodeTreeRoot()
 | 
					inline ZyDisOpcodeTreeNode VDEGetOpcodeTreeRoot()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return 0x1000;
 | 
					    return 0x1000;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1635,53 +1635,53 @@ inline VXOpcodeTreeNode VDEGetOpcodeTreeRoot()
 | 
				
			||||||
 * @param   index   The index of the child node to retrieve.
 | 
					 * @param   index   The index of the child node to retrieve.
 | 
				
			||||||
 * @return  The specified child node.
 | 
					 * @return  The specified child node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline VXOpcodeTreeNode VDEGetOpcodeTreeChild(VXOpcodeTreeNode parent, uint16_t index)
 | 
					inline ZyDisOpcodeTreeNode VDEGetOpcodeTreeChild(ZyDisOpcodeTreeNode parent, uint16_t index)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    using namespace Internal;
 | 
					    using namespace Internal;
 | 
				
			||||||
    VXOpcodeTreeNodeType nodeType = VDEGetOpcodeNodeType(parent);
 | 
					    ZyDisOpcodeTreeNodeType nodeType = VDEGetOpcodeNodeType(parent);
 | 
				
			||||||
    uint16_t tableIndex = VDEGetOpcodeNodeValue(parent);
 | 
					    uint16_t tableIndex = VDEGetOpcodeNodeValue(parent);
 | 
				
			||||||
    switch (nodeType)
 | 
					    switch (nodeType)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    case VXOpcodeTreeNodeType::TABLE:
 | 
					    case ZyDisOpcodeTreeNodeType::TABLE:
 | 
				
			||||||
        assert(index < 256);
 | 
					        assert(index < 256);
 | 
				
			||||||
        return optreeTable[tableIndex][index];
 | 
					        return optreeTable[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::MODRM_MOD:
 | 
					    case ZyDisOpcodeTreeNodeType::MODRM_MOD:
 | 
				
			||||||
        assert(index < 2);
 | 
					        assert(index < 2);
 | 
				
			||||||
        return optreeModrmMod[tableIndex][index];
 | 
					        return optreeModrmMod[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::MODRM_REG:
 | 
					    case ZyDisOpcodeTreeNodeType::MODRM_REG:
 | 
				
			||||||
        assert(index < 8);
 | 
					        assert(index < 8);
 | 
				
			||||||
        return optreeModrmReg[tableIndex][index];
 | 
					        return optreeModrmReg[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::MODRM_RM:
 | 
					    case ZyDisOpcodeTreeNodeType::MODRM_RM:
 | 
				
			||||||
        assert(index < 8);
 | 
					        assert(index < 8);
 | 
				
			||||||
        return optreeModrmRm[tableIndex][index];
 | 
					        return optreeModrmRm[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::MANDATORY:
 | 
					    case ZyDisOpcodeTreeNodeType::MANDATORY:
 | 
				
			||||||
        assert(index < 4);
 | 
					        assert(index < 4);
 | 
				
			||||||
        return optreeMandatory[tableIndex][index];
 | 
					        return optreeMandatory[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::X87:
 | 
					    case ZyDisOpcodeTreeNodeType::X87:
 | 
				
			||||||
        assert(index < 64);
 | 
					        assert(index < 64);
 | 
				
			||||||
        return optreeX87[tableIndex][index];
 | 
					        return optreeX87[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::ADDRESS_SIZE:
 | 
					    case ZyDisOpcodeTreeNodeType::ADDRESS_SIZE:
 | 
				
			||||||
        assert(index < 3);
 | 
					        assert(index < 3);
 | 
				
			||||||
        return optreeAddressSize[tableIndex][index];
 | 
					        return optreeAddressSize[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::OPERAND_SIZE:
 | 
					    case ZyDisOpcodeTreeNodeType::OPERAND_SIZE:
 | 
				
			||||||
        assert(index < 3);
 | 
					        assert(index < 3);
 | 
				
			||||||
        return optreeOperandSize[tableIndex][index];
 | 
					        return optreeOperandSize[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::MODE:
 | 
					    case ZyDisOpcodeTreeNodeType::MODE:
 | 
				
			||||||
        assert(index < 2);
 | 
					        assert(index < 2);
 | 
				
			||||||
        return optreeMode[tableIndex][index];
 | 
					        return optreeMode[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::VENDOR:
 | 
					    case ZyDisOpcodeTreeNodeType::VENDOR:
 | 
				
			||||||
        assert(index < 3);
 | 
					        assert(index < 3);
 | 
				
			||||||
        return optreeVendor[tableIndex][index];
 | 
					        return optreeVendor[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::AMD3DNOW:
 | 
					    case ZyDisOpcodeTreeNodeType::AMD3DNOW:
 | 
				
			||||||
        assert(index < 256);
 | 
					        assert(index < 256);
 | 
				
			||||||
        return optree3dnow[tableIndex][index];
 | 
					        return optree3dnow[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::VEX:
 | 
					    case ZyDisOpcodeTreeNodeType::VEX:
 | 
				
			||||||
        assert(index < 16);
 | 
					        assert(index < 16);
 | 
				
			||||||
        return optreeVex[tableIndex][index];
 | 
					        return optreeVex[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::VEXW:
 | 
					    case ZyDisOpcodeTreeNodeType::VEXW:
 | 
				
			||||||
        assert(index < 2);
 | 
					        assert(index < 2);
 | 
				
			||||||
        return optreeVexW[tableIndex][index];
 | 
					        return optreeVexW[tableIndex][index];
 | 
				
			||||||
    case VXOpcodeTreeNodeType::VEXL:
 | 
					    case ZyDisOpcodeTreeNodeType::VEXL:
 | 
				
			||||||
        assert(index < 2);
 | 
					        assert(index < 2);
 | 
				
			||||||
        return optreeVexL[tableIndex][index];
 | 
					        return optreeVexL[tableIndex][index];
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
| 
						 | 
					@ -1695,9 +1695,9 @@ inline VXOpcodeTreeNode VDEGetOpcodeTreeChild(VXOpcodeTreeNode parent, uint16_t
 | 
				
			||||||
 * @param   node    The instruction definition node.
 | 
					 * @param   node    The instruction definition node.
 | 
				
			||||||
 * @return  Pointer to the instruction definition.
 | 
					 * @return  Pointer to the instruction definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline const VXInstructionDefinition* VDEGetInstructionDefinition(VXOpcodeTreeNode node)
 | 
					inline const ZyDisInstructionDefinition* VDEGetInstructionDefinition(ZyDisOpcodeTreeNode node)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    assert(VDEGetOpcodeNodeType(node) == VXOpcodeTreeNodeType::INSTRUCTION_DEFINITION);
 | 
					    assert(VDEGetOpcodeNodeType(node) == ZyDisOpcodeTreeNodeType::INSTRUCTION_DEFINITION);
 | 
				
			||||||
    return &instrDefinitions[node & 0x0FFF];    
 | 
					    return &instrDefinitions[node & 0x0FFF];    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1706,7 +1706,7 @@ inline const VXInstructionDefinition* VDEGetInstructionDefinition(VXOpcodeTreeNo
 | 
				
			||||||
 * @param   mnemonic    The mnemonic.
 | 
					 * @param   mnemonic    The mnemonic.
 | 
				
			||||||
 * @return  The instruction mnemonic string.
 | 
					 * @return  The instruction mnemonic string.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline const char* VDEGetInstructionMnemonicString(VXInstructionMnemonic mnemonic)
 | 
					inline const char* VDEGetInstructionMnemonicString(ZyDisInstructionMnemonic mnemonic)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return instrMnemonicStrings[static_cast<uint16_t>(mnemonic)];
 | 
					    return instrMnemonicStrings[static_cast<uint16_t>(mnemonic)];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1716,14 +1716,14 @@ inline const char* VDEGetInstructionMnemonicString(VXInstructionMnemonic mnemoni
 | 
				
			||||||
 * @param   operandSize The defined operand size.
 | 
					 * @param   operandSize The defined operand size.
 | 
				
			||||||
 * @return  The the numeric value for the simple operand size definition.
 | 
					 * @return  The the numeric value for the simple operand size definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline uint16_t VDEGetSimpleOperandSize(VXDefinedOperandSize operandSize)
 | 
					inline uint16_t VDEGetSimpleOperandSize(ZyDisDefinedOperandSize operandSize)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    static uint16_t operandSizes[8] =
 | 
					    static uint16_t operandSizes[8] =
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        8, 16, 32, 64, 80, 12, 128, 256
 | 
					        8, 16, 32, 64, 80, 12, 128, 256
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    uint16_t index = 
 | 
					    uint16_t index = 
 | 
				
			||||||
        static_cast<uint8_t>(operandSize) - static_cast<uint8_t>(VXDefinedOperandSize::B);
 | 
					        static_cast<uint8_t>(operandSize) - static_cast<uint8_t>(ZyDisDefinedOperandSize::B);
 | 
				
			||||||
    assert(index < 8);
 | 
					    assert(index < 8);
 | 
				
			||||||
    return operandSizes[index];
 | 
					    return operandSizes[index];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1733,9 +1733,9 @@ inline uint16_t VDEGetSimpleOperandSize(VXDefinedOperandSize operandSize)
 | 
				
			||||||
 * @param   operandSize The defined operand size.
 | 
					 * @param   operandSize The defined operand size.
 | 
				
			||||||
 * @return  The memory-size part of the operand size definition.
 | 
					 * @return  The memory-size part of the operand size definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline VXDefinedOperandSize VDEGetComplexOperandMemSize(VXDefinedOperandSize operandSize)
 | 
					inline ZyDisDefinedOperandSize VDEGetComplexOperandMemSize(ZyDisDefinedOperandSize operandSize)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return static_cast<VXDefinedOperandSize>(static_cast<uint8_t>(operandSize) & 0x0F);
 | 
					    return static_cast<ZyDisDefinedOperandSize>(static_cast<uint8_t>(operandSize) & 0x0F);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -1743,9 +1743,9 @@ inline VXDefinedOperandSize VDEGetComplexOperandMemSize(VXDefinedOperandSize ope
 | 
				
			||||||
 * @param   operandSize The defined operand size.
 | 
					 * @param   operandSize The defined operand size.
 | 
				
			||||||
 * @return  The register-size part of the operand size definition.
 | 
					 * @return  The register-size part of the operand size definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
inline VXDefinedOperandSize VDEGetComplexOperandRegSize(VXDefinedOperandSize operandSize)
 | 
					inline ZyDisDefinedOperandSize VDEGetComplexOperandRegSize(ZyDisDefinedOperandSize operandSize)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return static_cast<VXDefinedOperandSize>((static_cast<uint8_t>(operandSize) >> 4) & 0x0F);    
 | 
					    return static_cast<ZyDisDefinedOperandSize>((static_cast<uint8_t>(operandSize) >> 4) & 0x0F);    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -44,42 +44,42 @@ endif ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Library
 | 
					# Library
 | 
				
			||||||
set(vde_headers
 | 
					set(vde_headers
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXDisassembler.h"
 | 
					    "VerteronDisassemblerEngine/ZyDisDisassembler.h"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXDisassemblerTypes.h"
 | 
					    "VerteronDisassemblerEngine/ZyDisDisassemblerTypes.h"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXDisassemblerUtils.h"
 | 
					    "VerteronDisassemblerEngine/ZyDisDisassemblerUtils.h"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXInstructionDecoder.h"
 | 
					    "VerteronDisassemblerEngine/ZyDisInstructionDecoder.h"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXInstructionFormatter.h"
 | 
					    "VerteronDisassemblerEngine/ZyDisInstructionFormatter.h"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXOpcodeTable.h"
 | 
					    "VerteronDisassemblerEngine/ZyDisOpcodeTable.h"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXOpcodeTableInternal.h"
 | 
					    "VerteronDisassemblerEngine/ZyDisOpcodeTableInternal.h"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXInternalHelpers.h"
 | 
					    "VerteronDisassemblerEngine/ZyDisInternalHelpers.h"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXInternalConfig.h")
 | 
					    "VerteronDisassemblerEngine/ZyDisInternalConfig.h")
 | 
				
			||||||
set(vde_sources
 | 
					set(vde_sources
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXDisassemblerUtils.c"
 | 
					    "VerteronDisassemblerEngine/ZyDisDisassemblerUtils.c"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXInstructionFormatter.c"
 | 
					    "VerteronDisassemblerEngine/ZyDisInstructionFormatter.c"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXOpcodeTable.c"
 | 
					    "VerteronDisassemblerEngine/ZyDisOpcodeTable.c"
 | 
				
			||||||
    "VerteronDisassemblerEngine/VXInstructionDecoder.c")
 | 
					    "VerteronDisassemblerEngine/ZyDisInstructionDecoder.c")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_library("VerteronDisassemblerEngine" ${vde_headers} ${vde_sources})
 | 
					add_library("VerteronDisassemblerEngine" ${vde_headers} ${vde_sources})
 | 
				
			||||||
generate_export_header(
 | 
					generate_export_header(
 | 
				
			||||||
    "VerteronDisassemblerEngine" 
 | 
					    "VerteronDisassemblerEngine" 
 | 
				
			||||||
    BASE_NAME "VX"
 | 
					    BASE_NAME "ZyDis"
 | 
				
			||||||
    EXPORT_FILE_NAME "VXExportConfig.h")
 | 
					    EXPORT_FILE_NAME "ZyDisExportConfig.h")
 | 
				
			||||||
include_directories(${PROJECT_BINARY_DIR})
 | 
					include_directories(${PROJECT_BINARY_DIR})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# C++ bindings
 | 
					# C++ bindings
 | 
				
			||||||
if (BUILD_CPP_BINDINGS)
 | 
					if (BUILD_CPP_BINDINGS)
 | 
				
			||||||
    set(vdecpp_headers
 | 
					    set(vdecpp_headers
 | 
				
			||||||
        "Bindings/Cpp/VXDisassembler.hpp"
 | 
					        "Bindings/Cpp/ZyDisDisassembler.hpp"
 | 
				
			||||||
        "Bindings/Cpp/VXDisassemblerTypes.hpp"
 | 
					        "Bindings/Cpp/ZyDisDisassemblerTypes.hpp"
 | 
				
			||||||
        "Bindings/Cpp/VXDisassemblerUtils.hpp"
 | 
					        "Bindings/Cpp/ZyDisDisassemblerUtils.hpp"
 | 
				
			||||||
        "Bindings/Cpp/VXInstructionDecoder.hpp"
 | 
					        "Bindings/Cpp/ZyDisInstructionDecoder.hpp"
 | 
				
			||||||
        "Bindings/Cpp/VXInstructionFormatter.hpp"
 | 
					        "Bindings/Cpp/ZyDisInstructionFormatter.hpp"
 | 
				
			||||||
        "Bindings/Cpp/VXOpcodeTable.hpp")
 | 
					        "Bindings/Cpp/ZyDisOpcodeTable.hpp")
 | 
				
			||||||
    set(vdecpp_sources
 | 
					    set(vdecpp_sources
 | 
				
			||||||
        "Bindings/Cpp/VXDisassemblerUtils.cpp"
 | 
					        "Bindings/Cpp/ZyDisDisassemblerUtils.cpp"
 | 
				
			||||||
        "Bindings/Cpp/VXInstructionFormatter.cpp"
 | 
					        "Bindings/Cpp/ZyDisInstructionFormatter.cpp"
 | 
				
			||||||
        "Bindings/Cpp/VXOpcodeTable.cpp"
 | 
					        "Bindings/Cpp/ZyDisOpcodeTable.cpp"
 | 
				
			||||||
        "Bindings/Cpp/VXInstructionDecoder.cpp")
 | 
					        "Bindings/Cpp/ZyDisInstructionDecoder.cpp")
 | 
				
			||||||
    add_library("VerteronDisassemblerEngineCpp" ${vdecpp_headers} ${vdecpp_sources})
 | 
					    add_library("VerteronDisassemblerEngineCpp" ${vdecpp_headers} ${vdecpp_sources})
 | 
				
			||||||
    target_link_libraries("VerteronDisassemblerEngineCpp" "VerteronDisassemblerEngine")
 | 
					    target_link_libraries("VerteronDisassemblerEngineCpp" "VerteronDisassemblerEngine")
 | 
				
			||||||
endif ()
 | 
					endif ()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@
 | 
				
			||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
#include <iomanip>
 | 
					#include <iomanip>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <VXDisassembler.hpp>
 | 
					#include <ZyDisDisassembler.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using namespace Verteron;
 | 
					using namespace Verteron;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,11 +30,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <VXDisassembler.h>
 | 
					#include <ZyDisDisassembler.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char* argv[])
 | 
					int main(int argc, char* argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VX_UNUSED(argc); VX_UNUSED(argv);
 | 
					    ZYDIS_UNUSED(argc); ZYDIS_UNUSED(argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO:
 | 
					    // TODO:
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,11 +30,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <VXDisassembler.h>
 | 
					#include <ZyDisDisassembler.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char* argv[])
 | 
					int main(int argc, char* argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VX_UNUSED(argc); VX_UNUSED(argv);
 | 
					    ZYDIS_UNUSED(argc); ZYDIS_UNUSED(argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO:
 | 
					    // TODO:
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <VXDisassembler.h>
 | 
					#include <ZyDisDisassembler.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
| 
						 | 
					@ -64,24 +64,24 @@ int main()
 | 
				
			||||||
        0x5F, 0x41, 0x5E, 0x41, 0x5D, 0x41, 0x5C, 0x5F, 0xC3    
 | 
					        0x5F, 0x41, 0x5E, 0x41, 0x5D, 0x41, 0x5C, 0x5F, 0xC3    
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VXInstructionInfo info;
 | 
					    ZyDisInstructionInfo info;
 | 
				
			||||||
    VXInstructionDecoderContext* decoder = NULL;
 | 
					    ZyDisInstructionDecoderContext* decoder = NULL;
 | 
				
			||||||
    VXBaseInstructionFormatterContext* formatter = NULL;
 | 
					    ZyDisBaseInstructionFormatterContext* formatter = NULL;
 | 
				
			||||||
    VXBaseDataSourceContext* input32 = NULL;
 | 
					    ZyDisBaseDataSourceContext* input32 = NULL;
 | 
				
			||||||
    VXBaseDataSourceContext* input64 = NULL;
 | 
					    ZyDisBaseDataSourceContext* input64 = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    decoder = VXInstructionDecoder_Create();
 | 
					    decoder = ZyDisInstructionDecoder_Create();
 | 
				
			||||||
    formatter = VXIntelInstructionFormatter_Create();
 | 
					    formatter = ZyDisIntelInstructionFormatter_Create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    input32 = VXMemoryDataSource_Create(&data32[0], sizeof(data32));
 | 
					    input32 = ZyDisMemoryDataSource_Create(&data32[0], sizeof(data32));
 | 
				
			||||||
    input64 = VXMemoryDataSource_Create(&data64[0], sizeof(data64));
 | 
					    input64 = ZyDisMemoryDataSource_Create(&data64[0], sizeof(data64));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VXInstructionDecoder_SetDisassemblerMode(decoder, DM_M32BIT);
 | 
					    ZyDisInstructionDecoder_SetDisassemblerMode(decoder, DM_M32BIT);
 | 
				
			||||||
    VXInstructionDecoder_SetDataSource(decoder, input32);
 | 
					    ZyDisInstructionDecoder_SetDataSource(decoder, input32);
 | 
				
			||||||
    VXInstructionDecoder_SetInstructionPointer(decoder, 0x77091852);
 | 
					    ZyDisInstructionDecoder_SetInstructionPointer(decoder, 0x77091852);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    puts("32 bit test ...\n\n");
 | 
					    puts("32 bit test ...\n\n");
 | 
				
			||||||
    while (VXInstructionDecoder_DecodeInstruction(decoder, &info))
 | 
					    while (ZyDisInstructionDecoder_DecodeInstruction(decoder, &info))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        printf("%08X ", (uint32_t)(info.instrAddress & 0xFFFFFFFF));
 | 
					        printf("%08X ", (uint32_t)(info.instrAddress & 0xFFFFFFFF));
 | 
				
			||||||
        if (info.flags & IF_ERROR_MASK)
 | 
					        if (info.flags & IF_ERROR_MASK)
 | 
				
			||||||
| 
						 | 
					@ -90,17 +90,17 @@ int main()
 | 
				
			||||||
        } 
 | 
					        } 
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            printf("%s\n", VXBaseInstructionFormatter_FormatInstruction(formatter, &info));
 | 
					            printf("%s\n", ZyDisBaseInstructionFormatter_FormatInstruction(formatter, &info));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    puts("\n");
 | 
					    puts("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VXInstructionDecoder_SetDisassemblerMode(decoder, DM_M64BIT);
 | 
					    ZyDisInstructionDecoder_SetDisassemblerMode(decoder, DM_M64BIT);
 | 
				
			||||||
    VXInstructionDecoder_SetDataSource(decoder, input64);
 | 
					    ZyDisInstructionDecoder_SetDataSource(decoder, input64);
 | 
				
			||||||
    VXInstructionDecoder_SetInstructionPointer(decoder, 0x00007FFA39A81930ull);
 | 
					    ZyDisInstructionDecoder_SetInstructionPointer(decoder, 0x00007FFA39A81930ull);
 | 
				
			||||||
    puts("64 bit test ...\n\n");
 | 
					    puts("64 bit test ...\n\n");
 | 
				
			||||||
    while (VXInstructionDecoder_DecodeInstruction(decoder, &info))
 | 
					    while (ZyDisInstructionDecoder_DecodeInstruction(decoder, &info))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        printf("%016llX ", info.instrAddress); 
 | 
					        printf("%016llX ", info.instrAddress); 
 | 
				
			||||||
        if (info.flags & IF_ERROR_MASK)
 | 
					        if (info.flags & IF_ERROR_MASK)
 | 
				
			||||||
| 
						 | 
					@ -109,14 +109,14 @@ int main()
 | 
				
			||||||
        } 
 | 
					        } 
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            printf("%s\n", VXBaseInstructionFormatter_FormatInstruction(formatter, &info));
 | 
					            printf("%s\n", ZyDisBaseInstructionFormatter_FormatInstruction(formatter, &info));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    VXBaseDataSource_Release(input32);
 | 
					    ZyDisBaseDataSource_Release(input32);
 | 
				
			||||||
    VXBaseDataSource_Release(input64);
 | 
					    ZyDisBaseDataSource_Release(input64);
 | 
				
			||||||
    VXBaseInstructionFormatter_Release(formatter);
 | 
					    ZyDisBaseInstructionFormatter_Release(formatter);
 | 
				
			||||||
    VXInstructionDecoder_Release(decoder);
 | 
					    ZyDisInstructionDecoder_Release(decoder);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getchar();
 | 
					    getchar();
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,12 +30,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <VXDisassembler.h>
 | 
					#include <ZyDisDisassembler.h>
 | 
				
			||||||
#include <Windows.h>
 | 
					#include <Windows.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char* argv[])
 | 
					int main(int argc, char* argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VX_UNUSED(argc); VX_UNUSED(argv);
 | 
					    ZYDIS_UNUSED(argc); ZYDIS_UNUSED(argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO: port to C
 | 
					    // TODO: port to C
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
| 
						 | 
					@ -57,14 +57,14 @@ int main(int argc, char* argv[])
 | 
				
			||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // Initialize disassembler
 | 
					    // Initialize disassembler
 | 
				
			||||||
    VXInstructionInfo info;
 | 
					    ZyDisInstructionInfo info;
 | 
				
			||||||
    VXInstructionDecoder decoder;
 | 
					    ZyDisInstructionDecoder decoder;
 | 
				
			||||||
    VXExactSymbolResolver resolver;
 | 
					    ZyDisExactSymbolResolver resolver;
 | 
				
			||||||
    VXIntelInstructionFormatter formatter;
 | 
					    ZyDisIntelInstructionFormatter formatter;
 | 
				
			||||||
#ifdef _M_X64
 | 
					#ifdef _M_X64
 | 
				
			||||||
    decoder.setDisassemblerMode(VXDisassemblerMode::M64BIT);
 | 
					    decoder.setDisassemblerMode(ZyDisDisassemblerMode::M64BIT);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    decoder.setDisassemblerMode(VXDisassemblerMode::M32BIT);
 | 
					    decoder.setDisassemblerMode(ZyDisDisassemblerMode::M32BIT);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    formatter.setSymbolResolver(&resolver);
 | 
					    formatter.setSymbolResolver(&resolver);
 | 
				
			||||||
    // Initialize output stream
 | 
					    // Initialize output stream
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,7 @@ int main(int argc, char* argv[])
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (sectionHeader->Characteristics & IMAGE_SCN_CNT_CODE)
 | 
					        if (sectionHeader->Characteristics & IMAGE_SCN_CNT_CODE)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            VXMemoryDataSource input(reinterpret_cast<const void*>(
 | 
					            ZyDisMemoryDataSource input(reinterpret_cast<const void*>(
 | 
				
			||||||
                baseAddress + sectionHeader->VirtualAddress), sectionHeader->SizeOfRawData);
 | 
					                baseAddress + sectionHeader->VirtualAddress), sectionHeader->SizeOfRawData);
 | 
				
			||||||
            decoder.setDataSource(&input);
 | 
					            decoder.setDataSource(&input);
 | 
				
			||||||
            decoder.setInstructionPointer(baseAddress + sectionHeader->VirtualAddress);
 | 
					            decoder.setInstructionPointer(baseAddress + sectionHeader->VirtualAddress);
 | 
				
			||||||
| 
						 | 
					@ -94,31 +94,31 @@ int main(int argc, char* argv[])
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                switch (info.mnemonic)
 | 
					                switch (info.mnemonic)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                case VXInstructionMnemonic::CALL:
 | 
					                case ZyDisInstructionMnemonic::CALL:
 | 
				
			||||||
                    resolver.setSymbol(VDECalcAbsoluteTarget(info, info.operand[0]), 
 | 
					                    resolver.setSymbol(VDECalcAbsoluteTarget(info, info.operand[0]), 
 | 
				
			||||||
                        std::string("sub_" + std::to_string(subCount)).c_str());
 | 
					                        std::string("sub_" + std::to_string(subCount)).c_str());
 | 
				
			||||||
                    subCount++;
 | 
					                    subCount++;
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                case VXInstructionMnemonic::JMP:
 | 
					                case ZyDisInstructionMnemonic::JMP:
 | 
				
			||||||
                case VXInstructionMnemonic::JO:
 | 
					                case ZyDisInstructionMnemonic::JO:
 | 
				
			||||||
                case VXInstructionMnemonic::JNO:
 | 
					                case ZyDisInstructionMnemonic::JNO:
 | 
				
			||||||
                case VXInstructionMnemonic::JB:
 | 
					                case ZyDisInstructionMnemonic::JB:
 | 
				
			||||||
                case VXInstructionMnemonic::JNB:
 | 
					                case ZyDisInstructionMnemonic::JNB:
 | 
				
			||||||
                case VXInstructionMnemonic::JE:
 | 
					                case ZyDisInstructionMnemonic::JE:
 | 
				
			||||||
                case VXInstructionMnemonic::JNE:
 | 
					                case ZyDisInstructionMnemonic::JNE:
 | 
				
			||||||
                case VXInstructionMnemonic::JBE:
 | 
					                case ZyDisInstructionMnemonic::JBE:
 | 
				
			||||||
                case VXInstructionMnemonic::JA:
 | 
					                case ZyDisInstructionMnemonic::JA:
 | 
				
			||||||
                case VXInstructionMnemonic::JS:
 | 
					                case ZyDisInstructionMnemonic::JS:
 | 
				
			||||||
                case VXInstructionMnemonic::JNS:
 | 
					                case ZyDisInstructionMnemonic::JNS:
 | 
				
			||||||
                case VXInstructionMnemonic::JP:
 | 
					                case ZyDisInstructionMnemonic::JP:
 | 
				
			||||||
                case VXInstructionMnemonic::JNP:
 | 
					                case ZyDisInstructionMnemonic::JNP:
 | 
				
			||||||
                case VXInstructionMnemonic::JL:
 | 
					                case ZyDisInstructionMnemonic::JL:
 | 
				
			||||||
                case VXInstructionMnemonic::JGE:
 | 
					                case ZyDisInstructionMnemonic::JGE:
 | 
				
			||||||
                case VXInstructionMnemonic::JLE:
 | 
					                case ZyDisInstructionMnemonic::JLE:
 | 
				
			||||||
                case VXInstructionMnemonic::JG:
 | 
					                case ZyDisInstructionMnemonic::JG:
 | 
				
			||||||
                case VXInstructionMnemonic::JCXZ:
 | 
					                case ZyDisInstructionMnemonic::JCXZ:
 | 
				
			||||||
                case VXInstructionMnemonic::JECXZ:
 | 
					                case ZyDisInstructionMnemonic::JECXZ:
 | 
				
			||||||
                case VXInstructionMnemonic::JRCXZ:
 | 
					                case ZyDisInstructionMnemonic::JRCXZ:
 | 
				
			||||||
                    resolver.setSymbol(VDECalcAbsoluteTarget(info, info.operand[0]), 
 | 
					                    resolver.setSymbol(VDECalcAbsoluteTarget(info, info.operand[0]), 
 | 
				
			||||||
                        std::string("loc_" + std::to_string(locCount)).c_str());
 | 
					                        std::string("loc_" + std::to_string(locCount)).c_str());
 | 
				
			||||||
                    locCount++;
 | 
					                    locCount++;
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,7 @@ int main(int argc, char* argv[])
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (sectionHeader->Characteristics & IMAGE_SCN_CNT_CODE)
 | 
					        if (sectionHeader->Characteristics & IMAGE_SCN_CNT_CODE)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            VXMemoryDataSource input(reinterpret_cast<const void*>(
 | 
					            ZyDisMemoryDataSource input(reinterpret_cast<const void*>(
 | 
				
			||||||
                baseAddress + sectionHeader->VirtualAddress), sectionHeader->SizeOfRawData);
 | 
					                baseAddress + sectionHeader->VirtualAddress), sectionHeader->SizeOfRawData);
 | 
				
			||||||
            decoder.setDataSource(&input);
 | 
					            decoder.setDataSource(&input);
 | 
				
			||||||
            decoder.setInstructionPointer(baseAddress + sectionHeader->VirtualAddress);
 | 
					            decoder.setInstructionPointer(baseAddress + sectionHeader->VirtualAddress);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,197 +0,0 @@
 | 
				
			||||||
/**************************************************************************************************
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Verteron Disassembler Engine
 | 
					 | 
				
			||||||
  Version 1.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Remarks         : Freeware, Copyright must be included
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Original Author : athre0z
 | 
					 | 
				
			||||||
  Modifications   : 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Last change     : 19. March 2015
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 * 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 _VDE_VXINTERNALHELPERS_H_
 | 
					 | 
				
			||||||
#define _VDE_VXINTERNALHELPERS_H_
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "VXInstructionDecoder.h"
 | 
					 | 
				
			||||||
#include "VXInstructionFormatter.h"
 | 
					 | 
				
			||||||
#include "VXInternalConfig.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <assert.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Types IDs =================================================================================== */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef enum _VXTypeId
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    TYPE_BASEDATASOURCE,
 | 
					 | 
				
			||||||
    TYPE_MEMORYDATASOURCE,
 | 
					 | 
				
			||||||
    TYPE_CUSTOMDATASOURCE,
 | 
					 | 
				
			||||||
    TYPE_INSTRUCTIONDECODER,
 | 
					 | 
				
			||||||
    TYPE_BASESYMBOLRESOLVER,
 | 
					 | 
				
			||||||
    TYPE_CUSTOMSYMBOLRESOLVER,
 | 
					 | 
				
			||||||
    TYPE_BASEINSTRUCTIONFORMATTER,
 | 
					 | 
				
			||||||
    TYPE_INTELINSTRUCTIONFORMATTER,
 | 
					 | 
				
			||||||
    TYPE_CUSTOMINSTRUCTIONFORMATTER,
 | 
					 | 
				
			||||||
} VXTypeId;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Context conversion helpers ================================================================== */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXBaseDataSource* VXBaseDataSource_thiz(
 | 
					 | 
				
			||||||
    VXBaseDataSourceContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_BASEDATASOURCE 
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_MEMORYDATASOURCE
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_CUSTOMDATASOURCE);
 | 
					 | 
				
			||||||
    return (struct _VXBaseDataSource*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXBaseDataSource* VXBaseDataSource_cthiz(
 | 
					 | 
				
			||||||
    const VXBaseDataSourceContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_BASEDATASOURCE 
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_MEMORYDATASOURCE
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_CUSTOMDATASOURCE);
 | 
					 | 
				
			||||||
    return (const struct _VXBaseDataSource*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXMemoryDataSource* VXMemoryDataSource_thiz(
 | 
					 | 
				
			||||||
    VXBaseDataSourceContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_MEMORYDATASOURCE);
 | 
					 | 
				
			||||||
    return (struct _VXMemoryDataSource*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXMemoryDataSource* VXMemoryDataSource_cthiz(
 | 
					 | 
				
			||||||
    const VXBaseDataSourceContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_MEMORYDATASOURCE);
 | 
					 | 
				
			||||||
    return (const struct _VXMemoryDataSource*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXCustomDataSource* VXCustomDataSource_thiz(
 | 
					 | 
				
			||||||
    VXBaseDataSourceContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_CUSTOMDATASOURCE);
 | 
					 | 
				
			||||||
    return (struct _VXCustomDataSource*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXCustomDataSource* VXCustomDataSource_cthiz(
 | 
					 | 
				
			||||||
    const VXBaseDataSourceContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_CUSTOMDATASOURCE);
 | 
					 | 
				
			||||||
    return (const struct _VXCustomDataSource*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXInstructionDecoder* VXInstructionDecoder_thiz(
 | 
					 | 
				
			||||||
    VXInstructionDecoderContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_INSTRUCTIONDECODER);
 | 
					 | 
				
			||||||
    return (struct _VXInstructionDecoder*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXInstructionDecoder* VXInstructionDecoder_cthiz(
 | 
					 | 
				
			||||||
    const VXInstructionDecoderContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_INSTRUCTIONDECODER);
 | 
					 | 
				
			||||||
    return (const struct _VXInstructionDecoder*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXBaseSymbolResolver* VXBaseSymbolResolver_thiz(
 | 
					 | 
				
			||||||
    VXBaseSymbolResolverContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_BASESYMBOLRESOLVER
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_CUSTOMSYMBOLRESOLVER);
 | 
					 | 
				
			||||||
    return (struct _VXBaseSymbolResolver*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXBaseSymbolResolver* VXBaseSymbolResolver_cthiz(
 | 
					 | 
				
			||||||
    const VXBaseSymbolResolverContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_BASESYMBOLRESOLVER
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_CUSTOMSYMBOLRESOLVER);
 | 
					 | 
				
			||||||
    return (const struct _VXBaseSymbolResolver*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXCustomSymbolResolver* VXCustomSymbolResolver_thiz(
 | 
					 | 
				
			||||||
    VXBaseSymbolResolverContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_CUSTOMSYMBOLRESOLVER);
 | 
					 | 
				
			||||||
    return (struct _VXCustomSymbolResolver*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXCustomSymbolResolver* VXCustomSymbolResolver_cthiz(
 | 
					 | 
				
			||||||
    const VXBaseSymbolResolverContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_CUSTOMSYMBOLRESOLVER);
 | 
					 | 
				
			||||||
    return (const struct _VXCustomSymbolResolver*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXBaseInstructionFormatter* VXBaseInstructionFormatter_thiz(
 | 
					 | 
				
			||||||
    VXBaseInstructionFormatterContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_BASEINSTRUCTIONFORMATTER 
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_INTELINSTRUCTIONFORMATTER
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_CUSTOMINSTRUCTIONFORMATTER);
 | 
					 | 
				
			||||||
    return (struct _VXBaseInstructionFormatter*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXBaseInstructionFormatter* VXBaseInstructionFormatter_cthiz(
 | 
					 | 
				
			||||||
    const VXBaseInstructionFormatterContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_BASEINSTRUCTIONFORMATTER
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_INTELINSTRUCTIONFORMATTER
 | 
					 | 
				
			||||||
        || ctx->d.type == TYPE_CUSTOMINSTRUCTIONFORMATTER);
 | 
					 | 
				
			||||||
    return (const struct _VXBaseInstructionFormatter*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXIntelInstructionFormatter* VXIntelInstructionFormatter_thiz(
 | 
					 | 
				
			||||||
    VXBaseInstructionFormatterContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_INTELINSTRUCTIONFORMATTER);
 | 
					 | 
				
			||||||
    return (struct _VXIntelInstructionFormatter*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXIntelInstructionFormatter* VXIntelInstructionFormatter_cthiz(
 | 
					 | 
				
			||||||
    const VXBaseInstructionFormatterContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_INTELINSTRUCTIONFORMATTER);
 | 
					 | 
				
			||||||
    return (const struct _VXIntelInstructionFormatter*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE struct _VXCustomInstructionFormatter* VXCustomInstructionFormatter_thiz(
 | 
					 | 
				
			||||||
    VXBaseInstructionFormatterContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_CUSTOMINSTRUCTIONFORMATTER);
 | 
					 | 
				
			||||||
    return (struct _VXCustomInstructionFormatter*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
VX_INLINE const struct _VXCustomInstructionFormatter* VXCustomInstructionFormatter_cthiz(
 | 
					 | 
				
			||||||
    const VXBaseInstructionFormatterContext *ctx)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    assert(ctx->d.type == TYPE_CUSTOMINSTRUCTIONFORMATTER);
 | 
					 | 
				
			||||||
    return (struct _VXCustomInstructionFormatter*)ctx->d.ptr;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* ============================================================================================= */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif /* _VDE_VXINTERNALHELPERS_H_ */
 | 
					 | 
				
			||||||
| 
						 | 
					@ -30,12 +30,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 **************************************************************************************************/
 | 
					 **************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _VDE_VXDISASSEMBLERC_H_
 | 
					#ifndef _VDE_ZyDisDISASSEMBLERC_H_
 | 
				
			||||||
#define _VDE_VXDISASSEMBLERC_H_
 | 
					#define _VDE_ZyDisDISASSEMBLERC_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "VXDisassemblerTypes.h"
 | 
					#include "ZyDisDisassemblerTypes.h"
 | 
				
			||||||
#include "VXInstructionDecoder.h"
 | 
					#include "ZyDisInstructionDecoder.h"
 | 
				
			||||||
#include "VXInstructionFormatter.h"
 | 
					#include "ZyDisInstructionFormatter.h"
 | 
				
			||||||
#include "VXDisassemblerUtils.h"
 | 
					#include "ZyDisDisassemblerUtils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* _VDE_VXDISASSEMBLERC_H_ */
 | 
					#endif /* _VDE_ZyDisDISASSEMBLERC_H_ */
 | 
				
			||||||
| 
						 | 
					@ -30,12 +30,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _VDE_VXDISASSEMBLERTYPESC_H_
 | 
					#ifndef _VDE_ZyDisDISASSEMBLERTYPESC_H_
 | 
				
			||||||
#define _VDE_VXDISASSEMBLERTYPESC_H_
 | 
					#define _VDE_ZyDisDISASSEMBLERTYPESC_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
#include "VXOpcodeTable.h"
 | 
					#include "ZyDisOpcodeTable.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C"
 | 
					extern "C"
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,7 @@ extern "C"
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent additional flags of a decoded instruction.
 | 
					 * @brief   Values that represent additional flags of a decoded instruction.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXInstructionFlags /* : uint32_t */
 | 
					typedef enum _ZyDisInstructionFlags /* : uint32_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    IF_NONE                         = 0x00000000,
 | 
					    IF_NONE                         = 0x00000000,
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -130,12 +130,12 @@ typedef enum _VXInstructionFlags /* : uint32_t */
 | 
				
			||||||
    IF_ERROR_OPERAND                = 0x01000000,
 | 
					    IF_ERROR_OPERAND                = 0x01000000,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IF_FORCE_DWORD                  = 0x7FFFFFFF
 | 
					    IF_FORCE_DWORD                  = 0x7FFFFFFF
 | 
				
			||||||
} VXInstructionFlags;
 | 
					} ZyDisInstructionFlags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent a cpu register.
 | 
					 * @brief   Values that represent a cpu register.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXRegister /* : uint16_t */
 | 
					typedef enum _ZyDisRegister /* : uint16_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    REG_NONE,
 | 
					    REG_NONE,
 | 
				
			||||||
    /* 8 bit general purpose registers */
 | 
					    /* 8 bit general purpose registers */
 | 
				
			||||||
| 
						 | 
					@ -192,12 +192,12 @@ typedef enum _VXRegister /* : uint16_t */
 | 
				
			||||||
    REG_RIP,
 | 
					    REG_RIP,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REG_FORCE_WORD = 0x7FFF
 | 
					    REG_FORCE_WORD = 0x7FFF
 | 
				
			||||||
} VXRegister;
 | 
					} ZyDisRegister;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the type of a decoded operand.
 | 
					 * @brief   Values that represent the type of a decoded operand.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXOperandType /*: uint8_t*/
 | 
					typedef enum _ZyDisOperandType /*: uint8_t*/
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The operand is not used.
 | 
					     * @brief   The operand is not used.
 | 
				
			||||||
| 
						 | 
					@ -227,12 +227,12 @@ typedef enum _VXOperandType /*: uint8_t*/
 | 
				
			||||||
     * @brief   The operand is a constant value.
 | 
					     * @brief   The operand is a constant value.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    OPTYPE_CONSTANT
 | 
					    OPTYPE_CONSTANT
 | 
				
			||||||
} VXOperandType;
 | 
					} ZyDisOperandType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the operand access mode.
 | 
					 * @brief   Values that represent the operand access mode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXOperandAccessMode /* : uint8_t */
 | 
					typedef enum _ZyDisOperandAccessMode /* : uint8_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    OPACCESSMODE_NA,
 | 
					    OPACCESSMODE_NA,
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -247,16 +247,16 @@ typedef enum _VXOperandAccessMode /* : uint8_t */
 | 
				
			||||||
     * @brief   The operand is accessed in read-write mode.
 | 
					     * @brief   The operand is accessed in read-write mode.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    OPACCESSMODE_READWRITE
 | 
					    OPACCESSMODE_READWRITE
 | 
				
			||||||
} VXOperandAccessMode;
 | 
					} ZyDisOperandAccessMode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   This struct holds information about a decoded operand.
 | 
					 * @brief   This struct holds information about a decoded operand.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef struct _VXOperandInfo
 | 
					typedef struct _ZyDisOperandInfo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The type of the operand.
 | 
					     * @brief   The type of the operand.
 | 
				
			||||||
     * @see     VXOperandType
 | 
					     * @see     ZyDisOperandType
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint8_t type;
 | 
					    uint8_t type;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -265,17 +265,17 @@ typedef struct _VXOperandInfo
 | 
				
			||||||
    uint16_t size;
 | 
					    uint16_t size;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The operand access mode.
 | 
					     * @brief   The operand access mode.
 | 
				
			||||||
     * @see     VXOperandAccessMode
 | 
					     * @see     ZyDisOperandAccessMode
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint8_t access_mode;
 | 
					    uint8_t access_mode;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The base register.
 | 
					     * @brief   The base register.
 | 
				
			||||||
     * @see     VXRegister
 | 
					     * @see     ZyDisRegister
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint16_t base;
 | 
					    uint16_t base;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The index register.
 | 
					     * @brief   The index register.
 | 
				
			||||||
     * @see     VXRegister
 | 
					     * @see     ZyDisRegister
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint16_t index;
 | 
					    uint16_t index;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -308,12 +308,12 @@ typedef struct _VXOperandInfo
 | 
				
			||||||
            uint32_t off;
 | 
					            uint32_t off;
 | 
				
			||||||
        } ptr;
 | 
					        } ptr;
 | 
				
			||||||
    } lval;   
 | 
					    } lval;   
 | 
				
			||||||
} VXOperandInfo;
 | 
					} ZyDisOperandInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   This struct holds information about a decoded instruction.
 | 
					 * @brief   This struct holds information about a decoded instruction.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef struct _VXInstructionInfo
 | 
					typedef struct _ZyDisInstructionInfo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction flags.
 | 
					     * @brief   The instruction flags.
 | 
				
			||||||
| 
						 | 
					@ -321,7 +321,7 @@ typedef struct _VXInstructionInfo
 | 
				
			||||||
    uint32_t flags;
 | 
					    uint32_t flags;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction mnemonic.
 | 
					     * @brief   The instruction mnemonic.
 | 
				
			||||||
     * @see     VXInstructionMnemonic
 | 
					     * @see     ZyDisInstructionMnemonic
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint16_t mnemonic;
 | 
					    uint16_t mnemonic;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -351,11 +351,11 @@ typedef struct _VXInstructionInfo
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The decoded operands.
 | 
					     * @brief   The decoded operands.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXOperandInfo operand[4];
 | 
					    ZyDisOperandInfo operand[4];
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The segment register. This value will default to @c NONE, if no segment register 
 | 
					     * @brief   The segment register. This value will default to @c NONE, if no segment register 
 | 
				
			||||||
     *          prefix is present.
 | 
					     *          prefix is present.
 | 
				
			||||||
     * @see     VXRegister
 | 
					     * @see     ZyDisRegister
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint16_t segment;
 | 
					    uint16_t segment;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -527,7 +527,7 @@ typedef struct _VXInstructionInfo
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction definition.
 | 
					     * @brief   The instruction definition.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    const VXInstructionDefinition *instrDefinition;
 | 
					    const ZyDisInstructionDefinition *instrDefinition;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction address points to the current instruction (relative to the 
 | 
					     * @brief   The instruction address points to the current instruction (relative to the 
 | 
				
			||||||
     *          initial instruction pointer).
 | 
					     *          initial instruction pointer).
 | 
				
			||||||
| 
						 | 
					@ -539,10 +539,10 @@ typedef struct _VXInstructionInfo
 | 
				
			||||||
     *          This field is used to properly format relative instructions.         
 | 
					     *          This field is used to properly format relative instructions.         
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint64_t instrPointer;
 | 
					    uint64_t instrPointer;
 | 
				
			||||||
} VXInstructionInfo;
 | 
					} ZyDisInstructionInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* _VDE_VXDISASSEMBLERTYPESC_H_ */
 | 
					#endif /* _VDE_ZyDisDISASSEMBLERTYPESC_H_ */
 | 
				
			||||||
| 
						 | 
					@ -30,11 +30,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "VXDisassemblerUtils.h"
 | 
					#include "ZyDisDisassemblerUtils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint64_t VXCalcAbsoluteTarget(const VXInstructionInfo *info, const VXOperandInfo *operand)
 | 
					uint64_t ZyDisCalcAbsoluteTarget(const ZyDisInstructionInfo *info, const ZyDisOperandInfo *operand)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    assert((operand->type == OPTYPE_REL_IMMEDIATE) || 
 | 
					    assert((operand->type == OPTYPE_REL_IMMEDIATE) || 
 | 
				
			||||||
        ((operand->type == OPTYPE_MEMORY) && (operand->base == REG_RIP)));
 | 
					        ((operand->type == OPTYPE_MEMORY) && (operand->base == REG_RIP)));
 | 
				
			||||||
| 
						 | 
					@ -30,11 +30,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _VDE_VXDISASSEMBLERUTILSC_H_
 | 
					#ifndef _VDE_ZyDisDISASSEMBLERUTILSC_H_
 | 
				
			||||||
#define _VDE_VXDISASSEMBLERUTILSC_H_
 | 
					#define _VDE_ZyDisDISASSEMBLERUTILSC_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "VXDisassemblerTypes.h"
 | 
					#include "ZyDisDisassemblerTypes.h"
 | 
				
			||||||
#include "VXInternalConfig.h"
 | 
					#include "ZyDisInternalConfig.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,11 +44,11 @@ extern "C"
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _VXContextDescriptor
 | 
					typedef struct _ZyDisContextDescriptor
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    uint8_t type;
 | 
					    uint8_t type;
 | 
				
			||||||
    void *ptr;
 | 
					    void *ptr;
 | 
				
			||||||
} VXContextDescriptor;
 | 
					} ZyDisContextDescriptor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Calculates the absolute target address of a relative instruction operand.
 | 
					 * @brief   Calculates the absolute target address of a relative instruction operand.
 | 
				
			||||||
| 
						 | 
					@ -56,12 +56,12 @@ typedef struct _VXContextDescriptor
 | 
				
			||||||
 * @param   operand The operand.
 | 
					 * @param   operand The operand.
 | 
				
			||||||
 * @return  The absolute target address.
 | 
					 * @return  The absolute target address.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT uint64_t VXCalcAbsoluteTarget(
 | 
					ZYDIS_EXPORT uint64_t ZyDisCalcAbsoluteTarget(
 | 
				
			||||||
    const VXInstructionInfo *info, 
 | 
					    const ZyDisInstructionInfo *info, 
 | 
				
			||||||
    const VXOperandInfo *operand);
 | 
					    const ZyDisOperandInfo *operand);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* _VDE_VXDISASSEMBLERUTILSC_H_ */
 | 
					#endif /* _VDE_ZyDisDISASSEMBLERUTILSC_H_ */
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -30,11 +30,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _VDE_VXINSTRUCTIONDECODERC_H_
 | 
					#ifndef _VDE_ZyDisINSTRUCTIONDECODERC_H_
 | 
				
			||||||
#define _VDE_VXINSTRUCTIONDECODERC_H_
 | 
					#define _VDE_ZyDisINSTRUCTIONDECODERC_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "VXDisassemblerTypes.h"
 | 
					#include "ZyDisDisassemblerTypes.h"
 | 
				
			||||||
#include "VXDisassemblerUtils.h"
 | 
					#include "ZyDisDisassemblerUtils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
#include <stddef.h>
 | 
					#include <stddef.h>
 | 
				
			||||||
| 
						 | 
					@ -44,24 +44,24 @@ extern "C"
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXBaseDataSource ============================================================================ */
 | 
					/* ZyDisBaseDataSource ============================================================================ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _VXBaseDataSourceContext { VXContextDescriptor d; } VXBaseDataSourceContext;
 | 
					typedef struct _ZyDisBaseDataSourceContext { ZyDisContextDescriptor d; } ZyDisBaseDataSourceContext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef void(*VXBaseDataSource_DestructionCallback)(VXBaseDataSourceContext *ctx);
 | 
					typedef void(*ZyDisBaseDataSource_DestructionCallback)(ZyDisBaseDataSourceContext *ctx);
 | 
				
			||||||
typedef uint8_t(*VXBaseDataSource_InputCallback)(VXBaseDataSourceContext *ctx);
 | 
					typedef uint8_t(*ZyDisBaseDataSource_InputCallback)(ZyDisBaseDataSourceContext *ctx);
 | 
				
			||||||
typedef bool(*VXBaseDataSource_IsEndOfInputCallback)(const VXBaseDataSourceContext *ctx);
 | 
					typedef bool(*ZyDisBaseDataSource_IsEndOfInputCallback)(const ZyDisBaseDataSourceContext *ctx);
 | 
				
			||||||
typedef uint64_t(*VXBaseDataSource_GetPositionCallback)(const VXBaseDataSourceContext *ctx);
 | 
					typedef uint64_t(*ZyDisBaseDataSource_GetPositionCallback)(const ZyDisBaseDataSourceContext *ctx);
 | 
				
			||||||
typedef bool(*VXBaseDataSource_SetPositionCallback)(
 | 
					typedef bool(*ZyDisBaseDataSource_SetPositionCallback)(
 | 
				
			||||||
    VXBaseDataSourceContext *ctx, uint64_t position);
 | 
					    ZyDisBaseDataSourceContext *ctx, uint64_t position);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Releases a data source. 
 | 
					 * @brief Releases a data source. 
 | 
				
			||||||
 * @param ctx The context to release.
 | 
					 * @param ctx The context to release.
 | 
				
			||||||
 * The context may no longer be used after it was released.
 | 
					 * The context may no longer be used after it was released.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXBaseDataSource_Release(
 | 
					ZYDIS_EXPORT void ZyDisBaseDataSource_Release(
 | 
				
			||||||
    VXBaseDataSourceContext *ctx);
 | 
					    ZyDisBaseDataSourceContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Reads the next byte from the data source without altering the current input position 
 | 
					 * @brief   Reads the next byte from the data source without altering the current input position 
 | 
				
			||||||
| 
						 | 
					@ -72,9 +72,9 @@ VX_EXPORT void VXBaseDataSource_Release(
 | 
				
			||||||
 *          field of the @c info parameter for error flags. Possible error values are 
 | 
					 *          field of the @c info parameter for error flags. Possible error values are 
 | 
				
			||||||
 *          @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
					 *          @c IF_ERROR_END_OF_INPUT or @c IF_ERROR_LENGTH.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT uint8_t VXBaseDataSource_InputPeek(
 | 
					ZYDIS_EXPORT uint8_t ZyDisBaseDataSource_InputPeek(
 | 
				
			||||||
    VXBaseDataSourceContext *ctx, 
 | 
					    ZyDisBaseDataSourceContext *ctx, 
 | 
				
			||||||
    VXInstructionInfo *info);
 | 
					    ZyDisInstructionInfo *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  * @brief   Reads the next byte from the data source.
 | 
					  * @brief   Reads the next byte from the data source.
 | 
				
			||||||
| 
						 | 
					@ -87,30 +87,30 @@ VX_EXPORT uint8_t VXBaseDataSource_InputPeek(
 | 
				
			||||||
  * parameter. This function also appends the new byte to to @c data field of the @c info 
 | 
					  * parameter. This function also appends the new byte to to @c data field of the @c info 
 | 
				
			||||||
  * parameter.
 | 
					  * parameter.
 | 
				
			||||||
  */
 | 
					  */
 | 
				
			||||||
VX_EXPORT uint8_t VXBaseDataSource_InputNext8(
 | 
					ZYDIS_EXPORT uint8_t ZyDisBaseDataSource_InputNext8(
 | 
				
			||||||
    VXBaseDataSourceContext *ctx, 
 | 
					    ZyDisBaseDataSourceContext *ctx, 
 | 
				
			||||||
    VXInstructionInfo *info);
 | 
					    ZyDisInstructionInfo *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @copydoc VXBaseDataSource_InputNext8
 | 
					 * @copydoc ZyDisBaseDataSource_InputNext8
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT uint16_t VXBaseDataSource_InputNext16(
 | 
					ZYDIS_EXPORT uint16_t ZyDisBaseDataSource_InputNext16(
 | 
				
			||||||
    VXBaseDataSourceContext *ctx, 
 | 
					    ZyDisBaseDataSourceContext *ctx, 
 | 
				
			||||||
    VXInstructionInfo *info);
 | 
					    ZyDisInstructionInfo *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @copydoc VXBaseDataSource_InputNext8
 | 
					 * @copydoc ZyDisBaseDataSource_InputNext8
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT uint32_t VXBaseDataSource_InputNext32(
 | 
					ZYDIS_EXPORT uint32_t ZyDisBaseDataSource_InputNext32(
 | 
				
			||||||
    VXBaseDataSourceContext *ctx, 
 | 
					    ZyDisBaseDataSourceContext *ctx, 
 | 
				
			||||||
    VXInstructionInfo *info);
 | 
					    ZyDisInstructionInfo *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @copydoc VXBaseDataSource_InputNext8
 | 
					 * @copydoc ZyDisBaseDataSource_InputNext8
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT uint64_t VXBaseDataSource_InputNext64(
 | 
					ZYDIS_EXPORT uint64_t ZyDisBaseDataSource_InputNext64(
 | 
				
			||||||
    VXBaseDataSourceContext *ctx, 
 | 
					    ZyDisBaseDataSourceContext *ctx, 
 | 
				
			||||||
    VXInstructionInfo *info);
 | 
					    ZyDisInstructionInfo *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Returns the current input byte.
 | 
					 * @brief   Returns the current input byte.
 | 
				
			||||||
| 
						 | 
					@ -119,24 +119,24 @@ VX_EXPORT uint64_t VXBaseDataSource_InputNext64(
 | 
				
			||||||
 * The current input byte is set everytime the @c inputPeek or @c inputNext method is called.
 | 
					 * The current input byte is set everytime the @c inputPeek or @c inputNext method is called.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
// TODO: check long descr
 | 
					// TODO: check long descr
 | 
				
			||||||
VX_EXPORT uint8_t VXBaseDataSource_InputCurrent(
 | 
					ZYDIS_EXPORT uint8_t ZyDisBaseDataSource_InputCurrent(
 | 
				
			||||||
    const VXBaseDataSourceContext *ctx);
 | 
					    const ZyDisBaseDataSourceContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Queries if the end of the data source is reached.
 | 
					 * @brief   Queries if the end of the data source is reached.
 | 
				
			||||||
 * @param   ctx  The data soruce context.
 | 
					 * @param   ctx  The data soruce context.
 | 
				
			||||||
 * @return  @c true if end of input, @c false if not.
 | 
					 * @return  @c true if end of input, @c false if not.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT bool VXBaseDataSource_IsEndOfInput(
 | 
					ZYDIS_EXPORT bool ZyDisBaseDataSource_IsEndOfInput(
 | 
				
			||||||
    const VXBaseDataSourceContext *ctx);
 | 
					    const ZyDisBaseDataSourceContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Returns the current input position.
 | 
					 * @brief   Returns the current input position.
 | 
				
			||||||
 * @param   ctx  The data soruce context.
 | 
					 * @param   ctx  The data soruce context.
 | 
				
			||||||
 * @return  The current input position.
 | 
					 * @return  The current input position.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT uint64_t VXBaseDataSource_GetPosition(
 | 
					ZYDIS_EXPORT uint64_t ZyDisBaseDataSource_GetPosition(
 | 
				
			||||||
    const VXBaseDataSourceContext *ctx);
 | 
					    const ZyDisBaseDataSourceContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Sets a new input position.
 | 
					 * @brief   Sets a new input position.
 | 
				
			||||||
| 
						 | 
					@ -144,24 +144,24 @@ VX_EXPORT uint64_t VXBaseDataSource_GetPosition(
 | 
				
			||||||
 * @param   position    The new input position.
 | 
					 * @param   position    The new input position.
 | 
				
			||||||
 * @return  @c false if the new position exceeds the maximum input length.
 | 
					 * @return  @c false if the new position exceeds the maximum input length.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT bool VXBaseDataSource_SetPosition(
 | 
					ZYDIS_EXPORT bool ZyDisBaseDataSource_SetPosition(
 | 
				
			||||||
    VXBaseDataSourceContext *ctx, 
 | 
					    ZyDisBaseDataSourceContext *ctx, 
 | 
				
			||||||
    uint64_t position);
 | 
					    uint64_t position);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXMemoryDataSource ========================================================================== */
 | 
					/* ZyDisMemoryDataSource ========================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Creates a memory data source.
 | 
					 * @brief   Creates a memory data source.
 | 
				
			||||||
 * @param   buffer      The input buffer.
 | 
					 * @param   buffer      The input buffer.
 | 
				
			||||||
 * @param   bufferLen   THe length of the input buffer.
 | 
					 * @param   bufferLen   THe length of the input buffer.
 | 
				
			||||||
 * @return  @c NULL if it fails, else a data source context.
 | 
					 * @return  @c NULL if it fails, else a data source context.
 | 
				
			||||||
 * @see     VXBaseDataSource_Release
 | 
					 * @see     ZyDisBaseDataSource_Release
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXBaseDataSourceContext* VXMemoryDataSource_Create(
 | 
					ZYDIS_EXPORT ZyDisBaseDataSourceContext* ZyDisMemoryDataSource_Create(
 | 
				
			||||||
    const void* buffer,
 | 
					    const void* buffer,
 | 
				
			||||||
    size_t bufferLen);
 | 
					    size_t bufferLen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXCustomDataSource ========================================================================== */
 | 
					/* ZyDisCustomDataSource ========================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Creates a custom daat source.
 | 
					 * @brief   Creates a custom daat source.
 | 
				
			||||||
| 
						 | 
					@ -173,52 +173,52 @@ VX_EXPORT VXBaseDataSourceContext* VXMemoryDataSource_Create(
 | 
				
			||||||
 * @param   setPositionCb   The callback setting the current input position.
 | 
					 * @param   setPositionCb   The callback setting the current input position.
 | 
				
			||||||
 * @param   destructionCb   The destruction callback. May be @c NULL.
 | 
					 * @param   destructionCb   The destruction callback. May be @c NULL.
 | 
				
			||||||
 * @return  @c NULL if it fails, else a data source context.
 | 
					 * @return  @c NULL if it fails, else a data source context.
 | 
				
			||||||
 * @see     VXBaseDataSource_Release
 | 
					 * @see     ZyDisBaseDataSource_Release
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXBaseDataSourceContext* VXCustomDataSource_Create(
 | 
					ZYDIS_EXPORT ZyDisBaseDataSourceContext* ZyDisCustomDataSource_Create(
 | 
				
			||||||
    VXBaseDataSource_InputCallback inputPeekCb,
 | 
					    ZyDisBaseDataSource_InputCallback inputPeekCb,
 | 
				
			||||||
    VXBaseDataSource_InputCallback inputNextCb,
 | 
					    ZyDisBaseDataSource_InputCallback inputNextCb,
 | 
				
			||||||
    VXBaseDataSource_IsEndOfInputCallback isEndOfInputCb,
 | 
					    ZyDisBaseDataSource_IsEndOfInputCallback isEndOfInputCb,
 | 
				
			||||||
    VXBaseDataSource_GetPositionCallback getPositionCb,
 | 
					    ZyDisBaseDataSource_GetPositionCallback getPositionCb,
 | 
				
			||||||
    VXBaseDataSource_SetPositionCallback setPositionCb,
 | 
					    ZyDisBaseDataSource_SetPositionCallback setPositionCb,
 | 
				
			||||||
    VXBaseDataSource_DestructionCallback destructionCb);
 | 
					    ZyDisBaseDataSource_DestructionCallback destructionCb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Enums ======================================================================================= */
 | 
					/* Enums ======================================================================================= */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent a disassembler mode.
 | 
					 * @brief   Values that represent a disassembler mode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXDisassemblerMode /* : uint8_t */
 | 
					typedef enum _ZyDisDisassemblerMode /* : uint8_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DM_M16BIT,
 | 
					    DM_M16BIT,
 | 
				
			||||||
    DM_M32BIT,
 | 
					    DM_M32BIT,
 | 
				
			||||||
    DM_M64BIT
 | 
					    DM_M64BIT
 | 
				
			||||||
} VXDisassemblerMode;
 | 
					} ZyDisDisassemblerMode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent an instruction-set vendor.
 | 
					 * @brief   Values that represent an instruction-set vendor.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXInstructionSetVendor /* : uint8_t */
 | 
					typedef enum _ZyDisInstructionSetVendor /* : uint8_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ISV_ANY,
 | 
					    ISV_ANY,
 | 
				
			||||||
    ISV_INTEL,
 | 
					    ISV_INTEL,
 | 
				
			||||||
    ISV_AMD
 | 
					    ISV_AMD
 | 
				
			||||||
} VXInstructionSetVendor;
 | 
					} ZyDisInstructionSetVendor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXInstructionDecoder ======================================================================== */
 | 
					/* ZyDisInstructionDecoder ======================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _VXInstructionDecoderContext 
 | 
					typedef struct _ZyDisInstructionDecoderContext 
 | 
				
			||||||
{ 
 | 
					{ 
 | 
				
			||||||
    VXContextDescriptor d; 
 | 
					    ZyDisContextDescriptor d; 
 | 
				
			||||||
} VXInstructionDecoderContext;
 | 
					} ZyDisInstructionDecoderContext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Creates an instruction decoder.
 | 
					 * @brief   Creates an instruction decoder.
 | 
				
			||||||
 * @return  @c NULL if it fails, else an instruction decoder context.
 | 
					 * @return  @c NULL if it fails, else an instruction decoder context.
 | 
				
			||||||
 * @see     VXInstructionDecoder_Release
 | 
					 * @see     ZyDisInstructionDecoder_Release
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
// TODO: verify return value
 | 
					// TODO: verify return value
 | 
				
			||||||
VX_EXPORT VXInstructionDecoderContext* VXInstructionDecoder_Create(void);
 | 
					ZYDIS_EXPORT ZyDisInstructionDecoderContext* ZyDisInstructionDecoder_Create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Creates an instruction decoder.
 | 
					 * @brief   Creates an instruction decoder.
 | 
				
			||||||
| 
						 | 
					@ -227,100 +227,100 @@ VX_EXPORT VXInstructionDecoderContext* VXInstructionDecoder_Create(void);
 | 
				
			||||||
 * @param   preferredVendor     The preferred instruction-set vendor.
 | 
					 * @param   preferredVendor     The preferred instruction-set vendor.
 | 
				
			||||||
 * @param   instructionPointer  The initial instruction pointer.
 | 
					 * @param   instructionPointer  The initial instruction pointer.
 | 
				
			||||||
 * @return  @c NULL if it fails, else an instruction decoder context.
 | 
					 * @return  @c NULL if it fails, else an instruction decoder context.
 | 
				
			||||||
 * @see     VXInstructionDecoder_Release
 | 
					 * @see     ZyDisInstructionDecoder_Release
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXInstructionDecoderContext* VXInstructionDecoder_CreateEx(
 | 
					ZYDIS_EXPORT ZyDisInstructionDecoderContext* ZyDisInstructionDecoder_CreateEx(
 | 
				
			||||||
    VXBaseDataSourceContext *input, 
 | 
					    ZyDisBaseDataSourceContext *input, 
 | 
				
			||||||
    VXDisassemblerMode disassemblerMode,
 | 
					    ZyDisDisassemblerMode disassemblerMode,
 | 
				
			||||||
    VXInstructionSetVendor preferredVendor, 
 | 
					    ZyDisInstructionSetVendor preferredVendor, 
 | 
				
			||||||
    uint64_t instructionPointer);
 | 
					    uint64_t instructionPointer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Releases an instruction decoder.
 | 
					 * @brief   Releases an instruction decoder.
 | 
				
			||||||
 * @param   ctx The context of the instruction decoder to release.
 | 
					 * @param   ctx The context of the instruction decoder to release.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXInstructionDecoder_Release(
 | 
					ZYDIS_EXPORT void ZyDisInstructionDecoder_Release(
 | 
				
			||||||
    VXInstructionDecoderContext *ctx);
 | 
					    ZyDisInstructionDecoderContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Decodes the next instruction from the input data source.
 | 
					 * @brief   Decodes the next instruction from the input data source.
 | 
				
			||||||
 * @param   ctx  The instruction decoder context.
 | 
					 * @param   ctx  The instruction decoder context.
 | 
				
			||||||
 * @param   info The @c VXInstructionInfo struct that receives the information about the decoded 
 | 
					 * @param   info The @c ZyDisInstructionInfo struct that receives the information about the decoded 
 | 
				
			||||||
 *               instruction.
 | 
					 *               instruction.
 | 
				
			||||||
 * @return  This function returns @c false if the current position exceeds the maximum input
 | 
					 * @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 
 | 
					 *          length. In all other cases (valid and invalid instructions) the return value is 
 | 
				
			||||||
 *          @c true.
 | 
					 *          @c true.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT bool VXInstructionDecoder_DecodeInstruction(
 | 
					ZYDIS_EXPORT bool ZyDisInstructionDecoder_DecodeInstruction(
 | 
				
			||||||
    VXInstructionDecoderContext *ctx, 
 | 
					    ZyDisInstructionDecoderContext *ctx, 
 | 
				
			||||||
    VXInstructionInfo *info);
 | 
					    ZyDisInstructionInfo *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Returns a pointer to the current data source.
 | 
					 * @brief   Returns a pointer to the current data source.
 | 
				
			||||||
 * @param   ctx The instruction decoder context.
 | 
					 * @param   ctx The instruction decoder context.
 | 
				
			||||||
 * @return  The context of the data source.
 | 
					 * @return  The context of the data source.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXBaseDataSourceContext* VXInstructionDecoder_GetDataSource(
 | 
					ZYDIS_EXPORT ZyDisBaseDataSourceContext* ZyDisInstructionDecoder_GetDataSource(
 | 
				
			||||||
    const VXInstructionDecoderContext *ctx);
 | 
					    const ZyDisInstructionDecoderContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Sets a new data source.
 | 
					 * @brief   Sets a new data source.
 | 
				
			||||||
 * @param   ctx   The instruction decoder context.
 | 
					 * @param   ctx   The instruction decoder context.
 | 
				
			||||||
 * @param   input The context of the new input data source.
 | 
					 * @param   input The context of the new input data source.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXInstructionDecoder_SetDataSource(
 | 
					ZYDIS_EXPORT void ZyDisInstructionDecoder_SetDataSource(
 | 
				
			||||||
    VXInstructionDecoderContext *ctx, 
 | 
					    ZyDisInstructionDecoderContext *ctx, 
 | 
				
			||||||
    VXBaseDataSourceContext *input);
 | 
					    ZyDisBaseDataSourceContext *input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Returns the current disassembler mode.
 | 
					 * @brief   Returns the current disassembler mode.
 | 
				
			||||||
 * @param   ctx The instruction decoder context.
 | 
					 * @param   ctx The instruction decoder context.
 | 
				
			||||||
 * @return  The current disassembler mode.
 | 
					 * @return  The current disassembler mode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXDisassemblerMode VXInstructionDecoder_GetDisassemblerMode(
 | 
					ZYDIS_EXPORT ZyDisDisassemblerMode ZyDisInstructionDecoder_GetDisassemblerMode(
 | 
				
			||||||
    const VXInstructionDecoderContext *ctx);
 | 
					    const ZyDisInstructionDecoderContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Sets the current disassembler mode.
 | 
					 * @brief   Sets the current disassembler mode.
 | 
				
			||||||
 * @param   ctx                 The instruction decoder context.
 | 
					 * @param   ctx                 The instruction decoder context.
 | 
				
			||||||
 * @param   disassemblerMode    The new disassembler mode.
 | 
					 * @param   disassemblerMode    The new disassembler mode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXInstructionDecoder_SetDisassemblerMode(
 | 
					ZYDIS_EXPORT void ZyDisInstructionDecoder_SetDisassemblerMode(
 | 
				
			||||||
    VXInstructionDecoderContext *ctx,
 | 
					    ZyDisInstructionDecoderContext *ctx,
 | 
				
			||||||
    VXDisassemblerMode disassemblerMode);
 | 
					    ZyDisDisassemblerMode disassemblerMode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Returns the preferred instruction-set vendor.
 | 
					 * @brief   Returns the preferred instruction-set vendor.
 | 
				
			||||||
 * @param   ctx The instruction decoder context.
 | 
					 * @param   ctx The instruction decoder context.
 | 
				
			||||||
 * @return  The preferred instruction-set vendor.
 | 
					 * @return  The preferred instruction-set vendor.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXInstructionSetVendor VXInstructionDecoder_GetPreferredVendor(
 | 
					ZYDIS_EXPORT ZyDisInstructionSetVendor ZyDisInstructionDecoder_GetPreferredVendor(
 | 
				
			||||||
    const VXInstructionDecoderContext *ctx);
 | 
					    const ZyDisInstructionDecoderContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Sets the preferred instruction-set vendor.
 | 
					 * @brief   Sets the preferred instruction-set vendor.
 | 
				
			||||||
 * @param   ctx             The instruction decoder context.
 | 
					 * @param   ctx             The instruction decoder context.
 | 
				
			||||||
 * @param   preferredVendor The new preferred instruction-set vendor.
 | 
					 * @param   preferredVendor The new preferred instruction-set vendor.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXInstructionDecoder_SetPreferredVendor(
 | 
					ZYDIS_EXPORT void ZyDisInstructionDecoder_SetPreferredVendor(
 | 
				
			||||||
    VXInstructionDecoderContext *ctx,
 | 
					    ZyDisInstructionDecoderContext *ctx,
 | 
				
			||||||
    VXInstructionSetVendor preferredVendor);
 | 
					    ZyDisInstructionSetVendor preferredVendor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Returns the current instruction pointer.
 | 
					 * @brief   Returns the current instruction pointer.
 | 
				
			||||||
 * @param   ctx The instruction decoder context.
 | 
					 * @param   ctx The instruction decoder context.
 | 
				
			||||||
 * @return  The current instruction pointer.
 | 
					 * @return  The current instruction pointer.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT uint64_t VXInstructionDecoder_GetInstructionPointer(
 | 
					ZYDIS_EXPORT uint64_t ZyDisInstructionDecoder_GetInstructionPointer(
 | 
				
			||||||
    const VXInstructionDecoderContext *ctx);
 | 
					    const ZyDisInstructionDecoderContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Sets a new instruction pointer.
 | 
					 * @brief   Sets a new instruction pointer.
 | 
				
			||||||
 * @param   ctx                 The instruction decoder context.
 | 
					 * @param   ctx                 The instruction decoder context.
 | 
				
			||||||
 * @param   instructionPointer  The new instruction pointer.
 | 
					 * @param   instructionPointer  The new instruction pointer.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXInstructionDecoder_SetInstructionPointer(
 | 
					ZYDIS_EXPORT void ZyDisInstructionDecoder_SetInstructionPointer(
 | 
				
			||||||
    VXInstructionDecoderContext *ctx,
 | 
					    ZyDisInstructionDecoderContext *ctx,
 | 
				
			||||||
    uint64_t instructionPointer);
 | 
					    uint64_t instructionPointer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ============================================================================================= */
 | 
					/* ============================================================================================= */
 | 
				
			||||||
| 
						 | 
					@ -329,4 +329,4 @@ VX_EXPORT void VXInstructionDecoder_SetInstructionPointer(
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* _VDE_VXINSTRUCTIONDECODERC_H_ */
 | 
					#endif /* _VDE_ZyDisINSTRUCTIONDECODERC_H_ */
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -30,31 +30,31 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _VDE_VXINSTRUCTIONFORMATTERC_H_
 | 
					#ifndef _VDE_ZyDisINSTRUCTIONFORMATTERC_H_
 | 
				
			||||||
#define _VDE_VXINSTRUCTIONFORMATTERC_H_
 | 
					#define _VDE_ZyDisINSTRUCTIONFORMATTERC_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "VXDisassemblerTypes.h"
 | 
					#include "ZyDisDisassemblerTypes.h"
 | 
				
			||||||
#include "VXDisassemblerUtils.h"
 | 
					#include "ZyDisDisassemblerUtils.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C"
 | 
					extern "C"
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXBaseSymbolResolver ======================================================================== */
 | 
					/* ZyDisBaseSymbolResolver ======================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _VXBaseSymbolResolverContext 
 | 
					typedef struct _ZyDisBaseSymbolResolverContext 
 | 
				
			||||||
{ 
 | 
					{ 
 | 
				
			||||||
    VXContextDescriptor d; 
 | 
					    ZyDisContextDescriptor d; 
 | 
				
			||||||
} VXBaseSymbolResolverContext;
 | 
					} ZyDisBaseSymbolResolverContext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Releases a symbol resolver.
 | 
					 * @brief   Releases a symbol resolver.
 | 
				
			||||||
 * @param   ctx The context of the symbol resolver to free.
 | 
					 * @param   ctx The context of the symbol resolver to free.
 | 
				
			||||||
 * The context may no longer used after it was released.
 | 
					 * The context may no longer used after it was released.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXBaseSymbolResolver_Release(
 | 
					ZYDIS_EXPORT void ZyDisBaseSymbolResolver_Release(
 | 
				
			||||||
    VXBaseSymbolResolverContext *ctx);
 | 
					    ZyDisBaseSymbolResolverContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Resolves a symbol.
 | 
					 * @brief   Resolves a symbol.
 | 
				
			||||||
| 
						 | 
					@ -65,16 +65,16 @@ VX_EXPORT void VXBaseSymbolResolver_Release(
 | 
				
			||||||
 *                  the base address of the symbol.
 | 
					 *                  the base address of the symbol.
 | 
				
			||||||
 * @return  The name of the symbol if the symbol was found, else @c NULL.
 | 
					 * @return  The name of the symbol if the symbol was found, else @c NULL.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT const char* VXBaseSymbolResolver_ResolveSymbol(
 | 
					ZYDIS_EXPORT const char* ZyDisBaseSymbolResolver_ResolveSymbol(
 | 
				
			||||||
    VXBaseSymbolResolverContext *ctx,
 | 
					    ZyDisBaseSymbolResolverContext *ctx,
 | 
				
			||||||
    const VXInstructionInfo *info, 
 | 
					    const ZyDisInstructionInfo *info, 
 | 
				
			||||||
    uint64_t address, 
 | 
					    uint64_t address, 
 | 
				
			||||||
    uint64_t *offset);
 | 
					    uint64_t *offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXCustomSymbolResolver ====================================================================== */
 | 
					/* ZyDisCustomSymbolResolver ====================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef const char* (*VXCustomSymbolResolver_ResolveSymbolCallback)(
 | 
					typedef const char* (*ZyDisCustomSymbolResolver_ResolveSymbolCallback)(
 | 
				
			||||||
    const VXInstructionInfo *info, 
 | 
					    const ZyDisInstructionInfo *info, 
 | 
				
			||||||
    uint64_t address, 
 | 
					    uint64_t address, 
 | 
				
			||||||
    uint64_t *offset,
 | 
					    uint64_t *offset,
 | 
				
			||||||
    void *userData);
 | 
					    void *userData);
 | 
				
			||||||
| 
						 | 
					@ -86,19 +86,19 @@ typedef const char* (*VXCustomSymbolResolver_ResolveSymbolCallback)(
 | 
				
			||||||
 *                      May also be @c NULL.
 | 
					 *                      May also be @c NULL.
 | 
				
			||||||
 * @return  @c NULL if it fails, else a symbol resolver context.
 | 
					 * @return  @c NULL if it fails, else a symbol resolver context.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXBaseSymbolResolverContext* VXCustomSymbolResolver_Create(
 | 
					ZYDIS_EXPORT ZyDisBaseSymbolResolverContext* ZyDisCustomSymbolResolver_Create(
 | 
				
			||||||
    VXCustomSymbolResolver_ResolveSymbolCallback resolverCb,
 | 
					    ZyDisCustomSymbolResolver_ResolveSymbolCallback resolverCb,
 | 
				
			||||||
    void *userData);
 | 
					    void *userData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXBaseInstructionFormatter ================================================================== */
 | 
					/* ZyDisBaseInstructionFormatter ================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _VXBaseInstructionFormatterContext
 | 
					typedef struct _ZyDisBaseInstructionFormatterContext
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VXContextDescriptor d;
 | 
					    ZyDisContextDescriptor d;
 | 
				
			||||||
} VXBaseInstructionFormatterContext;
 | 
					} ZyDisBaseInstructionFormatterContext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef void(*VXBaseInstructionFormatter_InternalFormatInstructionCallback)(
 | 
					typedef void(*ZyDisBaseInstructionFormatter_InternalFormatInstructionCallback)(
 | 
				
			||||||
    VXBaseInstructionFormatterContext *ctx, const VXInstructionInfo *info);
 | 
					    ZyDisBaseInstructionFormatterContext *ctx, const ZyDisInstructionInfo *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Formats a decoded instruction.
 | 
					 * @brief   Formats a decoded instruction.
 | 
				
			||||||
| 
						 | 
					@ -107,17 +107,17 @@ typedef void(*VXBaseInstructionFormatter_InternalFormatInstructionCallback)(
 | 
				
			||||||
 * @return  Pointer to the formatted instruction string. This pointer remains valid until 
 | 
					 * @return  Pointer to the formatted instruction string. This pointer remains valid until 
 | 
				
			||||||
 *          this function is called again or the context is released.
 | 
					 *          this function is called again or the context is released.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT const char* VXBaseInstructionFormatter_FormatInstruction(
 | 
					ZYDIS_EXPORT const char* ZyDisBaseInstructionFormatter_FormatInstruction(
 | 
				
			||||||
    VXBaseInstructionFormatterContext *ctx,
 | 
					    ZyDisBaseInstructionFormatterContext *ctx,
 | 
				
			||||||
    const VXInstructionInfo *info);
 | 
					    const ZyDisInstructionInfo *info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Returns a pointer to the current symbol resolver.
 | 
					 * @brief   Returns a pointer to the current symbol resolver.
 | 
				
			||||||
 * @param   ctx     The instruction formatter context.
 | 
					 * @param   ctx     The instruction formatter context.
 | 
				
			||||||
 * @return  Pointer to the current symbol resolver or @c NULL if no symbol resolver is used.
 | 
					 * @return  Pointer to the current symbol resolver or @c NULL if no symbol resolver is used.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXBaseSymbolResolverContext* VXBaseInstructionFormatter_GetSymbolResolver(
 | 
					ZYDIS_EXPORT ZyDisBaseSymbolResolverContext* ZyDisBaseInstructionFormatter_GetSymbolResolver(
 | 
				
			||||||
    const VXBaseInstructionFormatterContext *ctx);
 | 
					    const ZyDisBaseInstructionFormatterContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Sets a new symbol resolver.
 | 
					 * @brief   Sets a new symbol resolver.
 | 
				
			||||||
| 
						 | 
					@ -125,45 +125,45 @@ VX_EXPORT VXBaseSymbolResolverContext* VXBaseInstructionFormatter_GetSymbolResol
 | 
				
			||||||
 * @param   symbolResolver  Pointer to a symbol resolver instance or @c NULL, if no smybol
 | 
					 * @param   symbolResolver  Pointer to a symbol resolver instance or @c NULL, if no smybol
 | 
				
			||||||
 *                          resolver should be used.
 | 
					 *                          resolver should be used.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXBaseInstructionFormatter_SetSymbolResolver(
 | 
					ZYDIS_EXPORT void ZyDisBaseInstructionFormatter_SetSymbolResolver(
 | 
				
			||||||
    VXBaseInstructionFormatterContext *ctx,
 | 
					    ZyDisBaseInstructionFormatterContext *ctx,
 | 
				
			||||||
    VXBaseSymbolResolverContext *resolver);
 | 
					    ZyDisBaseSymbolResolverContext *resolver);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Releases an instruction formatter.
 | 
					 * @brief   Releases an instruction formatter.
 | 
				
			||||||
 * @param   ctx The context of the instruction formatter to release.
 | 
					 * @param   ctx The context of the instruction formatter to release.
 | 
				
			||||||
 * The context may no longer used after it has been released.
 | 
					 * The context may no longer used after it has been released.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT void VXBaseInstructionFormatter_Release(
 | 
					ZYDIS_EXPORT void ZyDisBaseInstructionFormatter_Release(
 | 
				
			||||||
    VXBaseInstructionFormatterContext *ctx);
 | 
					    ZyDisBaseInstructionFormatterContext *ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXIntelInstructionFormatter ================================================================= */
 | 
					/* ZyDisIntelInstructionFormatter ================================================================= */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Creates an Intel-syntax instruction formatter.
 | 
					 * @brief   Creates an Intel-syntax instruction formatter.
 | 
				
			||||||
 * @return  @c NULL if it fails, else an Intel instruction formatter context.
 | 
					 * @return  @c NULL if it fails, else an Intel instruction formatter context.
 | 
				
			||||||
 * @see     VXBaseInstructionFormatter_Release
 | 
					 * @see     ZyDisBaseInstructionFormatter_Release
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXBaseInstructionFormatterContext* VXIntelInstructionFormatter_Create(void);
 | 
					ZYDIS_EXPORT ZyDisBaseInstructionFormatterContext* ZyDisIntelInstructionFormatter_Create(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Creates an Intel-syntax instruction formatter.
 | 
					 * @brief   Creates an Intel-syntax instruction formatter.
 | 
				
			||||||
 * @param   resolver The symbol resolver consulted to resolve symbols on formatting.
 | 
					 * @param   resolver The symbol resolver consulted to resolve symbols on formatting.
 | 
				
			||||||
 * @return  @c NULL if it fails, else an Intel instruction formatter context.
 | 
					 * @return  @c NULL if it fails, else an Intel instruction formatter context.
 | 
				
			||||||
 * @see     VXBaseInstructionFormatter_Release
 | 
					 * @see     ZyDisBaseInstructionFormatter_Release
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXBaseInstructionFormatterContext* VXIntelInstructionFormatter_CreateEx(
 | 
					ZYDIS_EXPORT ZyDisBaseInstructionFormatterContext* ZyDisIntelInstructionFormatter_CreateEx(
 | 
				
			||||||
    VXBaseSymbolResolverContext *resolver);
 | 
					    ZyDisBaseSymbolResolverContext *resolver);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* VXCustomInstructionFormatter ================================================================ */
 | 
					/* ZyDisCustomInstructionFormatter ================================================================ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Creats a custom instruction formatter.
 | 
					 * @brief   Creats a custom instruction formatter.
 | 
				
			||||||
 * @param   formatInsnCb    The callback formatting the instruction.
 | 
					 * @param   formatInsnCb    The callback formatting the instruction.
 | 
				
			||||||
 * @return  @c NULL if it fails, else a custom instruction formatter context.
 | 
					 * @return  @c NULL if it fails, else a custom instruction formatter context.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_EXPORT VXBaseInstructionFormatterContext* VXCustomInstructionFormatter_Create(
 | 
					ZYDIS_EXPORT ZyDisBaseInstructionFormatterContext* ZyDisCustomInstructionFormatter_Create(
 | 
				
			||||||
    VXBaseInstructionFormatter_InternalFormatInstructionCallback formatInsnCb);
 | 
					    ZyDisBaseInstructionFormatter_InternalFormatInstructionCallback formatInsnCb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ============================================================================================= */
 | 
					/* ============================================================================================= */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,4 +171,4 @@ VX_EXPORT VXBaseInstructionFormatterContext* VXCustomInstructionFormatter_Create
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* _VDE_VXINSTRUCTIONFORMATTERC_H_ */
 | 
					#endif /* _VDE_ZyDisINSTRUCTIONFORMATTERC_H_ */
 | 
				
			||||||
| 
						 | 
					@ -34,17 +34,17 @@
 | 
				
			||||||
 * Include CMake generated header defining macros im-/exporting functions statically or 
 | 
					 * Include CMake generated header defining macros im-/exporting functions statically or 
 | 
				
			||||||
 * dynamically depending what the user requested from CMake.
 | 
					 * dynamically depending what the user requested from CMake.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#include "VXExportConfig.h"
 | 
					#include "ZyDisExportConfig.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _VDE_VXINTERNALCONFIG_H_
 | 
					#ifndef _VDE_ZyDisINTERNALCONFIG_H_
 | 
				
			||||||
#define _VDE_VXINTERNALCONFIG_H_
 | 
					#define _VDE_ZyDisINTERNALCONFIG_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef _MSC_VER
 | 
					#ifdef _MSC_VER
 | 
				
			||||||
#   define VX_INLINE __inline
 | 
					#   define ZYDIS_INLINE __inline
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#   define VX_INLINE static inline
 | 
					#   define ZYDIS_INLINE static inline
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define VX_UNUSED(x) ((void)x)
 | 
					#define ZYDIS_UNUSED(x) ((void)x)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* _VDE_VXINTERNALCONFIG_H_ */
 | 
					#endif /* _VDE_ZyDisINTERNALCONFIG_H_ */
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,197 @@
 | 
				
			||||||
 | 
					/**************************************************************************************************
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Verteron Disassembler Engine
 | 
				
			||||||
 | 
					  Version 1.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Remarks         : Freeware, Copyright must be included
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Original Author : athre0z
 | 
				
			||||||
 | 
					  Modifications   : 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Last change     : 19. March 2015
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * 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 _VDE_ZyDisINTERNALHELPERS_H_
 | 
				
			||||||
 | 
					#define _VDE_ZyDisINTERNALHELPERS_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "ZyDisInstructionDecoder.h"
 | 
				
			||||||
 | 
					#include "ZyDisInstructionFormatter.h"
 | 
				
			||||||
 | 
					#include "ZyDisInternalConfig.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Types IDs =================================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef enum _ZyDisTypeId
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    TYPE_BASEDATASOURCE,
 | 
				
			||||||
 | 
					    TYPE_MEMORYDATASOURCE,
 | 
				
			||||||
 | 
					    TYPE_CUSTOMDATASOURCE,
 | 
				
			||||||
 | 
					    TYPE_INSTRUCTIONDECODER,
 | 
				
			||||||
 | 
					    TYPE_BASESYMBOLRESOLVER,
 | 
				
			||||||
 | 
					    TYPE_CUSTOMSYMBOLRESOLVER,
 | 
				
			||||||
 | 
					    TYPE_BASEINSTRUCTIONFORMATTER,
 | 
				
			||||||
 | 
					    TYPE_INTELINSTRUCTIONFORMATTER,
 | 
				
			||||||
 | 
					    TYPE_CUSTOMINSTRUCTIONFORMATTER,
 | 
				
			||||||
 | 
					} ZyDisTypeId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Context conversion helpers ================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisBaseDataSource* ZyDisBaseDataSource_thiz(
 | 
				
			||||||
 | 
					    ZyDisBaseDataSourceContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_BASEDATASOURCE 
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_MEMORYDATASOURCE
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_CUSTOMDATASOURCE);
 | 
				
			||||||
 | 
					    return (struct _ZyDisBaseDataSource*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisBaseDataSource* ZyDisBaseDataSource_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisBaseDataSourceContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_BASEDATASOURCE 
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_MEMORYDATASOURCE
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_CUSTOMDATASOURCE);
 | 
				
			||||||
 | 
					    return (const struct _ZyDisBaseDataSource*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisMemoryDataSource* ZyDisMemoryDataSource_thiz(
 | 
				
			||||||
 | 
					    ZyDisBaseDataSourceContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_MEMORYDATASOURCE);
 | 
				
			||||||
 | 
					    return (struct _ZyDisMemoryDataSource*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisMemoryDataSource* ZyDisMemoryDataSource_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisBaseDataSourceContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_MEMORYDATASOURCE);
 | 
				
			||||||
 | 
					    return (const struct _ZyDisMemoryDataSource*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisCustomDataSource* ZyDisCustomDataSource_thiz(
 | 
				
			||||||
 | 
					    ZyDisBaseDataSourceContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_CUSTOMDATASOURCE);
 | 
				
			||||||
 | 
					    return (struct _ZyDisCustomDataSource*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisCustomDataSource* ZyDisCustomDataSource_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisBaseDataSourceContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_CUSTOMDATASOURCE);
 | 
				
			||||||
 | 
					    return (const struct _ZyDisCustomDataSource*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisInstructionDecoder* ZyDisInstructionDecoder_thiz(
 | 
				
			||||||
 | 
					    ZyDisInstructionDecoderContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_INSTRUCTIONDECODER);
 | 
				
			||||||
 | 
					    return (struct _ZyDisInstructionDecoder*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisInstructionDecoder* ZyDisInstructionDecoder_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisInstructionDecoderContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_INSTRUCTIONDECODER);
 | 
				
			||||||
 | 
					    return (const struct _ZyDisInstructionDecoder*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisBaseSymbolResolver* ZyDisBaseSymbolResolver_thiz(
 | 
				
			||||||
 | 
					    ZyDisBaseSymbolResolverContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_BASESYMBOLRESOLVER
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_CUSTOMSYMBOLRESOLVER);
 | 
				
			||||||
 | 
					    return (struct _ZyDisBaseSymbolResolver*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisBaseSymbolResolver* ZyDisBaseSymbolResolver_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisBaseSymbolResolverContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_BASESYMBOLRESOLVER
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_CUSTOMSYMBOLRESOLVER);
 | 
				
			||||||
 | 
					    return (const struct _ZyDisBaseSymbolResolver*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisCustomSymbolResolver* ZyDisCustomSymbolResolver_thiz(
 | 
				
			||||||
 | 
					    ZyDisBaseSymbolResolverContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_CUSTOMSYMBOLRESOLVER);
 | 
				
			||||||
 | 
					    return (struct _ZyDisCustomSymbolResolver*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisCustomSymbolResolver* ZyDisCustomSymbolResolver_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisBaseSymbolResolverContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_CUSTOMSYMBOLRESOLVER);
 | 
				
			||||||
 | 
					    return (const struct _ZyDisCustomSymbolResolver*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisBaseInstructionFormatter* ZyDisBaseInstructionFormatter_thiz(
 | 
				
			||||||
 | 
					    ZyDisBaseInstructionFormatterContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_BASEINSTRUCTIONFORMATTER 
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_INTELINSTRUCTIONFORMATTER
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_CUSTOMINSTRUCTIONFORMATTER);
 | 
				
			||||||
 | 
					    return (struct _ZyDisBaseInstructionFormatter*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisBaseInstructionFormatter* ZyDisBaseInstructionFormatter_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisBaseInstructionFormatterContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_BASEINSTRUCTIONFORMATTER
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_INTELINSTRUCTIONFORMATTER
 | 
				
			||||||
 | 
					        || ctx->d.type == TYPE_CUSTOMINSTRUCTIONFORMATTER);
 | 
				
			||||||
 | 
					    return (const struct _ZyDisBaseInstructionFormatter*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisIntelInstructionFormatter* ZyDisIntelInstructionFormatter_thiz(
 | 
				
			||||||
 | 
					    ZyDisBaseInstructionFormatterContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_INTELINSTRUCTIONFORMATTER);
 | 
				
			||||||
 | 
					    return (struct _ZyDisIntelInstructionFormatter*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisIntelInstructionFormatter* ZyDisIntelInstructionFormatter_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisBaseInstructionFormatterContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_INTELINSTRUCTIONFORMATTER);
 | 
				
			||||||
 | 
					    return (const struct _ZyDisIntelInstructionFormatter*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE struct _ZyDisCustomInstructionFormatter* ZyDisCustomInstructionFormatter_thiz(
 | 
				
			||||||
 | 
					    ZyDisBaseInstructionFormatterContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_CUSTOMINSTRUCTIONFORMATTER);
 | 
				
			||||||
 | 
					    return (struct _ZyDisCustomInstructionFormatter*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ZYDIS_INLINE const struct _ZyDisCustomInstructionFormatter* ZyDisCustomInstructionFormatter_cthiz(
 | 
				
			||||||
 | 
					    const ZyDisBaseInstructionFormatterContext *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    assert(ctx->d.type == TYPE_CUSTOMINSTRUCTIONFORMATTER);
 | 
				
			||||||
 | 
					    return (struct _ZyDisCustomInstructionFormatter*)ctx->d.ptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ============================================================================================= */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* _VDE_ZyDisINTERNALHELPERS_H_ */
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -30,8 +30,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _VDE_VXOPCODETABLEC_H_
 | 
					#ifndef _VDE_ZyDisOPCODETABLEC_H_
 | 
				
			||||||
#define _VDE_VXOPCODETABLEC_H_
 | 
					#define _VDE_ZyDisOPCODETABLEC_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@ extern "C"
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent an instruction mnemonic.
 | 
					 * @brief   Values that represent an instruction mnemonic.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXInstructionMnemonic /* : uint16_t */
 | 
					typedef enum _ZyDisInstructionMnemonic /* : uint16_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* 000 */ MNEM_INVALID,
 | 
					    /* 000 */ MNEM_INVALID,
 | 
				
			||||||
    /* 001 */ MNEM_AAA,
 | 
					    /* 001 */ MNEM_AAA,
 | 
				
			||||||
| 
						 | 
					@ -926,8 +926,8 @@ typedef enum _VXInstructionMnemonic /* : uint16_t */
 | 
				
			||||||
    /* 36D */ MNEM_VUNPCKHPS,
 | 
					    /* 36D */ MNEM_VUNPCKHPS,
 | 
				
			||||||
    /* 36E */ MNEM_VUNPCKLPD,
 | 
					    /* 36E */ MNEM_VUNPCKLPD,
 | 
				
			||||||
    /* 36F */ MNEM_VUNPCKLPS,
 | 
					    /* 36F */ MNEM_VUNPCKLPS,
 | 
				
			||||||
    /* 370 */ MNEM_VXORPD,
 | 
					    /* 370 */ MNEM_ZyDisORPD,
 | 
				
			||||||
    /* 371 */ MNEM_VXORPS,
 | 
					    /* 371 */ MNEM_ZyDisORPS,
 | 
				
			||||||
    /* 372 */ MNEM_VZEROALL,
 | 
					    /* 372 */ MNEM_VZEROALL,
 | 
				
			||||||
    /* 373 */ MNEM_VZEROUPPER,
 | 
					    /* 373 */ MNEM_VZEROUPPER,
 | 
				
			||||||
    /* 374 */ MNEM_WAIT,
 | 
					    /* 374 */ MNEM_WAIT,
 | 
				
			||||||
| 
						 | 
					@ -953,18 +953,18 @@ typedef enum _VXInstructionMnemonic /* : uint16_t */
 | 
				
			||||||
    /* 388 */ MNEM_XSTORE,
 | 
					    /* 388 */ MNEM_XSTORE,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    MNEM_FORCE_WORD = 0x7FFF
 | 
					    MNEM_FORCE_WORD = 0x7FFF
 | 
				
			||||||
} VXInstructionMnemonic;
 | 
					} ZyDisInstructionMnemonic;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Defines an alias representing an opcode tree node. An opcode tree node is a 16 bit
 | 
					 * @brief   Defines an alias representing an opcode tree node. An opcode tree node is a 16 bit
 | 
				
			||||||
 *          unsigned integer value with its first 4 bits reserved for the node type.
 | 
					 *          unsigned integer value with its first 4 bits reserved for the node type.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef uint16_t VXOpcodeTreeNode;
 | 
					typedef uint16_t ZyDisOpcodeTreeNode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the type of an opcode tree node.
 | 
					 * @brief   Values that represent the type of an opcode tree node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXOpcodeTreeNodeType /* : uint8_t */
 | 
					typedef enum _ZyDisOpcodeTreeNodeType /* : uint8_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Reference to a concrete instruction definition.
 | 
					     * @brief   Reference to a concrete instruction definition.
 | 
				
			||||||
| 
						 | 
					@ -1026,12 +1026,12 @@ typedef enum _VXOpcodeTreeNodeType /* : uint8_t */
 | 
				
			||||||
     * @brief   Reference to a vex_l switch table.
 | 
					     * @brief   Reference to a vex_l switch table.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    OTNT_VEXL                    = 14
 | 
					    OTNT_VEXL                    = 14
 | 
				
			||||||
} VXOpcodeTreeNodeType;
 | 
					} ZyDisOpcodeTreeNodeType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the type of an operand in the instruction definition.
 | 
					 * @brief   Values that represent the type of an operand in the instruction definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXDefinedOperandType /* : uint8_t */
 | 
					typedef enum _ZyDisDefinedOperandType /* : uint8_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * @brief   No operand. 
 | 
					     * @brief   No operand. 
 | 
				
			||||||
| 
						 | 
					@ -1286,13 +1286,13 @@ typedef enum _VXDefinedOperandType /* : uint8_t */
 | 
				
			||||||
     * @brief   Floating point register 7.
 | 
					     * @brief   Floating point register 7.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    DOT_ST7
 | 
					    DOT_ST7
 | 
				
			||||||
} VXDefinedOperandType;
 | 
					} ZyDisDefinedOperandType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent the size of an operand in the instruction definition.
 | 
					 * @brief   Values that represent the size of an operand in the instruction definition.
 | 
				
			||||||
 *          Do not change the order or the values of this enum! 
 | 
					 *          Do not change the order or the values of this enum! 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXDefinedOperandSize /* : uint8_t */
 | 
					typedef enum _ZyDisDefinedOperandSize /* : uint8_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   No operand.
 | 
					     * @brief   No operand.
 | 
				
			||||||
| 
						 | 
					@ -1386,13 +1386,13 @@ typedef enum _VXDefinedOperandSize /* : uint8_t */
 | 
				
			||||||
     * @brief   Q sized register or O sized memory operand.
 | 
					     * @brief   Q sized register or O sized memory operand.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    DOS_QO  = (DOS_Q << 4) | DOS_O,
 | 
					    DOS_QO  = (DOS_Q << 4) | DOS_O,
 | 
				
			||||||
} VXDefinedOperandSize;
 | 
					} ZyDisDefinedOperandSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Values that represent optional flags in the instruction definition.   
 | 
					 * @brief   Values that represent optional flags in the instruction definition.   
 | 
				
			||||||
 *          Do not change the order or the values of this enum!            
 | 
					 *          Do not change the order or the values of this enum!            
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef enum _VXInstructionDefinitionFlags /* : uint16_t */
 | 
					typedef enum _ZyDisInstructionDefinitionFlags /* : uint16_t */
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction accepts the rex.b prefix value.
 | 
					     * @brief   The instruction accepts the rex.b prefix value.
 | 
				
			||||||
| 
						 | 
					@ -1456,49 +1456,49 @@ typedef enum _VXInstructionDefinitionFlags /* : uint16_t */
 | 
				
			||||||
    IDF_OPERAND2_READWRITE              = 0x4000,
 | 
					    IDF_OPERAND2_READWRITE              = 0x4000,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IDF_FORCE_WORD                      = 0x7FFF
 | 
					    IDF_FORCE_WORD                      = 0x7FFF
 | 
				
			||||||
} VXInstructionDefinitionFlags;
 | 
					} ZyDisInstructionDefinitionFlags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma pack (push, 1)
 | 
					#pragma pack (push, 1)
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   An operand definition.
 | 
					 * @brief   An operand definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef struct _VXOperandDefinition
 | 
					typedef struct _ZyDisOperandDefinition
 | 
				
			||||||
{               
 | 
					{               
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The defined operand type.
 | 
					     * @brief   The defined operand type.
 | 
				
			||||||
     * @see     VXDefinedOperandType
 | 
					     * @see     ZyDisDefinedOperandType
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint8_t type;
 | 
					    uint8_t type;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The defined operand size.
 | 
					     * @brief   The defined operand size.
 | 
				
			||||||
     * @see     VXDefinedOperandType
 | 
					     * @see     ZyDisDefinedOperandType
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint8_t size;
 | 
					    uint8_t size;
 | 
				
			||||||
} VXOperandDefinition;
 | 
					} ZyDisOperandDefinition;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   An instruction definition.
 | 
					 * @brief   An instruction definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef struct _VXInstructionDefinition
 | 
					typedef struct _ZyDisInstructionDefinition
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The instruction mnemonic.
 | 
					     * @brief   The instruction mnemonic.
 | 
				
			||||||
     * @see     VXInstructionMnemonic
 | 
					     * @see     ZyDisInstructionMnemonic
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint16_t mnemonic;
 | 
					    uint16_t mnemonic;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   The operand definitions for all four possible operands.
 | 
					     * @brief   The operand definitions for all four possible operands.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    VXOperandDefinition operand[4];
 | 
					    ZyDisOperandDefinition operand[4];
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @brief   Additional flags for the instruction definition.
 | 
					     * @brief   Additional flags for the instruction definition.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    uint16_t flags;   
 | 
					    uint16_t flags;   
 | 
				
			||||||
} VXInstructionDefinition;
 | 
					} ZyDisInstructionDefinition;
 | 
				
			||||||
#pragma pack (pop)
 | 
					#pragma pack (pop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // _VDE_VXOPCODETABLEC_H_
 | 
					#endif // _VDE_ZyDisOPCODETABLEC_H_
 | 
				
			||||||
| 
						 | 
					@ -30,17 +30,17 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**************************************************************************************************/
 | 
					**************************************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef _VDE_VXOPCODETABLEINTERNAL_H_
 | 
					#ifndef _VDE_ZyDisOPCODETABLEINTERNAL_H_
 | 
				
			||||||
#define _VDE_VXOPCODETABLEINTERNAL_H_
 | 
					#define _VDE_ZyDisOPCODETABLEINTERNAL_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdint.h>
 | 
					#include <stdint.h>
 | 
				
			||||||
#include "VXOpcodeTable.h"
 | 
					#include "ZyDisOpcodeTable.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all opcode tables.
 | 
					 * @brief   Contains all opcode tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the opcode.
 | 
					 *          Indexed by the numeric value of the opcode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeTable[][256];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeTable[][256];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all modrm_mod switch tables.
 | 
					 * @brief   Contains all modrm_mod switch tables.
 | 
				
			||||||
| 
						 | 
					@ -48,19 +48,19 @@ extern const VXOpcodeTreeNode vxOptreeTable[][256];
 | 
				
			||||||
 *          0 = [modrm_mod == !11]
 | 
					 *          0 = [modrm_mod == !11]
 | 
				
			||||||
 *          1 = [modrm_mod ==  11]
 | 
					 *          1 = [modrm_mod ==  11]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeModrmMod[][2];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeModrmMod[][2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all modrm_reg switch tables.
 | 
					 * @brief   Contains all modrm_reg switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the modrm_reg field.
 | 
					 *          Indexed by the numeric value of the modrm_reg field.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeModrmReg[][8];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeModrmReg[][8];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all modrm_rm switch tables.
 | 
					 * @brief   Contains all modrm_rm switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the modrm_rm field.
 | 
					 *          Indexed by the numeric value of the modrm_rm field.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeModrmRm[][8];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeModrmRm[][8];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all mandatory-prefix switch tables.
 | 
					 * @brief   Contains all mandatory-prefix switch tables.
 | 
				
			||||||
| 
						 | 
					@ -70,14 +70,14 @@ extern const VXOpcodeTreeNode vxOptreeModrmRm[][8];
 | 
				
			||||||
 *          2 = F3  
 | 
					 *          2 = F3  
 | 
				
			||||||
 *          3 = 66
 | 
					 *          3 = 66
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeMandatory[][4];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeMandatory[][4];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all x87 opcode tables.
 | 
					 * @brief   Contains all x87 opcode tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the 6 lowest bits of the modrm byte (modrm_mod should
 | 
					 *          Indexed by the numeric value of the 6 lowest bits of the modrm byte (modrm_mod should
 | 
				
			||||||
 *          always be 11). 
 | 
					 *          always be 11). 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeX87[][64];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeX87[][64];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all address-size switch tables.
 | 
					 * @brief   Contains all address-size switch tables.
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,7 @@ extern const VXOpcodeTreeNode vxOptreeX87[][64];
 | 
				
			||||||
 *          1 = 32  
 | 
					 *          1 = 32  
 | 
				
			||||||
 *          2 = 64
 | 
					 *          2 = 64
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeAddressSize[][3];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeAddressSize[][3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all operand-size switch tables.
 | 
					 * @brief   Contains all operand-size switch tables.
 | 
				
			||||||
| 
						 | 
					@ -95,7 +95,7 @@ extern const VXOpcodeTreeNode vxOptreeAddressSize[][3];
 | 
				
			||||||
 *          1 = 32  
 | 
					 *          1 = 32  
 | 
				
			||||||
 *          2 = 64
 | 
					 *          2 = 64
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeOperandSize[][3];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeOperandSize[][3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all cpu-mode switch tables.
 | 
					 * @brief   Contains all cpu-mode switch tables.
 | 
				
			||||||
| 
						 | 
					@ -103,7 +103,7 @@ extern const VXOpcodeTreeNode vxOptreeOperandSize[][3];
 | 
				
			||||||
 *          0 = [!= 64]
 | 
					 *          0 = [!= 64]
 | 
				
			||||||
 *          1 = 64
 | 
					 *          1 = 64
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeMode[][2];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeMode[][2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all vendor switch tables. 
 | 
					 * @brief   Contains all vendor switch tables. 
 | 
				
			||||||
| 
						 | 
					@ -111,13 +111,13 @@ extern const VXOpcodeTreeNode vxOptreeMode[][2];
 | 
				
			||||||
 *          0 = AMD
 | 
					 *          0 = AMD
 | 
				
			||||||
 *          1 = Intel  
 | 
					 *          1 = Intel  
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeVendor[][2];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeVendor[][2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all 3DNow! switch tables.
 | 
					 * @brief   Contains all 3DNow! switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the 3DNow! opcode.
 | 
					 *          Indexed by the numeric value of the 3DNow! opcode.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptree3dnow[][256];
 | 
					extern const ZyDisOpcodeTreeNode vxOptree3dnow[][256];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all vex switch tables.
 | 
					 * @brief   Contains all vex switch tables.
 | 
				
			||||||
| 
						 | 
					@ -139,24 +139,24 @@ extern const VXOpcodeTreeNode vxOptree3dnow[][256];
 | 
				
			||||||
 *          E = F2_0F38
 | 
					 *          E = F2_0F38
 | 
				
			||||||
 *          F = F2_0F3A
 | 
					 *          F = F2_0F3A
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeVex[][16];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeVex[][16];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all vex_w switch tables.
 | 
					 * @brief   Contains all vex_w switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the vex_w field.
 | 
					 *          Indexed by the numeric value of the vex_w field.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeVexW[][2];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeVexW[][2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all vex_l switch tables.
 | 
					 * @brief   Contains all vex_l switch tables.
 | 
				
			||||||
 *          Indexed by the numeric value of the vex_l field.
 | 
					 *          Indexed by the numeric value of the vex_l field.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXOpcodeTreeNode vxOptreeVexL[][2];
 | 
					extern const ZyDisOpcodeTreeNode vxOptreeVexL[][2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all instruction definitions.
 | 
					 * @brief   Contains all instruction definitions.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern const VXInstructionDefinition vxInstrDefinitions[];
 | 
					extern const ZyDisInstructionDefinition vxInstrDefinitions[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief   Contains all instruction mnemonic strings.
 | 
					 * @brief   Contains all instruction mnemonic strings.
 | 
				
			||||||
| 
						 | 
					@ -168,9 +168,9 @@ extern const char* vxInstrMnemonicStrings[];
 | 
				
			||||||
 * @param   node    The node.
 | 
					 * @param   node    The node.
 | 
				
			||||||
 * @return  The type of the specified opcode tree node.
 | 
					 * @return  The type of the specified opcode tree node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE VXOpcodeTreeNodeType VXGetOpcodeNodeType(VXOpcodeTreeNode node)
 | 
					ZYDIS_INLINE ZyDisOpcodeTreeNodeType ZyDisGetOpcodeNodeType(ZyDisOpcodeTreeNode node)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (VXOpcodeTreeNodeType)((node >> 12) & 0x0F);
 | 
					    return (ZyDisOpcodeTreeNodeType)((node >> 12) & 0x0F);
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -178,7 +178,7 @@ VX_INLINE VXOpcodeTreeNodeType VXGetOpcodeNodeType(VXOpcodeTreeNode node)
 | 
				
			||||||
 * @param   node    The node.
 | 
					 * @param   node    The node.
 | 
				
			||||||
 * @return  The value of the specified opcode tree node.
 | 
					 * @return  The value of the specified opcode tree node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE uint16_t VXGetOpcodeNodeValue(VXOpcodeTreeNode node)
 | 
					ZYDIS_INLINE uint16_t ZyDisGetOpcodeNodeValue(ZyDisOpcodeTreeNode node)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (node & 0x0FFF);   
 | 
					    return (node & 0x0FFF);   
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -187,7 +187,7 @@ VX_INLINE uint16_t VXGetOpcodeNodeValue(VXOpcodeTreeNode node)
 | 
				
			||||||
 * @brief   Returns the root node of the opcode tree.
 | 
					 * @brief   Returns the root node of the opcode tree.
 | 
				
			||||||
 * @return  The root node of the opcode tree.
 | 
					 * @return  The root node of the opcode tree.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE VXOpcodeTreeNode VXGetOpcodeTreeRoot()
 | 
					ZYDIS_INLINE ZyDisOpcodeTreeNode ZyDisGetOpcodeTreeRoot()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return 0x1000;
 | 
					    return 0x1000;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -198,10 +198,10 @@ VX_INLINE VXOpcodeTreeNode VXGetOpcodeTreeRoot()
 | 
				
			||||||
 * @param   index   The index of the child node to retrieve.
 | 
					 * @param   index   The index of the child node to retrieve.
 | 
				
			||||||
 * @return  The specified child node.
 | 
					 * @return  The specified child node.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE VXOpcodeTreeNode VXGetOpcodeTreeChild(VXOpcodeTreeNode parent, uint16_t index)
 | 
					ZYDIS_INLINE ZyDisOpcodeTreeNode ZyDisGetOpcodeTreeChild(ZyDisOpcodeTreeNode parent, uint16_t index)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VXOpcodeTreeNodeType nodeType = VXGetOpcodeNodeType(parent);
 | 
					    ZyDisOpcodeTreeNodeType nodeType = ZyDisGetOpcodeNodeType(parent);
 | 
				
			||||||
    uint16_t tableIndex = VXGetOpcodeNodeValue(parent);
 | 
					    uint16_t tableIndex = ZyDisGetOpcodeNodeValue(parent);
 | 
				
			||||||
    switch (nodeType)
 | 
					    switch (nodeType)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    case OTNT_TABLE:
 | 
					    case OTNT_TABLE:
 | 
				
			||||||
| 
						 | 
					@ -257,9 +257,9 @@ VX_INLINE VXOpcodeTreeNode VXGetOpcodeTreeChild(VXOpcodeTreeNode parent, uint16_
 | 
				
			||||||
 * @param   node    The instruction definition node.
 | 
					 * @param   node    The instruction definition node.
 | 
				
			||||||
 * @return  Pointer to the instruction definition.
 | 
					 * @return  Pointer to the instruction definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE const VXInstructionDefinition* VXGetInstructionDefinition(VXOpcodeTreeNode node)
 | 
					ZYDIS_INLINE const ZyDisInstructionDefinition* ZyDisGetInstructionDefinition(ZyDisOpcodeTreeNode node)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    assert(VXGetOpcodeNodeType(node) == OTNT_INSTRUCTION_DEFINITION);
 | 
					    assert(ZyDisGetOpcodeNodeType(node) == OTNT_INSTRUCTION_DEFINITION);
 | 
				
			||||||
    return &vxInstrDefinitions[node & 0x0FFF];    
 | 
					    return &vxInstrDefinitions[node & 0x0FFF];    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -268,7 +268,7 @@ VX_INLINE const VXInstructionDefinition* VXGetInstructionDefinition(VXOpcodeTree
 | 
				
			||||||
 * @param   mnemonic    The mnemonic.
 | 
					 * @param   mnemonic    The mnemonic.
 | 
				
			||||||
 * @return  The instruction mnemonic string.
 | 
					 * @return  The instruction mnemonic string.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE const char* VXGetInstructionMnemonicString(VXInstructionMnemonic mnemonic)
 | 
					ZYDIS_INLINE const char* ZyDisGetInstructionMnemonicString(ZyDisInstructionMnemonic mnemonic)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return vxInstrMnemonicStrings[(uint16_t)mnemonic];
 | 
					    return vxInstrMnemonicStrings[(uint16_t)mnemonic];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -278,7 +278,7 @@ VX_INLINE const char* VXGetInstructionMnemonicString(VXInstructionMnemonic mnemo
 | 
				
			||||||
 * @param   operandSize The defined operand size.
 | 
					 * @param   operandSize The defined operand size.
 | 
				
			||||||
 * @return  The the numeric value for the simple operand size definition.
 | 
					 * @return  The the numeric value for the simple operand size definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE uint16_t VXGetSimpleOperandSize(VXDefinedOperandSize operandSize)
 | 
					ZYDIS_INLINE uint16_t ZyDisGetSimpleOperandSize(ZyDisDefinedOperandSize operandSize)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    static const uint16_t operandSizes[8] =
 | 
					    static const uint16_t operandSizes[8] =
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -295,9 +295,9 @@ VX_INLINE uint16_t VXGetSimpleOperandSize(VXDefinedOperandSize operandSize)
 | 
				
			||||||
 * @param   operandSize The defined operand size.
 | 
					 * @param   operandSize The defined operand size.
 | 
				
			||||||
 * @return  The memory-size part of the operand size definition.
 | 
					 * @return  The memory-size part of the operand size definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE VXDefinedOperandSize VXGetComplexOperandMemSize(VXDefinedOperandSize operandSize)
 | 
					ZYDIS_INLINE ZyDisDefinedOperandSize ZyDisGetComplexOperandMemSize(ZyDisDefinedOperandSize operandSize)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (VXDefinedOperandSize)(operandSize & 0x0F);
 | 
					    return (ZyDisDefinedOperandSize)(operandSize & 0x0F);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -305,9 +305,9 @@ VX_INLINE VXDefinedOperandSize VXGetComplexOperandMemSize(VXDefinedOperandSize o
 | 
				
			||||||
 * @param   operandSize The defined operand size.
 | 
					 * @param   operandSize The defined operand size.
 | 
				
			||||||
 * @return  The register-size part of the operand size definition.
 | 
					 * @return  The register-size part of the operand size definition.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
VX_INLINE VXDefinedOperandSize VXGetComplexOperandRegSize(VXDefinedOperandSize operandSize)
 | 
					ZYDIS_INLINE ZyDisDefinedOperandSize ZyDisGetComplexOperandRegSize(ZyDisDefinedOperandSize operandSize)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return (VXDefinedOperandSize)((operandSize >> 4) & 0x0F);    
 | 
					    return (ZyDisDefinedOperandSize)((operandSize >> 4) & 0x0F);    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // _VDE_VXOPCODETABLEINTERNAL_H_
 | 
					#endif // _VDE_ZyDisOPCODETABLEINTERNAL_H_
 | 
				
			||||||
		Loading…
	
		Reference in New Issue