mirror of https://github.com/x64dbg/zydis
Merge branch 'develop'
This commit is contained in:
commit
2852492484
|
@ -15,29 +15,32 @@ option(ZYDIS_FEATURE_DECODER
|
||||||
option(ZYDIS_FEATURE_FORMATTER
|
option(ZYDIS_FEATURE_FORMATTER
|
||||||
"Enable instruction formatting functionality"
|
"Enable instruction formatting functionality"
|
||||||
ON)
|
ON)
|
||||||
option(ZYDIS_FEATURE_EVEX
|
option(ZYDIS_FEATURE_EVEX
|
||||||
"Enable support for EVEX instructions"
|
"Enable support for EVEX instructions"
|
||||||
ON)
|
ON)
|
||||||
option(ZYDIS_FEATURE_MVEX
|
option(ZYDIS_FEATURE_MVEX
|
||||||
"Enable support for MVEX instructions"
|
"Enable support for MVEX instructions"
|
||||||
ON)
|
ON)
|
||||||
|
|
||||||
# Build configuration
|
# Build configuration
|
||||||
option(BUILD_SHARED_LIBS
|
option(BUILD_SHARED_LIBS
|
||||||
"Build shared libraries"
|
"Build shared libraries"
|
||||||
OFF)
|
OFF)
|
||||||
|
option(ZYDIS_WHOLE_PROGRAM_OPTIMIZATION
|
||||||
|
"Enable whole program optimization"
|
||||||
|
OFF)
|
||||||
option(ZYDIS_NO_LIBC
|
option(ZYDIS_NO_LIBC
|
||||||
"Don't use any C standard library functions (for exotic build-envs like kernel drivers)"
|
"Don't use any C standard library functions (for exotic build-envs like kernel drivers)"
|
||||||
OFF)
|
OFF)
|
||||||
option(ZYDIS_BUILD_EXAMPLES
|
option(ZYDIS_BUILD_EXAMPLES
|
||||||
"Build examples"
|
"Build examples"
|
||||||
ON)
|
ON)
|
||||||
option(ZYDIS_BUILD_TOOLS
|
option(ZYDIS_BUILD_TOOLS
|
||||||
"Build tools"
|
"Build tools"
|
||||||
ON)
|
ON)
|
||||||
option(ZYDIS_FUZZ_AFL_FAST
|
option(ZYDIS_FUZZ_AFL_FAST
|
||||||
"Enables AFL persistent mode and reduces prints in ZydisFuzzIn"
|
"Enables AFL persistent mode and reduces prints in ZydisFuzzIn"
|
||||||
OFF)
|
OFF)
|
||||||
option(ZYDIS_DEV_MODE
|
option(ZYDIS_DEV_MODE
|
||||||
"Enable developer mode (-Wall, -Werror, ...)"
|
"Enable developer mode (-Wall, -Werror, ...)"
|
||||||
OFF)
|
OFF)
|
||||||
|
@ -66,10 +69,15 @@ endif ()
|
||||||
|
|
||||||
add_library("Zydis")
|
add_library("Zydis")
|
||||||
|
|
||||||
target_include_directories("Zydis"
|
target_include_directories("Zydis"
|
||||||
PUBLIC "include" ${PROJECT_BINARY_DIR}
|
PUBLIC "include" ${PROJECT_BINARY_DIR}
|
||||||
PRIVATE "src")
|
PRIVATE "src")
|
||||||
target_compile_definitions("Zydis" PRIVATE "_CRT_SECURE_NO_WARNINGS" "ZYDIS_EXPORTS")
|
target_compile_definitions("Zydis" PRIVATE "_CRT_SECURE_NO_WARNINGS" "ZYDIS_EXPORTS")
|
||||||
|
if (ZYDIS_WHOLE_PROGRAM_OPTIMIZATION AND MSVC)
|
||||||
|
set_target_properties("Zydis" PROPERTIES COMPILE_FLAGS "/GL")
|
||||||
|
set_target_properties("Zydis" PROPERTIES LINK_FLAGS_RELEASE "/LTCG")
|
||||||
|
set_target_properties("Zydis" PROPERTIES STATIC_LIBRARY_FLAGS_RELEASE "/LTCG")
|
||||||
|
endif ()
|
||||||
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 (NOT ZYDIS_FEATURE_ENCODER AND NOT ZYDIS_FEATURE_DECODER)
|
if (NOT ZYDIS_FEATURE_ENCODER AND NOT ZYDIS_FEATURE_DECODER)
|
||||||
|
@ -80,6 +88,13 @@ if (NOT ZYDIS_FEATURE_ENCODER AND NOT ZYDIS_FEATURE_DECODER)
|
||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (ZYDIS_FEATURE_FORMATTER AND NOT ZYDIS_FEATURE_DECODER)
|
||||||
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"\nZYDIS_FEATURE_FORMATTER requires ZYDIS_FEATURE_DECODER to be enabled"
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (NOT ZYDIS_FEATURE_DECODER)
|
if (NOT ZYDIS_FEATURE_DECODER)
|
||||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_DISABLE_DECODER")
|
target_compile_definitions("Zydis" PUBLIC "ZYDIS_DISABLE_DECODER")
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -97,7 +112,7 @@ if (ZYDIS_NO_LIBC)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_sources("Zydis"
|
target_sources("Zydis"
|
||||||
PUBLIC
|
PRIVATE
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/CommonTypes.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/CommonTypes.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Defines.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Defines.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/MetaInfo.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/MetaInfo.h"
|
||||||
|
@ -110,7 +125,6 @@ target_sources("Zydis"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Zydis.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Zydis.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Internal/LibC.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Internal/LibC.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Internal/SharedData.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Internal/SharedData.h"
|
||||||
PRIVATE
|
|
||||||
"src/MetaInfo.c"
|
"src/MetaInfo.c"
|
||||||
"src/Mnemonic.c"
|
"src/Mnemonic.c"
|
||||||
"src/Register.c"
|
"src/Register.c"
|
||||||
|
@ -120,16 +134,19 @@ target_sources("Zydis"
|
||||||
"src/Zydis.c")
|
"src/Zydis.c")
|
||||||
|
|
||||||
if (ZYDIS_FEATURE_DECODER)
|
if (ZYDIS_FEATURE_DECODER)
|
||||||
target_sources("Zydis"
|
target_sources("Zydis"
|
||||||
PUBLIC
|
PRIVATE
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Decoder.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Decoder.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/DecoderTypes.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/DecoderTypes.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Formatter.h"
|
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Internal/DecoderData.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Internal/DecoderData.h"
|
||||||
PRIVATE
|
|
||||||
"src/Decoder.c"
|
"src/Decoder.c"
|
||||||
"src/DecoderData.c"
|
"src/DecoderData.c")
|
||||||
"src/Formatter.c")
|
if (ZYDIS_FEATURE_FORMATTER)
|
||||||
|
target_sources("Zydis"
|
||||||
|
PRIVATE
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Formatter.h"
|
||||||
|
"src/Formatter.c")
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS AND WIN32)
|
if (BUILD_SHARED_LIBS AND WIN32)
|
||||||
|
@ -141,14 +158,17 @@ install(TARGETS "Zydis"
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
install(DIRECTORY "include" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(FILES
|
||||||
|
"${PROJECT_BINARY_DIR}/ZydisExportConfig.h"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
install(DIRECTORY "include/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# Examples #
|
# Examples #
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
if (ZYDIS_BUILD_EXAMPLES)
|
if (ZYDIS_BUILD_EXAMPLES)
|
||||||
if (ZYDIS_FEATURE_DECODER)
|
if (ZYDIS_FEATURE_DECODER AND ZYDIS_FEATURE_FORMATTER)
|
||||||
add_executable("FormatterHooks" "examples/FormatterHooks.c")
|
add_executable("FormatterHooks" "examples/FormatterHooks.c")
|
||||||
target_link_libraries("FormatterHooks" "Zydis")
|
target_link_libraries("FormatterHooks" "Zydis")
|
||||||
set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples/Formatter")
|
set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples/Formatter")
|
||||||
|
@ -158,14 +178,22 @@ if (ZYDIS_BUILD_EXAMPLES)
|
||||||
target_link_libraries("ZydisFuzzIn" "Zydis")
|
target_link_libraries("ZydisFuzzIn" "Zydis")
|
||||||
set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples")
|
set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples")
|
||||||
target_compile_definitions("ZydisFuzzIn" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
target_compile_definitions("ZydisFuzzIn" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||||
if (ZYDIS_FUZZ_AFL_FAST)
|
if (ZYDIS_WHOLE_PROGRAM_OPTIMIZATION AND MSVC)
|
||||||
target_compile_definitions("ZydisFuzzIn" PRIVATE "ZYDIS_FUZZ_AFL_FAST")
|
set_target_properties("ZydisFuzzIn" PROPERTIES COMPILE_FLAGS "/GL")
|
||||||
endif ()
|
set_target_properties("ZydisFuzzIn" PROPERTIES LINK_FLAGS_RELEASE "/LTCG")
|
||||||
|
endif ()
|
||||||
|
if (ZYDIS_FUZZ_AFL_FAST)
|
||||||
|
target_compile_definitions("ZydisFuzzIn" PRIVATE "ZYDIS_FUZZ_AFL_FAST")
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_executable("ZydisPerfTest" "examples/ZydisPerfTest.c")
|
add_executable("ZydisPerfTest" "examples/ZydisPerfTest.c")
|
||||||
target_link_libraries("ZydisPerfTest" "Zydis")
|
target_link_libraries("ZydisPerfTest" "Zydis")
|
||||||
set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples")
|
set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples")
|
||||||
target_compile_definitions("ZydisPerfTest" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
target_compile_definitions("ZydisPerfTest" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||||
|
if (ZYDIS_WHOLE_PROGRAM_OPTIMIZATION AND MSVC)
|
||||||
|
set_target_properties("ZydisPerfTest" PROPERTIES COMPILE_FLAGS "/GL")
|
||||||
|
set_target_properties("ZydisPerfTest" PROPERTIES LINK_FLAGS_RELEASE "/LTCG")
|
||||||
|
endif ()
|
||||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
target_compile_definitions("ZydisPerfTest" PRIVATE "_GNU_SOURCE")
|
target_compile_definitions("ZydisPerfTest" PRIVATE "_GNU_SOURCE")
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
@ -179,15 +207,23 @@ endif ()
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
if (ZYDIS_BUILD_TOOLS)
|
if (ZYDIS_BUILD_TOOLS)
|
||||||
if (ZYDIS_FEATURE_DECODER)
|
if (ZYDIS_FEATURE_DECODER AND ZYDIS_FEATURE_FORMATTER)
|
||||||
add_executable("ZydisDisasm" "tools/ZydisDisasm.c")
|
add_executable("ZydisDisasm" "tools/ZydisDisasm.c")
|
||||||
target_link_libraries("ZydisDisasm" "Zydis")
|
target_link_libraries("ZydisDisasm" "Zydis")
|
||||||
set_target_properties ("ZydisDisasm" PROPERTIES FOLDER "Tools")
|
set_target_properties ("ZydisDisasm" PROPERTIES FOLDER "Tools")
|
||||||
target_compile_definitions("ZydisDisasm" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
target_compile_definitions("ZydisDisasm" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||||
|
if (ZYDIS_WHOLE_PROGRAM_OPTIMIZATION AND MSVC)
|
||||||
|
set_target_properties("ZydisDisasm" PROPERTIES COMPILE_FLAGS "/GL")
|
||||||
|
set_target_properties("ZydisDisasm" PROPERTIES LINK_FLAGS_RELEASE "/LTCG")
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_executable("ZydisInfo" "tools/ZydisInfo.c")
|
add_executable("ZydisInfo" "tools/ZydisInfo.c")
|
||||||
target_link_libraries("ZydisInfo" "Zydis")
|
target_link_libraries("ZydisInfo" "Zydis")
|
||||||
set_target_properties ("ZydisInfo" PROPERTIES FOLDER "Tools")
|
set_target_properties ("ZydisInfo" PROPERTIES FOLDER "Tools")
|
||||||
target_compile_definitions("ZydisInfo" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
target_compile_definitions("ZydisInfo" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||||
|
if (ZYDIS_WHOLE_PROGRAM_OPTIMIZATION AND MSVC)
|
||||||
|
set_target_properties("ZydisInfo" PROPERTIES COMPILE_FLAGS "/GL")
|
||||||
|
set_target_properties("ZydisInfo" PROPERTIES LINK_FLAGS_RELEASE "/LTCG")
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
4
LICENSE
4
LICENSE
|
@ -1,7 +1,7 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2017 Florian Bernd
|
Copyright (c) 2018 Florian Bernd
|
||||||
Copyright (c) 2017 Joel Höner
|
Copyright (c) 2018 Joel Höner
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
58
README.md
58
README.md
|
@ -1,31 +1,19 @@
|
||||||
![zydis logo](https://mainframe.pw/u/P94JAqY9XSDdPedv.svg?x)
|
![zydis logo](https://mainframe.pw/u/P94JAqY9XSDdPedv.svg?x)
|
||||||
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Gitter](https://badges.gitter.im/zyantific/zyan-disassembler-engine.svg)](https://gitter.im/zyantific/zyan-disassembler-engine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) [![Build status](https://ci.appveyor.com/api/projects/status/2tad27q0b9v6qtga/branch/master?svg=true)](https://ci.appveyor.com/project/athre0z/zydis/branch/master)
|
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Gitter](https://badges.gitter.im/zyantific/zyan-disassembler-engine.svg)](https://gitter.im/zyantific/zydis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) [![Discord](https://img.shields.io/discord/390136917779415060.svg)](https://discordapp.com/channels/390136917779415060/390138781313007626) [![Build status](https://ci.appveyor.com/api/projects/status/2tad27q0b9v6qtga/branch/master?svg=true)](https://ci.appveyor.com/project/athre0z/zydis/branch/master)
|
||||||
|
|
||||||
Fast and lightweight x86/x86-64 disassembler library.
|
Fast and lightweight x86/x86-64 disassembler library.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Supports all x86 and x86-64 (AMD64) instructions.
|
- Supports all x86 and x86-64 (AMD64) instructions and [extensions](https://github.com/zyantific/zydis/blob/master/include/Zydis/Generated/EnumISAExt.h)
|
||||||
- Supports pretty much all ISA extensions (list incomplete):
|
|
||||||
- FPU (x87), MMX
|
|
||||||
- SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, AESNI
|
|
||||||
- AVX, AVX2, AVX512BW, AVX512CD, AVX512DQ, AVX512ER, AVX512F, AVX512PF, AVX512VL
|
|
||||||
- ADX, BMI1, BMI2, FMA, FMA4
|
|
||||||
- Optimized for high performance
|
- Optimized for high performance
|
||||||
- No dynamic memory allocation ("malloc")
|
- No dynamic memory allocation ("malloc")
|
||||||
|
- Thread-safe by design
|
||||||
- Very small file-size overhead compared to other common disassembler libraries
|
- Very small file-size overhead compared to other common disassembler libraries
|
||||||
- [Complete doxygen documentation](https://www.zyantific.com/doc/zydis/index.html)
|
- [Complete doxygen documentation](https://www.zyantific.com/doc/zydis/index.html)
|
||||||
- No dependencies on platform specific APIs
|
- Absolutely no dependencies — [not even libc](https://github.com/zyantific/zydis/blob/develop/CMakeLists.txt#L32)
|
||||||
- Should compile on any platform with a complete libc and CMake
|
- Should compile on any platform with a working C99 compiler
|
||||||
- Tested on Windows, macOS and Linux
|
- Tested on Windows, macOS, FreeBSD and Linux, both user and kernel mode
|
||||||
|
|
||||||
## Roadmap
|
|
||||||
|
|
||||||
- Language bindings [v2.0 final]
|
|
||||||
- Tests [v2.0 final]
|
|
||||||
- Graphical editor for the instruction-database [v2.0 final]
|
|
||||||
- Implement CMake feature gates. Currently, everything is always included. [v2.0 final]
|
|
||||||
- Encoding support [v2.1]
|
|
||||||
|
|
||||||
## Quick Example
|
## Quick Example
|
||||||
|
|
||||||
|
@ -33,49 +21,52 @@ The following example program uses Zydis to disassemble a given memory buffer an
|
||||||
|
|
||||||
```C
|
```C
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <Zydis/Zydis.h>
|
#include <Zydis/Zydis.h>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
uint8_t data[] =
|
uint8_t data[] =
|
||||||
{
|
{
|
||||||
0x51, 0x8D, 0x45, 0xFF, 0x50, 0xFF, 0x75, 0x0C, 0xFF, 0x75,
|
0x51, 0x8D, 0x45, 0xFF, 0x50, 0xFF, 0x75, 0x0C, 0xFF, 0x75,
|
||||||
0x08, 0xFF, 0x15, 0xA0, 0xA5, 0x48, 0x76, 0x85, 0xC0, 0x0F,
|
0x08, 0xFF, 0x15, 0xA0, 0xA5, 0x48, 0x76, 0x85, 0xC0, 0x0F,
|
||||||
0x88, 0xFC, 0xDA, 0x02, 0x00
|
0x88, 0xFC, 0xDA, 0x02, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize decoder context.
|
// Initialize decoder context.
|
||||||
ZydisDecoder decoder;
|
ZydisDecoder decoder;
|
||||||
ZydisDecoderInit(
|
ZydisDecoderInit(
|
||||||
&decoder,
|
&decoder,
|
||||||
ZYDIS_MACHINE_MODE_LONG_64,
|
ZYDIS_MACHINE_MODE_LONG_64,
|
||||||
ZYDIS_ADDRESS_WIDTH_64);
|
ZYDIS_ADDRESS_WIDTH_64);
|
||||||
|
|
||||||
// Initialize formatter. Only required when you actually plan to
|
// Initialize formatter. Only required when you actually plan to
|
||||||
// do instruction formatting ("disassembling"), like we do here.
|
// do instruction formatting ("disassembling"), like we do here.
|
||||||
ZydisFormatter formatter;
|
ZydisFormatter formatter;
|
||||||
ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL);
|
ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL);
|
||||||
|
|
||||||
// Loop over the instructions in our buffer.
|
// Loop over the instructions in our buffer.
|
||||||
|
// The IP is chosen arbitrary here in order to better visualize
|
||||||
|
// relative addressing.
|
||||||
uint64_t instructionPointer = 0x007FFFFFFF400000;
|
uint64_t instructionPointer = 0x007FFFFFFF400000;
|
||||||
uint8_t* readPointer = data;
|
size_t offset = 0;
|
||||||
size_t length = sizeof(data);
|
size_t length = sizeof(data);
|
||||||
ZydisDecodedInstruction instruction;
|
ZydisDecodedInstruction instruction;
|
||||||
while (ZYDIS_SUCCESS(ZydisDecoderDecodeBuffer(
|
while (ZYDIS_SUCCESS(ZydisDecoderDecodeBuffer(
|
||||||
&decoder, readPointer, length, instructionPointer, &instruction)))
|
&decoder, data + offset, length - offset,
|
||||||
|
instructionPointer, &instruction)))
|
||||||
{
|
{
|
||||||
// Print current instruction pointer.
|
// Print current instruction pointer.
|
||||||
printf("%016" PRIX64 " ", instructionPointer);
|
printf("%016" PRIX64 " ", instructionPointer);
|
||||||
|
|
||||||
// Format & print the binary instruction
|
// Format & print the binary instruction
|
||||||
// structure to human readable format.
|
// structure to human readable format.
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
ZydisFormatterFormatInstruction(
|
ZydisFormatterFormatInstruction(
|
||||||
&formatter, &instruction, buffer, sizeof(buffer));
|
&formatter, &instruction, buffer, sizeof(buffer));
|
||||||
puts(buffer);
|
puts(buffer);
|
||||||
|
|
||||||
readPointer += instruction.length;
|
offset += instruction.length;
|
||||||
length -= instruction.length;
|
|
||||||
instructionPointer += instruction.length;
|
instructionPointer += instruction.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,12 +87,13 @@ The above example program generates the following output:
|
||||||
007FFFFFFF400013 js 0x007FFFFFFF42DB15
|
007FFFFFFF400013 js 0x007FFFFFFF42DB15
|
||||||
```
|
```
|
||||||
|
|
||||||
## Compilation
|
## Build
|
||||||
|
|
||||||
|
#### Unix
|
||||||
|
|
||||||
Zydis builds cleanly on most platforms without any external dependencies. You can use CMake to generate project files for your favorite C99 compiler.
|
Zydis builds cleanly on most platforms without any external dependencies. You can use CMake to generate project files for your favorite C99 compiler.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Linux and OS X
|
|
||||||
git clone 'https://github.com/zyantific/zydis.git'
|
git clone 'https://github.com/zyantific/zydis.git'
|
||||||
cd zydis
|
cd zydis
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
|
@ -109,12 +101,16 @@ cmake ..
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
|
||||||
|
Either use the [Visual Studio 2017 project](https://github.com/zyantific/zydis/tree/master/msvc) or build Zydis using [CMake](https://cmake.org/download/) ([video guide](https://www.youtube.com/watch?v=fywLDK1OAtQ)).
|
||||||
|
|
||||||
## `ZydisInfo` tool
|
## `ZydisInfo` tool
|
||||||
![ZydisInfo](https://raw.githubusercontent.com/zyantific/zydis/master/assets/screenshots/ZydisInfo.png)
|
![ZydisInfo](https://raw.githubusercontent.com/zyantific/zydis/master/assets/screenshots/ZydisInfo.png)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
- Intel (for open-sourcing [XED](https://github.com/intelxed/xed), allowing for automatic comparision of our tables against theirs, improving both)
|
- Intel (for open-sourcing [XED](https://github.com/intelxed/xed), allowing for automatic comparision of our tables against theirs, improving both)
|
||||||
- LLVM (for providing pretty solid instruction data as well)
|
- [LLVM](https://llvm.org) (for providing pretty solid instruction data as well)
|
||||||
- Christian Ludloff (http://sandpile.org, insanely helpful)
|
- Christian Ludloff (http://sandpile.org, insanely helpful)
|
||||||
- [LekoArts](https://www.lekoarts.de/) (for creating the project logo)
|
- [LekoArts](https://www.lekoarts.de/) (for creating the project logo)
|
||||||
- Our [contributors on GitHub](https://github.com/zyantific/zydis/graphs/contributors)
|
- Our [contributors on GitHub](https://github.com/zyantific/zydis/graphs/contributors)
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* @brief Demonstrates the hooking functionality of the @c ZydisFormatter class.
|
* @brief Demonstrates the hooking functionality of the @c ZydisFormatter class.
|
||||||
*
|
*
|
||||||
* This example demonstrates the hooking functionality of the @c ZydisFormatter class by
|
* This example demonstrates the hooking functionality of the @c ZydisFormatter class by
|
||||||
* rewriting the mnemonics of (V)CMPPS and (V)CMPPD to their corresponding alias-forms (based on
|
* rewriting the mnemonics of (V)CMPPS and (V)CMPPD to their corresponding alias-forms (based on
|
||||||
* the condition encoded in the immediate operand).
|
* the condition encoded in the immediate operand).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@
|
||||||
* @param string A pointer to the string.
|
* @param string A pointer to the string.
|
||||||
* @param format The format string.
|
* @param format The format string.
|
||||||
*
|
*
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
* sufficient to append the given text.
|
* sufficient to append the given text.
|
||||||
*/
|
*/
|
||||||
ZYDIS_INLINE ZydisStatus ZydisStringAppendFormatC(ZydisString* string, const char* format, ...)
|
ZYDIS_INLINE ZydisStatus ZydisStringAppendFormatC(ZydisString* string, const char* format, ...)
|
||||||
|
@ -62,7 +62,7 @@ ZYDIS_INLINE ZydisStatus ZydisStringAppendFormatC(ZydisString* string, const cha
|
||||||
|
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
va_start(arglist, format);
|
va_start(arglist, format);
|
||||||
const int w = vsnprintf(string->buffer + string->length, string->capacity - string->length,
|
const int w = vsnprintf(string->buffer + string->length, string->capacity - string->length,
|
||||||
format, arglist);
|
format, arglist);
|
||||||
if ((w < 0) || ((size_t)w > string->capacity - string->length))
|
if ((w < 0) || ((size_t)w > string->capacity - string->length))
|
||||||
{
|
{
|
||||||
|
@ -84,36 +84,36 @@ ZYDIS_INLINE ZydisStatus ZydisStringAppendFormatC(ZydisString* string, const cha
|
||||||
static const char* conditionCodeStrings[0x20] =
|
static const char* conditionCodeStrings[0x20] =
|
||||||
{
|
{
|
||||||
/*00*/ "eq",
|
/*00*/ "eq",
|
||||||
/*01*/ "lt",
|
/*01*/ "lt",
|
||||||
/*02*/ "le",
|
/*02*/ "le",
|
||||||
/*03*/ "unord",
|
/*03*/ "unord",
|
||||||
/*04*/ "neq",
|
/*04*/ "neq",
|
||||||
/*05*/ "nlt",
|
/*05*/ "nlt",
|
||||||
/*06*/ "nle",
|
/*06*/ "nle",
|
||||||
/*07*/ "ord",
|
/*07*/ "ord",
|
||||||
/*08*/ "eq_uq",
|
/*08*/ "eq_uq",
|
||||||
/*09*/ "nge",
|
/*09*/ "nge",
|
||||||
/*0A*/ "ngt",
|
/*0A*/ "ngt",
|
||||||
/*0B*/ "false",
|
/*0B*/ "false",
|
||||||
/*0C*/ "oq",
|
/*0C*/ "oq",
|
||||||
/*0D*/ "ge",
|
/*0D*/ "ge",
|
||||||
/*0E*/ "gt",
|
/*0E*/ "gt",
|
||||||
/*0F*/ "true",
|
/*0F*/ "true",
|
||||||
/*10*/ "eq_os",
|
/*10*/ "eq_os",
|
||||||
/*11*/ "lt_oq",
|
/*11*/ "lt_oq",
|
||||||
/*12*/ "le_oq",
|
/*12*/ "le_oq",
|
||||||
/*13*/ "unord_s",
|
/*13*/ "unord_s",
|
||||||
/*14*/ "neq_us",
|
/*14*/ "neq_us",
|
||||||
/*15*/ "nlt_uq",
|
/*15*/ "nlt_uq",
|
||||||
/*16*/ "nle_uq",
|
/*16*/ "nle_uq",
|
||||||
/*17*/ "ord_s",
|
/*17*/ "ord_s",
|
||||||
/*18*/ "eq_us",
|
/*18*/ "eq_us",
|
||||||
/*19*/ "nge_uq",
|
/*19*/ "nge_uq",
|
||||||
/*1A*/ "ngt_uq",
|
/*1A*/ "ngt_uq",
|
||||||
/*1B*/ "false_os",
|
/*1B*/ "false_os",
|
||||||
/*1C*/ "neq_os",
|
/*1C*/ "neq_os",
|
||||||
/*1D*/ "ge_oq",
|
/*1D*/ "ge_oq",
|
||||||
/*1E*/ "gt_oq",
|
/*1E*/ "gt_oq",
|
||||||
/*1F*/ "true_us"
|
/*1F*/ "true_us"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,17 +135,17 @@ typedef struct ZydisCustomUserData_
|
||||||
|
|
||||||
ZydisFormatterFunc defaultPrintMnemonic;
|
ZydisFormatterFunc defaultPrintMnemonic;
|
||||||
|
|
||||||
static ZydisStatus ZydisFormatterPrintMnemonic(const ZydisFormatter* formatter,
|
static ZydisStatus ZydisFormatterPrintMnemonic(const ZydisFormatter* formatter,
|
||||||
ZydisString* string, const ZydisDecodedInstruction* instruction, ZydisCustomUserData* userData)
|
ZydisString* string, const ZydisDecodedInstruction* instruction, ZydisCustomUserData* userData)
|
||||||
{
|
{
|
||||||
// We use the user-data to pass data to the @c ZydisFormatterFormatOperandImm function.
|
// We use the user-data to pass data to the @c ZydisFormatterFormatOperandImm function
|
||||||
userData->ommitImmediate = ZYDIS_TRUE;
|
userData->ommitImmediate = ZYDIS_TRUE;
|
||||||
|
|
||||||
// Rewrite the instruction-mnemonic for the given instructions
|
// Rewrite the instruction-mnemonic for the given instructions
|
||||||
if (instruction->operands[instruction->operandCount - 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE)
|
if (instruction->operands[instruction->operandCount - 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE)
|
||||||
{
|
{
|
||||||
const uint8_t conditionCode =
|
const ZydisU8 conditionCode =
|
||||||
(uint8_t)instruction->operands[instruction->operandCount - 1].imm.value.u;
|
(ZydisU8)instruction->operands[instruction->operandCount - 1].imm.value.u;
|
||||||
switch (instruction->mnemonic)
|
switch (instruction->mnemonic)
|
||||||
{
|
{
|
||||||
case ZYDIS_MNEMONIC_CMPPS:
|
case ZYDIS_MNEMONIC_CMPPS:
|
||||||
|
@ -162,7 +162,7 @@ static ZydisStatus ZydisFormatterPrintMnemonic(const ZydisFormatter* formatter,
|
||||||
string, "cmp%spd", conditionCodeStrings[conditionCode]);
|
string, "cmp%spd", conditionCodeStrings[conditionCode]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ZYDIS_MNEMONIC_VCMPPS:
|
case ZYDIS_MNEMONIC_VCMPPS:
|
||||||
if (conditionCode < 0x20)
|
if (conditionCode < 0x20)
|
||||||
{
|
{
|
||||||
return ZydisStringAppendFormatC(
|
return ZydisStringAppendFormatC(
|
||||||
|
@ -181,12 +181,12 @@ static ZydisStatus ZydisFormatterPrintMnemonic(const ZydisFormatter* formatter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We did not rewrite the instruction-mnemonic. Signal the @c ZydisFormatterFormatOperandImm
|
// We did not rewrite the instruction-mnemonic. Signal the @c ZydisFormatterFormatOperandImm
|
||||||
// function not to omit the operand
|
// function not to omit the operand
|
||||||
userData->ommitImmediate = ZYDIS_FALSE;
|
userData->ommitImmediate = ZYDIS_FALSE;
|
||||||
|
|
||||||
// Default mnemonic printing
|
// Default mnemonic printing
|
||||||
return defaultPrintMnemonic(formatter, string, instruction, userData);
|
return defaultPrintMnemonic(formatter, string, instruction, userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
@ -194,16 +194,14 @@ static ZydisStatus ZydisFormatterPrintMnemonic(const ZydisFormatter* formatter,
|
||||||
ZydisFormatterOperandFunc defaultFormatOperandImm;
|
ZydisFormatterOperandFunc defaultFormatOperandImm;
|
||||||
|
|
||||||
static ZydisStatus ZydisFormatterFormatOperandImm(const ZydisFormatter* formatter,
|
static ZydisStatus ZydisFormatterFormatOperandImm(const ZydisFormatter* formatter,
|
||||||
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
||||||
const ZydisDecodedOperand* operand, ZydisCustomUserData* userData)
|
const ZydisDecodedOperand* operand, ZydisCustomUserData* userData)
|
||||||
{
|
{
|
||||||
// The @c ZydisFormatterFormatMnemonic sinals us to omit the immediate (condition-code)
|
// The @c ZydisFormatterFormatMnemonic sinals us to omit the immediate (condition-code)
|
||||||
// operand, because it got replaced by the alias-mnemonic
|
// operand, because it got replaced by the alias-mnemonic
|
||||||
if (userData->ommitImmediate)
|
if (userData->ommitImmediate)
|
||||||
{
|
{
|
||||||
// The formatter will automatically omit the operand, if the buffer remains unchanged
|
return ZYDIS_STATUS_SKIP_OPERAND;
|
||||||
// after the callback returns
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default immediate formatting
|
// Default immediate formatting
|
||||||
|
@ -216,7 +214,8 @@ static ZydisStatus ZydisFormatterFormatOperandImm(const ZydisFormatter* formatte
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
void disassembleBuffer(ZydisDecoder* decoder, uint8_t* data, size_t length, ZydisBool installHooks)
|
void disassembleBuffer(ZydisDecoder* decoder, ZydisU8* data, ZydisUSize length,
|
||||||
|
ZydisBool installHooks)
|
||||||
{
|
{
|
||||||
ZydisFormatter formatter;
|
ZydisFormatter formatter;
|
||||||
ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL);
|
ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL);
|
||||||
|
@ -226,14 +225,14 @@ void disassembleBuffer(ZydisDecoder* decoder, uint8_t* data, size_t length, Zydi
|
||||||
if (installHooks)
|
if (installHooks)
|
||||||
{
|
{
|
||||||
defaultPrintMnemonic = (ZydisFormatterFunc)&ZydisFormatterPrintMnemonic;
|
defaultPrintMnemonic = (ZydisFormatterFunc)&ZydisFormatterPrintMnemonic;
|
||||||
ZydisFormatterSetHook(&formatter, ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC,
|
ZydisFormatterSetHook(&formatter, ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC,
|
||||||
(const void**)&defaultPrintMnemonic);
|
(const void**)&defaultPrintMnemonic);
|
||||||
defaultFormatOperandImm = (ZydisFormatterOperandFunc)&ZydisFormatterFormatOperandImm;
|
defaultFormatOperandImm = (ZydisFormatterOperandFunc)&ZydisFormatterFormatOperandImm;
|
||||||
ZydisFormatterSetHook(&formatter, ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM,
|
ZydisFormatterSetHook(&formatter, ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM,
|
||||||
(const void**)&defaultFormatOperandImm);
|
(const void**)&defaultFormatOperandImm);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t instructionPointer = 0x007FFFFFFF400000;
|
ZydisU64 instructionPointer = 0x007FFFFFFF400000;
|
||||||
|
|
||||||
ZydisDecodedInstruction instruction;
|
ZydisDecodedInstruction instruction;
|
||||||
ZydisCustomUserData userData;
|
ZydisCustomUserData userData;
|
||||||
|
@ -246,9 +245,9 @@ void disassembleBuffer(ZydisDecoder* decoder, uint8_t* data, size_t length, Zydi
|
||||||
instructionPointer += instruction.length;
|
instructionPointer += instruction.length;
|
||||||
printf("%016" PRIX64 " ", instruction.instrAddress);
|
printf("%016" PRIX64 " ", instruction.instrAddress);
|
||||||
ZydisFormatterFormatInstructionEx(
|
ZydisFormatterFormatInstructionEx(
|
||||||
&formatter, &instruction, &buffer[0], sizeof(buffer), &userData);
|
&formatter, &instruction, &buffer[0], sizeof(buffer), &userData);
|
||||||
printf(" %s\n", &buffer[0]);
|
printf(" %s\n", &buffer[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
@ -263,10 +262,10 @@ int main()
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t data[] =
|
ZydisU8 data[] =
|
||||||
{
|
{
|
||||||
// cmpps xmm1, xmm4, 0x03
|
// cmpps xmm1, xmm4, 0x03
|
||||||
0x0F, 0xC2, 0xCC, 0x03,
|
0x0F, 0xC2, 0xCC, 0x03,
|
||||||
|
|
||||||
// vcmppd xmm1, xmm2, xmm3, 0x17
|
// vcmppd xmm1, xmm2, xmm3, 0x17
|
||||||
0xC5, 0xE9, 0xC2, 0xCB, 0x17,
|
0xC5, 0xE9, 0xC2, 0xCB, 0x17,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
|
|
||||||
Zyan Disassembler Engine (Zydis)
|
Zyan Disassembler Library (Zydis)
|
||||||
|
|
||||||
Original Author : Joel Höner
|
Original Author : Joel Hoener
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
*
|
*
|
||||||
* This file implements a tool that is supposed to be fed as input for fuzzers like AFL,
|
* This file implements a tool that is supposed to be fed as input for fuzzers like AFL,
|
||||||
* reading a control block from stdin, allowing the fuzzer to reach every possible
|
* reading a control block from stdin, allowing the fuzzer to reach every possible
|
||||||
* code-path, testing any possible combination of disassembler configurations.
|
* code-path, testing any possible combination of disassembler configurations.
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <Zydis/Zydis.h>
|
#include <Zydis/Zydis.h>
|
||||||
|
|
||||||
typedef struct ZydisFuzzControlBlock_
|
typedef struct ZydisFuzzControlBlock_
|
||||||
{
|
{
|
||||||
ZydisMachineMode machineMode;
|
ZydisMachineMode machineMode;
|
||||||
ZydisAddressWidth addressWidth;
|
ZydisAddressWidth addressWidth;
|
||||||
|
@ -120,13 +120,13 @@ int doIteration()
|
||||||
{
|
{
|
||||||
case ZYDIS_FORMATTER_PROP_HEX_PREFIX:
|
case ZYDIS_FORMATTER_PROP_HEX_PREFIX:
|
||||||
case ZYDIS_FORMATTER_PROP_HEX_SUFFIX:
|
case ZYDIS_FORMATTER_PROP_HEX_SUFFIX:
|
||||||
controlBlock.formatterProperties[prop] =
|
controlBlock.formatterProperties[prop] =
|
||||||
controlBlock.formatterProperties[prop] ? (uintptr_t)&controlBlock.string : 0;
|
controlBlock.formatterProperties[prop] ? (uintptr_t)&controlBlock.string : 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter, prop,
|
if (!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter, prop,
|
||||||
controlBlock.formatterProperties[prop])))
|
controlBlock.formatterProperties[prop])))
|
||||||
{
|
{
|
||||||
ZYDIS_MAYBE_FPUTS("Failed to set formatter-attribute\n", stderr);
|
ZYDIS_MAYBE_FPUTS("Failed to set formatter-attribute\n", stderr);
|
||||||
|
@ -143,7 +143,7 @@ int doIteration()
|
||||||
ZydisDecodedInstruction instruction;
|
ZydisDecodedInstruction instruction;
|
||||||
ZydisStatus status;
|
ZydisStatus status;
|
||||||
size_t readOffs = 0;
|
size_t readOffs = 0;
|
||||||
while ((status = ZydisDecoderDecodeBuffer(&decoder, readBuf + readOffs,
|
while ((status = ZydisDecoderDecodeBuffer(&decoder, readBuf + readOffs,
|
||||||
numBytesRead - readOffs, readOffs, &instruction)) != ZYDIS_STATUS_NO_MORE_DATA)
|
numBytesRead - readOffs, readOffs, &instruction)) != ZYDIS_STATUS_NO_MORE_DATA)
|
||||||
{
|
{
|
||||||
if (!ZYDIS_SUCCESS(status))
|
if (!ZYDIS_SUCCESS(status))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
|
|
||||||
Zyan Disassembler Engine (Zydis)
|
Zyan Disassembler Library (Zydis)
|
||||||
|
|
||||||
Original Author : Florian Bernd
|
Original Author : Florian Bernd
|
||||||
|
|
||||||
|
@ -166,16 +166,16 @@ uint64_t processBuffer(const char* buffer, size_t length, ZydisBool minimalMode,
|
||||||
ZydisDecoderEnableMode(&decoder, ZYDIS_DECODER_MODE_MINIMAL, minimalMode)))
|
ZydisDecoderEnableMode(&decoder, ZYDIS_DECODER_MODE_MINIMAL, minimalMode)))
|
||||||
{
|
{
|
||||||
fputs("Failed to adjust decoder-mode\n", stderr);
|
fputs("Failed to adjust decoder-mode\n", stderr);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisFormatter formatter;
|
ZydisFormatter formatter;
|
||||||
if (format)
|
if (format)
|
||||||
{
|
{
|
||||||
if (!ZYDIS_SUCCESS(ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL)) ||
|
if (!ZYDIS_SUCCESS(ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL)) ||
|
||||||
!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter,
|
!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter,
|
||||||
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG, ZYDIS_TRUE)) ||
|
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG, ZYDIS_TRUE)) ||
|
||||||
!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter,
|
!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter,
|
||||||
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE, ZYDIS_TRUE)))
|
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE, ZYDIS_TRUE)))
|
||||||
{
|
{
|
||||||
fputs("Failed to initialize instruction-formatter\n", stderr);
|
fputs("Failed to initialize instruction-formatter\n", stderr);
|
||||||
|
@ -188,7 +188,7 @@ uint64_t processBuffer(const char* buffer, size_t length, ZydisBool minimalMode,
|
||||||
ZydisStatus status;
|
ZydisStatus status;
|
||||||
ZydisDecodedInstruction instruction;
|
ZydisDecodedInstruction instruction;
|
||||||
char formatBuffer[256];
|
char formatBuffer[256];
|
||||||
while ((status = ZydisDecoderDecodeBuffer(&decoder, buffer + offset, length - offset, offset,
|
while ((status = ZydisDecoderDecodeBuffer(&decoder, buffer + offset, length - offset, offset,
|
||||||
&instruction)) != ZYDIS_STATUS_NO_MORE_DATA)
|
&instruction)) != ZYDIS_STATUS_NO_MORE_DATA)
|
||||||
{
|
{
|
||||||
ZYDIS_ASSERT(ZYDIS_SUCCESS(status));
|
ZYDIS_ASSERT(ZYDIS_SUCCESS(status));
|
||||||
|
@ -202,10 +202,10 @@ uint64_t processBuffer(const char* buffer, size_t length, ZydisBool minimalMode,
|
||||||
{
|
{
|
||||||
ZydisFormatterFormatInstruction(
|
ZydisFormatterFormatInstruction(
|
||||||
&formatter, &instruction, formatBuffer, sizeof(formatBuffer));
|
&formatter, &instruction, formatBuffer, sizeof(formatBuffer));
|
||||||
}
|
}
|
||||||
offset += instruction.length;
|
offset += instruction.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,8 +221,8 @@ void testPerformance(const char* buffer, size_t length, ZydisBool minimalMode, Z
|
||||||
{
|
{
|
||||||
count += processBuffer(buffer, length, minimalMode, format);
|
count += processBuffer(buffer, length, minimalMode, format);
|
||||||
}
|
}
|
||||||
printf("Minimal-Mode %d, Formatting %d, Instructions: %6.2fM, Time: %8.2f msec\n",
|
printf("Minimal-Mode %d, Formatting %d, Instructions: %6.2fM, Time: %8.2f msec\n",
|
||||||
minimalMode, format, (double)count / 1000000, GetCounter());
|
minimalMode, format, (double)count / 1000000, GetCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
void generateTestData(FILE* file, uint8_t encoding)
|
void generateTestData(FILE* file, uint8_t encoding)
|
||||||
|
@ -234,7 +234,7 @@ void generateTestData(FILE* file, uint8_t encoding)
|
||||||
fputs("Failed to initialize decoder\n", stderr);
|
fputs("Failed to initialize decoder\n", stderr);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t last = 0;
|
uint8_t last = 0;
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
ZydisDecodedInstruction instruction;
|
ZydisDecodedInstruction instruction;
|
||||||
|
@ -245,7 +245,7 @@ void generateTestData(FILE* file, uint8_t encoding)
|
||||||
{
|
{
|
||||||
data[i] = rand() % 256;
|
data[i] = rand() % 256;
|
||||||
}
|
}
|
||||||
uint8_t offset = rand() % (ZYDIS_MAX_INSTRUCTION_LENGTH - 2);
|
const uint8_t offset = rand() % (ZYDIS_MAX_INSTRUCTION_LENGTH - 2);
|
||||||
switch (encoding)
|
switch (encoding)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -302,13 +302,13 @@ void generateTestData(FILE* file, uint8_t encoding)
|
||||||
fwrite(&instruction.data[0], 1, instruction.length, file);
|
fwrite(&instruction.data[0], 1, instruction.length, file);
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
uint8_t p = (uint8_t)((double)count / 100000 * 100);
|
const uint8_t p = (uint8_t)((double)count / 100000 * 100);
|
||||||
if (last < p)
|
if (last < p)
|
||||||
{
|
{
|
||||||
last = p;
|
last = p;
|
||||||
printf("%3.0d%%\n", p);
|
printf("%3.0d%%\n", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
generate = ZYDIS_TRUE;
|
generate = ZYDIS_TRUE;
|
||||||
}
|
}
|
||||||
const char* directory = argv[2];
|
const char* directory = argv[2];
|
||||||
|
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
|
@ -353,25 +353,26 @@ int main(int argc, char** argv)
|
||||||
{ "EVEX" , "enc_evex.dat" },
|
{ "EVEX" , "enc_evex.dat" },
|
||||||
{ "MVEX" , "enc_mvex.dat" }
|
{ "MVEX" , "enc_mvex.dat" }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (generate)
|
if (generate)
|
||||||
{
|
{
|
||||||
time_t t;
|
time_t t;
|
||||||
srand((unsigned)time(&t));
|
srand((unsigned)time(&t));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
adjustProcessAndThreadPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustProcessAndThreadPriority();
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < ZYDIS_ARRAY_SIZE(tests); ++i)
|
for (uint8_t i = 0; i < ZYDIS_ARRAY_SIZE(tests); ++i)
|
||||||
{
|
{
|
||||||
FILE* file;
|
FILE* file;
|
||||||
|
|
||||||
size_t len = strlen(directory);
|
const size_t len = strlen(directory);
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
strncpy(&buf[0], directory, sizeof(buf) - 1);
|
strncpy(&buf[0], directory, sizeof(buf) - 1);
|
||||||
if (generate)
|
if (generate)
|
||||||
{
|
{
|
||||||
file = fopen(strncat(buf, tests[i].filename, sizeof(buf) - len - 1), "wb");
|
file = fopen(strncat(buf, tests[i].filename, sizeof(buf) - len - 1), "wb");
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
file = fopen(strncat(buf, tests[i].filename, sizeof(buf) - len - 1), "rb");
|
file = fopen(strncat(buf, tests[i].filename, sizeof(buf) - len - 1), "rb");
|
||||||
|
@ -389,20 +390,20 @@ int main(int argc, char** argv)
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
fseek(file, 0L, SEEK_END);
|
fseek(file, 0L, SEEK_END);
|
||||||
long length = ftell(file);
|
const long length = ftell(file);
|
||||||
void* buffer = malloc(length);
|
void* buffer = malloc(length);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Failed to allocate %" PRIu64 " bytes on the heap", (uint64_t)length);
|
"Failed to allocate %" PRIu64 " bytes on the heap", (uint64_t)length);
|
||||||
goto NextFile2;
|
goto NextFile2;
|
||||||
}
|
}
|
||||||
|
|
||||||
rewind(file);
|
rewind(file);
|
||||||
if (fread(buffer, 1, length, file) != (size_t)length)
|
if (fread(buffer, 1, length, file) != (size_t)length)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Could not read %" PRIu64 " bytes from file \"%s\"", (uint64_t)length, &buf[0]);
|
"Could not read %" PRIu64 " bytes from file \"%s\"", (uint64_t)length, &buf[0]);
|
||||||
goto NextFile1;
|
goto NextFile1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,11 +413,12 @@ int main(int argc, char** argv)
|
||||||
testPerformance(buffer, length, ZYDIS_FALSE, ZYDIS_TRUE );
|
testPerformance(buffer, length, ZYDIS_FALSE, ZYDIS_TRUE );
|
||||||
puts("");
|
puts("");
|
||||||
|
|
||||||
NextFile1:
|
NextFile1:
|
||||||
free(buffer);
|
free(buffer);
|
||||||
NextFile2:
|
|
||||||
fclose(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NextFile2:
|
||||||
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Zyan Disassembler Library (Zydis)
|
Zyan Disassembler Library (Zydis)
|
||||||
|
|
||||||
Original Author : Florian Bernd, Joel Höner
|
Original Author : Florian Bernd, Joel Hoener
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
typedef ptrdiff_t ZydisISize;
|
typedef ptrdiff_t ZydisISize;
|
||||||
typedef uintptr_t ZydisUPointer;
|
typedef uintptr_t ZydisUPointer;
|
||||||
typedef intptr_t ZydisIPointer;
|
typedef intptr_t ZydisIPointer;
|
||||||
#else
|
#else
|
||||||
// No LibC, use compiler built-in types / macros.
|
// No LibC, use compiler built-in types / macros.
|
||||||
# if defined(ZYDIS_MSVC)
|
# if defined(ZYDIS_MSVC)
|
||||||
typedef unsigned __int8 ZydisU8;
|
typedef unsigned __int8 ZydisU8;
|
||||||
|
@ -65,18 +65,18 @@
|
||||||
typedef signed __int16 ZydisI16;
|
typedef signed __int16 ZydisI16;
|
||||||
typedef signed __int32 ZydisI32;
|
typedef signed __int32 ZydisI32;
|
||||||
typedef signed __int64 ZydisI64;
|
typedef signed __int64 ZydisI64;
|
||||||
# if _WIN64
|
# if _WIN64
|
||||||
typedef ZydisU64 ZydisUSize;
|
typedef ZydisU64 ZydisUSize;
|
||||||
typedef ZydisI64 ZydisISize;
|
typedef ZydisI64 ZydisISize;
|
||||||
typedef ZydisU64 ZydisUPointer;
|
typedef ZydisU64 ZydisUPointer;
|
||||||
typedef ZydisI64 ZydisIPointer;
|
typedef ZydisI64 ZydisIPointer;
|
||||||
# else
|
# else
|
||||||
typedef ZydisU32 ZydisUSize;
|
typedef ZydisU32 ZydisUSize;
|
||||||
typedef ZydisI32 ZydisISize;
|
typedef ZydisI32 ZydisISize;
|
||||||
typedef ZydisU32 ZydisUPointer;
|
typedef ZydisU32 ZydisUPointer;
|
||||||
typedef ZydisI32 ZydisIPointer;
|
typedef ZydisI32 ZydisIPointer;
|
||||||
# endif
|
# 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;
|
||||||
typedef __UINT32_TYPE__ ZydisU32;
|
typedef __UINT32_TYPE__ ZydisU32;
|
||||||
|
|
|
@ -61,73 +61,83 @@ enum ZydisDecoderModes
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Enables minimal instruction decoding without semantic analysis.
|
* @brief Enables minimal instruction decoding without semantic analysis.
|
||||||
*
|
*
|
||||||
* This mode provides access to the mnemonic, the instruction-length, the effective
|
* This mode provides access to the mnemonic, the instruction-length, the effective
|
||||||
* operand-size, the effective address-width, some attributes (e.g. `ZYDIS_ATTRIB_IS_RELATIVE`)
|
* operand-size, the effective address-width, some attributes (e.g. `ZYDIS_ATTRIB_IS_RELATIVE`)
|
||||||
* and all of the information in the `raw` field of the `ZydisDecodedInstruction` struct.
|
* and all of the information in the `raw` field of the `ZydisDecodedInstruction` struct.
|
||||||
*
|
*
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* This mode is NOT enabled by default.
|
* This mode is NOT enabled by default.
|
||||||
*/
|
*/
|
||||||
ZYDIS_DECODER_MODE_MINIMAL,
|
ZYDIS_DECODER_MODE_MINIMAL,
|
||||||
/**
|
/**
|
||||||
* @brief Enables the AMD-branch mode.
|
* @brief Enables the AMD-branch mode.
|
||||||
*
|
*
|
||||||
* Intel ignores the operand-size override-prefix (`0x66`) for all branches with 32-bit
|
* Intel ignores the operand-size override-prefix (`0x66`) for all branches with 32-bit
|
||||||
* immediates and forces the operand-size of the instruction to 64-bit in 64-bit mode.
|
* immediates and forces the operand-size of the instruction to 64-bit in 64-bit mode.
|
||||||
* In AMD-branch mode `0x66` is not ignored and changes the operand-size and the size of the
|
* In AMD-branch mode `0x66` is not ignored and changes the operand-size and the size of the
|
||||||
* immediate to 16-bit.
|
* immediate to 16-bit.
|
||||||
*
|
*
|
||||||
* This mode is NOT enabled by default.
|
* This mode is NOT enabled by default.
|
||||||
*/
|
*/
|
||||||
ZYDIS_DECODER_MODE_AMD_BRANCHES,
|
ZYDIS_DECODER_MODE_AMD_BRANCHES,
|
||||||
/**
|
/**
|
||||||
* @brief Enables KNC compatibility-mode.
|
* @brief Enables KNC compatibility-mode.
|
||||||
*
|
*
|
||||||
* KNC and KNL+ chips are sharing opcodes and encodings for some mask-related instructions.
|
* KNC and KNL+ chips are sharing opcodes and encodings for some mask-related instructions.
|
||||||
* Enable this mode to use the old KNC specifications (different mnemonics, operands, ..).
|
* Enable this mode to use the old KNC specifications (different mnemonics, operands, ..).
|
||||||
*
|
*
|
||||||
* This mode is NOT enabled by default.
|
* This mode is NOT enabled by default.
|
||||||
*/
|
*/
|
||||||
ZYDIS_DECODER_MODE_KNC,
|
ZYDIS_DECODER_MODE_KNC,
|
||||||
/**
|
/**
|
||||||
* @brief Enables the MPX mode.
|
* @brief Enables the MPX mode.
|
||||||
*
|
*
|
||||||
* The MPX isa-extension reuses (overrides) some of the widenop instruction opcodes.
|
* The MPX isa-extension reuses (overrides) some of the widenop instruction opcodes.
|
||||||
*
|
*
|
||||||
* This mode is enabled by default.
|
* This mode is enabled by default.
|
||||||
*/
|
*/
|
||||||
ZYDIS_DECODER_MODE_MPX,
|
ZYDIS_DECODER_MODE_MPX,
|
||||||
/**
|
/**
|
||||||
* @brief Enables the CET mode.
|
* @brief Enables the CET mode.
|
||||||
*
|
*
|
||||||
* The CET isa-extension reuses (overrides) some of the widenop instruction opcodes.
|
* The CET isa-extension reuses (overrides) some of the widenop instruction opcodes.
|
||||||
*
|
*
|
||||||
* This mode is enabled by default.
|
* This mode is enabled by default.
|
||||||
*/
|
*/
|
||||||
ZYDIS_DECODER_MODE_CET,
|
ZYDIS_DECODER_MODE_CET,
|
||||||
/**
|
/**
|
||||||
* @brief Enables the LZCNT mode.
|
* @brief Enables the LZCNT mode.
|
||||||
*
|
*
|
||||||
* The LZCNT isa-extension reuses (overrides) some of the widenop instruction opcodes.
|
* The LZCNT isa-extension reuses (overrides) some of the widenop instruction opcodes.
|
||||||
*
|
*
|
||||||
* This mode is enabled by default.
|
* This mode is enabled by default.
|
||||||
*/
|
*/
|
||||||
ZYDIS_DECODER_MODE_LZCNT,
|
ZYDIS_DECODER_MODE_LZCNT,
|
||||||
/**
|
/**
|
||||||
* @brief Enables the TZCNT mode.
|
* @brief Enables the TZCNT mode.
|
||||||
*
|
*
|
||||||
* The TZCNT isa-extension reuses (overrides) some of the widenop instruction opcodes.
|
* The TZCNT isa-extension reuses (overrides) some of the widenop instruction opcodes.
|
||||||
*
|
*
|
||||||
* This mode is enabled by default.
|
* This mode is enabled by default.
|
||||||
*/
|
*/
|
||||||
ZYDIS_DECODER_MODE_TZCNT,
|
ZYDIS_DECODER_MODE_TZCNT,
|
||||||
|
/**
|
||||||
|
* @brief Enables the WBNOINVD mode.
|
||||||
|
*
|
||||||
|
* The `WBINVD` instruction is interpreted as `WBNOINVD` on ICL chips, if a `F3` prefix is
|
||||||
|
* used.
|
||||||
|
*
|
||||||
|
* This mode is disabled by default.
|
||||||
|
*/
|
||||||
|
ZYDIS_DECODER_MODE_WBNOINVD,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
ZYDIS_DECODER_MODE_MAX_VALUE = ZYDIS_DECODER_MODE_TZCNT
|
ZYDIS_DECODER_MODE_MAX_VALUE = ZYDIS_DECODER_MODE_WBNOINVD
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
@ -159,7 +169,7 @@ typedef struct ZydisDecoder_
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT ZydisStatus ZydisDecoderInit(ZydisDecoder* decoder, ZydisMachineMode machineMode,
|
ZYDIS_EXPORT ZydisStatus ZydisDecoderInit(ZydisDecoder* decoder, ZydisMachineMode machineMode,
|
||||||
ZydisAddressWidth addressWidth);
|
ZydisAddressWidth addressWidth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -181,13 +191,13 @@ ZYDIS_EXPORT ZydisStatus ZydisDecoderEnableMode(ZydisDecoder* decoder, ZydisDeco
|
||||||
* @param buffer A pointer to the input buffer.
|
* @param buffer A pointer to the input buffer.
|
||||||
* @param bufferLen The length of the input buffer.
|
* @param bufferLen The length of the input buffer.
|
||||||
* @param instructionPointer The instruction-pointer.
|
* @param instructionPointer The instruction-pointer.
|
||||||
* @param instruction A pointer to the @c ZydisDecodedInstruction struct, that receives
|
* @param instruction A pointer to the @c ZydisDecodedInstruction struct, that receives
|
||||||
* the details about the decoded instruction.
|
* the details about the decoded instruction.
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT ZydisStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder,
|
ZYDIS_EXPORT ZydisStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder,
|
||||||
const void* buffer, ZydisUSize bufferLen, ZydisU64 instructionPointer,
|
const void* buffer, ZydisUSize bufferLen, ZydisU64 instructionPointer,
|
||||||
ZydisDecodedInstruction* instruction);
|
ZydisDecodedInstruction* instruction);
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
|
@ -71,11 +71,15 @@ enum ZydisMemoryOperandTypes
|
||||||
*/
|
*/
|
||||||
ZYDIS_MEMOP_TYPE_AGEN,
|
ZYDIS_MEMOP_TYPE_AGEN,
|
||||||
/**
|
/**
|
||||||
* @brief A memory operand using `SIB` addressing form, where the index register is not used
|
* @brief A memory operand using `SIB` addressing form, where the index register is not used
|
||||||
* in address calculation and scale is ignored. No real memory-access is
|
* in address calculation and scale is ignored. No real memory-access is caused.
|
||||||
* caused.
|
|
||||||
*/
|
*/
|
||||||
ZYDIS_MEMOP_TYPE_MIB
|
ZYDIS_MEMOP_TYPE_MIB,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
|
ZYDIS_MEMOP_TYPE_MAX_VALUE = ZYDIS_MEMOP_TYPE_MIB
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
@ -102,7 +106,7 @@ typedef struct ZydisDecodedOperand_
|
||||||
/**
|
/**
|
||||||
* @brief The operand-action.
|
* @brief The operand-action.
|
||||||
*/
|
*/
|
||||||
ZydisOperandAction action;
|
ZydisOperandAction action;
|
||||||
/**
|
/**
|
||||||
* @brief The operand-encoding.
|
* @brief The operand-encoding.
|
||||||
*/
|
*/
|
||||||
|
@ -110,7 +114,7 @@ typedef struct ZydisDecodedOperand_
|
||||||
/**
|
/**
|
||||||
* @brief The logical size of the operand (in bits).
|
* @brief The logical size of the operand (in bits).
|
||||||
*/
|
*/
|
||||||
ZydisU16 size;
|
ZydisU16 size;
|
||||||
/**
|
/**
|
||||||
* @brief The element-type.
|
* @brief The element-type.
|
||||||
*/
|
*/
|
||||||
|
@ -131,7 +135,7 @@ typedef struct ZydisDecodedOperand_
|
||||||
/**
|
/**
|
||||||
* @brief The register value.
|
* @brief The register value.
|
||||||
*/
|
*/
|
||||||
ZydisRegister value;
|
ZydisRegister value;
|
||||||
// TODO: AVX512_4VNNIW MULTISOURCE registers
|
// TODO: AVX512_4VNNIW MULTISOURCE registers
|
||||||
} reg;
|
} reg;
|
||||||
/**
|
/**
|
||||||
|
@ -177,7 +181,7 @@ typedef struct ZydisDecodedOperand_
|
||||||
/**
|
/**
|
||||||
* @brief Extended info for pointer-operands.
|
* @brief Extended info for pointer-operands.
|
||||||
*/
|
*/
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ZydisU16 segment;
|
ZydisU16 segment;
|
||||||
ZydisU32 offset;
|
ZydisU32 offset;
|
||||||
|
@ -192,17 +196,17 @@ typedef struct ZydisDecodedOperand_
|
||||||
*/
|
*/
|
||||||
ZydisBool isSigned;
|
ZydisBool isSigned;
|
||||||
/**
|
/**
|
||||||
* @brief Signals, if the immediate value contains a relative offset. You can use
|
* @brief Signals, if the immediate value contains a relative offset. You can use
|
||||||
* @c ZydisCalcAbsoluteAddress to determine the absolute address value.
|
* @c ZydisCalcAbsoluteAddress to determine the absolute address value.
|
||||||
*/
|
*/
|
||||||
ZydisBool isRelative;
|
ZydisBool isRelative;
|
||||||
/**
|
/**
|
||||||
* @brief The immediate value.
|
* @brief The immediate value.
|
||||||
*/
|
*/
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
ZydisU64 u;
|
ZydisU64 u;
|
||||||
ZydisI64 s;
|
ZydisI64 s;
|
||||||
} value;
|
} value;
|
||||||
} imm;
|
} imm;
|
||||||
} ZydisDecodedOperand;
|
} ZydisDecodedOperand;
|
||||||
|
@ -267,39 +271,39 @@ typedef ZydisU64 ZydisInstructionAttributes;
|
||||||
#define ZYDIS_ATTRIB_IS_FAR_BRANCH 0x0000001000000000 // (1 << 36) // TODO: rebase
|
#define ZYDIS_ATTRIB_IS_FAR_BRANCH 0x0000001000000000 // (1 << 36) // TODO: rebase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the lock prefix (0xF0).
|
* @brief The instruction accepts the lock prefix (0xF0).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_LOCK 0x0000000000000200 // (1 << 9)
|
#define ZYDIS_ATTRIB_ACCEPTS_LOCK 0x0000000000000200 // (1 << 9)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the rep prefix (0xF3).
|
* @brief The instruction accepts the rep prefix (0xF3).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_REP 0x0000000000000400 // (1 << 10)
|
#define ZYDIS_ATTRIB_ACCEPTS_REP 0x0000000000000400 // (1 << 10)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the repe/repz prefix (0xF3).
|
* @brief The instruction accepts the repe/repz prefix (0xF3).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_REPE 0x0000000000000800 // (1 << 11)
|
#define ZYDIS_ATTRIB_ACCEPTS_REPE 0x0000000000000800 // (1 << 11)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the repe/repz prefix (0xF3).
|
* @brief The instruction accepts the repe/repz prefix (0xF3).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_REPZ 0x0000000000000800 // (1 << 11)
|
#define ZYDIS_ATTRIB_ACCEPTS_REPZ 0x0000000000000800 // (1 << 11)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the repne/repnz prefix (0xF2).
|
* @brief The instruction accepts the repne/repnz prefix (0xF2).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_REPNE 0x0000000000001000 // (1 << 12)
|
#define ZYDIS_ATTRIB_ACCEPTS_REPNE 0x0000000000001000 // (1 << 12)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the repne/repnz prefix (0xF2).
|
* @brief The instruction accepts the repne/repnz prefix (0xF2).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_REPNZ 0x0000000000001000 // (1 << 12)
|
#define ZYDIS_ATTRIB_ACCEPTS_REPNZ 0x0000000000001000 // (1 << 12)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the bound prefix (0xF2).
|
* @brief The instruction accepts the bound prefix (0xF2).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_BOUND 0x0000000000002000 // (1 << 13)
|
#define ZYDIS_ATTRIB_ACCEPTS_BOUND 0x0000000000002000 // (1 << 13)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the xacquire prefix (0xF2).
|
* @brief The instruction accepts the xacquire prefix (0xF2).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_XACQUIRE 0x0000000000004000 // (1 << 14)
|
#define ZYDIS_ATTRIB_ACCEPTS_XACQUIRE 0x0000000000004000 // (1 << 14)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction accepts the xrelease prefix (0xF3).
|
* @brief The instruction accepts the xrelease prefix (0xF3).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_XRELEASE 0x0000000000008000 // (1 << 15)
|
#define ZYDIS_ATTRIB_ACCEPTS_XRELEASE 0x0000000000008000 // (1 << 15)
|
||||||
/**
|
/**
|
||||||
|
@ -316,47 +320,47 @@ typedef ZydisU64 ZydisInstructionAttributes;
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_ACCEPTS_SEGMENT 0x0000000000040000 // (1 << 18)
|
#define ZYDIS_ATTRIB_ACCEPTS_SEGMENT 0x0000000000040000 // (1 << 18)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the lock prefix (0xF0).
|
* @brief The instruction has the lock prefix (0xF0).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_LOCK 0x0000000000080000 // (1 << 19)
|
#define ZYDIS_ATTRIB_HAS_LOCK 0x0000000000080000 // (1 << 19)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the rep prefix (0xF3).
|
* @brief The instruction has the rep prefix (0xF3).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_REP 0x0000000000100000 // (1 << 20)
|
#define ZYDIS_ATTRIB_HAS_REP 0x0000000000100000 // (1 << 20)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the repe/repz prefix (0xF3).
|
* @brief The instruction has the repe/repz prefix (0xF3).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_REPE 0x0000000000200000 // (1 << 21)
|
#define ZYDIS_ATTRIB_HAS_REPE 0x0000000000200000 // (1 << 21)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the repe/repz prefix (0xF3).
|
* @brief The instruction has the repe/repz prefix (0xF3).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_REPZ 0x0000000000200000 // (1 << 21)
|
#define ZYDIS_ATTRIB_HAS_REPZ 0x0000000000200000 // (1 << 21)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the repne/repnz prefix (0xF2).
|
* @brief The instruction has the repne/repnz prefix (0xF2).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_REPNE 0x0000000000400000 // (1 << 22)
|
#define ZYDIS_ATTRIB_HAS_REPNE 0x0000000000400000 // (1 << 22)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the repne/repnz prefix (0xF2).
|
* @brief The instruction has the repne/repnz prefix (0xF2).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_REPNZ 0x0000000000400000 // (1 << 22)
|
#define ZYDIS_ATTRIB_HAS_REPNZ 0x0000000000400000 // (1 << 22)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the bound prefix (0xF2).
|
* @brief The instruction has the bound prefix (0xF2).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_BOUND 0x0000000000800000 // (1 << 23)
|
#define ZYDIS_ATTRIB_HAS_BOUND 0x0000000000800000 // (1 << 23)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the xacquire prefix (0xF2).
|
* @brief The instruction has the xacquire prefix (0xF2).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_XACQUIRE 0x0000000001000000 // (1 << 24)
|
#define ZYDIS_ATTRIB_HAS_XACQUIRE 0x0000000001000000 // (1 << 24)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the xrelease prefix (0xF3).
|
* @brief The instruction has the xrelease prefix (0xF3).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_XRELEASE 0x0000000002000000 // (1 << 25)
|
#define ZYDIS_ATTRIB_HAS_XRELEASE 0x0000000002000000 // (1 << 25)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the branch-not-taken hint (0x2E).
|
* @brief The instruction has the branch-not-taken hint (0x2E).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN 0x0000000004000000 // (1 << 26)
|
#define ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN 0x0000000004000000 // (1 << 26)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the branch-taken hint (0x3E).
|
* @brief The instruction has the branch-taken hint (0x3E).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_BRANCH_TAKEN 0x0000000008000000 // (1 << 27)
|
#define ZYDIS_ATTRIB_HAS_BRANCH_TAKEN 0x0000000008000000 // (1 << 27)
|
||||||
/**
|
/**
|
||||||
|
@ -364,35 +368,35 @@ typedef ZydisU64 ZydisInstructionAttributes;
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_SEGMENT 0x00000003F0000000
|
#define ZYDIS_ATTRIB_HAS_SEGMENT 0x00000003F0000000
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the CS segment modifier (0x2E).
|
* @brief The instruction has the CS segment modifier (0x2E).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_SEGMENT_CS 0x0000000010000000 // (1 << 28)
|
#define ZYDIS_ATTRIB_HAS_SEGMENT_CS 0x0000000010000000 // (1 << 28)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the SS segment modifier (0x36).
|
* @brief The instruction has the SS segment modifier (0x36).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_SEGMENT_SS 0x0000000020000000 // (1 << 29)
|
#define ZYDIS_ATTRIB_HAS_SEGMENT_SS 0x0000000020000000 // (1 << 29)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the DS segment modifier (0x3E).
|
* @brief The instruction has the DS segment modifier (0x3E).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_SEGMENT_DS 0x0000000040000000 // (1 << 30)
|
#define ZYDIS_ATTRIB_HAS_SEGMENT_DS 0x0000000040000000 // (1 << 30)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the ES segment modifier (0x26).
|
* @brief The instruction has the ES segment modifier (0x26).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_SEGMENT_ES 0x0000000080000000 // (1 << 31)
|
#define ZYDIS_ATTRIB_HAS_SEGMENT_ES 0x0000000080000000 // (1 << 31)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the FS segment modifier (0x64).
|
* @brief The instruction has the FS segment modifier (0x64).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_SEGMENT_FS 0x0000000100000000 // (1 << 32)
|
#define ZYDIS_ATTRIB_HAS_SEGMENT_FS 0x0000000100000000 // (1 << 32)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the GS segment modifier (0x65).
|
* @brief The instruction has the GS segment modifier (0x65).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_SEGMENT_GS 0x0000000200000000 // (1 << 33)
|
#define ZYDIS_ATTRIB_HAS_SEGMENT_GS 0x0000000200000000 // (1 << 33)
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the operand-size prefix (0x66).
|
* @brief The instruction has the operand-size prefix (0x66).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_OPERANDSIZE 0x0000000400000000 // (1 << 34) // TODO: rename
|
#define ZYDIS_ATTRIB_HAS_OPERANDSIZE 0x0000000400000000 // (1 << 34) // TODO: rename
|
||||||
/**
|
/**
|
||||||
* @brief The instruction has the address-size prefix (0x67).
|
* @brief The instruction has the address-size prefix (0x67).
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_ATTRIB_HAS_ADDRESSSIZE 0x0000000800000000 // (1 << 35) // TODO: rename
|
#define ZYDIS_ATTRIB_HAS_ADDRESSSIZE 0x0000000800000000 // (1 << 35) // TODO: rename
|
||||||
|
|
||||||
|
@ -499,6 +503,7 @@ enum ZydisCPUFlags
|
||||||
* @brief FPU condition-code flag 3.
|
* @brief FPU condition-code flag 3.
|
||||||
*/
|
*/
|
||||||
ZYDIS_CPUFLAG_C3,
|
ZYDIS_CPUFLAG_C3,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -521,6 +526,7 @@ enum ZydisCPUFlagActions
|
||||||
ZYDIS_CPUFLAG_ACTION_SET_0,
|
ZYDIS_CPUFLAG_ACTION_SET_0,
|
||||||
ZYDIS_CPUFLAG_ACTION_SET_1,
|
ZYDIS_CPUFLAG_ACTION_SET_1,
|
||||||
ZYDIS_CPUFLAG_ACTION_UNDEFINED,
|
ZYDIS_CPUFLAG_ACTION_UNDEFINED,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -582,6 +588,7 @@ enum ZydisExceptionClasses
|
||||||
ZYDIS_EXCEPTION_CLASS_E12NP,
|
ZYDIS_EXCEPTION_CLASS_E12NP,
|
||||||
ZYDIS_EXCEPTION_CLASS_K20,
|
ZYDIS_EXCEPTION_CLASS_K20,
|
||||||
ZYDIS_EXCEPTION_CLASS_K21,
|
ZYDIS_EXCEPTION_CLASS_K21,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -606,6 +613,7 @@ enum ZydisVectorLengths
|
||||||
ZYDIS_VECTOR_LENGTH_128 = 128,
|
ZYDIS_VECTOR_LENGTH_128 = 128,
|
||||||
ZYDIS_VECTOR_LENGTH_256 = 256,
|
ZYDIS_VECTOR_LENGTH_256 = 256,
|
||||||
ZYDIS_VECTOR_LENGTH_512 = 512,
|
ZYDIS_VECTOR_LENGTH_512 = 512,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -627,8 +635,13 @@ typedef ZydisU8 ZydisMaskMode;
|
||||||
enum ZydisMaskModes
|
enum ZydisMaskModes
|
||||||
{
|
{
|
||||||
ZYDIS_MASK_MODE_INVALID,
|
ZYDIS_MASK_MODE_INVALID,
|
||||||
|
|
||||||
|
// TODO: Add `ZYDIS_MASK_MODE_DISABLED` for for `EVEX`/`MVEX` instructions with `K0` mask
|
||||||
|
// TODO: Add `ZYDIS_MASK_MODE_CONTROL` and `ZYDIS_MASK_MODE_CONTROL_ZERO` as replacement for
|
||||||
|
// the `isControlMask` field
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The embedded mask register is used as a merge-mask. This is the default mode for
|
* @brief The embedded mask register is used as a merge-mask. This is the default mode for
|
||||||
* all EVEX/MVEX-instructions.
|
* all EVEX/MVEX-instructions.
|
||||||
*/
|
*/
|
||||||
ZYDIS_MASK_MODE_MERGE,
|
ZYDIS_MASK_MODE_MERGE,
|
||||||
|
@ -636,6 +649,7 @@ enum ZydisMaskModes
|
||||||
* @brief The embedded mask register is used as a zero-mask.
|
* @brief The embedded mask register is used as a zero-mask.
|
||||||
*/
|
*/
|
||||||
ZYDIS_MASK_MODE_ZERO,
|
ZYDIS_MASK_MODE_ZERO,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -669,6 +683,7 @@ enum ZydisBroadcastModes
|
||||||
ZYDIS_BROADCAST_MODE_4_TO_8,
|
ZYDIS_BROADCAST_MODE_4_TO_8,
|
||||||
ZYDIS_BROADCAST_MODE_4_TO_16,
|
ZYDIS_BROADCAST_MODE_4_TO_16,
|
||||||
ZYDIS_BROADCAST_MODE_8_TO_16,
|
ZYDIS_BROADCAST_MODE_8_TO_16,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -706,6 +721,7 @@ enum ZydisRoundingModes
|
||||||
* @brief Round towards zero.
|
* @brief Round towards zero.
|
||||||
*/
|
*/
|
||||||
ZYDIS_ROUNDING_MODE_RZ,
|
ZYDIS_ROUNDING_MODE_RZ,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -735,6 +751,7 @@ enum ZydisSwizzleModes
|
||||||
ZYDIS_SWIZZLE_MODE_BBBB,
|
ZYDIS_SWIZZLE_MODE_BBBB,
|
||||||
ZYDIS_SWIZZLE_MODE_CCCC,
|
ZYDIS_SWIZZLE_MODE_CCCC,
|
||||||
ZYDIS_SWIZZLE_MODE_DDDD,
|
ZYDIS_SWIZZLE_MODE_DDDD,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -761,6 +778,7 @@ enum ZydisConversionModes
|
||||||
ZYDIS_CONVERSION_MODE_UINT8,
|
ZYDIS_CONVERSION_MODE_UINT8,
|
||||||
ZYDIS_CONVERSION_MODE_SINT16,
|
ZYDIS_CONVERSION_MODE_SINT16,
|
||||||
ZYDIS_CONVERSION_MODE_UINT16,
|
ZYDIS_CONVERSION_MODE_UINT16,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -783,7 +801,7 @@ typedef struct ZydisDecodedInstruction_
|
||||||
/**
|
/**
|
||||||
* @brief The instruction-mnemonic.
|
* @brief The instruction-mnemonic.
|
||||||
*/
|
*/
|
||||||
ZydisMnemonic mnemonic;
|
ZydisMnemonic mnemonic;
|
||||||
/**
|
/**
|
||||||
* @brief The length of the decoded instruction.
|
* @brief The length of the decoded instruction.
|
||||||
*/
|
*/
|
||||||
|
@ -840,8 +858,8 @@ typedef struct ZydisDecodedInstruction_
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief The CPU-flag action.
|
* @brief The CPU-flag action.
|
||||||
*
|
*
|
||||||
* You can call `ZydisGetAccessedFlagsByAction` to get a mask with all flags matching a
|
* You can call `ZydisGetAccessedFlagsByAction` to get a mask with all flags matching a
|
||||||
* specific action.
|
* specific action.
|
||||||
*/
|
*/
|
||||||
ZydisCPUFlagAction action;
|
ZydisCPUFlagAction action;
|
||||||
|
@ -856,7 +874,7 @@ typedef struct ZydisDecodedInstruction_
|
||||||
*/
|
*/
|
||||||
ZydisVectorLength vectorLength;
|
ZydisVectorLength vectorLength;
|
||||||
/**
|
/**
|
||||||
* @brief Info about the embedded writemask-register.
|
* @brief Info about the embedded writemask-register (`EVEX` and `MVEX` only).
|
||||||
*/
|
*/
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -869,7 +887,7 @@ typedef struct ZydisDecodedInstruction_
|
||||||
*/
|
*/
|
||||||
ZydisRegister reg;
|
ZydisRegister reg;
|
||||||
/**
|
/**
|
||||||
* @brief Signals, if the mask-register is used as a control mask.
|
* @brief Signals, if the mask-register is used as a control mask.
|
||||||
*/
|
*/
|
||||||
ZydisBool isControlMask;
|
ZydisBool isControlMask;
|
||||||
} mask;
|
} mask;
|
||||||
|
@ -880,7 +898,7 @@ typedef struct ZydisDecodedInstruction_
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Signals, if the broadcast is a static broadcast.
|
* @brief Signals, if the broadcast is a static broadcast.
|
||||||
*
|
*
|
||||||
* This is the case for instructions with inbuild broadcast functionality, that is
|
* This is the case for instructions with inbuild broadcast functionality, that is
|
||||||
* always active and not be controlled by a flag in the XOP/VEX/EVEX/MVEX-prefix.
|
* always active and not be controlled by a flag in the XOP/VEX/EVEX/MVEX-prefix.
|
||||||
*/
|
*/
|
||||||
|
@ -898,36 +916,37 @@ typedef struct ZydisDecodedInstruction_
|
||||||
/**
|
/**
|
||||||
* @brief The AVX rounding-mode.
|
* @brief The AVX rounding-mode.
|
||||||
*/
|
*/
|
||||||
ZydisRoundingMode mode;
|
ZydisRoundingMode mode;
|
||||||
} rounding;
|
} rounding;
|
||||||
/**
|
/**
|
||||||
* @brief Contains info about the AVX register-swizzle (MVEX only).
|
* @brief Contains info about the AVX register-swizzle (`MVEX` only).
|
||||||
*/
|
*/
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief The AVX register-swizzle mode (MVEX only).
|
* @brief The AVX register-swizzle mode (`MVEX` only).
|
||||||
*/
|
*/
|
||||||
ZydisSwizzleMode mode;
|
ZydisSwizzleMode mode;
|
||||||
} swizzle;
|
} swizzle;
|
||||||
/**
|
/**
|
||||||
* @brief Contains info about the AVX data-conversion (MVEX only).
|
* @brief Contains info about the AVX data-conversion (`MVEX` only).
|
||||||
*/
|
*/
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief The AVX data-conversion mode (MVEX only).
|
* @brief The AVX data-conversion mode (`MVEX` only).
|
||||||
*/
|
*/
|
||||||
ZydisConversionMode mode;
|
ZydisConversionMode mode;
|
||||||
} conversion;
|
} conversion;
|
||||||
/**
|
/**
|
||||||
* @brief Signals, if the sae functionality is enabled for the instruction.
|
* @brief Signals, if the sae functionality is enabled for the instruction.
|
||||||
*/
|
*/
|
||||||
ZydisBool hasSAE;
|
ZydisBool hasSAE;
|
||||||
/**
|
/**
|
||||||
* @brief Signals, if the instruction has a memory eviction-hint (MVEX only).
|
* @brief Signals, if the instruction has a memory eviction-hint (`MVEX` only).
|
||||||
*/
|
*/
|
||||||
ZydisBool hasEvictionHint;
|
ZydisBool hasEvictionHint;
|
||||||
|
// TODO: publish EVEX tuple-type and MVEX functionality
|
||||||
} avx;
|
} avx;
|
||||||
/**
|
/**
|
||||||
* @brief Meta info.
|
* @brief Meta info.
|
||||||
|
@ -952,7 +971,7 @@ typedef struct ZydisDecodedInstruction_
|
||||||
ZydisExceptionClass exceptionClass;
|
ZydisExceptionClass exceptionClass;
|
||||||
} meta;
|
} meta;
|
||||||
/**
|
/**
|
||||||
* @brief Extended info about different instruction-parts like ModRM, SIB or
|
* @brief Extended info about different instruction-parts like ModRM, SIB or
|
||||||
* encoding-prefixes.
|
* encoding-prefixes.
|
||||||
*/
|
*/
|
||||||
struct
|
struct
|
||||||
|
@ -1005,7 +1024,7 @@ typedef struct ZydisDecodedInstruction_
|
||||||
* @brief Extension of the ModRM.rm, SIB.base, or opcode.reg field.
|
* @brief Extension of the ModRM.rm, SIB.base, or opcode.reg field.
|
||||||
*/
|
*/
|
||||||
ZydisU8 B;
|
ZydisU8 B;
|
||||||
} rex;
|
} rex;
|
||||||
/**
|
/**
|
||||||
* @brief Detailed info about the XOP-prefix.
|
* @brief Detailed info about the XOP-prefix.
|
||||||
*/
|
*/
|
||||||
|
@ -1265,6 +1284,7 @@ typedef struct ZydisDecodedInstruction_
|
||||||
* @brief The physical displacement size, in bits.
|
* @brief The physical displacement size, in bits.
|
||||||
*/
|
*/
|
||||||
ZydisU8 size;
|
ZydisU8 size;
|
||||||
|
// TODO: publish cd8 scale
|
||||||
/**
|
/**
|
||||||
* @brief The offset of the displacement data, relative to the beginning of the
|
* @brief The offset of the displacement data, relative to the beginning of the
|
||||||
* instruction, in bytes.
|
* instruction, in bytes.
|
||||||
|
@ -1279,9 +1299,9 @@ typedef struct ZydisDecodedInstruction_
|
||||||
/**
|
/**
|
||||||
* @brief Signals, if the immediate value is signed.
|
* @brief Signals, if the immediate value is signed.
|
||||||
*/
|
*/
|
||||||
ZydisBool isSigned;
|
ZydisBool isSigned;
|
||||||
/**
|
/**
|
||||||
* @brief Signals, if the immediate value contains a relative offset. You can use
|
* @brief Signals, if the immediate value contains a relative offset. You can use
|
||||||
* @c ZydisCalcAbsoluteAddress to determine the absolute address value.
|
* @c ZydisCalcAbsoluteAddress to determine the absolute address value.
|
||||||
*/
|
*/
|
||||||
ZydisBool isRelative;
|
ZydisBool isRelative;
|
||||||
|
@ -1289,7 +1309,7 @@ typedef struct ZydisDecodedInstruction_
|
||||||
* @brief The immediate value.
|
* @brief The immediate value.
|
||||||
*/
|
*/
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
ZydisU64 u;
|
ZydisU64 u;
|
||||||
ZydisI64 s;
|
ZydisI64 s;
|
||||||
} value;
|
} value;
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
/* Debug/Release detection */
|
/* Debug/Release detection */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
#if defined(ZYDIS_MSVC) || defined(ZYDIS_BORLAND)
|
#if defined(ZYDIS_MSVC) || defined(ZYDIS_BORLAND)
|
||||||
# ifdef _DEBUG
|
# ifdef _DEBUG
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
#if defined(ZYDIS_MSVC) || defined(ZYDIS_BORLAND)
|
#if defined(ZYDIS_MSVC) || defined(ZYDIS_BORLAND)
|
||||||
# define ZYDIS_INLINE __inline
|
# define ZYDIS_INLINE __inline
|
||||||
#else
|
#else
|
||||||
# define ZYDIS_INLINE static inline
|
# define ZYDIS_INLINE static inline
|
||||||
#endif
|
#endif
|
||||||
|
@ -183,6 +183,11 @@
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_UNUSED_PARAMETER(x) (void)(x)
|
#define ZYDIS_UNUSED_PARAMETER(x) (void)(x)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Intentional fallthrough.
|
||||||
|
*/
|
||||||
|
#define ZYDIS_FALLTHROUGH
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calculates the size of an array.
|
* @brief Calculates the size of an array.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -85,86 +85,86 @@ typedef ZydisU8 ZydisFormatterProperty;
|
||||||
enum ZydisFormatterProperties
|
enum ZydisFormatterProperties
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Controls the letter-case.
|
* @brief Controls the letter-case.
|
||||||
*
|
*
|
||||||
* Pass `ZYDIS_TRUE` as value to format in uppercase and `ZYDIS_FALSE` to format in lowercase.
|
* Pass `ZYDIS_TRUE` as value to format in uppercase and `ZYDIS_FALSE` to format in lowercase.
|
||||||
*
|
*
|
||||||
* The default value is `ZYDIS_FALSE`.
|
* The default value is `ZYDIS_FALSE`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_UPPERCASE,
|
ZYDIS_FORMATTER_PROP_UPPERCASE,
|
||||||
/**
|
/**
|
||||||
* @brief Controls the printing of segment prefixes.
|
* @brief Controls the printing of segment prefixes.
|
||||||
*
|
*
|
||||||
* Pass `ZYDIS_TRUE` as value to force the formatter to always print the segment register of
|
* Pass `ZYDIS_TRUE` as value to force the formatter to always print the segment register of
|
||||||
* memory-operands or `ZYDIS_FALSE` to ommit implicit DS/SS segments.
|
* memory-operands or `ZYDIS_FALSE` to ommit implicit DS/SS segments.
|
||||||
*
|
*
|
||||||
* The default value is `ZYDIS_FALSE`.
|
* The default value is `ZYDIS_FALSE`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG,
|
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG,
|
||||||
/**
|
/**
|
||||||
* @brief Controls the printing of memory-operand sizes.
|
* @brief Controls the printing of memory-operand sizes.
|
||||||
*
|
*
|
||||||
* Pass `ZYDIS_TRUE` as value to force the formatter to always print the size of memory-operands
|
* Pass `ZYDIS_TRUE` as value to force the formatter to always print the size of memory-operands
|
||||||
* or `ZYDIS_FALSE` to only print it on demand.
|
* or `ZYDIS_FALSE` to only print it on demand.
|
||||||
*
|
*
|
||||||
* The default value is `ZYDIS_FALSE`.
|
* The default value is `ZYDIS_FALSE`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE,
|
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Controls the format of addresses.
|
* @brief Controls the format of addresses.
|
||||||
*
|
*
|
||||||
* The default value is `ZYDIS_ADDR_FORMAT_ABSOLUTE`.
|
* The default value is `ZYDIS_ADDR_FORMAT_ABSOLUTE`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_ADDR_FORMAT,
|
ZYDIS_FORMATTER_PROP_ADDR_FORMAT,
|
||||||
/**
|
/**
|
||||||
* @brief Controls the format of displacement values.
|
* @brief Controls the format of displacement values.
|
||||||
*
|
*
|
||||||
* The default value is `ZYDIS_DISP_FORMAT_HEX_SIGNED`.
|
* The default value is `ZYDIS_DISP_FORMAT_HEX_SIGNED`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_DISP_FORMAT,
|
ZYDIS_FORMATTER_PROP_DISP_FORMAT,
|
||||||
/**
|
/**
|
||||||
* @brief Controls the format of immediate values.
|
* @brief Controls the format of immediate values.
|
||||||
*
|
*
|
||||||
* The default value is `ZYDIS_IMM_FORMAT_HEX_UNSIGNED`.
|
* The default value is `ZYDIS_IMM_FORMAT_HEX_UNSIGNED`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_IMM_FORMAT,
|
ZYDIS_FORMATTER_PROP_IMM_FORMAT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Controls the letter-case of hexadecimal values.
|
* @brief Controls the letter-case of hexadecimal values.
|
||||||
*
|
*
|
||||||
* Pass `ZYDIS_TRUE` as value to format in uppercase and `ZYDIS_FALSE` to format in lowercase.
|
* Pass `ZYDIS_TRUE` as value to format in uppercase and `ZYDIS_FALSE` to format in lowercase.
|
||||||
*
|
*
|
||||||
* The default value is `ZYDIS_TRUE`.
|
* The default value is `ZYDIS_TRUE`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_HEX_UPPERCASE,
|
ZYDIS_FORMATTER_PROP_HEX_UPPERCASE,
|
||||||
/**
|
/**
|
||||||
* @brief Sets the prefix for hexadecimal values.
|
* @brief Sets the prefix for hexadecimal values.
|
||||||
*
|
*
|
||||||
* The default value is `"0x"`.
|
* The default value is `"0x"`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_HEX_PREFIX,
|
ZYDIS_FORMATTER_PROP_HEX_PREFIX,
|
||||||
/**
|
/**
|
||||||
* @brief Sets the suffix for hexadecimal values.
|
* @brief Sets the suffix for hexadecimal values.
|
||||||
*
|
*
|
||||||
* The default value is `NULL`.
|
* The default value is `NULL`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
|
ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
|
||||||
/**
|
/**
|
||||||
* @brief Controls the padding (minimum number of chars) of hexadecimal address values.
|
* @brief Controls the padding (minimum number of chars) of hexadecimal address values.
|
||||||
*
|
*
|
||||||
* The default value is `2`.
|
* The default value is `2`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_HEX_PADDING_ADDR,
|
ZYDIS_FORMATTER_PROP_HEX_PADDING_ADDR,
|
||||||
/**
|
/**
|
||||||
* @brief Controls the padding (minimum number of chars) of hexadecimal displacement values.
|
* @brief Controls the padding (minimum number of chars) of hexadecimal displacement values.
|
||||||
*
|
*
|
||||||
* The default value is `2`.
|
* The default value is `2`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_HEX_PADDING_DISP,
|
ZYDIS_FORMATTER_PROP_HEX_PADDING_DISP,
|
||||||
/**
|
/**
|
||||||
* @brief Controls the padding (minimum number of chars) of hexadecimal immediate values.
|
* @brief Controls the padding (minimum number of chars) of hexadecimal immediate values.
|
||||||
*
|
*
|
||||||
* The default value is `2`.
|
* The default value is `2`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM,
|
ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM,
|
||||||
|
@ -183,20 +183,20 @@ enum ZydisFormatterProperties
|
||||||
* @brief Values that represent address-formats.
|
* @brief Values that represent address-formats.
|
||||||
*/
|
*/
|
||||||
enum ZydisAddressFormat
|
enum ZydisAddressFormat
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Displays absolute addresses instead of relative ones.
|
* @brief Displays absolute addresses instead of relative ones.
|
||||||
*
|
*
|
||||||
* Using this value will cause the formatter to invoke `ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS`
|
* Using this value will cause the formatter to invoke `ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS`
|
||||||
* for every address.
|
* for every address.
|
||||||
*/
|
*/
|
||||||
ZYDIS_ADDR_FORMAT_ABSOLUTE,
|
ZYDIS_ADDR_FORMAT_ABSOLUTE,
|
||||||
/**
|
/**
|
||||||
* @brief Uses signed hexadecimal values to display relative addresses.
|
* @brief Uses signed hexadecimal values to display relative addresses.
|
||||||
*
|
*
|
||||||
* Using this value will cause the formatter to either invoke
|
* Using this value will cause the formatter to either invoke
|
||||||
* `ZYDIS_FORMATTER_HOOK_PRINT_DISP` or `ZYDIS_FORMATTER_HOOK_PRINT_IMM` to format addresses.
|
* `ZYDIS_FORMATTER_HOOK_PRINT_DISP` or `ZYDIS_FORMATTER_HOOK_PRINT_IMM` to format addresses.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* - `"JMP 0x20"`
|
* - `"JMP 0x20"`
|
||||||
* - `"JMP -0x20"`
|
* - `"JMP -0x20"`
|
||||||
|
@ -204,10 +204,10 @@ enum ZydisAddressFormat
|
||||||
ZYDIS_ADDR_FORMAT_RELATIVE_SIGNED,
|
ZYDIS_ADDR_FORMAT_RELATIVE_SIGNED,
|
||||||
/**
|
/**
|
||||||
* @brief Uses unsigned hexadecimal values to display relative addresses.
|
* @brief Uses unsigned hexadecimal values to display relative addresses.
|
||||||
*
|
*
|
||||||
* Using this value will cause the formatter to either invoke
|
* Using this value will cause the formatter to either invoke
|
||||||
* `ZYDIS_FORMATTER_HOOK_PRINT_DISP` or `ZYDIS_FORMATTER_HOOK_PRINT_IMM` to format addresses.
|
* `ZYDIS_FORMATTER_HOOK_PRINT_DISP` or `ZYDIS_FORMATTER_HOOK_PRINT_IMM` to format addresses.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* - `"JMP 0x20"`
|
* - `"JMP 0x20"`
|
||||||
* - `"JMP 0xE0"`
|
* - `"JMP 0xE0"`
|
||||||
|
@ -231,16 +231,16 @@ enum ZydisDisplacementFormat
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Formats displacements as signed hexadecimal values.
|
* @brief Formats displacements as signed hexadecimal values.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* - `"MOV EAX, DWORD PTR SS:[ESP+0x400]"`
|
* - `"MOV EAX, DWORD PTR SS:[ESP+0x400]"`
|
||||||
* - `"MOV EAX, DWORD PTR SS:[ESP-0x400]"`
|
* - `"MOV EAX, DWORD PTR SS:[ESP-0x400]"`
|
||||||
*/
|
*/
|
||||||
ZYDIS_DISP_FORMAT_HEX_SIGNED,
|
ZYDIS_DISP_FORMAT_HEX_SIGNED,
|
||||||
/**
|
/**
|
||||||
* @brief Formats displacements as unsigned hexadecimal values.
|
* @brief Formats displacements as unsigned hexadecimal values.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* - `"MOV EAX, DWORD PTR SS:[ESP+0x400]"`
|
* - `"MOV EAX, DWORD PTR SS:[ESP+0x400]"`
|
||||||
* - `"MOV EAX, DWORD PTR SS:[ESP+0xFFFFFC00]"`
|
* - `"MOV EAX, DWORD PTR SS:[ESP+0xFFFFFC00]"`
|
||||||
*/
|
*/
|
||||||
|
@ -268,16 +268,16 @@ enum ZydisImmediateFormat
|
||||||
ZYDIS_IMM_FORMAT_HEX_AUTO,
|
ZYDIS_IMM_FORMAT_HEX_AUTO,
|
||||||
/**
|
/**
|
||||||
* @brief Formats immediates as signed hexadecimal values.
|
* @brief Formats immediates as signed hexadecimal values.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* - `"MOV EAX, 0x400"`
|
* - `"MOV EAX, 0x400"`
|
||||||
* - `"MOV EAX, -0x400"`
|
* - `"MOV EAX, -0x400"`
|
||||||
*/
|
*/
|
||||||
ZYDIS_IMM_FORMAT_HEX_SIGNED,
|
ZYDIS_IMM_FORMAT_HEX_SIGNED,
|
||||||
/**
|
/**
|
||||||
* @brief Formats immediates as unsigned hexadecimal values.
|
* @brief Formats immediates as unsigned hexadecimal values.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* - `"MOV EAX, 0x400"`
|
* - `"MOV EAX, 0x400"`
|
||||||
* - `"MOV EAX, 0xFFFFFC00"`
|
* - `"MOV EAX, 0xFFFFFC00"`
|
||||||
*/
|
*/
|
||||||
|
@ -308,7 +308,7 @@ enum ZydisFormatterHookTypes
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION,
|
ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION,
|
||||||
/**
|
/**
|
||||||
* @brief This function is invoked before the formatter formatted an instruction.
|
* @brief This function is invoked after the formatter formatted an instruction.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION,
|
ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION,
|
||||||
/**
|
/**
|
||||||
|
@ -316,16 +316,16 @@ enum ZydisFormatterHookTypes
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_PRE_OPERAND,
|
ZYDIS_FORMATTER_HOOK_PRE_OPERAND,
|
||||||
/**
|
/**
|
||||||
* @brief This function is invoked before the formatter formatted an operand.
|
* @brief This function is invoked after the formatter formatted an operand.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_POST_OPERAND,
|
ZYDIS_FORMATTER_HOOK_POST_OPERAND,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function refers to the main formatting function.
|
* @brief This function refers to the main formatting function.
|
||||||
*
|
*
|
||||||
* Replacing this function allows for complete custom formatting, but indirectly disables all
|
* Replacing this function allows for complete custom formatting, but indirectly disables all
|
||||||
* other hooks except for `ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION` and
|
* other hooks except for `ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION` and
|
||||||
* `ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION`.
|
* `ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION`.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION,
|
ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION,
|
||||||
/**
|
/**
|
||||||
|
@ -335,8 +335,9 @@ enum ZydisFormatterHookTypes
|
||||||
/**
|
/**
|
||||||
* @brief This function is invoked to format a memory operand.
|
* @brief This function is invoked to format a memory operand.
|
||||||
*
|
*
|
||||||
* Replacing this function might indirectly disable some specific calls to the
|
* Replacing this function might indirectly disable some specific calls to the
|
||||||
* `ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS` and `ZYDIS_FORMATTER_HOOK_PRINT_DISP` functions.
|
* `ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE`, `ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS` and
|
||||||
|
* `ZYDIS_FORMATTER_HOOK_PRINT_DISP` functions.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_MEM,
|
ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_MEM,
|
||||||
/**
|
/**
|
||||||
|
@ -346,10 +347,10 @@ enum ZydisFormatterHookTypes
|
||||||
/**
|
/**
|
||||||
* @brief This function is invoked to format an immediate operand.
|
* @brief This function is invoked to format an immediate operand.
|
||||||
*
|
*
|
||||||
* Replacing this function might indirectly disable some specific calls to the
|
* Replacing this function might indirectly disable some specific calls to the
|
||||||
* `ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS` and `ZYDIS_FORMATTER_HOOK_PRINT_IMM` functions.
|
* `ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS` and `ZYDIS_FORMATTER_HOOK_PRINT_IMM` functions.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM,
|
ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function is invoked to print the instruction mnemonic.
|
* @brief This function is invoked to print the instruction mnemonic.
|
||||||
|
@ -375,13 +376,13 @@ enum ZydisFormatterHookTypes
|
||||||
/**
|
/**
|
||||||
* @brief This function is invoked to print the size of a memory operand.
|
* @brief This function is invoked to print the size of a memory operand.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE,
|
ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE,
|
||||||
/**
|
/**
|
||||||
* @brief This function is invoked to print the instruction prefixes.
|
* @brief This function is invoked to print the instruction prefixes.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES,
|
ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES,
|
||||||
/**
|
/**
|
||||||
* @brief This function is invoked after formatting an operand to print a `EVEX`/`MVEX`
|
* @brief This function is invoked after formatting an operand to print a `EVEX`/`MVEX`
|
||||||
* decorator.
|
* decorator.
|
||||||
*/
|
*/
|
||||||
ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR,
|
ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR,
|
||||||
|
@ -451,23 +452,20 @@ typedef struct ZydisFormatter_ ZydisFormatter;
|
||||||
* @param string A pointer to the string.
|
* @param string A pointer to the string.
|
||||||
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
||||||
* @param userData A pointer to user-defined data.
|
* @param userData A pointer to user-defined data.
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*
|
*
|
||||||
* Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the formatting
|
* Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the formatting
|
||||||
* process to fail.
|
* process to fail.
|
||||||
*
|
|
||||||
* Returning `ZYDIS_STATUS_SUCCESS` in `ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES` without writing to
|
|
||||||
* the string is valid and signals that the corresponding element should not be printed.
|
|
||||||
*
|
*
|
||||||
* This function type is used for:
|
* This function type is used for:
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION`
|
* - `ZYDIS_FORMATTER_HOOK_PRE_INSTRUCTION`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION`
|
* - `ZYDIS_FORMATTER_HOOK_POST_INSTRUCTION`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION`
|
* - `ZYDIS_FORMATTER_HOOK_FORMAT_INSTRUCTION`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC`
|
* - `ZYDIS_FORMATTER_HOOK_PRINT_MNEMONIC`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES`
|
* - `ZYDIS_FORMATTER_HOOK_PRINT_PREFIXES`
|
||||||
*/
|
*/
|
||||||
typedef ZydisStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
|
typedef ZydisStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
|
||||||
ZydisString* string, const ZydisDecodedInstruction* instruction, void* userData);
|
ZydisString* string, const ZydisDecodedInstruction* instruction, void* userData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -478,33 +476,35 @@ typedef ZydisStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
|
||||||
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
||||||
* @param operand A pointer to the `ZydisDecodedOperand` struct.
|
* @param operand A pointer to the `ZydisDecodedOperand` struct.
|
||||||
* @param userData A pointer to user-defined data.
|
* @param userData A pointer to user-defined data.
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*
|
*
|
||||||
* Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the formatting
|
* Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the formatting
|
||||||
* process to fail.
|
* process to fail (see exceptions below).
|
||||||
*
|
*
|
||||||
* Returning `ZYDIS_STATUS_SUCCESS` in one of the `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_X` hooks
|
* Returning `ZYDIS_STATUS_SKIP_OPERAND` is valid for `ZYDIS_FORMATTER_HOOK_PRE_OPERAND`,
|
||||||
* without writing to the string is valid and will cause the formatter to omit the current
|
* `ZYDIS_FORMATTER_HOOK_POST_OPERAND` and all of the `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_XXX`
|
||||||
|
* callbacks. This will cause the formatter to omit the current operand.
|
||||||
|
*
|
||||||
|
* DEPRECATED:
|
||||||
|
* Returning `ZYDIS_STATUS_SUCCESS` without writing to the string is valid for
|
||||||
|
* `ZYDIS_FORMATTER_HOOK_PRE_OPERAND`, `ZYDIS_FORMATTER_HOOK_POST_OPERAND` and all of the
|
||||||
|
* `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_XXX`. This will cause the formatter to omit the current
|
||||||
* operand.
|
* operand.
|
||||||
*
|
|
||||||
* Returning `ZYDIS_STATUS_SUCCESS` in `ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE` or
|
|
||||||
* `ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR` without writing to the string is valid and signals that
|
|
||||||
* the corresponding element should not be printed for the current operand.
|
|
||||||
*
|
*
|
||||||
* This function type is used for:
|
* This function type is used for:
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRE_OPERAND`
|
* - `ZYDIS_FORMATTER_HOOK_PRE_OPERAND`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_POST_OPERAND`
|
* - `ZYDIS_FORMATTER_HOOK_POST_OPERAND`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_REG`
|
* - `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_REG`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_MEM`
|
* - `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_MEM`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_PTR`
|
* - `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_PTR`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM`
|
* - `ZYDIS_FORMATTER_HOOK_FORMAT_OPERAND_IMM`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRINT_DISP`
|
* - `ZYDIS_FORMATTER_HOOK_PRINT_DISP`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRINT_IMM`
|
* - `ZYDIS_FORMATTER_HOOK_PRINT_IMM`
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE`
|
* - `ZYDIS_FORMATTER_HOOK_PRINT_MEMSIZE`
|
||||||
*/
|
*/
|
||||||
typedef ZydisStatus (*ZydisFormatterOperandFunc)(const ZydisFormatter* formatter,
|
typedef ZydisStatus (*ZydisFormatterOperandFunc)(const ZydisFormatter* formatter,
|
||||||
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
||||||
const ZydisDecodedOperand* operand, void* userData);
|
const ZydisDecodedOperand* operand, void* userData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -516,15 +516,15 @@ typedef ZydisStatus (*ZydisFormatterOperandFunc)(const ZydisFormatter* formatter
|
||||||
* @param operand A pointer to the `ZydisDecodedOperand` struct.
|
* @param operand A pointer to the `ZydisDecodedOperand` struct.
|
||||||
* @param reg The register.
|
* @param reg The register.
|
||||||
* @param userData A pointer to user-defined data.
|
* @param userData A pointer to user-defined data.
|
||||||
*
|
*
|
||||||
* @return Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the
|
* @return Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the
|
||||||
* formatting process to fail.
|
* formatting process to fail.
|
||||||
*
|
*
|
||||||
* This function type is used for:
|
* This function type is used for:
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRINT_REGISTER`.
|
* - `ZYDIS_FORMATTER_HOOK_PRINT_REGISTER`.
|
||||||
*/
|
*/
|
||||||
typedef ZydisStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* formatter,
|
typedef ZydisStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* formatter,
|
||||||
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
||||||
const ZydisDecodedOperand* operand, ZydisRegister reg, void* userData);
|
const ZydisDecodedOperand* operand, ZydisRegister reg, void* userData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -536,15 +536,15 @@ typedef ZydisStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* formatte
|
||||||
* @param operand A pointer to the `ZydisDecodedOperand` struct.
|
* @param operand A pointer to the `ZydisDecodedOperand` struct.
|
||||||
* @param address The address.
|
* @param address The address.
|
||||||
* @param userData A pointer to user-defined data.
|
* @param userData A pointer to user-defined data.
|
||||||
*
|
*
|
||||||
* @return Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the
|
* @return Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the
|
||||||
* formatting process to fail.
|
* formatting process to fail.
|
||||||
*
|
*
|
||||||
* This function type is used for:
|
* This function type is used for:
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS`
|
* - `ZYDIS_FORMATTER_HOOK_PRINT_ADDRESS`
|
||||||
*/
|
*/
|
||||||
typedef ZydisStatus (*ZydisFormatterAddressFunc)(const ZydisFormatter* formatter,
|
typedef ZydisStatus (*ZydisFormatterAddressFunc)(const ZydisFormatter* formatter,
|
||||||
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
||||||
const ZydisDecodedOperand* operand, ZydisU64 address, void* userData);
|
const ZydisDecodedOperand* operand, ZydisU64 address, void* userData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -554,21 +554,18 @@ typedef ZydisStatus (*ZydisFormatterAddressFunc)(const ZydisFormatter* formatter
|
||||||
* @param string A pointer to the string.
|
* @param string A pointer to the string.
|
||||||
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
||||||
* @param operand A pointer to the `ZydisDecodedOperand` struct.
|
* @param operand A pointer to the `ZydisDecodedOperand` struct.
|
||||||
* @param type The decorator type.
|
* @param decorator The decorator type.
|
||||||
* @param userData A pointer to user-defined data.
|
* @param userData A pointer to user-defined data.
|
||||||
*
|
*
|
||||||
* @return Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the
|
* @return Returning a status code other than `ZYDIS_STATUS_SUCCESS` will immediately cause the
|
||||||
* formatting process to fail.
|
* formatting process to fail.
|
||||||
*
|
|
||||||
* Returning `ZYDIS_STATUS_SUCCESS` without writing to the string is valid and will cause the
|
|
||||||
* formatter to omit the current decorator.
|
|
||||||
*
|
*
|
||||||
* This function type is used for:
|
* This function type is used for:
|
||||||
* - `ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR`
|
* - `ZYDIS_FORMATTER_HOOK_PRINT_DECORATOR`
|
||||||
*/
|
*/
|
||||||
typedef ZydisStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* formatter,
|
typedef ZydisStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* formatter,
|
||||||
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
ZydisString* string, const ZydisDecodedInstruction* instruction,
|
||||||
const ZydisDecodedOperand* operand, ZydisDecoratorType type, void* userData);
|
const ZydisDecodedOperand* operand, ZydisDecoratorType decorator, void* userData);
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
/* Formatter struct */
|
/* Formatter struct */
|
||||||
|
@ -606,7 +603,7 @@ struct ZydisFormatter_
|
||||||
ZydisFormatterRegisterFunc funcPrintRegister;
|
ZydisFormatterRegisterFunc funcPrintRegister;
|
||||||
ZydisFormatterAddressFunc funcPrintAddress;
|
ZydisFormatterAddressFunc funcPrintAddress;
|
||||||
ZydisFormatterOperandFunc funcPrintDisp;
|
ZydisFormatterOperandFunc funcPrintDisp;
|
||||||
ZydisFormatterOperandFunc funcPrintImm;
|
ZydisFormatterOperandFunc funcPrintImm;
|
||||||
ZydisFormatterOperandFunc funcPrintMemSize;
|
ZydisFormatterOperandFunc funcPrintMemSize;
|
||||||
ZydisFormatterFunc funcPrintPrefixes;
|
ZydisFormatterFunc funcPrintPrefixes;
|
||||||
ZydisFormatterDecoratorFunc funcPrintDecorator;
|
ZydisFormatterDecoratorFunc funcPrintDecorator;
|
||||||
|
@ -650,11 +647,11 @@ ZYDIS_EXPORT ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
|
||||||
* and receives the pointer of the currently used function.
|
* and receives the pointer of the currently used function.
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*
|
*
|
||||||
* Call this function with `callback` pointing to a `NULL` value to retrieve the currently used
|
* Call this function with `callback` pointing to a `NULL` value to retrieve the currently used
|
||||||
* function without replacing it.
|
* function without replacing it.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
|
ZYDIS_EXPORT ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
|
||||||
ZydisFormatterHookType hook, const void** callback);
|
ZydisFormatterHookType hook, const void** callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -667,7 +664,7 @@ ZYDIS_EXPORT ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
|
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
|
||||||
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen);
|
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -677,14 +674,51 @@ ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* f
|
||||||
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
||||||
* @param buffer A pointer to the output buffer.
|
* @param buffer A pointer to the output buffer.
|
||||||
* @param bufferLen The length of the output buffer.
|
* @param bufferLen The length of the output buffer.
|
||||||
* @param userData A pointer to user-defined data which can be used in custom formatter
|
* @param userData A pointer to user-defined data which can be used in custom formatter
|
||||||
* callbacks.
|
* callbacks.
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
|
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
|
||||||
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen, void* userData);
|
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen, void* userData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Formats the given operand and writes it into the output buffer.
|
||||||
|
*
|
||||||
|
* @param formatter A pointer to the `ZydisFormatter` instance.
|
||||||
|
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
||||||
|
* @param index The index of the operand to format.
|
||||||
|
* @param buffer A pointer to the output buffer.
|
||||||
|
* @param bufferLen The length of the output buffer.
|
||||||
|
*
|
||||||
|
* @return A zydis status code.
|
||||||
|
*
|
||||||
|
* Use `ZydisFormatterFormatInstruction` or `ZydisFormatterFormatInstructionEx` to format a
|
||||||
|
* complete instruction.
|
||||||
|
*/
|
||||||
|
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
|
||||||
|
const ZydisDecodedInstruction* instruction, ZydisU8 index, char* buffer, ZydisUSize bufferLen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Formats the given operand and writes it into the output buffer.
|
||||||
|
*
|
||||||
|
* @param formatter A pointer to the `ZydisFormatter` instance.
|
||||||
|
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
|
||||||
|
* @param index The index of the operand to format.
|
||||||
|
* @param buffer A pointer to the output buffer.
|
||||||
|
* @param bufferLen The length of the output buffer.
|
||||||
|
* @param userData A pointer to user-defined data which can be used in custom formatter
|
||||||
|
* callbacks.
|
||||||
|
*
|
||||||
|
* @return A zydis status code.
|
||||||
|
*
|
||||||
|
* Use `ZydisFormatterFormatInstruction` or `ZydisFormatterFormatInstructionEx` to format a
|
||||||
|
* complete instruction.
|
||||||
|
*/
|
||||||
|
ZYDIS_EXPORT ZydisStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
|
||||||
|
const ZydisDecodedInstruction* instruction, ZydisU8 index, char* buffer, ZydisUSize bufferLen,
|
||||||
|
void* userData);
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -66,8 +66,11 @@ enum ZydisISAExts
|
||||||
ZYDIS_ISA_EXT_AVX512_VPCLMULQDQ_128,
|
ZYDIS_ISA_EXT_AVX512_VPCLMULQDQ_128,
|
||||||
ZYDIS_ISA_EXT_AVX512_VPCLMULQDQ_256,
|
ZYDIS_ISA_EXT_AVX512_VPCLMULQDQ_256,
|
||||||
ZYDIS_ISA_EXT_AVX512_VPCLMULQDQ_512,
|
ZYDIS_ISA_EXT_AVX512_VPCLMULQDQ_512,
|
||||||
|
ZYDIS_ISA_EXT_AVX512_VPOPCNTDQ_128,
|
||||||
|
ZYDIS_ISA_EXT_AVX512_VPOPCNTDQ_256,
|
||||||
ZYDIS_ISA_EXT_AVX512_VPOPCNTDQ_512,
|
ZYDIS_ISA_EXT_AVX512_VPOPCNTDQ_512,
|
||||||
ZYDIS_ISA_EXT_AVXAES,
|
ZYDIS_ISA_EXT_AVXAES,
|
||||||
|
ZYDIS_ISA_EXT_AVX_GFNI,
|
||||||
ZYDIS_ISA_EXT_BMI1,
|
ZYDIS_ISA_EXT_BMI1,
|
||||||
ZYDIS_ISA_EXT_BMI2,
|
ZYDIS_ISA_EXT_BMI2,
|
||||||
ZYDIS_ISA_EXT_CET,
|
ZYDIS_ISA_EXT_CET,
|
||||||
|
@ -103,10 +106,12 @@ enum ZydisISAExts
|
||||||
ZYDIS_ISA_EXT_LONGMODE,
|
ZYDIS_ISA_EXT_LONGMODE,
|
||||||
ZYDIS_ISA_EXT_LZCNT,
|
ZYDIS_ISA_EXT_LZCNT,
|
||||||
ZYDIS_ISA_EXT_MONITOR,
|
ZYDIS_ISA_EXT_MONITOR,
|
||||||
|
ZYDIS_ISA_EXT_MONITORX,
|
||||||
ZYDIS_ISA_EXT_MOVBE,
|
ZYDIS_ISA_EXT_MOVBE,
|
||||||
ZYDIS_ISA_EXT_MPX,
|
ZYDIS_ISA_EXT_MPX,
|
||||||
ZYDIS_ISA_EXT_PAUSE,
|
ZYDIS_ISA_EXT_PAUSE,
|
||||||
ZYDIS_ISA_EXT_PCLMULQDQ,
|
ZYDIS_ISA_EXT_PCLMULQDQ,
|
||||||
|
ZYDIS_ISA_EXT_PCONFIG,
|
||||||
ZYDIS_ISA_EXT_PENTIUMMMX,
|
ZYDIS_ISA_EXT_PENTIUMMMX,
|
||||||
ZYDIS_ISA_EXT_PENTIUMREAL,
|
ZYDIS_ISA_EXT_PENTIUMREAL,
|
||||||
ZYDIS_ISA_EXT_PKU,
|
ZYDIS_ISA_EXT_PKU,
|
||||||
|
@ -123,6 +128,7 @@ enum ZydisISAExts
|
||||||
ZYDIS_ISA_EXT_RDWRFSGS,
|
ZYDIS_ISA_EXT_RDWRFSGS,
|
||||||
ZYDIS_ISA_EXT_RTM,
|
ZYDIS_ISA_EXT_RTM,
|
||||||
ZYDIS_ISA_EXT_SGX,
|
ZYDIS_ISA_EXT_SGX,
|
||||||
|
ZYDIS_ISA_EXT_SGX_ENCLV,
|
||||||
ZYDIS_ISA_EXT_SHA,
|
ZYDIS_ISA_EXT_SHA,
|
||||||
ZYDIS_ISA_EXT_SMAP,
|
ZYDIS_ISA_EXT_SMAP,
|
||||||
ZYDIS_ISA_EXT_SMX,
|
ZYDIS_ISA_EXT_SMX,
|
||||||
|
@ -133,6 +139,7 @@ enum ZydisISAExts
|
||||||
ZYDIS_ISA_EXT_SSE3X87,
|
ZYDIS_ISA_EXT_SSE3X87,
|
||||||
ZYDIS_ISA_EXT_SSE4,
|
ZYDIS_ISA_EXT_SSE4,
|
||||||
ZYDIS_ISA_EXT_SSE42,
|
ZYDIS_ISA_EXT_SSE42,
|
||||||
|
ZYDIS_ISA_EXT_SSE4A,
|
||||||
ZYDIS_ISA_EXT_SSEMXCSR,
|
ZYDIS_ISA_EXT_SSEMXCSR,
|
||||||
ZYDIS_ISA_EXT_SSE_PREFETCH,
|
ZYDIS_ISA_EXT_SSE_PREFETCH,
|
||||||
ZYDIS_ISA_EXT_SSSE3,
|
ZYDIS_ISA_EXT_SSSE3,
|
||||||
|
@ -149,6 +156,13 @@ enum ZydisISAExts
|
||||||
ZYDIS_ISA_EXT_XSAVEC,
|
ZYDIS_ISA_EXT_XSAVEC,
|
||||||
ZYDIS_ISA_EXT_XSAVEOPT,
|
ZYDIS_ISA_EXT_XSAVEOPT,
|
||||||
ZYDIS_ISA_EXT_XSAVES,
|
ZYDIS_ISA_EXT_XSAVES,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_ISA_EXT_MAX_VALUE = ZYDIS_ISA_EXT_XSAVES,
|
ZYDIS_ISA_EXT_MAX_VALUE = ZYDIS_ISA_EXT_XSAVES,
|
||||||
|
/**
|
||||||
|
* @brief Minimum amount of bits required to store a value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_ISA_EXT_MIN_BITS = 0x0008
|
ZYDIS_ISA_EXT_MIN_BITS = 0x0008
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,10 +38,12 @@ enum ZydisISASets
|
||||||
ZYDIS_ISA_SET_LZCNT,
|
ZYDIS_ISA_SET_LZCNT,
|
||||||
ZYDIS_ISA_SET_MMX,
|
ZYDIS_ISA_SET_MMX,
|
||||||
ZYDIS_ISA_SET_MONITOR,
|
ZYDIS_ISA_SET_MONITOR,
|
||||||
|
ZYDIS_ISA_SET_MONITORX,
|
||||||
ZYDIS_ISA_SET_MOVBE,
|
ZYDIS_ISA_SET_MOVBE,
|
||||||
ZYDIS_ISA_SET_MPX,
|
ZYDIS_ISA_SET_MPX,
|
||||||
ZYDIS_ISA_SET_PAUSE,
|
ZYDIS_ISA_SET_PAUSE,
|
||||||
ZYDIS_ISA_SET_PCLMULQDQ,
|
ZYDIS_ISA_SET_PCLMULQDQ,
|
||||||
|
ZYDIS_ISA_SET_PCONFIG,
|
||||||
ZYDIS_ISA_SET_PKU,
|
ZYDIS_ISA_SET_PKU,
|
||||||
ZYDIS_ISA_SET_PREFETCHWT1,
|
ZYDIS_ISA_SET_PREFETCHWT1,
|
||||||
ZYDIS_ISA_SET_PT,
|
ZYDIS_ISA_SET_PT,
|
||||||
|
@ -52,6 +54,7 @@ enum ZydisISASets
|
||||||
ZYDIS_ISA_SET_RDWRFSGS,
|
ZYDIS_ISA_SET_RDWRFSGS,
|
||||||
ZYDIS_ISA_SET_RTM,
|
ZYDIS_ISA_SET_RTM,
|
||||||
ZYDIS_ISA_SET_SGX,
|
ZYDIS_ISA_SET_SGX,
|
||||||
|
ZYDIS_ISA_SET_SGX_ENCLV,
|
||||||
ZYDIS_ISA_SET_SHA,
|
ZYDIS_ISA_SET_SHA,
|
||||||
ZYDIS_ISA_SET_SMAP,
|
ZYDIS_ISA_SET_SMAP,
|
||||||
ZYDIS_ISA_SET_SMX,
|
ZYDIS_ISA_SET_SMX,
|
||||||
|
@ -59,6 +62,7 @@ enum ZydisISASets
|
||||||
ZYDIS_ISA_SET_SSE2,
|
ZYDIS_ISA_SET_SSE2,
|
||||||
ZYDIS_ISA_SET_SSE3,
|
ZYDIS_ISA_SET_SSE3,
|
||||||
ZYDIS_ISA_SET_SSE4,
|
ZYDIS_ISA_SET_SSE4,
|
||||||
|
ZYDIS_ISA_SET_SSE4A,
|
||||||
ZYDIS_ISA_SET_SSSE3,
|
ZYDIS_ISA_SET_SSSE3,
|
||||||
ZYDIS_ISA_SET_SVM,
|
ZYDIS_ISA_SET_SVM,
|
||||||
ZYDIS_ISA_SET_TBM,
|
ZYDIS_ISA_SET_TBM,
|
||||||
|
@ -72,6 +76,13 @@ enum ZydisISASets
|
||||||
ZYDIS_ISA_SET_XSAVEC,
|
ZYDIS_ISA_SET_XSAVEC,
|
||||||
ZYDIS_ISA_SET_XSAVEOPT,
|
ZYDIS_ISA_SET_XSAVEOPT,
|
||||||
ZYDIS_ISA_SET_XSAVES,
|
ZYDIS_ISA_SET_XSAVES,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_ISA_SET_MAX_VALUE = ZYDIS_ISA_SET_XSAVES,
|
ZYDIS_ISA_SET_MAX_VALUE = ZYDIS_ISA_SET_XSAVES,
|
||||||
ZYDIS_ISA_SET_MIN_BITS = 0x0006
|
/**
|
||||||
|
* @brief Minimum amount of bits required to store a value of this enum.
|
||||||
|
*/
|
||||||
|
ZYDIS_ISA_SET_MIN_BITS = 0x0007
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,6 +60,7 @@ enum ZydisInstructionCategories
|
||||||
ZYDIS_CATEGORY_MPX,
|
ZYDIS_CATEGORY_MPX,
|
||||||
ZYDIS_CATEGORY_NOP,
|
ZYDIS_CATEGORY_NOP,
|
||||||
ZYDIS_CATEGORY_PCLMULQDQ,
|
ZYDIS_CATEGORY_PCLMULQDQ,
|
||||||
|
ZYDIS_CATEGORY_PCONFIG,
|
||||||
ZYDIS_CATEGORY_PKU,
|
ZYDIS_CATEGORY_PKU,
|
||||||
ZYDIS_CATEGORY_POP,
|
ZYDIS_CATEGORY_POP,
|
||||||
ZYDIS_CATEGORY_PREFETCH,
|
ZYDIS_CATEGORY_PREFETCH,
|
||||||
|
@ -99,6 +100,13 @@ enum ZydisInstructionCategories
|
||||||
ZYDIS_CATEGORY_XOP,
|
ZYDIS_CATEGORY_XOP,
|
||||||
ZYDIS_CATEGORY_XSAVE,
|
ZYDIS_CATEGORY_XSAVE,
|
||||||
ZYDIS_CATEGORY_XSAVEOPT,
|
ZYDIS_CATEGORY_XSAVEOPT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_CATEGORY_MAX_VALUE = ZYDIS_CATEGORY_XSAVEOPT,
|
ZYDIS_CATEGORY_MAX_VALUE = ZYDIS_CATEGORY_XSAVEOPT,
|
||||||
|
/**
|
||||||
|
* @brief Minimum amount of bits required to store a value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_CATEGORY_MIN_BITS = 0x0007
|
ZYDIS_CATEGORY_MIN_BITS = 0x0007
|
||||||
};
|
};
|
||||||
|
|
|
@ -155,10 +155,12 @@ enum ZydisMnemonics
|
||||||
ZYDIS_MNEMONIC_EMMS,
|
ZYDIS_MNEMONIC_EMMS,
|
||||||
ZYDIS_MNEMONIC_ENCLS,
|
ZYDIS_MNEMONIC_ENCLS,
|
||||||
ZYDIS_MNEMONIC_ENCLU,
|
ZYDIS_MNEMONIC_ENCLU,
|
||||||
|
ZYDIS_MNEMONIC_ENCLV,
|
||||||
ZYDIS_MNEMONIC_ENDBR32,
|
ZYDIS_MNEMONIC_ENDBR32,
|
||||||
ZYDIS_MNEMONIC_ENDBR64,
|
ZYDIS_MNEMONIC_ENDBR64,
|
||||||
ZYDIS_MNEMONIC_ENTER,
|
ZYDIS_MNEMONIC_ENTER,
|
||||||
ZYDIS_MNEMONIC_EXTRACTPS,
|
ZYDIS_MNEMONIC_EXTRACTPS,
|
||||||
|
ZYDIS_MNEMONIC_EXTRQ,
|
||||||
ZYDIS_MNEMONIC_F2XM1,
|
ZYDIS_MNEMONIC_F2XM1,
|
||||||
ZYDIS_MNEMONIC_FABS,
|
ZYDIS_MNEMONIC_FABS,
|
||||||
ZYDIS_MNEMONIC_FADD,
|
ZYDIS_MNEMONIC_FADD,
|
||||||
|
@ -274,6 +276,7 @@ enum ZydisMnemonics
|
||||||
ZYDIS_MNEMONIC_INSB,
|
ZYDIS_MNEMONIC_INSB,
|
||||||
ZYDIS_MNEMONIC_INSD,
|
ZYDIS_MNEMONIC_INSD,
|
||||||
ZYDIS_MNEMONIC_INSERTPS,
|
ZYDIS_MNEMONIC_INSERTPS,
|
||||||
|
ZYDIS_MNEMONIC_INSERTQ,
|
||||||
ZYDIS_MNEMONIC_INSW,
|
ZYDIS_MNEMONIC_INSW,
|
||||||
ZYDIS_MNEMONIC_INT,
|
ZYDIS_MNEMONIC_INT,
|
||||||
ZYDIS_MNEMONIC_INT1,
|
ZYDIS_MNEMONIC_INT1,
|
||||||
|
@ -416,6 +419,7 @@ enum ZydisMnemonics
|
||||||
ZYDIS_MNEMONIC_MINSD,
|
ZYDIS_MNEMONIC_MINSD,
|
||||||
ZYDIS_MNEMONIC_MINSS,
|
ZYDIS_MNEMONIC_MINSS,
|
||||||
ZYDIS_MNEMONIC_MONITOR,
|
ZYDIS_MNEMONIC_MONITOR,
|
||||||
|
ZYDIS_MNEMONIC_MONITORX,
|
||||||
ZYDIS_MNEMONIC_MOV,
|
ZYDIS_MNEMONIC_MOV,
|
||||||
ZYDIS_MNEMONIC_MOVAPD,
|
ZYDIS_MNEMONIC_MOVAPD,
|
||||||
ZYDIS_MNEMONIC_MOVAPS,
|
ZYDIS_MNEMONIC_MOVAPS,
|
||||||
|
@ -439,6 +443,8 @@ enum ZydisMnemonics
|
||||||
ZYDIS_MNEMONIC_MOVNTPD,
|
ZYDIS_MNEMONIC_MOVNTPD,
|
||||||
ZYDIS_MNEMONIC_MOVNTPS,
|
ZYDIS_MNEMONIC_MOVNTPS,
|
||||||
ZYDIS_MNEMONIC_MOVNTQ,
|
ZYDIS_MNEMONIC_MOVNTQ,
|
||||||
|
ZYDIS_MNEMONIC_MOVNTSD,
|
||||||
|
ZYDIS_MNEMONIC_MOVNTSS,
|
||||||
ZYDIS_MNEMONIC_MOVQ,
|
ZYDIS_MNEMONIC_MOVQ,
|
||||||
ZYDIS_MNEMONIC_MOVQ2DQ,
|
ZYDIS_MNEMONIC_MOVQ2DQ,
|
||||||
ZYDIS_MNEMONIC_MOVSB,
|
ZYDIS_MNEMONIC_MOVSB,
|
||||||
|
@ -461,6 +467,7 @@ enum ZydisMnemonics
|
||||||
ZYDIS_MNEMONIC_MULSS,
|
ZYDIS_MNEMONIC_MULSS,
|
||||||
ZYDIS_MNEMONIC_MULX,
|
ZYDIS_MNEMONIC_MULX,
|
||||||
ZYDIS_MNEMONIC_MWAIT,
|
ZYDIS_MNEMONIC_MWAIT,
|
||||||
|
ZYDIS_MNEMONIC_MWAITX,
|
||||||
ZYDIS_MNEMONIC_NEG,
|
ZYDIS_MNEMONIC_NEG,
|
||||||
ZYDIS_MNEMONIC_NOP,
|
ZYDIS_MNEMONIC_NOP,
|
||||||
ZYDIS_MNEMONIC_NOT,
|
ZYDIS_MNEMONIC_NOT,
|
||||||
|
@ -508,6 +515,7 @@ enum ZydisMnemonics
|
||||||
ZYDIS_MNEMONIC_PCMPGTW,
|
ZYDIS_MNEMONIC_PCMPGTW,
|
||||||
ZYDIS_MNEMONIC_PCMPISTRI,
|
ZYDIS_MNEMONIC_PCMPISTRI,
|
||||||
ZYDIS_MNEMONIC_PCMPISTRM,
|
ZYDIS_MNEMONIC_PCMPISTRM,
|
||||||
|
ZYDIS_MNEMONIC_PCONFIG,
|
||||||
ZYDIS_MNEMONIC_PDEP,
|
ZYDIS_MNEMONIC_PDEP,
|
||||||
ZYDIS_MNEMONIC_PEXT,
|
ZYDIS_MNEMONIC_PEXT,
|
||||||
ZYDIS_MNEMONIC_PEXTRB,
|
ZYDIS_MNEMONIC_PEXTRB,
|
||||||
|
@ -1583,6 +1591,13 @@ enum ZydisMnemonics
|
||||||
ZYDIS_MNEMONIC_XSAVES64,
|
ZYDIS_MNEMONIC_XSAVES64,
|
||||||
ZYDIS_MNEMONIC_XSETBV,
|
ZYDIS_MNEMONIC_XSETBV,
|
||||||
ZYDIS_MNEMONIC_XTEST,
|
ZYDIS_MNEMONIC_XTEST,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_MNEMONIC_MAX_VALUE = ZYDIS_MNEMONIC_XTEST,
|
ZYDIS_MNEMONIC_MAX_VALUE = ZYDIS_MNEMONIC_XTEST,
|
||||||
|
/**
|
||||||
|
* @brief Minimum amount of bits required to store a value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_MNEMONIC_MIN_BITS = 0x000B
|
ZYDIS_MNEMONIC_MIN_BITS = 0x000B
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,294 @@
|
||||||
|
/**
|
||||||
|
* @brief Defines the `ZydisRegister` datatype.
|
||||||
|
*/
|
||||||
|
typedef ZydisU8 ZydisRegister;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Values that represent `ZydisRegister` elements.
|
||||||
|
*/
|
||||||
|
enum ZydisRegisters
|
||||||
|
{
|
||||||
|
ZYDIS_REGISTER_NONE,
|
||||||
|
|
||||||
|
// General purpose registers 8-bit
|
||||||
|
ZYDIS_REGISTER_AL,
|
||||||
|
ZYDIS_REGISTER_CL,
|
||||||
|
ZYDIS_REGISTER_DL,
|
||||||
|
ZYDIS_REGISTER_BL,
|
||||||
|
ZYDIS_REGISTER_AH,
|
||||||
|
ZYDIS_REGISTER_CH,
|
||||||
|
ZYDIS_REGISTER_DH,
|
||||||
|
ZYDIS_REGISTER_BH,
|
||||||
|
ZYDIS_REGISTER_SPL,
|
||||||
|
ZYDIS_REGISTER_BPL,
|
||||||
|
ZYDIS_REGISTER_SIL,
|
||||||
|
ZYDIS_REGISTER_DIL,
|
||||||
|
ZYDIS_REGISTER_R8B,
|
||||||
|
ZYDIS_REGISTER_R9B,
|
||||||
|
ZYDIS_REGISTER_R10B,
|
||||||
|
ZYDIS_REGISTER_R11B,
|
||||||
|
ZYDIS_REGISTER_R12B,
|
||||||
|
ZYDIS_REGISTER_R13B,
|
||||||
|
ZYDIS_REGISTER_R14B,
|
||||||
|
ZYDIS_REGISTER_R15B,
|
||||||
|
// General purpose registers 16-bit
|
||||||
|
ZYDIS_REGISTER_AX,
|
||||||
|
ZYDIS_REGISTER_CX,
|
||||||
|
ZYDIS_REGISTER_DX,
|
||||||
|
ZYDIS_REGISTER_BX,
|
||||||
|
ZYDIS_REGISTER_SP,
|
||||||
|
ZYDIS_REGISTER_BP,
|
||||||
|
ZYDIS_REGISTER_SI,
|
||||||
|
ZYDIS_REGISTER_DI,
|
||||||
|
ZYDIS_REGISTER_R8W,
|
||||||
|
ZYDIS_REGISTER_R9W,
|
||||||
|
ZYDIS_REGISTER_R10W,
|
||||||
|
ZYDIS_REGISTER_R11W,
|
||||||
|
ZYDIS_REGISTER_R12W,
|
||||||
|
ZYDIS_REGISTER_R13W,
|
||||||
|
ZYDIS_REGISTER_R14W,
|
||||||
|
ZYDIS_REGISTER_R15W,
|
||||||
|
// General purpose registers 32-bit
|
||||||
|
ZYDIS_REGISTER_EAX,
|
||||||
|
ZYDIS_REGISTER_ECX,
|
||||||
|
ZYDIS_REGISTER_EDX,
|
||||||
|
ZYDIS_REGISTER_EBX,
|
||||||
|
ZYDIS_REGISTER_ESP,
|
||||||
|
ZYDIS_REGISTER_EBP,
|
||||||
|
ZYDIS_REGISTER_ESI,
|
||||||
|
ZYDIS_REGISTER_EDI,
|
||||||
|
ZYDIS_REGISTER_R8D,
|
||||||
|
ZYDIS_REGISTER_R9D,
|
||||||
|
ZYDIS_REGISTER_R10D,
|
||||||
|
ZYDIS_REGISTER_R11D,
|
||||||
|
ZYDIS_REGISTER_R12D,
|
||||||
|
ZYDIS_REGISTER_R13D,
|
||||||
|
ZYDIS_REGISTER_R14D,
|
||||||
|
ZYDIS_REGISTER_R15D,
|
||||||
|
// General purpose registers 64-bit
|
||||||
|
ZYDIS_REGISTER_RAX,
|
||||||
|
ZYDIS_REGISTER_RCX,
|
||||||
|
ZYDIS_REGISTER_RDX,
|
||||||
|
ZYDIS_REGISTER_RBX,
|
||||||
|
ZYDIS_REGISTER_RSP,
|
||||||
|
ZYDIS_REGISTER_RBP,
|
||||||
|
ZYDIS_REGISTER_RSI,
|
||||||
|
ZYDIS_REGISTER_RDI,
|
||||||
|
ZYDIS_REGISTER_R8,
|
||||||
|
ZYDIS_REGISTER_R9,
|
||||||
|
ZYDIS_REGISTER_R10,
|
||||||
|
ZYDIS_REGISTER_R11,
|
||||||
|
ZYDIS_REGISTER_R12,
|
||||||
|
ZYDIS_REGISTER_R13,
|
||||||
|
ZYDIS_REGISTER_R14,
|
||||||
|
ZYDIS_REGISTER_R15,
|
||||||
|
// Floating point legacy registers
|
||||||
|
ZYDIS_REGISTER_ST0,
|
||||||
|
ZYDIS_REGISTER_ST1,
|
||||||
|
ZYDIS_REGISTER_ST2,
|
||||||
|
ZYDIS_REGISTER_ST3,
|
||||||
|
ZYDIS_REGISTER_ST4,
|
||||||
|
ZYDIS_REGISTER_ST5,
|
||||||
|
ZYDIS_REGISTER_ST6,
|
||||||
|
ZYDIS_REGISTER_ST7,
|
||||||
|
// Floating point multimedia registers
|
||||||
|
ZYDIS_REGISTER_MM0,
|
||||||
|
ZYDIS_REGISTER_MM1,
|
||||||
|
ZYDIS_REGISTER_MM2,
|
||||||
|
ZYDIS_REGISTER_MM3,
|
||||||
|
ZYDIS_REGISTER_MM4,
|
||||||
|
ZYDIS_REGISTER_MM5,
|
||||||
|
ZYDIS_REGISTER_MM6,
|
||||||
|
ZYDIS_REGISTER_MM7,
|
||||||
|
// Floating point vector registers 128-bit
|
||||||
|
ZYDIS_REGISTER_XMM0,
|
||||||
|
ZYDIS_REGISTER_XMM1,
|
||||||
|
ZYDIS_REGISTER_XMM2,
|
||||||
|
ZYDIS_REGISTER_XMM3,
|
||||||
|
ZYDIS_REGISTER_XMM4,
|
||||||
|
ZYDIS_REGISTER_XMM5,
|
||||||
|
ZYDIS_REGISTER_XMM6,
|
||||||
|
ZYDIS_REGISTER_XMM7,
|
||||||
|
ZYDIS_REGISTER_XMM8,
|
||||||
|
ZYDIS_REGISTER_XMM9,
|
||||||
|
ZYDIS_REGISTER_XMM10,
|
||||||
|
ZYDIS_REGISTER_XMM11,
|
||||||
|
ZYDIS_REGISTER_XMM12,
|
||||||
|
ZYDIS_REGISTER_XMM13,
|
||||||
|
ZYDIS_REGISTER_XMM14,
|
||||||
|
ZYDIS_REGISTER_XMM15,
|
||||||
|
ZYDIS_REGISTER_XMM16,
|
||||||
|
ZYDIS_REGISTER_XMM17,
|
||||||
|
ZYDIS_REGISTER_XMM18,
|
||||||
|
ZYDIS_REGISTER_XMM19,
|
||||||
|
ZYDIS_REGISTER_XMM20,
|
||||||
|
ZYDIS_REGISTER_XMM21,
|
||||||
|
ZYDIS_REGISTER_XMM22,
|
||||||
|
ZYDIS_REGISTER_XMM23,
|
||||||
|
ZYDIS_REGISTER_XMM24,
|
||||||
|
ZYDIS_REGISTER_XMM25,
|
||||||
|
ZYDIS_REGISTER_XMM26,
|
||||||
|
ZYDIS_REGISTER_XMM27,
|
||||||
|
ZYDIS_REGISTER_XMM28,
|
||||||
|
ZYDIS_REGISTER_XMM29,
|
||||||
|
ZYDIS_REGISTER_XMM30,
|
||||||
|
ZYDIS_REGISTER_XMM31,
|
||||||
|
// Floating point vector registers 256-bit
|
||||||
|
ZYDIS_REGISTER_YMM0,
|
||||||
|
ZYDIS_REGISTER_YMM1,
|
||||||
|
ZYDIS_REGISTER_YMM2,
|
||||||
|
ZYDIS_REGISTER_YMM3,
|
||||||
|
ZYDIS_REGISTER_YMM4,
|
||||||
|
ZYDIS_REGISTER_YMM5,
|
||||||
|
ZYDIS_REGISTER_YMM6,
|
||||||
|
ZYDIS_REGISTER_YMM7,
|
||||||
|
ZYDIS_REGISTER_YMM8,
|
||||||
|
ZYDIS_REGISTER_YMM9,
|
||||||
|
ZYDIS_REGISTER_YMM10,
|
||||||
|
ZYDIS_REGISTER_YMM11,
|
||||||
|
ZYDIS_REGISTER_YMM12,
|
||||||
|
ZYDIS_REGISTER_YMM13,
|
||||||
|
ZYDIS_REGISTER_YMM14,
|
||||||
|
ZYDIS_REGISTER_YMM15,
|
||||||
|
ZYDIS_REGISTER_YMM16,
|
||||||
|
ZYDIS_REGISTER_YMM17,
|
||||||
|
ZYDIS_REGISTER_YMM18,
|
||||||
|
ZYDIS_REGISTER_YMM19,
|
||||||
|
ZYDIS_REGISTER_YMM20,
|
||||||
|
ZYDIS_REGISTER_YMM21,
|
||||||
|
ZYDIS_REGISTER_YMM22,
|
||||||
|
ZYDIS_REGISTER_YMM23,
|
||||||
|
ZYDIS_REGISTER_YMM24,
|
||||||
|
ZYDIS_REGISTER_YMM25,
|
||||||
|
ZYDIS_REGISTER_YMM26,
|
||||||
|
ZYDIS_REGISTER_YMM27,
|
||||||
|
ZYDIS_REGISTER_YMM28,
|
||||||
|
ZYDIS_REGISTER_YMM29,
|
||||||
|
ZYDIS_REGISTER_YMM30,
|
||||||
|
ZYDIS_REGISTER_YMM31,
|
||||||
|
// Floating point vector registers 512-bit
|
||||||
|
ZYDIS_REGISTER_ZMM0,
|
||||||
|
ZYDIS_REGISTER_ZMM1,
|
||||||
|
ZYDIS_REGISTER_ZMM2,
|
||||||
|
ZYDIS_REGISTER_ZMM3,
|
||||||
|
ZYDIS_REGISTER_ZMM4,
|
||||||
|
ZYDIS_REGISTER_ZMM5,
|
||||||
|
ZYDIS_REGISTER_ZMM6,
|
||||||
|
ZYDIS_REGISTER_ZMM7,
|
||||||
|
ZYDIS_REGISTER_ZMM8,
|
||||||
|
ZYDIS_REGISTER_ZMM9,
|
||||||
|
ZYDIS_REGISTER_ZMM10,
|
||||||
|
ZYDIS_REGISTER_ZMM11,
|
||||||
|
ZYDIS_REGISTER_ZMM12,
|
||||||
|
ZYDIS_REGISTER_ZMM13,
|
||||||
|
ZYDIS_REGISTER_ZMM14,
|
||||||
|
ZYDIS_REGISTER_ZMM15,
|
||||||
|
ZYDIS_REGISTER_ZMM16,
|
||||||
|
ZYDIS_REGISTER_ZMM17,
|
||||||
|
ZYDIS_REGISTER_ZMM18,
|
||||||
|
ZYDIS_REGISTER_ZMM19,
|
||||||
|
ZYDIS_REGISTER_ZMM20,
|
||||||
|
ZYDIS_REGISTER_ZMM21,
|
||||||
|
ZYDIS_REGISTER_ZMM22,
|
||||||
|
ZYDIS_REGISTER_ZMM23,
|
||||||
|
ZYDIS_REGISTER_ZMM24,
|
||||||
|
ZYDIS_REGISTER_ZMM25,
|
||||||
|
ZYDIS_REGISTER_ZMM26,
|
||||||
|
ZYDIS_REGISTER_ZMM27,
|
||||||
|
ZYDIS_REGISTER_ZMM28,
|
||||||
|
ZYDIS_REGISTER_ZMM29,
|
||||||
|
ZYDIS_REGISTER_ZMM30,
|
||||||
|
ZYDIS_REGISTER_ZMM31,
|
||||||
|
// Flags registers
|
||||||
|
ZYDIS_REGISTER_FLAGS,
|
||||||
|
ZYDIS_REGISTER_EFLAGS,
|
||||||
|
ZYDIS_REGISTER_RFLAGS,
|
||||||
|
// Instruction-pointer registers
|
||||||
|
ZYDIS_REGISTER_IP,
|
||||||
|
ZYDIS_REGISTER_EIP,
|
||||||
|
ZYDIS_REGISTER_RIP,
|
||||||
|
// Segment registers
|
||||||
|
ZYDIS_REGISTER_ES,
|
||||||
|
ZYDIS_REGISTER_CS,
|
||||||
|
ZYDIS_REGISTER_SS,
|
||||||
|
ZYDIS_REGISTER_DS,
|
||||||
|
ZYDIS_REGISTER_FS,
|
||||||
|
ZYDIS_REGISTER_GS,
|
||||||
|
// Table registers
|
||||||
|
ZYDIS_REGISTER_GDTR,
|
||||||
|
ZYDIS_REGISTER_LDTR,
|
||||||
|
ZYDIS_REGISTER_IDTR,
|
||||||
|
ZYDIS_REGISTER_TR,
|
||||||
|
// Test registers
|
||||||
|
ZYDIS_REGISTER_TR0,
|
||||||
|
ZYDIS_REGISTER_TR1,
|
||||||
|
ZYDIS_REGISTER_TR2,
|
||||||
|
ZYDIS_REGISTER_TR3,
|
||||||
|
ZYDIS_REGISTER_TR4,
|
||||||
|
ZYDIS_REGISTER_TR5,
|
||||||
|
ZYDIS_REGISTER_TR6,
|
||||||
|
ZYDIS_REGISTER_TR7,
|
||||||
|
// Control registers
|
||||||
|
ZYDIS_REGISTER_CR0,
|
||||||
|
ZYDIS_REGISTER_CR1,
|
||||||
|
ZYDIS_REGISTER_CR2,
|
||||||
|
ZYDIS_REGISTER_CR3,
|
||||||
|
ZYDIS_REGISTER_CR4,
|
||||||
|
ZYDIS_REGISTER_CR5,
|
||||||
|
ZYDIS_REGISTER_CR6,
|
||||||
|
ZYDIS_REGISTER_CR7,
|
||||||
|
ZYDIS_REGISTER_CR8,
|
||||||
|
ZYDIS_REGISTER_CR9,
|
||||||
|
ZYDIS_REGISTER_CR10,
|
||||||
|
ZYDIS_REGISTER_CR11,
|
||||||
|
ZYDIS_REGISTER_CR12,
|
||||||
|
ZYDIS_REGISTER_CR13,
|
||||||
|
ZYDIS_REGISTER_CR14,
|
||||||
|
ZYDIS_REGISTER_CR15,
|
||||||
|
// Debug registers
|
||||||
|
ZYDIS_REGISTER_DR0,
|
||||||
|
ZYDIS_REGISTER_DR1,
|
||||||
|
ZYDIS_REGISTER_DR2,
|
||||||
|
ZYDIS_REGISTER_DR3,
|
||||||
|
ZYDIS_REGISTER_DR4,
|
||||||
|
ZYDIS_REGISTER_DR5,
|
||||||
|
ZYDIS_REGISTER_DR6,
|
||||||
|
ZYDIS_REGISTER_DR7,
|
||||||
|
ZYDIS_REGISTER_DR8,
|
||||||
|
ZYDIS_REGISTER_DR9,
|
||||||
|
ZYDIS_REGISTER_DR10,
|
||||||
|
ZYDIS_REGISTER_DR11,
|
||||||
|
ZYDIS_REGISTER_DR12,
|
||||||
|
ZYDIS_REGISTER_DR13,
|
||||||
|
ZYDIS_REGISTER_DR14,
|
||||||
|
ZYDIS_REGISTER_DR15,
|
||||||
|
// Mask registers
|
||||||
|
ZYDIS_REGISTER_K0,
|
||||||
|
ZYDIS_REGISTER_K1,
|
||||||
|
ZYDIS_REGISTER_K2,
|
||||||
|
ZYDIS_REGISTER_K3,
|
||||||
|
ZYDIS_REGISTER_K4,
|
||||||
|
ZYDIS_REGISTER_K5,
|
||||||
|
ZYDIS_REGISTER_K6,
|
||||||
|
ZYDIS_REGISTER_K7,
|
||||||
|
// Bound registers
|
||||||
|
ZYDIS_REGISTER_BND0,
|
||||||
|
ZYDIS_REGISTER_BND1,
|
||||||
|
ZYDIS_REGISTER_BND2,
|
||||||
|
ZYDIS_REGISTER_BND3,
|
||||||
|
ZYDIS_REGISTER_BNDCFG,
|
||||||
|
ZYDIS_REGISTER_BNDSTATUS,
|
||||||
|
// Uncategorized
|
||||||
|
ZYDIS_REGISTER_MXCSR,
|
||||||
|
ZYDIS_REGISTER_PKRU,
|
||||||
|
ZYDIS_REGISTER_XCR0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
|
ZYDIS_REGISTER_MAX_VALUE = ZYDIS_REGISTER_XCR0,
|
||||||
|
/**
|
||||||
|
* @brief Minimum amount of bits required to store a value of this enum.
|
||||||
|
*/
|
||||||
|
ZYDIS_REGISTER_MIN_BITS = 0x0008
|
||||||
|
};
|
|
@ -52,7 +52,7 @@ extern "C" {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines the @c ZydisDecoderTreeNodeType datatype.
|
* @brief Defines the @c ZydisDecoderTreeNodeType datatype.
|
||||||
*/
|
*/
|
||||||
typedef ZydisU8 ZydisDecoderTreeNodeType;
|
typedef ZydisU8 ZydisDecoderTreeNodeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,7 +99,7 @@ enum ZydisDecoderTreeNodeTypes
|
||||||
ZYDIS_NODETYPE_FILTER_MODRM_MOD_COMPACT = 0x08,
|
ZYDIS_NODETYPE_FILTER_MODRM_MOD_COMPACT = 0x08,
|
||||||
/**
|
/**
|
||||||
* @brief Reference to a ModRM.reg filter.
|
* @brief Reference to a ModRM.reg filter.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NODETYPE_FILTER_MODRM_REG = 0x09,
|
ZYDIS_NODETYPE_FILTER_MODRM_REG = 0x09,
|
||||||
/**
|
/**
|
||||||
* @brief Reference to a ModRM.rm filter.
|
* @brief Reference to a ModRM.rm filter.
|
||||||
|
@ -221,7 +221,7 @@ typedef ZydisU8 ZydisInstructionEncodingFlags;
|
||||||
/**
|
/**
|
||||||
* @brief The instruction ignores the value of `modrm.mod` and always assumes `modrm.mod == 3`
|
* @brief The instruction ignores the value of `modrm.mod` and always assumes `modrm.mod == 3`
|
||||||
* ("reg, reg" - form).
|
* ("reg, reg" - form).
|
||||||
*
|
*
|
||||||
* Instructions with this flag can't have a SIB byte or a displacement value.
|
* Instructions with this flag can't have a SIB byte or a displacement value.
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM 0x10
|
#define ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM 0x10
|
||||||
|
@ -232,7 +232,7 @@ typedef ZydisU8 ZydisInstructionEncodingFlags;
|
||||||
typedef struct ZydisInstructionEncodingInfo_
|
typedef struct ZydisInstructionEncodingInfo_
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Contains flags with information about the physical instruction-encoding.
|
* @brief Contains flags with information about the physical instruction-encoding.
|
||||||
*/
|
*/
|
||||||
ZydisInstructionEncodingFlags flags;
|
ZydisInstructionEncodingFlags flags;
|
||||||
/**
|
/**
|
||||||
|
@ -287,20 +287,20 @@ ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode(void);
|
||||||
*
|
*
|
||||||
* @param parent The parent node.
|
* @param parent The parent node.
|
||||||
* @param index The index of the child node to retrieve.
|
* @param index The index of the child node to retrieve.
|
||||||
*
|
*
|
||||||
* @return The specified child node.
|
* @return The specified child node.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(
|
ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(
|
||||||
const ZydisDecoderTreeNode* parent, ZydisU16 index);
|
const ZydisDecoderTreeNode* parent, ZydisU16 index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns information about optional instruction parts (like modrm, displacement or
|
* @brief Returns information about optional instruction parts (like modrm, displacement or
|
||||||
* immediates) for the instruction that is linked to the given @c node.
|
* immediates) for the instruction that is linked to the given @c node.
|
||||||
*
|
*
|
||||||
* @param node The instruction definition node.
|
* @param node The instruction definition node.
|
||||||
* @param info A pointer to the @c ZydisInstructionParts struct.
|
* @param info A pointer to the @c ZydisInstructionParts struct.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
|
ZYDIS_NO_EXPORT void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
|
||||||
const ZydisInstructionEncodingInfo** info);
|
const ZydisInstructionEncodingInfo** info);
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Zyan Disassembler Library (Zydis)
|
Zyan Disassembler Library (Zydis)
|
||||||
|
|
||||||
Original Author : Joel Höner
|
Original Author : Joel Hoener
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -71,9 +71,9 @@ enum ZydisSemanticOperandTypes
|
||||||
ZYDIS_SEMANTIC_OPTYPE_GPR16,
|
ZYDIS_SEMANTIC_OPTYPE_GPR16,
|
||||||
ZYDIS_SEMANTIC_OPTYPE_GPR32,
|
ZYDIS_SEMANTIC_OPTYPE_GPR32,
|
||||||
ZYDIS_SEMANTIC_OPTYPE_GPR64,
|
ZYDIS_SEMANTIC_OPTYPE_GPR64,
|
||||||
ZYDIS_SEMANTIC_OPTYPE_GPR16_32_64,
|
ZYDIS_SEMANTIC_OPTYPE_GPR16_32_64,
|
||||||
ZYDIS_SEMANTIC_OPTYPE_GPR32_32_64,
|
ZYDIS_SEMANTIC_OPTYPE_GPR32_32_64,
|
||||||
ZYDIS_SEMANTIC_OPTYPE_GPR16_32_32,
|
ZYDIS_SEMANTIC_OPTYPE_GPR16_32_32,
|
||||||
ZYDIS_SEMANTIC_OPTYPE_FPR,
|
ZYDIS_SEMANTIC_OPTYPE_FPR,
|
||||||
ZYDIS_SEMANTIC_OPTYPE_MMX,
|
ZYDIS_SEMANTIC_OPTYPE_MMX,
|
||||||
ZYDIS_SEMANTIC_OPTYPE_XMM,
|
ZYDIS_SEMANTIC_OPTYPE_XMM,
|
||||||
|
@ -141,7 +141,7 @@ typedef struct ZydisOperandDefinition_
|
||||||
ZydisInternalElementType elementType ZYDIS_BITFIELD(5);
|
ZydisInternalElementType elementType ZYDIS_BITFIELD(5);
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
ZydisOperandEncoding encoding;
|
ZydisOperandEncoding encoding;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ZydisU8 type ZYDIS_BITFIELD(3);
|
ZydisU8 type ZYDIS_BITFIELD(3);
|
||||||
|
@ -151,10 +151,10 @@ typedef struct ZydisOperandDefinition_
|
||||||
ZydisU8 id ZYDIS_BITFIELD(6);
|
ZydisU8 id ZYDIS_BITFIELD(6);
|
||||||
} reg;
|
} reg;
|
||||||
} reg;
|
} reg;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ZydisU8 seg ZYDIS_BITFIELD(3);
|
ZydisU8 seg ZYDIS_BITFIELD(3);
|
||||||
ZydisU8 base ZYDIS_BITFIELD(3);
|
ZydisU8 base ZYDIS_BITFIELD(3);
|
||||||
} mem;
|
} mem;
|
||||||
} op;
|
} op;
|
||||||
} ZydisOperandDefinition;
|
} ZydisOperandDefinition;
|
||||||
|
@ -182,13 +182,40 @@ enum ZydisImplicitMemBase
|
||||||
ZYDIS_IMPLMEM_BASE_ASP,
|
ZYDIS_IMPLMEM_BASE_ASP,
|
||||||
ZYDIS_IMPLMEM_BASE_ABP,
|
ZYDIS_IMPLMEM_BASE_ABP,
|
||||||
ZYDIS_IMPLMEM_BASE_ASI,
|
ZYDIS_IMPLMEM_BASE_ASI,
|
||||||
ZYDIS_IMPLMEM_BASE_ADI
|
ZYDIS_IMPLMEM_BASE_ADI
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
/* Instruction definition */
|
/* Instruction definition */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Defines the `ZydisRegisterConstraint` datatype.
|
||||||
|
*/
|
||||||
|
typedef ZydisU8 ZydisRegisterConstraint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Values that represent register-constraints.
|
||||||
|
*/
|
||||||
|
enum ZydisRegisterConstraints
|
||||||
|
{
|
||||||
|
ZYDIS_REG_CONSTRAINTS_UNUSED,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_NONE,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_GPR,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_SR_DEST,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_SR,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_CR,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_DR,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_MASK,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_BND,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_VSIB,
|
||||||
|
|
||||||
|
ZYDIS_REG_CONSTRAINTS_MAX_VALUE = ZYDIS_REG_CONSTRAINTS_VSIB,
|
||||||
|
ZYDIS_REG_CONSTRAINTS_MIN_BITS = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines the @c ZydisInternalVectorLength datatype.
|
* @brief Defines the @c ZydisInternalVectorLength datatype.
|
||||||
*/
|
*/
|
||||||
|
@ -222,7 +249,9 @@ enum ZydisInternalElementSizes
|
||||||
ZYDIS_IELEMENT_SIZE_16,
|
ZYDIS_IELEMENT_SIZE_16,
|
||||||
ZYDIS_IELEMENT_SIZE_32,
|
ZYDIS_IELEMENT_SIZE_32,
|
||||||
ZYDIS_IELEMENT_SIZE_64,
|
ZYDIS_IELEMENT_SIZE_64,
|
||||||
ZYDIS_IELEMENT_SIZE_128
|
ZYDIS_IELEMENT_SIZE_128,
|
||||||
|
|
||||||
|
ZYDIS_IELEMENT_SIZE_MAX_VALUE = ZYDIS_IELEMENT_SIZE_128
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
@ -460,10 +489,12 @@ enum ZydisVEXStaticBroadcasts
|
||||||
ZYDIS_VEX_STATIC_BROADCAST_NONE,
|
ZYDIS_VEX_STATIC_BROADCAST_NONE,
|
||||||
ZYDIS_VEX_STATIC_BROADCAST_1_TO_2,
|
ZYDIS_VEX_STATIC_BROADCAST_1_TO_2,
|
||||||
ZYDIS_VEX_STATIC_BROADCAST_1_TO_4,
|
ZYDIS_VEX_STATIC_BROADCAST_1_TO_4,
|
||||||
ZYDIS_VEX_STATIC_BROADCAST_1_TO_8,
|
ZYDIS_VEX_STATIC_BROADCAST_1_TO_8,
|
||||||
ZYDIS_VEX_STATIC_BROADCAST_1_TO_16,
|
ZYDIS_VEX_STATIC_BROADCAST_1_TO_16,
|
||||||
ZYDIS_VEX_STATIC_BROADCAST_1_TO_32,
|
ZYDIS_VEX_STATIC_BROADCAST_1_TO_32,
|
||||||
ZYDIS_VEX_STATIC_BROADCAST_2_TO_4
|
ZYDIS_VEX_STATIC_BROADCAST_2_TO_4,
|
||||||
|
|
||||||
|
ZYDIS_VEX_STATIC_BROADCAST_MAX_VALUE = ZYDIS_VEX_STATIC_BROADCAST_2_TO_4
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
@ -490,7 +521,9 @@ enum ZydisEVEXStaticBroadcasts
|
||||||
ZYDIS_EVEX_STATIC_BROADCAST_2_TO_16,
|
ZYDIS_EVEX_STATIC_BROADCAST_2_TO_16,
|
||||||
ZYDIS_EVEX_STATIC_BROADCAST_4_TO_8,
|
ZYDIS_EVEX_STATIC_BROADCAST_4_TO_8,
|
||||||
ZYDIS_EVEX_STATIC_BROADCAST_4_TO_16,
|
ZYDIS_EVEX_STATIC_BROADCAST_4_TO_16,
|
||||||
ZYDIS_EVEX_STATIC_BROADCAST_8_TO_16
|
ZYDIS_EVEX_STATIC_BROADCAST_8_TO_16,
|
||||||
|
|
||||||
|
ZYDIS_EVEX_STATIC_BROADCAST_MAX_VALUE = ZYDIS_EVEX_STATIC_BROADCAST_8_TO_16
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
@ -553,30 +586,35 @@ enum ZydisMaskPolicies
|
||||||
ZydisInstructionCategory category ZYDIS_BITFIELD(ZYDIS_CATEGORY_MIN_BITS); \
|
ZydisInstructionCategory category ZYDIS_BITFIELD(ZYDIS_CATEGORY_MIN_BITS); \
|
||||||
ZydisISASet isaSet ZYDIS_BITFIELD(ZYDIS_ISA_SET_MIN_BITS); \
|
ZydisISASet isaSet ZYDIS_BITFIELD(ZYDIS_ISA_SET_MIN_BITS); \
|
||||||
ZydisISAExt isaExt ZYDIS_BITFIELD(ZYDIS_ISA_EXT_MIN_BITS); \
|
ZydisISAExt isaExt ZYDIS_BITFIELD(ZYDIS_ISA_EXT_MIN_BITS); \
|
||||||
ZydisExceptionClass exceptionClass ZYDIS_BITFIELD( 6)
|
ZydisExceptionClass exceptionClass ZYDIS_BITFIELD( 6); \
|
||||||
|
ZydisRegisterConstraint constrREG ZYDIS_BITFIELD(ZYDIS_REG_CONSTRAINTS_MIN_BITS); \
|
||||||
|
ZydisRegisterConstraint constrRM ZYDIS_BITFIELD(ZYDIS_REG_CONSTRAINTS_MIN_BITS)
|
||||||
|
|
||||||
#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR \
|
#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR \
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE; \
|
ZYDIS_INSTRUCTION_DEFINITION_BASE; \
|
||||||
ZydisBool hasNDSNDDOperand ZYDIS_BITFIELD( 1)
|
ZydisRegisterConstraint constrNDSNDD ZYDIS_BITFIELD(ZYDIS_REG_CONSTRAINTS_MIN_BITS)
|
||||||
|
|
||||||
#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_EX \
|
#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL \
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR; \
|
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR; \
|
||||||
ZydisBool hasVSIB ZYDIS_BITFIELD( 1)
|
ZydisBool isGather ZYDIS_BITFIELD( 1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines the @c ZydisInstructionDefinition struct.
|
* @brief Defines the `ZydisInstructionDefinition` struct.
|
||||||
*/
|
*/
|
||||||
typedef struct ZydisInstructionDefinition_
|
typedef struct ZydisInstructionDefinition_
|
||||||
{
|
{
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE;
|
ZYDIS_INSTRUCTION_DEFINITION_BASE;
|
||||||
} ZydisInstructionDefinition;
|
} ZydisInstructionDefinition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Defines the `ZydisInstructionDefinitionDEFAULT` struct.
|
||||||
|
*/
|
||||||
typedef struct ZydisInstructionDefinitionDEFAULT_
|
typedef struct ZydisInstructionDefinitionDEFAULT_
|
||||||
{
|
{
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE;
|
ZYDIS_INSTRUCTION_DEFINITION_BASE;
|
||||||
ZydisBool isPrivileged ZYDIS_BITFIELD( 1);
|
ZydisBool isPrivileged ZYDIS_BITFIELD( 1);
|
||||||
ZydisBool isFarBranch ZYDIS_BITFIELD( 1);
|
ZydisBool isFarBranch ZYDIS_BITFIELD( 1);
|
||||||
ZydisBool acceptsLock ZYDIS_BITFIELD( 1);
|
ZydisBool acceptsLOCK ZYDIS_BITFIELD( 1);
|
||||||
ZydisBool acceptsREP ZYDIS_BITFIELD( 1);
|
ZydisBool acceptsREP ZYDIS_BITFIELD( 1);
|
||||||
ZydisBool acceptsREPEREPZ ZYDIS_BITFIELD( 1);
|
ZydisBool acceptsREPEREPZ ZYDIS_BITFIELD( 1);
|
||||||
ZydisBool acceptsREPNEREPNZ ZYDIS_BITFIELD( 1);
|
ZydisBool acceptsREPNEREPNZ ZYDIS_BITFIELD( 1);
|
||||||
|
@ -588,26 +626,38 @@ typedef struct ZydisInstructionDefinitionDEFAULT_
|
||||||
ZydisBool acceptsSegment ZYDIS_BITFIELD( 1);
|
ZydisBool acceptsSegment ZYDIS_BITFIELD( 1);
|
||||||
} ZydisInstructionDefinitionDEFAULT;
|
} ZydisInstructionDefinitionDEFAULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Defines the `ZydisInstructionDefinition3DNOW` struct.
|
||||||
|
*/
|
||||||
typedef struct ZydisInstructionDefinition3DNOW_
|
typedef struct ZydisInstructionDefinition3DNOW_
|
||||||
{
|
{
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE;
|
ZYDIS_INSTRUCTION_DEFINITION_BASE;
|
||||||
} ZydisInstructionDefinition3DNOW;
|
} ZydisInstructionDefinition3DNOW;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Defines the `ZydisInstructionDefinitionXOP` struct.
|
||||||
|
*/
|
||||||
typedef struct ZydisInstructionDefinitionXOP_
|
typedef struct ZydisInstructionDefinitionXOP_
|
||||||
{
|
{
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR;
|
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR;
|
||||||
} ZydisInstructionDefinitionXOP;
|
} ZydisInstructionDefinitionXOP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Defines the `ZydisInstructionDefinitionVEX` struct.
|
||||||
|
*/
|
||||||
typedef struct ZydisInstructionDefinitionVEX_
|
typedef struct ZydisInstructionDefinitionVEX_
|
||||||
{
|
{
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR;
|
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL;
|
||||||
ZydisVEXStaticBroadcast broadcast ZYDIS_BITFIELD( 3);
|
ZydisVEXStaticBroadcast broadcast ZYDIS_BITFIELD( 3);
|
||||||
} ZydisInstructionDefinitionVEX;
|
} ZydisInstructionDefinitionVEX;
|
||||||
|
|
||||||
#ifndef ZYDIS_DISABLE_EVEX
|
#ifndef ZYDIS_DISABLE_EVEX
|
||||||
|
/**
|
||||||
|
* @brief Defines the `ZydisInstructionDefinitionEVEX` struct.
|
||||||
|
*/
|
||||||
typedef struct ZydisInstructionDefinitionEVEX_
|
typedef struct ZydisInstructionDefinitionEVEX_
|
||||||
{
|
{
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_EX;
|
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL;
|
||||||
ZydisInternalVectorLength vectorLength ZYDIS_BITFIELD( 2);
|
ZydisInternalVectorLength vectorLength ZYDIS_BITFIELD( 2);
|
||||||
ZydisEVEXTupleType tupleType ZYDIS_BITFIELD( 4);
|
ZydisEVEXTupleType tupleType ZYDIS_BITFIELD( 4);
|
||||||
ZydisInternalElementSize elementSize ZYDIS_BITFIELD( 3);
|
ZydisInternalElementSize elementSize ZYDIS_BITFIELD( 3);
|
||||||
|
@ -620,9 +670,12 @@ typedef struct ZydisInstructionDefinitionEVEX_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ZYDIS_DISABLE_MVEX
|
#ifndef ZYDIS_DISABLE_MVEX
|
||||||
|
/**
|
||||||
|
* @brief Defines the `ZydisInstructionDefinitionMVEX` struct.
|
||||||
|
*/
|
||||||
typedef struct ZydisInstructionDefinitionMVEX_
|
typedef struct ZydisInstructionDefinitionMVEX_
|
||||||
{
|
{
|
||||||
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_EX;
|
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL;
|
||||||
ZydisMVEXFunctionality functionality ZYDIS_BITFIELD( 5);
|
ZydisMVEXFunctionality functionality ZYDIS_BITFIELD( 5);
|
||||||
ZydisMaskPolicy maskPolicy ZYDIS_BITFIELD( 2);
|
ZydisMaskPolicy maskPolicy ZYDIS_BITFIELD( 2);
|
||||||
ZydisBool hasElementGranularity ZYDIS_BITFIELD( 1);
|
ZydisBool hasElementGranularity ZYDIS_BITFIELD( 1);
|
||||||
|
@ -676,10 +729,10 @@ ZYDIS_NO_EXPORT void ZydisGetInstructionDefinition(ZydisInstructionEncoding enco
|
||||||
* @param definition A pointer to the instruction-definition.
|
* @param definition A pointer to the instruction-definition.
|
||||||
* @param operand A pointer to the variable that receives a pointer to the first operand-
|
* @param operand A pointer to the variable that receives a pointer to the first operand-
|
||||||
* definition of the instruction.
|
* definition of the instruction.
|
||||||
*
|
*
|
||||||
* @return The number of operands for the given instruction-definition.
|
* @return The number of operands for the given instruction-definition.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZydisU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
|
ZYDIS_NO_EXPORT ZydisU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
|
||||||
const ZydisOperandDefinition** operand);
|
const ZydisOperandDefinition** operand);
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* @brief
|
* @brief
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ZYDIS_METAINFO_H
|
#ifndef ZYDIS_METAINFO_H
|
||||||
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
/* Enums and types */
|
/* Enums and types */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
#include <Zydis/Generated/EnumInstructionCategory.h>
|
#include <Zydis/Generated/EnumInstructionCategory.h>
|
||||||
#include <Zydis/Generated/EnumISASet.h>
|
#include <Zydis/Generated/EnumISASet.h>
|
||||||
#include <Zydis/Generated/EnumISAExt.h>
|
#include <Zydis/Generated/EnumISAExt.h>
|
||||||
|
|
||||||
|
@ -53,27 +53,27 @@ extern "C" {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the specified instruction category string.
|
* @brief Returns the specified instruction category string.
|
||||||
*
|
*
|
||||||
* @param category The instruction category.
|
* @param category The instruction category.
|
||||||
*
|
*
|
||||||
* @return The instruction category string or @c NULL, if an invalid category was passed.
|
* @return The instruction category string or @c NULL, if an invalid category was passed.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT const char* ZydisCategoryGetString(ZydisInstructionCategory category);
|
ZYDIS_EXPORT const char* ZydisCategoryGetString(ZydisInstructionCategory category);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the specified isa-set string.
|
* @brief Returns the specified isa-set string.
|
||||||
*
|
*
|
||||||
* @param isaSet The isa-set.
|
* @param isaSet The isa-set.
|
||||||
*
|
*
|
||||||
* @return The isa-set string or @c NULL, if an invalid isa-set was passed.
|
* @return The isa-set string or @c NULL, if an invalid isa-set was passed.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT const char* ZydisISASetGetString(ZydisISASet isaSet);
|
ZYDIS_EXPORT const char* ZydisISASetGetString(ZydisISASet isaSet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the specified isa-extension string.
|
* @brief Returns the specified isa-extension string.
|
||||||
*
|
*
|
||||||
* @param isaExt The isa-extension.
|
* @param isaExt The isa-extension.
|
||||||
*
|
*
|
||||||
* @return The isa-extension string or @c NULL, if an invalid isa-extension was passed.
|
* @return The isa-extension string or @c NULL, if an invalid isa-extension was passed.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT const char* ZydisISAExtGetString(ZydisISAExt isaExt);
|
ZYDIS_EXPORT const char* ZydisISAExtGetString(ZydisISAExt isaExt);
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
/* Enums and types */
|
/* Enums and types */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
#include <Zydis/Generated/EnumMnemonic.h>
|
#include <Zydis/Generated/EnumMnemonic.h>
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
/* Exported functions */
|
/* Exported functions */
|
||||||
|
@ -51,20 +51,20 @@ extern "C" {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the specified instruction mnemonic string.
|
* @brief Returns the specified instruction mnemonic string.
|
||||||
*
|
*
|
||||||
* @param mnemonic The mnemonic.
|
* @param mnemonic The mnemonic.
|
||||||
*
|
*
|
||||||
* @return The instruction mnemonic string or @c NULL, if an invalid mnemonic was passed.
|
* @return The instruction mnemonic string or @c NULL, if an invalid mnemonic was passed.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT const char* ZydisMnemonicGetString(ZydisMnemonic mnemonic);
|
ZYDIS_EXPORT const char* ZydisMnemonicGetString(ZydisMnemonic mnemonic);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the specified instruction mnemonic as `ZydisStaticString`.
|
* @brief Returns the specified instruction mnemonic as `ZydisStaticString`.
|
||||||
*
|
*
|
||||||
* @param mnemonic The mnemonic.
|
* @param mnemonic The mnemonic.
|
||||||
*
|
*
|
||||||
* @return The instruction mnemonic string or @c NULL, if an invalid mnemonic was passed.
|
* @return The instruction mnemonic string or @c NULL, if an invalid mnemonic was passed.
|
||||||
*
|
*
|
||||||
* The `buffer` of the returned struct is guaranteed to be zero-terminated in this special case.
|
* The `buffer` of the returned struct is guaranteed to be zero-terminated in this special case.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT const ZydisStaticString* ZydisMnemonicGetStaticString(ZydisMnemonic mnemonic);
|
ZYDIS_EXPORT const ZydisStaticString* ZydisMnemonicGetStaticString(ZydisMnemonic mnemonic);
|
||||||
|
|
|
@ -48,112 +48,7 @@ extern "C" {
|
||||||
/* Registers */
|
/* Registers */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
#include <Zydis/Generated/EnumRegister.h>
|
||||||
* @brief Defines the @c ZydisRegister datatype.
|
|
||||||
*/
|
|
||||||
typedef ZydisU8 ZydisRegister;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Values that represent zydis registers.
|
|
||||||
*/
|
|
||||||
enum ZydisRegisters
|
|
||||||
{
|
|
||||||
ZYDIS_REGISTER_NONE,
|
|
||||||
|
|
||||||
// General purpose registers 8-bit
|
|
||||||
ZYDIS_REGISTER_AL, ZYDIS_REGISTER_CL, ZYDIS_REGISTER_DL, ZYDIS_REGISTER_BL,
|
|
||||||
ZYDIS_REGISTER_AH, ZYDIS_REGISTER_CH, ZYDIS_REGISTER_DH, ZYDIS_REGISTER_BH,
|
|
||||||
ZYDIS_REGISTER_SPL, ZYDIS_REGISTER_BPL, ZYDIS_REGISTER_SIL, ZYDIS_REGISTER_DIL,
|
|
||||||
ZYDIS_REGISTER_R8B, ZYDIS_REGISTER_R9B, ZYDIS_REGISTER_R10B, ZYDIS_REGISTER_R11B,
|
|
||||||
ZYDIS_REGISTER_R12B, ZYDIS_REGISTER_R13B, ZYDIS_REGISTER_R14B, ZYDIS_REGISTER_R15B,
|
|
||||||
// General purpose registers 16-bit
|
|
||||||
ZYDIS_REGISTER_AX, ZYDIS_REGISTER_CX, ZYDIS_REGISTER_DX, ZYDIS_REGISTER_BX,
|
|
||||||
ZYDIS_REGISTER_SP, ZYDIS_REGISTER_BP, ZYDIS_REGISTER_SI, ZYDIS_REGISTER_DI,
|
|
||||||
ZYDIS_REGISTER_R8W, ZYDIS_REGISTER_R9W, ZYDIS_REGISTER_R10W, ZYDIS_REGISTER_R11W,
|
|
||||||
ZYDIS_REGISTER_R12W, ZYDIS_REGISTER_R13W, ZYDIS_REGISTER_R14W, ZYDIS_REGISTER_R15W,
|
|
||||||
// General purpose registers 32-bit
|
|
||||||
ZYDIS_REGISTER_EAX, ZYDIS_REGISTER_ECX, ZYDIS_REGISTER_EDX, ZYDIS_REGISTER_EBX,
|
|
||||||
ZYDIS_REGISTER_ESP, ZYDIS_REGISTER_EBP, ZYDIS_REGISTER_ESI, ZYDIS_REGISTER_EDI,
|
|
||||||
ZYDIS_REGISTER_R8D, ZYDIS_REGISTER_R9D, ZYDIS_REGISTER_R10D, ZYDIS_REGISTER_R11D,
|
|
||||||
ZYDIS_REGISTER_R12D, ZYDIS_REGISTER_R13D, ZYDIS_REGISTER_R14D, ZYDIS_REGISTER_R15D,
|
|
||||||
// General purpose registers 64-bit
|
|
||||||
ZYDIS_REGISTER_RAX, ZYDIS_REGISTER_RCX, ZYDIS_REGISTER_RDX, ZYDIS_REGISTER_RBX,
|
|
||||||
ZYDIS_REGISTER_RSP, ZYDIS_REGISTER_RBP, ZYDIS_REGISTER_RSI, ZYDIS_REGISTER_RDI,
|
|
||||||
ZYDIS_REGISTER_R8, ZYDIS_REGISTER_R9, ZYDIS_REGISTER_R10, ZYDIS_REGISTER_R11,
|
|
||||||
ZYDIS_REGISTER_R12, ZYDIS_REGISTER_R13, ZYDIS_REGISTER_R14, ZYDIS_REGISTER_R15,
|
|
||||||
// Floating point legacy registers
|
|
||||||
ZYDIS_REGISTER_ST0, ZYDIS_REGISTER_ST1, ZYDIS_REGISTER_ST2, ZYDIS_REGISTER_ST3,
|
|
||||||
ZYDIS_REGISTER_ST4, ZYDIS_REGISTER_ST5, ZYDIS_REGISTER_ST6, ZYDIS_REGISTER_ST7,
|
|
||||||
// Floating point multimedia registers
|
|
||||||
ZYDIS_REGISTER_MM0, ZYDIS_REGISTER_MM1, ZYDIS_REGISTER_MM2, ZYDIS_REGISTER_MM3,
|
|
||||||
ZYDIS_REGISTER_MM4, ZYDIS_REGISTER_MM5, ZYDIS_REGISTER_MM6, ZYDIS_REGISTER_MM7,
|
|
||||||
// Floating point vector registers 128-bit
|
|
||||||
ZYDIS_REGISTER_XMM0, ZYDIS_REGISTER_XMM1, ZYDIS_REGISTER_XMM2, ZYDIS_REGISTER_XMM3,
|
|
||||||
ZYDIS_REGISTER_XMM4, ZYDIS_REGISTER_XMM5, ZYDIS_REGISTER_XMM6, ZYDIS_REGISTER_XMM7,
|
|
||||||
ZYDIS_REGISTER_XMM8, ZYDIS_REGISTER_XMM9, ZYDIS_REGISTER_XMM10, ZYDIS_REGISTER_XMM11,
|
|
||||||
ZYDIS_REGISTER_XMM12, ZYDIS_REGISTER_XMM13, ZYDIS_REGISTER_XMM14, ZYDIS_REGISTER_XMM15,
|
|
||||||
ZYDIS_REGISTER_XMM16, ZYDIS_REGISTER_XMM17, ZYDIS_REGISTER_XMM18, ZYDIS_REGISTER_XMM19,
|
|
||||||
ZYDIS_REGISTER_XMM20, ZYDIS_REGISTER_XMM21, ZYDIS_REGISTER_XMM22, ZYDIS_REGISTER_XMM23,
|
|
||||||
ZYDIS_REGISTER_XMM24, ZYDIS_REGISTER_XMM25, ZYDIS_REGISTER_XMM26, ZYDIS_REGISTER_XMM27,
|
|
||||||
ZYDIS_REGISTER_XMM28, ZYDIS_REGISTER_XMM29, ZYDIS_REGISTER_XMM30, ZYDIS_REGISTER_XMM31,
|
|
||||||
// Floating point vector registers 256-bit
|
|
||||||
ZYDIS_REGISTER_YMM0, ZYDIS_REGISTER_YMM1, ZYDIS_REGISTER_YMM2, ZYDIS_REGISTER_YMM3,
|
|
||||||
ZYDIS_REGISTER_YMM4, ZYDIS_REGISTER_YMM5, ZYDIS_REGISTER_YMM6, ZYDIS_REGISTER_YMM7,
|
|
||||||
ZYDIS_REGISTER_YMM8, ZYDIS_REGISTER_YMM9, ZYDIS_REGISTER_YMM10, ZYDIS_REGISTER_YMM11,
|
|
||||||
ZYDIS_REGISTER_YMM12, ZYDIS_REGISTER_YMM13, ZYDIS_REGISTER_YMM14, ZYDIS_REGISTER_YMM15,
|
|
||||||
ZYDIS_REGISTER_YMM16, ZYDIS_REGISTER_YMM17, ZYDIS_REGISTER_YMM18, ZYDIS_REGISTER_YMM19,
|
|
||||||
ZYDIS_REGISTER_YMM20, ZYDIS_REGISTER_YMM21, ZYDIS_REGISTER_YMM22, ZYDIS_REGISTER_YMM23,
|
|
||||||
ZYDIS_REGISTER_YMM24, ZYDIS_REGISTER_YMM25, ZYDIS_REGISTER_YMM26, ZYDIS_REGISTER_YMM27,
|
|
||||||
ZYDIS_REGISTER_YMM28, ZYDIS_REGISTER_YMM29, ZYDIS_REGISTER_YMM30, ZYDIS_REGISTER_YMM31,
|
|
||||||
// Floating point vector registers 512-bit
|
|
||||||
ZYDIS_REGISTER_ZMM0, ZYDIS_REGISTER_ZMM1, ZYDIS_REGISTER_ZMM2, ZYDIS_REGISTER_ZMM3,
|
|
||||||
ZYDIS_REGISTER_ZMM4, ZYDIS_REGISTER_ZMM5, ZYDIS_REGISTER_ZMM6, ZYDIS_REGISTER_ZMM7,
|
|
||||||
ZYDIS_REGISTER_ZMM8, ZYDIS_REGISTER_ZMM9, ZYDIS_REGISTER_ZMM10, ZYDIS_REGISTER_ZMM11,
|
|
||||||
ZYDIS_REGISTER_ZMM12, ZYDIS_REGISTER_ZMM13, ZYDIS_REGISTER_ZMM14, ZYDIS_REGISTER_ZMM15,
|
|
||||||
ZYDIS_REGISTER_ZMM16, ZYDIS_REGISTER_ZMM17, ZYDIS_REGISTER_ZMM18, ZYDIS_REGISTER_ZMM19,
|
|
||||||
ZYDIS_REGISTER_ZMM20, ZYDIS_REGISTER_ZMM21, ZYDIS_REGISTER_ZMM22, ZYDIS_REGISTER_ZMM23,
|
|
||||||
ZYDIS_REGISTER_ZMM24, ZYDIS_REGISTER_ZMM25, ZYDIS_REGISTER_ZMM26, ZYDIS_REGISTER_ZMM27,
|
|
||||||
ZYDIS_REGISTER_ZMM28, ZYDIS_REGISTER_ZMM29, ZYDIS_REGISTER_ZMM30, ZYDIS_REGISTER_ZMM31,
|
|
||||||
// Flags registers
|
|
||||||
ZYDIS_REGISTER_FLAGS, ZYDIS_REGISTER_EFLAGS, ZYDIS_REGISTER_RFLAGS,
|
|
||||||
// IP registers
|
|
||||||
ZYDIS_REGISTER_IP, ZYDIS_REGISTER_EIP, ZYDIS_REGISTER_RIP,
|
|
||||||
// Segment registers
|
|
||||||
ZYDIS_REGISTER_ES, ZYDIS_REGISTER_CS, ZYDIS_REGISTER_SS, ZYDIS_REGISTER_DS,
|
|
||||||
ZYDIS_REGISTER_FS, ZYDIS_REGISTER_GS,
|
|
||||||
// Table registers
|
|
||||||
ZYDIS_REGISTER_GDTR, ZYDIS_REGISTER_LDTR, ZYDIS_REGISTER_IDTR, ZYDIS_REGISTER_TR,
|
|
||||||
// Test registers
|
|
||||||
ZYDIS_REGISTER_TR0, ZYDIS_REGISTER_TR1, ZYDIS_REGISTER_TR2, ZYDIS_REGISTER_TR3,
|
|
||||||
ZYDIS_REGISTER_TR4, ZYDIS_REGISTER_TR5, ZYDIS_REGISTER_TR6, ZYDIS_REGISTER_TR7,
|
|
||||||
// Control registers
|
|
||||||
ZYDIS_REGISTER_CR0, ZYDIS_REGISTER_CR1, ZYDIS_REGISTER_CR2, ZYDIS_REGISTER_CR3,
|
|
||||||
ZYDIS_REGISTER_CR4, ZYDIS_REGISTER_CR5, ZYDIS_REGISTER_CR6, ZYDIS_REGISTER_CR7,
|
|
||||||
ZYDIS_REGISTER_CR8, ZYDIS_REGISTER_CR9, ZYDIS_REGISTER_CR10, ZYDIS_REGISTER_CR11,
|
|
||||||
ZYDIS_REGISTER_CR12, ZYDIS_REGISTER_CR13, ZYDIS_REGISTER_CR14, ZYDIS_REGISTER_CR15,
|
|
||||||
// Debug registers
|
|
||||||
ZYDIS_REGISTER_DR0, ZYDIS_REGISTER_DR1, ZYDIS_REGISTER_DR2, ZYDIS_REGISTER_DR3,
|
|
||||||
ZYDIS_REGISTER_DR4, ZYDIS_REGISTER_DR5, ZYDIS_REGISTER_DR6, ZYDIS_REGISTER_DR7,
|
|
||||||
ZYDIS_REGISTER_DR8, ZYDIS_REGISTER_DR9, ZYDIS_REGISTER_DR10, ZYDIS_REGISTER_DR11,
|
|
||||||
ZYDIS_REGISTER_DR12, ZYDIS_REGISTER_DR13, ZYDIS_REGISTER_DR14, ZYDIS_REGISTER_DR15,
|
|
||||||
// Mask registers
|
|
||||||
ZYDIS_REGISTER_K0, ZYDIS_REGISTER_K1, ZYDIS_REGISTER_K2, ZYDIS_REGISTER_K3,
|
|
||||||
ZYDIS_REGISTER_K4, ZYDIS_REGISTER_K5, ZYDIS_REGISTER_K6, ZYDIS_REGISTER_K7,
|
|
||||||
// Bound registers
|
|
||||||
ZYDIS_REGISTER_BND0, ZYDIS_REGISTER_BND1, ZYDIS_REGISTER_BND2, ZYDIS_REGISTER_BND3,
|
|
||||||
ZYDIS_REGISTER_BNDCFG, ZYDIS_REGISTER_BNDSTATUS,
|
|
||||||
// Misc registers
|
|
||||||
ZYDIS_REGISTER_MXCSR, ZYDIS_REGISTER_PKRU, ZYDIS_REGISTER_XCR0,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Maximum value of this enum.
|
|
||||||
*/
|
|
||||||
ZYDIS_REGISTER_MAX_VALUE = ZYDIS_REGISTER_XCR0,
|
|
||||||
/**
|
|
||||||
* @brief Minimum amount of bits required to store a value of this enum.
|
|
||||||
*/
|
|
||||||
ZYDIS_REGISTER_MIN_BITS = 0x0008
|
|
||||||
};
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
/* Register classes */
|
/* Register classes */
|
||||||
|
@ -238,6 +133,7 @@ enum ZydisRegisterClasses
|
||||||
* @brief Bound registers.
|
* @brief Bound registers.
|
||||||
*/
|
*/
|
||||||
ZYDIS_REGCLASS_BOUND,
|
ZYDIS_REGCLASS_BOUND,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -247,9 +143,9 @@ enum ZydisRegisterClasses
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
/* Register width */
|
/* Register width */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines the @c ZydisRegisterWidth datatype.
|
* @brief Defines the @c ZydisRegisterWidth datatype.
|
||||||
*/
|
*/
|
||||||
typedef ZydisU16 ZydisRegisterWidth;
|
typedef ZydisU16 ZydisRegisterWidth;
|
||||||
|
|
||||||
|
@ -321,7 +217,7 @@ ZYDIS_EXPORT const char* ZydisRegisterGetString(ZydisRegister reg);
|
||||||
* @param reg The register.
|
* @param reg The register.
|
||||||
*
|
*
|
||||||
* @return The register string or @c NULL, if an invalid register was passed.
|
* @return The register string or @c NULL, if an invalid register was passed.
|
||||||
*
|
*
|
||||||
* The `buffer` of the returned struct is guaranteed to be zero-terminated in this special case.
|
* The `buffer` of the returned struct is guaranteed to be zero-terminated in this special case.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT const ZydisStaticString* ZydisRegisterGetStaticString(ZydisRegister reg);
|
ZYDIS_EXPORT const ZydisStaticString* ZydisRegisterGetStaticString(ZydisRegister reg);
|
||||||
|
|
|
@ -94,6 +94,7 @@ enum ZydisMachineModes
|
||||||
* @brief 16 bit real mode.
|
* @brief 16 bit real mode.
|
||||||
*/
|
*/
|
||||||
ZYDIS_MACHINE_MODE_REAL_16,
|
ZYDIS_MACHINE_MODE_REAL_16,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -114,10 +115,14 @@ typedef ZydisU8 ZydisAddressWidth;
|
||||||
*/
|
*/
|
||||||
enum ZydisAddressWidths
|
enum ZydisAddressWidths
|
||||||
{
|
{
|
||||||
ZYDIS_ADDRESS_WIDTH_INVALID = 0,
|
ZYDIS_ADDRESS_WIDTH_INVALID = 0, // TODO: Don't manually initialize values
|
||||||
ZYDIS_ADDRESS_WIDTH_16 = 16,
|
ZYDIS_ADDRESS_WIDTH_16 = 16,
|
||||||
ZYDIS_ADDRESS_WIDTH_32 = 32,
|
ZYDIS_ADDRESS_WIDTH_32 = 32,
|
||||||
ZYDIS_ADDRESS_WIDTH_64 = 64,
|
ZYDIS_ADDRESS_WIDTH_64 = 64,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_ADDRESS_WIDTH_MAX_VALUE = ZYDIS_ADDRESS_WIDTH_64
|
ZYDIS_ADDRESS_WIDTH_MAX_VALUE = ZYDIS_ADDRESS_WIDTH_64
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -144,6 +149,10 @@ enum ZydisElementTypes
|
||||||
ZYDIS_ELEMENT_TYPE_FLOAT64,
|
ZYDIS_ELEMENT_TYPE_FLOAT64,
|
||||||
ZYDIS_ELEMENT_TYPE_FLOAT80,
|
ZYDIS_ELEMENT_TYPE_FLOAT80,
|
||||||
ZYDIS_ELEMENT_TYPE_LONGBCD,
|
ZYDIS_ELEMENT_TYPE_LONGBCD,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_ELEMENT_TYPE_MAX_VALUE = ZYDIS_ELEMENT_TYPE_LONGBCD
|
ZYDIS_ELEMENT_TYPE_MAX_VALUE = ZYDIS_ELEMENT_TYPE_LONGBCD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -186,6 +195,7 @@ enum ZydisOperandTypes
|
||||||
* @brief The operand is an immediate operand.
|
* @brief The operand is an immediate operand.
|
||||||
*/
|
*/
|
||||||
ZYDIS_OPERAND_TYPE_IMMEDIATE,
|
ZYDIS_OPERAND_TYPE_IMMEDIATE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -241,6 +251,10 @@ enum ZydisOperandEncodings
|
||||||
ZYDIS_OPERAND_ENCODING_JIMM16_32_64,
|
ZYDIS_OPERAND_ENCODING_JIMM16_32_64,
|
||||||
ZYDIS_OPERAND_ENCODING_JIMM32_32_64,
|
ZYDIS_OPERAND_ENCODING_JIMM32_32_64,
|
||||||
ZYDIS_OPERAND_ENCODING_JIMM16_32_32,
|
ZYDIS_OPERAND_ENCODING_JIMM16_32_32,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
ZYDIS_OPERAND_ENCODING_MAX_VALUE = ZYDIS_OPERAND_ENCODING_JIMM16_32_32
|
ZYDIS_OPERAND_ENCODING_MAX_VALUE = ZYDIS_OPERAND_ENCODING_JIMM16_32_32
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -260,7 +274,7 @@ enum ZydisOperandVisibilities
|
||||||
{
|
{
|
||||||
ZYDIS_OPERAND_VISIBILITY_INVALID,
|
ZYDIS_OPERAND_VISIBILITY_INVALID,
|
||||||
/**
|
/**
|
||||||
* @brief The operand is explicitly encoded in the instruction.
|
* @brief The operand is explicitly encoded in the instruction.
|
||||||
*/
|
*/
|
||||||
ZYDIS_OPERAND_VISIBILITY_EXPLICIT,
|
ZYDIS_OPERAND_VISIBILITY_EXPLICIT,
|
||||||
/**
|
/**
|
||||||
|
@ -271,6 +285,7 @@ enum ZydisOperandVisibilities
|
||||||
* @brief The operand is part of the opcode, and not typically listed as an operand.
|
* @brief The operand is part of the opcode, and not typically listed as an operand.
|
||||||
*/
|
*/
|
||||||
ZYDIS_OPERAND_VISIBILITY_HIDDEN,
|
ZYDIS_OPERAND_VISIBILITY_HIDDEN,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -325,13 +340,13 @@ enum ZydisOperandActions
|
||||||
* @brief Mask combining all writing access flags.
|
* @brief Mask combining all writing access flags.
|
||||||
*/
|
*/
|
||||||
ZYDIS_OPERAND_ACTION_MASK_WRITE = ZYDIS_OPERAND_ACTION_WRITE |
|
ZYDIS_OPERAND_ACTION_MASK_WRITE = ZYDIS_OPERAND_ACTION_WRITE |
|
||||||
ZYDIS_OPERAND_ACTION_READWRITE | ZYDIS_OPERAND_ACTION_CONDWRITE |
|
ZYDIS_OPERAND_ACTION_READWRITE | ZYDIS_OPERAND_ACTION_CONDWRITE |
|
||||||
ZYDIS_OPERAND_ACTION_READ_CONDWRITE | ZYDIS_OPERAND_ACTION_CONDREAD_WRITE,
|
ZYDIS_OPERAND_ACTION_READ_CONDWRITE | ZYDIS_OPERAND_ACTION_CONDREAD_WRITE,
|
||||||
/**
|
/**
|
||||||
* @brief Mask combining all reading access flags.
|
* @brief Mask combining all reading access flags.
|
||||||
*/
|
*/
|
||||||
ZYDIS_OPERAND_ACTION_MASK_READ = ZYDIS_OPERAND_ACTION_READ | ZYDIS_OPERAND_ACTION_READWRITE |
|
ZYDIS_OPERAND_ACTION_MASK_READ = ZYDIS_OPERAND_ACTION_READ | ZYDIS_OPERAND_ACTION_READWRITE |
|
||||||
ZYDIS_OPERAND_ACTION_CONDREAD | ZYDIS_OPERAND_ACTION_READ_CONDWRITE |
|
ZYDIS_OPERAND_ACTION_CONDREAD | ZYDIS_OPERAND_ACTION_READ_CONDWRITE |
|
||||||
ZYDIS_OPERAND_ACTION_CONDREAD_WRITE,
|
ZYDIS_OPERAND_ACTION_CONDREAD_WRITE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -379,6 +394,7 @@ enum ZydisInstructionEncodings
|
||||||
* @brief The instruction uses the MVEX-encoding.
|
* @brief The instruction uses the MVEX-encoding.
|
||||||
*/
|
*/
|
||||||
ZYDIS_INSTRUCTION_ENCODING_MVEX,
|
ZYDIS_INSTRUCTION_ENCODING_MVEX,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maximum value of this enum.
|
* @brief Maximum value of this enum.
|
||||||
*/
|
*/
|
||||||
|
@ -407,7 +423,11 @@ enum ZydisOpcodeMaps
|
||||||
ZYDIS_OPCODE_MAP_XOP8,
|
ZYDIS_OPCODE_MAP_XOP8,
|
||||||
ZYDIS_OPCODE_MAP_XOP9,
|
ZYDIS_OPCODE_MAP_XOP9,
|
||||||
ZYDIS_OPCODE_MAP_XOPA,
|
ZYDIS_OPCODE_MAP_XOPA,
|
||||||
ZYDIS_OPCODE_MAP_MAX_VALUE = ZYDIS_OPCODE_MAP_XOP9
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum value of this enum.
|
||||||
|
*/
|
||||||
|
ZYDIS_OPCODE_MAP_MAX_VALUE = ZYDIS_OPCODE_MAP_XOPA
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -78,7 +78,7 @@ enum ZydisStatusCodes
|
||||||
/* ------------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An attempt was made to read data from an input data-source that has no more data
|
* @brief An attempt was made to read data from an input data-source that has no more data
|
||||||
* available.
|
* available.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_NO_MORE_DATA,
|
ZYDIS_STATUS_NO_MORE_DATA,
|
||||||
|
@ -86,7 +86,7 @@ enum ZydisStatusCodes
|
||||||
* @brief An general error occured while decoding the current instruction. The instruction
|
* @brief An general error occured while decoding the current instruction. The instruction
|
||||||
* might be undefined.
|
* might be undefined.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_DECODING_ERROR,
|
ZYDIS_STATUS_DECODING_ERROR,
|
||||||
/**
|
/**
|
||||||
* @brief The instruction exceeded the maximum length of 15 bytes.
|
* @brief The instruction exceeded the maximum length of 15 bytes.
|
||||||
*/
|
*/
|
||||||
|
@ -97,35 +97,45 @@ enum ZydisStatusCodes
|
||||||
ZYDIS_STATUS_BAD_REGISTER,
|
ZYDIS_STATUS_BAD_REGISTER,
|
||||||
/**
|
/**
|
||||||
* @brief A lock-prefix (F0) was found while decoding an instruction that does not support
|
* @brief A lock-prefix (F0) was found while decoding an instruction that does not support
|
||||||
* locking.
|
* locking.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_ILLEGAL_LOCK,
|
ZYDIS_STATUS_ILLEGAL_LOCK,
|
||||||
/**
|
/**
|
||||||
* @brief A legacy-prefix (F2, F3, 66) was found while decoding a XOP/VEX/EVEX/MVEX
|
* @brief A legacy-prefix (F2, F3, 66) was found while decoding a XOP/VEX/EVEX/MVEX
|
||||||
* instruction.
|
* instruction.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_ILLEGAL_LEGACY_PFX,
|
ZYDIS_STATUS_ILLEGAL_LEGACY_PFX,
|
||||||
/**
|
/**
|
||||||
* @brief A rex-prefix was found while decoding a XOP/VEX/EVEX/MVEX instruction.
|
* @brief A rex-prefix was found while decoding a XOP/VEX/EVEX/MVEX instruction.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_ILLEGAL_REX,
|
ZYDIS_STATUS_ILLEGAL_REX,
|
||||||
/**
|
/**
|
||||||
* @brief An invalid opcode-map value was found while decoding a XOP/VEX/EVEX/MVEX-prefix.
|
* @brief An invalid opcode-map value was found while decoding a XOP/VEX/EVEX/MVEX-prefix.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_INVALID_MAP,
|
ZYDIS_STATUS_INVALID_MAP,
|
||||||
/**
|
/**
|
||||||
* @brief An error occured while decoding the EVEX-prefix.
|
* @brief An error occured while decoding the EVEX-prefix.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_MALFORMED_EVEX,
|
ZYDIS_STATUS_MALFORMED_EVEX,
|
||||||
/**
|
/**
|
||||||
* @brief An error occured while decoding the MVEX-prefix.
|
* @brief An error occured while decoding the MVEX-prefix.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_MALFORMED_MVEX, // TODO: Do we need this?
|
ZYDIS_STATUS_MALFORMED_MVEX, // TODO: Do we need this?
|
||||||
/**
|
/**
|
||||||
* @brief An invalid write-mask was specified for an EVEX/MVEX instruction.
|
* @brief An invalid write-mask was specified for an EVEX/MVEX instruction.
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_INVALID_MASK,
|
ZYDIS_STATUS_INVALID_MASK,
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------------------ */
|
||||||
|
/* Formatter */
|
||||||
|
/* ------------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returning this status code in operand-related custom formatter callbacks will cause
|
||||||
|
* the formatter to omit the operand.
|
||||||
|
*/
|
||||||
|
ZYDIS_STATUS_SKIP_OPERAND,
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------------ */
|
||||||
/* Encoder */
|
/* Encoder */
|
||||||
/* ------------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------------ */
|
||||||
|
@ -141,8 +151,8 @@ enum ZydisStatusCodes
|
||||||
*/
|
*/
|
||||||
ZYDIS_STATUS_USER = 0x10000000
|
ZYDIS_STATUS_USER = 0x10000000
|
||||||
|
|
||||||
// Max value entry intentionally omitted since users might
|
// Max value entry intentionally omitted since users might define custom error codes for
|
||||||
// define custom error codes for formatter hooks.
|
// formatter hooks.
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Zyan Disassembler Library (Zydis)
|
Zyan Disassembler Library (Zydis)
|
||||||
|
|
||||||
Original Author : Florian Bernd, Joel Höner
|
Original Author : Florian Bernd, Joel Hoener
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -42,12 +42,12 @@
|
||||||
/**
|
/**
|
||||||
* @brief Defines the `ZydisString` struct.
|
* @brief Defines the `ZydisString` struct.
|
||||||
*/
|
*/
|
||||||
typedef struct ZydisString_
|
typedef struct ZydisString_
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief The buffer that contains the actual string (0-termination is optional!).
|
* @brief The buffer that contains the actual string (0-termination is optional!).
|
||||||
*/
|
*/
|
||||||
char *buffer;
|
char* buffer;
|
||||||
/**
|
/**
|
||||||
* @brief The length of the string (without 0-termination).
|
* @brief The length of the string (without 0-termination).
|
||||||
*/
|
*/
|
||||||
|
@ -65,8 +65,8 @@ typedef struct ZydisString_
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines the `ZydisStaticString` struct.
|
* @brief Defines the `ZydisStaticString` struct.
|
||||||
*
|
*
|
||||||
* This more compact struct is mainly used for internal string-tables to save up some bytes.
|
* This more compact struct is mainly used for internal string-tables to save up some bytes.
|
||||||
*/
|
*/
|
||||||
typedef struct ZydisStaticString_
|
typedef struct ZydisStaticString_
|
||||||
|
@ -128,16 +128,16 @@ enum ZydisLetterCases
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a `ZydisString` struct from a static C-string.
|
* @brief Creates a `ZydisString` struct from a static C-string.
|
||||||
*
|
*
|
||||||
* @param string The C-string constant.
|
* @param string The C-string constant.
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_MAKE_STRING(string) \
|
#define ZYDIS_MAKE_STRING(string) \
|
||||||
{ (char*)string, sizeof(string) - 1, sizeof(string) - 1 }
|
{ (char*)string, sizeof(string) - 1, sizeof(string) - 1 }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a `ZydisStaticString` from a static C-string.
|
* @brief Creates a `ZydisStaticString` from a static C-string.
|
||||||
*
|
*
|
||||||
* @param string The C-string constant.
|
* @param string The C-string constant.
|
||||||
*/
|
*/
|
||||||
#define ZYDIS_MAKE_STATIC_STRING(string) \
|
#define ZYDIS_MAKE_STATIC_STRING(string) \
|
||||||
{ string, sizeof(string) - 1 }
|
{ string, sizeof(string) - 1 }
|
||||||
|
@ -154,51 +154,37 @@ enum ZydisLetterCases
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes a `ZydisString` struct with a C-string.
|
* @brief Initializes a `ZydisString` struct with a C-string.
|
||||||
*
|
*
|
||||||
* @param string The string to initialize.
|
* @param string The string to initialize.
|
||||||
* @param value The C-string constant.
|
* @param text The C-string constant.
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringInit(ZydisString* string, char* value)
|
ZYDIS_EXPORT ZydisStatus ZydisStringInit(ZydisString* string, char* text);
|
||||||
{
|
|
||||||
if (!string || !value)
|
|
||||||
{
|
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ZydisUSize length = ZydisStrLen(value);
|
|
||||||
string->buffer = value;
|
|
||||||
string->length = length;
|
|
||||||
string->capacity = length;
|
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Finalizes a `ZydisString` struct by adding a terminating zero byte.
|
* @brief Finalizes a `ZydisString` struct by adding a terminating zero byte.
|
||||||
*
|
*
|
||||||
* @param string The string to finalize.
|
* @param string The string to finalize.
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringFinalize(ZydisString* string)
|
ZYDIS_EXPORT ZydisStatus ZydisStringFinalize(ZydisString* string);
|
||||||
{
|
|
||||||
if (!string)
|
|
||||||
{
|
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
if (string->length >= string->capacity)
|
|
||||||
{
|
|
||||||
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
string->buffer[string->length] = 0;
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Appends a `ZydisString` to another `ZydisString`.
|
||||||
|
*
|
||||||
|
* @param string The string to append to.
|
||||||
|
* @param text The string to append.
|
||||||
|
*
|
||||||
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
|
* sufficient to append the given @c text.
|
||||||
|
*/
|
||||||
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppend(ZydisString* string, const ZydisString* text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Appends a `ZydisString` to another `ZydisString`, converting it to the specified
|
* @brief Appends a `ZydisString` to another `ZydisString`, converting it to the specified
|
||||||
* letter-case.
|
* letter-case.
|
||||||
|
@ -207,13 +193,25 @@ ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringFinalize(ZydisString* string
|
||||||
* @param text The string to append.
|
* @param text The string to append.
|
||||||
* @param letterCase The letter case to use.
|
* @param letterCase The letter case to use.
|
||||||
*
|
*
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
* sufficient to append the given @c text.
|
* sufficient to append the given @c text.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZydisStatus ZydisStringAppendEx(ZydisString* string, const ZydisString* text,
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendEx(ZydisString* string, const ZydisString* text,
|
||||||
ZydisLetterCase letterCase);
|
ZydisLetterCase letterCase);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Appends the given C-string to a `ZydisString`.
|
||||||
|
*
|
||||||
|
* @param string The string to append to.
|
||||||
|
* @param text The C-string to append.
|
||||||
|
*
|
||||||
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
|
* sufficient to append the given @c text.
|
||||||
|
*/
|
||||||
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendC(ZydisString* string, const char* text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Appends the given C-string to a `ZydisString`, converting it to the specified
|
* @brief Appends the given C-string to a `ZydisString`, converting it to the specified
|
||||||
* letter-case.
|
* letter-case.
|
||||||
|
@ -222,79 +220,12 @@ ZYDIS_NO_EXPORT ZydisStatus ZydisStringAppendEx(ZydisString* string, const Zydis
|
||||||
* @param text The C-string to append.
|
* @param text The C-string to append.
|
||||||
* @param letterCase The letter case to use.
|
* @param letterCase The letter case to use.
|
||||||
*
|
*
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
* sufficient to append the given @c text.
|
* sufficient to append the given @c text.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringAppendExC(ZydisString* string,
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendExC(ZydisString* string, const char* text,
|
||||||
const char* text, ZydisLetterCase letterCase)
|
ZydisLetterCase letterCase);
|
||||||
{
|
|
||||||
ZydisString other;
|
|
||||||
ZYDIS_CHECK(ZydisStringInit(&other, (char*)text));
|
|
||||||
|
|
||||||
return ZydisStringAppendEx(string, &other, letterCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Appends the given 'ZydisStaticString' to a `ZydisString`, converting it to the
|
|
||||||
* specified letter-case.
|
|
||||||
*
|
|
||||||
* @param string The string to append to.
|
|
||||||
* @param text The static-string to append.
|
|
||||||
* @param letterCase The letter case to use.
|
|
||||||
*
|
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
|
||||||
* sufficient to append the given @c text.
|
|
||||||
*/
|
|
||||||
ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringAppendExStatic(ZydisString* string,
|
|
||||||
const ZydisStaticString* text, ZydisLetterCase letterCase)
|
|
||||||
{
|
|
||||||
if (!text || !text->buffer)
|
|
||||||
{
|
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZydisString other;
|
|
||||||
other.buffer = (char*)text->buffer;
|
|
||||||
other.length = text->length;
|
|
||||||
|
|
||||||
return ZydisStringAppendEx(string, &other, letterCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Appends a `ZydisString` to another `ZydisString`.
|
|
||||||
*
|
|
||||||
* @param string The string to append to.
|
|
||||||
* @param text The string to append.
|
|
||||||
*
|
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
|
||||||
* sufficient to append the given @c text.
|
|
||||||
*/
|
|
||||||
ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringAppend(ZydisString* string,
|
|
||||||
const ZydisString* text)
|
|
||||||
{
|
|
||||||
return ZydisStringAppendEx(string, text, ZYDIS_LETTER_CASE_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Appends the given C-string to a `ZydisString`.
|
|
||||||
*
|
|
||||||
* @param string The string to append to.
|
|
||||||
* @param text The C-string to append.
|
|
||||||
*
|
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
|
||||||
* sufficient to append the given @c text.
|
|
||||||
*/
|
|
||||||
ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringAppendC(ZydisString* string, const char* text)
|
|
||||||
{
|
|
||||||
ZydisString other;
|
|
||||||
ZYDIS_CHECK(ZydisStringInit(&other, (char*)text));
|
|
||||||
|
|
||||||
return ZydisStringAppendEx(string, &other, ZYDIS_LETTER_CASE_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Appends the given 'ZydisStaticString' to a `ZydisString`.
|
* @brief Appends the given 'ZydisStaticString' to a `ZydisString`.
|
||||||
|
@ -302,113 +233,116 @@ ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringAppendC(ZydisString* string,
|
||||||
* @param string The string to append to.
|
* @param string The string to append to.
|
||||||
* @param text The static-string to append.
|
* @param text The static-string to append.
|
||||||
*
|
*
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
* sufficient to append the given @c text.
|
* sufficient to append the given @c text.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZYDIS_INLINE ZydisStatus ZydisStringAppendStatic(ZydisString* string,
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendStatic(ZydisString* string,
|
||||||
const ZydisStaticString* text, ZydisLetterCase letterCase)
|
const ZydisStaticString* text, ZydisLetterCase letterCase);
|
||||||
{
|
|
||||||
if (!text || !text->buffer)
|
|
||||||
{
|
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZydisString other;
|
/**
|
||||||
other.buffer = (char*)text->buffer;
|
* @brief Appends the given 'ZydisStaticString' to a `ZydisString`, converting it to the
|
||||||
other.length = text->length;
|
* specified letter-case.
|
||||||
|
*
|
||||||
return ZydisStringAppendEx(string, &other, letterCase);
|
* @param string The string to append to.
|
||||||
}
|
* @param text The static-string to append.
|
||||||
|
* @param letterCase The letter case to use.
|
||||||
|
*
|
||||||
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
|
* sufficient to append the given @c text.
|
||||||
|
*/
|
||||||
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendExStatic(ZydisString* string,
|
||||||
|
const ZydisStaticString* text, ZydisLetterCase letterCase);
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
/* Formatting */
|
/* Formatting */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Formats the given unsigned ordinal @c value to its decimal text-representation and
|
* @brief Formats the given unsigned ordinal @c value to its decimal text-representation and
|
||||||
* appends it to @c s.
|
* appends it to the @c string.
|
||||||
*
|
*
|
||||||
* @param string A pointer to the string.
|
* @param string A pointer to the string.
|
||||||
* @param value The value.
|
* @param value The value.
|
||||||
* @param paddingLength Padds the converted value with leading zeros, if the number of chars is
|
* @param paddingLength Padds the converted value with leading zeros, if the number of chars is
|
||||||
* less than the @c paddingLength.
|
* less than the @c paddingLength.
|
||||||
*
|
*
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
* sufficient to append the given @c value.
|
* sufficient to append the given @c value.
|
||||||
*
|
*
|
||||||
* The string-buffer pointer is increased by the number of chars written, if the call was
|
* The string-buffer pointer is increased by the number of chars written, if the call was
|
||||||
* successfull.
|
* successfull.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintDecU(ZydisString* string, ZydisU64 value,
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendDecU(ZydisString* string, ZydisU64 value,
|
||||||
ZydisU8 paddingLength);
|
ZydisU8 paddingLength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Formats the given signed ordinal @c value to its decimal text-representation and
|
* @brief Formats the given signed ordinal @c value to its decimal text-representation and
|
||||||
* appends it to @c s.
|
* appends it to the @c string.
|
||||||
*
|
*
|
||||||
* @param string A pointer to the string.
|
* @param string A pointer to the string.
|
||||||
* @param value The value.
|
* @param value The value.
|
||||||
* @param paddingLength Padds the converted value with leading zeros, if the number of chars is
|
* @param paddingLength Padds the converted value with leading zeros, if the number of chars is
|
||||||
* less than the @c paddingLength (the sign char is ignored).
|
* less than the @c paddingLength (the sign char is ignored).
|
||||||
*
|
*
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
* sufficient to append the given @c value.
|
* sufficient to append the given @c value.
|
||||||
*
|
*
|
||||||
* The string-buffer pointer is increased by the number of chars written, if the call was
|
* The string-buffer pointer is increased by the number of chars written, if the call was
|
||||||
* successfull.
|
* successfull.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintDecS(ZydisString* string, ZydisI64 value,
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendDecS(ZydisString* string, ZydisI64 value,
|
||||||
ZydisU8 paddingLength);
|
ZydisU8 paddingLength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Formats the given unsigned ordinal @c value to its hexadecimal text-representation and
|
* @brief Formats the given unsigned ordinal @c value to its hexadecimal text-representation and
|
||||||
* appends it to the @c buffer.
|
* appends it to the @c string.
|
||||||
*
|
*
|
||||||
* @param string A pointer to the string.
|
* @param string A pointer to the string.
|
||||||
* @param value The value.
|
* @param value The value.
|
||||||
* @param paddingLength Padds the converted value with leading zeros, if the number of chars is
|
* @param paddingLength Padds the converted value with leading zeros, if the number of chars is
|
||||||
* less than the @c paddingLength.
|
* less than the @c paddingLength.
|
||||||
* @param uppercase Set @c TRUE to print the hexadecimal value in uppercase letters instead
|
* @param uppercase Set @c TRUE to print the hexadecimal value in uppercase letters instead
|
||||||
* of lowercase ones.
|
* of lowercase ones.
|
||||||
* @param prefix The string to use as prefix or `NULL`, if not needed.
|
* @param prefix The string to use as prefix or `NULL`, if not needed.
|
||||||
* @param suffix The string to use as suffix or `NULL`, if not needed.
|
* @param suffix The string to use as suffix or `NULL`, if not needed.
|
||||||
*
|
*
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
* sufficient to append the given @c value.
|
* sufficient to append the given @c value.
|
||||||
*
|
*
|
||||||
* The string-buffer pointer is increased by the number of chars written, if the call was
|
* The string-buffer pointer is increased by the number of chars written, if the call was
|
||||||
* successfull.
|
* successfull.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintHexU(ZydisString* string, ZydisU64 value,
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendHexU(ZydisString* string, ZydisU64 value,
|
||||||
ZydisU8 paddingLength, ZydisBool uppercase, const ZydisString* prefix,
|
ZydisU8 paddingLength, ZydisBool uppercase, const ZydisString* prefix,
|
||||||
const ZydisString* suffix);
|
const ZydisString* suffix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Formats the given signed ordinal @c value to its hexadecimal text-representation and
|
* @brief Formats the given signed ordinal @c value to its hexadecimal text-representation and
|
||||||
* appends it to the @c buffer.
|
* appends it to the @c string.
|
||||||
*
|
*
|
||||||
* @param string A pointer to the string.
|
* @param string A pointer to the string.
|
||||||
* @param value The value.
|
* @param value The value.
|
||||||
* @param paddingLength Padds the converted value with leading zeros, if the number of chars is
|
* @param paddingLength Padds the converted value with leading zeros, if the number of chars is
|
||||||
* less than the @c paddingLength (the sign char is ignored).
|
* less than the @c paddingLength (the sign char is ignored).
|
||||||
* @param uppercase Set @c TRUE to print the hexadecimal value in uppercase letters instead
|
* @param uppercase Set @c TRUE to print the hexadecimal value in uppercase letters instead
|
||||||
* of lowercase ones.
|
* of lowercase ones.
|
||||||
* @param prefix The string to use as prefix or `NULL`, if not needed.
|
* @param prefix The string to use as prefix or `NULL`, if not needed.
|
||||||
* @param suffix The string to use as suffix or `NULL`, if not needed.
|
* @param suffix The string to use as suffix or `NULL`, if not needed.
|
||||||
*
|
*
|
||||||
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
* @return @c ZYDIS_STATUS_SUCCESS, if the function succeeded, or
|
||||||
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
* @c ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE, if the size of the buffer was not
|
||||||
* sufficient to append the given @c value.
|
* sufficient to append the given @c value.
|
||||||
*
|
*
|
||||||
* The string-buffer pointer is increased by the number of chars written, if the call was
|
* The string-buffer pointer is increased by the number of chars written, if the call was
|
||||||
* successfull.
|
* successfull.
|
||||||
*/
|
*/
|
||||||
ZYDIS_NO_EXPORT ZydisStatus ZydisPrintHexS(ZydisString* string, ZydisI64 value,
|
ZYDIS_EXPORT ZydisStatus ZydisStringAppendHexS(ZydisString* string, ZydisI64 value,
|
||||||
ZydisU8 paddingLength, ZydisBool uppercase, const ZydisString* prefix,
|
ZydisU8 paddingLength, ZydisBool uppercase, const ZydisString* prefix,
|
||||||
const ZydisString* suffix);
|
const ZydisString* suffix);
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -52,14 +52,14 @@ extern "C" {
|
||||||
* @param address A pointer to the memory that receives the absolute target-address.
|
* @param address A pointer to the memory that receives the absolute target-address.
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*
|
*
|
||||||
* You should use this function in the following cases:
|
* You should use this function in the following cases:
|
||||||
* - `IMM` operands with relative address (e.g. `JMP`, `CALL`, ...)
|
* - `IMM` operands with relative address (e.g. `JMP`, `CALL`, ...)
|
||||||
* - `MEM` operands with RIP/EIP-relative address (e.g. `MOV RAX, [RIP+0x12345678]`)
|
* - `MEM` operands with RIP/EIP-relative address (e.g. `MOV RAX, [RIP+0x12345678]`)
|
||||||
* - `MEM` operands with absolute address (e.g. `MOV RAX, [0x12345678]`)
|
* - `MEM` operands with absolute address (e.g. `MOV RAX, [0x12345678]`)
|
||||||
* - The displacement needs to get truncated and zero extended
|
* - The displacement needs to get truncated and zero extended
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
ZYDIS_EXPORT ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||||
const ZydisDecodedOperand* operand, ZydisU64* address);
|
const ZydisDecodedOperand* operand, ZydisU64* address);
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
@ -75,7 +75,7 @@ ZYDIS_EXPORT ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction*
|
||||||
*
|
*
|
||||||
* @return A zydis status code.
|
* @return A zydis status code.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT ZydisStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruction,
|
ZYDIS_EXPORT ZydisStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruction,
|
||||||
ZydisCPUFlagAction action, ZydisCPUFlagMask* flags);
|
ZydisCPUFlagAction action, ZydisCPUFlagMask* flags);
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
|
@ -33,13 +33,17 @@
|
||||||
#define ZYDIS_H
|
#define ZYDIS_H
|
||||||
|
|
||||||
#include <Zydis/CommonTypes.h>
|
#include <Zydis/CommonTypes.h>
|
||||||
|
#ifndef ZYDIS_DISABLE_DECODER
|
||||||
#include <Zydis/Decoder.h>
|
#include <Zydis/Decoder.h>
|
||||||
#include <Zydis/DecoderTypes.h>
|
#include <Zydis/DecoderTypes.h>
|
||||||
|
#endif
|
||||||
#include <Zydis/Defines.h>
|
#include <Zydis/Defines.h>
|
||||||
|
#ifndef ZYDIS_DISABLE_FORMATTER
|
||||||
#include <Zydis/Formatter.h>
|
#include <Zydis/Formatter.h>
|
||||||
|
#endif
|
||||||
#include <Zydis/MetaInfo.h>
|
#include <Zydis/MetaInfo.h>
|
||||||
#include <Zydis/Mnemonic.h>
|
#include <Zydis/Mnemonic.h>
|
||||||
#include <Zydis/Register.h>
|
#include <Zydis/Register.h>
|
||||||
#include <Zydis/SharedTypes.h>
|
#include <Zydis/SharedTypes.h>
|
||||||
#include <Zydis/Status.h>
|
#include <Zydis/Status.h>
|
||||||
#include <Zydis/String.h>
|
#include <Zydis/String.h>
|
||||||
|
@ -122,8 +126,8 @@ enum ZydisFeatures
|
||||||
* @brief Returns the zydis version.
|
* @brief Returns the zydis version.
|
||||||
*
|
*
|
||||||
* @return The zydis version.
|
* @return The zydis version.
|
||||||
*
|
*
|
||||||
* Use the macros provided in this file to extract the major, minor, patch and build part from the
|
* Use the macros provided in this file to extract the major, minor, patch and build part from the
|
||||||
* returned version value.
|
* returned version value.
|
||||||
*/
|
*/
|
||||||
ZYDIS_EXPORT ZydisU64 ZydisGetVersion(void);
|
ZYDIS_EXPORT ZydisU64 ZydisGetVersion(void);
|
||||||
|
|
1359
src/Decoder.c
1359
src/Decoder.c
File diff suppressed because it is too large
Load Diff
|
@ -36,29 +36,38 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all XOP-map filters.
|
* @brief Contains all XOP-map filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 0 = POP instruction (default encoding)
|
* 00 = POP instruction (default encoding)
|
||||||
* 1 = xop8
|
* 01 = XOP8
|
||||||
* 2 = xop9
|
* 02 = XOP9
|
||||||
* 3 = xopA
|
* 03 = XOPA
|
||||||
|
* 04 = 66_XOP8
|
||||||
|
* 05 = 66_XOP9
|
||||||
|
* 06 = 66_XOPA
|
||||||
|
* 07 = F3_XOP8
|
||||||
|
* 08 = F3_XOP9
|
||||||
|
* 09 = F3_XOPA
|
||||||
|
* 0A = F2_XOP8
|
||||||
|
* 0B = F2_XOP9
|
||||||
|
* 0C = F2_XOPA
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersXOP[][4];
|
extern const ZydisDecoderTreeNode filtersXOP[][13];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all VEX-map filters.
|
* @brief Contains all VEX-map filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 00 = LES or LDS instruction (default encoding)
|
* 00 = LES or LDS instruction (default encoding)
|
||||||
* 01 = VEX MAP0
|
* 01 = VEX MAP0
|
||||||
* 02 = 0F
|
* 02 = 0F
|
||||||
* 03 = 0F38
|
* 03 = 0F38
|
||||||
* 04 = 0F3A
|
* 04 = 0F3A
|
||||||
* 05 = 66
|
* 05 = 66
|
||||||
* 06 = 66_0F
|
* 06 = 66_0F
|
||||||
* 07 = 66_0F38
|
* 07 = 66_0F38
|
||||||
* 08 = 66_0F3A
|
* 08 = 66_0F3A
|
||||||
* 09 = F3
|
* 09 = F3
|
||||||
* 0A = F3_0F
|
* 0A = F3_0F
|
||||||
* 0B = F3_0F38
|
* 0B = F3_0F38
|
||||||
* 0C = F3_0F3A
|
* 0C = F3_0F3A
|
||||||
|
@ -71,34 +80,34 @@ extern const ZydisDecoderTreeNode filtersVEX[][17];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all EVEX/MVEX-map filters.
|
* @brief Contains all EVEX/MVEX-map filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 00 = BOUND instruction (default encoding)
|
* 00 = BOUND instruction (default encoding)
|
||||||
* 01 = EVEX MAP0
|
* 01 = EVEX MAP0
|
||||||
* 02 = EVEX 0F
|
* 02 = EVEX 0F
|
||||||
* 03 = EVEX 0F38
|
* 03 = EVEX 0F38
|
||||||
* 04 = EVEX 0F3A
|
* 04 = EVEX 0F3A
|
||||||
* 05 = EVEX 66
|
* 05 = EVEX 66
|
||||||
* 06 = EVEX 66_0F
|
* 06 = EVEX 66_0F
|
||||||
* 07 = EVEX 66_0F38
|
* 07 = EVEX 66_0F38
|
||||||
* 08 = EVEX 66_0F3A
|
* 08 = EVEX 66_0F3A
|
||||||
* 09 = EVEX F3
|
* 09 = EVEX F3
|
||||||
* 0A = EVEX F3_0F
|
* 0A = EVEX F3_0F
|
||||||
* 0B = EVEX F3_0F38
|
* 0B = EVEX F3_0F38
|
||||||
* 0C = EVEX F3_0F3A
|
* 0C = EVEX F3_0F3A
|
||||||
* 0D = EVEX EVEX F2
|
* 0D = EVEX EVEX F2
|
||||||
* 0E = EVEX F2_0F
|
* 0E = EVEX F2_0F
|
||||||
* 0F = EVEX
|
* 0F = EVEX
|
||||||
* 10 = EVEX F2_0F3A
|
* 10 = EVEX F2_0F3A
|
||||||
* 11 = MVEX MAP0
|
* 11 = MVEX MAP0
|
||||||
* 12 = MVEX 0F
|
* 12 = MVEX 0F
|
||||||
* 13 = MVEX 0F38
|
* 13 = MVEX 0F38
|
||||||
* 14 = MVEX 0F3A
|
* 14 = MVEX 0F3A
|
||||||
* 15 = MVEX 66
|
* 15 = MVEX 66
|
||||||
* 16 = MVEX 66_0F
|
* 16 = MVEX 66_0F
|
||||||
* 17 = MVEX 66_0F38
|
* 17 = MVEX 66_0F38
|
||||||
* 18 = MVEX 66_0F3A
|
* 18 = MVEX 66_0F3A
|
||||||
* 19 = MVEX F3
|
* 19 = MVEX F3
|
||||||
* 1A = MVEX F3_0F
|
* 1A = MVEX F3_0F
|
||||||
* 1B = MVEX F3_0F38
|
* 1B = MVEX F3_0F38
|
||||||
* 1C = MVEX F3_0F3A
|
* 1C = MVEX F3_0F3A
|
||||||
|
@ -111,14 +120,14 @@ extern const ZydisDecoderTreeNode filtersEMVEX[][33];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all opcode filters.
|
* @brief Contains all opcode filters.
|
||||||
*
|
*
|
||||||
* Indexed by the numeric value of the opcode.
|
* Indexed by the numeric value of the opcode.
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersOpcode[][256];
|
extern const ZydisDecoderTreeNode filtersOpcode[][256];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all instruction-mode filters.
|
* @brief Contains all instruction-mode filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 0 = 16 bit mode
|
* 0 = 16 bit mode
|
||||||
* 1 = 32 bit mode
|
* 1 = 32 bit mode
|
||||||
|
@ -128,7 +137,7 @@ extern const ZydisDecoderTreeNode filtersMode[][3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all compacted instruction-mode filters.
|
* @brief Contains all compacted instruction-mode filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 0 = 64 bit mode
|
* 0 = 64 bit mode
|
||||||
* 1 = not 64 bit mode
|
* 1 = not 64 bit mode
|
||||||
|
@ -137,14 +146,14 @@ extern const ZydisDecoderTreeNode filtersModeCompact[][2];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all ModRM.mod filters.
|
* @brief Contains all ModRM.mod filters.
|
||||||
*
|
*
|
||||||
* Indexed by the ordinal value of the ModRM.mod field.
|
* Indexed by the ordinal value of the ModRM.mod field.
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersModrmMod[][4];
|
extern const ZydisDecoderTreeNode filtersModrmMod[][4];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all compacted ModRM.mod filters.
|
* @brief Contains all compacted ModRM.mod filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 0 = [ModRM.mod == 11] = register
|
* 0 = [ModRM.mod == 11] = register
|
||||||
* 1 = [ModRM.mod == !11] = memory
|
* 1 = [ModRM.mod == !11] = memory
|
||||||
|
@ -153,70 +162,70 @@ extern const ZydisDecoderTreeNode filtersModrmModCompact[][2];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all ModRM.reg filters.
|
* @brief Contains all ModRM.reg filters.
|
||||||
*
|
*
|
||||||
* Indexed by the numeric value of the ModRM.reg field.
|
* Indexed by the numeric value of the ModRM.reg field.
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersModrmReg[][8];
|
extern const ZydisDecoderTreeNode filtersModrmReg[][8];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all ModRM.rm filters.
|
* @brief Contains all ModRM.rm filters.
|
||||||
*
|
*
|
||||||
* Indexed by the numeric value of the ModRM.rm field.
|
* Indexed by the numeric value of the ModRM.rm field.
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersModrmRm[][8];
|
extern const ZydisDecoderTreeNode filtersModrmRm[][8];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all mandatory-prefix switch tables.
|
* @brief Contains all mandatory-prefix switch tables.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 0 = ignored (prefixes are not interpreted as mandatory-prefix)
|
* 0 = ignored (prefixes are not interpreted as mandatory-prefix)
|
||||||
* 1 = none
|
* 1 = none
|
||||||
* 2 = 66
|
* 2 = 66
|
||||||
* 3 = F3
|
* 3 = F3
|
||||||
* 4 = F2
|
* 4 = F2
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersMandatoryPrefix[][5];
|
extern const ZydisDecoderTreeNode filtersMandatoryPrefix[][5];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all operand-size filters.
|
* @brief Contains all operand-size filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 0 = 16 bit
|
* 0 = 16 bit
|
||||||
* 1 = 32 bit
|
* 1 = 32 bit
|
||||||
* 2 = 64 bit
|
* 2 = 64 bit
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersOperandSize[][3];
|
extern const ZydisDecoderTreeNode filtersOperandSize[][3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all address-size filters.
|
* @brief Contains all address-size filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 0 = 16 bit
|
* 0 = 16 bit
|
||||||
* 1 = 32 bit
|
* 1 = 32 bit
|
||||||
* 2 = 64 bit
|
* 2 = 64 bit
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersAddressSize[][3];
|
extern const ZydisDecoderTreeNode filtersAddressSize[][3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all vector-length filters.
|
* @brief Contains all vector-length filters.
|
||||||
*
|
*
|
||||||
* Index values:
|
* Index values:
|
||||||
* 0 = 128 bit
|
* 0 = 128 bit
|
||||||
* 1 = 256 bit
|
* 1 = 256 bit
|
||||||
* 2 = 512 bit
|
* 2 = 512 bit
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersVectorLength[][3];
|
extern const ZydisDecoderTreeNode filtersVectorLength[][3];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all REX/VEX/EVEX.w filters.
|
* @brief Contains all REX/VEX/EVEX.w filters.
|
||||||
*
|
*
|
||||||
* Indexed by the numeric value of the REX/VEX/EVEX.w field.
|
* Indexed by the numeric value of the REX/VEX/EVEX.w field.
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersREXW[][2];
|
extern const ZydisDecoderTreeNode filtersREXW[][2];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Contains all REX/VEX/EVEX.B filters.
|
* @brief Contains all REX/VEX/EVEX.B filters.
|
||||||
*
|
*
|
||||||
* Indexed by the numeric value of the REX/VEX/EVEX.B field.
|
* Indexed by the numeric value of the REX/VEX/EVEX.B field.
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersREXB[][2];
|
extern const ZydisDecoderTreeNode filtersREXB[][2];
|
||||||
|
@ -224,7 +233,7 @@ extern const ZydisDecoderTreeNode filtersREXB[][2];
|
||||||
#ifndef ZYDIS_DISABLE_EVEX
|
#ifndef ZYDIS_DISABLE_EVEX
|
||||||
/**
|
/**
|
||||||
* @brief Contains all EVEX.b filters.
|
* @brief Contains all EVEX.b filters.
|
||||||
*
|
*
|
||||||
* Indexed by the numeric value of the EVEX.b field.
|
* Indexed by the numeric value of the EVEX.b field.
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersEVEXB[][2];
|
extern const ZydisDecoderTreeNode filtersEVEXB[][2];
|
||||||
|
@ -233,7 +242,7 @@ extern const ZydisDecoderTreeNode filtersEVEXB[][2];
|
||||||
#ifndef ZYDIS_DISABLE_MVEX
|
#ifndef ZYDIS_DISABLE_MVEX
|
||||||
/**
|
/**
|
||||||
* @brief Contains all MVEX.E filters.
|
* @brief Contains all MVEX.E filters.
|
||||||
*
|
*
|
||||||
* Indexed by the numeric value of the MVEX.E field.
|
* Indexed by the numeric value of the MVEX.E field.
|
||||||
*/
|
*/
|
||||||
extern const ZydisDecoderTreeNode filtersMVEXE[][2];
|
extern const ZydisDecoderTreeNode filtersMVEXE[][2];
|
||||||
|
@ -274,17 +283,17 @@ extern const ZydisDecoderTreeNode filtersMVEXE[][2];
|
||||||
|
|
||||||
const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode(void)
|
const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode(void)
|
||||||
{
|
{
|
||||||
static const ZydisDecoderTreeNode root = { ZYDIS_NODETYPE_FILTER_OPCODE, 0x0000 };
|
static const ZydisDecoderTreeNode root = { ZYDIS_NODETYPE_FILTER_OPCODE, 0x0000 };
|
||||||
return &root;
|
return &root;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(const ZydisDecoderTreeNode* parent,
|
const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(const ZydisDecoderTreeNode* parent,
|
||||||
ZydisU16 index)
|
ZydisU16 index)
|
||||||
{
|
{
|
||||||
switch (parent->type)
|
switch (parent->type)
|
||||||
{
|
{
|
||||||
case ZYDIS_NODETYPE_FILTER_XOP:
|
case ZYDIS_NODETYPE_FILTER_XOP:
|
||||||
ZYDIS_ASSERT(index < 4);
|
ZYDIS_ASSERT(index < 13);
|
||||||
return &filtersXOP[parent->value][index];
|
return &filtersXOP[parent->value][index];
|
||||||
case ZYDIS_NODETYPE_FILTER_VEX:
|
case ZYDIS_NODETYPE_FILTER_VEX:
|
||||||
ZYDIS_ASSERT(index < 17);
|
ZYDIS_ASSERT(index < 17);
|
||||||
|
@ -361,10 +370,10 @@ const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(const ZydisDecoderTreeN
|
||||||
return &filtersModeTZCNT[parent->value][index];
|
return &filtersModeTZCNT[parent->value][index];
|
||||||
default:
|
default:
|
||||||
ZYDIS_UNREACHABLE;
|
ZYDIS_UNREACHABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
|
void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
|
||||||
const ZydisInstructionEncodingInfo** info)
|
const ZydisInstructionEncodingInfo** info)
|
||||||
{
|
{
|
||||||
ZYDIS_ASSERT(node->type & ZYDIS_NODETYPE_DEFINITION_MASK);
|
ZYDIS_ASSERT(node->type & ZYDIS_NODETYPE_DEFINITION_MASK);
|
||||||
|
|
448
src/Formatter.c
448
src/Formatter.c
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Zyan Disassembler Library (Zydis)
|
Zyan Disassembler Library (Zydis)
|
||||||
|
|
||||||
Original Author : Florian Bernd, Joel Höner
|
Original Author : Florian Bernd, Joel Hoener
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
/* General */
|
/* General */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static ZydisStatus ZydisFormatInstruction(const ZydisFormatter* formatter, const
|
static ZydisStatus ZydisFormatInstruction(const ZydisFormatter* formatter, const
|
||||||
ZydisDecodedInstruction* instruction, ZydisString* string, void* userData)
|
ZydisDecodedInstruction* instruction, ZydisString* string, void* userData)
|
||||||
{
|
{
|
||||||
if (formatter->funcPreInstruction)
|
if (formatter->funcPreInstruction)
|
||||||
|
@ -60,7 +60,7 @@ static ZydisStatus ZydisFormatInstruction(const ZydisFormatter* formatter, const
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static ZydisStatus ZydisFormatInstrIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisFormatInstrIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, void* userData)
|
const ZydisDecodedInstruction* instruction, void* userData)
|
||||||
{
|
{
|
||||||
if (!formatter || !string || !instruction)
|
if (!formatter || !string || !instruction)
|
||||||
|
@ -71,6 +71,7 @@ static ZydisStatus ZydisFormatInstrIntel(const ZydisFormatter* formatter, ZydisS
|
||||||
ZYDIS_CHECK(formatter->funcPrintPrefixes(formatter, string, instruction, userData));
|
ZYDIS_CHECK(formatter->funcPrintPrefixes(formatter, string, instruction, userData));
|
||||||
ZYDIS_CHECK(formatter->funcPrintMnemonic(formatter, string, instruction, userData));
|
ZYDIS_CHECK(formatter->funcPrintMnemonic(formatter, string, instruction, userData));
|
||||||
|
|
||||||
|
const ZydisUSize strLenMnemonic = string->length;
|
||||||
for (ZydisU8 i = 0; i < instruction->operandCount; ++i)
|
for (ZydisU8 i = 0; i < instruction->operandCount; ++i)
|
||||||
{
|
{
|
||||||
if (instruction->operands[i].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN)
|
if (instruction->operands[i].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN)
|
||||||
|
@ -79,7 +80,7 @@ static ZydisStatus ZydisFormatInstrIntel(const ZydisFormatter* formatter, ZydisS
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZydisUSize strLenRestore = string->length;
|
const ZydisUSize strLenRestore = string->length;
|
||||||
if (i == 0)
|
if (string->length == strLenMnemonic)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, " "));
|
ZYDIS_CHECK(ZydisStringAppendC(string, " "));
|
||||||
} else
|
} else
|
||||||
|
@ -87,97 +88,124 @@ static ZydisStatus ZydisFormatInstrIntel(const ZydisFormatter* formatter, ZydisS
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, ", "));
|
ZYDIS_CHECK(ZydisStringAppendC(string, ", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formatter->funcPreOperand)
|
const ZydisUSize strLenPreOperand = string->length;
|
||||||
|
|
||||||
|
// Print embedded-mask registers as decorator instead of a regular operand
|
||||||
|
if ((i == 1) && (instruction->operands[i].type == ZYDIS_OPERAND_TYPE_REGISTER) &&
|
||||||
|
(instruction->operands[i].encoding == ZYDIS_OPERAND_ENCODING_MASK))
|
||||||
{
|
{
|
||||||
formatter->funcPreOperand(formatter, string, instruction, &instruction->operands[i],
|
goto SkipOperand;
|
||||||
userData);
|
}
|
||||||
|
|
||||||
|
ZydisStatus status;
|
||||||
|
if (formatter->funcPreOperand)
|
||||||
|
{
|
||||||
|
status = formatter->funcPreOperand(formatter, string, instruction,
|
||||||
|
&instruction->operands[i], userData);
|
||||||
|
if (status == ZYDIS_STATUS_SKIP_OPERAND)
|
||||||
|
{
|
||||||
|
goto SkipOperand;
|
||||||
|
}
|
||||||
|
if (status != ZYDIS_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZydisUSize strLenPreOperand = string->length;
|
|
||||||
switch (instruction->operands[i].type)
|
switch (instruction->operands[i].type)
|
||||||
{
|
{
|
||||||
case ZYDIS_OPERAND_TYPE_REGISTER:
|
case ZYDIS_OPERAND_TYPE_REGISTER:
|
||||||
ZYDIS_CHECK(formatter->funcFormatOperandReg(formatter, string, instruction,
|
status = formatter->funcFormatOperandReg(formatter, string, instruction,
|
||||||
&instruction->operands[i], userData));
|
&instruction->operands[i], userData);
|
||||||
break;
|
break;
|
||||||
case ZYDIS_OPERAND_TYPE_MEMORY:
|
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintMemSize(formatter, string, instruction,
|
status = formatter->funcFormatOperandMem(formatter, string, instruction,
|
||||||
&instruction->operands[i], userData));
|
&instruction->operands[i], userData);
|
||||||
const ZydisUSize strLenTemp = string->length;
|
|
||||||
ZYDIS_CHECK(formatter->funcFormatOperandMem(formatter, string, instruction,
|
|
||||||
&instruction->operands[i], userData));
|
|
||||||
if (strLenTemp == string->length)
|
|
||||||
{
|
|
||||||
string->length = strLenPreOperand;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ZYDIS_OPERAND_TYPE_POINTER:
|
case ZYDIS_OPERAND_TYPE_POINTER:
|
||||||
ZYDIS_CHECK(formatter->funcFormatOperandPtr(formatter, string, instruction,
|
status = formatter->funcFormatOperandPtr(formatter, string, instruction,
|
||||||
&instruction->operands[i], userData));
|
&instruction->operands[i], userData);
|
||||||
break;
|
break;
|
||||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||||
ZYDIS_CHECK(formatter->funcFormatOperandImm(formatter, string, instruction,
|
status = formatter->funcFormatOperandImm(formatter, string, instruction,
|
||||||
&instruction->operands[i], userData));
|
&instruction->operands[i], userData);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
if (status == ZYDIS_STATUS_SKIP_OPERAND)
|
||||||
|
{
|
||||||
|
goto SkipOperand;
|
||||||
|
}
|
||||||
|
if (status != ZYDIS_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formatter->funcPostOperand)
|
||||||
|
{
|
||||||
|
status = formatter->funcPostOperand(formatter, string, instruction,
|
||||||
|
&instruction->operands[i], userData);
|
||||||
|
if (status == ZYDIS_STATUS_SKIP_OPERAND)
|
||||||
|
{
|
||||||
|
goto SkipOperand;
|
||||||
|
}
|
||||||
|
if (status != ZYDIS_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (strLenPreOperand == string->length)
|
if (strLenPreOperand == string->length)
|
||||||
{
|
{
|
||||||
|
SkipOperand:
|
||||||
// Omit whole operand, if the string did not change during the formatting-callback
|
// Omit whole operand, if the string did not change during the formatting-callback
|
||||||
string->length = strLenRestore;
|
string->length = strLenRestore;
|
||||||
|
|
||||||
if (formatter->funcPostOperand)
|
if (formatter->funcPostOperand)
|
||||||
{
|
{
|
||||||
formatter->funcPostOperand(formatter, string, instruction,
|
formatter->funcPostOperand(formatter, string, instruction,
|
||||||
&instruction->operands[i], userData);
|
&instruction->operands[i], userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formatter->funcPostOperand)
|
|
||||||
{
|
|
||||||
formatter->funcPostOperand(formatter, string, instruction, &instruction->operands[i],
|
|
||||||
userData);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX) ||
|
if ((instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX) ||
|
||||||
(instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX))
|
(instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX))
|
||||||
{
|
{
|
||||||
if ((i == 0) &&
|
if ((i == 0) &&
|
||||||
(instruction->operands[i + 1].encoding == ZYDIS_OPERAND_ENCODING_MASK))
|
(instruction->operands[i + 1].encoding == ZYDIS_OPERAND_ENCODING_MASK))
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
||||||
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_MASK, userData));
|
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_MASK, userData));
|
||||||
}
|
}
|
||||||
if (instruction->operands[i].type == ZYDIS_OPERAND_TYPE_MEMORY)
|
if (instruction->operands[i].type == ZYDIS_OPERAND_TYPE_MEMORY)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
||||||
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_BC, userData));
|
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_BC, userData));
|
||||||
if (instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX)
|
if (instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
||||||
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_CONVERSION, userData));
|
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_CONVERSION, userData));
|
||||||
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
||||||
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_EH, userData));
|
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_EH, userData));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if ((i == (instruction->operandCount - 1)) ||
|
if ((i == (instruction->operandCount - 1)) ||
|
||||||
(instruction->operands[i + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE))
|
(instruction->operands[i + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE))
|
||||||
{
|
{
|
||||||
if (instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX)
|
if (instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
||||||
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_SWIZZLE, userData));
|
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_SWIZZLE, userData));
|
||||||
}
|
}
|
||||||
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
||||||
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_RC, userData));
|
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_RC, userData));
|
||||||
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
ZYDIS_CHECK(formatter->funcPrintDecorator(formatter, string, instruction,
|
||||||
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_SAE, userData));
|
&instruction->operands[i], ZYDIS_DECORATOR_TYPE_SAE, userData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +215,7 @@ static ZydisStatus ZydisFormatInstrIntel(const ZydisFormatter* formatter, ZydisS
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisFormatOperandRegIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisFormatOperandRegIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
||||||
{
|
{
|
||||||
if (!operand)
|
if (!operand)
|
||||||
|
@ -195,17 +223,11 @@ static ZydisStatus ZydisFormatOperandRegIntel(const ZydisFormatter* formatter, Z
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to print embedded-mask registers as decorator instead of a regular operand
|
return formatter->funcPrintRegister(formatter, string, instruction, operand,
|
||||||
if ((operand->id == 1) && (operand->encoding == ZYDIS_OPERAND_ENCODING_MASK))
|
|
||||||
{
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatter->funcPrintRegister(formatter, string, instruction, operand,
|
|
||||||
operand->reg.value, userData);
|
operand->reg.value, userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisFormatOperandMemIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisFormatOperandMemIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
||||||
{
|
{
|
||||||
if (!formatter || !instruction || !operand)
|
if (!formatter || !instruction || !operand)
|
||||||
|
@ -213,29 +235,32 @@ static ZydisStatus ZydisFormatOperandMemIntel(const ZydisFormatter* formatter, Z
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZYDIS_CHECK(formatter->funcPrintMemSize(formatter, string, instruction, operand, userData));
|
||||||
|
|
||||||
switch (operand->mem.segment)
|
switch (operand->mem.segment)
|
||||||
{
|
{
|
||||||
case ZYDIS_REGISTER_ES:
|
case ZYDIS_REGISTER_ES:
|
||||||
case ZYDIS_REGISTER_CS:
|
case ZYDIS_REGISTER_CS:
|
||||||
case ZYDIS_REGISTER_FS:
|
case ZYDIS_REGISTER_FS:
|
||||||
case ZYDIS_REGISTER_GS:
|
case ZYDIS_REGISTER_GS:
|
||||||
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
||||||
operand->mem.segment, userData));
|
operand->mem.segment, userData));
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, ":"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, ":"));
|
||||||
|
break;
|
||||||
case ZYDIS_REGISTER_SS:
|
case ZYDIS_REGISTER_SS:
|
||||||
if ((formatter->forceMemorySegment) ||
|
if ((formatter->forceMemorySegment) ||
|
||||||
(instruction->attributes & ZYDIS_ATTRIB_HAS_SEGMENT_SS))
|
(instruction->attributes & ZYDIS_ATTRIB_HAS_SEGMENT_SS))
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
||||||
operand->mem.segment, userData));
|
operand->mem.segment, userData));
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, ":"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, ":"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ZYDIS_REGISTER_DS:
|
case ZYDIS_REGISTER_DS:
|
||||||
if ((formatter->forceMemorySegment) ||
|
if ((formatter->forceMemorySegment) ||
|
||||||
(instruction->attributes & ZYDIS_ATTRIB_HAS_SEGMENT_DS))
|
(instruction->attributes & ZYDIS_ATTRIB_HAS_SEGMENT_DS))
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
||||||
operand->mem.segment, userData));
|
operand->mem.segment, userData));
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, ":"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, ":"));
|
||||||
}
|
}
|
||||||
|
@ -245,10 +270,10 @@ static ZydisStatus ZydisFormatOperandMemIntel(const ZydisFormatter* formatter, Z
|
||||||
}
|
}
|
||||||
|
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, "["));
|
ZYDIS_CHECK(ZydisStringAppendC(string, "["));
|
||||||
|
|
||||||
if (operand->mem.disp.hasDisplacement && (
|
if (operand->mem.disp.hasDisplacement && (
|
||||||
(operand->mem.base == ZYDIS_REGISTER_NONE) ||
|
(operand->mem.base == ZYDIS_REGISTER_NONE) ||
|
||||||
(operand->mem.base == ZYDIS_REGISTER_EIP) ||
|
(operand->mem.base == ZYDIS_REGISTER_EIP) ||
|
||||||
(operand->mem.base == ZYDIS_REGISTER_RIP)) &&
|
(operand->mem.base == ZYDIS_REGISTER_RIP)) &&
|
||||||
(operand->mem.index == ZYDIS_REGISTER_NONE) && (operand->mem.scale == 0))
|
(operand->mem.index == ZYDIS_REGISTER_NONE) && (operand->mem.scale == 0))
|
||||||
{
|
{
|
||||||
|
@ -258,45 +283,45 @@ static ZydisStatus ZydisFormatOperandMemIntel(const ZydisFormatter* formatter, Z
|
||||||
{
|
{
|
||||||
ZydisU64 address;
|
ZydisU64 address;
|
||||||
ZYDIS_CHECK(ZydisCalcAbsoluteAddress(instruction, operand, &address));
|
ZYDIS_CHECK(ZydisCalcAbsoluteAddress(instruction, operand, &address));
|
||||||
ZYDIS_CHECK(formatter->funcPrintAddress(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintAddress(formatter, string, instruction, operand,
|
||||||
address, userData));
|
address, userData));
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
||||||
operand->mem.base, userData));
|
operand->mem.base, userData));
|
||||||
ZYDIS_CHECK(formatter->funcPrintDisp(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintDisp(formatter, string, instruction, operand,
|
||||||
userData));
|
userData));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// Regular memory operand
|
// Regular memory operand
|
||||||
if (operand->mem.base != ZYDIS_REGISTER_NONE)
|
if (operand->mem.base != ZYDIS_REGISTER_NONE)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
||||||
operand->mem.base, userData));
|
operand->mem.base, userData));
|
||||||
}
|
}
|
||||||
if ((operand->mem.index != ZYDIS_REGISTER_NONE) &&
|
if ((operand->mem.index != ZYDIS_REGISTER_NONE) &&
|
||||||
(operand->mem.type != ZYDIS_MEMOP_TYPE_MIB))
|
(operand->mem.type != ZYDIS_MEMOP_TYPE_MIB))
|
||||||
{
|
{
|
||||||
if (operand->mem.base != ZYDIS_REGISTER_NONE)
|
if (operand->mem.base != ZYDIS_REGISTER_NONE)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, "+"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, "+"));
|
||||||
}
|
}
|
||||||
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
||||||
operand->mem.index, userData));
|
operand->mem.index, userData));
|
||||||
if (operand->mem.scale)
|
if (operand->mem.scale)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, "*"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, "*"));
|
||||||
ZYDIS_CHECK(ZydisPrintDecU(string, operand->mem.scale, 0));
|
ZYDIS_CHECK(ZydisStringAppendDecU(string, operand->mem.scale, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ZYDIS_CHECK(formatter->funcPrintDisp(formatter, string, instruction, operand, userData));
|
ZYDIS_CHECK(formatter->funcPrintDisp(formatter, string, instruction, operand, userData));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZydisStringAppendC(string, "]");
|
return ZydisStringAppendC(string, "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisFormatOperandPtrIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisFormatOperandPtrIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
||||||
{
|
{
|
||||||
ZYDIS_UNUSED_PARAMETER(instruction);
|
ZYDIS_UNUSED_PARAMETER(instruction);
|
||||||
|
@ -307,14 +332,14 @@ static ZydisStatus ZydisFormatOperandPtrIntel(const ZydisFormatter* formatter, Z
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZYDIS_CHECK(ZydisPrintHexU(string, operand->ptr.segment, 4,
|
ZYDIS_CHECK(ZydisStringAppendHexU(string, operand->ptr.segment, 4,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix));
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix));
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, ":"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, ":"));
|
||||||
return ZydisPrintHexU(string, operand->ptr.offset, 8,
|
return ZydisStringAppendHexU(string, operand->ptr.offset, 8,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisFormatOperandImmIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisFormatOperandImmIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
||||||
{
|
{
|
||||||
if (!formatter || !instruction || !operand)
|
if (!formatter || !instruction || !operand)
|
||||||
|
@ -332,7 +357,7 @@ static ZydisStatus ZydisFormatOperandImmIntel(const ZydisFormatter* formatter, Z
|
||||||
{
|
{
|
||||||
ZydisU64 address;
|
ZydisU64 address;
|
||||||
ZYDIS_CHECK(ZydisCalcAbsoluteAddress(instruction, operand, &address));
|
ZYDIS_CHECK(ZydisCalcAbsoluteAddress(instruction, operand, &address));
|
||||||
return formatter->funcPrintAddress(formatter, string, instruction, operand, address,
|
return formatter->funcPrintAddress(formatter, string, instruction, operand, address,
|
||||||
userData);
|
userData);
|
||||||
}
|
}
|
||||||
case ZYDIS_ADDR_FORMAT_RELATIVE_SIGNED:
|
case ZYDIS_ADDR_FORMAT_RELATIVE_SIGNED:
|
||||||
|
@ -343,15 +368,15 @@ static ZydisStatus ZydisFormatOperandImmIntel(const ZydisFormatter* formatter, Z
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (printSignedHEX)
|
if (printSignedHEX)
|
||||||
{
|
{
|
||||||
return ZydisPrintHexS(string, (ZydisI32)operand->imm.value.s,
|
return ZydisStringAppendHexS(string, (ZydisI32)operand->imm.value.s,
|
||||||
formatter->hexPaddingAddress, formatter->hexUppercase, formatter->hexPrefix,
|
formatter->hexPaddingAddress, formatter->hexUppercase, formatter->hexPrefix,
|
||||||
formatter->hexSuffix);
|
formatter->hexSuffix);
|
||||||
}
|
}
|
||||||
return ZydisPrintHexU(string, operand->imm.value.u,
|
return ZydisStringAppendHexU(string, operand->imm.value.u,
|
||||||
formatter->hexPaddingAddress, formatter->hexUppercase, formatter->hexPrefix,
|
formatter->hexPaddingAddress, formatter->hexUppercase, formatter->hexPrefix,
|
||||||
formatter->hexSuffix);
|
formatter->hexSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +386,7 @@ static ZydisStatus ZydisFormatOperandImmIntel(const ZydisFormatter* formatter, Z
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static ZydisStatus ZydisPrintMnemonicIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisPrintMnemonicIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, void* userData)
|
const ZydisDecodedInstruction* instruction, void* userData)
|
||||||
{
|
{
|
||||||
ZYDIS_UNUSED_PARAMETER(userData);
|
ZYDIS_UNUSED_PARAMETER(userData);
|
||||||
|
@ -377,7 +402,7 @@ static ZydisStatus ZydisPrintMnemonicIntel(const ZydisFormatter* formatter, Zydi
|
||||||
return ZydisStringAppendExC(string, "invalid", formatter->letterCase);
|
return ZydisStringAppendExC(string, "invalid", formatter->letterCase);
|
||||||
}
|
}
|
||||||
ZYDIS_CHECK(ZydisStringAppendExStatic(string, mnemonic, formatter->letterCase));
|
ZYDIS_CHECK(ZydisStringAppendExStatic(string, mnemonic, formatter->letterCase));
|
||||||
|
|
||||||
if (instruction->attributes & ZYDIS_ATTRIB_IS_FAR_BRANCH)
|
if (instruction->attributes & ZYDIS_ATTRIB_IS_FAR_BRANCH)
|
||||||
{
|
{
|
||||||
return ZydisStringAppendExC(string, " far", formatter->letterCase);
|
return ZydisStringAppendExC(string, " far", formatter->letterCase);
|
||||||
|
@ -386,8 +411,8 @@ static ZydisStatus ZydisPrintMnemonicIntel(const ZydisFormatter* formatter, Zydi
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisPrintRegisterIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisPrintRegisterIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
|
||||||
ZydisRegister reg, void* userData)
|
ZydisRegister reg, void* userData)
|
||||||
{
|
{
|
||||||
ZYDIS_UNUSED_PARAMETER(instruction);
|
ZYDIS_UNUSED_PARAMETER(instruction);
|
||||||
|
@ -407,8 +432,8 @@ static ZydisStatus ZydisPrintRegisterIntel(const ZydisFormatter* formatter, Zydi
|
||||||
return ZydisStringAppendExStatic(string, str, formatter->letterCase);
|
return ZydisStringAppendExStatic(string, str, formatter->letterCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisPrintAddrIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisPrintAddrIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
|
||||||
ZydisU64 address, void* userData)
|
ZydisU64 address, void* userData)
|
||||||
{
|
{
|
||||||
ZYDIS_UNUSED_PARAMETER(operand);
|
ZYDIS_UNUSED_PARAMETER(operand);
|
||||||
|
@ -422,20 +447,20 @@ static ZydisStatus ZydisPrintAddrIntel(const ZydisFormatter* formatter, ZydisStr
|
||||||
switch (instruction->stackWidth)
|
switch (instruction->stackWidth)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
return ZydisPrintHexU(string, (ZydisU16)address, 4,
|
return ZydisStringAppendHexU(string, (ZydisU16)address, 4,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
case 32:
|
case 32:
|
||||||
return ZydisPrintHexU(string, (ZydisU32)address, 8,
|
return ZydisStringAppendHexU(string, (ZydisU32)address, 8,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
case 64:
|
case 64:
|
||||||
return ZydisPrintHexU(string, address, 16,
|
return ZydisStringAppendHexU(string, address, 16,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisPrintDispIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisPrintDispIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
||||||
{
|
{
|
||||||
ZYDIS_UNUSED_PARAMETER(instruction);
|
ZYDIS_UNUSED_PARAMETER(instruction);
|
||||||
|
@ -446,30 +471,31 @@ static ZydisStatus ZydisPrintDispIntel(const ZydisFormatter* formatter, ZydisStr
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operand->mem.disp.hasDisplacement && ((operand->mem.disp.value) ||
|
if (operand->mem.disp.hasDisplacement && ((operand->mem.disp.value) ||
|
||||||
((operand->mem.base == ZYDIS_REGISTER_NONE) &&
|
((operand->mem.base == ZYDIS_REGISTER_NONE) &&
|
||||||
(operand->mem.index == ZYDIS_REGISTER_NONE))))
|
(operand->mem.index == ZYDIS_REGISTER_NONE))))
|
||||||
{
|
{
|
||||||
const ZydisBool printSignedHEX = (formatter->formatDisp != ZYDIS_DISP_FORMAT_HEX_UNSIGNED);
|
const ZydisBool printSignedHEX = (formatter->formatDisp != ZYDIS_DISP_FORMAT_HEX_UNSIGNED);
|
||||||
if (printSignedHEX && (operand->mem.disp.value < 0) && (
|
if (printSignedHEX && (operand->mem.disp.value < 0) && (
|
||||||
(operand->mem.base != ZYDIS_REGISTER_NONE) ||
|
(operand->mem.base != ZYDIS_REGISTER_NONE) ||
|
||||||
(operand->mem.index != ZYDIS_REGISTER_NONE)))
|
(operand->mem.index != ZYDIS_REGISTER_NONE)))
|
||||||
{
|
{
|
||||||
return ZydisPrintHexS(string, operand->mem.disp.value, formatter->hexPaddingDisp,
|
return ZydisStringAppendHexS(string, operand->mem.disp.value, formatter->hexPaddingDisp,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
}
|
}
|
||||||
if ((operand->mem.base != ZYDIS_REGISTER_NONE) ||
|
if ((operand->mem.base != ZYDIS_REGISTER_NONE) ||
|
||||||
(operand->mem.index != ZYDIS_REGISTER_NONE))
|
(operand->mem.index != ZYDIS_REGISTER_NONE))
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, "+"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, "+"));
|
||||||
}
|
}
|
||||||
return ZydisPrintHexU(string, (ZydisU64)operand->mem.disp.value, formatter->hexPaddingDisp,
|
return ZydisStringAppendHexU(string, (ZydisU64)operand->mem.disp.value,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexPaddingDisp, formatter->hexUppercase, formatter->hexPrefix,
|
||||||
|
formatter->hexSuffix);
|
||||||
}
|
}
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisPrintImmIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisPrintImmIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
||||||
{
|
{
|
||||||
ZYDIS_UNUSED_PARAMETER(userData);
|
ZYDIS_UNUSED_PARAMETER(userData);
|
||||||
|
@ -482,7 +508,7 @@ static ZydisStatus ZydisPrintImmIntel(const ZydisFormatter* formatter, ZydisStri
|
||||||
ZydisBool printSignedHEX = (formatter->formatImm == ZYDIS_IMM_FORMAT_HEX_SIGNED);
|
ZydisBool printSignedHEX = (formatter->formatImm == ZYDIS_IMM_FORMAT_HEX_SIGNED);
|
||||||
if (formatter->formatImm == ZYDIS_IMM_FORMAT_HEX_AUTO)
|
if (formatter->formatImm == ZYDIS_IMM_FORMAT_HEX_AUTO)
|
||||||
{
|
{
|
||||||
printSignedHEX = operand->imm.isSigned;
|
printSignedHEX = operand->imm.isSigned;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (printSignedHEX && (operand->imm.value.s < 0))
|
if (printSignedHEX && (operand->imm.value.s < 0))
|
||||||
|
@ -490,41 +516,44 @@ static ZydisStatus ZydisPrintImmIntel(const ZydisFormatter* formatter, ZydisStri
|
||||||
switch (operand->size)
|
switch (operand->size)
|
||||||
{
|
{
|
||||||
case 8:
|
case 8:
|
||||||
return ZydisPrintHexS(string, (ZydisI8)operand->imm.value.s, formatter->formatImm,
|
return ZydisStringAppendHexS(string, (ZydisI8)operand->imm.value.s,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->formatImm, formatter->hexUppercase, formatter->hexPrefix,
|
||||||
|
formatter->hexSuffix);
|
||||||
case 16:
|
case 16:
|
||||||
return ZydisPrintHexS(string, (ZydisI16)operand->imm.value.s, formatter->formatImm,
|
return ZydisStringAppendHexS(string, (ZydisI16)operand->imm.value.s,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->formatImm, formatter->hexUppercase, formatter->hexPrefix,
|
||||||
|
formatter->hexSuffix);
|
||||||
case 32:
|
case 32:
|
||||||
return ZydisPrintHexS(string, (ZydisI32)operand->imm.value.s, formatter->formatImm,
|
return ZydisStringAppendHexS(string, (ZydisI32)operand->imm.value.s,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->formatImm, formatter->hexUppercase, formatter->hexPrefix,
|
||||||
|
formatter->hexSuffix);
|
||||||
case 64:
|
case 64:
|
||||||
return ZydisPrintHexS(string, operand->imm.value.s, formatter->formatImm,
|
return ZydisStringAppendHexS(string, operand->imm.value.s, formatter->formatImm,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (instruction->operandWidth)
|
switch (instruction->operandWidth)
|
||||||
{
|
{
|
||||||
case 8:
|
case 8:
|
||||||
return ZydisPrintHexU(string, (ZydisU8)operand->imm.value.u, formatter->formatImm,
|
return ZydisStringAppendHexU(string, (ZydisU8)operand->imm.value.u, formatter->formatImm,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
case 16:
|
case 16:
|
||||||
return ZydisPrintHexU(string, (ZydisU16)operand->imm.value.u, formatter->formatImm,
|
return ZydisStringAppendHexU(string, (ZydisU16)operand->imm.value.u, formatter->formatImm,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
case 32:
|
case 32:
|
||||||
return ZydisPrintHexU(string, (ZydisU32)operand->imm.value.u, formatter->formatImm,
|
return ZydisStringAppendHexU(string, (ZydisU32)operand->imm.value.u, formatter->formatImm,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
case 64:
|
case 64:
|
||||||
return ZydisPrintHexU(string, operand->imm.value.u, formatter->formatImm,
|
return ZydisStringAppendHexU(string, operand->imm.value.u, formatter->formatImm,
|
||||||
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
formatter->hexUppercase, formatter->hexPrefix, formatter->hexSuffix);
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisPrintMemSizeIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisPrintMemSizeIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand, void* userData)
|
||||||
{
|
{
|
||||||
ZYDIS_UNUSED_PARAMETER(userData);
|
ZYDIS_UNUSED_PARAMETER(userData);
|
||||||
|
@ -539,25 +568,25 @@ static ZydisStatus ZydisPrintMemSizeIntel(const ZydisFormatter* formatter, Zydis
|
||||||
ZydisU32 typecast = 0;
|
ZydisU32 typecast = 0;
|
||||||
if (formatter->forceMemorySize)
|
if (formatter->forceMemorySize)
|
||||||
{
|
{
|
||||||
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
|
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
|
||||||
(operand->mem.type == ZYDIS_MEMOP_TYPE_MEM))
|
(operand->mem.type == ZYDIS_MEMOP_TYPE_MEM))
|
||||||
{
|
{
|
||||||
typecast = instruction->operands[operand->id].size;
|
typecast = instruction->operands[operand->id].size;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
|
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
|
||||||
(operand->mem.type == ZYDIS_MEMOP_TYPE_MEM))
|
(operand->mem.type == ZYDIS_MEMOP_TYPE_MEM))
|
||||||
{
|
{
|
||||||
switch (operand->id)
|
switch (operand->id)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
typecast =
|
typecast =
|
||||||
((instruction->operands[1].type == ZYDIS_OPERAND_TYPE_UNUSED) ||
|
((instruction->operands[1].type == ZYDIS_OPERAND_TYPE_UNUSED) ||
|
||||||
(instruction->operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE) ||
|
(instruction->operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE) ||
|
||||||
(instruction->operands[0].size != instruction->operands[1].size)) ?
|
(instruction->operands[0].size != instruction->operands[1].size)) ?
|
||||||
instruction->operands[0].size : 0;
|
instruction->operands[0].size : 0;
|
||||||
if (!typecast &&
|
if (!typecast &&
|
||||||
(instruction->operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER) &&
|
(instruction->operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER) &&
|
||||||
(instruction->operands[1].reg.value == ZYDIS_REGISTER_CL))
|
(instruction->operands[1].reg.value == ZYDIS_REGISTER_CL))
|
||||||
{
|
{
|
||||||
switch (instruction->mnemonic)
|
switch (instruction->mnemonic)
|
||||||
|
@ -577,9 +606,9 @@ static ZydisStatus ZydisPrintMemSizeIntel(const ZydisFormatter* formatter, Zydis
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
typecast =
|
typecast =
|
||||||
(instruction->operands[operand->id - 1].size !=
|
(instruction->operands[operand->id - 1].size !=
|
||||||
instruction->operands[operand->id].size) ?
|
instruction->operands[operand->id].size) ?
|
||||||
instruction->operands[operand->id].size : 0;
|
instruction->operands[operand->id].size : 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -633,7 +662,7 @@ static ZydisStatus ZydisPrintMemSizeIntel(const ZydisFormatter* formatter, Zydis
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static ZydisStatus ZydisPrintPrefixesIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisPrintPrefixesIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, void* userData)
|
const ZydisDecodedInstruction* instruction, void* userData)
|
||||||
{
|
{
|
||||||
ZYDIS_UNUSED_PARAMETER(userData);
|
ZYDIS_UNUSED_PARAMETER(userData);
|
||||||
|
@ -659,8 +688,8 @@ static ZydisStatus ZydisPrintPrefixesIntel(const ZydisFormatter* formatter, Zydi
|
||||||
if (instruction->attributes & ZYDIS_ATTRIB_HAS_REPNE)
|
if (instruction->attributes & ZYDIS_ATTRIB_HAS_REPNE)
|
||||||
{
|
{
|
||||||
return ZydisStringAppendExC(string, "repne ", formatter->letterCase);
|
return ZydisStringAppendExC(string, "repne ", formatter->letterCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instruction->attributes & ZYDIS_ATTRIB_HAS_BOUND)
|
if (instruction->attributes & ZYDIS_ATTRIB_HAS_BOUND)
|
||||||
{
|
{
|
||||||
return ZydisStringAppendExC(string, "bnd ", formatter->letterCase);
|
return ZydisStringAppendExC(string, "bnd ", formatter->letterCase);
|
||||||
|
@ -669,17 +698,17 @@ static ZydisStatus ZydisPrintPrefixesIntel(const ZydisFormatter* formatter, Zydi
|
||||||
if (instruction->attributes & ZYDIS_ATTRIB_HAS_XACQUIRE)
|
if (instruction->attributes & ZYDIS_ATTRIB_HAS_XACQUIRE)
|
||||||
{
|
{
|
||||||
return ZydisStringAppendExC(string, "xacquire ", formatter->letterCase);
|
return ZydisStringAppendExC(string, "xacquire ", formatter->letterCase);
|
||||||
}
|
}
|
||||||
if (instruction->attributes & ZYDIS_ATTRIB_HAS_XRELEASE)
|
if (instruction->attributes & ZYDIS_ATTRIB_HAS_XRELEASE)
|
||||||
{
|
{
|
||||||
return ZydisStringAppendExC(string, "xrelease ", formatter->letterCase);
|
return ZydisStringAppendExC(string, "xrelease ", formatter->letterCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ZydisStatus ZydisPrintDecoratorIntel(const ZydisFormatter* formatter, ZydisString* string,
|
static ZydisStatus ZydisPrintDecoratorIntel(const ZydisFormatter* formatter, ZydisString* string,
|
||||||
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
|
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
|
||||||
ZydisDecoratorType type, void* userData)
|
ZydisDecoratorType type, void* userData)
|
||||||
{
|
{
|
||||||
if (!formatter || !instruction)
|
if (!formatter || !instruction)
|
||||||
|
@ -691,20 +720,23 @@ static ZydisStatus ZydisPrintDecoratorIntel(const ZydisFormatter* formatter, Zyd
|
||||||
{
|
{
|
||||||
case ZYDIS_DECORATOR_TYPE_MASK:
|
case ZYDIS_DECORATOR_TYPE_MASK:
|
||||||
{
|
{
|
||||||
|
#if !defined(ZYDIS_DISABLE_EVEX) || !defined(ZYDIS_DISABLE_MVEX)
|
||||||
if (instruction->avx.mask.reg != ZYDIS_REGISTER_K0)
|
if (instruction->avx.mask.reg != ZYDIS_REGISTER_K0)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, " {"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, " {"));
|
||||||
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
ZYDIS_CHECK(formatter->funcPrintRegister(formatter, string, instruction, operand,
|
||||||
instruction->avx.mask.reg, userData));
|
instruction->avx.mask.reg, userData));
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, "}"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, "}"));
|
||||||
if (instruction->avx.mask.mode == ZYDIS_MASK_MODE_ZERO)
|
if (instruction->avx.mask.mode == ZYDIS_MASK_MODE_ZERO)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, " {z}"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, " {z}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ZYDIS_DECORATOR_TYPE_BC:
|
case ZYDIS_DECORATOR_TYPE_BC:
|
||||||
|
#if !defined(ZYDIS_DISABLE_EVEX)
|
||||||
if (!instruction->avx.broadcast.isStatic)
|
if (!instruction->avx.broadcast.isStatic)
|
||||||
{
|
{
|
||||||
switch (instruction->avx.broadcast.mode)
|
switch (instruction->avx.broadcast.mode)
|
||||||
|
@ -733,13 +765,15 @@ static ZydisStatus ZydisPrintDecoratorIntel(const ZydisFormatter* formatter, Zyd
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ZYDIS_DECORATOR_TYPE_RC:
|
case ZYDIS_DECORATOR_TYPE_RC:
|
||||||
|
#if !defined(ZYDIS_DISABLE_EVEX)
|
||||||
if (instruction->avx.hasSAE)
|
if (instruction->avx.hasSAE)
|
||||||
{
|
{
|
||||||
switch (instruction->avx.rounding.mode)
|
switch (instruction->avx.rounding.mode)
|
||||||
{
|
{
|
||||||
case ZYDIS_ROUNDING_MODE_INVALID:
|
case ZYDIS_ROUNDING_MODE_INVALID:
|
||||||
break;
|
break;
|
||||||
case ZYDIS_ROUNDING_MODE_RN:
|
case ZYDIS_ROUNDING_MODE_RN:
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, " {rn-sae}"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, " {rn-sae}"));
|
||||||
|
@ -755,7 +789,7 @@ static ZydisStatus ZydisPrintDecoratorIntel(const ZydisFormatter* formatter, Zyd
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
switch (instruction->avx.rounding.mode)
|
switch (instruction->avx.rounding.mode)
|
||||||
|
@ -776,22 +810,26 @@ static ZydisStatus ZydisPrintDecoratorIntel(const ZydisFormatter* formatter, Zyd
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ZYDIS_DECORATOR_TYPE_SAE:
|
case ZYDIS_DECORATOR_TYPE_SAE:
|
||||||
|
#if !defined(ZYDIS_DISABLE_EVEX)
|
||||||
if (instruction->avx.hasSAE && !instruction->avx.rounding.mode)
|
if (instruction->avx.hasSAE && !instruction->avx.rounding.mode)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, " {sae}"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, " {sae}"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ZYDIS_DECORATOR_TYPE_SWIZZLE:
|
case ZYDIS_DECORATOR_TYPE_SWIZZLE:
|
||||||
|
#if !defined(ZYDIS_DISABLE_MVEX)
|
||||||
switch (instruction->avx.swizzle.mode)
|
switch (instruction->avx.swizzle.mode)
|
||||||
{
|
{
|
||||||
case ZYDIS_SWIZZLE_MODE_INVALID:
|
case ZYDIS_SWIZZLE_MODE_INVALID:
|
||||||
case ZYDIS_SWIZZLE_MODE_DCBA:
|
case ZYDIS_SWIZZLE_MODE_DCBA:
|
||||||
// Nothing to do here
|
// Nothing to do here
|
||||||
break;
|
break;
|
||||||
case ZYDIS_SWIZZLE_MODE_CDAB:
|
case ZYDIS_SWIZZLE_MODE_CDAB:
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, " {cdab}"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, " {cdab}"));
|
||||||
break;
|
break;
|
||||||
|
@ -816,8 +854,10 @@ static ZydisStatus ZydisPrintDecoratorIntel(const ZydisFormatter* formatter, Zyd
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ZYDIS_DECORATOR_TYPE_CONVERSION:
|
case ZYDIS_DECORATOR_TYPE_CONVERSION:
|
||||||
|
#if !defined(ZYDIS_DISABLE_MVEX)
|
||||||
switch (instruction->avx.conversion.mode)
|
switch (instruction->avx.conversion.mode)
|
||||||
{
|
{
|
||||||
case ZYDIS_CONVERSION_MODE_INVALID:
|
case ZYDIS_CONVERSION_MODE_INVALID:
|
||||||
|
@ -840,12 +880,15 @@ static ZydisStatus ZydisPrintDecoratorIntel(const ZydisFormatter* formatter, Zyd
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ZYDIS_DECORATOR_TYPE_EH:
|
case ZYDIS_DECORATOR_TYPE_EH:
|
||||||
|
#if !defined(ZYDIS_DISABLE_MVEX)
|
||||||
if (instruction->avx.hasEvictionHint)
|
if (instruction->avx.hasEvictionHint)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, " {eh}"));
|
ZYDIS_CHECK(ZydisStringAppendC(string, " {eh}"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
@ -886,11 +929,15 @@ ZydisStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle st
|
||||||
switch (style)
|
switch (style)
|
||||||
{
|
{
|
||||||
case ZYDIS_FORMATTER_STYLE_INTEL:
|
case ZYDIS_FORMATTER_STYLE_INTEL:
|
||||||
|
formatter->funcPreInstruction = ZYDIS_NULL;
|
||||||
|
formatter->funcPostInstruction = ZYDIS_NULL;
|
||||||
|
formatter->funcPreOperand = ZYDIS_NULL;
|
||||||
|
formatter->funcPostOperand = ZYDIS_NULL;
|
||||||
formatter->funcFormatInstruction = &ZydisFormatInstrIntel;
|
formatter->funcFormatInstruction = &ZydisFormatInstrIntel;
|
||||||
formatter->funcFormatOperandReg = &ZydisFormatOperandRegIntel;
|
formatter->funcFormatOperandReg = &ZydisFormatOperandRegIntel;
|
||||||
formatter->funcFormatOperandMem = &ZydisFormatOperandMemIntel;
|
formatter->funcFormatOperandMem = &ZydisFormatOperandMemIntel;
|
||||||
formatter->funcFormatOperandPtr = &ZydisFormatOperandPtrIntel;
|
formatter->funcFormatOperandPtr = &ZydisFormatOperandPtrIntel;
|
||||||
formatter->funcFormatOperandImm = &ZydisFormatOperandImmIntel;
|
formatter->funcFormatOperandImm = &ZydisFormatOperandImmIntel;
|
||||||
formatter->funcPrintMnemonic = &ZydisPrintMnemonicIntel;
|
formatter->funcPrintMnemonic = &ZydisPrintMnemonicIntel;
|
||||||
formatter->funcPrintRegister = &ZydisPrintRegisterIntel;
|
formatter->funcPrintRegister = &ZydisPrintRegisterIntel;
|
||||||
formatter->funcPrintAddress = &ZydisPrintAddrIntel;
|
formatter->funcPrintAddress = &ZydisPrintAddrIntel;
|
||||||
|
@ -904,17 +951,17 @@ ZydisStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle st
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
|
ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
|
||||||
ZydisFormatterProperty property, ZydisUPointer value)
|
ZydisFormatterProperty property, ZydisUPointer value)
|
||||||
{
|
{
|
||||||
if (!formatter)
|
if (!formatter)
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (property)
|
switch (property)
|
||||||
{
|
{
|
||||||
case ZYDIS_FORMATTER_PROP_UPPERCASE:
|
case ZYDIS_FORMATTER_PROP_UPPERCASE:
|
||||||
|
@ -940,7 +987,7 @@ ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
|
||||||
}
|
}
|
||||||
formatter->formatDisp = (ZydisU8)value;
|
formatter->formatDisp = (ZydisU8)value;
|
||||||
break;
|
break;
|
||||||
case ZYDIS_FORMATTER_PROP_IMM_FORMAT:
|
case ZYDIS_FORMATTER_PROP_IMM_FORMAT:
|
||||||
if (value > ZYDIS_IMM_FORMAT_MAX_VALUE)
|
if (value > ZYDIS_IMM_FORMAT_MAX_VALUE)
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
@ -964,21 +1011,21 @@ ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
|
||||||
return ZydisStringInit(&formatter->hexSuffixData, (char*)value);
|
return ZydisStringInit(&formatter->hexSuffixData, (char*)value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ZYDIS_FORMATTER_PROP_HEX_PADDING_ADDR:
|
case ZYDIS_FORMATTER_PROP_HEX_PADDING_ADDR:
|
||||||
if (value > 20)
|
if (value > 20)
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
formatter->hexPaddingAddress = (ZydisU8)value;
|
formatter->hexPaddingAddress = (ZydisU8)value;
|
||||||
break;
|
break;
|
||||||
case ZYDIS_FORMATTER_PROP_HEX_PADDING_DISP:
|
case ZYDIS_FORMATTER_PROP_HEX_PADDING_DISP:
|
||||||
if (value > 20)
|
if (value > 20)
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
formatter->hexPaddingDisp = (ZydisU8)value;
|
formatter->hexPaddingDisp = (ZydisU8)value;
|
||||||
break;
|
break;
|
||||||
case ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM:
|
case ZYDIS_FORMATTER_PROP_HEX_PADDING_IMM:
|
||||||
if (value > 20)
|
if (value > 20)
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
@ -992,7 +1039,7 @@ ZydisStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter, ZydisFormatterHookType hook,
|
ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter, ZydisFormatterHookType hook,
|
||||||
const void** callback)
|
const void** callback)
|
||||||
{
|
{
|
||||||
if (!formatter || !callback)
|
if (!formatter || !callback)
|
||||||
|
@ -1127,13 +1174,13 @@ ZydisStatus ZydisFormatterSetHook(ZydisFormatter* formatter, ZydisFormatterHookT
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
|
ZydisStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
|
||||||
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen)
|
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen)
|
||||||
{
|
{
|
||||||
return ZydisFormatterFormatInstructionEx(formatter, instruction, buffer, bufferLen, ZYDIS_NULL);
|
return ZydisFormatterFormatInstructionEx(formatter, instruction, buffer, bufferLen, ZYDIS_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
|
ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
|
||||||
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen, void* userData)
|
const ZydisDecodedInstruction* instruction, char* buffer, ZydisUSize bufferLen, void* userData)
|
||||||
{
|
{
|
||||||
if (!formatter || !instruction || !buffer || (bufferLen == 0))
|
if (!formatter || !instruction || !buffer || (bufferLen == 0))
|
||||||
|
@ -1150,6 +1197,95 @@ ZydisStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
|
||||||
|
|
||||||
buffer[string.length] = 0;
|
buffer[string.length] = 0;
|
||||||
|
|
||||||
|
if (status == ZYDIS_STATUS_SKIP_OPERAND)
|
||||||
|
{
|
||||||
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
|
||||||
|
const ZydisDecodedInstruction* instruction, ZydisU8 index, char* buffer, ZydisUSize bufferLen)
|
||||||
|
{
|
||||||
|
return ZydisFormatterFormatOperandEx(
|
||||||
|
formatter, instruction, index, buffer, bufferLen, ZYDIS_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
|
||||||
|
const ZydisDecodedInstruction* instruction, ZydisU8 index, char* buffer, ZydisUSize bufferLen,
|
||||||
|
void* userData)
|
||||||
|
{
|
||||||
|
if (!formatter || !instruction || index >= instruction->operandCount || !buffer ||
|
||||||
|
(bufferLen == 0))
|
||||||
|
{
|
||||||
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisString string;
|
||||||
|
string.buffer = buffer;
|
||||||
|
string.length = 0;
|
||||||
|
string.capacity = bufferLen - 1;
|
||||||
|
|
||||||
|
ZydisStatus status;
|
||||||
|
const ZydisDecodedOperand* operand = &instruction->operands[index];
|
||||||
|
|
||||||
|
if (formatter->funcPreOperand)
|
||||||
|
{
|
||||||
|
status = formatter->funcPreOperand(formatter, &string, instruction, operand, userData);
|
||||||
|
// We ignore `ZYDIS_STATUS_SKIP_OPERAND` as it does not make any sense to skip the only
|
||||||
|
// operand printed by this function
|
||||||
|
if ((status != ZYDIS_STATUS_SUCCESS) && (status != ZYDIS_STATUS_SKIP_OPERAND))
|
||||||
|
{
|
||||||
|
goto FinalizeString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (operand->type)
|
||||||
|
{
|
||||||
|
case ZYDIS_OPERAND_TYPE_REGISTER:
|
||||||
|
status = formatter->funcFormatOperandReg(formatter, &string, instruction, operand,
|
||||||
|
userData);
|
||||||
|
break;
|
||||||
|
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||||
|
status = formatter->funcFormatOperandMem(formatter, &string, instruction, operand,
|
||||||
|
userData);
|
||||||
|
break;
|
||||||
|
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||||
|
status = formatter->funcFormatOperandImm(formatter, &string, instruction, operand,
|
||||||
|
userData);
|
||||||
|
break;
|
||||||
|
case ZYDIS_OPERAND_TYPE_POINTER:
|
||||||
|
status = formatter->funcFormatOperandPtr(formatter, &string, instruction, operand,
|
||||||
|
userData);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
status = ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Ignore `ZYDIS_STATUS_SKIP_OPERAND`
|
||||||
|
if (status == ZYDIS_STATUS_SKIP_OPERAND)
|
||||||
|
{
|
||||||
|
status = ZYDIS_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
if (!ZYDIS_SUCCESS(status))
|
||||||
|
{
|
||||||
|
goto FinalizeString;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Print AVX512/KNC decorator
|
||||||
|
|
||||||
|
if (formatter->funcPostOperand)
|
||||||
|
{
|
||||||
|
status = formatter->funcPostOperand(formatter, &string, instruction, operand, userData);
|
||||||
|
// Ignore `ZYDIS_STATUS_SKIP_OPERAND`
|
||||||
|
if (status == ZYDIS_STATUS_SKIP_OPERAND)
|
||||||
|
{
|
||||||
|
status = ZYDIS_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FinalizeString:
|
||||||
|
buffer[string.length] = 0;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -58,8 +58,11 @@ static const char* zydisISAExtStrings[] =
|
||||||
"AVX512_VPCLMULQDQ_128",
|
"AVX512_VPCLMULQDQ_128",
|
||||||
"AVX512_VPCLMULQDQ_256",
|
"AVX512_VPCLMULQDQ_256",
|
||||||
"AVX512_VPCLMULQDQ_512",
|
"AVX512_VPCLMULQDQ_512",
|
||||||
|
"AVX512_VPOPCNTDQ_128",
|
||||||
|
"AVX512_VPOPCNTDQ_256",
|
||||||
"AVX512_VPOPCNTDQ_512",
|
"AVX512_VPOPCNTDQ_512",
|
||||||
"AVXAES",
|
"AVXAES",
|
||||||
|
"AVX_GFNI",
|
||||||
"BMI1",
|
"BMI1",
|
||||||
"BMI2",
|
"BMI2",
|
||||||
"CET",
|
"CET",
|
||||||
|
@ -95,10 +98,12 @@ static const char* zydisISAExtStrings[] =
|
||||||
"LONGMODE",
|
"LONGMODE",
|
||||||
"LZCNT",
|
"LZCNT",
|
||||||
"MONITOR",
|
"MONITOR",
|
||||||
|
"MONITORX",
|
||||||
"MOVBE",
|
"MOVBE",
|
||||||
"MPX",
|
"MPX",
|
||||||
"PAUSE",
|
"PAUSE",
|
||||||
"PCLMULQDQ",
|
"PCLMULQDQ",
|
||||||
|
"PCONFIG",
|
||||||
"PENTIUMMMX",
|
"PENTIUMMMX",
|
||||||
"PENTIUMREAL",
|
"PENTIUMREAL",
|
||||||
"PKU",
|
"PKU",
|
||||||
|
@ -115,6 +120,7 @@ static const char* zydisISAExtStrings[] =
|
||||||
"RDWRFSGS",
|
"RDWRFSGS",
|
||||||
"RTM",
|
"RTM",
|
||||||
"SGX",
|
"SGX",
|
||||||
|
"SGX_ENCLV",
|
||||||
"SHA",
|
"SHA",
|
||||||
"SMAP",
|
"SMAP",
|
||||||
"SMX",
|
"SMX",
|
||||||
|
@ -125,6 +131,7 @@ static const char* zydisISAExtStrings[] =
|
||||||
"SSE3X87",
|
"SSE3X87",
|
||||||
"SSE4",
|
"SSE4",
|
||||||
"SSE42",
|
"SSE42",
|
||||||
|
"SSE4A",
|
||||||
"SSEMXCSR",
|
"SSEMXCSR",
|
||||||
"SSE_PREFETCH",
|
"SSE_PREFETCH",
|
||||||
"SSSE3",
|
"SSSE3",
|
||||||
|
|
|
@ -30,10 +30,12 @@ static const char* zydisISASetStrings[] =
|
||||||
"LZCNT",
|
"LZCNT",
|
||||||
"MMX",
|
"MMX",
|
||||||
"MONITOR",
|
"MONITOR",
|
||||||
|
"MONITORX",
|
||||||
"MOVBE",
|
"MOVBE",
|
||||||
"MPX",
|
"MPX",
|
||||||
"PAUSE",
|
"PAUSE",
|
||||||
"PCLMULQDQ",
|
"PCLMULQDQ",
|
||||||
|
"PCONFIG",
|
||||||
"PKU",
|
"PKU",
|
||||||
"PREFETCHWT1",
|
"PREFETCHWT1",
|
||||||
"PT",
|
"PT",
|
||||||
|
@ -44,6 +46,7 @@ static const char* zydisISASetStrings[] =
|
||||||
"RDWRFSGS",
|
"RDWRFSGS",
|
||||||
"RTM",
|
"RTM",
|
||||||
"SGX",
|
"SGX",
|
||||||
|
"SGX_ENCLV",
|
||||||
"SHA",
|
"SHA",
|
||||||
"SMAP",
|
"SMAP",
|
||||||
"SMX",
|
"SMX",
|
||||||
|
@ -51,6 +54,7 @@ static const char* zydisISASetStrings[] =
|
||||||
"SSE2",
|
"SSE2",
|
||||||
"SSE3",
|
"SSE3",
|
||||||
"SSE4",
|
"SSE4",
|
||||||
|
"SSE4A",
|
||||||
"SSSE3",
|
"SSSE3",
|
||||||
"SVM",
|
"SVM",
|
||||||
"TBM",
|
"TBM",
|
||||||
|
|
|
@ -52,6 +52,7 @@ static const char* zydisInstructionCategoryStrings[] =
|
||||||
"MPX",
|
"MPX",
|
||||||
"NOP",
|
"NOP",
|
||||||
"PCLMULQDQ",
|
"PCLMULQDQ",
|
||||||
|
"PCONFIG",
|
||||||
"PKU",
|
"PKU",
|
||||||
"POP",
|
"POP",
|
||||||
"PREFETCH",
|
"PREFETCH",
|
||||||
|
|
|
@ -147,10 +147,12 @@ static const ZydisStaticString zydisMnemonicStrings[] =
|
||||||
ZYDIS_MAKE_STATIC_STRING("emms"),
|
ZYDIS_MAKE_STATIC_STRING("emms"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("encls"),
|
ZYDIS_MAKE_STATIC_STRING("encls"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("enclu"),
|
ZYDIS_MAKE_STATIC_STRING("enclu"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("enclv"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("endbr32"),
|
ZYDIS_MAKE_STATIC_STRING("endbr32"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("endbr64"),
|
ZYDIS_MAKE_STATIC_STRING("endbr64"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("enter"),
|
ZYDIS_MAKE_STATIC_STRING("enter"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("extractps"),
|
ZYDIS_MAKE_STATIC_STRING("extractps"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("extrq"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("f2xm1"),
|
ZYDIS_MAKE_STATIC_STRING("f2xm1"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("fabs"),
|
ZYDIS_MAKE_STATIC_STRING("fabs"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("fadd"),
|
ZYDIS_MAKE_STATIC_STRING("fadd"),
|
||||||
|
@ -266,6 +268,7 @@ static const ZydisStaticString zydisMnemonicStrings[] =
|
||||||
ZYDIS_MAKE_STATIC_STRING("insb"),
|
ZYDIS_MAKE_STATIC_STRING("insb"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("insd"),
|
ZYDIS_MAKE_STATIC_STRING("insd"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("insertps"),
|
ZYDIS_MAKE_STATIC_STRING("insertps"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("insertq"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("insw"),
|
ZYDIS_MAKE_STATIC_STRING("insw"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("int"),
|
ZYDIS_MAKE_STATIC_STRING("int"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("int1"),
|
ZYDIS_MAKE_STATIC_STRING("int1"),
|
||||||
|
@ -408,6 +411,7 @@ static const ZydisStaticString zydisMnemonicStrings[] =
|
||||||
ZYDIS_MAKE_STATIC_STRING("minsd"),
|
ZYDIS_MAKE_STATIC_STRING("minsd"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("minss"),
|
ZYDIS_MAKE_STATIC_STRING("minss"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("monitor"),
|
ZYDIS_MAKE_STATIC_STRING("monitor"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("monitorx"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("mov"),
|
ZYDIS_MAKE_STATIC_STRING("mov"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("movapd"),
|
ZYDIS_MAKE_STATIC_STRING("movapd"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("movaps"),
|
ZYDIS_MAKE_STATIC_STRING("movaps"),
|
||||||
|
@ -431,6 +435,8 @@ static const ZydisStaticString zydisMnemonicStrings[] =
|
||||||
ZYDIS_MAKE_STATIC_STRING("movntpd"),
|
ZYDIS_MAKE_STATIC_STRING("movntpd"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("movntps"),
|
ZYDIS_MAKE_STATIC_STRING("movntps"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("movntq"),
|
ZYDIS_MAKE_STATIC_STRING("movntq"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("movntsd"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("movntss"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("movq"),
|
ZYDIS_MAKE_STATIC_STRING("movq"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("movq2dq"),
|
ZYDIS_MAKE_STATIC_STRING("movq2dq"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("movsb"),
|
ZYDIS_MAKE_STATIC_STRING("movsb"),
|
||||||
|
@ -453,6 +459,7 @@ static const ZydisStaticString zydisMnemonicStrings[] =
|
||||||
ZYDIS_MAKE_STATIC_STRING("mulss"),
|
ZYDIS_MAKE_STATIC_STRING("mulss"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("mulx"),
|
ZYDIS_MAKE_STATIC_STRING("mulx"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("mwait"),
|
ZYDIS_MAKE_STATIC_STRING("mwait"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mwaitx"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("neg"),
|
ZYDIS_MAKE_STATIC_STRING("neg"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("nop"),
|
ZYDIS_MAKE_STATIC_STRING("nop"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("not"),
|
ZYDIS_MAKE_STATIC_STRING("not"),
|
||||||
|
@ -500,6 +507,7 @@ static const ZydisStaticString zydisMnemonicStrings[] =
|
||||||
ZYDIS_MAKE_STATIC_STRING("pcmpgtw"),
|
ZYDIS_MAKE_STATIC_STRING("pcmpgtw"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("pcmpistri"),
|
ZYDIS_MAKE_STATIC_STRING("pcmpistri"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("pcmpistrm"),
|
ZYDIS_MAKE_STATIC_STRING("pcmpistrm"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("pconfig"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("pdep"),
|
ZYDIS_MAKE_STATIC_STRING("pdep"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("pext"),
|
ZYDIS_MAKE_STATIC_STRING("pext"),
|
||||||
ZYDIS_MAKE_STATIC_STRING("pextrb"),
|
ZYDIS_MAKE_STATIC_STRING("pextrb"),
|
||||||
|
|
|
@ -0,0 +1,277 @@
|
||||||
|
static const ZydisStaticString zydisRegisterStrings[] =
|
||||||
|
{
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("none"),
|
||||||
|
|
||||||
|
// General purpose registers 8-bit
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("al"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cl"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dl"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bl"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ah"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ch"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dh"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bh"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("spl"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bpl"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("sil"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dil"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r8b"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r9b"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r10b"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r11b"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r12b"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r13b"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r14b"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r15b"),
|
||||||
|
// General purpose registers 16-bit
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ax"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("sp"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bp"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("si"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("di"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r8w"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r9w"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r10w"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r11w"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r12w"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r13w"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r14w"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r15w"),
|
||||||
|
// General purpose registers 32-bit
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("eax"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ecx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("edx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ebx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("esp"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ebp"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("esi"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("edi"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r8d"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r9d"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r10d"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r11d"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r12d"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r13d"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r14d"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r15d"),
|
||||||
|
// General purpose registers 64-bit
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rax"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rcx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rdx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rbx"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rsp"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rbp"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rsi"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rdi"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r8"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r9"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r10"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r11"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r12"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r13"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r14"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("r15"),
|
||||||
|
// Floating point legacy registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("st0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("st1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("st2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("st3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("st4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("st5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("st6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("st7"),
|
||||||
|
// Floating point multimedia registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mm0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mm1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mm2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mm3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mm4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mm5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mm6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mm7"),
|
||||||
|
// Floating point vector registers 128-bit
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm7"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm8"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm9"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm10"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm11"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm12"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm13"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm14"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm15"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm16"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm17"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm18"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm19"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm20"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm21"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm22"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm23"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm24"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm25"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm26"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm27"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm28"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm29"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm30"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xmm31"),
|
||||||
|
// Floating point vector registers 256-bit
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm7"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm8"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm9"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm10"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm11"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm12"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm13"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm14"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm15"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm16"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm17"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm18"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm19"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm20"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm21"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm22"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm23"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm24"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm25"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm26"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm27"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm28"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm29"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm30"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ymm31"),
|
||||||
|
// Floating point vector registers 512-bit
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm7"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm8"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm9"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm10"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm11"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm12"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm13"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm14"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm15"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm16"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm17"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm18"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm19"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm20"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm21"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm22"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm23"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm24"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm25"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm26"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm27"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm28"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm29"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm30"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("zmm31"),
|
||||||
|
// Flags registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("flags"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("eflags"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rflags"),
|
||||||
|
// Instruction-pointer registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ip"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("eip"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("rip"),
|
||||||
|
// Segment registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("es"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cs"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ss"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ds"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("fs"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("gs"),
|
||||||
|
// Table registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("gdtr"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("ldtr"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("idtr"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr"),
|
||||||
|
// Test registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("tr7"),
|
||||||
|
// Control registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr7"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr8"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr9"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr10"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr11"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr12"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr13"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr14"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("cr15"),
|
||||||
|
// Debug registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr7"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr8"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr9"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr10"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr11"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr12"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr13"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr14"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("dr15"),
|
||||||
|
// Mask registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("k0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("k1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("k2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("k3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("k4"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("k5"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("k6"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("k7"),
|
||||||
|
// Bound registers
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bnd0"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bnd1"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bnd2"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bnd3"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bndcfg"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("bndstatus"),
|
||||||
|
// Uncategorized
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("mxcsr"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("pkru"),
|
||||||
|
ZYDIS_MAKE_STATIC_STRING("xcr0")
|
||||||
|
};
|
File diff suppressed because it is too large
Load Diff
|
@ -18,5 +18,6 @@ static const ZydisInstructionEncodingInfo instructionEncodings[] =
|
||||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYDIS_TRUE, ZYDIS_TRUE }, { { 0, 0, 0 }, ZYDIS_FALSE, ZYDIS_FALSE } } },
|
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYDIS_TRUE, ZYDIS_TRUE }, { { 0, 0, 0 }, ZYDIS_FALSE, ZYDIS_FALSE } } },
|
||||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYDIS_FALSE, ZYDIS_FALSE }, { { 0, 0, 0 }, ZYDIS_FALSE, ZYDIS_FALSE } } },
|
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYDIS_FALSE, ZYDIS_FALSE }, { { 0, 0, 0 }, ZYDIS_FALSE, ZYDIS_FALSE } } },
|
||||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYDIS_FALSE, ZYDIS_FALSE }, { { 8, 8, 8 }, ZYDIS_FALSE, ZYDIS_FALSE } } },
|
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYDIS_FALSE, ZYDIS_FALSE }, { { 8, 8, 8 }, ZYDIS_FALSE, ZYDIS_FALSE } } },
|
||||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYDIS_TRUE, ZYDIS_TRUE }, { { 16, 16, 16 }, ZYDIS_FALSE, ZYDIS_FALSE } } }
|
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYDIS_TRUE, ZYDIS_TRUE }, { { 16, 16, 16 }, ZYDIS_FALSE, ZYDIS_FALSE } } },
|
||||||
|
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYDIS_FALSE, ZYDIS_FALSE }, { { 8, 8, 8 }, ZYDIS_FALSE, ZYDIS_FALSE } } }
|
||||||
};
|
};
|
||||||
|
|
|
@ -141,6 +141,11 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_XMM0 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_XMM0 } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READWRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_UINT32, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EAX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_UINT32, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EBX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_UINT32, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_ECX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_UINT32, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EDX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
@ -1165,6 +1170,10 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RBX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RBX } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RCX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RCX } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RDX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RDX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_UINT32, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EAX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_UINT64, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RBX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_UINT64, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RCX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_UINT64, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RDX } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR16_32_64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR16_32_64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR16_32_64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR16_32_64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 2, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT, { .encoding = ZYDIS_OPERAND_ENCODING_SIMM16_32_32 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 2, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT, { .encoding = ZYDIS_OPERAND_ENCODING_SIMM16_32_32 } },
|
||||||
|
@ -1205,17 +1214,21 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_DX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_DX } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ_CONDWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_GPR_ASZ, { .id = 0x1 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ_CONDWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_GPR_ASZ, { .id = 0x1 } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDWRITE, { 2, 2, 2 }, ZYDIS_IELEMENT_TYPE_INT16, { .mem = { 1, ZYDIS_IMPLMEM_BASE_ADI } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDWRITE, { 2, 2, 2 }, ZYDIS_IELEMENT_TYPE_INT16, { .mem = { 1, ZYDIS_IMPLMEM_BASE_ADI } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_DX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_DX } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ_CONDWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_GPR_ASZ, { .id = 0x1 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ_CONDWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_GPR_ASZ, { .id = 0x1 } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_IP_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_IP_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_GPR_SSZ, { .id = 0x4 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_GPR_SSZ, { .id = 0x4 } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 6, 12, 24 }, ZYDIS_IELEMENT_TYPE_INT, { .mem = { 0, ZYDIS_IMPLMEM_BASE_ASP } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 10, 20, 40 }, ZYDIS_IELEMENT_TYPE_INT, { .mem = { 0, ZYDIS_IMPLMEM_BASE_ASP } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RIP } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RIP } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_GPR_SSZ, { .id = 0x4 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_GPR_SSZ, { .id = 0x4 } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 6, 12, 24 }, ZYDIS_IELEMENT_TYPE_INT, { .mem = { 0, ZYDIS_IMPLMEM_BASE_ASP } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 10, 20, 40 }, ZYDIS_IELEMENT_TYPE_INT, { .mem = { 0, ZYDIS_IMPLMEM_BASE_ASP } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_AL } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDWRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_AL } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .mem = { 4, ZYDIS_IMPLMEM_BASE_ASI } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_CONDREAD, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .mem = { 4, ZYDIS_IMPLMEM_BASE_ASI } } },
|
||||||
|
@ -1341,6 +1354,10 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EDX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EDX } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EAX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EAX } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_XCR0 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_XCR0 } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 576, 576, 576 }, ZYDIS_IELEMENT_TYPE_STRUCT, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EDX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EAX } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_XCR0 } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 576, 576, 576 }, ZYDIS_IELEMENT_TYPE_STRUCT, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 576, 576, 576 }, ZYDIS_IELEMENT_TYPE_STRUCT, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EDX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EDX } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EAX } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EAX } } } },
|
||||||
|
@ -1408,27 +1425,27 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_INT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
@ -1440,35 +1457,35 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
@ -1509,19 +1526,19 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_IS4 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_IS4 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR32, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
|
@ -1669,6 +1686,22 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_IS4 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_IS4 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
@ -1709,18 +1742,10 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
@ -1741,18 +1766,10 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_IS4 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_IS4 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_YMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 32, 32, 32 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
@ -2926,6 +2943,9 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_IMPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 10, 10, 10 }, ZYDIS_IELEMENT_TYPE_FLOAT80, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_ST0 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_IMPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 10, 10, 10 }, ZYDIS_IELEMENT_TYPE_FLOAT80, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_ST0 } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_FPR, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 10, 10, 10 }, ZYDIS_IELEMENT_TYPE_FLOAT80, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_FPR, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 10, 10, 10 }, ZYDIS_IELEMENT_TYPE_FLOAT80, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
|
@ -3413,9 +3433,6 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 4, 4, 4 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
@ -3540,22 +3557,16 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT32, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT8, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
|
@ -3564,12 +3575,6 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT64, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 1, 1, 1 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_UIMM8 } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_NDSNDD } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_UINT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
@ -5634,6 +5639,8 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 2, 4, 8 }, ZYDIS_IELEMENT_TYPE_INT, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 2, 4, 8 }, ZYDIS_IELEMENT_TYPE_INT, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READWRITE, { 10, 10, 10 }, ZYDIS_IELEMENT_TYPE_FLOAT80, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_ST0 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READWRITE, { 10, 10, 10 }, ZYDIS_IELEMENT_TYPE_FLOAT80, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_ST0 } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 10, 10, 10 }, ZYDIS_IELEMENT_TYPE_FLOAT80, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_ST0 } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 10, 10, 10 }, ZYDIS_IELEMENT_TYPE_FLOAT80, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_ST0 } } } },
|
||||||
|
@ -5812,6 +5819,8 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
@ -5824,8 +5833,6 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_GPR64, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MMX, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_INT32, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
|
@ -6064,10 +6071,10 @@ const ZydisOperandDefinition operandDefinitions[] =
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_TR } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_TR } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 2, 2, 2 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_MEM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_WRITE, { 2, 2, 2 }, ZYDIS_IELEMENT_TYPE_INT16, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_TR } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_READ, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_TR } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EIP } } } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RIP } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_RIP } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_STATIC, { .reg = ZYDIS_REGISTER_EIP } } } },
|
||||||
|
{ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG, ZYDIS_OPERAND_VISIBILITY_HIDDEN, ZYDIS_OPERAND_ACTION_WRITE, { 0, 0, 0 }, ZYDIS_IELEMENT_TYPE_INVALID, { .reg = { ZYDIS_IMPLREG_TYPE_FLAGS_SSZ, { .id = 0x3F } } } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READ, { 8, 8, 8 }, ZYDIS_IELEMENT_TYPE_INT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_RM } },
|
||||||
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
{ ZYDIS_SEMANTIC_OPTYPE_XMM, ZYDIS_OPERAND_VISIBILITY_EXPLICIT, ZYDIS_OPERAND_ACTION_READWRITE, { 16, 16, 16 }, ZYDIS_IELEMENT_TYPE_FLOAT64, { .encoding = ZYDIS_OPERAND_ENCODING_MODRM_REG } },
|
||||||
|
|
|
@ -44,7 +44,7 @@ const char* ZydisCategoryGetString(ZydisInstructionCategory category)
|
||||||
{
|
{
|
||||||
return ZYDIS_NULL;
|
return ZYDIS_NULL;
|
||||||
}
|
}
|
||||||
return zydisInstructionCategoryStrings[category];
|
return zydisInstructionCategoryStrings[category];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ZydisISASetGetString(ZydisISASet isaSet)
|
const char* ZydisISASetGetString(ZydisISASet isaSet)
|
||||||
|
@ -53,7 +53,7 @@ const char* ZydisISASetGetString(ZydisISASet isaSet)
|
||||||
{
|
{
|
||||||
return ZYDIS_NULL;
|
return ZYDIS_NULL;
|
||||||
}
|
}
|
||||||
return zydisISASetStrings[isaSet];
|
return zydisISASetStrings[isaSet];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ZydisISAExtGetString(ZydisISAExt isaExt)
|
const char* ZydisISAExtGetString(ZydisISAExt isaExt)
|
||||||
|
@ -62,7 +62,7 @@ const char* ZydisISAExtGetString(ZydisISAExt isaExt)
|
||||||
{
|
{
|
||||||
return ZYDIS_NULL;
|
return ZYDIS_NULL;
|
||||||
}
|
}
|
||||||
return zydisISAExtStrings[isaExt];
|
return zydisISAExtStrings[isaExt];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
164
src/Register.c
164
src/Register.c
|
@ -30,157 +30,7 @@
|
||||||
/* Register strings */
|
/* Register strings */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
static const ZydisStaticString registerStrings[] =
|
#include <Generated/EnumRegister.inc>
|
||||||
{
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("none"),
|
|
||||||
// General purpose registers 8-bit
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("al"), ZYDIS_MAKE_STATIC_STRING("cl"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dl"), ZYDIS_MAKE_STATIC_STRING("bl"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ah"), ZYDIS_MAKE_STATIC_STRING("ch"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dh"), ZYDIS_MAKE_STATIC_STRING("bh"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("spl"), ZYDIS_MAKE_STATIC_STRING("bpl"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("sil"), ZYDIS_MAKE_STATIC_STRING("dil"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r8b"), ZYDIS_MAKE_STATIC_STRING("r9b"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r10b"), ZYDIS_MAKE_STATIC_STRING("r11b"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r12b"), ZYDIS_MAKE_STATIC_STRING("r13b"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r14b"), ZYDIS_MAKE_STATIC_STRING("r15b"),
|
|
||||||
// General purpose registers 16-bit
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ax"), ZYDIS_MAKE_STATIC_STRING("cx"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dx"), ZYDIS_MAKE_STATIC_STRING("bx"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("sp"), ZYDIS_MAKE_STATIC_STRING("bp"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("si"), ZYDIS_MAKE_STATIC_STRING("di"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r8w"), ZYDIS_MAKE_STATIC_STRING("r9w"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r10w"), ZYDIS_MAKE_STATIC_STRING("r11w"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r12w"), ZYDIS_MAKE_STATIC_STRING("r13w"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r14w"), ZYDIS_MAKE_STATIC_STRING("r15w"),
|
|
||||||
// General purpose registers 32-bit
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("eax"), ZYDIS_MAKE_STATIC_STRING("ecx"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("edx"), ZYDIS_MAKE_STATIC_STRING("ebx"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("esp"), ZYDIS_MAKE_STATIC_STRING("ebp"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("esi"), ZYDIS_MAKE_STATIC_STRING("edi"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r8d"), ZYDIS_MAKE_STATIC_STRING("r9d"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r10d"), ZYDIS_MAKE_STATIC_STRING("r11d"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r12d"), ZYDIS_MAKE_STATIC_STRING("r13d"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r14d"), ZYDIS_MAKE_STATIC_STRING("r15d"),
|
|
||||||
// General purpose registers 64-bi
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("rax"), ZYDIS_MAKE_STATIC_STRING("rcx"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("rdx"), ZYDIS_MAKE_STATIC_STRING("rbx"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("rsp"), ZYDIS_MAKE_STATIC_STRING("rbp"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("rsi"), ZYDIS_MAKE_STATIC_STRING("rdi"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r8"), ZYDIS_MAKE_STATIC_STRING("r9"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r10"), ZYDIS_MAKE_STATIC_STRING("r11"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r12"), ZYDIS_MAKE_STATIC_STRING("r13"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("r14"), ZYDIS_MAKE_STATIC_STRING("r15"),
|
|
||||||
// Floating point legacy registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("st0"), ZYDIS_MAKE_STATIC_STRING("st1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("st2"), ZYDIS_MAKE_STATIC_STRING("st3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("st4"), ZYDIS_MAKE_STATIC_STRING("st5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("st6"), ZYDIS_MAKE_STATIC_STRING("st7"),
|
|
||||||
// Floating point multimedia registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("mm0"), ZYDIS_MAKE_STATIC_STRING("mm1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("mm2"), ZYDIS_MAKE_STATIC_STRING("mm3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("mm4"), ZYDIS_MAKE_STATIC_STRING("mm5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("mm6"), ZYDIS_MAKE_STATIC_STRING("mm7"),
|
|
||||||
// Floating point vector registers 128-bit
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm0"), ZYDIS_MAKE_STATIC_STRING("xmm1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm2"), ZYDIS_MAKE_STATIC_STRING("xmm3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm4"), ZYDIS_MAKE_STATIC_STRING("xmm5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm6"), ZYDIS_MAKE_STATIC_STRING("xmm7"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm8"), ZYDIS_MAKE_STATIC_STRING("xmm9"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm10"), ZYDIS_MAKE_STATIC_STRING("xmm11"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm12"), ZYDIS_MAKE_STATIC_STRING("xmm13"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm14"), ZYDIS_MAKE_STATIC_STRING("xmm15"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm16"), ZYDIS_MAKE_STATIC_STRING("xmm17"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm18"), ZYDIS_MAKE_STATIC_STRING("xmm19"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm20"), ZYDIS_MAKE_STATIC_STRING("xmm21"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm22"), ZYDIS_MAKE_STATIC_STRING("xmm23"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm24"), ZYDIS_MAKE_STATIC_STRING("xmm25"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm26"), ZYDIS_MAKE_STATIC_STRING("xmm27"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm28"), ZYDIS_MAKE_STATIC_STRING("xmm29"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xmm30"), ZYDIS_MAKE_STATIC_STRING("xmm31"),
|
|
||||||
// Floating point vector registers 256-bit
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm0"), ZYDIS_MAKE_STATIC_STRING("ymm1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm2"), ZYDIS_MAKE_STATIC_STRING("ymm3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm4"), ZYDIS_MAKE_STATIC_STRING("ymm5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm6"), ZYDIS_MAKE_STATIC_STRING("ymm7"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm8"), ZYDIS_MAKE_STATIC_STRING("ymm9"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm10"), ZYDIS_MAKE_STATIC_STRING("ymm11"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm12"), ZYDIS_MAKE_STATIC_STRING("ymm13"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm14"), ZYDIS_MAKE_STATIC_STRING("ymm15"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm16"), ZYDIS_MAKE_STATIC_STRING("ymm17"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm18"), ZYDIS_MAKE_STATIC_STRING("ymm19"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm20"), ZYDIS_MAKE_STATIC_STRING("ymm21"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm22"), ZYDIS_MAKE_STATIC_STRING("ymm23"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm24"), ZYDIS_MAKE_STATIC_STRING("ymm25"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm26"), ZYDIS_MAKE_STATIC_STRING("ymm27"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm28"), ZYDIS_MAKE_STATIC_STRING("ymm29"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ymm30"), ZYDIS_MAKE_STATIC_STRING("ymm31"),
|
|
||||||
// Floating point vector registers 512-bit
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm0"), ZYDIS_MAKE_STATIC_STRING("zmm1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm2"), ZYDIS_MAKE_STATIC_STRING("zmm3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm4"), ZYDIS_MAKE_STATIC_STRING("zmm5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm6"), ZYDIS_MAKE_STATIC_STRING("zmm7"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm8"), ZYDIS_MAKE_STATIC_STRING("zmm9"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm10"), ZYDIS_MAKE_STATIC_STRING("zmm11"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm12"), ZYDIS_MAKE_STATIC_STRING("zmm13"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm14"), ZYDIS_MAKE_STATIC_STRING("zmm15"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm16"), ZYDIS_MAKE_STATIC_STRING("zmm17"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm18"), ZYDIS_MAKE_STATIC_STRING("zmm19"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm20"), ZYDIS_MAKE_STATIC_STRING("zmm21"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm22"), ZYDIS_MAKE_STATIC_STRING("zmm23"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm24"), ZYDIS_MAKE_STATIC_STRING("zmm25"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm26"), ZYDIS_MAKE_STATIC_STRING("zmm27"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm28"), ZYDIS_MAKE_STATIC_STRING("zmm29"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("zmm30"), ZYDIS_MAKE_STATIC_STRING("zmm31"),
|
|
||||||
// Flags registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("flags"), ZYDIS_MAKE_STATIC_STRING("eflags"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("rflags"),
|
|
||||||
// Instruction-pointer registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ip"), ZYDIS_MAKE_STATIC_STRING("eip"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("rip"),
|
|
||||||
// Segment registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("es"), ZYDIS_MAKE_STATIC_STRING("cs"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("ss"), ZYDIS_MAKE_STATIC_STRING("ds"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("fs"), ZYDIS_MAKE_STATIC_STRING("gs"),
|
|
||||||
// Table registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("gdtr"), ZYDIS_MAKE_STATIC_STRING("ldtr"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("idtr"), ZYDIS_MAKE_STATIC_STRING("tr"),
|
|
||||||
// Test registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("tr0"), ZYDIS_MAKE_STATIC_STRING("tr1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("tr2"), ZYDIS_MAKE_STATIC_STRING("tr3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("tr4"), ZYDIS_MAKE_STATIC_STRING("tr5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("tr6"), ZYDIS_MAKE_STATIC_STRING("tr7"),
|
|
||||||
// Control registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("cr0"), ZYDIS_MAKE_STATIC_STRING("cr1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("cr2"), ZYDIS_MAKE_STATIC_STRING("cr3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("cr4"), ZYDIS_MAKE_STATIC_STRING("cr5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("cr6"), ZYDIS_MAKE_STATIC_STRING("cr7"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("cr8"), ZYDIS_MAKE_STATIC_STRING("cr9"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("cr10"), ZYDIS_MAKE_STATIC_STRING("cr11"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("cr12"), ZYDIS_MAKE_STATIC_STRING("cr13"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("cr14"), ZYDIS_MAKE_STATIC_STRING("cr15"),
|
|
||||||
// Debug registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dr0"), ZYDIS_MAKE_STATIC_STRING("dr1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dr2"), ZYDIS_MAKE_STATIC_STRING("dr3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dr4"), ZYDIS_MAKE_STATIC_STRING("dr5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dr6"), ZYDIS_MAKE_STATIC_STRING("dr7"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dr8"), ZYDIS_MAKE_STATIC_STRING("dr9"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dr10"), ZYDIS_MAKE_STATIC_STRING("dr11"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dr12"), ZYDIS_MAKE_STATIC_STRING("dr13"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("dr14"), ZYDIS_MAKE_STATIC_STRING("dr15"),
|
|
||||||
// Mask registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("k0"), ZYDIS_MAKE_STATIC_STRING("k1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("k2"), ZYDIS_MAKE_STATIC_STRING("k3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("k4"), ZYDIS_MAKE_STATIC_STRING("k5"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("k6"), ZYDIS_MAKE_STATIC_STRING("k7"),
|
|
||||||
// Bound registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("bnd0"), ZYDIS_MAKE_STATIC_STRING("bnd1"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("bnd2"), ZYDIS_MAKE_STATIC_STRING("bnd3"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("bndcfg"), ZYDIS_MAKE_STATIC_STRING("bndstatus"),
|
|
||||||
// Misc registers
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("mxcsr"), ZYDIS_MAKE_STATIC_STRING("pkru"),
|
|
||||||
ZYDIS_MAKE_STATIC_STRING("xcr0")
|
|
||||||
};
|
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
/* Register-class mapping */
|
/* Register-class mapping */
|
||||||
|
@ -207,8 +57,8 @@ static const struct ZydisRegisterMapItem registerMap[] =
|
||||||
{ ZYDIS_REGCLASS_XMM , ZYDIS_REGISTER_XMM0 , ZYDIS_REGISTER_XMM31 , 128 , 128 },
|
{ ZYDIS_REGCLASS_XMM , ZYDIS_REGISTER_XMM0 , ZYDIS_REGISTER_XMM31 , 128 , 128 },
|
||||||
{ ZYDIS_REGCLASS_YMM , ZYDIS_REGISTER_YMM0 , ZYDIS_REGISTER_YMM31 , 256 , 256 },
|
{ ZYDIS_REGCLASS_YMM , ZYDIS_REGISTER_YMM0 , ZYDIS_REGISTER_YMM31 , 256 , 256 },
|
||||||
{ ZYDIS_REGCLASS_ZMM , ZYDIS_REGISTER_ZMM0 , ZYDIS_REGISTER_ZMM31 , 512 , 512 },
|
{ ZYDIS_REGCLASS_ZMM , ZYDIS_REGISTER_ZMM0 , ZYDIS_REGISTER_ZMM31 , 512 , 512 },
|
||||||
{ ZYDIS_REGCLASS_FLAGS , ZYDIS_REGISTER_RFLAGS , ZYDIS_REGISTER_FLAGS , 0 , 0 },
|
{ ZYDIS_REGCLASS_FLAGS , ZYDIS_REGISTER_FLAGS , ZYDIS_REGISTER_RFLAGS , 0 , 0 },
|
||||||
{ ZYDIS_REGCLASS_IP , ZYDIS_REGISTER_RIP , ZYDIS_REGISTER_IP , 0 , 0 },
|
{ ZYDIS_REGCLASS_IP , ZYDIS_REGISTER_IP , ZYDIS_REGISTER_RIP , 0 , 0 },
|
||||||
{ ZYDIS_REGCLASS_SEGMENT , ZYDIS_REGISTER_ES , ZYDIS_REGISTER_GS , 16 , 16 },
|
{ ZYDIS_REGCLASS_SEGMENT , ZYDIS_REGISTER_ES , ZYDIS_REGISTER_GS , 16 , 16 },
|
||||||
{ ZYDIS_REGCLASS_TEST , ZYDIS_REGISTER_TR0 , ZYDIS_REGISTER_TR7 , 32 , 32 },
|
{ ZYDIS_REGCLASS_TEST , ZYDIS_REGISTER_TR0 , ZYDIS_REGISTER_TR7 , 32 , 32 },
|
||||||
{ ZYDIS_REGCLASS_CONTROL , ZYDIS_REGISTER_CR0 , ZYDIS_REGISTER_CR15 , 32 , 64 },
|
{ ZYDIS_REGCLASS_CONTROL , ZYDIS_REGISTER_CR0 , ZYDIS_REGISTER_CR15 , 32 , 64 },
|
||||||
|
@ -333,20 +183,20 @@ ZydisRegisterWidth ZydisRegisterGetWidth64(ZydisRegister reg)
|
||||||
|
|
||||||
const char* ZydisRegisterGetString(ZydisRegister reg)
|
const char* ZydisRegisterGetString(ZydisRegister reg)
|
||||||
{
|
{
|
||||||
if (reg >= ZYDIS_ARRAY_SIZE(registerStrings))
|
if (reg >= ZYDIS_ARRAY_SIZE(zydisRegisterStrings))
|
||||||
{
|
{
|
||||||
return ZYDIS_NULL;
|
return ZYDIS_NULL;
|
||||||
}
|
}
|
||||||
return registerStrings[reg].buffer;
|
return zydisRegisterStrings[reg].buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZydisStaticString* ZydisRegisterGetStaticString(ZydisRegister reg)
|
const ZydisStaticString* ZydisRegisterGetStaticString(ZydisRegister reg)
|
||||||
{
|
{
|
||||||
if (reg >= ZYDIS_ARRAY_SIZE(registerStrings))
|
if (reg >= ZYDIS_ARRAY_SIZE(zydisRegisterStrings))
|
||||||
{
|
{
|
||||||
return ZYDIS_NULL;
|
return ZYDIS_NULL;
|
||||||
}
|
}
|
||||||
return ®isterStrings[reg];
|
return &zydisRegisterStrings[reg];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
|
@ -144,7 +144,7 @@ void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding, ZydisU16 i
|
||||||
/* Operand definition */
|
/* Operand definition */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
ZydisU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
|
ZydisU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
|
||||||
const ZydisOperandDefinition** operand)
|
const ZydisOperandDefinition** operand)
|
||||||
{
|
{
|
||||||
if (definition->operandCount == 0)
|
if (definition->operandCount == 0)
|
||||||
|
|
194
src/String.c
194
src/String.c
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Zyan Disassembler Library (Zydis)
|
Zyan Disassembler Library (Zydis)
|
||||||
|
|
||||||
Original Author : Florian Bernd, Joel Höner
|
Original Author : Florian Bernd, Joel Hoener
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -53,7 +53,7 @@ static const char* decimalLookup =
|
||||||
"60616263646566676869"
|
"60616263646566676869"
|
||||||
"70717273747576777879"
|
"70717273747576777879"
|
||||||
"80818283848586878889"
|
"80818283848586878889"
|
||||||
"90919293949596979899";
|
"90919293949596979899";
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ static const char* decimalLookup =
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#if defined(ZYDIS_X86) || defined(ZYDIS_ARM)
|
#if defined(ZYDIS_X86) || defined(ZYDIS_ARM)
|
||||||
ZydisStatus ZydisPrintDecU32(ZydisString* string, ZydisU32 value, ZydisU8 paddingLength)
|
ZydisStatus ZydisStringAppendDecU32(ZydisString* string, ZydisU32 value, ZydisU8 paddingLength)
|
||||||
{
|
{
|
||||||
ZYDIS_ASSERT(string);
|
ZYDIS_ASSERT(string);
|
||||||
ZYDIS_ASSERT(string->buffer);
|
ZYDIS_ASSERT(string->buffer);
|
||||||
|
@ -84,7 +84,7 @@ ZydisStatus ZydisPrintDecU32(ZydisString* string, ZydisU32 value, ZydisU8 paddin
|
||||||
ZydisMemoryCopy(p, &decimalLookup[value * 2], sizeof(ZydisU16));
|
ZydisMemoryCopy(p, &decimalLookup[value * 2], sizeof(ZydisU16));
|
||||||
|
|
||||||
const ZydisUSize n = &temp[ZYDIS_MAXCHARS_DEC_32] - p;
|
const ZydisUSize n = &temp[ZYDIS_MAXCHARS_DEC_32] - p;
|
||||||
if ((string->capacity - string->length < (ZydisUSize)(n + 1)) ||
|
if ((string->capacity - string->length < (ZydisUSize)(n + 1)) ||
|
||||||
(string->capacity - string->length < (ZydisUSize)(paddingLength + 1)))
|
(string->capacity - string->length < (ZydisUSize)(paddingLength + 1)))
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||||
|
@ -103,7 +103,7 @@ ZydisStatus ZydisPrintDecU32(ZydisString* string, ZydisU32 value, ZydisU8 paddin
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisStatus ZydisPrintHexU32(ZydisString* string, ZydisU32 value, ZydisU8 paddingLength,
|
ZydisStatus ZydisStringAppendHexU32(ZydisString* string, ZydisU32 value, ZydisU8 paddingLength,
|
||||||
ZydisBool uppercase, const ZydisString* prefix, const ZydisString* suffix)
|
ZydisBool uppercase, const ZydisString* prefix, const ZydisString* suffix)
|
||||||
{
|
{
|
||||||
ZYDIS_ASSERT(string);
|
ZYDIS_ASSERT(string);
|
||||||
|
@ -113,7 +113,7 @@ ZydisStatus ZydisPrintHexU32(ZydisString* string, ZydisU32 value, ZydisU8 paddin
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppend(string, prefix));
|
ZYDIS_CHECK(ZydisStringAppend(string, prefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
char* buffer = string->buffer + string->length;
|
char* buffer = string->buffer + string->length;
|
||||||
const ZydisUSize remaining = string->capacity - string->length;
|
const ZydisUSize remaining = string->capacity - string->length;
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ ZydisStatus ZydisPrintHexU32(ZydisString* string, ZydisU32 value, ZydisU8 paddin
|
||||||
|
|
||||||
ZydisMemorySet(buffer, '0', n);
|
ZydisMemorySet(buffer, '0', n);
|
||||||
string->length += n;
|
string->length += n;
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ ZydisStatus ZydisPrintHexU32(ZydisString* string, ZydisU32 value, ZydisU8 paddin
|
||||||
if (remaining <= (ZydisU8)(i + 1)) // TODO: +1?
|
if (remaining <= (ZydisU8)(i + 1)) // TODO: +1?
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
if (paddingLength > i)
|
if (paddingLength > i)
|
||||||
{
|
{
|
||||||
n = paddingLength - i - 1;
|
n = paddingLength - i - 1;
|
||||||
|
@ -159,24 +159,24 @@ ZydisStatus ZydisPrintHexU32(ZydisString* string, ZydisU32 value, ZydisU8 paddin
|
||||||
}
|
}
|
||||||
if (uppercase)
|
if (uppercase)
|
||||||
{
|
{
|
||||||
buffer[n++] = "0123456789ABCDEF"[v];
|
buffer[n++] = "0123456789ABCDEF"[v];
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
buffer[n++] = "0123456789abcdef"[v];
|
buffer[n++] = "0123456789abcdef"[v];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string->length += n;
|
string->length += n;
|
||||||
|
|
||||||
if (suffix)
|
if (suffix)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppend(string, suffix));
|
ZYDIS_CHECK(ZydisStringAppend(string, suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ZydisStatus ZydisPrintDecU64(ZydisString* string, ZydisU64 value, ZydisU8 paddingLength)
|
ZydisStatus ZydisStringAppendDecU64(ZydisString* string, ZydisU64 value, ZydisU8 paddingLength)
|
||||||
{
|
{
|
||||||
ZYDIS_ASSERT(string);
|
ZYDIS_ASSERT(string);
|
||||||
ZYDIS_ASSERT(string->buffer);
|
ZYDIS_ASSERT(string->buffer);
|
||||||
|
@ -194,7 +194,7 @@ ZydisStatus ZydisPrintDecU64(ZydisString* string, ZydisU64 value, ZydisU8 paddin
|
||||||
ZydisMemoryCopy(p, &decimalLookup[value * 2], sizeof(ZydisU16));
|
ZydisMemoryCopy(p, &decimalLookup[value * 2], sizeof(ZydisU16));
|
||||||
|
|
||||||
const ZydisUSize n = &temp[ZYDIS_MAXCHARS_DEC_64] - p;
|
const ZydisUSize n = &temp[ZYDIS_MAXCHARS_DEC_64] - p;
|
||||||
if ((string->capacity - string->length < (ZydisUSize)(n + 1)) ||
|
if ((string->capacity - string->length < (ZydisUSize)(n + 1)) ||
|
||||||
(string->capacity - string->length < (ZydisUSize)(paddingLength + 1)))
|
(string->capacity - string->length < (ZydisUSize)(paddingLength + 1)))
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||||
|
@ -213,7 +213,7 @@ ZydisStatus ZydisPrintDecU64(ZydisString* string, ZydisU64 value, ZydisU8 paddin
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisStatus ZydisPrintHexU64(ZydisString* string, ZydisU64 value, ZydisU8 paddingLength,
|
ZydisStatus ZydisStringAppendHexU64(ZydisString* string, ZydisU64 value, ZydisU8 paddingLength,
|
||||||
ZydisBool uppercase, const ZydisString* prefix, const ZydisString* suffix)
|
ZydisBool uppercase, const ZydisString* prefix, const ZydisString* suffix)
|
||||||
{
|
{
|
||||||
ZYDIS_ASSERT(string);
|
ZYDIS_ASSERT(string);
|
||||||
|
@ -223,7 +223,7 @@ ZydisStatus ZydisPrintHexU64(ZydisString* string, ZydisU64 value, ZydisU8 paddin
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppend(string, prefix));
|
ZYDIS_CHECK(ZydisStringAppend(string, prefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
char* buffer = string->buffer + string->length;
|
char* buffer = string->buffer + string->length;
|
||||||
const ZydisUSize remaining = string->capacity - string->length;
|
const ZydisUSize remaining = string->capacity - string->length;
|
||||||
|
|
||||||
|
@ -243,12 +243,12 @@ ZydisStatus ZydisPrintHexU64(ZydisString* string, ZydisU64 value, ZydisU8 paddin
|
||||||
|
|
||||||
ZydisMemorySet(buffer, '0', n);
|
ZydisMemorySet(buffer, '0', n);
|
||||||
string->length += n;
|
string->length += n;
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisU8 n = 0;
|
ZydisU8 n = 0;
|
||||||
const ZydisU8 c =
|
const ZydisU8 c =
|
||||||
((value & 0xFFFFFFFF00000000) ? ZYDIS_MAXCHARS_HEX_64 : ZYDIS_MAXCHARS_HEX_32);
|
((value & 0xFFFFFFFF00000000) ? ZYDIS_MAXCHARS_HEX_64 : ZYDIS_MAXCHARS_HEX_32);
|
||||||
for (ZydisI8 i = c - 1; i >= 0; --i)
|
for (ZydisI8 i = c - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
|
@ -262,7 +262,7 @@ ZydisStatus ZydisPrintHexU64(ZydisString* string, ZydisU64 value, ZydisU8 paddin
|
||||||
if (remaining <= (ZydisU8)(i + 1)) // TODO: +1?
|
if (remaining <= (ZydisU8)(i + 1)) // TODO: +1?
|
||||||
{
|
{
|
||||||
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
if (paddingLength > i)
|
if (paddingLength > i)
|
||||||
{
|
{
|
||||||
n = paddingLength - i - 1;
|
n = paddingLength - i - 1;
|
||||||
|
@ -271,17 +271,17 @@ ZydisStatus ZydisPrintHexU64(ZydisString* string, ZydisU64 value, ZydisU8 paddin
|
||||||
}
|
}
|
||||||
if (uppercase)
|
if (uppercase)
|
||||||
{
|
{
|
||||||
buffer[n++] = "0123456789ABCDEF"[v];
|
buffer[n++] = "0123456789ABCDEF"[v];
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
buffer[n++] = "0123456789abcdef"[v];
|
buffer[n++] = "0123456789abcdef"[v];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string->length += n;
|
string->length += n;
|
||||||
|
|
||||||
if (suffix)
|
if (suffix)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppend(string, suffix));
|
ZYDIS_CHECK(ZydisStringAppend(string, suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
|
@ -297,7 +297,44 @@ ZydisStatus ZydisPrintHexU64(ZydisString* string, ZydisU64 value, ZydisU8 paddin
|
||||||
/* Basic Operations */
|
/* Basic Operations */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
ZydisStatus ZydisStringAppendEx(ZydisString* string, const ZydisString* text,
|
ZydisStatus ZydisStringInit(ZydisString* string, char* text)
|
||||||
|
{
|
||||||
|
if (!string || !text)
|
||||||
|
{
|
||||||
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ZydisUSize length = ZydisStrLen(text);
|
||||||
|
string->buffer = text;
|
||||||
|
string->length = length;
|
||||||
|
string->capacity = length;
|
||||||
|
|
||||||
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringFinalize(ZydisString* string)
|
||||||
|
{
|
||||||
|
if (!string)
|
||||||
|
{
|
||||||
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
if (string->length >= string->capacity)
|
||||||
|
{
|
||||||
|
return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
string->buffer[string->length] = 0;
|
||||||
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringAppend(ZydisString* string, const ZydisString* text)
|
||||||
|
{
|
||||||
|
return ZydisStringAppendEx(string, text, ZYDIS_LETTER_CASE_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringAppendEx(ZydisString* string, const ZydisString* text,
|
||||||
ZydisLetterCase letterCase)
|
ZydisLetterCase letterCase)
|
||||||
{
|
{
|
||||||
if (!string || !text)
|
if (!string || !text)
|
||||||
|
@ -351,52 +388,99 @@ ZydisStatus ZydisStringAppendEx(ZydisString* string, const ZydisString* text,
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringAppendC(ZydisString* string, const char* text)
|
||||||
|
{
|
||||||
|
ZydisString other;
|
||||||
|
ZYDIS_CHECK(ZydisStringInit(&other, (char*)text));
|
||||||
|
|
||||||
|
return ZydisStringAppendEx(string, &other, ZYDIS_LETTER_CASE_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringAppendExC(ZydisString* string, const char* text, ZydisLetterCase letterCase)
|
||||||
|
{
|
||||||
|
ZydisString other;
|
||||||
|
ZYDIS_CHECK(ZydisStringInit(&other, (char*)text));
|
||||||
|
|
||||||
|
return ZydisStringAppendEx(string, &other, letterCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringAppendStatic(ZydisString* string, const ZydisStaticString* text,
|
||||||
|
ZydisLetterCase letterCase)
|
||||||
|
{
|
||||||
|
if (!text || !text->buffer)
|
||||||
|
{
|
||||||
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisString other;
|
||||||
|
other.buffer = (char*)text->buffer;
|
||||||
|
other.length = text->length;
|
||||||
|
|
||||||
|
return ZydisStringAppendEx(string, &other, letterCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringAppendExStatic(ZydisString* string, const ZydisStaticString* text,
|
||||||
|
ZydisLetterCase letterCase)
|
||||||
|
{
|
||||||
|
if (!text || !text->buffer)
|
||||||
|
{
|
||||||
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisString other;
|
||||||
|
other.buffer = (char*)text->buffer;
|
||||||
|
other.length = text->length;
|
||||||
|
|
||||||
|
return ZydisStringAppendEx(string, &other, letterCase);
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
/* Formatting */
|
/* Formatting */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
ZydisStatus ZydisPrintDecU(ZydisString* string, ZydisU64 value, ZydisU8 paddingLength)
|
ZydisStatus ZydisStringAppendDecU(ZydisString* string, ZydisU64 value, ZydisU8 paddingLength)
|
||||||
{
|
{
|
||||||
#if defined(ZYDIS_X64) || defined(ZYDIS_AARCH64)
|
#if defined(ZYDIS_X64) || defined(ZYDIS_AARCH64)
|
||||||
return ZydisPrintDecU64(string, value, paddingLength);
|
return ZydisStringAppendDecU64(string, value, paddingLength);
|
||||||
#else
|
#else
|
||||||
if (value & 0xFFFFFFFF00000000)
|
if (value & 0xFFFFFFFF00000000)
|
||||||
{
|
{
|
||||||
return ZydisPrintDecU64(string, value, paddingLength);
|
return ZydisStringAppendDecU64(string, value, paddingLength);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
return ZydisPrintDecU32(string, (ZydisU32)value, paddingLength);
|
return ZydisStringAppendDecU32(string, (ZydisU32)value, paddingLength);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
ZydisStatus ZydisPrintDecS(ZydisString* string, ZydisI64 value, ZydisU8 paddingLength)
|
|
||||||
{
|
|
||||||
if (value < 0)
|
|
||||||
{
|
|
||||||
ZYDIS_CHECK(ZydisStringAppendC(string, "-"));
|
|
||||||
return ZydisPrintDecU(string, -value, paddingLength);
|
|
||||||
}
|
|
||||||
return ZydisPrintDecU(string, value, paddingLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZydisStatus ZydisPrintHexU(ZydisString* string, ZydisU64 value, ZydisU8 paddingLength,
|
|
||||||
ZydisBool uppercase, const ZydisString* prefix, const ZydisString* suffix)
|
|
||||||
{
|
|
||||||
#if defined(ZYDIS_X64) || defined(ZYDIS_AARCH64)
|
|
||||||
return ZydisPrintHexU64(string, value, paddingLength, uppercase, prefix, suffix);
|
|
||||||
#else
|
|
||||||
if (value & 0xFFFFFFFF00000000)
|
|
||||||
{
|
|
||||||
return ZydisPrintHexU64(string, value, paddingLength, uppercase, prefix, suffix);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return ZydisPrintHexU32(string, (ZydisU32)value, paddingLength, uppercase, prefix, suffix);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisStatus ZydisPrintHexS(ZydisString* string, ZydisI64 value, ZydisU8 paddingLength,
|
ZydisStatus ZydisStringAppendDecS(ZydisString* string, ZydisI64 value, ZydisU8 paddingLength)
|
||||||
|
{
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
ZYDIS_CHECK(ZydisStringAppendC(string, "-"));
|
||||||
|
return ZydisStringAppendDecU(string, -value, paddingLength);
|
||||||
|
}
|
||||||
|
return ZydisStringAppendDecU(string, value, paddingLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringAppendHexU(ZydisString* string, ZydisU64 value, ZydisU8 paddingLength,
|
||||||
|
ZydisBool uppercase, const ZydisString* prefix, const ZydisString* suffix)
|
||||||
|
{
|
||||||
|
#if defined(ZYDIS_X64) || defined(ZYDIS_AARCH64)
|
||||||
|
return ZydisStringAppendHexU64(string, value, paddingLength, uppercase, prefix, suffix);
|
||||||
|
#else
|
||||||
|
if (value & 0xFFFFFFFF00000000)
|
||||||
|
{
|
||||||
|
return ZydisStringAppendHexU64(string, value, paddingLength, uppercase, prefix, suffix);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return ZydisStringAppendHexU32(
|
||||||
|
string, (ZydisU32)value, paddingLength, uppercase, prefix, suffix);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
ZydisStatus ZydisStringAppendHexS(ZydisString* string, ZydisI64 value, ZydisU8 paddingLength,
|
||||||
ZydisBool uppercase, const ZydisString* prefix, const ZydisString* suffix)
|
ZydisBool uppercase, const ZydisString* prefix, const ZydisString* suffix)
|
||||||
{
|
{
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
|
@ -406,9 +490,9 @@ ZydisStatus ZydisPrintHexS(ZydisString* string, ZydisI64 value, ZydisU8 paddingL
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisStringAppend(string, prefix));
|
ZYDIS_CHECK(ZydisStringAppend(string, prefix));
|
||||||
}
|
}
|
||||||
return ZydisPrintHexU(string, -value, paddingLength, uppercase, ZYDIS_NULL, suffix);
|
return ZydisStringAppendHexU(string, -value, paddingLength, uppercase, ZYDIS_NULL, suffix);
|
||||||
}
|
}
|
||||||
return ZydisPrintHexU(string, value, paddingLength, uppercase, prefix, suffix);
|
return ZydisStringAppendHexU(string, value, paddingLength, uppercase, prefix, suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
18
src/Utils.c
18
src/Utils.c
|
@ -34,7 +34,7 @@
|
||||||
/* Exported functions */
|
/* Exported functions */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||||
const ZydisDecodedOperand* operand, ZydisU64* address)
|
const ZydisDecodedOperand* operand, ZydisU64* address)
|
||||||
{
|
{
|
||||||
if (!instruction || !operand || !address)
|
if (!instruction || !operand || !address)
|
||||||
|
@ -50,15 +50,15 @@ ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||||
}
|
}
|
||||||
if (operand->mem.base == ZYDIS_REGISTER_EIP)
|
if (operand->mem.base == ZYDIS_REGISTER_EIP)
|
||||||
{
|
{
|
||||||
*address = (ZydisU64)((ZydisU32)instruction->instrAddress + instruction->length +
|
*address = ((ZydisU32)instruction->instrAddress + instruction->length +
|
||||||
(ZydisU32)operand->mem.disp.value);
|
(ZydisU32)operand->mem.disp.value);
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
if (operand->mem.base == ZYDIS_REGISTER_RIP)
|
if (operand->mem.base == ZYDIS_REGISTER_RIP)
|
||||||
{
|
{
|
||||||
*address = (ZydisU64)(instruction->instrAddress + instruction->length +
|
*address = (ZydisU64)(instruction->instrAddress + instruction->length +
|
||||||
operand->mem.disp.value);
|
operand->mem.disp.value);
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
if ((operand->mem.base == ZYDIS_REGISTER_NONE) &&
|
if ((operand->mem.base == ZYDIS_REGISTER_NONE) &&
|
||||||
(operand->mem.index == ZYDIS_REGISTER_NONE))
|
(operand->mem.index == ZYDIS_REGISTER_NONE))
|
||||||
|
@ -76,13 +76,13 @@ ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||||
if (operand->imm.isSigned && operand->imm.isRelative)
|
if (operand->imm.isSigned && operand->imm.isRelative)
|
||||||
{
|
{
|
||||||
*address = (ZydisU64)((ZydisI64)instruction->instrAddress + instruction->length +
|
*address = (ZydisU64)((ZydisI64)instruction->instrAddress + instruction->length +
|
||||||
operand->imm.value.s);
|
operand->imm.value.s);
|
||||||
switch (instruction->machineMode)
|
switch (instruction->machineMode)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||||
default:
|
default:
|
||||||
return ZYDIS_STATUS_INVALID_PARAMETER;
|
return ZYDIS_STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -120,7 +120,7 @@ ZydisStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||||
/* Exported functions */
|
/* Exported functions */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
ZydisStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruction,
|
ZydisStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruction,
|
||||||
ZydisCPUFlagAction action, ZydisCPUFlagMask* flags)
|
ZydisCPUFlagAction action, ZydisCPUFlagMask* flags)
|
||||||
{
|
{
|
||||||
if (!instruction)
|
if (!instruction)
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,8 @@
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
|
|
||||||
Zyan Disassembler Engine (Zydis)
|
Zyan Disassembler Library (Zydis)
|
||||||
|
|
||||||
Original Author : Florian Bernd, Joel Höner
|
Original Author : Florian Bernd, Joel Hoener
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -50,7 +50,7 @@ int main(int argc, char** argv)
|
||||||
fprintf(stderr, "Usage: %s [input file]\n", (argc > 0 ? argv[0] : "ZydisDisasm"));
|
fprintf(stderr, "Usage: %s [input file]\n", (argc > 0 ? argv[0] : "ZydisDisasm"));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* file = argc >= 2 ? fopen(argv[1], "rb") : stdin;
|
FILE* file = argc >= 2 ? fopen(argv[1], "rb") : stdin;
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
|
@ -68,9 +68,9 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
ZydisFormatter formatter;
|
ZydisFormatter formatter;
|
||||||
if (!ZYDIS_SUCCESS(ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL)) ||
|
if (!ZYDIS_SUCCESS(ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL)) ||
|
||||||
!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter,
|
!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter,
|
||||||
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG, ZYDIS_TRUE)) ||
|
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG, ZYDIS_TRUE)) ||
|
||||||
!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter,
|
!ZYDIS_SUCCESS(ZydisFormatterSetProperty(&formatter,
|
||||||
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE, ZYDIS_TRUE)))
|
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE, ZYDIS_TRUE)))
|
||||||
{
|
{
|
||||||
fputs("Failed to initialized instruction-formatter\n", stderr);
|
fputs("Failed to initialized instruction-formatter\n", stderr);
|
||||||
|
@ -82,11 +82,11 @@ int main(int argc, char** argv)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
numBytesRead = fread(readBuf, 1, sizeof(readBuf), file);
|
numBytesRead = fread(readBuf, 1, sizeof(readBuf), file);
|
||||||
|
|
||||||
ZydisDecodedInstruction instruction;
|
ZydisDecodedInstruction instruction;
|
||||||
ZydisStatus status;
|
ZydisStatus status;
|
||||||
size_t readOffs = 0;
|
size_t readOffs = 0;
|
||||||
while ((status = ZydisDecoderDecodeBuffer(&decoder, readBuf + readOffs,
|
while ((status = ZydisDecoderDecodeBuffer(&decoder, readBuf + readOffs,
|
||||||
numBytesRead - readOffs, readOffs, &instruction)) != ZYDIS_STATUS_NO_MORE_DATA)
|
numBytesRead - readOffs, readOffs, &instruction)) != ZYDIS_STATUS_NO_MORE_DATA)
|
||||||
{
|
{
|
||||||
if (!ZYDIS_SUCCESS(status))
|
if (!ZYDIS_SUCCESS(status))
|
||||||
|
@ -133,10 +133,10 @@ int main(int argc, char** argv)
|
||||||
ZYDIS_ASSERT(!memcmp(encBuffer, readBuf + readOffs, encBufferSize));
|
ZYDIS_ASSERT(!memcmp(encBuffer, readBuf + readOffs, encBufferSize));
|
||||||
#endif
|
#endif
|
||||||
// DEBUG CODE END
|
// DEBUG CODE END
|
||||||
|
|
||||||
readOffs += instruction.length;
|
readOffs += instruction.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readOffs < sizeof(readBuf))
|
if (readOffs < sizeof(readBuf))
|
||||||
{
|
{
|
||||||
memmove(readBuf, readBuf + readOffs, sizeof(readBuf) - readOffs);
|
memmove(readBuf, readBuf + readOffs, sizeof(readBuf) - readOffs);
|
||||||
|
|
|
@ -92,7 +92,7 @@ void printOperands(ZydisDecodedInstruction* instruction)
|
||||||
static const char* operandVisibilities[] =
|
static const char* operandVisibilities[] =
|
||||||
{
|
{
|
||||||
"INVALID",
|
"INVALID",
|
||||||
"EXPLICIT",
|
"EXPLICIT",
|
||||||
"IMPLICIT",
|
"IMPLICIT",
|
||||||
"HIDDEN"
|
"HIDDEN"
|
||||||
};
|
};
|
||||||
|
@ -164,7 +164,7 @@ void printOperands(ZydisDecodedInstruction* instruction)
|
||||||
"AGEN",
|
"AGEN",
|
||||||
"MIB"
|
"MIB"
|
||||||
};
|
};
|
||||||
printf("%2d %9s %10s %6s %12s %5d %4d %6d %8s",
|
printf("%2d %9s %10s %6s %12s %5d %4d %6d %8s",
|
||||||
i,
|
i,
|
||||||
operandTypes[instruction->operands[i].type],
|
operandTypes[instruction->operands[i].type],
|
||||||
operandVisibilities[instruction->operands[i].visibility],
|
operandVisibilities[instruction->operands[i].visibility],
|
||||||
|
@ -172,7 +172,7 @@ void printOperands(ZydisDecodedInstruction* instruction)
|
||||||
operandEncodings[instruction->operands[i].encoding],
|
operandEncodings[instruction->operands[i].encoding],
|
||||||
instruction->operands[i].size,
|
instruction->operands[i].size,
|
||||||
instruction->operands[i].elementCount,
|
instruction->operands[i].elementCount,
|
||||||
instruction->operands[i].elementSize,
|
instruction->operands[i].elementSize,
|
||||||
elementTypes[instruction->operands[i].elementType]);
|
elementTypes[instruction->operands[i].elementType]);
|
||||||
switch (instruction->operands[i].type)
|
switch (instruction->operands[i].type)
|
||||||
{
|
{
|
||||||
|
@ -181,14 +181,14 @@ void printOperands(ZydisDecodedInstruction* instruction)
|
||||||
break;
|
break;
|
||||||
case ZYDIS_OPERAND_TYPE_MEMORY:
|
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||||
printf(" TYPE =%20s\n", memopTypes[instruction->operands[i].mem.type]);
|
printf(" TYPE =%20s\n", memopTypes[instruction->operands[i].mem.type]);
|
||||||
printf(" %84s =%20s\n",
|
printf(" %84s =%20s\n",
|
||||||
"SEG ", ZydisRegisterGetString(instruction->operands[i].mem.segment));
|
"SEG ", ZydisRegisterGetString(instruction->operands[i].mem.segment));
|
||||||
printf(" %84s =%20s\n",
|
printf(" %84s =%20s\n",
|
||||||
"BASE ", ZydisRegisterGetString(instruction->operands[i].mem.base));
|
"BASE ", ZydisRegisterGetString(instruction->operands[i].mem.base));
|
||||||
printf(" %84s =%20s\n",
|
printf(" %84s =%20s\n",
|
||||||
"INDEX", ZydisRegisterGetString(instruction->operands[i].mem.index));
|
"INDEX", ZydisRegisterGetString(instruction->operands[i].mem.index));
|
||||||
printf(" %84s =%20d\n", "SCALE", instruction->operands[i].mem.scale);
|
printf(" %84s =%20d\n", "SCALE", instruction->operands[i].mem.scale);
|
||||||
printf(" %84s = 0x%016"PRIX64,
|
printf(" %84s = 0x%016"PRIX64,
|
||||||
"DISP ", instruction->operands[i].mem.disp.value);
|
"DISP ", instruction->operands[i].mem.disp.value);
|
||||||
break;
|
break;
|
||||||
case ZYDIS_OPERAND_TYPE_POINTER:
|
case ZYDIS_OPERAND_TYPE_POINTER:
|
||||||
|
@ -196,19 +196,19 @@ void printOperands(ZydisDecodedInstruction* instruction)
|
||||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||||
if (instruction->operands[i].imm.isSigned)
|
if (instruction->operands[i].imm.isSigned)
|
||||||
{
|
{
|
||||||
printf(" (%s %s %2d) 0x%016" PRIX64,
|
printf(" (%s %s %2d) 0x%016" PRIX64,
|
||||||
instruction->operands[i].imm.isSigned ? "S" : "U",
|
instruction->operands[i].imm.isSigned ? "S" : "U",
|
||||||
instruction->operands[i].imm.isRelative ? "R" : "_",
|
instruction->operands[i].imm.isRelative ? "R" : "_",
|
||||||
instruction->raw.imm[immId].size,
|
instruction->raw.imm[immId].size,
|
||||||
instruction->operands[i].imm.value.s);
|
instruction->operands[i].imm.value.s);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
printf(" SIGN =%20s\n", instruction->operands[i].imm.isSigned ? "Y" : "N");
|
printf(" SIGN =%20s\n", instruction->operands[i].imm.isSigned ? "Y" : "N");
|
||||||
printf(" %84s =%20s\n",
|
printf(" %84s =%20s\n",
|
||||||
"REL ", instruction->operands[i].imm.isRelative ? "Y" : "N");
|
"REL ", instruction->operands[i].imm.isRelative ? "Y" : "N");
|
||||||
printf(" %84s = %2d\n",
|
printf(" %84s = %2d\n",
|
||||||
"SIZE ", instruction->raw.imm[immId].size);
|
"SIZE ", instruction->raw.imm[immId].size);
|
||||||
printf(" %84s = 0x%016" PRIX64,
|
printf(" %84s = 0x%016" PRIX64,
|
||||||
"VALUE", instruction->operands[i].imm.value.u);
|
"VALUE", instruction->operands[i].imm.value.u);
|
||||||
}
|
}
|
||||||
++immId;
|
++immId;
|
||||||
|
@ -219,7 +219,7 @@ void printOperands(ZydisDecodedInstruction* instruction)
|
||||||
puts("");
|
puts("");
|
||||||
}
|
}
|
||||||
fputs("-- --------- ---------- ------ ------------ ---- ----- ------", stdout);
|
fputs("-- --------- ---------- ------ ------------ ---- ----- ------", stdout);
|
||||||
fputs(" -------- ---------------------------\n", stdout);
|
fputs(" -------- ---------------------------\n", stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printFlags(ZydisDecodedInstruction* instruction)
|
void printFlags(ZydisDecodedInstruction* instruction)
|
||||||
|
@ -351,7 +351,7 @@ void printAVXInfo(ZydisDecodedInstruction* instruction)
|
||||||
fputs("=======================================\n", stdout);
|
fputs("=======================================\n", stdout);
|
||||||
|
|
||||||
printf(" VECTORLEN: %03d\n", instruction->avx.vectorLength);
|
printf(" VECTORLEN: %03d\n", instruction->avx.vectorLength);
|
||||||
printf(" BROADCAST: %s%s", broadcastStrings[instruction->avx.broadcast.mode],
|
printf(" BROADCAST: %s%s", broadcastStrings[instruction->avx.broadcast.mode],
|
||||||
instruction->avx.broadcast.isStatic ? " (static)" : "");
|
instruction->avx.broadcast.isStatic ? " (static)" : "");
|
||||||
|
|
||||||
switch (instruction->encoding)
|
switch (instruction->encoding)
|
||||||
|
@ -359,8 +359,8 @@ void printAVXInfo(ZydisDecodedInstruction* instruction)
|
||||||
case ZYDIS_INSTRUCTION_ENCODING_EVEX:
|
case ZYDIS_INSTRUCTION_ENCODING_EVEX:
|
||||||
printf("\n ROUNDING: %s", roundingModeStrings[instruction->avx.rounding.mode]);
|
printf("\n ROUNDING: %s", roundingModeStrings[instruction->avx.rounding.mode]);
|
||||||
printf("\n SAE: %s", instruction->avx.hasSAE ? "Y" : "N");
|
printf("\n SAE: %s", instruction->avx.hasSAE ? "Y" : "N");
|
||||||
printf("\n MASK: %s [%5s]%s", ZydisRegisterGetString(instruction->avx.mask.reg),
|
printf("\n MASK: %s [%5s]%s", ZydisRegisterGetString(instruction->avx.mask.reg),
|
||||||
maskModeStrings[instruction->avx.mask.mode],
|
maskModeStrings[instruction->avx.mask.mode],
|
||||||
instruction->avx.mask.isControlMask ? " (control-mask)" : "");
|
instruction->avx.mask.isControlMask ? " (control-mask)" : "");
|
||||||
break;
|
break;
|
||||||
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
|
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
|
||||||
|
@ -450,10 +450,10 @@ void printInstruction(ZydisDecodedInstruction* instruction)
|
||||||
{
|
{
|
||||||
ZydisInstructionAttributes attrMask;
|
ZydisInstructionAttributes attrMask;
|
||||||
const char* str;
|
const char* str;
|
||||||
} attributeMap[] =
|
} attributeMap[] =
|
||||||
{
|
{
|
||||||
{ ZYDIS_ATTRIB_HAS_MODRM, "HAS_MODRM" },
|
{ ZYDIS_ATTRIB_HAS_MODRM, "HAS_MODRM" },
|
||||||
{ ZYDIS_ATTRIB_HAS_SIB, "HAS_SIB" },
|
{ ZYDIS_ATTRIB_HAS_SIB, "HAS_SIB" },
|
||||||
{ ZYDIS_ATTRIB_HAS_REX, "HAS_REX" },
|
{ ZYDIS_ATTRIB_HAS_REX, "HAS_REX" },
|
||||||
{ ZYDIS_ATTRIB_HAS_XOP, "HAS_XOP" },
|
{ ZYDIS_ATTRIB_HAS_XOP, "HAS_XOP" },
|
||||||
{ ZYDIS_ATTRIB_HAS_VEX, "HAS_VEX" },
|
{ ZYDIS_ATTRIB_HAS_VEX, "HAS_VEX" },
|
||||||
|
@ -498,7 +498,7 @@ void printInstruction(ZydisDecodedInstruction* instruction)
|
||||||
|
|
||||||
fputs("== [ BASIC ] =====================================================", stdout);
|
fputs("== [ BASIC ] =====================================================", stdout);
|
||||||
fputs("=======================================\n", stdout);
|
fputs("=======================================\n", stdout);
|
||||||
printf(" MNEMONIC: %s [ENC: %s, MAP: %s, OPC: %02X]\n",
|
printf(" MNEMONIC: %s [ENC: %s, MAP: %s, OPC: %02X]\n",
|
||||||
ZydisMnemonicGetString(instruction->mnemonic),
|
ZydisMnemonicGetString(instruction->mnemonic),
|
||||||
instructionEncodingStrings[instruction->encoding],
|
instructionEncodingStrings[instruction->encoding],
|
||||||
opcodeMapStrings[instruction->opcodeMap],
|
opcodeMapStrings[instruction->opcodeMap],
|
||||||
|
@ -511,7 +511,7 @@ void printInstruction(ZydisDecodedInstruction* instruction)
|
||||||
printf(" ISA-SET: %s\n", ZydisISASetGetString(instruction->meta.isaSet));
|
printf(" ISA-SET: %s\n", ZydisISASetGetString(instruction->meta.isaSet));
|
||||||
printf(" ISA-EXT: %s\n", ZydisISAExtGetString(instruction->meta.isaExt));
|
printf(" ISA-EXT: %s\n", ZydisISAExtGetString(instruction->meta.isaExt));
|
||||||
printf(" EXCEPTIONS: %s\n", exceptionClassStrings[instruction->meta.exceptionClass]);
|
printf(" EXCEPTIONS: %s\n", exceptionClassStrings[instruction->meta.exceptionClass]);
|
||||||
|
|
||||||
if (instruction->attributes)
|
if (instruction->attributes)
|
||||||
{
|
{
|
||||||
fputs (" ATTRIBUTES: ", stdout);
|
fputs (" ATTRIBUTES: ", stdout);
|
||||||
|
@ -524,13 +524,13 @@ void printInstruction(ZydisDecodedInstruction* instruction)
|
||||||
}
|
}
|
||||||
fputs("\n", stdout);
|
fputs("\n", stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instruction->operandCount > 0)
|
if (instruction->operandCount > 0)
|
||||||
{
|
{
|
||||||
puts("");
|
puts("");
|
||||||
printOperands(instruction);
|
printOperands(instruction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZydisRegisterGetClass(
|
if (ZydisRegisterGetClass(
|
||||||
instruction->operands[instruction->operandCount - 1].reg.value) == ZYDIS_REGCLASS_FLAGS)
|
instruction->operands[instruction->operandCount - 1].reg.value) == ZYDIS_REGCLASS_FLAGS)
|
||||||
{
|
{
|
||||||
|
@ -550,9 +550,9 @@ void printInstruction(ZydisDecodedInstruction* instruction)
|
||||||
ZydisStatus status;
|
ZydisStatus status;
|
||||||
ZydisFormatter formatter;
|
ZydisFormatter formatter;
|
||||||
if (!ZYDIS_SUCCESS((status = ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL))) ||
|
if (!ZYDIS_SUCCESS((status = ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL))) ||
|
||||||
!ZYDIS_SUCCESS((status = ZydisFormatterSetProperty(&formatter,
|
!ZYDIS_SUCCESS((status = ZydisFormatterSetProperty(&formatter,
|
||||||
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG, ZYDIS_TRUE))) ||
|
ZYDIS_FORMATTER_PROP_FORCE_MEMSEG, ZYDIS_TRUE))) ||
|
||||||
!ZYDIS_SUCCESS((status = ZydisFormatterSetProperty(&formatter,
|
!ZYDIS_SUCCESS((status = ZydisFormatterSetProperty(&formatter,
|
||||||
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE, ZYDIS_TRUE))))
|
ZYDIS_FORMATTER_PROP_FORCE_MEMSIZE, ZYDIS_TRUE))))
|
||||||
{
|
{
|
||||||
fputs("Failed to initialize instruction-formatter\n", stderr);
|
fputs("Failed to initialize instruction-formatter\n", stderr);
|
||||||
|
@ -586,19 +586,19 @@ int main(int argc, char** argv)
|
||||||
ZydisDecoder decoder;
|
ZydisDecoder decoder;
|
||||||
if (!strcmp(argv[1], "-real"))
|
if (!strcmp(argv[1], "-real"))
|
||||||
{
|
{
|
||||||
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_REAL_16, ZYDIS_ADDRESS_WIDTH_16);
|
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_REAL_16, ZYDIS_ADDRESS_WIDTH_16);
|
||||||
} else
|
} else
|
||||||
if (!strcmp(argv[1], "-16"))
|
if (!strcmp(argv[1], "-16"))
|
||||||
{
|
{
|
||||||
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_COMPAT_16, ZYDIS_ADDRESS_WIDTH_16);
|
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_COMPAT_16, ZYDIS_ADDRESS_WIDTH_16);
|
||||||
} else
|
} else
|
||||||
if (!strcmp(argv[1], "-32"))
|
if (!strcmp(argv[1], "-32"))
|
||||||
{
|
{
|
||||||
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_COMPAT_32, ZYDIS_ADDRESS_WIDTH_32);
|
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_COMPAT_32, ZYDIS_ADDRESS_WIDTH_32);
|
||||||
} else
|
} else
|
||||||
if (!strcmp(argv[1], "-64"))
|
if (!strcmp(argv[1], "-64"))
|
||||||
{
|
{
|
||||||
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_ADDRESS_WIDTH_64);
|
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_ADDRESS_WIDTH_64);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
fputs("Usage: ZydisInfo -[real|16|32|64] [hexbytes]\n", stderr);
|
fputs("Usage: ZydisInfo -[real|16|32|64] [hexbytes]\n", stderr);
|
||||||
|
@ -631,7 +631,7 @@ int main(int argc, char** argv)
|
||||||
data[length] = (uint8_t)value;
|
data[length] = (uint8_t)value;
|
||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZydisDecodedInstruction instruction;
|
ZydisDecodedInstruction instruction;
|
||||||
ZydisStatus status = ZydisDecoderDecodeBuffer(&decoder, &data, length, 0, &instruction);
|
ZydisStatus status = ZydisDecoderDecodeBuffer(&decoder, &data, length, 0, &instruction);
|
||||||
|
@ -639,8 +639,8 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
if (status >= ZYDIS_STATUS_USER)
|
if (status >= ZYDIS_STATUS_USER)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Could not decode instruction: User defined status code 0x%" PRIx32, status);
|
"Could not decode instruction: User defined status code 0x%" PRIx32, status);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not decode instruction: %s", ZydisFormatStatus(status));
|
fprintf(stderr, "Could not decode instruction: %s", ZydisFormatStatus(status));
|
||||||
|
|
Loading…
Reference in New Issue