Updated CMake file and Zydis features

This commit is contained in:
flobernd 2017-06-21 18:25:53 +02:00
parent dc62509b9b
commit bd38d86986
4 changed files with 29 additions and 16 deletions

View File

@ -10,12 +10,15 @@ option(ZYDIS_BUILD_SHARED_LIBS
option(ZYDIS_FORCE_SHARED_CRT option(ZYDIS_FORCE_SHARED_CRT
"Forces shared linkage against the CRT even when building a static library. MSVC only." "Forces shared linkage against the CRT even when building a static library. MSVC only."
OFF) OFF)
option(ZYDIS_FEATURE_IMPLICITLY_USED_REGISTERS option(ZYDIS_FEATURE_EVEX
"Include information about implicitly used registers" "Enable EVEX encoded instructions"
OFF) ON)
option(ZYDIS_FEATURE_AFFECTED_FLAGS option(ZYDIS_FEATURE_MVEX
"Enable MVEX encoded instructions"
ON)
option(ZYDIS_FEATURE_FLAGS
"Include information about affected flags" "Include information about affected flags"
OFF) ON)
option(ZYDIS_FEATURE_CPUID option(ZYDIS_FEATURE_CPUID
"Include information about CPUID feature-flags" "Include information about CPUID feature-flags"
OFF) OFF)
@ -79,11 +82,14 @@ target_include_directories("Zydis" PUBLIC "include/" ${PROJECT_BINARY_DIR})
target_compile_definitions("Zydis" PRIVATE "_CRT_SECURE_NO_WARNINGS" "ZYDIS_EXPORTS") target_compile_definitions("Zydis" PRIVATE "_CRT_SECURE_NO_WARNINGS" "ZYDIS_EXPORTS")
generate_export_header("Zydis" BASE_NAME "ZYDIS" EXPORT_FILE_NAME "ZydisExportConfig.h") generate_export_header("Zydis" BASE_NAME "ZYDIS" EXPORT_FILE_NAME "ZydisExportConfig.h")
if (ZYDIS_FEATURE_IMPLICITLY_USED_REGISTERS) if (ZYDIS_FEATURE_EVEX)
target_compile_definitions("Zydis" PRIVATE "ZYDIS_ENABLE_FEATURE_IMPLICITLY_USED_REGISTERS") target_compile_definitions("Zydis" PRIVATE "ZYDIS_ENABLE_FEATURE_EVEX")
endif () endif ()
if (ZYDIS_FEATURE_AFFECTED_FLAGS) if (ZYDIS_FEATURE_MVEX)
target_compile_definitions("Zydis" PRIVATE "ZYDIS_ENABLE_FEATURE_AFFECTED_FLAGS") target_compile_definitions("Zydis" PRIVATE "ZYDIS_ENABLE_FEATURE_MVEX")
endif ()
if (ZYDIS_FEATURE_FLAGS)
target_compile_definitions("Zydis" PRIVATE "ZYDIS_ENABLE_FEATURE_FLAGS")
endif () endif ()
if (ZYDIS_FEATURE_CPUID) if (ZYDIS_FEATURE_CPUID)
target_compile_definitions("Zydis" PRIVATE "ZYDIS_ENABLE_FEATURE_CPUID") target_compile_definitions("Zydis" PRIVATE "ZYDIS_ENABLE_FEATURE_CPUID")

View File

@ -270,7 +270,7 @@ ZYDIS_EXPORT int16_t ZydisRegisterGetId(ZydisRegister reg);
ZYDIS_EXPORT ZydisRegisterClass ZydisRegisterGetClass(ZydisRegister reg); ZYDIS_EXPORT ZydisRegisterClass ZydisRegisterGetClass(ZydisRegister reg);
/** /**
* @brief Returns the width of the specified register mode. * @brief Returns the width of the specified register.
* *
* @param reg The register. * @param reg The register.
* *

View File

@ -103,8 +103,9 @@ typedef uint8_t ZydisFeature;
*/ */
enum ZydisFeatures enum ZydisFeatures
{ {
ZYDIS_FEATURE_IMPLICITLY_USED_REGISTERS, ZYDIS_FEATURE_EVEX,
ZYDIS_FEATURE_AFFECTED_FLAGS, ZYDIS_FEATURE_MVEX,
ZYDIS_FEATURE_FLAGS,
ZYDIS_FEATURE_CPUID ZYDIS_FEATURE_CPUID
}; };

View File

@ -39,14 +39,20 @@ ZydisBool ZydisIsFeatureEnabled(ZydisFeature feature)
{ {
switch (feature) switch (feature)
{ {
case ZYDIS_FEATURE_IMPLICITLY_USED_REGISTERS: case ZYDIS_FEATURE_EVEX:
#ifdef ZYDIS_ENABLE_FEATURE_IMPLICITLY_USED_REGISTERS #ifdef ZYDIS_ENABLE_FEATURE_EVEX
return ZYDIS_TRUE; return ZYDIS_TRUE;
#else #else
return ZYDIS_FALSE; return ZYDIS_FALSE;
#endif #endif
case ZYDIS_FEATURE_AFFECTED_FLAGS: case ZYDIS_FEATURE_MVEX:
#ifdef ZYDIS_ENABLE_FEATURE_AFFECTED_FLAGS #ifdef ZYDIS_ENABLE_FEATURE_MVEX
return ZYDIS_TRUE;
#else
return ZYDIS_FALSE;
#endif
case ZYDIS_FEATURE_FLAGS:
#ifdef ZYDIS_ENABLE_FEATURE_FLAGS
return ZYDIS_TRUE; return ZYDIS_TRUE;
#else #else
return ZYDIS_FALSE; return ZYDIS_FALSE;