mirror of https://github.com/x64dbg/zydis
Inverted feature gate macros
This commit is contained in:
parent
2dadf3f7a1
commit
fb452e5b59
|
@ -10,7 +10,10 @@ project(Zydis VERSION 2.0)
|
|||
|
||||
# Features
|
||||
option(ZYDIS_FEATURE_DECODER
|
||||
"Enable instruction decoding and formtting functionality"
|
||||
"Enable instruction decoding functionality"
|
||||
ON)
|
||||
option(ZYDIS_FEATURE_FORMATTER
|
||||
"Enable instruction formatting functionality"
|
||||
ON)
|
||||
#option(ZYDIS_FEATURE_ENCODER
|
||||
# "Enable instruction encoding functionality"
|
||||
|
@ -80,24 +83,18 @@ if (NOT ZYDIS_FEATURE_ENCODER AND NOT ZYDIS_FEATURE_DECODER)
|
|||
)
|
||||
endif ()
|
||||
|
||||
if (ZYDIS_FEATURE_EVEX)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_EVEX")
|
||||
if (NOT ZYDIS_FEATURE_DECODER)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_DISABLE_DECODER")
|
||||
endif ()
|
||||
if (ZYDIS_FEATURE_MVEX)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_MVEX")
|
||||
if (NOT ZYDIS_FEATURE_FORMATTER)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_DISABLE_FORMATTER")
|
||||
endif ()
|
||||
if (ZYDIS_FEATURE_FLAGS)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_FLAGS")
|
||||
if (NOT ZYDIS_FEATURE_EVEX)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_DISABLE_EVEX")
|
||||
endif ()
|
||||
if (ZYDIS_FEATURE_CPUID)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_CPUID")
|
||||
if (NOT ZYDIS_FEATURE_MVEX)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_DISABLE_MVEX")
|
||||
endif ()
|
||||
if (ZYDIS_FEATURE_DECODER)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_DECODER")
|
||||
endif ()
|
||||
#if (ZYDIS_FEATURE_ENCODER)
|
||||
# target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_ENCODER")
|
||||
#endif ()
|
||||
|
||||
target_sources("Zydis"
|
||||
PUBLIC
|
||||
|
@ -134,16 +131,6 @@ if (ZYDIS_FEATURE_DECODER)
|
|||
"src/FormatHelper.c")
|
||||
endif ()
|
||||
|
||||
#if (ZYDIS_FEATURE_ENCODER)
|
||||
# target_sources("Zydis"
|
||||
# PUBLIC
|
||||
# "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Encoder.h"
|
||||
# PRIVATE
|
||||
# "src/EncoderData.h"
|
||||
# "src/Encoder.c"
|
||||
# "src/EncoderData.c")
|
||||
#endif ()
|
||||
|
||||
if (BUILD_SHARED_LIBS AND WIN32)
|
||||
target_sources("Zydis" PRIVATE "src/VersionInfo.rc")
|
||||
endif ()
|
||||
|
|
|
@ -470,10 +470,10 @@ static ZydisStatus ZydisDecodeVEX(ZydisDecoderContext* context,
|
|||
}
|
||||
|
||||
// Map 0 is only valid for some KNC instructions
|
||||
#ifdef ZYDIS_ENABLE_FEATURE_MVEX
|
||||
if (instruction->raw.vex.m_mmmm > 0x03)
|
||||
#else
|
||||
#ifdef ZYDIS_DISABLE_MVEX
|
||||
if ((instruction->raw.vex.m_mmmm == 0) || (instruction->raw.vex.m_mmmm > 0x03))
|
||||
#else
|
||||
if (instruction->raw.vex.m_mmmm > 0x03)
|
||||
#endif
|
||||
{
|
||||
// Invalid according to the intel documentation
|
||||
|
|
11
src/Zydis.c
11
src/Zydis.c
|
@ -40,33 +40,32 @@ ZydisBool ZydisIsFeatureEnabled(ZydisFeature feature)
|
|||
switch (feature)
|
||||
{
|
||||
case ZYDIS_FEATURE_EVEX:
|
||||
#ifdef ZYDIS_ENABLE_FEATURE_EVEX
|
||||
#ifndef ZYDIS_DISABLE_EVEX
|
||||
return ZYDIS_TRUE;
|
||||
#else
|
||||
return ZYDIS_FALSE;
|
||||
#endif
|
||||
case ZYDIS_FEATURE_MVEX:
|
||||
#ifdef ZYDIS_ENABLE_FEATURE_MVEX
|
||||
#ifndef ZYDIS_DISABLE_MVEX
|
||||
return ZYDIS_TRUE;
|
||||
#else
|
||||
return ZYDIS_FALSE;
|
||||
#endif
|
||||
case ZYDIS_FEATURE_FLAGS:
|
||||
#ifdef ZYDIS_ENABLE_FEATURE_FLAGS
|
||||
#ifndef ZYDIS_DISABLE_FLAGS
|
||||
return ZYDIS_TRUE;
|
||||
#else
|
||||
return ZYDIS_FALSE;
|
||||
#endif
|
||||
case ZYDIS_FEATURE_CPUID:
|
||||
#ifdef ZYDIS_ENABLE_FEATURE_CPUID
|
||||
#ifndef ZYDIS_DISABLE_CPUID
|
||||
return ZYDIS_TRUE;
|
||||
#else
|
||||
return ZYDIS_FALSE;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
return ZYDIS_FALSE;
|
||||
}
|
||||
return ZYDIS_FALSE;
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
|
|
Loading…
Reference in New Issue