mirror of https://github.com/x64dbg/zydis
Added support for compiling on ARM target
This commit is contained in:
parent
a835185da2
commit
56f47f4863
|
@ -63,8 +63,13 @@
|
||||||
typedef __int16 ZydisI16;
|
typedef __int16 ZydisI16;
|
||||||
typedef __int32 ZydisI32;
|
typedef __int32 ZydisI32;
|
||||||
typedef __int64 ZydisI64;
|
typedef __int64 ZydisI64;
|
||||||
typedef ZydisU64 ZydisUSize;
|
# if _WIN64
|
||||||
typedef ZydisI64 ZydisISize;
|
typedef ZydisU64 ZydisUSize;
|
||||||
|
typedef ZydisI64 ZydisISize;
|
||||||
|
# else
|
||||||
|
typedef ZydisU32 ZydisUSize;
|
||||||
|
typedef ZydisI32 ZydisISize;
|
||||||
|
# endif
|
||||||
# elif defined(ZYDIS_GNUC)
|
# elif defined(ZYDIS_GNUC)
|
||||||
typedef __UINT8_TYPE__ ZydisU8;
|
typedef __UINT8_TYPE__ ZydisU8;
|
||||||
typedef __UINT16_TYPE__ ZydisU16;
|
typedef __UINT16_TYPE__ ZydisU16;
|
||||||
|
|
|
@ -72,19 +72,21 @@
|
||||||
#elif defined(__posix)
|
#elif defined(__posix)
|
||||||
# define ZYDIS_POSIX
|
# define ZYDIS_POSIX
|
||||||
#else
|
#else
|
||||||
# error "Unsupported platform detected"
|
# define ZYDIS_UNKNOWN_PLATFORM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
/* Architecture detection */
|
/* Architecture detection */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
#if defined (_M_AMD64) || defined (__x86_64__)
|
#if defined(_M_AMD64) || defined(__x86_64__)
|
||||||
# define ZYDIS_X64
|
# define ZYDIS_X64
|
||||||
# define ZYDIS_WORD_SIZE 64
|
#elif defined(_M_IX86) || defined(__i386__)
|
||||||
#elif defined (_M_IX86) || defined (__i386__)
|
|
||||||
# define ZYDIS_X86
|
# define ZYDIS_X86
|
||||||
# define ZYDIS_WORD_SIZE 32
|
#elif defined(_M_ARM64) || defined(__aarch64__)
|
||||||
|
# define ZYDIS_AARCH64
|
||||||
|
#elif defined(_M_ARM) || defined(_M_ARMT) || defined(__arm__) || defined(__thumb__)
|
||||||
|
# define ZYDIS_ARM
|
||||||
#else
|
#else
|
||||||
# error "Unsupported architecture detected"
|
# error "Unsupported architecture detected"
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,7 +108,7 @@
|
||||||
# define ZYDIS_DEBUG
|
# define ZYDIS_DEBUG
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# error "Unsupported compiler detected"
|
# define ZYDIS_RELEASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
|
@ -98,7 +98,7 @@ void ZydisToUpperCase(char* buffer, ZydisUSize bufferLen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZYDIS_X86
|
#if defined(ZYDIS_X86) || defined(ZYDIS_ARM)
|
||||||
ZydisStatus ZydisPrintDecU32(char** buffer, ZydisUSize bufferLen, ZydisU32 value, ZydisU8 paddingLength)
|
ZydisStatus ZydisPrintDecU32(char** buffer, ZydisUSize bufferLen, ZydisU32 value, ZydisU8 paddingLength)
|
||||||
{
|
{
|
||||||
ZYDIS_ASSERT(buffer);
|
ZYDIS_ASSERT(buffer);
|
||||||
|
@ -354,7 +354,7 @@ ZydisStatus ZydisPrintStr(char** buffer, ZydisUSize bufferLen, const char* text,
|
||||||
|
|
||||||
ZydisStatus ZydisPrintDecU(char** buffer, ZydisUSize bufferLen, ZydisU64 value, ZydisU8 paddingLength)
|
ZydisStatus ZydisPrintDecU(char** buffer, ZydisUSize bufferLen, ZydisU64 value, ZydisU8 paddingLength)
|
||||||
{
|
{
|
||||||
#ifdef ZYDIS_X64
|
#if defined(ZYDIS_X64) || defined(ZYDIS_AARCH64)
|
||||||
return ZydisPrintDecU64(buffer, bufferLen, value, paddingLength);
|
return ZydisPrintDecU64(buffer, bufferLen, value, paddingLength);
|
||||||
#else
|
#else
|
||||||
if (value & 0xFFFFFFFF00000000)
|
if (value & 0xFFFFFFFF00000000)
|
||||||
|
@ -380,7 +380,7 @@ ZydisStatus ZydisPrintDecS(char** buffer, ZydisUSize bufferLen, ZydisI64 value,
|
||||||
ZydisStatus ZydisPrintHexU(char** buffer, ZydisUSize bufferLen, ZydisU64 value, ZydisU8 paddingLength,
|
ZydisStatus ZydisPrintHexU(char** buffer, ZydisUSize bufferLen, ZydisU64 value, ZydisU8 paddingLength,
|
||||||
ZydisBool uppercase, const char* prefix, const char* suffix)
|
ZydisBool uppercase, const char* prefix, const char* suffix)
|
||||||
{
|
{
|
||||||
#ifdef ZYDIS_X64
|
#if defined(ZYDIS_X64) || defined(ZYDIS_AARCH64)
|
||||||
return ZydisPrintHexU64(buffer, bufferLen, value, paddingLength, uppercase, prefix, suffix);
|
return ZydisPrintHexU64(buffer, bufferLen, value, paddingLength, uppercase, prefix, suffix);
|
||||||
#else
|
#else
|
||||||
if (value & 0xFFFFFFFF00000000)
|
if (value & 0xFFFFFFFF00000000)
|
||||||
|
|
Loading…
Reference in New Issue