mirror of https://github.com/x64dbg/zydis
Various minor no-libc fixes
This commit is contained in:
parent
486add62ed
commit
a2cc8615ba
|
@ -55,47 +55,54 @@
|
|||
#else
|
||||
// No LibC, use compiler built-in types / macros.
|
||||
# if defined(ZYDIS_MSVC)
|
||||
typedef unsigned __int8 ZydisU8;
|
||||
typedef unsigned __int16 ZydisU16;
|
||||
typedef unsigned __int32 ZydisU32;
|
||||
typedef unsigned __int64 ZydisU64;
|
||||
typedef __int8 ZydisI8;
|
||||
typedef __int16 ZydisI16;
|
||||
typedef __int32 ZydisI32;
|
||||
typedef __int64 ZydisI64;
|
||||
# if _WIN64
|
||||
typedef ZydisU64 ZydisUSize;
|
||||
typedef ZydisI64 ZydisISize;
|
||||
# else
|
||||
typedef ZydisU32 ZydisUSize;
|
||||
typedef ZydisI32 ZydisISize;
|
||||
# endif
|
||||
# elif defined(ZYDIS_GNUC)
|
||||
typedef __UINT8_TYPE__ ZydisU8;
|
||||
typedef __UINT16_TYPE__ ZydisU16;
|
||||
typedef __UINT32_TYPE__ ZydisU32;
|
||||
typedef __UINT64_TYPE__ ZydisU64;
|
||||
typedef __INT8_TYPE__ ZydisI8;
|
||||
typedef __INT16_TYPE__ ZydisI16;
|
||||
typedef __INT32_TYPE__ ZydisI32;
|
||||
typedef __INT64_TYPE__ ZydisI64;
|
||||
typedef __SIZE_TYPE__ ZydisUSize;
|
||||
typedef __PTRDIFF_TYPE__ ZydisISize;
|
||||
typedef unsigned __int8 ZydisU8;
|
||||
typedef unsigned __int16 ZydisU16;
|
||||
typedef unsigned __int32 ZydisU32;
|
||||
typedef unsigned __int64 ZydisU64;
|
||||
typedef signed __int8 ZydisI8;
|
||||
typedef signed __int16 ZydisI16;
|
||||
typedef signed __int32 ZydisI32;
|
||||
typedef signed __int64 ZydisI64;
|
||||
# if _WIN64
|
||||
typedef ZydisU64 ZydisUSize;
|
||||
typedef ZydisI64 ZydisISize;
|
||||
# else
|
||||
typedef ZydisU32 ZydisUSize;
|
||||
typedef ZydisI32 ZydisISize;
|
||||
# endif
|
||||
# elif defined(ZYDIS_GNUC)
|
||||
typedef __UINT8_TYPE__ ZydisU8;
|
||||
typedef __UINT16_TYPE__ ZydisU16;
|
||||
typedef __UINT32_TYPE__ ZydisU32;
|
||||
typedef __UINT64_TYPE__ ZydisU64;
|
||||
typedef __INT8_TYPE__ ZydisI8;
|
||||
typedef __INT16_TYPE__ ZydisI16;
|
||||
typedef __INT32_TYPE__ ZydisI32;
|
||||
typedef __INT64_TYPE__ ZydisI64;
|
||||
typedef __SIZE_TYPE__ ZydisUSize;
|
||||
typedef __PTRDIFF_TYPE__ ZydisISize;
|
||||
# else
|
||||
# error "Unsupported compiler for no-libc mode."
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Verify assumptions.
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisU8) == 1);
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisU16) == 2);
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisU32) == 4);
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisU64) == 8);
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisI8) == 1);
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisI16) == 2);
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisI32) == 4);
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisI64) == 8);
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisUSize) == sizeof(ZydisISize));
|
||||
// Verify size assumptions.
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisU8 ) == 1 );
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisU16 ) == 2 );
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisU32 ) == 4 );
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisU64 ) == 8 );
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisI8 ) == 1 );
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisI16 ) == 2 );
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisI32 ) == 4 );
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisI64 ) == 8 );
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisUSize) == sizeof(void*));
|
||||
ZYDIS_STATIC_ASSERT(sizeof(ZydisISize) == sizeof(void*));
|
||||
|
||||
// Verify signedness assumptions (relies on size checks above).
|
||||
ZYDIS_STATIC_ASSERT((ZydisI8 )-1 >> 1 < (ZydisI8 )((ZydisU8 )-1 >> 1));
|
||||
ZYDIS_STATIC_ASSERT((ZydisI16)-1 >> 1 < (ZydisI16)((ZydisU16)-1 >> 1));
|
||||
ZYDIS_STATIC_ASSERT((ZydisI32)-1 >> 1 < (ZydisI32)((ZydisU32)-1 >> 1));
|
||||
ZYDIS_STATIC_ASSERT((ZydisI64)-1 >> 1 < (ZydisI64)((ZydisU64)-1 >> 1));
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* NULL */
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
# if __has_builtin(__builtin_unreachable)
|
||||
# define ZYDIS_UNREACHABLE __builtin_unreachable()
|
||||
# else
|
||||
# define ZYDIS_UNREACHABLE
|
||||
# define ZYDIS_UNREACHABLE for(;;)
|
||||
# endif
|
||||
# elif defined(ZYDIS_GCC) && ((__GNUC__ == 4 && __GNUC_MINOR__ > 4) || __GNUC__ > 4)
|
||||
# define ZYDIS_UNREACHABLE __builtin_unreachable()
|
||||
|
@ -151,10 +151,10 @@
|
|||
# elif defined(ZYDIS_MSVC)
|
||||
# define ZYDIS_UNREACHABLE __assume(0)
|
||||
# else
|
||||
# define ZYDIS_UNREACHABLE
|
||||
# define ZYDIS_UNREACHABLE for(;;)
|
||||
# endif
|
||||
#elif defined(ZYDIS_NO_LIBC)
|
||||
# define ZYDIS_UNREACHABLE
|
||||
# define ZYDIS_UNREACHABLE for(;;)
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
# define ZYDIS_UNREACHABLE { assert(0); abort(); }
|
||||
|
|
|
@ -125,7 +125,7 @@ enum ZydisFeatures
|
|||
* Use the macros provided in this file to extract the major, minor, patch and build part from the
|
||||
* returned version value.
|
||||
*/
|
||||
ZYDIS_EXPORT ZydisU64 ZydisGetVersion();
|
||||
ZYDIS_EXPORT ZydisU64 ZydisGetVersion(void);
|
||||
|
||||
/**
|
||||
* @brief Checks, if the specified feature is enabled in the current zydis library instance.
|
||||
|
|
|
@ -272,9 +272,9 @@ extern const ZydisDecoderTreeNode filtersMVEXE[][2];
|
|||
/* Decoder tree */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode()
|
||||
const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode(void)
|
||||
{
|
||||
static const ZydisDecoderTreeNode root = { ZYDIS_NODETYPE_FILTER_OPCODE, 0x00000000 };
|
||||
static const ZydisDecoderTreeNode root = { ZYDIS_NODETYPE_FILTER_OPCODE, 0x0000 };
|
||||
return &root;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ typedef struct ZydisInstructionEncodingInfo_
|
|||
*
|
||||
* @return The root node of the instruction tree.
|
||||
*/
|
||||
ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode();
|
||||
ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the child node of @c parent specified by @c index.
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
/* Exported functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
ZydisU64 ZydisGetVersion()
|
||||
ZydisU64 ZydisGetVersion(void)
|
||||
{
|
||||
return ZYDIS_VERSION;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue