Refactorings

This commit is contained in:
flobernd 2017-07-04 16:10:21 +02:00
parent bbf8b1193b
commit b9cf56af4d
4 changed files with 351 additions and 335 deletions

View File

@ -46,7 +46,7 @@ extern "C" {
typedef uint32_t ZydisDecodeGranularity; typedef uint32_t ZydisDecodeGranularity;
/** /**
* @brief Decoders modes defining how granular the instruction should be decoded. * @brief Decoder modes defining how granular the instruction should be decoded.
*/ */
enum ZydisDecodeGranularities enum ZydisDecodeGranularities
{ {
@ -56,16 +56,16 @@ enum ZydisDecodeGranularities
* *
* This mode should be sufficient, if you plan to analyse code for pure relocation purposes, * This mode should be sufficient, if you plan to analyse code for pure relocation purposes,
* as it gives you access to the mnemonic, the instruction-length, displacements, immediates * as it gives you access to the mnemonic, the instruction-length, displacements, immediates
* and even the `ZYDIS_ATTRIB_IS_RELATIVE`. * and the `ZYDIS_ATTRIB_IS_RELATIVE` attribute.
* *
* Operands, most attributes and other specific information (like AVX info) are not * Operands, most attributes and other specific information (like AVX info) are not
* accessible in this mode. * accessible in this mode.
*/ */
ZYDIS_DECODE_GRANULARITY_PHYSICAL, ZYDIS_DECODE_GRANULARITY_MINIMAL,
/** /**
* @brief Full physical and semantical instruction-decoding. * @brief Full physical and semantical instruction-decoding.
*/ */
ZYDIS_DECODE_GRANULARITY_SEMANTIC ZYDIS_DECODE_GRANULARITY_FULL
}; };
/** /**

View File

@ -1346,7 +1346,7 @@ typedef struct ZydisDecodedInstruction_
*/ */
uint8_t offset; uint8_t offset;
} imm[2]; } imm[2];
} details; } raw;
/** /**
* @brief This field is intended for custom data and may be freely set by the user. * @brief This field is intended for custom data and may be freely set by the user.
*/ */

File diff suppressed because it is too large Load Diff

View File

@ -33,14 +33,21 @@
#include <time.h> #include <time.h>
#include <Zydis/Zydis.h> #include <Zydis/Zydis.h>
#ifdef ZYDIS_WINDOWS #if defined(ZYDIS_WINDOWS)
# include <Windows.h> # include <Windows.h>
#elif defined(ZYDIS_APPLE)
# include <mach/mach_time.h>
#elif defined(ZYDIS_LINUX)
# include <sys/time.h>
#else
# error "Unsupported platform detected"
#endif #endif
/* ============================================================================================== */ /* ============================================================================================== */
/* Helper functions */ /* Helper functions */
/* ============================================================================================== */ /* ============================================================================================== */
#if defined(ZYDIS_WINDOWS)
double CounterFreq = 0.0; double CounterFreq = 0.0;
uint64_t CounterStart = 0; uint64_t CounterStart = 0;
@ -62,6 +69,11 @@ double GetCounter()
QueryPerformanceCounter(&li); QueryPerformanceCounter(&li);
return (double)(li.QuadPart - CounterStart) / CounterFreq; return (double)(li.QuadPart - CounterStart) / CounterFreq;
} }
#elif defined(ZYDIS_APPLE)
// TODO:
#elif defined(ZYDIS_LINUX)
// TODO:
#endif
/* ============================================================================================== */ /* ============================================================================================== */
/* Internal functions */ /* Internal functions */