3rdparty: Update Zydis to v4.1.1

This commit is contained in:
chaoticgd 2025-07-03 23:20:35 +01:00 committed by Ty
parent 6c3ea29157
commit ff01a6359b
78 changed files with 31666 additions and 14436 deletions

View File

@ -1,10 +1,5 @@
add_library(zydis
dependencies/zycore/src/Allocator.c
dependencies/zycore/src/API/Memory.c
dependencies/zycore/src/API/Process.c
dependencies/zycore/src/API/Synchronization.c
dependencies/zycore/src/API/Terminal.c
dependencies/zycore/src/API/Thread.c
dependencies/zycore/src/ArgParse.c
dependencies/zycore/src/Bitset.c
dependencies/zycore/src/Format.c
@ -12,34 +7,51 @@ add_library(zydis
dependencies/zycore/src/String.c
dependencies/zycore/src/Vector.c
dependencies/zycore/src/Zycore.c
dependencies/zycore/src/API/Memory.c
dependencies/zycore/src/API/Process.c
dependencies/zycore/src/API/Synchronization.c
dependencies/zycore/src/API/Terminal.c
dependencies/zycore/src/API/Thread.c
src/Decoder.c
src/DecoderData.c
src/Formatter.c
src/Disassembler.c
src/Encoder.c
src/EncoderData.c
src/FormatterATT.c
src/FormatterBase.c
src/FormatterBuffer.c
src/Formatter.c
src/FormatterIntel.c
src/MetaInfo.c
src/Mnemonic.c
src/Register.c
src/Segment.c
src/SharedData.c
src/String.c
src/Utils.c
src/Zydis.c
src/Generated/AccessedFlags.inc
src/Generated/DecoderTables.inc
src/Generated/EncoderTables.inc
src/Generated/EnumInstructionCategory.inc
src/Generated/EnumISAExt.inc
src/Generated/EnumISASet.inc
src/Generated/EnumMnemonic.inc
src/Generated/EnumRegister.inc
src/Generated/FormatterStrings.inc
src/Generated/GetRelInfo.inc
src/Generated/InstructionDefinitions.inc
src/Generated/InstructionEncodings.inc
src/Generated/OperandDefinitions.inc
src/Generated/RegisterClassLookup.inc
src/Generated/RegisterLookup.inc
dependencies/zycore/include/Zycore/Allocator.h
dependencies/zycore/include/Zycore/API/Memory.h
dependencies/zycore/include/Zycore/API/Process.h
dependencies/zycore/include/Zycore/API/Synchronization.h
dependencies/zycore/include/Zycore/API/Terminal.h
dependencies/zycore/include/Zycore/API/Thread.h
dependencies/zycore/include/Zycore/ArgParse.h
dependencies/zycore/include/Zycore/Atomic.h
dependencies/zycore/include/Zycore/Bitset.h
dependencies/zycore/include/Zycore/Comparison.h
dependencies/zycore/include/Zycore/Defines.h
dependencies/zycore/include/Zycore/Format.h
dependencies/zycore/include/Zycore/Internal/AtomicGNU.h
dependencies/zycore/include/Zycore/Internal/AtomicMSVC.h
dependencies/zycore/include/Zycore/LibC.h
dependencies/zycore/include/Zycore/List.h
dependencies/zycore/include/Zycore/Object.h
@ -48,34 +60,46 @@ add_library(zydis
dependencies/zycore/include/Zycore/Types.h
dependencies/zycore/include/Zycore/Vector.h
dependencies/zycore/include/Zycore/Zycore.h
dependencies/zycore/include/Zycore/API/Memory.h
dependencies/zycore/include/Zycore/API/Process.h
dependencies/zycore/include/Zycore/API/Synchronization.h
dependencies/zycore/include/Zycore/API/Terminal.h
dependencies/zycore/include/Zycore/API/Thread.h
dependencies/zycore/include/Zycore/Internal/AtomicGNU.h
dependencies/zycore/include/Zycore/Internal/AtomicMSVC.h
include/Zydis/Decoder.h
include/Zydis/DecoderTypes.h
include/Zydis/Formatter.h
include/Zydis/Defines.h
include/Zydis/Disassembler.h
include/Zydis/Encoder.h
include/Zydis/FormatterBuffer.h
include/Zydis/Formatter.h
include/Zydis/MetaInfo.h
include/Zydis/Mnemonic.h
include/Zydis/Register.h
include/Zydis/Segment.h
include/Zydis/SharedTypes.h
include/Zydis/ShortString.h
include/Zydis/Status.h
include/Zydis/Utils.h
include/Zydis/Zydis.h
include/Zydis/Generated/EnumInstructionCategory.h
include/Zydis/Generated/EnumISAExt.h
include/Zydis/Generated/EnumISASet.h
include/Zydis/Generated/EnumMnemonic.h
include/Zydis/Generated/EnumRegister.h
include/Zydis/Internal/DecoderData.h
include/Zydis/Internal/EncoderData.h
include/Zydis/Internal/FormatterATT.h
include/Zydis/Internal/FormatterBase.h
include/Zydis/Internal/FormatterIntel.h
include/Zydis/Internal/SharedData.h
include/Zydis/Internal/String.h
include/Zydis/MetaInfo.h
include/Zydis/Mnemonic.h
include/Zydis/Register.h
include/Zydis/SharedTypes.h
include/Zydis/ShortString.h
include/Zydis/Status.h
include/Zydis/Utils.h
include/Zydis/Zydis.h
)
target_compile_definitions(zydis PUBLIC
ZYCORE_STATIC_DEFINE
ZYDIS_STATIC_DEFINE
ZYCORE_STATIC_BUILD
ZYDIS_STATIC_BUILD
)
target_include_directories(zydis PUBLIC

View File

@ -1,7 +1,7 @@
The MIT License (MIT)
Copyright (c) 2014-2021 Florian Bernd
Copyright (c) 2014-2021 Joel Höner
Copyright (c) 2014-2024 Florian Bernd
Copyright (c) 2014-2024 Joel Höner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,80 +1,48 @@
<p align="center">
<img alt="zydis logo" src="https://zydis.re/img/logo.svg" width="400px">
<a href="https://zydis.re/">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/zyantific/zydis/master/assets/img/logo-dark.svg" width="400px">
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/zyantific/zydis/master/assets/img/logo-light.svg" width="400px">
<img alt="zydis logo" src="https://raw.githubusercontent.com/zyantific/zydis/master/assets/img/logo-dark.svg" width="400px">
</picture>
</a>
</p>
<p align="center">
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT">
<a href="https://github.com/zyantific/zydis/actions"><img src="https://github.com/zyantific/zydis/workflows/GitHub%20Actions%20CI/badge.svg" alt="GitHub Actions"></a>
<a href="https://github.com/zyantific/zydis/actions"><img src="https://github.com/zyantific/zydis/workflows/CI/badge.svg" alt="GitHub Actions"></a>
<a href="https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zydis"><img src="https://oss-fuzz-build-logs.storage.googleapis.com/badges/zydis.svg" alt="Fuzzing Status"></a>
<a href="https://gitter.im/zyantific/zydis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/zyantific/zyan-disassembler-engine.svg" alt="Gitter"></a>
<a href="https://discord.zyantific.com/"><img src="https://img.shields.io/discord/390136917779415060.svg?logo=discord&label=Discord" alt="Discord"></a>
</p>
<p align="center">Fast and lightweight x86/x86-64 disassembler library.</p>
<p align="center">Fast and lightweight x86/x86-64 disassembler and code generation library.</p>
## Features
- Supports all x86 and x86-64 (AMD64) instructions and [extensions](./include/Zydis/Generated/EnumISAExt.h)
- Optimized for high performance
- No dynamic memory allocation ("malloc")
- Thread-safe by design
- Very small file-size overhead compared to other common disassembler libraries
- [Complete doxygen documentation](https://zydis.re/doc/3/)
- [Complete doxygen documentation](https://doc.zydis.re/)
- Trusted by many major open-source projects
- Examples include [x64dbg][zydis-x64dbg], [Mozilla Firefox][zydis-firefox] and [Webkit][zydis-webkit]
- Absolutely no third party dependencies — not even libc
- Should compile on any platform with a working C99 compiler
- Should compile on any platform with a working C11 compiler
- Tested on Windows, macOS, FreeBSD, Linux and UEFI, both user and kernel mode
## Quick Example
The following example program uses Zydis to disassemble a given memory buffer and prints the output to the console ([more examples here](./examples/)).
[zydis-x64dbg]: https://github.com/x64dbg/x64dbg/tree/729285ef82580812edf7167c41aa6a2c23d8d72d/src/zydis_wrapper
[zydis-firefox]: https://github.com/mozilla/gecko-dev/tree/3ddbce3c426a55080bd84974444f9ac4869e580b/js/src/zydis
[zydis-webkit]: https://github.com/WebKit/WebKit/tree/1f2d2a92eeb831bedd01bbb5b694a0e29fa9af81/Source/JavaScriptCore/disassembler/zydis
```C
#include <stdio.h>
#include <inttypes.h>
#include <Zydis/Zydis.h>
## Examples
int main()
{
ZyanU8 data[] =
{
0x51, 0x8D, 0x45, 0xFF, 0x50, 0xFF, 0x75, 0x0C, 0xFF, 0x75,
0x08, 0xFF, 0x15, 0xA0, 0xA5, 0x48, 0x76, 0x85, 0xC0, 0x0F,
0x88, 0xFC, 0xDA, 0x02, 0x00
};
### Disassembler
// Initialize decoder context
ZydisDecoder decoder;
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_ADDRESS_WIDTH_64);
The following example program uses Zydis to disassemble a given memory buffer and prints the output to the console.
// Initialize formatter. Only required when you actually plan to do instruction
// formatting ("disassembling"), like we do here
ZydisFormatter formatter;
ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL);
https://github.com/zyantific/zydis/blob/214536a814ba20d2e33d2a907198d1a329aac45c/examples/DisassembleSimple.c#L38-L63
// Loop over the instructions in our buffer.
// The runtime-address (instruction pointer) is chosen arbitrary here in order to better
// visualize relative addressing
ZyanU64 runtime_address = 0x007FFFFFFF400000;
ZyanUSize offset = 0;
const ZyanUSize length = sizeof(data);
ZydisDecodedInstruction instruction;
while (ZYAN_SUCCESS(ZydisDecoderDecodeBuffer(&decoder, data + offset, length - offset,
&instruction)))
{
// Print current instruction pointer.
printf("%016" PRIX64 " ", runtime_address);
// Format & print the binary instruction structure to human readable format
char buffer[256];
ZydisFormatterFormatInstruction(&formatter, &instruction, buffer, sizeof(buffer),
runtime_address);
puts(buffer);
offset += instruction.length;
runtime_address += instruction.length;
}
}
```
## Sample Output
The above example program generates the following output:
```asm
@ -88,74 +56,133 @@ The above example program generates the following output:
007FFFFFFF400013 js 0x007FFFFFFF42DB15
```
### Encoder
https://github.com/zyantific/zydis/blob/b37076e69f5aa149fde540cae43c50f15a380dfc/examples/EncodeMov.c#L39-L62
The above example program generates the following output:
```
48 C7 C0 37 13 00 00
```
### More Examples
More examples can be found in the [examples](./examples/) directory of this repository.
## 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.
There are many ways to make Zydis available on your system. The following sub-sections list commonly used options.
### CMake Build
**Platforms:** Windows, macOS, Linux, BSDs
You can use CMake to build Zydis on all supported platforms.
Instructions on how to install CMake can be found [here](https://cmake.org/install/).
```bash
git clone --recursive 'https://github.com/zyantific/zydis.git'
cd zydis
mkdir build && cd build
cmake ..
make
cmake -B build
cmake --build build -j4
```
#### Windows
Either use the [Visual Studio 2017 project](./msvc/) or build Zydis using [CMake](https://cmake.org/download/) ([video guide](https://www.youtube.com/watch?v=fywLDK1OAtQ)).
### Visual Studio 2022 project
#### Building Zydis - Using vcpkg
**Platforms:** Windows
You can download and install Zydis using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
We manually maintain a [Visual Studio 2022 project](./msvc/) in addition to the CMake build logic.
```bash
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install zydis
```
The Zydis port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
### CMake generated VS project
**Platforms:** Windows
CMake can be instructed to generate a Visual Studio project for pretty much any VS version. A video guide describing how to use the CMake GUI to generate such project files is available [here](https://www.youtube.com/watch?v=fywLDK1OAtQ). Don't be confused by the apparent use of macOS in the video: Windows is simply running in a virtual machine.
### Amalgamated distribution
**Platforms:** any platform with a working C11 compiler
We provide an auto-generated single header & single source file variant of Zydis. To use this variant
of Zydis in your project, all you need to do is to copy these two files into your project. The
amalgamated builds can be found on our [release page](https://github.com/zyantific/zydis/releases)
as `zydis-amalgamated.tar.gz`.
These files are generated with the [`amalgamate.py`](./assets/amalgamate.py) script.
### Package managers
**Platforms:** Windows, macOS, Linux, FreeBSD
Pre-built headers, shared libraries and executables are available through a variety of package managers.
<details>
<summary>Zydis version in various package repositories</summary>
[![Packaging status](https://repology.org/badge/vertical-allrepos/zydis.svg)](https://repology.org/project/zydis/versions)
</details>
| Repository | Install command |
|------------|--------------------------------------------|
| Arch Linux | `pacman -S zydis` |
| Debian | `apt-get install libzydis-dev zydis-tools` |
| Homebrew | `brew install zydis` |
| NixOS | `nix-shell -p zydis` |
| Ubuntu | `apt-get install libzydis-dev zydis-tools` |
| vcpkg | `vcpkg install zydis` |
## Using Zydis in a CMake project
An example on how to use Zydis in your own CMake based project [can be found in this repo](https://github.com/zyantific/zydis-submodule-example).
## `ZydisInfo` tool
The `ZydisInfo` command-line tool can be used to inspect essentially all information
that Zydis provides about an instruction.
![ZydisInfo](./assets/screenshots/ZydisInfo.png)
## Bindings
Official bindings exist for a selection of languages:
- [Pascal](https://github.com/zyantific/zydis-pascal)
- [Python 3](https://github.com/zyantific/zydis-py)
- [Rust](https://github.com/zyantific/zydis-rs)
Unofficial but actively maintained bindings:
- [Go](https://github.com/jpap/go-zydis)
- [LuaJIT](https://github.com/Wiladams/lj2zydis)
- [Haskell](https://github.com/nerded1337/zydiskell)
Official bindings exist for a selection of languages:
- [Rust](https://github.com/zyantific/zydis-rs)
- [Python 3](https://github.com/zyantific/zydis-py)
### asmjit-style C++ front-end
If you're looking for an asmjit-style assembler front-end for the encoder, check out [zasm](https://github.com/zyantific/zasm).
zasm also provides an idiomatic C++ wrapper around the decoder and formatter interface.
## Versions
#### Scheme
Versions follow the [semantic versioning scheme](https://semver.org/). All stability guarantees apply to the API only — ABI stability between patches cannot be assumed unless explicitly mentioned in the release notes.
### Scheme
Versions follow the [semantic versioning scheme](https://semver.org/). All stability guarantees apply to the API only. ABI stability is provided only between patch versions.
### Branches & Tags
#### Branches & Tags
- `master` holds the bleeding edge code of the next, unreleased Zydis version. Elevated amounts of bugs and issues must be expected, API stability is not guaranteed outside of tagged commits.
- Stable and preview versions are annotated with git tags
- beta and other preview versions have `-beta`, `-rc`, etc. suffixes
- `maintenance/v2` contains the code of the latest legacy release of v2
- v2 is now deprecated, but will receive security fixes until 2021
- `maintenance/v3` points to the code of the latest release of v3
- v3 won't get any feature updates but will receive security updates until 2025
- `maintenance/v2` points to the code of the last legacy release of v2
- v2 is has reached end-of-life and won't receive any security updates
## Credits
- Intel (for open-sourcing [XED](https://github.com/intelxed/xed), allowing for automatic comparison of our tables against theirs, improving both)
- [LLVM](https://llvm.org) (for providing pretty solid instruction data as well)
- Christian Ludloff (http://sandpile.org, insanely helpful)
- Christian Ludloff (https://sandpile.org, insanely helpful)
- [LekoArts](https://www.lekoarts.de/) (for creating the project logo)
- Our [contributors on GitHub](https://github.com/zyantific/zydis/graphs/contributors)
## Troubleshooting
#### `-fPIC` for shared library builds
### `-fPIC` for shared library builds
```
/usr/bin/ld: ./libfoo.a(foo.c.o): relocation R_X86_64_PC32 against symbol `bar' can not be used when making a shared object; recompile with -fPIC
@ -167,11 +194,12 @@ might fail to detect that relocation information must be emitted. This can be fo
by passing `-DCMAKE_POSITION_INDEPENDENT_CODE=ON` to the CMake invocation.
## Consulting and Business Support
We offer consulting services and professional business support for Zydis. If you need a custom extension, require help in integrating Zydis into your product or simply want contractually guaranteed updates and turnaround times, we are happy to assist with that! Please contact us at business@zyantific.com.
## Donations
Since GitHub Sponsors currently doesn't support sponsoring teams directly, donations are collected and distributed using [flobernd](https://github.com/users/flobernd/sponsorship)s account.
Donations are collected and distributed using [flobernd](https://github.com/users/flobernd/sponsorship)'s account.
## License

View File

@ -1,7 +1,7 @@
The MIT License (MIT)
Copyright (c) 2018-2020 Florian Bernd
Copyright (c) 2018-2020 Joel Höner
Copyright (c) 2018-2024 Florian Bernd
Copyright (c) 2018-2024 Joel Höner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -87,7 +87,7 @@ typedef enum ZyanMemoryPageProtection_
*
* @return The system page size.
*/
ZYCORE_EXPORT ZyanU32 ZyanMemoryGetSystemPageSize();
ZYCORE_EXPORT ZyanU32 ZyanMemoryGetSystemPageSize(void);
/**
* Returns the system allocation granularity.
@ -100,7 +100,7 @@ ZYCORE_EXPORT ZyanU32 ZyanMemoryGetSystemPageSize();
*
* @return The system allocation granularity.
*/
ZYCORE_EXPORT ZyanU32 ZyanMemoryGetSystemAllocationGranularity();
ZYCORE_EXPORT ZyanU32 ZyanMemoryGetSystemAllocationGranularity(void);
/* ---------------------------------------------------------------------------------------------- */
/* Memory management */

View File

@ -64,6 +64,10 @@
#if defined(__clang__)
# define ZYAN_CLANG
# define ZYAN_GNUC
# if defined(_MSC_VER)
# define ZYAN_CLANG_CL
# define ZYAN_MSVC
# endif
#elif defined(__ICC) || defined(__INTEL_COMPILER)
# define ZYAN_ICC
#elif defined(__GNUC__) || defined(__GNUG__)
@ -97,10 +101,16 @@
#elif defined(__FreeBSD__)
# define ZYAN_FREEBSD
# define ZYAN_POSIX
#elif defined(__NetBSD__)
# define ZYAN_NETBSD
# define ZYAN_POSIX
#elif defined(sun) || defined(__sun)
# define ZYAN_SOLARIS
# define ZYAN_POSIX
#elif defined(__unix)
#elif defined(__HAIKU__)
# define ZYAN_HAIKU
# define ZYAN_POSIX
#elif defined(__unix) || defined(__unix__)
# define ZYAN_UNIX
# define ZYAN_POSIX
#elif defined(__posix)
@ -136,6 +146,14 @@
# define ZYAN_ARM
#elif defined(__EMSCRIPTEN__) || defined(__wasm__) || defined(__WASM__)
# define ZYAN_WASM
#elif defined(__loongarch__)
# define ZYAN_LOONGARCH
#elif defined(__powerpc64__)
# define ZYAN_PPC64
#elif defined(__powerpc__)
# define ZYAN_PPC
#elif defined(__riscv) && __riscv_xlen == 64
# define ZYAN_RISCV64
#else
# error "Unsupported architecture detected"
#endif
@ -176,13 +194,18 @@
/* Generic DLL import/export helpers */
/* ============================================================================================== */
#if defined(ZYAN_MSVC)
#if defined(ZYAN_MSVC) || (defined(ZYAN_WINDOWS) && defined(ZYAN_GNUC))
# define ZYAN_DLLEXPORT __declspec(dllexport)
# define ZYAN_DLLIMPORT __declspec(dllimport)
#else
# if defined(ZYAN_GNUC)
# define ZYAN_DLLEXPORT __attribute__((__visibility__("default")))
# define ZYAN_DLLIMPORT extern
# else
# define ZYAN_DLLEXPORT
# define ZYAN_DLLIMPORT
# endif
#endif
/* ============================================================================================== */
/* Zycore dll{export,import} */
@ -201,8 +224,7 @@
// backward compatibility for users that don't use CMake and previously manually defined these, we
// translate the old defines here and print a warning.
#if defined(ZYCORE_STATIC_DEFINE)
// Warning disabled for PCSX2 since we define this on the command line.
//# pragma message("ZYCORE_STATIC_DEFINE was renamed to ZYCORE_STATIC_BUILD.")
# pragma message("ZYCORE_STATIC_DEFINE was renamed to ZYCORE_STATIC_BUILD.")
# define ZYCORE_STATIC_BUILD
#endif
#if defined(Zycore_EXPORTS)
@ -226,7 +248,11 @@
/**
* Symbol is not exported and for internal use only.
*/
#if defined(ZYAN_GNUC)
# define ZYCORE_NO_EXPORT __attribute__((__visibility__("hidden")))
#else
# define ZYCORE_NO_EXPORT
#endif
/* ============================================================================================== */
/* Misc compatibility macros */
@ -272,12 +298,15 @@
/**
* Compiler-time assertion.
*/
#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
# define ZYAN_STATIC_ASSERT(x) _Static_assert(x, #x)
#elif (defined(__cplusplus) && __cplusplus >= 201103L) || \
(defined(__cplusplus) && defined (_MSC_VER) && (_MSC_VER >= 1600)) || \
(defined (_MSC_VER) && (_MSC_VER >= 1800))
# define ZYAN_STATIC_ASSERT(x) static_assert(x, #x)
#elif defined(ZYAN_GNUC)
# define ZYAN_STATIC_ASSERT(x) \
__attribute__((unused)) typedef int ZYAN_MACRO_CONCAT_EXPAND(ZYAN_SASSERT_, __COUNTER__) [(x) ? 1 : -1]
#else
# define ZYAN_STATIC_ASSERT(x) \
typedef int ZYAN_MACRO_CONCAT_EXPAND(ZYAN_SASSERT_, __COUNTER__) [(x) ? 1 : -1]
@ -335,7 +364,7 @@
* Intentional fallthrough.
*/
#if defined(ZYAN_GCC) && __GNUC__ >= 7
# define ZYAN_FALLTHROUGH __attribute__((__fallthrough__))
# define ZYAN_FALLTHROUGH ; __attribute__((__fallthrough__))
#else
# define ZYAN_FALLTHROUGH
#endif
@ -469,6 +498,20 @@
*/
#define ZYAN_ALIGN_DOWN(x, align) (((x) - 1) & ~((align) - 1))
/**
* Divide the 64bit integer value by the given divisor.
*
* @param n Variable containing the dividend that will be updated with the result of the
* division.
* @param divisor The divisor.
*/
#if defined(ZYAN_LINUX) && defined(ZYAN_KERNEL)
# include <asm/div64.h> /* do_div */
# define ZYAN_DIV64(n, divisor) do_div(n, divisor)
#else
# define ZYAN_DIV64(n, divisor) (n /= divisor)
#endif
/* ---------------------------------------------------------------------------------------------- */
/* Bit operations */
/* ---------------------------------------------------------------------------------------------- */

View File

@ -99,6 +99,7 @@ typedef FILE ZyanFile;
#include <stdlib.h>
#define ZYAN_CALLOC calloc
#define ZYAN_FREE free
#define ZYAN_GETENV getenv
#define ZYAN_MALLOC malloc
#define ZYAN_REALLOC realloc

View File

@ -62,19 +62,83 @@
typedef ZyanI32 ZyanIPointer;
# endif
# elif defined(ZYAN_GNUC)
# ifdef __UINT8_TYPE__
typedef __UINT8_TYPE__ ZyanU8;
# else
typedef unsigned char ZyanU8;
# endif
# ifdef __UINT16_TYPE__
typedef __UINT16_TYPE__ ZyanU16;
# else
typedef unsigned short int ZyanU16;
# endif
# ifdef __UINT32_TYPE__
typedef __UINT32_TYPE__ ZyanU32;
# else
typedef unsigned int ZyanU32;
# endif
# ifdef __UINT64_TYPE__
typedef __UINT64_TYPE__ ZyanU64;
# else
# if defined(__x86_64__) && !defined(__ILP32__)
typedef unsigned long int ZyanU64;
# else
typedef unsigned long long int ZyanU64;
# endif
# endif
# ifdef __INT8_TYPE__
typedef __INT8_TYPE__ ZyanI8;
# else
typedef signed char ZyanI8;
# endif
# ifdef __INT16_TYPE__
typedef __INT16_TYPE__ ZyanI16;
# else
typedef signed short int ZyanI16;
# endif
# ifdef __INT32_TYPE__
typedef __INT32_TYPE__ ZyanI32;
# else
typedef signed int ZyanI32;
# endif
# ifdef __INT64_TYPE__
typedef __INT64_TYPE__ ZyanI64;
# else
# if defined(__x86_64__) && !defined( __ILP32__)
typedef signed long int ZyanI64;
# else
typedef signed long long int ZyanI64;
# endif
# endif
# ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ ZyanUSize;
# else
typedef long unsigned int ZyanUSize;
# endif
# ifdef __PTRDIFF_TYPE__
typedef __PTRDIFF_TYPE__ ZyanISize;
# else
typedef long int ZyanISize;
# endif
# ifdef __UINTPTR_TYPE__
typedef __UINTPTR_TYPE__ ZyanUPointer;
# else
# if defined(__x86_64__) && !defined( __ILP32__)
typedef unsigned long int ZyanUPointer;
# else
typedef unsigned int ZyanUPointer;
# endif
# endif
# ifdef __INTPTR_TYPE__
typedef __INTPTR_TYPE__ ZyanIPointer;
# else
# if defined(__x86_64__) && !defined( __ILP32__)
typedef long int ZyanIPointer;
# else
typedef int ZyanIPointer;
# endif
# endif
# else
# error "Unsupported compiler for no-libc mode."
# endif
@ -92,18 +156,58 @@
# define ZYAN_UINT32_MAX 0xffffffffui32
# define ZYAN_UINT64_MAX 0xffffffffffffffffui64
# else
# ifdef __INT8_MAX__
# define ZYAN_INT8_MAX __INT8_MAX__
# else
# define ZYAN_INT8_MAX (127)
# endif
# define ZYAN_INT8_MIN (-ZYAN_INT8_MAX - 1)
# ifdef __INT16_MAX__
# define ZYAN_INT16_MAX __INT16_MAX__
# else
# define ZYAN_INT16_MAX (32767)
# endif
# define ZYAN_INT16_MIN (-ZYAN_INT16_MAX - 1)
# ifdef __INT32_MAX__
# define ZYAN_INT32_MAX __INT32_MAX__
# else
# define ZYAN_INT32_MAX (2147483647)
# endif
# define ZYAN_INT32_MIN (-ZYAN_INT32_MAX - 1)
# ifdef __INT64_MAX__
# define ZYAN_INT64_MAX __INT64_MAX__
# else
# if defined(__x86_64__) && !defined( __ILP32__)
# define ZYAN_INT64_MAX (9223372036854775807L)
# else
# define ZYAN_INT64_MAX (9223372036854775807LL)
# endif
# endif
# define ZYAN_INT64_MIN (-ZYAN_INT64_MAX - 1)
# ifdef __UINT8_MAX__
# define ZYAN_UINT8_MAX __UINT8_MAX__
# else
# define ZYAN_UINT8_MAX (255)
# endif
# ifdef __UINT16_MAX__
# define ZYAN_UINT16_MAX __UINT16_MAX__
# else
# define ZYAN_UINT16_MAX (65535)
# endif
# ifdef __UINT32_MAX__
# define ZYAN_UINT32_MAX __UINT32_MAX__
# else
# define ZYAN_UINT32_MAX (4294967295U)
# endif
# ifdef __UINT64_MAX__
# define ZYAN_UINT64_MAX __UINT64_MAX__
# else
# if defined(__x86_64__) && !defined( __ILP32__)
# define ZYAN_UINT64_MAX (18446744073709551615UL)
# else
# define ZYAN_UINT64_MAX (18446744073709551615ULL)
# endif
# endif
# endif
#else
// If is LibC present, we use stdint types.
@ -180,8 +284,8 @@ typedef const void* ZyanConstVoidPointer;
/* Boolean */
/* ---------------------------------------------------------------------------------------------- */
#define ZYAN_FALSE 0
#define ZYAN_TRUE 1
#define ZYAN_FALSE 0u
#define ZYAN_TRUE 1u
/**
* Defines the `ZyanBool` data-type.

View File

@ -51,7 +51,7 @@ extern "C" {
/**
* A macro that defines the zycore version.
*/
#define ZYCORE_VERSION (ZyanU64)0x0001000200000000
#define ZYCORE_VERSION 0x0001000500020000ULL
/* ---------------------------------------------------------------------------------------------- */
/* Helper macros */
@ -62,28 +62,28 @@ extern "C" {
*
* @param version The zycore version value
*/
#define ZYCORE_VERSION_MAJOR(version) (ZyanU16)((version & 0xFFFF000000000000) >> 48)
#define ZYCORE_VERSION_MAJOR(version) ((version & 0xFFFF000000000000) >> 48)
/**
* Extracts the minor-part of the zycore version.
*
* @param version The zycore version value
*/
#define ZYCORE_VERSION_MINOR(version) (ZyanU16)((version & 0x0000FFFF00000000) >> 32)
#define ZYCORE_VERSION_MINOR(version) ((version & 0x0000FFFF00000000) >> 32)
/**
* Extracts the patch-part of the zycore version.
*
* @param version The zycore version value
*/
#define ZYCORE_VERSION_PATCH(version) (ZyanU16)((version & 0x00000000FFFF0000) >> 16)
#define ZYCORE_VERSION_PATCH(version) ((version & 0x00000000FFFF0000) >> 16)
/**
* Extracts the build-part of the zycore version.
*
* @param version The zycore version value
*/
#define ZYCORE_VERSION_BUILD(version) (ZyanU16)(version & 0x000000000000FFFF)
#define ZYCORE_VERSION_BUILD(version) (version & 0x000000000000FFFF)
/* ---------------------------------------------------------------------------------------------- */

View File

@ -44,7 +44,7 @@
/* General */
/* ---------------------------------------------------------------------------------------------- */
ZyanU32 ZyanMemoryGetSystemPageSize()
ZyanU32 ZyanMemoryGetSystemPageSize(void)
{
#if defined(ZYAN_WINDOWS)
@ -60,7 +60,7 @@ ZyanU32 ZyanMemoryGetSystemPageSize()
#endif
}
ZyanU32 ZyanMemoryGetSystemAllocationGranularity()
ZyanU32 ZyanMemoryGetSystemAllocationGranularity(void)
{
#if defined(ZYAN_WINDOWS)

View File

@ -25,6 +25,10 @@
***************************************************************************************************/
#include <Zycore/Defines.h>
#include <Zycore/API/Process.h>
#ifndef ZYAN_NO_LIBC
#if defined(ZYAN_WINDOWS)
#if defined(ZYAN_KERNEL)
# include <wdm.h>
@ -36,9 +40,6 @@
#else
# error "Unsupported platform detected"
#endif
#include <Zycore/API/Process.h>
#ifndef ZYAN_NO_LIBC
/* ============================================================================================== */
/* Exported functions */

View File

@ -83,7 +83,7 @@ static const ZyanStringView STR_SUB = ZYAN_DEFINE_STRING_VIEW("-");
/* Decimal */
/* ---------------------------------------------------------------------------------------------- */
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM)
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
ZyanStatus ZyanStringAppendDecU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length)
{
if (!string)
@ -179,7 +179,7 @@ ZyanStatus ZyanStringAppendDecU64(ZyanString* string, ZyanU64 value, ZyanU8 padd
/* Hexadecimal */
/* ---------------------------------------------------------------------------------------------- */
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM)
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
ZyanStatus ZyanStringAppendHexU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length,
ZyanBool uppercase)
{
@ -423,7 +423,7 @@ ZyanStatus ZyanStringAppendFormat(ZyanString* string, const char* format, ...)
ZyanStatus ZyanStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length)
{
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64) || defined(ZYAN_LOONGARCH)
return ZyanStringAppendDecU64(string, value, padding_length);
#else
// Working with 64-bit values is slow on non 64-bit systems
@ -464,7 +464,7 @@ ZyanStatus ZyanStringAppendDecS(ZyanString* string, ZyanI64 value, ZyanU8 paddin
ZyanStatus ZyanStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
ZyanBool uppercase)
{
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64) || defined(ZYAN_LOONGARCH)
return ZyanStringAppendHexU64(string, value, padding_length, uppercase);
#else
// Working with 64-bit values is slow on non 64-bit systems

View File

@ -1,46 +0,0 @@
#ifndef ZYCORE_EXPORT_H
#define ZYCORE_EXPORT_H
#ifdef ZYCORE_STATIC_DEFINE
# define ZYCORE_EXPORT
# define ZYCORE_NO_EXPORT
#else
# ifndef ZYCORE_EXPORT
# ifdef Zycore_EXPORTS
/* We are building this library */
# define ZYCORE_EXPORT __declspec(dllexport)
# else
/* We are using this library */
# define ZYCORE_EXPORT __declspec(dllimport)
# endif
# endif
# ifndef ZYCORE_NO_EXPORT
# define ZYCORE_NO_EXPORT
# endif
#endif
#ifndef ZYCORE_DEPRECATED
# ifdef _MSC_VER
# define ZYCORE_DEPRECATED __declspec(deprecated)
# else
# define ZYCORE_DEPRECATED
# endif
#endif
#ifndef ZYCORE_DEPRECATED_EXPORT
# define ZYCORE_DEPRECATED_EXPORT ZYCORE_EXPORT ZYCORE_DEPRECATED
#endif
#ifndef ZYCORE_DEPRECATED_NO_EXPORT
# define ZYCORE_DEPRECATED_NO_EXPORT ZYCORE_NO_EXPORT ZYCORE_DEPRECATED
#endif
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef ZYCORE_NO_DEPRECATED
# define ZYCORE_NO_DEPRECATED
# endif
#endif
#endif /* ZYCORE_EXPORT_H */

View File

@ -136,11 +136,28 @@ typedef enum ZydisDecoderMode_
* This mode is enabled by default.
*/
ZYDIS_DECODER_MODE_CLDEMOTE,
/**
* Enables the `IPREFETCH` mode.
*
* The `IPREFETCH` isa-extension reuses (overrides) some of the widenop instruction opcodes.
*
* This mode is enabled by default.
*/
ZYDIS_DECODER_MODE_IPREFETCH,
/**
* Enables the `UD0` compatibility mode.
*
* Some processors decode the `UD0` instruction without a ModR/M byte. Enable this decoder mode
* to mimic this behavior.
*
* This mode is disabled by default.
*/
ZYDIS_DECODER_MODE_UD0_COMPAT,
/**
* Maximum value of this enum.
*/
ZYDIS_DECODER_MODE_MAX_VALUE = ZYDIS_DECODER_MODE_CLDEMOTE,
ZYDIS_DECODER_MODE_MAX_VALUE = ZYDIS_DECODER_MODE_UD0_COMPAT,
/**
* The minimum number of bits required to represent all values of this enum.
*/
@ -164,13 +181,13 @@ typedef struct ZydisDecoder_
*/
ZydisMachineMode machine_mode;
/**
* The address width.
* The stack width.
*/
ZydisAddressWidth address_width;
ZydisStackWidth stack_width;
/**
* The decoder mode array.
* The decoder mode bitmap.
*/
ZyanBool decoder_mode[ZYDIS_DECODER_MODE_MAX_VALUE + 1];
ZyanU32 decoder_mode;
} ZydisDecoder;
/* ---------------------------------------------------------------------------------------------- */
@ -190,12 +207,12 @@ typedef struct ZydisDecoder_
*
* @param decoder A pointer to the `ZydisDecoder` instance.
* @param machine_mode The machine mode.
* @param address_width The address width.
* @param stack_width The stack width.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisDecoderInit(ZydisDecoder* decoder, ZydisMachineMode machine_mode,
ZydisAddressWidth address_width);
ZydisStackWidth stack_width);
/**
* Enables or disables the specified decoder-mode.
@ -209,10 +226,45 @@ ZYDIS_EXPORT ZyanStatus ZydisDecoderInit(ZydisDecoder* decoder, ZydisMachineMode
ZYDIS_EXPORT ZyanStatus ZydisDecoderEnableMode(ZydisDecoder* decoder, ZydisDecoderMode mode,
ZyanBool enabled);
/**
* Decodes the instruction in the given input `buffer` and returns all details (e.g. operands).
*
* @param decoder A pointer to the `ZydisDecoder` instance.
* @param buffer A pointer to the input buffer.
* @param length The length of the input buffer. Note that this can be bigger than the
* actual size of the instruction -- you don't have to know the size up
* front. This length is merely used to prevent Zydis from doing
* out-of-bounds reads on your buffer.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct receiving the details
* about the decoded instruction.
* @param operands A pointer to an array with `ZYDIS_MAX_OPERAND_COUNT` entries that
* receives the decoded operands. The number of operands decoded is
* determined by the `instruction.operand_count` field. Excess entries are
* zeroed.
*
* This is a convenience function that combines the following functions into one call:
*
* - `ZydisDecoderDecodeInstruction`
* - `ZydisDecoderDecodeOperands`
*
* Please refer to `ZydisDecoderDecodeInstruction` if operand decoding is not required or should
* be done separately (`ZydisDecoderDecodeOperands`).
*
* This function is not available in MINIMAL_MODE.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisDecoderDecodeFull(const ZydisDecoder* decoder,
const void* buffer, ZyanUSize length, ZydisDecodedInstruction* instruction,
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT]);
/**
* Decodes the instruction in the given input `buffer`.
*
* @param decoder A pointer to the `ZydisDecoder` instance.
* @param context A pointer to a decoder context struct which is required for further
* decoding (e.g. operand decoding using `ZydisDecoderDecodeOperands`) or
* `ZYAN_NULL` if not needed.
* @param buffer A pointer to the input buffer.
* @param length The length of the input buffer. Note that this can be bigger than the
* actual size of the instruction -- you don't have to know the size up
@ -223,8 +275,39 @@ ZYDIS_EXPORT ZyanStatus ZydisDecoderEnableMode(ZydisDecoder* decoder, ZydisDecod
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder,
const void* buffer, ZyanUSize length, ZydisDecodedInstruction* instruction);
ZYDIS_EXPORT ZyanStatus ZydisDecoderDecodeInstruction(const ZydisDecoder* decoder,
ZydisDecoderContext* context, const void* buffer, ZyanUSize length,
ZydisDecodedInstruction* instruction);
/**
* Decodes the instruction operands.
*
* @param decoder A pointer to the `ZydisDecoder` instance.
* @param context A pointer to the `ZydisDecoderContext` struct.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param operands The array that receives the decoded operands.
* Refer to `ZYDIS_MAX_OPERAND_COUNT` or `ZYDIS_MAX_OPERAND_COUNT_VISIBLE`
* when allocating space for the array to ensure that the buffer size is
* sufficient to always fit all instruction operands.
* Refer to `instruction.operand_count` or
* `instruction.operand_count_visible' when allocating space for the array
* to ensure that the buffer size is sufficient to fit all operands of
* the given instruction.
* @param operand_count The length of the `operands` array.
* This argument as well limits the maximum amount of operands to decode.
* If this value is `0`, no operands will be decoded and `ZYAN_NULL` will
* be accepted for the `operands` argument.
*
* This function fails, if `operand_count` is larger than the total number of operands for the
* given instruction (`instruction.operand_count`).
*
* This function is not available in MINIMAL_MODE.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisDecoderDecodeOperands(const ZydisDecoder* decoder,
const ZydisDecoderContext* context, const ZydisDecodedInstruction* instruction,
ZydisDecodedOperand* operands, ZyanU8 operand_count);
/** @} */

File diff suppressed because it is too large Load Diff

76
3rdparty/zydis/include/Zydis/Defines.h vendored Normal file
View File

@ -0,0 +1,76 @@
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Joel Hoener
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***************************************************************************************************/
/**
* @file
* Import/export defines for MSVC builds.
*/
#ifndef ZYDIS_DEFINES_H
#define ZYDIS_DEFINES_H
#include <Zycore/Defines.h>
// This is a cut-down version of what CMake's `GenerateExportHeader` would usually generate. To
// simplify builds without CMake, we define these things manually instead of relying on CMake
// to generate the header.
//
// For static builds, our CMakeList will define `ZYDIS_STATIC_BUILD`. For shared library builds,
// our CMake will define `ZYDIS_SHOULD_EXPORT` depending on whether the target is being imported or
// exported. If CMake isn't used, users can manually define these to fit their use-case.
// Backward compatibility: CMake would previously generate these variables names. However, because
// they have pretty cryptic names, we renamed them when we got rid of `GenerateExportHeader`. For
// backward compatibility for users that don't use CMake and previously manually defined these, we
// translate the old defines here and print a warning.
#if defined(ZYDIS_STATIC_DEFINE)
# pragma message("ZYDIS_STATIC_DEFINE was renamed to ZYDIS_STATIC_BUILD.")
# define ZYDIS_STATIC_BUILD
#endif
#if defined(Zydis_EXPORTS)
# pragma message("Zydis_EXPORTS was renamed to ZYDIS_SHOULD_EXPORT.")
# define ZYDIS_SHOULD_EXPORT
#endif
/**
* Symbol is exported in shared library builds.
*/
#if defined(ZYDIS_STATIC_BUILD)
# define ZYDIS_EXPORT
#else
# if defined(ZYDIS_SHOULD_EXPORT)
# define ZYDIS_EXPORT ZYAN_DLLEXPORT
# else
# define ZYDIS_EXPORT ZYAN_DLLIMPORT
# endif
#endif
/**
* Symbol is not exported and for internal use only.
*/
#define ZYDIS_NO_EXPORT
#endif // ZYDIS_DEFINES_H

View File

@ -0,0 +1,135 @@
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Joel Hoener
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***************************************************************************************************/
/**
* @file
* All-in-one convenience function providing the simplest possible way to use Zydis.
*/
#ifndef ZYDIS_DISASSEMBLER_H
#define ZYDIS_DISASSEMBLER_H
#include <Zydis/Decoder.h>
#include <Zydis/Formatter.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ============================================================================================== */
/* Types */
/* ============================================================================================== */
/**
* All commonly used information about a decoded instruction that Zydis can provide.
*
* This structure is filled in by calling `ZydisDisassembleIntel` or `ZydisDisassembleATT`.
*/
typedef struct ZydisDisassembledInstruction_
{
/**
* The runtime address that was passed when disassembling the instruction.
*/
ZyanU64 runtime_address;
/**
* General information about the decoded instruction in machine-readable format.
*/
ZydisDecodedInstruction info;
/**
* The operands of the decoded instruction in a machine-readable format.
*
* The amount of actual operands can be determined by inspecting the corresponding fields
* in the `info` member of this struct. Inspect `operand_count_visible` if you care about
* visible operands (those that are printed by the formatter) or `operand_count` if you're
* also interested in implicit operands (for example the registers implicitly accessed by
* `pushad`). Unused entries are zeroed.
*/
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
/**
* The textual, human-readable representation of the instruction.
*
* Guaranteed to be zero-terminated.
*/
char text[96];
} ZydisDisassembledInstruction;
/* ============================================================================================== */
/* Exported functions */
/* ============================================================================================== */
/**
* Disassemble an instruction and format it to human-readable text in a single step (Intel syntax).
*
* @param machine_mode The machine mode to assume when disassembling. When in doubt, pass
* `ZYDIS_MACHINE_MODE_LONG_64` for what is typically referred to as
* "64-bit mode" or `ZYDIS_MACHINE_MODE_LEGACY_32` for "32-bit mode".
* @param runtime_address The program counter (`eip` / `rip`) to assume when formatting the
* instruction. Many instructions behave differently depending on the
* address they are located at.
* @param buffer A pointer to the raw instruction bytes that you wish to decode.
* @param length The length of the input buffer. Note that this can be bigger than the
* actual size of the instruction -- you don't have to know the size up
* front. This length is merely used to prevent Zydis from doing
* out-of-bounds reads on your buffer.
* @param instruction A pointer to receive the decoded instruction information. Can be
* uninitialized and reused on later calls.
*
* This is a convenience function intended as a quick path for getting started with using Zydis.
* It internally calls a range of other more advanced functions to obtain all commonly needed
* information about the instruction. It is likely that you won't need most of this information in
* practice, so it is advisable to instead call these more advanced functions directly if you're
* concerned about performance.
*
* This function essentially combines the following more advanced functions into a single call:
*
* - `ZydisDecoderInit`
* - `ZydisDecoderDecodeInstruction`
* - `ZydisDecoderDecodeOperands`
* - `ZydisFormatterInit`
* - `ZydisFormatterFormatInstruction`
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisDisassembleIntel(ZydisMachineMode machine_mode,
ZyanU64 runtime_address, const void* buffer, ZyanUSize length,
ZydisDisassembledInstruction *instruction);
/**
* Disassemble an instruction and format it to human-readable text in a single step (AT&T syntax).
*
* @copydetails ZydisDisassembleIntel
*/
ZYDIS_EXPORT ZyanStatus ZydisDisassembleATT(ZydisMachineMode machine_mode,
ZyanU64 runtime_address, const void* buffer, ZyanUSize length,
ZydisDisassembledInstruction *instruction);
/* ============================================================================================== */
#ifdef __cplusplus
}
#endif
#endif /* ZYDIS_DISASSEMBLER_H */

471
3rdparty/zydis/include/Zydis/Encoder.h vendored Normal file
View File

@ -0,0 +1,471 @@
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Mappa
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***************************************************************************************************/
/**
* @file
* Functions for encoding instructions.
*/
#ifndef ZYDIS_ENCODER_H
#define ZYDIS_ENCODER_H
#include <Zycore/Types.h>
#include <Zydis/MetaInfo.h>
#include <Zydis/Register.h>
#include <Zydis/DecoderTypes.h>
#include <Zydis/Mnemonic.h>
#include <Zydis/Status.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ============================================================================================== */
/* Macros */
/* ============================================================================================== */
/* ---------------------------------------------------------------------------------------------- */
/* Constants */
/* ---------------------------------------------------------------------------------------------- */
/**
* Maximum number of encodable (explicit and implicit) operands
*/
#define ZYDIS_ENCODER_MAX_OPERANDS 5
// If asserts are failing here remember to update encoder table generator before fixing asserts
ZYAN_STATIC_ASSERT(ZYAN_BITS_TO_REPRESENT(ZYDIS_ENCODER_MAX_OPERANDS) == 3);
/**
* Combination of all user-encodable prefixes
*/
#define ZYDIS_ENCODABLE_PREFIXES (ZYDIS_ATTRIB_HAS_LOCK | \
ZYDIS_ATTRIB_HAS_REP | \
ZYDIS_ATTRIB_HAS_REPE | \
ZYDIS_ATTRIB_HAS_REPNE | \
ZYDIS_ATTRIB_HAS_BND | \
ZYDIS_ATTRIB_HAS_XACQUIRE | \
ZYDIS_ATTRIB_HAS_XRELEASE | \
ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN | \
ZYDIS_ATTRIB_HAS_BRANCH_TAKEN | \
ZYDIS_ATTRIB_HAS_NOTRACK | \
ZYDIS_ATTRIB_HAS_SEGMENT_CS | \
ZYDIS_ATTRIB_HAS_SEGMENT_SS | \
ZYDIS_ATTRIB_HAS_SEGMENT_DS | \
ZYDIS_ATTRIB_HAS_SEGMENT_ES | \
ZYDIS_ATTRIB_HAS_SEGMENT_FS | \
ZYDIS_ATTRIB_HAS_SEGMENT_GS)
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */
/* Enums and types */
/* ============================================================================================== */
/**
* Defines possible physical instruction encodings as bit flags, so multiple acceptable encodings
* can be specified simultaneously.
*/
typedef enum ZydisEncodableEncoding_
{
ZYDIS_ENCODABLE_ENCODING_DEFAULT = 0x00000000,
ZYDIS_ENCODABLE_ENCODING_LEGACY = 0x00000001,
ZYDIS_ENCODABLE_ENCODING_3DNOW = 0x00000002,
ZYDIS_ENCODABLE_ENCODING_XOP = 0x00000004,
ZYDIS_ENCODABLE_ENCODING_VEX = 0x00000008,
ZYDIS_ENCODABLE_ENCODING_EVEX = 0x00000010,
ZYDIS_ENCODABLE_ENCODING_MVEX = 0x00000020,
/**
* Maximum value of this enum.
*/
ZYDIS_ENCODABLE_ENCODING_MAX_VALUE = (ZYDIS_ENCODABLE_ENCODING_MVEX |
(ZYDIS_ENCODABLE_ENCODING_MVEX - 1)),
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_ENCODABLE_ENCODING_REQUIRED_BITS =
ZYAN_BITS_TO_REPRESENT(ZYDIS_ENCODABLE_ENCODING_MAX_VALUE)
} ZydisEncodableEncoding;
/**
* Defines encodable physical/effective sizes of relative immediate operands. See
* `ZydisEncoderRequest.branch_width` for more details.
*/
typedef enum ZydisBranchWidth_
{
ZYDIS_BRANCH_WIDTH_NONE,
ZYDIS_BRANCH_WIDTH_8,
ZYDIS_BRANCH_WIDTH_16,
ZYDIS_BRANCH_WIDTH_32,
ZYDIS_BRANCH_WIDTH_64,
/**
* Maximum value of this enum.
*/
ZYDIS_BRANCH_WIDTH_MAX_VALUE = ZYDIS_BRANCH_WIDTH_64,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_BRANCH_WIDTH_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_BRANCH_WIDTH_MAX_VALUE)
} ZydisBranchWidth;
/**
* Defines possible values for address size hints. See `ZydisEncoderRequest` for more information
* about address size hints.
*/
typedef enum ZydisAddressSizeHint_
{
ZYDIS_ADDRESS_SIZE_HINT_NONE,
ZYDIS_ADDRESS_SIZE_HINT_16,
ZYDIS_ADDRESS_SIZE_HINT_32,
ZYDIS_ADDRESS_SIZE_HINT_64,
/**
* Maximum value of this enum.
*/
ZYDIS_ADDRESS_SIZE_HINT_MAX_VALUE = ZYDIS_ADDRESS_SIZE_HINT_64,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_ADDRESS_SIZE_HINT_REQUIRED_BITS =
ZYAN_BITS_TO_REPRESENT(ZYDIS_ADDRESS_SIZE_HINT_MAX_VALUE)
} ZydisAddressSizeHint;
/**
* Defines possible values for operand size hints. See `ZydisEncoderRequest` for more information
* about operand size hints.
*/
typedef enum ZydisOperandSizeHint_
{
ZYDIS_OPERAND_SIZE_HINT_NONE,
ZYDIS_OPERAND_SIZE_HINT_8,
ZYDIS_OPERAND_SIZE_HINT_16,
ZYDIS_OPERAND_SIZE_HINT_32,
ZYDIS_OPERAND_SIZE_HINT_64,
/**
* Maximum value of this enum.
*/
ZYDIS_OPERAND_SIZE_HINT_MAX_VALUE = ZYDIS_OPERAND_SIZE_HINT_64,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_OPERAND_SIZE_HINT_REQUIRED_BITS =
ZYAN_BITS_TO_REPRESENT(ZYDIS_OPERAND_SIZE_HINT_MAX_VALUE)
} ZydisOperandSizeHint;
/**
* Describes explicit or implicit instruction operand.
*/
typedef struct ZydisEncoderOperand_
{
/**
* The type of the operand.
*/
ZydisOperandType type;
/**
* Extended info for register-operands.
*/
struct ZydisEncoderOperandReg_
{
/**
* The register value.
*/
ZydisRegister value;
/**
* Is this 4th operand (`VEX`/`XOP`). Despite its name, `is4` encoding can sometimes be
* applied to 3rd operand instead of 4th. This field is used to resolve such ambiguities.
* For all other operands it should be set to `ZYAN_FALSE`.
*/
ZyanBool is4;
} reg;
/**
* Extended info for memory-operands.
*/
struct ZydisEncoderOperandMem_
{
/**
* The base register.
*/
ZydisRegister base;
/**
* The index register.
*/
ZydisRegister index;
/**
* The scale factor.
*/
ZyanU8 scale;
/**
* The displacement value. This value is always treated as 64-bit signed integer, so it's
* important to take this into account when specifying absolute addresses. For example
* to specify a 16-bit address 0x8000 in 16-bit mode it should be sign extended to
* `0xFFFFFFFFFFFF8000`. See `address_size_hint` for more information about absolute
* addresses.
*/
ZyanI64 displacement;
/**
* Size of this operand in bytes.
*/
ZyanU16 size;
} mem;
/**
* Extended info for pointer-operands.
*/
struct ZydisEncoderOperandPtr_
{
/**
* The segment value.
*/
ZyanU16 segment;
/**
* The offset value.
*/
ZyanU32 offset;
} ptr;
/**
* Extended info for immediate-operands.
*/
union ZydisEncoderOperandImm_
{
/**
* The unsigned immediate value.
*/
ZyanU64 u;
/**
* The signed immediate value.
*/
ZyanI64 s;
} imm;
} ZydisEncoderOperand;
/**
* Main structure consumed by the encoder. It represents full semantics of an instruction.
*/
typedef struct ZydisEncoderRequest_
{
/**
* The machine mode used to encode this instruction.
*/
ZydisMachineMode machine_mode;
/**
* This optional field can be used to restrict allowed physical encodings for desired
* instruction. Some mnemonics can be supported by more than one encoding, so this field can
* resolve ambiguities e.g. you can disable `AVX-512` extensions by prohibiting usage of `EVEX`
* prefix and allow only `VEX` variants.
*/
ZydisEncodableEncoding allowed_encodings;
/**
* The instruction-mnemonic.
*/
ZydisMnemonic mnemonic;
/**
* A combination of requested encodable prefixes (`ZYDIS_ATTRIB_HAS_*` flags) for desired
* instruction. See `ZYDIS_ENCODABLE_PREFIXES` for list of available prefixes.
*/
ZydisInstructionAttributes prefixes;
/**
* Branch type (required for branching instructions only). Use `ZYDIS_BRANCH_TYPE_NONE` to let
* encoder pick size-optimal branch type automatically (`short` and `near` are prioritized over
* `far`).
*/
ZydisBranchType branch_type;
/**
* Specifies physical size for relative immediate operands. Use `ZYDIS_BRANCH_WIDTH_NONE` to
* let encoder pick size-optimal branch width automatically. For segment:offset `far` branches
* this field applies to physical size of the offset part. For branching instructions without
* relative operands this field affects effective operand size attribute.
*/
ZydisBranchWidth branch_width;
/**
* Optional address size hint used to resolve ambiguities for some instructions. Generally
* encoder deduces address size from `ZydisEncoderOperand` structures that represent
* explicit and implicit operands. This hint resolves conflicts when instruction's hidden
* operands scale with address size attribute.
*
* This hint is also used for instructions with absolute memory addresses (memory operands with
* displacement and no registers). Since displacement field is a 64-bit signed integer it's not
* possible to determine actual size of the address value in all situations. This hint
* specifies size of the address value provided inside encoder request rather than desired
* address size attribute of encoded instruction. Use `ZYDIS_ADDRESS_SIZE_HINT_NONE` to assume
* address size default for specified machine mode.
*/
ZydisAddressSizeHint address_size_hint;
/**
* Optional operand size hint used to resolve ambiguities for some instructions. Generally
* encoder deduces operand size from `ZydisEncoderOperand` structures that represent
* explicit and implicit operands. This hint resolves conflicts when instruction's hidden
* operands scale with operand size attribute.
*/
ZydisOperandSizeHint operand_size_hint;
/**
* The number of instruction-operands.
*/
ZyanU8 operand_count;
/**
* Detailed info for all explicit and implicit instruction operands.
*/
ZydisEncoderOperand operands[ZYDIS_ENCODER_MAX_OPERANDS];
/**
* Extended info for `EVEX` instructions.
*/
struct ZydisEncoderRequestEvexFeatures_
{
/**
* The broadcast-mode. Specify `ZYDIS_BROADCAST_MODE_INVALID` for instructions with
* static broadcast functionality.
*/
ZydisBroadcastMode broadcast;
/**
* The rounding-mode.
*/
ZydisRoundingMode rounding;
/**
* Signals, if the `SAE` (suppress-all-exceptions) functionality should be enabled for
* the instruction.
*/
ZyanBool sae;
/**
* Signals, if the zeroing-mask functionality should be enabled for the instruction.
* Specify `ZYAN_TRUE` for instructions with forced zeroing mask.
*/
ZyanBool zeroing_mask;
} evex;
/**
* Extended info for `MVEX` instructions.
*/
struct ZydisEncoderRequestMvexFeatures_
{
/**
* The broadcast-mode.
*/
ZydisBroadcastMode broadcast;
/**
* The data-conversion mode.
*/
ZydisConversionMode conversion;
/**
* The rounding-mode.
*/
ZydisRoundingMode rounding;
/**
* The `AVX` register-swizzle mode.
*/
ZydisSwizzleMode swizzle;
/**
* Signals, if the `SAE` (suppress-all-exceptions) functionality is enabled for
* the instruction.
*/
ZyanBool sae;
/**
* Signals, if the instruction has a memory-eviction-hint (`KNC` only).
*/
ZyanBool eviction_hint;
} mvex;
} ZydisEncoderRequest;
/* ============================================================================================== */
/* Exported functions */
/* ============================================================================================== */
/**
* @addtogroup encoder Encoder
* Functions allowing encoding of instruction bytes from a machine interpretable struct.
* @{
*/
/**
* Encodes instruction with semantics specified in encoder request structure.
*
* @param request A pointer to the `ZydisEncoderRequest` struct.
* @param buffer A pointer to the output buffer receiving encoded instruction.
* @param length A pointer to the variable containing length of the output buffer. Upon
* successful return this variable receives length of the encoded instruction.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisEncoderEncodeInstruction(const ZydisEncoderRequest *request,
void *buffer, ZyanUSize *length);
/**
* Encodes instruction with semantics specified in encoder request structure. This function expects
* absolute addresses inside encoder request instead of `EIP`/`RIP`-relative values. Function
* predicts final instruction length prior to encoding and writes back calculated relative operands
* to provided encoder request.
*
* @param request A pointer to the `ZydisEncoderRequest` struct.
* @param buffer A pointer to the output buffer receiving encoded instruction.
* @param length A pointer to the variable containing length of the output buffer. Upon
* successful return this variable receives length of the encoded
* instruction.
* @param runtime_address The runtime address of the instruction.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisEncoderEncodeInstructionAbsolute(ZydisEncoderRequest *request,
void *buffer, ZyanUSize *length, ZyanU64 runtime_address);
/**
* Converts decoded instruction to encoder request that can be passed to
* `ZydisEncoderEncodeInstruction`.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param operands A pointer to the decoded operands.
* @param operand_count The operand count.
* @param request A pointer to the `ZydisEncoderRequest` struct, that receives
* information necessary for encoder to re-encode the instruction.
*
* This function performs simple structure conversion and does minimal sanity checks on the
* input. There's no guarantee that produced request will be accepted by
* `ZydisEncoderEncodeInstruction` if malformed `ZydisDecodedInstruction` or malformed
* `ZydisDecodedOperands` is passed to this function.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisEncoderDecodedInstructionToEncoderRequest(
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands,
ZyanU8 operand_count, ZydisEncoderRequest* request);
/**
* Fills provided buffer with `NOP` instructions using longest possible multi-byte instructions.
*
* @param buffer A pointer to the output buffer receiving encoded instructions.
* @param length Size of the output buffer.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisEncoderNopFill(void *buffer, ZyanUSize length);
/** @} */
/* ============================================================================================== */
#ifdef __cplusplus
}
#endif
#endif /* ZYDIS_ENCODER_H */

View File

@ -61,7 +61,7 @@ extern "C" {
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisFormatterStyle` enum.
* Enum selecting the syntax to format the disassembly in.
*/
typedef enum ZydisFormatterStyle_
{
@ -96,7 +96,7 @@ typedef enum ZydisFormatterStyle_
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisFormatterProperty` enum.
* Enum selecting a property of the formatter.
*/
typedef enum ZydisFormatterProperty_
{
@ -176,16 +176,16 @@ typedef enum ZydisFormatterProperty_
/**
* Controls the padding of absolute address values.
*
* Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to padd all
* addresses to the current stack width (hexadecimal only), or any other integer value for
* Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to pad all
* addresses to the current address width (hexadecimal only), or any other integer value for
* custom padding.
*/
ZYDIS_FORMATTER_PROP_ADDR_PADDING_ABSOLUTE,
/**
* Controls the padding of relative address values.
*
* Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to padd all
* addresses to the current stack width (hexadecimal only), or any other integer value for
* Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to pad all
* addresses to the current address width (hexadecimal only), or any other integer value for
* custom padding.
*/
ZYDIS_FORMATTER_PROP_ADDR_PADDING_RELATIVE,
@ -262,6 +262,8 @@ typedef enum ZydisFormatterProperty_
* Controls the letter-case for decorators.
*
* Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
*
* WARNING: this is currently not implemented (ignored).
*/
ZYDIS_FORMATTER_PROP_UPPERCASE_DECORATORS,
@ -298,6 +300,16 @@ typedef enum ZydisFormatterProperty_
* The default value is `ZYAN_TRUE`.
*/
ZYDIS_FORMATTER_PROP_HEX_UPPERCASE,
/**
* Controls whether to prepend hexadecimal values with a leading zero if the first character
* is non-numeric.
*
* Pass `ZYAN_TRUE` to prepend a leading zero if the first character is non-numeric or
* `ZYAN_FALSE` to disable this functionality.
*
* The default value is `ZYAN_FALSE`.
*/
ZYDIS_FORMATTER_PROP_HEX_FORCE_LEADING_NUMBER,
/**
* Controls the prefix for hexadecimal values.
*
@ -332,7 +344,7 @@ typedef enum ZydisFormatterProperty_
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisNumericBase` enum.
* Enum defining different mantissae to be used during formatting.
*/
typedef enum ZydisNumericBase_
{
@ -358,7 +370,7 @@ typedef enum ZydisNumericBase_
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisSignedness` enum.
* Enum defining the signeness of integers to be used during formatting.
*/
typedef enum ZydisSignedness_
{
@ -389,7 +401,8 @@ typedef enum ZydisSignedness_
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisPadding` enum.
* Enum definining magic values that receive special treatment when used as padding properties
* of the formatter.
*/
typedef enum ZydisPadding_
{
@ -418,7 +431,7 @@ typedef enum ZydisPadding_
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisFormatterFunction` enum.
* Enum selecting a formatter function to be replaced with hooks.
*
* Do NOT change the order of the values this enum or the function fields inside the
* `ZydisFormatter` struct.
@ -582,7 +595,7 @@ typedef enum ZydisFormatterFunction_
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisDecorator` enum.
* Enum of all decorator types.
*/
typedef enum ZydisDecorator_
{
@ -633,7 +646,7 @@ typedef enum ZydisDecorator_
typedef struct ZydisFormatter_ ZydisFormatter;
/**
* Defines the `ZydisFormatterContext` struct.
* Context structure that that is passed to all formatter.
*/
typedef struct ZydisFormatterContext_
{
@ -641,6 +654,10 @@ typedef struct ZydisFormatterContext_
* A pointer to the `ZydisDecodedInstruction` struct.
*/
const ZydisDecodedInstruction* instruction;
/**
* A pointer to the first `ZydisDecodedOperand` struct of the instruction.
*/
const ZydisDecodedOperand* operands;
/**
* A pointer to the `ZydisDecodedOperand` struct.
*/
@ -651,6 +668,9 @@ typedef struct ZydisFormatterContext_
ZyanU64 runtime_address;
/**
* A pointer to user-defined data.
*
* This is the value that was previously passed as the `user_data` argument to
* @ref ZydisFormatterFormatInstruction or @ref ZydisFormatterTokenizeOperand.
*/
void* user_data;
} ZydisFormatterContext;
@ -741,7 +761,7 @@ typedef ZyanStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* formatte
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisFormatter` struct.
* Context structure keeping track of internal state of the formatter.
*
* All fields in this struct should be considered as "private". Any changes may lead to unexpected
* behavior.
@ -780,73 +800,77 @@ struct ZydisFormatter_
*/
ZyanBool print_branch_size;
/**
* The `ZYDIS_FORMATTER_DETAILED_PREFIXES` property.
* The `ZYDIS_FORMATTER_PROP_DETAILED_PREFIXES` property.
*/
ZyanBool detailed_prefixes;
/**
* The `ZYDIS_FORMATTER_ADDR_BASE` property.
* The `ZYDIS_FORMATTER_PROP_ADDR_BASE` property.
*/
ZydisNumericBase addr_base;
/**
* The `ZYDIS_FORMATTER_ADDR_SIGNEDNESS` property.
* The `ZYDIS_FORMATTER_PROP_ADDR_SIGNEDNESS` property.
*/
ZydisSignedness addr_signedness;
/**
* The `ZYDIS_FORMATTER_ADDR_PADDING_ABSOLUTE` property.
* The `ZYDIS_FORMATTER_PROP_ADDR_PADDING_ABSOLUTE` property.
*/
ZydisPadding addr_padding_absolute;
/**
* The `ZYDIS_FORMATTER_ADDR_PADDING_RELATIVE` property.
* The `ZYDIS_FORMATTER_PROP_ADDR_PADDING_RELATIVE` property.
*/
ZydisPadding addr_padding_relative;
/**
* The `ZYDIS_FORMATTER_DISP_BASE` property.
* The `ZYDIS_FORMATTER_PROP_DISP_BASE` property.
*/
ZydisNumericBase disp_base;
/**
* The `ZYDIS_FORMATTER_DISP_SIGNEDNESS` property.
* The `ZYDIS_FORMATTER_PROP_DISP_SIGNEDNESS` property.
*/
ZydisSignedness disp_signedness;
/**
* The `ZYDIS_FORMATTER_DISP_PADDING` property.
* The `ZYDIS_FORMATTER_PROP_DISP_PADDING` property.
*/
ZydisPadding disp_padding;
/**
* The `ZYDIS_FORMATTER_IMM_BASE` property.
* The `ZYDIS_FORMATTER_PROP_IMM_BASE` property.
*/
ZydisNumericBase imm_base;
/**
* The `ZYDIS_FORMATTER_IMM_SIGNEDNESS` property.
* The `ZYDIS_FORMATTER_PROP_IMM_SIGNEDNESS` property.
*/
ZydisSignedness imm_signedness;
/**
* The `ZYDIS_FORMATTER_IMM_PADDING` property.
* The `ZYDIS_FORMATTER_PROP_IMM_PADDING` property.
*/
ZydisPadding imm_padding;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_PREFIXES` property.
* The `ZYDIS_FORMATTER_PROP_UPPERCASE_PREFIXES` property.
*/
ZyanI32 case_prefixes;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_MNEMONIC` property.
* The `ZYDIS_FORMATTER_PROP_UPPERCASE_MNEMONIC` property.
*/
ZyanI32 case_mnemonic;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_REGISTERS` property.
* The `ZYDIS_FORMATTER_PROP_UPPERCASE_REGISTERS` property.
*/
ZyanI32 case_registers;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_TYPECASTS` property.
* The `ZYDIS_FORMATTER_PROP_UPPERCASE_TYPECASTS` property.
*/
ZyanI32 case_typecasts;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_DECORATORS` property.
* The `ZYDIS_FORMATTER_PROP_UPPERCASE_DECORATORS` property.
*/
ZyanI32 case_decorators;
/**
* The `ZYDIS_FORMATTER_HEX_UPPERCASE` property.
* The `ZYDIS_FORMATTER_PROP_HEX_UPPERCASE` property.
*/
ZyanBool hex_uppercase;
/**
* The `ZYDIS_FORMATTER_PROP_HEX_FORCE_LEADING_NUMBER` property.
*/
ZyanBool hex_force_leading_number;
/**
* The number formats for all numeric bases.
*
@ -1020,45 +1044,35 @@ ZYDIS_EXPORT ZyanStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param buffer A pointer to the output buffer.
* @param length The length of the output buffer (in characters).
* @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
* to print relative addresses.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
ZyanU64 runtime_address);
/**
* Formats the given instruction and writes it into the output buffer.
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param operands A pointer to the decoded operands array.
* @param operand_count The length of the `operands` array. Must be equal to or greater than
* the value of `instruction->operand_count_visible`.
* @param buffer A pointer to the output buffer.
* @param length The length of the output buffer (in characters).
* @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
* to print relative addresses.
* @param user_data A pointer to user-defined data which can be used in custom formatter
* callbacks.
* callbacks. Can be `ZYAN_NULL`.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
ZyanU64 runtime_address, void* user_data);
ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands,
ZyanU8 operand_count, char* buffer, ZyanUSize length, ZyanU64 runtime_address,
void* user_data);
/**
* 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 operand A pointer to the `ZydisDecodedOperand` struct of the operand to format.
* @param buffer A pointer to the output buffer.
* @param length The length of the output buffer (in characters).
* @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
* to print relative addresses.
* @param user_data A pointer to user-defined data which can be used in custom formatter
* callbacks. Can be `ZYAN_NULL`.
*
* @return A zyan status code.
*
@ -1066,30 +1080,8 @@ ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter*
* complete instruction.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
ZyanU64 runtime_address);
/**
* 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 length The length of the output buffer (in characters).
* @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
* to print relative addresses.
* @param user_data A pointer to user-defined data which can be used in custom formatter
* callbacks.
*
* @return A zyan status code.
*
* Use `ZydisFormatterFormatInstruction` or `ZydisFormatterFormatInstructionEx` to format a
* complete instruction.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
ZyanU64 runtime_address, void* user_data);
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
char* buffer, ZyanUSize length, ZyanU64 runtime_address, void* user_data);
/* ---------------------------------------------------------------------------------------------- */
/* Tokenizing */
@ -1100,80 +1092,46 @@ ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* form
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param operands A pointer to the decoded operands array.
* @param operand_count The length of the `operands` array. Must be equal to or greater than
* the value of `instruction->operand_count_visible`.
* @param buffer A pointer to the output buffer.
* @param length The length of the output buffer (in bytes).
* @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
* to print relative addresses.
* @param token Receives a pointer to the first token in the output buffer.
* @param user_data A pointer to user-defined data which can be used in custom formatter
* callbacks. Can be `ZYAN_NULL`.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
ZyanU64 runtime_address, ZydisFormatterTokenConst** token);
/**
* Tokenizes the given instruction and writes it into the output buffer.
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param buffer A pointer to the output buffer.
* @param length The length of the output buffer (in bytes).
* @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
* to print relative addresses.
* @param token Receives a pointer to the first token in the output buffer.
* @param user_data A pointer to user-defined data which can be used in custom formatter
* callbacks.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstructionEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data);
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands,
ZyanU8 operand_count, void* buffer, ZyanUSize length, ZyanU64 runtime_address,
ZydisFormatterTokenConst** token, void* user_data);
/**
* Tokenizes 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 operand A pointer to the `ZydisDecodedOperand` struct of the operand to format.
* @param buffer A pointer to the output buffer.
* @param length The length of the output buffer (in bytes).
* @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
* to print relative addresses.
* @param token Receives a pointer to the first token in the output buffer.
* @param user_data A pointer to user-defined data which can be used in custom formatter
* callbacks. Can be `ZYAN_NULL`.
*
* @return A zyan status code.
*
* Use `ZydisFormatterTokenizeInstruction` or `ZydisFormatterTokenizeInstructionEx` to tokenize a
* complete instruction.
* Use `ZydisFormatterTokenizeInstruction` to tokenize a complete instruction.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperand(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
ZyanU64 runtime_address, ZydisFormatterTokenConst** token);
/**
* Tokenizes 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 length The length of the output buffer (in bytes).
* @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
* to print relative addresses.
* @param token Receives a pointer to the first token in the output buffer.
* @param user_data A pointer to user-defined data which can be used in custom formatter
* callbacks.
*
* @return A zyan status code.
*
* Use `ZydisFormatterTokenizeInstruction` or `ZydisFormatterTokenizeInstructionEx` to tokenize a
* complete instruction.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperandEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data);
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
void* buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst** token,
void* user_data);
/* ---------------------------------------------------------------------------------------------- */

View File

@ -32,9 +32,9 @@
#ifndef ZYDIS_FORMATTER_TOKEN_H
#define ZYDIS_FORMATTER_TOKEN_H
#include <ZydisExportConfig.h>
#include <Zycore/String.h>
#include <Zycore/Types.h>
#include <Zydis/Defines.h>
#include <Zydis/Status.h>
#ifdef __cplusplus
@ -50,7 +50,7 @@ extern "C" {
/* ---------------------------------------------------------------------------------------------- */
/**
* @biref Defines the `ZydisTokenType` data-type.
* Defines the `ZydisTokenType` data-type.
*/
typedef ZyanU8 ZydisTokenType;

View File

@ -10,6 +10,7 @@ typedef enum ZydisISAExt_
ZYDIS_ISA_EXT_AMD3DNOW_PREFETCH,
ZYDIS_ISA_EXT_AMD_INVLPGB,
ZYDIS_ISA_EXT_AMX_BF16,
ZYDIS_ISA_EXT_AMX_FP16,
ZYDIS_ISA_EXT_AMX_INT8,
ZYDIS_ISA_EXT_AMX_TILE,
ZYDIS_ISA_EXT_AVX,
@ -18,7 +19,11 @@ typedef enum ZydisISAExt_
ZYDIS_ISA_EXT_AVX512EVEX,
ZYDIS_ISA_EXT_AVX512VEX,
ZYDIS_ISA_EXT_AVXAES,
ZYDIS_ISA_EXT_AVX_IFMA,
ZYDIS_ISA_EXT_AVX_NE_CONVERT,
ZYDIS_ISA_EXT_AVX_VNNI,
ZYDIS_ISA_EXT_AVX_VNNI_INT16,
ZYDIS_ISA_EXT_AVX_VNNI_INT8,
ZYDIS_ISA_EXT_BASE,
ZYDIS_ISA_EXT_BMI1,
ZYDIS_ISA_EXT_BMI2,
@ -34,6 +39,7 @@ typedef enum ZydisISAExt_
ZYDIS_ISA_EXT_FMA4,
ZYDIS_ISA_EXT_GFNI,
ZYDIS_ISA_EXT_HRESET,
ZYDIS_ISA_EXT_ICACHE_PREFETCH,
ZYDIS_ISA_EXT_INVPCID,
ZYDIS_ISA_EXT_KEYLOCKER,
ZYDIS_ISA_EXT_KEYLOCKER_WIDE,
@ -49,13 +55,17 @@ typedef enum ZydisISAExt_
ZYDIS_ISA_EXT_MOVBE,
ZYDIS_ISA_EXT_MOVDIR,
ZYDIS_ISA_EXT_MPX,
ZYDIS_ISA_EXT_MSRLIST,
ZYDIS_ISA_EXT_PADLOCK,
ZYDIS_ISA_EXT_PAUSE,
ZYDIS_ISA_EXT_PBNDKB,
ZYDIS_ISA_EXT_PCLMULQDQ,
ZYDIS_ISA_EXT_PCOMMIT,
ZYDIS_ISA_EXT_PCONFIG,
ZYDIS_ISA_EXT_PKU,
ZYDIS_ISA_EXT_PREFETCHWT1,
ZYDIS_ISA_EXT_PT,
ZYDIS_ISA_EXT_RAO_INT,
ZYDIS_ISA_EXT_RDPID,
ZYDIS_ISA_EXT_RDPRU,
ZYDIS_ISA_EXT_RDRAND,
@ -67,6 +77,9 @@ typedef enum ZydisISAExt_
ZYDIS_ISA_EXT_SGX,
ZYDIS_ISA_EXT_SGX_ENCLV,
ZYDIS_ISA_EXT_SHA,
ZYDIS_ISA_EXT_SHA512,
ZYDIS_ISA_EXT_SM3,
ZYDIS_ISA_EXT_SM4,
ZYDIS_ISA_EXT_SMAP,
ZYDIS_ISA_EXT_SMX,
ZYDIS_ISA_EXT_SNP,
@ -86,6 +99,7 @@ typedef enum ZydisISAExt_
ZYDIS_ISA_EXT_VPCLMULQDQ,
ZYDIS_ISA_EXT_VTX,
ZYDIS_ISA_EXT_WAITPKG,
ZYDIS_ISA_EXT_WRMSRNS,
ZYDIS_ISA_EXT_X87,
ZYDIS_ISA_EXT_XOP,
ZYDIS_ISA_EXT_XSAVE,

View File

@ -8,7 +8,9 @@ typedef enum ZydisISASet_
ZYDIS_ISA_SET_AES,
ZYDIS_ISA_SET_AMD,
ZYDIS_ISA_SET_AMD3DNOW,
ZYDIS_ISA_SET_AMD_INVLPGB,
ZYDIS_ISA_SET_AMX_BF16,
ZYDIS_ISA_SET_AMX_FP16,
ZYDIS_ISA_SET_AMX_INT8,
ZYDIS_ISA_SET_AMX_TILE,
ZYDIS_ISA_SET_AVX,
@ -80,7 +82,11 @@ typedef enum ZydisISASet_
ZYDIS_ISA_SET_AVX512_VPOPCNTDQ_512,
ZYDIS_ISA_SET_AVXAES,
ZYDIS_ISA_SET_AVX_GFNI,
ZYDIS_ISA_SET_AVX_IFMA,
ZYDIS_ISA_SET_AVX_NE_CONVERT,
ZYDIS_ISA_SET_AVX_VNNI,
ZYDIS_ISA_SET_AVX_VNNI_INT16,
ZYDIS_ISA_SET_AVX_VNNI_INT8,
ZYDIS_ISA_SET_BMI1,
ZYDIS_ISA_SET_BMI2,
ZYDIS_ISA_SET_CET,
@ -95,6 +101,7 @@ typedef enum ZydisISASet_
ZYDIS_ISA_SET_F16C,
ZYDIS_ISA_SET_FAT_NOP,
ZYDIS_ISA_SET_FCMOV,
ZYDIS_ISA_SET_FCOMI,
ZYDIS_ISA_SET_FMA,
ZYDIS_ISA_SET_FMA4,
ZYDIS_ISA_SET_FXSAVE,
@ -108,6 +115,7 @@ typedef enum ZydisISASet_
ZYDIS_ISA_SET_I486,
ZYDIS_ISA_SET_I486REAL,
ZYDIS_ISA_SET_I86,
ZYDIS_ISA_SET_ICACHE_PREFETCH,
ZYDIS_ISA_SET_INVPCID,
ZYDIS_ISA_SET_KEYLOCKER,
ZYDIS_ISA_SET_KEYLOCKER_WIDE,
@ -127,12 +135,15 @@ typedef enum ZydisISASet_
ZYDIS_ISA_SET_MOVBE,
ZYDIS_ISA_SET_MOVDIR,
ZYDIS_ISA_SET_MPX,
ZYDIS_ISA_SET_MSRLIST,
ZYDIS_ISA_SET_PADLOCK_ACE,
ZYDIS_ISA_SET_PADLOCK_PHE,
ZYDIS_ISA_SET_PADLOCK_PMM,
ZYDIS_ISA_SET_PADLOCK_RNG,
ZYDIS_ISA_SET_PAUSE,
ZYDIS_ISA_SET_PBNDKB,
ZYDIS_ISA_SET_PCLMULQDQ,
ZYDIS_ISA_SET_PCOMMIT,
ZYDIS_ISA_SET_PCONFIG,
ZYDIS_ISA_SET_PENTIUMMMX,
ZYDIS_ISA_SET_PENTIUMREAL,
@ -142,6 +153,7 @@ typedef enum ZydisISASet_
ZYDIS_ISA_SET_PREFETCHWT1,
ZYDIS_ISA_SET_PREFETCH_NOP,
ZYDIS_ISA_SET_PT,
ZYDIS_ISA_SET_RAO_INT,
ZYDIS_ISA_SET_RDPID,
ZYDIS_ISA_SET_RDPMC,
ZYDIS_ISA_SET_RDPRU,
@ -154,8 +166,12 @@ typedef enum ZydisISASet_
ZYDIS_ISA_SET_SGX,
ZYDIS_ISA_SET_SGX_ENCLV,
ZYDIS_ISA_SET_SHA,
ZYDIS_ISA_SET_SHA512,
ZYDIS_ISA_SET_SM3,
ZYDIS_ISA_SET_SM4,
ZYDIS_ISA_SET_SMAP,
ZYDIS_ISA_SET_SMX,
ZYDIS_ISA_SET_SNP,
ZYDIS_ISA_SET_SSE,
ZYDIS_ISA_SET_SSE2,
ZYDIS_ISA_SET_SSE2MMX,
@ -178,6 +194,7 @@ typedef enum ZydisISASet_
ZYDIS_ISA_SET_VPCLMULQDQ,
ZYDIS_ISA_SET_VTX,
ZYDIS_ISA_SET_WAITPKG,
ZYDIS_ISA_SET_WRMSRNS,
ZYDIS_ISA_SET_X87,
ZYDIS_ISA_SET_XOP,
ZYDIS_ISA_SET_XSAVE,

View File

@ -17,6 +17,7 @@ typedef enum ZydisInstructionCategory_
ZYDIS_CATEGORY_AVX512_BITALG,
ZYDIS_CATEGORY_AVX512_VBMI,
ZYDIS_CATEGORY_AVX512_VP2INTERSECT,
ZYDIS_CATEGORY_AVX_IFMA,
ZYDIS_CATEGORY_BINARY,
ZYDIS_CATEGORY_BITBYTE,
ZYDIS_CATEGORY_BLEND,
@ -63,9 +64,12 @@ typedef enum ZydisInstructionCategory_
ZYDIS_CATEGORY_MMX,
ZYDIS_CATEGORY_MOVDIR,
ZYDIS_CATEGORY_MPX,
ZYDIS_CATEGORY_MSRLIST,
ZYDIS_CATEGORY_NOP,
ZYDIS_CATEGORY_PADLOCK,
ZYDIS_CATEGORY_PBNDKB,
ZYDIS_CATEGORY_PCLMULQDQ,
ZYDIS_CATEGORY_PCOMMIT,
ZYDIS_CATEGORY_PCONFIG,
ZYDIS_CATEGORY_PKU,
ZYDIS_CATEGORY_POP,
@ -87,6 +91,7 @@ typedef enum ZydisInstructionCategory_
ZYDIS_CATEGORY_SETCC,
ZYDIS_CATEGORY_SGX,
ZYDIS_CATEGORY_SHA,
ZYDIS_CATEGORY_SHA512,
ZYDIS_CATEGORY_SHIFT,
ZYDIS_CATEGORY_SMAP,
ZYDIS_CATEGORY_SSE,
@ -108,6 +113,7 @@ typedef enum ZydisInstructionCategory_
ZYDIS_CATEGORY_VTX,
ZYDIS_CATEGORY_WAITPKG,
ZYDIS_CATEGORY_WIDENOP,
ZYDIS_CATEGORY_WRMSRNS,
ZYDIS_CATEGORY_X87_ALU,
ZYDIS_CATEGORY_XOP,
ZYDIS_CATEGORY_XSAVE,

View File

@ -6,7 +6,9 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_INVALID,
ZYDIS_MNEMONIC_AAA,
ZYDIS_MNEMONIC_AAD,
ZYDIS_MNEMONIC_AADD,
ZYDIS_MNEMONIC_AAM,
ZYDIS_MNEMONIC_AAND,
ZYDIS_MNEMONIC_AAS,
ZYDIS_MNEMONIC_ADC,
ZYDIS_MNEMONIC_ADCX,
@ -38,7 +40,9 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_ANDNPS,
ZYDIS_MNEMONIC_ANDPD,
ZYDIS_MNEMONIC_ANDPS,
ZYDIS_MNEMONIC_AOR,
ZYDIS_MNEMONIC_ARPL,
ZYDIS_MNEMONIC_AXOR,
ZYDIS_MNEMONIC_BEXTR,
ZYDIS_MNEMONIC_BLCFILL,
ZYDIS_MNEMONIC_BLCI,
@ -519,6 +523,7 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_PAVGW,
ZYDIS_MNEMONIC_PBLENDVB,
ZYDIS_MNEMONIC_PBLENDW,
ZYDIS_MNEMONIC_PBNDKB,
ZYDIS_MNEMONIC_PCLMULQDQ,
ZYDIS_MNEMONIC_PCMPEQB,
ZYDIS_MNEMONIC_PCMPEQD,
@ -532,6 +537,7 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_PCMPGTW,
ZYDIS_MNEMONIC_PCMPISTRI,
ZYDIS_MNEMONIC_PCMPISTRM,
ZYDIS_MNEMONIC_PCOMMIT,
ZYDIS_MNEMONIC_PCONFIG,
ZYDIS_MNEMONIC_PDEP,
ZYDIS_MNEMONIC_PEXT,
@ -615,6 +621,8 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_POPFQ,
ZYDIS_MNEMONIC_POR,
ZYDIS_MNEMONIC_PREFETCH,
ZYDIS_MNEMONIC_PREFETCHIT0,
ZYDIS_MNEMONIC_PREFETCHIT1,
ZYDIS_MNEMONIC_PREFETCHNTA,
ZYDIS_MNEMONIC_PREFETCHT0,
ZYDIS_MNEMONIC_PREFETCHT1,
@ -675,6 +683,7 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_RDFSBASE,
ZYDIS_MNEMONIC_RDGSBASE,
ZYDIS_MNEMONIC_RDMSR,
ZYDIS_MNEMONIC_RDMSRLIST,
ZYDIS_MNEMONIC_RDPID,
ZYDIS_MNEMONIC_RDPKRU,
ZYDIS_MNEMONIC_RDPMC,
@ -788,6 +797,7 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_TDPBSUD,
ZYDIS_MNEMONIC_TDPBUSD,
ZYDIS_MNEMONIC_TDPBUUD,
ZYDIS_MNEMONIC_TDPFP16PS,
ZYDIS_MNEMONIC_TEST,
ZYDIS_MNEMONIC_TESTUI,
ZYDIS_MNEMONIC_TILELOADD,
@ -839,6 +849,8 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_VANDNPS,
ZYDIS_MNEMONIC_VANDPD,
ZYDIS_MNEMONIC_VANDPS,
ZYDIS_MNEMONIC_VBCSTNEBF162PS,
ZYDIS_MNEMONIC_VBCSTNESH2PS,
ZYDIS_MNEMONIC_VBLENDMPD,
ZYDIS_MNEMONIC_VBLENDMPS,
ZYDIS_MNEMONIC_VBLENDPD,
@ -880,6 +892,10 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_VCVTFXPNTPS2UDQ,
ZYDIS_MNEMONIC_VCVTFXPNTUDQ2PS,
ZYDIS_MNEMONIC_VCVTNE2PS2BF16,
ZYDIS_MNEMONIC_VCVTNEEBF162PS,
ZYDIS_MNEMONIC_VCVTNEEPH2PS,
ZYDIS_MNEMONIC_VCVTNEOBF162PS,
ZYDIS_MNEMONIC_VCVTNEOPH2PS,
ZYDIS_MNEMONIC_VCVTNEPS2BF16,
ZYDIS_MNEMONIC_VCVTPD2DQ,
ZYDIS_MNEMONIC_VCVTPD2PH,
@ -1341,10 +1357,22 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_VPCOMW,
ZYDIS_MNEMONIC_VPCONFLICTD,
ZYDIS_MNEMONIC_VPCONFLICTQ,
ZYDIS_MNEMONIC_VPDPBSSD,
ZYDIS_MNEMONIC_VPDPBSSDS,
ZYDIS_MNEMONIC_VPDPBSUD,
ZYDIS_MNEMONIC_VPDPBSUDS,
ZYDIS_MNEMONIC_VPDPBUSD,
ZYDIS_MNEMONIC_VPDPBUSDS,
ZYDIS_MNEMONIC_VPDPBUUD,
ZYDIS_MNEMONIC_VPDPBUUDS,
ZYDIS_MNEMONIC_VPDPWSSD,
ZYDIS_MNEMONIC_VPDPWSSDS,
ZYDIS_MNEMONIC_VPDPWSUD,
ZYDIS_MNEMONIC_VPDPWSUDS,
ZYDIS_MNEMONIC_VPDPWUSD,
ZYDIS_MNEMONIC_VPDPWUSDS,
ZYDIS_MNEMONIC_VPDPWUUD,
ZYDIS_MNEMONIC_VPDPWUUDS,
ZYDIS_MNEMONIC_VPERM2F128,
ZYDIS_MNEMONIC_VPERM2I128,
ZYDIS_MNEMONIC_VPERMB,
@ -1681,12 +1709,20 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_VSCATTERPF1QPS,
ZYDIS_MNEMONIC_VSCATTERQPD,
ZYDIS_MNEMONIC_VSCATTERQPS,
ZYDIS_MNEMONIC_VSHA512MSG1,
ZYDIS_MNEMONIC_VSHA512MSG2,
ZYDIS_MNEMONIC_VSHA512RNDS2,
ZYDIS_MNEMONIC_VSHUFF32X4,
ZYDIS_MNEMONIC_VSHUFF64X2,
ZYDIS_MNEMONIC_VSHUFI32X4,
ZYDIS_MNEMONIC_VSHUFI64X2,
ZYDIS_MNEMONIC_VSHUFPD,
ZYDIS_MNEMONIC_VSHUFPS,
ZYDIS_MNEMONIC_VSM3MSG1,
ZYDIS_MNEMONIC_VSM3MSG2,
ZYDIS_MNEMONIC_VSM3RNDS2,
ZYDIS_MNEMONIC_VSM4KEY4,
ZYDIS_MNEMONIC_VSM4RNDS4,
ZYDIS_MNEMONIC_VSQRTPD,
ZYDIS_MNEMONIC_VSQRTPH,
ZYDIS_MNEMONIC_VSQRTPS,
@ -1719,6 +1755,8 @@ typedef enum ZydisMnemonic_
ZYDIS_MNEMONIC_WRFSBASE,
ZYDIS_MNEMONIC_WRGSBASE,
ZYDIS_MNEMONIC_WRMSR,
ZYDIS_MNEMONIC_WRMSRLIST,
ZYDIS_MNEMONIC_WRMSRNS,
ZYDIS_MNEMONIC_WRPKRU,
ZYDIS_MNEMONIC_WRSSD,
ZYDIS_MNEMONIC_WRSSQ,

View File

@ -26,6 +26,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_R13B,
ZYDIS_REGISTER_R14B,
ZYDIS_REGISTER_R15B,
// General purpose registers 16-bit
ZYDIS_REGISTER_AX,
ZYDIS_REGISTER_CX,
@ -43,6 +44,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_R13W,
ZYDIS_REGISTER_R14W,
ZYDIS_REGISTER_R15W,
// General purpose registers 32-bit
ZYDIS_REGISTER_EAX,
ZYDIS_REGISTER_ECX,
@ -60,6 +62,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_R13D,
ZYDIS_REGISTER_R14D,
ZYDIS_REGISTER_R15D,
// General purpose registers 64-bit
ZYDIS_REGISTER_RAX,
ZYDIS_REGISTER_RCX,
@ -77,6 +80,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_R13,
ZYDIS_REGISTER_R14,
ZYDIS_REGISTER_R15,
// Floating point legacy registers
ZYDIS_REGISTER_ST0,
ZYDIS_REGISTER_ST1,
@ -89,6 +93,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_X87CONTROL,
ZYDIS_REGISTER_X87STATUS,
ZYDIS_REGISTER_X87TAG,
// Floating point multimedia registers
ZYDIS_REGISTER_MM0,
ZYDIS_REGISTER_MM1,
@ -98,6 +103,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_MM5,
ZYDIS_REGISTER_MM6,
ZYDIS_REGISTER_MM7,
// Floating point vector registers 128-bit
ZYDIS_REGISTER_XMM0,
ZYDIS_REGISTER_XMM1,
@ -131,6 +137,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_XMM29,
ZYDIS_REGISTER_XMM30,
ZYDIS_REGISTER_XMM31,
// Floating point vector registers 256-bit
ZYDIS_REGISTER_YMM0,
ZYDIS_REGISTER_YMM1,
@ -164,6 +171,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_YMM29,
ZYDIS_REGISTER_YMM30,
ZYDIS_REGISTER_YMM31,
// Floating point vector registers 512-bit
ZYDIS_REGISTER_ZMM0,
ZYDIS_REGISTER_ZMM1,
@ -197,6 +205,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_ZMM29,
ZYDIS_REGISTER_ZMM30,
ZYDIS_REGISTER_ZMM31,
// Matrix registers
ZYDIS_REGISTER_TMM0,
ZYDIS_REGISTER_TMM1,
@ -206,14 +215,17 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_TMM5,
ZYDIS_REGISTER_TMM6,
ZYDIS_REGISTER_TMM7,
// 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,
@ -221,11 +233,13 @@ typedef enum ZydisRegister_
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,
@ -235,6 +249,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_TR5,
ZYDIS_REGISTER_TR6,
ZYDIS_REGISTER_TR7,
// Control registers
ZYDIS_REGISTER_CR0,
ZYDIS_REGISTER_CR1,
@ -252,6 +267,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_CR13,
ZYDIS_REGISTER_CR14,
ZYDIS_REGISTER_CR15,
// Debug registers
ZYDIS_REGISTER_DR0,
ZYDIS_REGISTER_DR1,
@ -269,6 +285,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_DR13,
ZYDIS_REGISTER_DR14,
ZYDIS_REGISTER_DR15,
// Mask registers
ZYDIS_REGISTER_K0,
ZYDIS_REGISTER_K1,
@ -278,6 +295,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_K5,
ZYDIS_REGISTER_K6,
ZYDIS_REGISTER_K7,
// Bound registers
ZYDIS_REGISTER_BND0,
ZYDIS_REGISTER_BND1,
@ -285,6 +303,7 @@ typedef enum ZydisRegister_
ZYDIS_REGISTER_BND3,
ZYDIS_REGISTER_BNDCFG,
ZYDIS_REGISTER_BNDSTATUS,
// Uncategorized
ZYDIS_REGISTER_MXCSR,
ZYDIS_REGISTER_PKRU,

View File

@ -28,7 +28,8 @@
#define ZYDIS_INTERNAL_DECODERDATA_H
#include <Zycore/Defines.h>
#include <Zydis/DecoderTypes.h>
#include <Zycore/Types.h>
#include <Zydis/Defines.h>
#ifdef __cplusplus
extern "C" {
@ -172,7 +173,15 @@ enum ZydisDecoderTreeNodeTypes
/**
* Reference to a CLDEMOTE-mode filter.
*/
ZYDIS_NODETYPE_FILTER_MODE_CLDEMOTE = 0x1B
ZYDIS_NODETYPE_FILTER_MODE_CLDEMOTE = 0x1B,
/**
* Reference to a IPREFETCH-mode filter.
*/
ZYDIS_NODETYPE_FILTER_MODE_IPREFETCH = 0x1C,
/**
* Reference to a UD0_COMPAT-mode filter.
*/
ZYDIS_NODETYPE_FILTER_MODE_UD0_COMPAT = 0x1D
};
/* ---------------------------------------------------------------------------------------------- */

View File

@ -0,0 +1,253 @@
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Mappa
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***************************************************************************************************/
#ifndef ZYDIS_INTERNAL_ENCODERDATA_H
#define ZYDIS_INTERNAL_ENCODERDATA_H
#include <Zycore/Defines.h>
#include <Zydis/Mnemonic.h>
#include <Zydis/SharedTypes.h>
/**
* Used in encoder's table to represent standard ISA sizes in form of bit flags.
*/
typedef enum ZydisWidthFlag_
{
ZYDIS_WIDTH_INVALID = 0x00,
ZYDIS_WIDTH_16 = 0x01,
ZYDIS_WIDTH_32 = 0x02,
ZYDIS_WIDTH_64 = 0x04,
/**
* Maximum value of this enum.
*/
ZYDIS_WIDTH_MAX_VALUE = (ZYDIS_WIDTH_64 | (ZYDIS_WIDTH_64 - 1)),
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_WIDTH_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_WIDTH_MAX_VALUE)
} ZydisWidthFlag;
/**
* Used in encoder's table to represent mandatory instruction prefix. Using this enum instead of
* actual prefix value saves space.
*/
typedef enum ZydisMandatoryPrefix_
{
ZYDIS_MANDATORY_PREFIX_NONE,
ZYDIS_MANDATORY_PREFIX_66,
ZYDIS_MANDATORY_PREFIX_F2,
ZYDIS_MANDATORY_PREFIX_F3,
/**
* Maximum value of this enum.
*/
ZYDIS_MANDATORY_PREFIX_MAX_VALUE = ZYDIS_MANDATORY_PREFIX_F3,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_MANDATORY_PREFIX_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_MANDATORY_PREFIX_MAX_VALUE)
} ZydisMandatoryPrefix;
/**
* Used in encoder's table to represent vector size supported by instruction definition.
*/
typedef enum ZydisVectorLength_
{
ZYDIS_VECTOR_LENGTH_INVALID,
ZYDIS_VECTOR_LENGTH_128,
ZYDIS_VECTOR_LENGTH_256,
ZYDIS_VECTOR_LENGTH_512,
/**
* Maximum value of this enum.
*/
ZYDIS_VECTOR_LENGTH_MAX_VALUE = ZYDIS_VECTOR_LENGTH_512,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_VECTOR_LENGTH_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_VECTOR_LENGTH_MAX_VALUE)
} ZydisVectorLength;
/**
* Used in encoder's table to represent hint type supported by instruction definition.
*/
typedef enum ZydisSizeHint_
{
ZYDIS_SIZE_HINT_NONE,
ZYDIS_SIZE_HINT_ASZ,
ZYDIS_SIZE_HINT_OSZ,
/**
* Maximum value of this enum.
*/
ZYDIS_SIZE_HINT_MAX_VALUE = ZYDIS_SIZE_HINT_OSZ,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_SIZE_HINT_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_SIZE_HINT_MAX_VALUE)
} ZydisSizeHint;
/**
* Used in encoder's primary lookup table which allows to access a set of instruction definitions
* for specified mnemonic in constant time.
*/
typedef struct ZydisEncoderLookupEntry_
{
/**
* Index to main array of `ZydisEncodableInstruction`.
*/
ZyanU16 encoder_reference;
/**
* The number of entries.
*/
ZyanU8 instruction_count;
} ZydisEncoderLookupEntry;
#pragma pack(push, 1)
/**
* This structure is encoder's internal representation of encodable instruction definition.
*/
typedef struct ZydisEncodableInstruction_
{
/**
* Index to one of decoder's instruction definition arrays.
*/
ZyanU16 instruction_reference;
/**
* Compressed information about operand count and types. Operand count is stored in lowest bits.
* Types of subsequent operands are stored in higher bits.
*/
ZyanU16 operand_mask;
/**
* The instruction-opcode.
*/
ZyanU8 opcode;
/**
* The mandatory ModR/M value.
*/
ZyanU8 modrm;
/**
* The instruction-encoding.
*/
ZyanU8 encoding ZYAN_BITFIELD(ZYDIS_INSTRUCTION_ENCODING_REQUIRED_BITS);
/**
* The opcode map.
*/
ZyanU8 opcode_map ZYAN_BITFIELD(ZYDIS_OPCODE_MAP_REQUIRED_BITS);
/**
* The combination of allowed processor modes.
*/
ZyanU8 modes ZYAN_BITFIELD(ZYDIS_WIDTH_REQUIRED_BITS);
/**
* The combination of allowed address sizes.
*/
ZyanU8 address_sizes ZYAN_BITFIELD(ZYDIS_WIDTH_REQUIRED_BITS);
/**
* The combination of allowed operand sizes.
*/
ZyanU8 operand_sizes ZYAN_BITFIELD(ZYDIS_WIDTH_REQUIRED_BITS);
/**
* The mandatory prefix.
*/
ZyanU8 mandatory_prefix ZYAN_BITFIELD(ZYDIS_MANDATORY_PREFIX_REQUIRED_BITS);
/**
* True if `REX.W` is required for this definition.
*/
ZyanU8 rex_w ZYAN_BITFIELD(1);
/**
* The vector length.
*/
ZyanU8 vector_length ZYAN_BITFIELD(ZYDIS_MANDATORY_PREFIX_REQUIRED_BITS);
/**
* The accepted sizing hint.
*/
ZyanU8 accepts_hint ZYAN_BITFIELD(ZYDIS_SIZE_HINT_REQUIRED_BITS);
/**
* Indicates that next instruction definition can be safely used instead of current one. This
* is used with some `VEX` instructions to take advantage of 2-byte `VEX` prefix when possible.
* 2-byte `VEX` allows to use high registers only when operand is encoded in `modrm_reg`
* (high bit in `REX.R`). Encoder uses swappable definitions to take advantage of this
* optimization opportunity.
*
* Second use of this field is to handle special case for `mov` instruction. This particular
* conflict is described in detail inside `ZydisHandleSwappableDefinition`.
*/
ZyanU8 swappable ZYAN_BITFIELD(1);
} ZydisEncodableInstruction;
#pragma pack(pop)
/**
* Contains information used by instruction size prediction algorithm inside
* `ZydisEncoderEncodeInstructionAbsolute`.
*/
typedef struct ZydisEncoderRelInfo_
{
/**
* Sizes of instruction variants. First index is effective address size. Second index is
* desired immediate size (8, 16 and 32 bits respectively).
*/
ZyanU8 size[3][3];
/**
* See `ZydisSizeHint`.
*/
ZyanU8 accepts_scaling_hints;
/**
* True if instruction accepts branch hint prefixes.
*/
ZyanBool accepts_branch_hints;
/**
* True if instruction accepts bound (`BND`) prefix.
*/
ZyanBool accepts_bound;
} ZydisEncoderRelInfo;
/**
* Fetches array of `ZydisEncodableInstruction` structures and its size for given instruction
* mnemonic.
*
* @param mnemonic Instruction mnemonic.
* @param instruction This variable will receive a pointer to the array of
* `ZydisEncodableInstruction` structures.
*
* @return Entry count (0 if function failed).
*/
ZyanU8 ZydisGetEncodableInstructions(ZydisMnemonic mnemonic,
const ZydisEncodableInstruction **instruction);
/**
* Fetches `ZydisEncoderRelInfo` record for given instruction mnemonic.
*
* @param mnemonic Instruction mnemonic.
*
* @return Pointer to `ZydisEncoderRelInfo` structure or `ZYAN_NULL` if instruction doesn't have
* relative operands.
*/
const ZydisEncoderRelInfo *ZydisGetRelInfo(ZydisMnemonic mnemonic);
#endif /* ZYDIS_INTERNAL_ENCODERDATA_H */

View File

@ -116,6 +116,7 @@ static const ZydisFormatter FORMATTER_ATT =
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
/* hex_uppercase */ ZYAN_TRUE,
/* hex_force_leading_number */ ZYAN_FALSE,
/* number_format */
{
// ZYDIS_NUMERIC_BASE_DEC

View File

@ -53,10 +53,13 @@ extern "C" {
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param base The numeric base.
* @param str The destination string.
* @param value The value.
* @param value The value to append.
* @param padding_length The padding length.
* @param force_leading_number Enable this option to prepend a leading `0` if the first
* character is non-numeric.
*/
#define ZYDIS_STRING_APPEND_NUM_U(formatter, base, str, value, padding_length) \
#define ZYDIS_STRING_APPEND_NUM_U(formatter, base, str, value, padding_length, \
force_leading_number) \
switch (base) \
{ \
case ZYDIS_NUMERIC_BASE_DEC: \
@ -65,7 +68,7 @@ extern "C" {
(formatter)->number_format[base][1].string)); \
break; \
case ZYDIS_NUMERIC_BASE_HEX: \
ZYAN_CHECK(ZydisStringAppendHexU(str, value, padding_length, \
ZYAN_CHECK(ZydisStringAppendHexU(str, value, padding_length, force_leading_number, \
(formatter)->hex_uppercase, \
(formatter)->number_format[base][0].string, \
(formatter)->number_format[base][1].string)); \
@ -80,11 +83,14 @@ extern "C" {
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param base The numeric base.
* @param str The destination string.
* @param value The value.
* @param value The value to append.
* @param padding_length The padding length.
* @param force_sign Forces printing of the '+' sign for positive numbers.
* @param force_leading_number Enable this option to prepend a leading `0`, if the first
* character is non-numeric.
* @param force_sign Enable to print the '+' sign for positive numbers.
*/
#define ZYDIS_STRING_APPEND_NUM_S(formatter, base, str, value, padding_length, force_sign) \
#define ZYDIS_STRING_APPEND_NUM_S(formatter, base, str, value, padding_length, \
force_leading_number, force_sign) \
switch (base) \
{ \
case ZYDIS_NUMERIC_BASE_DEC: \
@ -93,7 +99,7 @@ extern "C" {
(formatter)->number_format[base][1].string)); \
break; \
case ZYDIS_NUMERIC_BASE_HEX: \
ZYAN_CHECK(ZydisStringAppendHexS(str, value, padding_length, \
ZYAN_CHECK(ZydisStringAppendHexS(str, value, padding_length, force_leading_number, \
(formatter)->hex_uppercase, force_sign, \
(formatter)->number_format[base][0].string, \
(formatter)->number_format[base][1].string)); \
@ -162,7 +168,7 @@ extern "C" {
*
* @param buffer A pointer to the `ZydisFormatterBuffer` struct.
* @param name The base name (without prefix) of the string- or token.
* @param letter-case The desired letter-case.
* @param letter_case The desired letter-case.
*/
#define ZYDIS_BUFFER_APPEND_CASE(buffer, name, letter_case) \
if ((buffer)->is_token_list) \
@ -252,7 +258,7 @@ ZYAN_INLINE ZyanStatus ZydisFormatterBufferAppendPredefined(ZydisFormatterBuffer
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param context A pointer to the `ZydisFormatterContext` struct.
* @param memop_id The operand-id of the instructions first memory operand.
* @param operand The instructions first memory operand.
*
* @return Returns the explicit size, if required, or `0`, if not needed.
*
@ -260,7 +266,7 @@ ZYAN_INLINE ZyanStatus ZydisFormatterBufferAppendPredefined(ZydisFormatterBuffer
* is set to `ZYAN_TRUE`.
*/
ZyanU32 ZydisFormatterHelperGetExplicitSize(const ZydisFormatter* formatter,
ZydisFormatterContext* context, ZyanU8 memop_id);
ZydisFormatterContext* context, const ZydisDecodedOperand* operand);
/* ---------------------------------------------------------------------------------------------- */

View File

@ -115,6 +115,7 @@ static const ZydisFormatter FORMATTER_INTEL =
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
/* hex_uppercase */ ZYAN_TRUE,
/* hex_force_leading_number */ ZYAN_FALSE,
/* number_format */
{
// ZYDIS_NUMERIC_BASE_DEC
@ -203,6 +204,7 @@ static const ZydisFormatter FORMATTER_INTEL_MASM =
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
/* hex_uppercase */ ZYAN_TRUE,
/* hex_force_leading_number */ ZYAN_TRUE,
/* number_format */
{
// ZYDIS_NUMERIC_BASE_DEC

View File

@ -116,11 +116,15 @@ typedef enum ZydisInternalElementType_
ZYDIS_IELEMENT_TYPE_UINT,
ZYDIS_IELEMENT_TYPE_INT1,
ZYDIS_IELEMENT_TYPE_INT8,
ZYDIS_IELEMENT_TYPE_INT8X4,
ZYDIS_IELEMENT_TYPE_INT16,
ZYDIS_IELEMENT_TYPE_INT16X2,
ZYDIS_IELEMENT_TYPE_INT32,
ZYDIS_IELEMENT_TYPE_INT64,
ZYDIS_IELEMENT_TYPE_UINT8,
ZYDIS_IELEMENT_TYPE_UINT8X4,
ZYDIS_IELEMENT_TYPE_UINT16,
ZYDIS_IELEMENT_TYPE_UINT16X2,
ZYDIS_IELEMENT_TYPE_UINT32,
ZYDIS_IELEMENT_TYPE_UINT64,
ZYDIS_IELEMENT_TYPE_UINT128,
@ -130,6 +134,7 @@ typedef enum ZydisInternalElementType_
ZYDIS_IELEMENT_TYPE_FLOAT32,
ZYDIS_IELEMENT_TYPE_FLOAT64,
ZYDIS_IELEMENT_TYPE_FLOAT80,
ZYDIS_IELEMENT_TYPE_BFLOAT16X2,
ZYDIS_IELEMENT_TYPE_BCD80,
ZYDIS_IELEMENT_TYPE_CC3,
ZYDIS_IELEMENT_TYPE_CC5,
@ -151,12 +156,13 @@ typedef enum ZydisInternalElementType_
*/
typedef enum ZydisImplicitRegisterType_
{
// TODO: Rename OSZ|ASZ|SSZ_
ZYDIS_IMPLREG_TYPE_STATIC,
ZYDIS_IMPLREG_TYPE_GPR_OSZ,
ZYDIS_IMPLREG_TYPE_GPR_ASZ,
ZYDIS_IMPLREG_TYPE_GPR_SSZ,
ZYDIS_IMPLREG_TYPE_IP_ASZ,
ZYDIS_IMPLREG_TYPE_IP_SSZ,
ZYDIS_IMPLREG_TYPE_GPR_SSZ,
ZYDIS_IMPLREG_TYPE_FLAGS_SSZ,
/**
@ -176,6 +182,7 @@ typedef enum ZydisImplicitRegisterType_
*/
typedef enum ZydisImplicitMemBase_
{
// TODO: Rename OSZ|ASZ|SSZ_
ZYDIS_IMPLMEM_BASE_AGPR_REG,
ZYDIS_IMPLMEM_BASE_AGPR_RM,
ZYDIS_IMPLMEM_BASE_AAX,
@ -267,35 +274,6 @@ typedef enum ZydisReadWriteAction_
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisRegisterConstraint` enum.
*/
typedef enum ZydisRegisterConstraint_
{
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_NO_REL,
/**
* Maximum value of this enum.
*/
ZYDIS_REG_CONSTRAINTS_MAX_VALUE = ZYDIS_REG_CONSTRAINTS_NO_REL,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_REG_CONSTRAINTS_MAX_VALUE)
} ZydisRegisterConstraint;
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisInternalVectorLength` enum.
*/
@ -713,6 +691,21 @@ typedef enum ZydisMaskOverride_
/* ---------------------------------------------------------------------------------------------- */
#define ZYDIS_OPDEF_REQUIRED_BITS \
ZYAN_MAX(ZYDIS_REGKIND_REQUIRED_BITS, ZYDIS_MEMOP_TYPE_REQUIRED_BITS + 1) + 1
#define ZYDIS_OPDEF_GET_REG(operand_definition) \
((operand_definition) & ((1 << ZYDIS_REGKIND_REQUIRED_BITS ) - 1))
#define ZYDIS_OPDEF_GET_MEM(operand_definition) \
((operand_definition) & ((1 << ZYDIS_MEMOP_TYPE_REQUIRED_BITS) - 1))
#define ZYDIS_OPDEF_GET_REG_HIGH_BIT(operand_definition) \
(((operand_definition) >> ZYDIS_REGKIND_REQUIRED_BITS ) & 0x01)
#define ZYDIS_OPDEF_GET_MEM_HIGH_BIT(operand_definition) \
(((operand_definition) >> ZYDIS_MEMOP_TYPE_REQUIRED_BITS) & 0x01)
// MSVC does not correctly execute the `pragma pack(1)` compiler-directive, if we use the correct
// enum types
ZYAN_STATIC_ASSERT(ZYDIS_MNEMONIC_REQUIRED_BITS <= 16);
@ -721,13 +714,14 @@ ZYAN_STATIC_ASSERT(ZYDIS_ISA_SET_REQUIRED_BITS <= 8);
ZYAN_STATIC_ASSERT(ZYDIS_ISA_EXT_REQUIRED_BITS <= 8);
ZYAN_STATIC_ASSERT(ZYDIS_BRANCH_TYPE_REQUIRED_BITS <= 8);
ZYAN_STATIC_ASSERT(ZYDIS_EXCEPTION_CLASS_REQUIRED_BITS <= 8);
ZYAN_STATIC_ASSERT(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS <= 8);
ZYAN_STATIC_ASSERT(ZYDIS_OPDEF_REQUIRED_BITS <= 8);
ZYAN_STATIC_ASSERT(ZYDIS_RW_ACTION_REQUIRED_BITS <= 8);
#ifndef ZYDIS_MINIMAL_MODE
# define ZYDIS_INSTRUCTION_DEFINITION_BASE \
ZyanU16 mnemonic ZYAN_BITFIELD(ZYDIS_MNEMONIC_REQUIRED_BITS); \
ZyanU8 operand_count ZYAN_BITFIELD( 4); \
ZyanU8 operand_count_visible ZYAN_BITFIELD( 3); \
ZyanU16 operand_reference ZYAN_BITFIELD(15); \
ZyanU8 operand_size_map ZYAN_BITFIELD( 3); \
ZyanU8 address_size_map ZYAN_BITFIELD( 2); \
@ -739,8 +733,8 @@ ZYAN_STATIC_ASSERT(ZYDIS_RW_ACTION_REQUIRED_BITS <= 8);
ZyanU8 isa_ext ZYAN_BITFIELD(ZYDIS_ISA_EXT_REQUIRED_BITS); \
ZyanU8 branch_type ZYAN_BITFIELD(ZYDIS_BRANCH_TYPE_REQUIRED_BITS); \
ZyanU8 exception_class ZYAN_BITFIELD(ZYDIS_EXCEPTION_CLASS_REQUIRED_BITS); \
ZyanU8 constr_REG ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS); \
ZyanU8 constr_RM ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS); \
ZyanU8 op_reg ZYAN_BITFIELD(ZYDIS_OPDEF_REQUIRED_BITS); \
ZyanU8 op_rm ZYAN_BITFIELD(ZYDIS_OPDEF_REQUIRED_BITS); \
ZyanU8 cpu_state ZYAN_BITFIELD(ZYDIS_RW_ACTION_REQUIRED_BITS); \
ZyanU8 fpu_state ZYAN_BITFIELD(ZYDIS_RW_ACTION_REQUIRED_BITS); \
ZyanU8 xmm_state ZYAN_BITFIELD(ZYDIS_RW_ACTION_REQUIRED_BITS); \
@ -751,18 +745,20 @@ ZYAN_STATIC_ASSERT(ZYDIS_RW_ACTION_REQUIRED_BITS <= 8);
ZyanU8 operand_size_map ZYAN_BITFIELD( 3); \
ZyanU8 address_size_map ZYAN_BITFIELD( 2); \
ZyanBool requires_protected_mode ZYAN_BITFIELD( 1); \
ZyanU8 constr_REG ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS); \
ZyanU8 constr_RM ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS)
ZyanBool no_compat_mode ZYAN_BITFIELD( 1); \
ZyanU8 op_reg ZYAN_BITFIELD(ZYDIS_OPDEF_REQUIRED_BITS); \
ZyanU8 op_rm ZYAN_BITFIELD(ZYDIS_OPDEF_REQUIRED_BITS)
#endif
#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR \
ZYDIS_INSTRUCTION_DEFINITION_BASE; \
ZyanU8 constr_NDSNDD ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS)
ZyanU8 op_ndsndd ZYAN_BITFIELD(ZYDIS_OPDEF_REQUIRED_BITS)
#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL \
ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR; \
ZyanBool is_gather ZYAN_BITFIELD( 1); \
ZyanBool no_source_dest_match ZYAN_BITFIELD( 1)
ZyanBool no_source_dest_match ZYAN_BITFIELD( 1); \
ZyanBool no_source_source_match ZYAN_BITFIELD( 1) // TODO: Could be moved to VEX
/**
* Defines the `ZydisInstructionDefinition` struct.
@ -882,19 +878,6 @@ typedef struct ZydisInstructionDefinitionMVEX_
} ZydisInstructionDefinitionMVEX;
#endif
/* ---------------------------------------------------------------------------------------------- */
/* Accessed CPU flags */
/* ---------------------------------------------------------------------------------------------- */
typedef struct ZydisAccessedFlags_
{
ZydisCPUFlagAction action[ZYDIS_CPUFLAG_MAX_VALUE + 1];
ZyanU32 cpu_flags_read ZYAN_BITFIELD(22);
ZyanU32 cpu_flags_written ZYAN_BITFIELD(22);
ZyanU8 fpu_flags_read ZYAN_BITFIELD( 4);
ZyanU8 fpu_flags_written ZYAN_BITFIELD( 4);
} ZydisAccessedFlags;
/* ---------------------------------------------------------------------------------------------- */
#pragma pack(pop)
@ -903,6 +886,24 @@ typedef struct ZydisAccessedFlags_
# pragma warning(pop)
#endif
/* ---------------------------------------------------------------------------------------------- */
/* Accessed CPU/FPU flags */
/* ---------------------------------------------------------------------------------------------- */
/*
* Contains information about the CPU/FPU flags accessed by an instruction.
*
* We don't want this struct to be packed! A pointer to the individual members will be used by the
* `ZydisDecodedInstruction` struct.
*/
typedef struct ZydisDefinitionAccessedFlags_
{
ZydisAccessedFlags cpu_flags;
ZydisAccessedFlags fpu_flags;
} ZydisDefinitionAccessedFlags;
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */
/* Functions */
/* ============================================================================================== */
@ -931,13 +932,11 @@ ZYDIS_NO_EXPORT void ZydisGetInstructionDefinition(ZydisInstructionEncoding enco
* Returns the the operand-definitions for the given 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-
* definition of the instruction.
*
* @return The number of operands for the given instruction-definition.
* @return A pointer to the first operand definition of the instruction, or `ZYAN_NULL`.
*/
ZYDIS_NO_EXPORT ZyanU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
const ZydisOperandDefinition** operand);
ZYDIS_NO_EXPORT const ZydisOperandDefinition* ZydisGetOperandDefinitions(
const ZydisInstructionDefinition* definition);
#endif
/* ---------------------------------------------------------------------------------------------- */
@ -965,12 +964,13 @@ ZYDIS_NO_EXPORT void ZydisGetElementInfo(ZydisInternalElementType element, Zydis
* Returns the the operand-definitions for the given instruction-`definition`.
*
* @param definition A pointer to the instruction-definition.
* @param flags A pointer to the variable that receives the `ZydisAccessedFlags` struct.
* @param flags A pointer to the variable that receives the `ZydisDefinitionAccessedFlags`
* struct.
*
* @return `ZYAN_TRUE`, if the instruction accesses any flags, or `ZYAN_FALSE`, if not.
*/
ZYDIS_NO_EXPORT ZyanBool ZydisGetAccessedFlags(const ZydisInstructionDefinition* definition,
const ZydisAccessedFlags** flags);
const ZydisDefinitionAccessedFlags** flags);
#endif
/* ---------------------------------------------------------------------------------------------- */

View File

@ -45,7 +45,9 @@
#include <Zycore/Types.h>
#include <Zycore/Format.h>
#include <Zydis/ShortString.h>
#include <Zydis/Status.h>
#include <Zycore/Defines.h>
#include <Zycore/Status.h>
#include <Zycore/Vector.h>
#ifdef __cplusplus
extern "C" {
@ -327,7 +329,7 @@ ZYAN_INLINE ZyanStatus ZydisStringAppendShortCase(ZyanString* destination,
* appends it to the `string`.
*
* @param string A pointer to the `ZyanString` instance.
* @param value The value.
* @param value The value to append.
* @param padding_length Padds the converted value with leading zeros, if the number of chars is
* less than the `padding_length`.
* @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
@ -346,10 +348,10 @@ ZyanStatus ZydisStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 paddi
* appends it to the `string`.
*
* @param string A pointer to the `ZyanString` instance.
* @param value The value.
* @param value The value to append.
* @param padding_length Padds the converted value with leading zeros, if the number of chars is
* less than the `padding_length`.
* @param force_sign Set `ZYAN_TRUE`, to force printing of the `+` sign for positive numbers.
* @param force_sign Enable this option to print the `+` sign for positive numbers.
* @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
* @param suffix The string to use as suffix or `ZYAN_NULL`, if not needed.
*
@ -389,11 +391,13 @@ ZYAN_INLINE ZyanStatus ZydisStringAppendDecS(ZyanString* string, ZyanI64 value,
* appends it to the `string`.
*
* @param string A pointer to the `ZyanString` instance.
* @param value The value.
* @param padding_length Padds the converted value with leading zeros, if the number of chars is
* less than the `padding_length`.
* @param uppercase Set `ZYAN_TRUE` to use uppercase letters ('A'-'F') instead of lowercase
* ones ('a'-'f').
* @param value The value to append.
* @param padding_length Pads the converted value with leading zeros if the number of
* chars is less than the `padding_length`.
* @param force_leading_number Enable this option to prepend a leading `0` if the first
* character is non-numeric.
* @param uppercase Enable this option to use uppercase letters ('A'-'F') instead
* of lowercase ones ('a'-'f').
* @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
* @param suffix The string to use as suffix or `ZYAN_NULL`, if not needed.
*
@ -403,33 +407,34 @@ ZYAN_INLINE ZyanStatus ZydisStringAppendDecS(ZyanString* string, ZyanI64 value,
* `ZyanString` instance.
*/
ZyanStatus ZydisStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
ZyanBool uppercase, const ZyanStringView* prefix, const ZyanStringView* suffix);
ZyanBool force_leading_number, ZyanBool uppercase, const ZyanStringView* prefix,
const ZyanStringView* suffix);
/**
* Formats the given signed ordinal `value` to its hexadecimal text-representation and
* appends it to the `string`.
*
* @param string A pointer to the string.
* @param value The value.
* @param padding_length Padds the converted value with leading zeros, if the number of chars is
* less than the `padding_length` (the sign char is ignored).
* @param uppercase Set `ZYAN_TRUE` to print the hexadecimal value in uppercase letters
* instead of lowercase ones.
* @param force_sign Set to `ZYAN_TRUE`, to force printing of the `+` sign for positive
* numbers.
* @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 string A pointer to the `ZyanString` instance.
* @param value The value to append.
* @param padding_length Padds the converted value with leading zeros, if the number of
* chars is less than the `padding_length` (the sign char does not
* count).
* @param force_leading_number Enable this option to prepend a leading `0`, if the first
* character is non-numeric.
* @param uppercase Enable this option to use uppercase letters ('A'-'F') instead
* of lowercase ones ('a'-'f').
* @param force_sign Enable this option to print the `+` sign for positive numbers.
* @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
* @param suffix The string to use as suffix or `ZYAN_NULL`, if not needed.
*
* @return `ZYAN_STATUS_SUCCESS`, if the function succeeded, or
* `ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE`, if the size of the buffer was not
* sufficient to append the given `value`.
* @return A zyan status code.
*
* The string-buffer pointer is increased by the number of chars written, if the call was
* successful.
* This function will fail if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
* `ZyanString` instance.
*/
ZYAN_INLINE ZyanStatus ZydisStringAppendHexS(ZyanString* string, ZyanI64 value,
ZyanU8 padding_length, ZyanBool uppercase, ZyanBool force_sign, const ZyanStringView* prefix,
const ZyanStringView* suffix)
ZyanU8 padding_length, ZyanBool force_leading_number, ZyanBool uppercase, ZyanBool force_sign,
const ZyanStringView* prefix, const ZyanStringView* suffix)
{
static const ZydisShortString str_add = ZYDIS_MAKE_SHORTSTRING("+");
static const ZydisShortString str_sub = ZYDIS_MAKE_SHORTSTRING("-");
@ -441,8 +446,8 @@ ZYAN_INLINE ZyanStatus ZydisStringAppendHexS(ZyanString* string, ZyanI64 value,
{
ZYAN_CHECK(ZydisStringAppend(string, prefix));
}
return ZydisStringAppendHexU(string, ZyanAbsI64(value), padding_length, uppercase,
(const ZyanStringView*)ZYAN_NULL, suffix);
return ZydisStringAppendHexU(string, ZyanAbsI64(value), padding_length,
force_leading_number, uppercase, (const ZyanStringView*)ZYAN_NULL, suffix);
}
if (force_sign)
@ -450,7 +455,8 @@ ZYAN_INLINE ZyanStatus ZydisStringAppendHexS(ZyanString* string, ZyanI64 value,
ZYAN_ASSERT(value >= 0);
ZYAN_CHECK(ZydisStringAppendShort(string, &str_add));
}
return ZydisStringAppendHexU(string, value, padding_length, uppercase, prefix, suffix);
return ZydisStringAppendHexU(string, value, padding_length, force_leading_number, uppercase,
prefix, suffix);
}
/* ---------------------------------------------------------------------------------------------- */

View File

@ -32,9 +32,7 @@
#ifndef ZYDIS_METAINFO_H
#define ZYDIS_METAINFO_H
#include <ZydisExportConfig.h>
#include <Zycore/Defines.h>
#include <Zycore/Types.h>
#include <Zydis/Defines.h>
#ifdef __cplusplus
extern "C" {

View File

@ -32,7 +32,7 @@
#ifndef ZYDIS_MNEMONIC_H
#define ZYDIS_MNEMONIC_H
#include <Zycore/Types.h>
#include <Zydis/Defines.h>
#include <Zydis/ShortString.h>
#ifdef __cplusplus

View File

@ -34,6 +34,7 @@
#include <Zycore/Defines.h>
#include <Zycore/Types.h>
#include <Zydis/Defines.h>
#include <Zydis/SharedTypes.h>
#include <Zydis/ShortString.h>
@ -51,6 +52,45 @@ extern "C" {
#include <Zydis/Generated/EnumRegister.h>
/* ---------------------------------------------------------------------------------------------- */
/* Register kinds */
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisRegisterKind` enum.
*
* Please note that this enum does not contain a matching entry for all values of the
* `ZydisRegister` enum, but only for those registers where it makes sense to logically group them
* for decoding/encoding purposes.
*
* These are mainly the registers that can be identified by an id within their corresponding
* register-class.
*/
typedef enum ZydisRegisterKind_
{
ZYDIS_REGKIND_INVALID,
ZYDIS_REGKIND_GPR,
ZYDIS_REGKIND_X87,
ZYDIS_REGKIND_MMX,
ZYDIS_REGKIND_VR,
ZYDIS_REGKIND_TMM,
ZYDIS_REGKIND_SEGMENT,
ZYDIS_REGKIND_TEST,
ZYDIS_REGKIND_CONTROL,
ZYDIS_REGKIND_DEBUG,
ZYDIS_REGKIND_MASK,
ZYDIS_REGKIND_BOUND,
/**
* Maximum value of this enum.
*/
ZYDIS_REGKIND_MAX_VALUE = ZYDIS_REGKIND_BOUND,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_REGKIND_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_REGKIND_MAX_VALUE)
} ZydisRegisterKind;
/* ---------------------------------------------------------------------------------------------- */
/* Register classes */
/* ---------------------------------------------------------------------------------------------- */
@ -120,6 +160,10 @@ typedef enum ZydisRegisterClass_
* Segment registers.
*/
ZYDIS_REGCLASS_SEGMENT,
/**
* Table registers.
*/
ZYDIS_REGCLASS_TABLE,
/**
* Test registers.
*/
@ -238,7 +282,7 @@ ZYDIS_EXPORT ZydisRegisterWidth ZydisRegisterGetWidth(ZydisMachineMode mode, Zyd
* @param reg The register.
*
* @return The largest enclosing register of the given register, or `ZYDIS_REGISTER_NONE` if the
* register is invalid for the active machine-mode or does not have an enclosing-register.
* register is invalid for the active machine-mode.
*/
ZYDIS_EXPORT ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode,
ZydisRegister reg);

178
3rdparty/zydis/include/Zydis/Segment.h vendored Normal file
View File

@ -0,0 +1,178 @@
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Florian Bernd
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***************************************************************************************************/
/**
* @file
* Functions and types providing encoding information about individual instruction bytes.
*/
#ifndef ZYDIS_SEGMENT_H
#define ZYDIS_SEGMENT_H
#include <Zycore/Defines.h>
#include <Zydis/DecoderTypes.h>
#include <Zydis/Status.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup segment Segment
* Functions and types providing encoding information about individual instruction bytes.
* @{
*/
/* ============================================================================================== */
/* Macros */
/* ============================================================================================== */
/* ---------------------------------------------------------------------------------------------- */
/* Constants */
/* ---------------------------------------------------------------------------------------------- */
#define ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT 9
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */
/* Enums and types */
/* ============================================================================================== */
/**
* Defines the `ZydisInstructionSegment` struct.
*/
typedef enum ZydisInstructionSegment_
{
ZYDIS_INSTR_SEGMENT_NONE,
/**
* The legacy prefixes (including ignored `REX` prefixes).
*/
ZYDIS_INSTR_SEGMENT_PREFIXES,
/**
* The effective `REX` prefix byte.
*/
ZYDIS_INSTR_SEGMENT_REX,
/**
* The `XOP` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_XOP,
/**
* The `VEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_VEX,
/**
* The `EVEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_EVEX,
/**
* The `MVEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_MVEX,
/**
* The opcode bytes.
*/
ZYDIS_INSTR_SEGMENT_OPCODE,
/**
* The `ModRM` byte.
*/
ZYDIS_INSTR_SEGMENT_MODRM,
/**
* The `SIB` byte.
*/
ZYDIS_INSTR_SEGMENT_SIB,
/**
* The displacement bytes.
*/
ZYDIS_INSTR_SEGMENT_DISPLACEMENT,
/**
* The immediate bytes.
*/
ZYDIS_INSTR_SEGMENT_IMMEDIATE,
/**
* Maximum value of this enum.
*/
ZYDIS_INSTR_SEGMENT_MAX_VALUE = ZYDIS_INSTR_SEGMENT_IMMEDIATE,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_INSTR_SEGMENT_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_INSTR_SEGMENT_MAX_VALUE)
} ZydisInstructionSegment;
/**
* Defines the `ZydisInstructionSegments` struct.
*/
typedef struct ZydisInstructionSegments_
{
/**
* The number of logical instruction segments.
*/
ZyanU8 count;
struct
{
/**
* The type of the segment.
*/
ZydisInstructionSegment type;
/**
* The offset of the segment relative to the start of the instruction (in bytes).
*/
ZyanU8 offset;
/**
* The size of the segment, in bytes.
*/
ZyanU8 size;
} segments[ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT];
} ZydisInstructionSegments;
/* ============================================================================================== */
/* Exported functions */
/* ============================================================================================== */
/**
* Returns offsets and sizes of all logical instruction segments (e.g. `OPCODE`,
* `MODRM`, ...).
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param segments Receives the instruction segments information.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* instruction,
ZydisInstructionSegments* segments);
/* ============================================================================================== */
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ZYDIS_SEGMENT_H */

View File

@ -47,7 +47,8 @@ extern "C" {
/* ---------------------------------------------------------------------------------------------- */
#define ZYDIS_MAX_INSTRUCTION_LENGTH 15
#define ZYDIS_MAX_OPERAND_COUNT 10
#define ZYDIS_MAX_OPERAND_COUNT 10 // TODO: Auto generate
#define ZYDIS_MAX_OPERAND_COUNT_VISIBLE 5 // TODO: Auto generate
/* ---------------------------------------------------------------------------------------------- */
@ -100,27 +101,27 @@ typedef enum ZydisMachineMode_
} ZydisMachineMode;
/* ---------------------------------------------------------------------------------------------- */
/* Address width */
/* Stack width */
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisAddressWidth` enum.
* Defines the `ZydisStackWidth` enum.
*/
typedef enum ZydisAddressWidth_
typedef enum ZydisStackWidth_
{
ZYDIS_ADDRESS_WIDTH_16,
ZYDIS_ADDRESS_WIDTH_32,
ZYDIS_ADDRESS_WIDTH_64,
ZYDIS_STACK_WIDTH_16,
ZYDIS_STACK_WIDTH_32,
ZYDIS_STACK_WIDTH_64,
/**
* Maximum value of this enum.
*/
ZYDIS_ADDRESS_WIDTH_MAX_VALUE = ZYDIS_ADDRESS_WIDTH_64,
ZYDIS_STACK_WIDTH_MAX_VALUE = ZYDIS_STACK_WIDTH_64,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_ADDRESS_WIDTH_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_ADDRESS_WIDTH_MAX_VALUE)
} ZydisAddressWidth;
ZYDIS_STACK_WIDTH_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_STACK_WIDTH_MAX_VALUE)
} ZydisStackWidth;
/* ---------------------------------------------------------------------------------------------- */
/* Element type */
@ -160,6 +161,10 @@ typedef enum ZydisElementType_
* 80-bit floating point value (`extended`).
*/
ZYDIS_ELEMENT_TYPE_FLOAT80,
/**
* 16-bit brain floating point value.
*/
ZYDIS_ELEMENT_TYPE_BFLOAT16,
/**
* Binary coded decimal value.
*/
@ -228,6 +233,10 @@ typedef enum ZydisOperandType_
ZYDIS_OPERAND_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_OPERAND_TYPE_MAX_VALUE)
} ZydisOperandType;
// If asserts are failing here remember to update encoder table generator before fixing asserts
ZYAN_STATIC_ASSERT(ZYAN_BITS_TO_REPRESENT(
ZYDIS_OPERAND_TYPE_MAX_VALUE - ZYDIS_OPERAND_TYPE_REGISTER) == 2);
/* ---------------------------------------------------------------------------------------------- */
/* Operand encoding */
/* ---------------------------------------------------------------------------------------------- */
@ -473,6 +482,244 @@ typedef enum ZydisOpcodeMap_
ZYDIS_OPCODE_MAP_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_OPCODE_MAP_MAX_VALUE)
} ZydisOpcodeMap;
/* ---------------------------------------------------------------------------------------------- */
/* Instruction attributes */
/* ---------------------------------------------------------------------------------------------- */
/**
* @defgroup instruction_attributes Instruction attributes
*
* Constants describing various properties of an instruction. Used in the
* @ref ZydisDecodedInstruction.attributes and @ref ZydisEncoderRequest.prefixes fields.
*
* @{
*/
/**
* Defines the `ZydisInstructionAttributes` data-type.
*/
typedef ZyanU64 ZydisInstructionAttributes;
/**
* The instruction has the `ModRM` byte.
*/
#define ZYDIS_ATTRIB_HAS_MODRM (1ULL << 0)
/**
* The instruction has the `SIB` byte.
*/
#define ZYDIS_ATTRIB_HAS_SIB (1ULL << 1)
/**
* The instruction has the `REX` prefix.
*/
#define ZYDIS_ATTRIB_HAS_REX (1ULL << 2)
/**
* The instruction has the `XOP` prefix.
*/
#define ZYDIS_ATTRIB_HAS_XOP (1ULL << 3)
/**
* The instruction has the `VEX` prefix.
*/
#define ZYDIS_ATTRIB_HAS_VEX (1ULL << 4)
/**
* The instruction has the `EVEX` prefix.
*/
#define ZYDIS_ATTRIB_HAS_EVEX (1ULL << 5)
/**
* The instruction has the `MVEX` prefix.
*/
#define ZYDIS_ATTRIB_HAS_MVEX (1ULL << 6)
/**
* The instruction has one or more operands with position-relative offsets.
*/
#define ZYDIS_ATTRIB_IS_RELATIVE (1ULL << 7)
/**
* The instruction is privileged.
*
* Privileged instructions are any instructions that require a current ring level below 3.
*/
#define ZYDIS_ATTRIB_IS_PRIVILEGED (1ULL << 8)
/**
* The instruction accesses one or more CPU-flags.
*/
#define ZYDIS_ATTRIB_CPUFLAG_ACCESS (1ULL << 9)
/**
* The instruction may conditionally read the general CPU state.
*/
#define ZYDIS_ATTRIB_CPU_STATE_CR (1ULL << 10)
/**
* The instruction may conditionally write the general CPU state.
*/
#define ZYDIS_ATTRIB_CPU_STATE_CW (1ULL << 11)
/**
* The instruction may conditionally read the FPU state (X87, MMX).
*/
#define ZYDIS_ATTRIB_FPU_STATE_CR (1ULL << 12)
/**
* The instruction may conditionally write the FPU state (X87, MMX).
*/
#define ZYDIS_ATTRIB_FPU_STATE_CW (1ULL << 13)
/**
* The instruction may conditionally read the XMM state (AVX, AVX2, AVX-512).
*/
#define ZYDIS_ATTRIB_XMM_STATE_CR (1ULL << 14)
/**
* The instruction may conditionally write the XMM state (AVX, AVX2, AVX-512).
*/
#define ZYDIS_ATTRIB_XMM_STATE_CW (1ULL << 15)
/**
* The instruction accepts the `LOCK` prefix (`0xF0`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_LOCK (1ULL << 16)
/**
* The instruction accepts the `REP` prefix (`0xF3`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_REP (1ULL << 17)
/**
* The instruction accepts the `REPE`/`REPZ` prefix (`0xF3`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_REPE (1ULL << 18)
/**
* The instruction accepts the `REPE`/`REPZ` prefix (`0xF3`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_REPZ ZYDIS_ATTRIB_ACCEPTS_REPE
/**
* The instruction accepts the `REPNE`/`REPNZ` prefix (`0xF2`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_REPNE (1ULL << 19)
/**
* The instruction accepts the `REPNE`/`REPNZ` prefix (`0xF2`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_REPNZ ZYDIS_ATTRIB_ACCEPTS_REPNE
/**
* The instruction accepts the `BND` prefix (`0xF2`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_BND (1ULL << 20)
/**
* The instruction accepts the `XACQUIRE` prefix (`0xF2`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_XACQUIRE (1ULL << 21)
/**
* The instruction accepts the `XRELEASE` prefix (`0xF3`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_XRELEASE (1ULL << 22)
/**
* The instruction accepts the `XACQUIRE`/`XRELEASE` prefixes (`0xF2`, `0xF3`)
* without the `LOCK` prefix (`0x0F`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_HLE_WITHOUT_LOCK (1ULL << 23)
/**
* The instruction accepts branch hints (0x2E, 0x3E).
*/
#define ZYDIS_ATTRIB_ACCEPTS_BRANCH_HINTS (1ULL << 24)
/**
* The instruction accepts the `CET` `no-track` prefix (`0x3E`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_NOTRACK (1ULL << 25)
/**
* The instruction accepts segment prefixes (`0x2E`, `0x36`, `0x3E`, `0x26`,
* `0x64`, `0x65`).
*/
#define ZYDIS_ATTRIB_ACCEPTS_SEGMENT (1ULL << 26)
/**
* The instruction has the `LOCK` prefix (`0xF0`).
*/
#define ZYDIS_ATTRIB_HAS_LOCK (1ULL << 27)
/**
* The instruction has the `REP` prefix (`0xF3`).
*/
#define ZYDIS_ATTRIB_HAS_REP (1ULL << 28)
/**
* The instruction has the `REPE`/`REPZ` prefix (`0xF3`).
*/
#define ZYDIS_ATTRIB_HAS_REPE (1ULL << 29)
/**
* The instruction has the `REPE`/`REPZ` prefix (`0xF3`).
*/
#define ZYDIS_ATTRIB_HAS_REPZ ZYDIS_ATTRIB_HAS_REPE
/**
* The instruction has the `REPNE`/`REPNZ` prefix (`0xF2`).
*/
#define ZYDIS_ATTRIB_HAS_REPNE (1ULL << 30)
/**
* The instruction has the `REPNE`/`REPNZ` prefix (`0xF2`).
*/
#define ZYDIS_ATTRIB_HAS_REPNZ ZYDIS_ATTRIB_HAS_REPNE
/**
* The instruction has the `BND` prefix (`0xF2`).
*/
#define ZYDIS_ATTRIB_HAS_BND (1ULL << 31)
/**
* The instruction has the `XACQUIRE` prefix (`0xF2`).
*/
#define ZYDIS_ATTRIB_HAS_XACQUIRE (1ULL << 32)
/**
* The instruction has the `XRELEASE` prefix (`0xF3`).
*/
#define ZYDIS_ATTRIB_HAS_XRELEASE (1ULL << 33)
/**
* The instruction has the branch-not-taken hint (`0x2E`).
*/
#define ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN (1ULL << 34)
/**
* The instruction has the branch-taken hint (`0x3E`).
*/
#define ZYDIS_ATTRIB_HAS_BRANCH_TAKEN (1ULL << 35)
/**
* The instruction has the `CET` `no-track` prefix (`0x3E`).
*/
#define ZYDIS_ATTRIB_HAS_NOTRACK (1ULL << 36)
/**
* The instruction has the `CS` segment modifier (`0x2E`).
*/
#define ZYDIS_ATTRIB_HAS_SEGMENT_CS (1ULL << 37)
/**
* The instruction has the `SS` segment modifier (`0x36`).
*/
#define ZYDIS_ATTRIB_HAS_SEGMENT_SS (1ULL << 38)
/**
* The instruction has the `DS` segment modifier (`0x3E`).
*/
#define ZYDIS_ATTRIB_HAS_SEGMENT_DS (1ULL << 39)
/**
* The instruction has the `ES` segment modifier (`0x26`).
*/
#define ZYDIS_ATTRIB_HAS_SEGMENT_ES (1ULL << 40)
/**
* The instruction has the `FS` segment modifier (`0x64`).
*/
#define ZYDIS_ATTRIB_HAS_SEGMENT_FS (1ULL << 41)
/**
* The instruction has the `GS` segment modifier (`0x65`).
*/
#define ZYDIS_ATTRIB_HAS_SEGMENT_GS (1ULL << 42)
/**
* The instruction has a segment modifier.
*/
#define ZYDIS_ATTRIB_HAS_SEGMENT (ZYDIS_ATTRIB_HAS_SEGMENT_CS | \
ZYDIS_ATTRIB_HAS_SEGMENT_SS | \
ZYDIS_ATTRIB_HAS_SEGMENT_DS | \
ZYDIS_ATTRIB_HAS_SEGMENT_ES | \
ZYDIS_ATTRIB_HAS_SEGMENT_FS | \
ZYDIS_ATTRIB_HAS_SEGMENT_GS)
/**
* The instruction has the operand-size override prefix (`0x66`).
*/
#define ZYDIS_ATTRIB_HAS_OPERANDSIZE (1ULL << 43) // TODO: rename
/**
* The instruction has the address-size override prefix (`0x67`).
*/
#define ZYDIS_ATTRIB_HAS_ADDRESSSIZE (1ULL << 44) // TODO: rename
/**
* The instruction has the `EVEX.b` bit set.
*
* This attribute is mainly used by the encoder.
*/
#define ZYDIS_ATTRIB_HAS_EVEX_B (1ULL << 45) // TODO: rename
/**
* @}
*/
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */

View File

@ -33,7 +33,6 @@
#ifndef ZYDIS_SHORTSTRING_H
#define ZYDIS_SHORTSTRING_H
#include <ZydisExportConfig.h>
#include <Zycore/Defines.h>
#include <Zycore/Types.h>
@ -45,7 +44,9 @@ extern "C" {
/* Enums and types */
/* ============================================================================================== */
#if !defined(ZYAN_APPLE)
# pragma pack(push, 1)
#endif
/**
* Defines the `ZydisShortString` struct.
@ -67,7 +68,9 @@ typedef struct ZydisShortString_
ZyanU8 size;
} ZydisShortString;
#if !defined(ZYAN_APPLE)
# pragma pack(pop)
#endif
/* ============================================================================================== */
/* Macros */

View File

@ -148,10 +148,18 @@ extern "C" {
#define ZYDIS_STATUS_SKIP_TOKEN \
ZYAN_MAKE_STATUS(0u, ZYAN_MODULE_ZYDIS, 0x0Bu)
/* ---------------------------------------------------------------------------------------------- */
/* Encoder */
/* ---------------------------------------------------------------------------------------------- */
#define ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION \
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Cu)
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */
#ifdef __cplusplus
}
#endif

View File

@ -40,109 +40,6 @@
extern "C" {
#endif
/* ============================================================================================== */
/* Macros */
/* ============================================================================================== */
/* ---------------------------------------------------------------------------------------------- */
/* Constants */
/* ---------------------------------------------------------------------------------------------- */
#define ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT 9
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */
/* Enums and types */
/* ============================================================================================== */
/**
* Defines the `ZydisInstructionSegment` struct.
*/
typedef enum ZydisInstructionSegment_
{
ZYDIS_INSTR_SEGMENT_NONE,
/**
* The legacy prefixes (including ignored `REX` prefixes).
*/
ZYDIS_INSTR_SEGMENT_PREFIXES,
/**
* The effective `REX` prefix byte.
*/
ZYDIS_INSTR_SEGMENT_REX,
/**
* The `XOP` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_XOP,
/**
* The `VEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_VEX,
/**
* The `EVEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_EVEX,
/**
* The `MVEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_MVEX,
/**
* The opcode bytes.
*/
ZYDIS_INSTR_SEGMENT_OPCODE,
/**
* The `ModRM` byte.
*/
ZYDIS_INSTR_SEGMENT_MODRM,
/**
* The `SIB` byte.
*/
ZYDIS_INSTR_SEGMENT_SIB,
/**
* The displacement bytes.
*/
ZYDIS_INSTR_SEGMENT_DISPLACEMENT,
/**
* The immediate bytes.
*/
ZYDIS_INSTR_SEGMENT_IMMEDIATE,
/**
* Maximum value of this enum.
*/
ZYDIS_INSTR_SEGMENT_MAX_VALUE = ZYDIS_INSTR_SEGMENT_IMMEDIATE,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_INSTR_SEGMENT_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_INSTR_SEGMENT_MAX_VALUE)
} ZydisInstructionSegment;
/**
* Defines the `ZydisInstructionSegments` struct.
*/
typedef struct ZydisInstructionSegments_
{
/**
* The number of logical instruction segments.
*/
ZyanU8 count;
struct
{
/**
* The type of the segment.
*/
ZydisInstructionSegment type;
/**
* The offset of the segment relative to the start of the instruction (in bytes).
*/
ZyanU8 offset;
/**
* The size of the segment, in bytes.
*/
ZyanU8 size;
} segments[ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT];
} ZydisInstructionSegments;
/* ============================================================================================== */
/* Exported functions */
/* ============================================================================================== */
@ -199,67 +96,6 @@ ZYDIS_EXPORT ZyanStatus ZydisCalcAbsoluteAddressEx(const ZydisDecodedInstruction
const ZydisDecodedOperand* operand, ZyanU64 runtime_address,
const ZydisRegisterContext* register_context, ZyanU64* result_address);
/* ---------------------------------------------------------------------------------------------- */
/* Accessed CPU flags */
/* ---------------------------------------------------------------------------------------------- */
/**
* Returns a mask of accessed CPU-flags matching the given `action`.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param action The CPU-flag action.
* @param flags Receives the flag mask.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruction,
ZydisCPUFlagAction action, ZydisCPUFlags* flags);
/**
* Returns a mask of accessed CPU-flags that are read (tested) by the current instruction.
*
* DEPRECATED. This function will be removed in the next major release. Please refer to the
* `cpu_flags_read` or `fpu_flags_read` fields of the `ZydisDecodedInstruction` instead.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param flags Receives the flag mask.
*
* @return A zyan status code.
*/
ZYDIS_DEPRECATED_EXPORT ZyanStatus ZydisGetAccessedFlagsRead(
const ZydisDecodedInstruction* instruction, ZydisCPUFlags* flags);
/**
* Returns a mask of accessed CPU-flags that are written (modified, undefined) by the current
* instruction.
*
* DEPRECATED. This function will be removed in the next major release. Please refer to the
* `cpu_flags_written` or `fpu_flags_written` fields of the `ZydisDecodedInstruction` instead.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param flags Receives the flag mask.
*
* @return A zyan status code.
*/
ZYDIS_DEPRECATED_EXPORT ZyanStatus ZydisGetAccessedFlagsWritten(
const ZydisDecodedInstruction* instruction, ZydisCPUFlags* flags);
/* ---------------------------------------------------------------------------------------------- */
/* Instruction segments */
/* ---------------------------------------------------------------------------------------------- */
/**
* Returns offsets and sizes of all logical instruction segments (e.g. `OPCODE`,
* `MODRM`, ...).
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param segments Receives the instruction segments information.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* instruction,
ZydisInstructionSegments* segments);
/* ---------------------------------------------------------------------------------------------- */
/**

View File

@ -26,7 +26,7 @@
/**
* @file
* Master include file, including everything else.
* Master include file. Includes everything else.
*/
#ifndef ZYDIS_H
@ -35,15 +35,27 @@
#include <Zycore/Defines.h>
#include <Zycore/Types.h>
#ifndef ZYDIS_DISABLE_DECODER
#if !defined(ZYDIS_DISABLE_DECODER)
# include <Zydis/Decoder.h>
# include <Zydis/DecoderTypes.h>
#endif
#ifndef ZYDIS_DISABLE_FORMATTER
#if !defined(ZYDIS_DISABLE_ENCODER)
# include <Zydis/Encoder.h>
#endif
#if !defined(ZYDIS_DISABLE_FORMATTER)
# include <Zydis/Formatter.h>
#endif
#if !defined(ZYDIS_DISABLE_SEGMENT)
# include <Zydis/Segment.h>
#endif
#if !defined(ZYDIS_DISABLE_DECODER) && !defined(ZYDIS_DISABLE_FORMATTER)
# include <Zydis/Disassembler.h>
#endif
#include <Zydis/MetaInfo.h>
#include <Zydis/Mnemonic.h>
#include <Zydis/Register.h>
@ -55,6 +67,14 @@
extern "C" {
#endif
/**
* @addtogroup version Version
*
* Functions for checking the library version and build options.
*
* @{
*/
/* ============================================================================================== */
/* Macros */
/* ============================================================================================== */
@ -66,7 +86,7 @@ extern "C" {
/**
* A macro that defines the zydis version.
*/
#define ZYDIS_VERSION (ZyanU64)0x0003000200010000
#define ZYDIS_VERSION 0x0004000100000000ULL
/* ---------------------------------------------------------------------------------------------- */
/* Helper macros */
@ -77,28 +97,28 @@ extern "C" {
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_MAJOR(version) (ZyanU16)(((version) & 0xFFFF000000000000) >> 48)
#define ZYDIS_VERSION_MAJOR(version) (((version) & 0xFFFF000000000000) >> 48)
/**
* Extracts the minor-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_MINOR(version) (ZyanU16)(((version) & 0x0000FFFF00000000) >> 32)
#define ZYDIS_VERSION_MINOR(version) (((version) & 0x0000FFFF00000000) >> 32)
/**
* Extracts the patch-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_PATCH(version) (ZyanU16)(((version) & 0x00000000FFFF0000) >> 16)
#define ZYDIS_VERSION_PATCH(version) (((version) & 0x00000000FFFF0000) >> 16)
/**
* Extracts the build-part of the zydis version.
*
* @param version The zydis version value
*/
#define ZYDIS_VERSION_BUILD(version) (ZyanU16)((version) & 0x000000000000FFFF)
#define ZYDIS_VERSION_BUILD(version) ((version) & 0x000000000000FFFF)
/* ---------------------------------------------------------------------------------------------- */
@ -112,14 +132,16 @@ extern "C" {
typedef enum ZydisFeature_
{
ZYDIS_FEATURE_DECODER,
ZYDIS_FEATURE_ENCODER,
ZYDIS_FEATURE_FORMATTER,
ZYDIS_FEATURE_AVX512,
ZYDIS_FEATURE_KNC,
ZYDIS_FEATURE_SEGMENT,
/**
* Maximum value of this enum.
*/
ZYDIS_FEATURE_MAX_VALUE = ZYDIS_FEATURE_KNC,
ZYDIS_FEATURE_MAX_VALUE = ZYDIS_FEATURE_SEGMENT,
/**
* The minimum number of bits required to represent all values of this enum.
*/
@ -130,12 +152,6 @@ typedef enum ZydisFeature_
/* Exported functions */
/* ============================================================================================== */
/**
* @addtogroup version Version
* Functions for checking the library version and build options.
* @{
*/
/**
* Returns the zydis version.
*
@ -156,12 +172,12 @@ ZYDIS_EXPORT ZyanU64 ZydisGetVersion(void);
*/
ZYDIS_EXPORT ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature);
/* ============================================================================================== */
/**
* @}
*/
/* ============================================================================================== */
#ifdef __cplusplus
}
#endif

View File

@ -1,46 +0,0 @@
#ifndef ZYDIS_EXPORT_H
#define ZYDIS_EXPORT_H
#ifdef ZYDIS_STATIC_DEFINE
# define ZYDIS_EXPORT
# define ZYDIS_NO_EXPORT
#else
# ifndef ZYDIS_EXPORT
# ifdef Zydis_EXPORTS
/* We are building this library */
# define ZYDIS_EXPORT __declspec(dllexport)
# else
/* We are using this library */
# define ZYDIS_EXPORT __declspec(dllimport)
# endif
# endif
# ifndef ZYDIS_NO_EXPORT
# define ZYDIS_NO_EXPORT
# endif
#endif
#ifndef ZYDIS_DEPRECATED
# ifdef _MSC_VER
# define ZYDIS_DEPRECATED __declspec(deprecated)
# else
# define ZYDIS_DEPRECATED
# endif
#endif
#ifndef ZYDIS_DEPRECATED_EXPORT
# define ZYDIS_DEPRECATED_EXPORT ZYDIS_EXPORT ZYDIS_DEPRECATED
#endif
#ifndef ZYDIS_DEPRECATED_NO_EXPORT
# define ZYDIS_DEPRECATED_NO_EXPORT ZYDIS_NO_EXPORT ZYDIS_DEPRECATED
#endif
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef ZYDIS_NO_DEPRECATED
# define ZYDIS_NO_DEPRECATED
# endif
#endif
#endif /* ZYDIS_EXPORT_H */

File diff suppressed because it is too large Load Diff

View File

@ -155,6 +155,12 @@ const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(const ZydisDecoderTreeN
case ZYDIS_NODETYPE_FILTER_MODE_CLDEMOTE:
ZYAN_ASSERT(index < 2);
return &FILTERS_MODE_CLDEMOTE[parent->value][index];
case ZYDIS_NODETYPE_FILTER_MODE_IPREFETCH:
ZYAN_ASSERT(index < 2);
return &FILTERS_MODE_IPREFETCH[parent->value][index];
case ZYDIS_NODETYPE_FILTER_MODE_UD0_COMPAT:
ZYAN_ASSERT(index < 2);
return &FILTERS_MODE_UD0_COMPAT[parent->value][index];
default:
ZYAN_UNREACHABLE;
}

105
3rdparty/zydis/src/Disassembler.c vendored Normal file
View File

@ -0,0 +1,105 @@
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Joel Hoener
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***************************************************************************************************/
#include <Zydis/Disassembler.h>
#include <Zycore/LibC.h>
/* ============================================================================================== */
/* Internal helpers */
/* ============================================================================================== */
static ZyanStatus ZydisDisassemble(ZydisMachineMode machine_mode,
ZyanU64 runtime_address, const void* buffer, ZyanUSize length,
ZydisDisassembledInstruction *instruction, ZydisFormatterStyle style)
{
if (!buffer || !instruction)
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
*instruction = (ZydisDisassembledInstruction)
{
.runtime_address = runtime_address
};
// Derive the stack width from the address width.
ZydisStackWidth stack_width;
switch (machine_mode)
{
case ZYDIS_MACHINE_MODE_LONG_64:
stack_width = ZYDIS_STACK_WIDTH_64;
break;
case ZYDIS_MACHINE_MODE_LONG_COMPAT_32:
case ZYDIS_MACHINE_MODE_LEGACY_32:
stack_width = ZYDIS_STACK_WIDTH_32;
break;
case ZYDIS_MACHINE_MODE_LONG_COMPAT_16:
case ZYDIS_MACHINE_MODE_LEGACY_16:
case ZYDIS_MACHINE_MODE_REAL_16:
stack_width = ZYDIS_STACK_WIDTH_16;
break;
default:
return ZYAN_STATUS_INVALID_ARGUMENT;
}
ZydisDecoder decoder;
ZYAN_CHECK(ZydisDecoderInit(&decoder, machine_mode, stack_width));
ZydisDecoderContext ctx;
ZYAN_CHECK(ZydisDecoderDecodeInstruction(&decoder, &ctx, buffer, length, &instruction->info));
ZYAN_CHECK(ZydisDecoderDecodeOperands(&decoder, &ctx, &instruction->info,
instruction->operands, instruction->info.operand_count));
ZydisFormatter formatter;
ZYAN_CHECK(ZydisFormatterInit(&formatter, style));
ZYAN_CHECK(ZydisFormatterFormatInstruction(&formatter, &instruction->info,
instruction->operands, instruction->info.operand_count_visible, instruction->text,
sizeof(instruction->text), runtime_address, ZYAN_NULL));
return ZYAN_STATUS_SUCCESS;
}
/* ============================================================================================== */
/* Public functions */
/* ============================================================================================== */
ZyanStatus ZydisDisassembleIntel(ZydisMachineMode machine_mode,
ZyanU64 runtime_address, const void* buffer, ZyanUSize length,
ZydisDisassembledInstruction *instruction)
{
return ZydisDisassemble(machine_mode, runtime_address, buffer, length, instruction,
ZYDIS_FORMATTER_STYLE_INTEL);
}
ZyanStatus ZydisDisassembleATT(ZydisMachineMode machine_mode,
ZyanU64 runtime_address, const void* buffer, ZyanUSize length,
ZydisDisassembledInstruction *instruction)
{
return ZydisDisassemble(machine_mode, runtime_address, buffer, length, instruction,
ZYDIS_FORMATTER_STYLE_ATT);
}
/* ============================================================================================== */

4788
3rdparty/zydis/src/Encoder.c vendored Normal file

File diff suppressed because it is too large Load Diff

43
3rdparty/zydis/src/EncoderData.c vendored Normal file
View File

@ -0,0 +1,43 @@
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Mappa
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***************************************************************************************************/
#include <Zydis/Internal/EncoderData.h>
#include <Generated/EncoderTables.inc>
#include <Generated/GetRelInfo.inc>
ZyanU8 ZydisGetEncodableInstructions(ZydisMnemonic mnemonic,
const ZydisEncodableInstruction **instruction)
{
if (mnemonic <= ZYDIS_MNEMONIC_INVALID || mnemonic > ZYDIS_MNEMONIC_MAX_VALUE)
{
*instruction = ZYAN_NULL;
return 0;
}
ZydisEncoderLookupEntry lookup_entry = encoder_instruction_lookup[mnemonic];
*instruction = &encoder_instructions[lookup_entry.encoder_reference];
return lookup_entry.instruction_count;
}

View File

@ -55,7 +55,7 @@ static const ZydisFormatter* const FORMATTER_PRESETS[ZYDIS_FORMATTER_STYLE_MAX_V
/* Helper functions */
/* ---------------------------------------------------------------------------------------------- */
void ZydisFormatterBufferInit(ZydisFormatterBuffer* buffer, char* user_buffer,
static void ZydisFormatterBufferInit(ZydisFormatterBuffer* buffer, char* user_buffer,
ZyanUSize length)
{
ZYAN_ASSERT(buffer);
@ -66,20 +66,8 @@ void ZydisFormatterBufferInit(ZydisFormatterBuffer* buffer, char* user_buffer,
buffer->capacity = 0;
buffer->string.flags = ZYAN_STRING_HAS_FIXED_CAPACITY;
buffer->string.vector.allocator = ZYAN_NULL;
#if defined(ZYAN_NO_LIBC) // no-libc correlates quite well with kernel environments
// We can't use floats in kernel. Initialize them via memcpy hack.
// Note: this is only required in the backported version for Zydis v3.0.
// Newer version depend on a version of zycore that got rid of the floats.
ZYAN_STATIC_ASSERT(sizeof(buffer->string.vector.growth_factor) == 4);
ZYAN_STATIC_ASSERT(sizeof(buffer->string.vector.shrink_threshold) == 4);
ZYAN_MEMCPY(&buffer->string.vector.growth_factor, "\x00\x00\x80\x3F", 4);
ZYAN_MEMCPY(&buffer->string.vector.shrink_threshold, "\x00\x00\x00\x00", 4);
#else
buffer->string.vector.growth_factor = 1.0f;
buffer->string.vector.shrink_threshold = 0.0f;
#endif
buffer->string.vector.growth_factor = 1;
buffer->string.vector.shrink_threshold = 0;
buffer->string.vector.destructor = ZYAN_NULL;
buffer->string.vector.element_size = sizeof(char);
buffer->string.vector.size = 1;
@ -89,7 +77,7 @@ void ZydisFormatterBufferInit(ZydisFormatterBuffer* buffer, char* user_buffer,
*user_buffer = '\0';
}
void ZydisFormatterBufferInitTokenized(ZydisFormatterBuffer* buffer,
static void ZydisFormatterBufferInitTokenized(ZydisFormatterBuffer* buffer,
ZydisFormatterToken** first_token, void* user_buffer, ZyanUSize length)
{
ZYAN_ASSERT(buffer);
@ -108,20 +96,8 @@ void ZydisFormatterBufferInitTokenized(ZydisFormatterBuffer* buffer,
buffer->capacity = length;
buffer->string.flags = ZYAN_STRING_HAS_FIXED_CAPACITY;
buffer->string.vector.allocator = ZYAN_NULL;
#if defined(ZYAN_NO_LIBC) // no-libc correlates quite well with kernel environments
// We can't use floats in kernel. Initialize them via memcpy hack.
// Note: this is only required in the backported version for Zydis v3.0.
// Newer version depend on a version of zycore that got rid of the floats.
ZYAN_STATIC_ASSERT(sizeof(buffer->string.vector.growth_factor) == 4);
ZYAN_STATIC_ASSERT(sizeof(buffer->string.vector.shrink_threshold) == 4);
ZYAN_MEMCPY(&buffer->string.vector.growth_factor, "\x00\x00\x80\x3F", 4);
ZYAN_MEMCPY(&buffer->string.vector.shrink_threshold, "\x00\x00\x00\x00", 4);
#else
buffer->string.vector.growth_factor = 1.0f;
buffer->string.vector.shrink_threshold = 0.0f;
#endif
buffer->string.vector.growth_factor = 1;
buffer->string.vector.shrink_threshold = 0;
buffer->string.vector.destructor = ZYAN_NULL;
buffer->string.vector.element_size = sizeof(char);
buffer->string.vector.size = 1;
@ -355,6 +331,11 @@ ZyanStatus ZydisFormatterSetProperty(ZydisFormatter* formatter, ZydisFormatterPr
formatter->hex_uppercase = (value) ? ZYAN_TRUE : ZYAN_FALSE;
break;
}
case ZYDIS_FORMATTER_PROP_HEX_FORCE_LEADING_NUMBER:
{
formatter->hex_force_leading_number = (value) ? ZYAN_TRUE : ZYAN_FALSE;
break;
}
case ZYDIS_FORMATTER_PROP_HEX_PREFIX:
{
base = ZYDIS_NUMERIC_BASE_HEX;
@ -472,18 +453,12 @@ ZyanStatus ZydisFormatterSetHook(ZydisFormatter* formatter, ZydisFormatterFuncti
/* ---------------------------------------------------------------------------------------------- */
ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
ZyanU64 runtime_address)
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands,
ZyanU8 operand_count, char* buffer, ZyanUSize length, ZyanU64 runtime_address, void* user_data)
{
return ZydisFormatterFormatInstructionEx(formatter, instruction, buffer, length,
runtime_address, ZYAN_NULL);
}
ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
ZyanU64 runtime_address, void* user_data)
{
if (!formatter || !instruction || !buffer || (length == 0))
if (!formatter || !instruction || (operand_count && !operands) ||
(operand_count > ZYDIS_MAX_OPERAND_COUNT) ||
(operand_count < instruction->operand_count_visible) || !buffer || (length == 0))
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
@ -493,6 +468,7 @@ ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
ZydisFormatterContext context;
context.instruction = instruction;
context.operands = operands;
context.runtime_address = runtime_address;
context.operand = ZYAN_NULL;
context.user_data = user_data;
@ -513,19 +489,10 @@ ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
}
ZyanStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
ZyanU64 runtime_address)
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
char* buffer, ZyanUSize length, ZyanU64 runtime_address, void* user_data)
{
return ZydisFormatterFormatOperandEx(formatter, instruction, index, buffer, length,
runtime_address, ZYAN_NULL);
}
ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
ZyanU64 runtime_address, void* user_data)
{
if (!formatter || !instruction || index >= instruction->operand_count || !buffer ||
(length == 0))
if (!formatter || !instruction || !operand || !buffer || (length == 0))
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
@ -535,8 +502,9 @@ ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
ZydisFormatterContext context;
context.instruction = instruction;
context.operands = ZYAN_NULL;
context.runtime_address = runtime_address;
context.operand = &instruction->operands[index];
context.operand = operand;
context.user_data = user_data;
// We ignore `ZYDIS_STATUS_SKIP_TOKEN` for all operand-functions as it does not make any sense
@ -578,18 +546,14 @@ ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
/* ---------------------------------------------------------------------------------------------- */
ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
ZyanU64 runtime_address, ZydisFormatterTokenConst** token)
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands,
ZyanU8 operand_count, void* buffer, ZyanUSize length, ZyanU64 runtime_address,
ZydisFormatterTokenConst** token, void* user_data)
{
return ZydisFormatterTokenizeInstructionEx(formatter, instruction, buffer, length,
runtime_address, token, ZYAN_NULL);
}
ZyanStatus ZydisFormatterTokenizeInstructionEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data)
{
if (!formatter || !instruction || !buffer || (length <= sizeof(ZydisFormatterToken)) || !token)
if (!formatter || !instruction || (operand_count && !operands) ||
(operand_count > ZYDIS_MAX_OPERAND_COUNT) ||
(operand_count < instruction->operand_count_visible) || !buffer ||
(length <= sizeof(ZydisFormatterToken)) || !token)
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
@ -600,6 +564,7 @@ ZyanStatus ZydisFormatterTokenizeInstructionEx(const ZydisFormatter* formatter,
ZydisFormatterContext context;
context.instruction = instruction;
context.operands = operands;
context.runtime_address = runtime_address;
context.operand = ZYAN_NULL;
context.user_data = user_data;
@ -628,18 +593,11 @@ ZyanStatus ZydisFormatterTokenizeInstructionEx(const ZydisFormatter* formatter,
}
ZyanStatus ZydisFormatterTokenizeOperand(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
ZyanU64 runtime_address, ZydisFormatterTokenConst** token)
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
void* buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst** token,
void* user_data)
{
return ZydisFormatterTokenizeOperandEx(formatter, instruction, index, buffer, length,
runtime_address, token, ZYAN_NULL);
}
ZyanStatus ZydisFormatterTokenizeOperandEx(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data)
{
if (!formatter || !instruction || (index >= instruction->operand_count) || !buffer ||
if (!formatter || !instruction || !operand || !buffer ||
(length <= sizeof(ZydisFormatterToken)) || !token)
{
return ZYAN_STATUS_INVALID_ARGUMENT;
@ -651,8 +609,9 @@ ZyanStatus ZydisFormatterTokenizeOperandEx(const ZydisFormatter* formatter,
ZydisFormatterContext context;
context.instruction = instruction;
context.operands = ZYAN_NULL;
context.runtime_address = runtime_address;
context.operand = &instruction->operands[index];
context.operand = operand;
context.user_data = user_data;
// We ignore `ZYDIS_STATUS_SKIP_TOKEN` for all operand-functions as it does not make any sense

View File

@ -46,24 +46,19 @@ ZyanStatus ZydisFormatterATTFormatInstruction(const ZydisFormatter* formatter,
ZYAN_ASSERT(formatter);
ZYAN_ASSERT(buffer);
ZYAN_ASSERT(context);
ZYAN_ASSERT(context->instruction);
ZYAN_ASSERT(context->operands);
ZYAN_CHECK(formatter->func_print_prefixes(formatter, buffer, context));
ZYAN_CHECK(formatter->func_print_mnemonic(formatter, buffer, context));
ZyanUPointer state_mnemonic;
ZYDIS_BUFFER_REMEMBER(buffer, state_mnemonic);
ZyanI8 c = (ZyanI8)context->instruction->operand_count - 1;
for (; c >= 0; --c)
{
if (context->instruction->operands[c].visibility != ZYDIS_OPERAND_VISIBILITY_HIDDEN)
{
break;
}
}
const ZyanI8 c = (ZyanI8)context->instruction->operand_count_visible - 1;
for (ZyanI8 i = c; i >= 0; --i)
{
const ZydisDecodedOperand* const operand = &context->instruction->operands[i];
const ZydisDecodedOperand* const operand = &context->operands[i];
// Print embedded-mask registers as decorator instead of a regular operand
if ((i == 1) && (operand->type == ZYDIS_OPERAND_TYPE_REGISTER) &&
@ -147,7 +142,8 @@ ZyanStatus ZydisFormatterATTFormatInstruction(const ZydisFormatter* formatter,
(context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX))
{
if ((i == 0) &&
(context->instruction->operands[i + 1].encoding == ZYDIS_OPERAND_ENCODING_MASK))
(context->instruction->operand_count_visible > 1) &&
(context->operands[1].encoding == ZYDIS_OPERAND_ENCODING_MASK))
{
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
ZYDIS_DECORATOR_MASK));
@ -165,16 +161,17 @@ ZyanStatus ZydisFormatterATTFormatInstruction(const ZydisFormatter* formatter,
}
} else
{
ZyanBool decorate_operand = ZYAN_FALSE;
if (i == (context->instruction->operand_count - 1))
ZyanBool decorate_operand;
if (i == (context->instruction->operand_count_visible - 1))
{
decorate_operand = operand->type != ZYDIS_OPERAND_TYPE_IMMEDIATE;
}
else
{
decorate_operand =
(context->instruction->operands[i + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE) ||
(context->instruction->operands[i + 1].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN);
(context->instruction->operand_count_visible > (i + 1)) &&
((context->operands[i + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE) ||
(context->operands[i + 1].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN));
}
if (decorate_operand)
{
@ -280,6 +277,8 @@ ZyanStatus ZydisFormatterATTPrintMnemonic(const ZydisFormatter* formatter,
ZYAN_ASSERT(formatter);
ZYAN_ASSERT(buffer);
ZYAN_ASSERT(context);
ZYAN_ASSERT(context->instruction);
ZYAN_ASSERT(context->operands);
const ZydisShortString* mnemonic = ZydisMnemonicGetStringWrapped(
context->instruction->mnemonic);
@ -299,17 +298,14 @@ ZyanStatus ZydisFormatterATTPrintMnemonic(const ZydisFormatter* formatter,
// Append operand-size suffix
ZyanU32 size = 0;
for (ZyanU8 i = 0; i < context->instruction->operand_count; ++i)
for (ZyanU8 i = 0; i < context->instruction->operand_count_visible; ++i)
{
const ZydisDecodedOperand* const operand = &context->instruction->operands[i];
if (operand->visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN)
{
break;
}
const ZydisDecodedOperand* const operand = &context->operands[i];
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
(operand->mem.type == ZYDIS_MEMOP_TYPE_MEM))
((operand->mem.type == ZYDIS_MEMOP_TYPE_MEM) ||
(operand->mem.type == ZYDIS_MEMOP_TYPE_VSIB)))
{
size = ZydisFormatterHelperGetExplicitSize(formatter, context, i);
size = ZydisFormatterHelperGetExplicitSize(formatter, context, operand);
break;
}
}
@ -374,7 +370,7 @@ ZyanStatus ZydisFormatterATTPrintAddressABS(const ZydisFormatter* formatter,
ZYAN_ASSERT(context);
if ((context->instruction->meta.branch_type != ZYDIS_BRANCH_TYPE_NONE) &&
(context->instruction->operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY))
(context->operand->type == ZYDIS_OPERAND_TYPE_MEMORY))
{
ZYDIS_BUFFER_APPEND(buffer, MUL);
}
@ -395,11 +391,13 @@ ZyanStatus ZydisFormatterATTPrintDISP(const ZydisFormatter* formatter,
case ZYDIS_SIGNEDNESS_AUTO:
case ZYDIS_SIGNEDNESS_SIGNED:
ZYDIS_STRING_APPEND_NUM_S(formatter, formatter->disp_base, &buffer->string,
context->operand->mem.disp.value, formatter->disp_padding, ZYAN_FALSE);
context->operand->mem.disp.value, formatter->disp_padding,
formatter->hex_force_leading_number, ZYAN_FALSE);
break;
case ZYDIS_SIGNEDNESS_UNSIGNED:
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->disp_base, &buffer->string,
context->operand->mem.disp.value, formatter->disp_padding);
context->operand->mem.disp.value, formatter->disp_padding,
formatter->hex_force_leading_number);
break;
default:
return ZYAN_STATUS_INVALID_ARGUMENT;

View File

@ -78,46 +78,62 @@ static const ZydisPredefinedToken* const TOK_PREF_REX[16] =
/* ============================================================================================== */
ZyanU32 ZydisFormatterHelperGetExplicitSize(const ZydisFormatter* formatter,
ZydisFormatterContext* context, ZyanU8 memop_id)
ZydisFormatterContext* context, const ZydisDecodedOperand* operand)
{
ZYAN_ASSERT(formatter);
ZYAN_ASSERT(context);
ZYAN_ASSERT(memop_id < context->instruction->operand_count);
ZYAN_ASSERT(operand);
const ZydisDecodedOperand* const operand = &context->instruction->operands[memop_id];
ZYAN_ASSERT(operand->type == ZYDIS_OPERAND_TYPE_MEMORY);
ZYAN_ASSERT(operand->mem.type == ZYDIS_MEMOP_TYPE_MEM);
ZYAN_ASSERT((operand->mem.type == ZYDIS_MEMOP_TYPE_MEM) ||
(operand->mem.type == ZYDIS_MEMOP_TYPE_AGEN) ||
(operand->mem.type == ZYDIS_MEMOP_TYPE_VSIB));
if (formatter->force_memory_size)
{
return operand->size;
}
else if (operand->mem.type == ZYDIS_MEMOP_TYPE_AGEN)
{
return 0;
}
if (!context->operands)
{
// Single operand formatting. We can not derive the explicit size by using the other
// operands.
return 0;
}
switch (operand->id)
{
case 0:
if ((context->instruction->operands[1].type == ZYDIS_OPERAND_TYPE_UNUSED) ||
(context->instruction->operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE))
if (context->instruction->operand_count_visible < 2)
{
return context->instruction->operands[0].size;
return 0;
}
if (context->instruction->operands[0].size != context->instruction->operands[1].size)
if ((context->operands[1].type == ZYDIS_OPERAND_TYPE_UNUSED) ||
(context->operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE))
{
return context->instruction->operands[0].size;
return context->operands[0].size;
}
if ((context->instruction->operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER) &&
(context->instruction->operands[1].visibility == ZYDIS_OPERAND_VISIBILITY_IMPLICIT) &&
(context->instruction->operands[1].reg.value == ZYDIS_REGISTER_CL))
if (context->operands[0].size != context->operands[1].size)
{
return context->instruction->operands[0].size;
return context->operands[0].size;
}
if ((context->operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER) &&
(context->operands[1].visibility == ZYDIS_OPERAND_VISIBILITY_IMPLICIT) &&
(context->operands[1].reg.value == ZYDIS_REGISTER_CL))
{
return context->operands[0].size;
}
break;
case 1:
case 2:
if (context->instruction->operands[operand->id - 1].size !=
context->instruction->operands[operand->id].size)
if (context->operands[operand->id - 1].size !=
context->operands[operand->id].size)
{
return context->instruction->operands[operand->id].size;
return context->operands[operand->id].size;
}
break;
default:
@ -154,7 +170,7 @@ ZyanStatus ZydisFormatterBaseFormatOperandPTR(const ZydisFormatter* formatter,
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string,
context->operand->ptr.segment, 4);
context->operand->ptr.segment, 4, formatter->hex_force_leading_number);
ZYDIS_BUFFER_APPEND(buffer, DELIM_SEGMENT);
ZyanU8 padding;
@ -172,7 +188,7 @@ ZyanStatus ZydisFormatterBaseFormatOperandPTR(const ZydisFormatter* formatter,
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string,
context->operand->ptr.offset , padding);
context->operand->ptr.offset , padding, formatter->hex_force_leading_number);
return ZYAN_STATUS_SUCCESS;
}
@ -219,7 +235,7 @@ ZyanStatus ZydisFormatterBasePrintAddressABS(const ZydisFormatter* formatter,
if ((formatter->addr_padding_absolute == ZYDIS_PADDING_AUTO) &&
(formatter->addr_base == ZYDIS_NUMERIC_BASE_HEX))
{
switch (context->instruction->stack_width)
switch (context->instruction->address_width)
{
case 16:
padding = 4;
@ -238,7 +254,8 @@ ZyanStatus ZydisFormatterBasePrintAddressABS(const ZydisFormatter* formatter,
}
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_ADDRESS_ABS);
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string, address, padding);
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string, address, padding,
formatter->hex_force_leading_number);
return ZYAN_STATUS_SUCCESS;
}
@ -258,7 +275,7 @@ ZyanStatus ZydisFormatterBasePrintAddressREL(const ZydisFormatter* formatter,
if ((formatter->addr_padding_relative == ZYDIS_PADDING_AUTO) &&
(formatter->addr_base == ZYDIS_NUMERIC_BASE_HEX))
{
switch (context->instruction->stack_width)
switch (context->instruction->address_width)
{
case 16:
padding = 4;
@ -282,12 +299,12 @@ ZyanStatus ZydisFormatterBasePrintAddressREL(const ZydisFormatter* formatter,
case ZYDIS_SIGNEDNESS_AUTO:
case ZYDIS_SIGNEDNESS_SIGNED:
ZYDIS_STRING_APPEND_NUM_S(formatter, formatter->addr_base, &buffer->string, address,
padding, ZYAN_TRUE);
padding, formatter->hex_force_leading_number, ZYAN_TRUE);
break;
case ZYDIS_SIGNEDNESS_UNSIGNED:
ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_ADD));
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->addr_base, &buffer->string, address,
padding);
padding, formatter->hex_force_leading_number);
break;
default:
return ZYAN_STATUS_INVALID_ARGUMENT;
@ -311,7 +328,8 @@ ZyanStatus ZydisFormatterBasePrintIMM(const ZydisFormatter* formatter,
if (is_signed && (context->operand->imm.value.s < 0))
{
ZYDIS_STRING_APPEND_NUM_S(formatter, formatter->imm_base, &buffer->string,
context->operand->imm.value.s, formatter->imm_padding, ZYAN_FALSE);
context->operand->imm.value.s, formatter->imm_padding,
formatter->hex_force_leading_number, ZYAN_FALSE);
return ZYAN_STATUS_SUCCESS;
}
ZyanU64 value;
@ -350,7 +368,8 @@ ZyanStatus ZydisFormatterBasePrintIMM(const ZydisFormatter* formatter,
default:
return ZYAN_STATUS_INVALID_ARGUMENT;
}
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->imm_base, &buffer->string, value, padding);
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->imm_base, &buffer->string, value, padding,
formatter->hex_force_leading_number);
return ZYAN_STATUS_SUCCESS;
}
@ -463,7 +482,8 @@ ZyanStatus ZydisFormatterBasePrintPrefixes(const ZydisFormatter* formatter,
default:
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_PREFIX);
ZYAN_CHECK(ZydisStringAppendHexU(&buffer->string, value, 0,
formatter->hex_uppercase, ZYAN_NULL, ZYAN_NULL));
formatter->hex_force_leading_number, formatter->hex_uppercase,
ZYAN_NULL, ZYAN_NULL));
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_WHITESPACE);
ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_WHITESPACE));
break;

View File

@ -48,20 +48,17 @@ ZyanStatus ZydisFormatterIntelFormatInstruction(const ZydisFormatter* formatter,
ZYAN_ASSERT(formatter);
ZYAN_ASSERT(buffer);
ZYAN_ASSERT(context);
ZYAN_ASSERT(context->instruction);
ZYAN_ASSERT(context->operands);
ZYAN_CHECK(formatter->func_print_prefixes(formatter, buffer, context));
ZYAN_CHECK(formatter->func_print_mnemonic(formatter, buffer, context));
ZyanUPointer state_mnemonic;
ZYDIS_BUFFER_REMEMBER(buffer, state_mnemonic);
for (ZyanU8 i = 0; i < context->instruction->operand_count; ++i)
for (ZyanU8 i = 0; i < context->instruction->operand_count_visible; ++i)
{
const ZydisDecodedOperand* const operand = &context->instruction->operands[i];
if (operand->visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN)
{
break;
}
const ZydisDecodedOperand* const operand = &context->operands[i];
// Print embedded-mask registers as decorator instead of a regular operand
if ((i == 1) && (operand->type == ZYDIS_OPERAND_TYPE_REGISTER) &&
@ -145,7 +142,8 @@ ZyanStatus ZydisFormatterIntelFormatInstruction(const ZydisFormatter* formatter,
(context->instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX))
{
if ((i == 0) &&
(context->instruction->operands[i + 1].encoding == ZYDIS_OPERAND_ENCODING_MASK))
(context->instruction->operand_count_visible > 1) &&
(context->operands[i + 1].encoding == ZYDIS_OPERAND_ENCODING_MASK))
{
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
ZYDIS_DECORATOR_MASK));
@ -163,16 +161,17 @@ ZyanStatus ZydisFormatterIntelFormatInstruction(const ZydisFormatter* formatter,
}
} else
{
ZyanBool decorate_operand = ZYAN_FALSE;
if (i == (context->instruction->operand_count - 1))
ZyanBool decorate_operand;
if (i == (context->instruction->operand_count_visible - 1))
{
decorate_operand = operand->type != ZYDIS_OPERAND_TYPE_IMMEDIATE;
}
else
{
decorate_operand =
(context->instruction->operands[i + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE) ||
(context->instruction->operands[i + 1].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN);
(context->instruction->operand_count_visible > (i + 1)) &&
((context->operands[i + 1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE) ||
(context->operands[i + 1].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN));
}
if (decorate_operand)
{
@ -201,7 +200,9 @@ ZyanStatus ZydisFormatterIntelFormatOperandMEM(const ZydisFormatter* formatter,
ZYAN_ASSERT(buffer);
ZYAN_ASSERT(context);
if (context->operand->mem.type == ZYDIS_MEMOP_TYPE_MEM)
if ((context->operand->mem.type == ZYDIS_MEMOP_TYPE_MEM) ||
(context->operand->mem.type == ZYDIS_MEMOP_TYPE_AGEN) ||
(context->operand->mem.type == ZYDIS_MEMOP_TYPE_VSIB))
{
ZYAN_CHECK(formatter->func_print_typecast(formatter, buffer, context));
}
@ -343,7 +344,8 @@ ZyanStatus ZydisFormatterIntelPrintDISP(const ZydisFormatter* formatter,
}
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_DISPLACEMENT);
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->disp_base, &buffer->string,
ZyanAbsI64(context->operand->mem.disp.value), formatter->disp_padding);
ZyanAbsI64(context->operand->mem.disp.value), formatter->disp_padding,
formatter->hex_force_leading_number);
break;
}
ZYAN_FALLTHROUGH;
@ -355,7 +357,8 @@ ZyanStatus ZydisFormatterIntelPrintDISP(const ZydisFormatter* formatter,
}
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_DISPLACEMENT);
ZYDIS_STRING_APPEND_NUM_U(formatter, formatter->disp_base, &buffer->string,
context->operand->mem.disp.value, formatter->disp_padding);
context->operand->mem.disp.value, formatter->disp_padding,
formatter->hex_force_leading_number);
break;
default:
return ZYAN_STATUS_INVALID_ARGUMENT;
@ -371,7 +374,7 @@ ZyanStatus ZydisFormatterIntelPrintTypecast(const ZydisFormatter* formatter,
ZYAN_ASSERT(buffer);
ZYAN_ASSERT(context);
switch (ZydisFormatterHelperGetExplicitSize(formatter, context, context->operand->id))
switch (ZydisFormatterHelperGetExplicitSize(formatter, context, context->operand))
{
case 8: ZYDIS_BUFFER_APPEND(buffer, SIZE_8_INTEL ); break;
case 16: ZYDIS_BUFFER_APPEND(buffer, SIZE_16_INTEL ); break;
@ -423,7 +426,7 @@ ZyanStatus ZydisFormatterIntelPrintAddressMASM(const ZydisFormatter* formatter,
if ((formatter->addr_padding_relative == ZYDIS_PADDING_AUTO) &&
(formatter->addr_base == ZYDIS_NUMERIC_BASE_HEX))
{
switch (context->instruction->stack_width)
switch (context->instruction->address_width)
{
case 16:
padding = 4;
@ -443,7 +446,7 @@ ZyanStatus ZydisFormatterIntelPrintAddressMASM(const ZydisFormatter* formatter,
ZYDIS_BUFFER_APPEND(buffer, ADDR_RELATIVE);
ZYDIS_STRING_APPEND_NUM_S(formatter, formatter->addr_base, &buffer->string, address, padding,
ZYAN_TRUE);
formatter->hex_force_leading_number, ZYAN_TRUE);
return ZYAN_STATUS_SUCCESS;
}

View File

@ -1,78 +1,78 @@
#ifndef ZYDIS_MINIMAL_MODE
static const ZydisAccessedFlags ACCESSED_FLAGS[] =
static const ZydisDefinitionAccessedFlags ACCESSED_FLAGS[] =
{
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED }, 0x0, 0x0, 0x0, 0xF },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED }, 0x0, 0x0, 0x0, 0xF },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED }, 0x0, 0x0, 0x0, 0xF },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED }, 0x0, 0x0, 0x0, 0xF },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x40000, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_1, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x40000, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x1000, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x800, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x800, 0x800, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x400, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x1400, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x400, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_1, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x400, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x1000, 0x80200, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x30200, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x21800, 0x74300, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x21000, 0xF4300, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x80, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x880, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x40, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED }, 0x40, 0x0, 0x0, 0xF },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x8C0, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x40, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x4, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED }, 0x4, 0x0, 0x0, 0xF },
{ { ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D4, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x1, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED }, 0x1, 0x0, 0x0, 0xF },
{ { ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x41, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED }, 0x41, 0x0, 0x0, 0xF },
{ { ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0xD5, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x3F5FD5, 0x0, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x1, 0x1, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x1, 0x801, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x11, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x1, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x1, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x1, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x801, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x41, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x440, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0xD5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x400, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x25000, 0x3F5FD5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x21000, 0x3D5FD5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_TESTED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x121000, 0x2D5FD5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x3F5FD5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x3D5FD5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x3F5FD5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x2 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x10, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x895, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x1, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_SET_0, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_SET_1, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x1, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_MODIFIED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 },
{ { ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_UNDEFINED, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE, ZYDIS_CPUFLAG_ACTION_NONE }, 0x0, 0x8D5, 0x0, 0x0 }
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0xF, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x6, 0x0, 0x0, 0x9 } },
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0xF } },
{ { 0x0, 0x0, 0x40000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x0, 0x40000, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1000, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x800, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x800, 0x800, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x400, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1400, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x400, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x0, 0x400, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1000, 0x80200, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x30200, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x21800, 0x64300, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x21000, 0xE4200, 0x10100, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x80, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x880, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x40, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x40, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
{ { 0x8C0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x40, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x4, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x4, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
{ { 0x0, 0x8D4, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
{ { 0x41, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x41, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
{ { 0xD5, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x3F5FD5, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1, 0x1, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1, 0x1, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x11, 0xD5, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x1, 0x8C5, 0x0, 0x0, 0x10 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x1, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x1, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x41, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x440, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0xD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x400, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x25000, 0x3F5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x21000, 0x3D5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x121000, 0x2C5FD5, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x3F5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x3C5FD5, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x3C5FD5, 0x30000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x45, 0x890, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x45, 0x890, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0x0 } },
{ { 0x0, 0xC5, 0x0, 0x0, 0x810 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x8C1, 0x14, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x41, 0x894, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x1, 0x8D4, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x10, 0x11, 0x0, 0x0, 0x8C4 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x1, 0x0, 0x0, 0x894 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0xC1, 0x800, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x41, 0x0, 0x0, 0x894 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x81, 0x840, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x801, 0x0, 0x0, 0xD4 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x1, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0xC4, 0x801, 0x0, 0x10 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x40, 0x895, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x8D5, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0xC0, 0x801, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x40, 0x801, 0x0, 0x94 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x0, 0x1, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0xC4, 0x0, 0x0, 0x811 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x40, 0x0, 0x0, 0x895 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
{ { 0x0, 0x0, 0x0, 0x0, 0x8D5 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } }
};
#endif

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@ static const char* STR_ISAEXT[] =
"AMD3DNOW_PREFETCH",
"AMD_INVLPGB",
"AMX_BF16",
"AMX_FP16",
"AMX_INT8",
"AMX_TILE",
"AVX",
@ -15,7 +16,11 @@ static const char* STR_ISAEXT[] =
"AVX512EVEX",
"AVX512VEX",
"AVXAES",
"AVX_IFMA",
"AVX_NE_CONVERT",
"AVX_VNNI",
"AVX_VNNI_INT16",
"AVX_VNNI_INT8",
"BASE",
"BMI1",
"BMI2",
@ -31,6 +36,7 @@ static const char* STR_ISAEXT[] =
"FMA4",
"GFNI",
"HRESET",
"ICACHE_PREFETCH",
"INVPCID",
"KEYLOCKER",
"KEYLOCKER_WIDE",
@ -46,13 +52,17 @@ static const char* STR_ISAEXT[] =
"MOVBE",
"MOVDIR",
"MPX",
"MSRLIST",
"PADLOCK",
"PAUSE",
"PBNDKB",
"PCLMULQDQ",
"PCOMMIT",
"PCONFIG",
"PKU",
"PREFETCHWT1",
"PT",
"RAO_INT",
"RDPID",
"RDPRU",
"RDRAND",
@ -64,6 +74,9 @@ static const char* STR_ISAEXT[] =
"SGX",
"SGX_ENCLV",
"SHA",
"SHA512",
"SM3",
"SM4",
"SMAP",
"SMX",
"SNP",
@ -83,6 +96,7 @@ static const char* STR_ISAEXT[] =
"VPCLMULQDQ",
"VTX",
"WAITPKG",
"WRMSRNS",
"X87",
"XOP",
"XSAVE",

View File

@ -5,7 +5,9 @@ static const char* STR_ISASET[] =
"AES",
"AMD",
"AMD3DNOW",
"AMD_INVLPGB",
"AMX_BF16",
"AMX_FP16",
"AMX_INT8",
"AMX_TILE",
"AVX",
@ -77,7 +79,11 @@ static const char* STR_ISASET[] =
"AVX512_VPOPCNTDQ_512",
"AVXAES",
"AVX_GFNI",
"AVX_IFMA",
"AVX_NE_CONVERT",
"AVX_VNNI",
"AVX_VNNI_INT16",
"AVX_VNNI_INT8",
"BMI1",
"BMI2",
"CET",
@ -92,6 +98,7 @@ static const char* STR_ISASET[] =
"F16C",
"FAT_NOP",
"FCMOV",
"FCOMI",
"FMA",
"FMA4",
"FXSAVE",
@ -105,6 +112,7 @@ static const char* STR_ISASET[] =
"I486",
"I486REAL",
"I86",
"ICACHE_PREFETCH",
"INVPCID",
"KEYLOCKER",
"KEYLOCKER_WIDE",
@ -124,12 +132,15 @@ static const char* STR_ISASET[] =
"MOVBE",
"MOVDIR",
"MPX",
"MSRLIST",
"PADLOCK_ACE",
"PADLOCK_PHE",
"PADLOCK_PMM",
"PADLOCK_RNG",
"PAUSE",
"PBNDKB",
"PCLMULQDQ",
"PCOMMIT",
"PCONFIG",
"PENTIUMMMX",
"PENTIUMREAL",
@ -139,6 +150,7 @@ static const char* STR_ISASET[] =
"PREFETCHWT1",
"PREFETCH_NOP",
"PT",
"RAO_INT",
"RDPID",
"RDPMC",
"RDPRU",
@ -151,8 +163,12 @@ static const char* STR_ISASET[] =
"SGX",
"SGX_ENCLV",
"SHA",
"SHA512",
"SM3",
"SM4",
"SMAP",
"SMX",
"SNP",
"SSE",
"SSE2",
"SSE2MMX",
@ -175,6 +191,7 @@ static const char* STR_ISASET[] =
"VPCLMULQDQ",
"VTX",
"WAITPKG",
"WRMSRNS",
"X87",
"XOP",
"XSAVE",

View File

@ -14,6 +14,7 @@ static const char* STR_INSTRUCTIONCATEGORY[] =
"AVX512_BITALG",
"AVX512_VBMI",
"AVX512_VP2INTERSECT",
"AVX_IFMA",
"BINARY",
"BITBYTE",
"BLEND",
@ -60,9 +61,12 @@ static const char* STR_INSTRUCTIONCATEGORY[] =
"MMX",
"MOVDIR",
"MPX",
"MSRLIST",
"NOP",
"PADLOCK",
"PBNDKB",
"PCLMULQDQ",
"PCOMMIT",
"PCONFIG",
"PKU",
"POP",
@ -84,6 +88,7 @@ static const char* STR_INSTRUCTIONCATEGORY[] =
"SETCC",
"SGX",
"SHA",
"SHA512",
"SHIFT",
"SMAP",
"SSE",
@ -105,6 +110,7 @@ static const char* STR_INSTRUCTIONCATEGORY[] =
"VTX",
"WAITPKG",
"WIDENOP",
"WRMSRNS",
"X87_ALU",
"XOP",
"XSAVE",

View File

@ -3,7 +3,9 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("invalid"),
ZYDIS_MAKE_SHORTSTRING("aaa"),
ZYDIS_MAKE_SHORTSTRING("aad"),
ZYDIS_MAKE_SHORTSTRING("aadd"),
ZYDIS_MAKE_SHORTSTRING("aam"),
ZYDIS_MAKE_SHORTSTRING("aand"),
ZYDIS_MAKE_SHORTSTRING("aas"),
ZYDIS_MAKE_SHORTSTRING("adc"),
ZYDIS_MAKE_SHORTSTRING("adcx"),
@ -35,7 +37,9 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("andnps"),
ZYDIS_MAKE_SHORTSTRING("andpd"),
ZYDIS_MAKE_SHORTSTRING("andps"),
ZYDIS_MAKE_SHORTSTRING("aor"),
ZYDIS_MAKE_SHORTSTRING("arpl"),
ZYDIS_MAKE_SHORTSTRING("axor"),
ZYDIS_MAKE_SHORTSTRING("bextr"),
ZYDIS_MAKE_SHORTSTRING("blcfill"),
ZYDIS_MAKE_SHORTSTRING("blci"),
@ -516,6 +520,7 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("pavgw"),
ZYDIS_MAKE_SHORTSTRING("pblendvb"),
ZYDIS_MAKE_SHORTSTRING("pblendw"),
ZYDIS_MAKE_SHORTSTRING("pbndkb"),
ZYDIS_MAKE_SHORTSTRING("pclmulqdq"),
ZYDIS_MAKE_SHORTSTRING("pcmpeqb"),
ZYDIS_MAKE_SHORTSTRING("pcmpeqd"),
@ -529,6 +534,7 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("pcmpgtw"),
ZYDIS_MAKE_SHORTSTRING("pcmpistri"),
ZYDIS_MAKE_SHORTSTRING("pcmpistrm"),
ZYDIS_MAKE_SHORTSTRING("pcommit"),
ZYDIS_MAKE_SHORTSTRING("pconfig"),
ZYDIS_MAKE_SHORTSTRING("pdep"),
ZYDIS_MAKE_SHORTSTRING("pext"),
@ -612,6 +618,8 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("popfq"),
ZYDIS_MAKE_SHORTSTRING("por"),
ZYDIS_MAKE_SHORTSTRING("prefetch"),
ZYDIS_MAKE_SHORTSTRING("prefetchit0"),
ZYDIS_MAKE_SHORTSTRING("prefetchit1"),
ZYDIS_MAKE_SHORTSTRING("prefetchnta"),
ZYDIS_MAKE_SHORTSTRING("prefetcht0"),
ZYDIS_MAKE_SHORTSTRING("prefetcht1"),
@ -672,6 +680,7 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("rdfsbase"),
ZYDIS_MAKE_SHORTSTRING("rdgsbase"),
ZYDIS_MAKE_SHORTSTRING("rdmsr"),
ZYDIS_MAKE_SHORTSTRING("rdmsrlist"),
ZYDIS_MAKE_SHORTSTRING("rdpid"),
ZYDIS_MAKE_SHORTSTRING("rdpkru"),
ZYDIS_MAKE_SHORTSTRING("rdpmc"),
@ -785,6 +794,7 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("tdpbsud"),
ZYDIS_MAKE_SHORTSTRING("tdpbusd"),
ZYDIS_MAKE_SHORTSTRING("tdpbuud"),
ZYDIS_MAKE_SHORTSTRING("tdpfp16ps"),
ZYDIS_MAKE_SHORTSTRING("test"),
ZYDIS_MAKE_SHORTSTRING("testui"),
ZYDIS_MAKE_SHORTSTRING("tileloadd"),
@ -836,6 +846,8 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("vandnps"),
ZYDIS_MAKE_SHORTSTRING("vandpd"),
ZYDIS_MAKE_SHORTSTRING("vandps"),
ZYDIS_MAKE_SHORTSTRING("vbcstnebf162ps"),
ZYDIS_MAKE_SHORTSTRING("vbcstnesh2ps"),
ZYDIS_MAKE_SHORTSTRING("vblendmpd"),
ZYDIS_MAKE_SHORTSTRING("vblendmps"),
ZYDIS_MAKE_SHORTSTRING("vblendpd"),
@ -877,6 +889,10 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("vcvtfxpntps2udq"),
ZYDIS_MAKE_SHORTSTRING("vcvtfxpntudq2ps"),
ZYDIS_MAKE_SHORTSTRING("vcvtne2ps2bf16"),
ZYDIS_MAKE_SHORTSTRING("vcvtneebf162ps"),
ZYDIS_MAKE_SHORTSTRING("vcvtneeph2ps"),
ZYDIS_MAKE_SHORTSTRING("vcvtneobf162ps"),
ZYDIS_MAKE_SHORTSTRING("vcvtneoph2ps"),
ZYDIS_MAKE_SHORTSTRING("vcvtneps2bf16"),
ZYDIS_MAKE_SHORTSTRING("vcvtpd2dq"),
ZYDIS_MAKE_SHORTSTRING("vcvtpd2ph"),
@ -1338,10 +1354,22 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("vpcomw"),
ZYDIS_MAKE_SHORTSTRING("vpconflictd"),
ZYDIS_MAKE_SHORTSTRING("vpconflictq"),
ZYDIS_MAKE_SHORTSTRING("vpdpbssd"),
ZYDIS_MAKE_SHORTSTRING("vpdpbssds"),
ZYDIS_MAKE_SHORTSTRING("vpdpbsud"),
ZYDIS_MAKE_SHORTSTRING("vpdpbsuds"),
ZYDIS_MAKE_SHORTSTRING("vpdpbusd"),
ZYDIS_MAKE_SHORTSTRING("vpdpbusds"),
ZYDIS_MAKE_SHORTSTRING("vpdpbuud"),
ZYDIS_MAKE_SHORTSTRING("vpdpbuuds"),
ZYDIS_MAKE_SHORTSTRING("vpdpwssd"),
ZYDIS_MAKE_SHORTSTRING("vpdpwssds"),
ZYDIS_MAKE_SHORTSTRING("vpdpwsud"),
ZYDIS_MAKE_SHORTSTRING("vpdpwsuds"),
ZYDIS_MAKE_SHORTSTRING("vpdpwusd"),
ZYDIS_MAKE_SHORTSTRING("vpdpwusds"),
ZYDIS_MAKE_SHORTSTRING("vpdpwuud"),
ZYDIS_MAKE_SHORTSTRING("vpdpwuuds"),
ZYDIS_MAKE_SHORTSTRING("vperm2f128"),
ZYDIS_MAKE_SHORTSTRING("vperm2i128"),
ZYDIS_MAKE_SHORTSTRING("vpermb"),
@ -1678,12 +1706,20 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("vscatterpf1qps"),
ZYDIS_MAKE_SHORTSTRING("vscatterqpd"),
ZYDIS_MAKE_SHORTSTRING("vscatterqps"),
ZYDIS_MAKE_SHORTSTRING("vsha512msg1"),
ZYDIS_MAKE_SHORTSTRING("vsha512msg2"),
ZYDIS_MAKE_SHORTSTRING("vsha512rnds2"),
ZYDIS_MAKE_SHORTSTRING("vshuff32x4"),
ZYDIS_MAKE_SHORTSTRING("vshuff64x2"),
ZYDIS_MAKE_SHORTSTRING("vshufi32x4"),
ZYDIS_MAKE_SHORTSTRING("vshufi64x2"),
ZYDIS_MAKE_SHORTSTRING("vshufpd"),
ZYDIS_MAKE_SHORTSTRING("vshufps"),
ZYDIS_MAKE_SHORTSTRING("vsm3msg1"),
ZYDIS_MAKE_SHORTSTRING("vsm3msg2"),
ZYDIS_MAKE_SHORTSTRING("vsm3rnds2"),
ZYDIS_MAKE_SHORTSTRING("vsm4key4"),
ZYDIS_MAKE_SHORTSTRING("vsm4rnds4"),
ZYDIS_MAKE_SHORTSTRING("vsqrtpd"),
ZYDIS_MAKE_SHORTSTRING("vsqrtph"),
ZYDIS_MAKE_SHORTSTRING("vsqrtps"),
@ -1716,6 +1752,8 @@ static const ZydisShortString STR_MNEMONIC[] =
ZYDIS_MAKE_SHORTSTRING("wrfsbase"),
ZYDIS_MAKE_SHORTSTRING("wrgsbase"),
ZYDIS_MAKE_SHORTSTRING("wrmsr"),
ZYDIS_MAKE_SHORTSTRING("wrmsrlist"),
ZYDIS_MAKE_SHORTSTRING("wrmsrns"),
ZYDIS_MAKE_SHORTSTRING("wrpkru"),
ZYDIS_MAKE_SHORTSTRING("wrssd"),
ZYDIS_MAKE_SHORTSTRING("wrssq"),

View File

@ -1,7 +1,6 @@
static const ZydisShortString STR_REGISTER[] =
static const ZydisShortString STR_REGISTERS[] =
{
ZYDIS_MAKE_SHORTSTRING("none"),
// General purpose registers 8-bit
ZYDIS_MAKE_SHORTSTRING("al"),
ZYDIS_MAKE_SHORTSTRING("cl"),

View File

@ -0,0 +1,58 @@
const ZydisEncoderRelInfo *ZydisGetRelInfo(ZydisMnemonic mnemonic)
{
static const ZydisEncoderRelInfo info_lookup[9] =
{
{ { { 0, 3, 6 }, { 0, 4, 5 }, { 0, 0, 5 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE, ZYAN_TRUE },
{ { { 2, 4, 7 }, { 2, 5, 6 }, { 2, 0, 6 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_TRUE, ZYAN_TRUE },
{ { { 2, 0, 0 }, { 3, 0, 0 }, { 0, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE, ZYAN_FALSE },
{ { { 3, 0, 0 }, { 2, 0, 0 }, { 3, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE, ZYAN_FALSE },
{ { { 0, 0, 0 }, { 0, 0, 0 }, { 5, 0, 7 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE, ZYAN_FALSE },
{ { { 2, 3, 6 }, { 2, 4, 5 }, { 2, 0, 5 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE, ZYAN_TRUE },
{ { { 0, 0, 0 }, { 0, 0, 0 }, { 2, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE, ZYAN_FALSE },
{ { { 2, 0, 0 }, { 2, 0, 0 }, { 2, 0, 0 } }, ZYDIS_SIZE_HINT_ASZ, ZYAN_FALSE, ZYAN_FALSE },
{ { { 0, 4, 7 }, { 0, 5, 6 }, { 0, 5, 6 } }, ZYDIS_SIZE_HINT_OSZ, ZYAN_FALSE, ZYAN_FALSE },
};
switch (mnemonic)
{
case ZYDIS_MNEMONIC_CALL:
return &info_lookup[0];
case ZYDIS_MNEMONIC_JB:
case ZYDIS_MNEMONIC_JBE:
case ZYDIS_MNEMONIC_JL:
case ZYDIS_MNEMONIC_JLE:
case ZYDIS_MNEMONIC_JNB:
case ZYDIS_MNEMONIC_JNBE:
case ZYDIS_MNEMONIC_JNL:
case ZYDIS_MNEMONIC_JNLE:
case ZYDIS_MNEMONIC_JNO:
case ZYDIS_MNEMONIC_JNP:
case ZYDIS_MNEMONIC_JNS:
case ZYDIS_MNEMONIC_JNZ:
case ZYDIS_MNEMONIC_JO:
case ZYDIS_MNEMONIC_JP:
case ZYDIS_MNEMONIC_JS:
case ZYDIS_MNEMONIC_JZ:
return &info_lookup[1];
case ZYDIS_MNEMONIC_JCXZ:
return &info_lookup[2];
case ZYDIS_MNEMONIC_JECXZ:
return &info_lookup[3];
case ZYDIS_MNEMONIC_JKNZD:
case ZYDIS_MNEMONIC_JKZD:
return &info_lookup[4];
case ZYDIS_MNEMONIC_JMP:
return &info_lookup[5];
case ZYDIS_MNEMONIC_JRCXZ:
return &info_lookup[6];
case ZYDIS_MNEMONIC_LOOP:
case ZYDIS_MNEMONIC_LOOPE:
case ZYDIS_MNEMONIC_LOOPNE:
return &info_lookup[7];
case ZYDIS_MNEMONIC_XBEGIN:
return &info_lookup[8];
default:
return ZYAN_NULL;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@ static const ZydisInstructionEncodingInfo INSTR_ENCODINGS[] =
{ ZYDIS_INSTR_ENC_FLAG_HAS_DISP, { { 16, 32, 64 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 64 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 64 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 32, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
static const ZydisRegisterClassLookupItem REG_CLASS_LOOKUP[] =
{
/* INVALID */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
/* GPR8 */ { ZYDIS_REGISTER_AL, ZYDIS_REGISTER_R15B, 8, 8 },
/* GPR16 */ { ZYDIS_REGISTER_AX, ZYDIS_REGISTER_R15W, 16, 16 },
/* GPR32 */ { ZYDIS_REGISTER_EAX, ZYDIS_REGISTER_R15D, 32, 32 },
/* GPR64 */ { ZYDIS_REGISTER_RAX, ZYDIS_REGISTER_R15, 0, 64 },
/* X87 */ { ZYDIS_REGISTER_ST0, ZYDIS_REGISTER_ST7, 80, 80 },
/* MMX */ { ZYDIS_REGISTER_MM0, ZYDIS_REGISTER_MM7, 64, 64 },
/* XMM */ { ZYDIS_REGISTER_XMM0, ZYDIS_REGISTER_XMM31, 128, 128 },
/* YMM */ { ZYDIS_REGISTER_YMM0, ZYDIS_REGISTER_YMM31, 256, 256 },
/* ZMM */ { ZYDIS_REGISTER_ZMM0, ZYDIS_REGISTER_ZMM31, 512, 512 },
/* TMM */ { ZYDIS_REGISTER_TMM0, ZYDIS_REGISTER_TMM7, 8192, 8192 },
/* FLAGS */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
/* IP */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
/* SEGMENT */ { ZYDIS_REGISTER_ES, ZYDIS_REGISTER_GS, 16, 16 },
/* TABLE */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
/* TEST */ { ZYDIS_REGISTER_TR0, ZYDIS_REGISTER_TR7, 32, 32 },
/* CONTROL */ { ZYDIS_REGISTER_CR0, ZYDIS_REGISTER_CR15, 32, 64 },
/* DEBUG */ { ZYDIS_REGISTER_DR0, ZYDIS_REGISTER_DR15, 32, 64 },
/* MASK */ { ZYDIS_REGISTER_K0, ZYDIS_REGISTER_K7, 64, 64 },
/* BOUND */ { ZYDIS_REGISTER_BND0, ZYDIS_REGISTER_BND3, 128, 128 }
};

View File

@ -0,0 +1,269 @@
static const ZydisRegisterLookupItem REG_LOOKUP[] =
{
/* NONE */ { ZYDIS_REGCLASS_INVALID, -1, 0, 0 },
/* AL */ { ZYDIS_REGCLASS_GPR8, 0, 8, 8 },
/* CL */ { ZYDIS_REGCLASS_GPR8, 1, 8, 8 },
/* DL */ { ZYDIS_REGCLASS_GPR8, 2, 8, 8 },
/* BL */ { ZYDIS_REGCLASS_GPR8, 3, 8, 8 },
/* AH */ { ZYDIS_REGCLASS_GPR8, 4, 8, 8 },
/* CH */ { ZYDIS_REGCLASS_GPR8, 5, 8, 8 },
/* DH */ { ZYDIS_REGCLASS_GPR8, 6, 8, 8 },
/* BH */ { ZYDIS_REGCLASS_GPR8, 7, 8, 8 },
/* SPL */ { ZYDIS_REGCLASS_GPR8, 8, 8, 8 },
/* BPL */ { ZYDIS_REGCLASS_GPR8, 9, 8, 8 },
/* SIL */ { ZYDIS_REGCLASS_GPR8, 10, 8, 8 },
/* DIL */ { ZYDIS_REGCLASS_GPR8, 11, 8, 8 },
/* R8B */ { ZYDIS_REGCLASS_GPR8, 12, 8, 8 },
/* R9B */ { ZYDIS_REGCLASS_GPR8, 13, 8, 8 },
/* R10B */ { ZYDIS_REGCLASS_GPR8, 14, 8, 8 },
/* R11B */ { ZYDIS_REGCLASS_GPR8, 15, 8, 8 },
/* R12B */ { ZYDIS_REGCLASS_GPR8, 16, 8, 8 },
/* R13B */ { ZYDIS_REGCLASS_GPR8, 17, 8, 8 },
/* R14B */ { ZYDIS_REGCLASS_GPR8, 18, 8, 8 },
/* R15B */ { ZYDIS_REGCLASS_GPR8, 19, 8, 8 },
/* AX */ { ZYDIS_REGCLASS_GPR16, 0, 16, 16 },
/* CX */ { ZYDIS_REGCLASS_GPR16, 1, 16, 16 },
/* DX */ { ZYDIS_REGCLASS_GPR16, 2, 16, 16 },
/* BX */ { ZYDIS_REGCLASS_GPR16, 3, 16, 16 },
/* SP */ { ZYDIS_REGCLASS_GPR16, 4, 16, 16 },
/* BP */ { ZYDIS_REGCLASS_GPR16, 5, 16, 16 },
/* SI */ { ZYDIS_REGCLASS_GPR16, 6, 16, 16 },
/* DI */ { ZYDIS_REGCLASS_GPR16, 7, 16, 16 },
/* R8W */ { ZYDIS_REGCLASS_GPR16, 8, 16, 16 },
/* R9W */ { ZYDIS_REGCLASS_GPR16, 9, 16, 16 },
/* R10W */ { ZYDIS_REGCLASS_GPR16, 10, 16, 16 },
/* R11W */ { ZYDIS_REGCLASS_GPR16, 11, 16, 16 },
/* R12W */ { ZYDIS_REGCLASS_GPR16, 12, 16, 16 },
/* R13W */ { ZYDIS_REGCLASS_GPR16, 13, 16, 16 },
/* R14W */ { ZYDIS_REGCLASS_GPR16, 14, 16, 16 },
/* R15W */ { ZYDIS_REGCLASS_GPR16, 15, 16, 16 },
/* EAX */ { ZYDIS_REGCLASS_GPR32, 0, 32, 32 },
/* ECX */ { ZYDIS_REGCLASS_GPR32, 1, 32, 32 },
/* EDX */ { ZYDIS_REGCLASS_GPR32, 2, 32, 32 },
/* EBX */ { ZYDIS_REGCLASS_GPR32, 3, 32, 32 },
/* ESP */ { ZYDIS_REGCLASS_GPR32, 4, 32, 32 },
/* EBP */ { ZYDIS_REGCLASS_GPR32, 5, 32, 32 },
/* ESI */ { ZYDIS_REGCLASS_GPR32, 6, 32, 32 },
/* EDI */ { ZYDIS_REGCLASS_GPR32, 7, 32, 32 },
/* R8D */ { ZYDIS_REGCLASS_GPR32, 8, 32, 32 },
/* R9D */ { ZYDIS_REGCLASS_GPR32, 9, 32, 32 },
/* R10D */ { ZYDIS_REGCLASS_GPR32, 10, 32, 32 },
/* R11D */ { ZYDIS_REGCLASS_GPR32, 11, 32, 32 },
/* R12D */ { ZYDIS_REGCLASS_GPR32, 12, 32, 32 },
/* R13D */ { ZYDIS_REGCLASS_GPR32, 13, 32, 32 },
/* R14D */ { ZYDIS_REGCLASS_GPR32, 14, 32, 32 },
/* R15D */ { ZYDIS_REGCLASS_GPR32, 15, 32, 32 },
/* RAX */ { ZYDIS_REGCLASS_GPR64, 0, 0, 64 },
/* RCX */ { ZYDIS_REGCLASS_GPR64, 1, 0, 64 },
/* RDX */ { ZYDIS_REGCLASS_GPR64, 2, 0, 64 },
/* RBX */ { ZYDIS_REGCLASS_GPR64, 3, 0, 64 },
/* RSP */ { ZYDIS_REGCLASS_GPR64, 4, 0, 64 },
/* RBP */ { ZYDIS_REGCLASS_GPR64, 5, 0, 64 },
/* RSI */ { ZYDIS_REGCLASS_GPR64, 6, 0, 64 },
/* RDI */ { ZYDIS_REGCLASS_GPR64, 7, 0, 64 },
/* R8 */ { ZYDIS_REGCLASS_GPR64, 8, 0, 64 },
/* R9 */ { ZYDIS_REGCLASS_GPR64, 9, 0, 64 },
/* R10 */ { ZYDIS_REGCLASS_GPR64, 10, 0, 64 },
/* R11 */ { ZYDIS_REGCLASS_GPR64, 11, 0, 64 },
/* R12 */ { ZYDIS_REGCLASS_GPR64, 12, 0, 64 },
/* R13 */ { ZYDIS_REGCLASS_GPR64, 13, 0, 64 },
/* R14 */ { ZYDIS_REGCLASS_GPR64, 14, 0, 64 },
/* R15 */ { ZYDIS_REGCLASS_GPR64, 15, 0, 64 },
/* ST0 */ { ZYDIS_REGCLASS_X87, 0, 80, 80 },
/* ST1 */ { ZYDIS_REGCLASS_X87, 1, 80, 80 },
/* ST2 */ { ZYDIS_REGCLASS_X87, 2, 80, 80 },
/* ST3 */ { ZYDIS_REGCLASS_X87, 3, 80, 80 },
/* ST4 */ { ZYDIS_REGCLASS_X87, 4, 80, 80 },
/* ST5 */ { ZYDIS_REGCLASS_X87, 5, 80, 80 },
/* ST6 */ { ZYDIS_REGCLASS_X87, 6, 80, 80 },
/* ST7 */ { ZYDIS_REGCLASS_X87, 7, 80, 80 },
/* X87CONTROL */ { ZYDIS_REGCLASS_INVALID, -1, 16, 16 },
/* X87STATUS */ { ZYDIS_REGCLASS_INVALID, -1, 16, 16 },
/* X87TAG */ { ZYDIS_REGCLASS_INVALID, -1, 16, 16 },
/* MM0 */ { ZYDIS_REGCLASS_MMX, 0, 64, 64 },
/* MM1 */ { ZYDIS_REGCLASS_MMX, 1, 64, 64 },
/* MM2 */ { ZYDIS_REGCLASS_MMX, 2, 64, 64 },
/* MM3 */ { ZYDIS_REGCLASS_MMX, 3, 64, 64 },
/* MM4 */ { ZYDIS_REGCLASS_MMX, 4, 64, 64 },
/* MM5 */ { ZYDIS_REGCLASS_MMX, 5, 64, 64 },
/* MM6 */ { ZYDIS_REGCLASS_MMX, 6, 64, 64 },
/* MM7 */ { ZYDIS_REGCLASS_MMX, 7, 64, 64 },
/* XMM0 */ { ZYDIS_REGCLASS_XMM, 0, 128, 128 },
/* XMM1 */ { ZYDIS_REGCLASS_XMM, 1, 128, 128 },
/* XMM2 */ { ZYDIS_REGCLASS_XMM, 2, 128, 128 },
/* XMM3 */ { ZYDIS_REGCLASS_XMM, 3, 128, 128 },
/* XMM4 */ { ZYDIS_REGCLASS_XMM, 4, 128, 128 },
/* XMM5 */ { ZYDIS_REGCLASS_XMM, 5, 128, 128 },
/* XMM6 */ { ZYDIS_REGCLASS_XMM, 6, 128, 128 },
/* XMM7 */ { ZYDIS_REGCLASS_XMM, 7, 128, 128 },
/* XMM8 */ { ZYDIS_REGCLASS_XMM, 8, 128, 128 },
/* XMM9 */ { ZYDIS_REGCLASS_XMM, 9, 128, 128 },
/* XMM10 */ { ZYDIS_REGCLASS_XMM, 10, 128, 128 },
/* XMM11 */ { ZYDIS_REGCLASS_XMM, 11, 128, 128 },
/* XMM12 */ { ZYDIS_REGCLASS_XMM, 12, 128, 128 },
/* XMM13 */ { ZYDIS_REGCLASS_XMM, 13, 128, 128 },
/* XMM14 */ { ZYDIS_REGCLASS_XMM, 14, 128, 128 },
/* XMM15 */ { ZYDIS_REGCLASS_XMM, 15, 128, 128 },
/* XMM16 */ { ZYDIS_REGCLASS_XMM, 16, 128, 128 },
/* XMM17 */ { ZYDIS_REGCLASS_XMM, 17, 128, 128 },
/* XMM18 */ { ZYDIS_REGCLASS_XMM, 18, 128, 128 },
/* XMM19 */ { ZYDIS_REGCLASS_XMM, 19, 128, 128 },
/* XMM20 */ { ZYDIS_REGCLASS_XMM, 20, 128, 128 },
/* XMM21 */ { ZYDIS_REGCLASS_XMM, 21, 128, 128 },
/* XMM22 */ { ZYDIS_REGCLASS_XMM, 22, 128, 128 },
/* XMM23 */ { ZYDIS_REGCLASS_XMM, 23, 128, 128 },
/* XMM24 */ { ZYDIS_REGCLASS_XMM, 24, 128, 128 },
/* XMM25 */ { ZYDIS_REGCLASS_XMM, 25, 128, 128 },
/* XMM26 */ { ZYDIS_REGCLASS_XMM, 26, 128, 128 },
/* XMM27 */ { ZYDIS_REGCLASS_XMM, 27, 128, 128 },
/* XMM28 */ { ZYDIS_REGCLASS_XMM, 28, 128, 128 },
/* XMM29 */ { ZYDIS_REGCLASS_XMM, 29, 128, 128 },
/* XMM30 */ { ZYDIS_REGCLASS_XMM, 30, 128, 128 },
/* XMM31 */ { ZYDIS_REGCLASS_XMM, 31, 128, 128 },
/* YMM0 */ { ZYDIS_REGCLASS_YMM, 0, 256, 256 },
/* YMM1 */ { ZYDIS_REGCLASS_YMM, 1, 256, 256 },
/* YMM2 */ { ZYDIS_REGCLASS_YMM, 2, 256, 256 },
/* YMM3 */ { ZYDIS_REGCLASS_YMM, 3, 256, 256 },
/* YMM4 */ { ZYDIS_REGCLASS_YMM, 4, 256, 256 },
/* YMM5 */ { ZYDIS_REGCLASS_YMM, 5, 256, 256 },
/* YMM6 */ { ZYDIS_REGCLASS_YMM, 6, 256, 256 },
/* YMM7 */ { ZYDIS_REGCLASS_YMM, 7, 256, 256 },
/* YMM8 */ { ZYDIS_REGCLASS_YMM, 8, 256, 256 },
/* YMM9 */ { ZYDIS_REGCLASS_YMM, 9, 256, 256 },
/* YMM10 */ { ZYDIS_REGCLASS_YMM, 10, 256, 256 },
/* YMM11 */ { ZYDIS_REGCLASS_YMM, 11, 256, 256 },
/* YMM12 */ { ZYDIS_REGCLASS_YMM, 12, 256, 256 },
/* YMM13 */ { ZYDIS_REGCLASS_YMM, 13, 256, 256 },
/* YMM14 */ { ZYDIS_REGCLASS_YMM, 14, 256, 256 },
/* YMM15 */ { ZYDIS_REGCLASS_YMM, 15, 256, 256 },
/* YMM16 */ { ZYDIS_REGCLASS_YMM, 16, 256, 256 },
/* YMM17 */ { ZYDIS_REGCLASS_YMM, 17, 256, 256 },
/* YMM18 */ { ZYDIS_REGCLASS_YMM, 18, 256, 256 },
/* YMM19 */ { ZYDIS_REGCLASS_YMM, 19, 256, 256 },
/* YMM20 */ { ZYDIS_REGCLASS_YMM, 20, 256, 256 },
/* YMM21 */ { ZYDIS_REGCLASS_YMM, 21, 256, 256 },
/* YMM22 */ { ZYDIS_REGCLASS_YMM, 22, 256, 256 },
/* YMM23 */ { ZYDIS_REGCLASS_YMM, 23, 256, 256 },
/* YMM24 */ { ZYDIS_REGCLASS_YMM, 24, 256, 256 },
/* YMM25 */ { ZYDIS_REGCLASS_YMM, 25, 256, 256 },
/* YMM26 */ { ZYDIS_REGCLASS_YMM, 26, 256, 256 },
/* YMM27 */ { ZYDIS_REGCLASS_YMM, 27, 256, 256 },
/* YMM28 */ { ZYDIS_REGCLASS_YMM, 28, 256, 256 },
/* YMM29 */ { ZYDIS_REGCLASS_YMM, 29, 256, 256 },
/* YMM30 */ { ZYDIS_REGCLASS_YMM, 30, 256, 256 },
/* YMM31 */ { ZYDIS_REGCLASS_YMM, 31, 256, 256 },
/* ZMM0 */ { ZYDIS_REGCLASS_ZMM, 0, 512, 512 },
/* ZMM1 */ { ZYDIS_REGCLASS_ZMM, 1, 512, 512 },
/* ZMM2 */ { ZYDIS_REGCLASS_ZMM, 2, 512, 512 },
/* ZMM3 */ { ZYDIS_REGCLASS_ZMM, 3, 512, 512 },
/* ZMM4 */ { ZYDIS_REGCLASS_ZMM, 4, 512, 512 },
/* ZMM5 */ { ZYDIS_REGCLASS_ZMM, 5, 512, 512 },
/* ZMM6 */ { ZYDIS_REGCLASS_ZMM, 6, 512, 512 },
/* ZMM7 */ { ZYDIS_REGCLASS_ZMM, 7, 512, 512 },
/* ZMM8 */ { ZYDIS_REGCLASS_ZMM, 8, 512, 512 },
/* ZMM9 */ { ZYDIS_REGCLASS_ZMM, 9, 512, 512 },
/* ZMM10 */ { ZYDIS_REGCLASS_ZMM, 10, 512, 512 },
/* ZMM11 */ { ZYDIS_REGCLASS_ZMM, 11, 512, 512 },
/* ZMM12 */ { ZYDIS_REGCLASS_ZMM, 12, 512, 512 },
/* ZMM13 */ { ZYDIS_REGCLASS_ZMM, 13, 512, 512 },
/* ZMM14 */ { ZYDIS_REGCLASS_ZMM, 14, 512, 512 },
/* ZMM15 */ { ZYDIS_REGCLASS_ZMM, 15, 512, 512 },
/* ZMM16 */ { ZYDIS_REGCLASS_ZMM, 16, 512, 512 },
/* ZMM17 */ { ZYDIS_REGCLASS_ZMM, 17, 512, 512 },
/* ZMM18 */ { ZYDIS_REGCLASS_ZMM, 18, 512, 512 },
/* ZMM19 */ { ZYDIS_REGCLASS_ZMM, 19, 512, 512 },
/* ZMM20 */ { ZYDIS_REGCLASS_ZMM, 20, 512, 512 },
/* ZMM21 */ { ZYDIS_REGCLASS_ZMM, 21, 512, 512 },
/* ZMM22 */ { ZYDIS_REGCLASS_ZMM, 22, 512, 512 },
/* ZMM23 */ { ZYDIS_REGCLASS_ZMM, 23, 512, 512 },
/* ZMM24 */ { ZYDIS_REGCLASS_ZMM, 24, 512, 512 },
/* ZMM25 */ { ZYDIS_REGCLASS_ZMM, 25, 512, 512 },
/* ZMM26 */ { ZYDIS_REGCLASS_ZMM, 26, 512, 512 },
/* ZMM27 */ { ZYDIS_REGCLASS_ZMM, 27, 512, 512 },
/* ZMM28 */ { ZYDIS_REGCLASS_ZMM, 28, 512, 512 },
/* ZMM29 */ { ZYDIS_REGCLASS_ZMM, 29, 512, 512 },
/* ZMM30 */ { ZYDIS_REGCLASS_ZMM, 30, 512, 512 },
/* ZMM31 */ { ZYDIS_REGCLASS_ZMM, 31, 512, 512 },
/* TMM0 */ { ZYDIS_REGCLASS_TMM, 0, 8192, 8192 },
/* TMM1 */ { ZYDIS_REGCLASS_TMM, 1, 8192, 8192 },
/* TMM2 */ { ZYDIS_REGCLASS_TMM, 2, 8192, 8192 },
/* TMM3 */ { ZYDIS_REGCLASS_TMM, 3, 8192, 8192 },
/* TMM4 */ { ZYDIS_REGCLASS_TMM, 4, 8192, 8192 },
/* TMM5 */ { ZYDIS_REGCLASS_TMM, 5, 8192, 8192 },
/* TMM6 */ { ZYDIS_REGCLASS_TMM, 6, 8192, 8192 },
/* TMM7 */ { ZYDIS_REGCLASS_TMM, 7, 8192, 8192 },
/* FLAGS */ { ZYDIS_REGCLASS_FLAGS, -1, 16, 16 },
/* EFLAGS */ { ZYDIS_REGCLASS_FLAGS, -1, 32, 32 },
/* RFLAGS */ { ZYDIS_REGCLASS_FLAGS, -1, 0, 64 },
/* IP */ { ZYDIS_REGCLASS_IP, -1, 16, 16 },
/* EIP */ { ZYDIS_REGCLASS_IP, -1, 32, 32 },
/* RIP */ { ZYDIS_REGCLASS_IP, -1, 0, 64 },
/* ES */ { ZYDIS_REGCLASS_SEGMENT, 0, 16, 16 },
/* CS */ { ZYDIS_REGCLASS_SEGMENT, 1, 16, 16 },
/* SS */ { ZYDIS_REGCLASS_SEGMENT, 2, 16, 16 },
/* DS */ { ZYDIS_REGCLASS_SEGMENT, 3, 16, 16 },
/* FS */ { ZYDIS_REGCLASS_SEGMENT, 4, 16, 16 },
/* GS */ { ZYDIS_REGCLASS_SEGMENT, 5, 16, 16 },
/* GDTR */ { ZYDIS_REGCLASS_TABLE, -1, 0, 0 },
/* LDTR */ { ZYDIS_REGCLASS_TABLE, -1, 0, 0 },
/* IDTR */ { ZYDIS_REGCLASS_TABLE, -1, 0, 0 },
/* TR */ { ZYDIS_REGCLASS_TABLE, -1, 0, 0 },
/* TR0 */ { ZYDIS_REGCLASS_TEST, 0, 32, 32 },
/* TR1 */ { ZYDIS_REGCLASS_TEST, 1, 32, 32 },
/* TR2 */ { ZYDIS_REGCLASS_TEST, 2, 32, 32 },
/* TR3 */ { ZYDIS_REGCLASS_TEST, 3, 32, 32 },
/* TR4 */ { ZYDIS_REGCLASS_TEST, 4, 32, 32 },
/* TR5 */ { ZYDIS_REGCLASS_TEST, 5, 32, 32 },
/* TR6 */ { ZYDIS_REGCLASS_TEST, 6, 32, 32 },
/* TR7 */ { ZYDIS_REGCLASS_TEST, 7, 32, 32 },
/* CR0 */ { ZYDIS_REGCLASS_CONTROL, 0, 32, 64 },
/* CR1 */ { ZYDIS_REGCLASS_CONTROL, 1, 32, 64 },
/* CR2 */ { ZYDIS_REGCLASS_CONTROL, 2, 32, 64 },
/* CR3 */ { ZYDIS_REGCLASS_CONTROL, 3, 32, 64 },
/* CR4 */ { ZYDIS_REGCLASS_CONTROL, 4, 32, 64 },
/* CR5 */ { ZYDIS_REGCLASS_CONTROL, 5, 32, 64 },
/* CR6 */ { ZYDIS_REGCLASS_CONTROL, 6, 32, 64 },
/* CR7 */ { ZYDIS_REGCLASS_CONTROL, 7, 32, 64 },
/* CR8 */ { ZYDIS_REGCLASS_CONTROL, 8, 32, 64 },
/* CR9 */ { ZYDIS_REGCLASS_CONTROL, 9, 32, 64 },
/* CR10 */ { ZYDIS_REGCLASS_CONTROL, 10, 32, 64 },
/* CR11 */ { ZYDIS_REGCLASS_CONTROL, 11, 32, 64 },
/* CR12 */ { ZYDIS_REGCLASS_CONTROL, 12, 32, 64 },
/* CR13 */ { ZYDIS_REGCLASS_CONTROL, 13, 32, 64 },
/* CR14 */ { ZYDIS_REGCLASS_CONTROL, 14, 32, 64 },
/* CR15 */ { ZYDIS_REGCLASS_CONTROL, 15, 32, 64 },
/* DR0 */ { ZYDIS_REGCLASS_DEBUG, 0, 32, 64 },
/* DR1 */ { ZYDIS_REGCLASS_DEBUG, 1, 32, 64 },
/* DR2 */ { ZYDIS_REGCLASS_DEBUG, 2, 32, 64 },
/* DR3 */ { ZYDIS_REGCLASS_DEBUG, 3, 32, 64 },
/* DR4 */ { ZYDIS_REGCLASS_DEBUG, 4, 32, 64 },
/* DR5 */ { ZYDIS_REGCLASS_DEBUG, 5, 32, 64 },
/* DR6 */ { ZYDIS_REGCLASS_DEBUG, 6, 32, 64 },
/* DR7 */ { ZYDIS_REGCLASS_DEBUG, 7, 32, 64 },
/* DR8 */ { ZYDIS_REGCLASS_DEBUG, 8, 32, 64 },
/* DR9 */ { ZYDIS_REGCLASS_DEBUG, 9, 32, 64 },
/* DR10 */ { ZYDIS_REGCLASS_DEBUG, 10, 32, 64 },
/* DR11 */ { ZYDIS_REGCLASS_DEBUG, 11, 32, 64 },
/* DR12 */ { ZYDIS_REGCLASS_DEBUG, 12, 32, 64 },
/* DR13 */ { ZYDIS_REGCLASS_DEBUG, 13, 32, 64 },
/* DR14 */ { ZYDIS_REGCLASS_DEBUG, 14, 32, 64 },
/* DR15 */ { ZYDIS_REGCLASS_DEBUG, 15, 32, 64 },
/* K0 */ { ZYDIS_REGCLASS_MASK, 0, 64, 64 },
/* K1 */ { ZYDIS_REGCLASS_MASK, 1, 64, 64 },
/* K2 */ { ZYDIS_REGCLASS_MASK, 2, 64, 64 },
/* K3 */ { ZYDIS_REGCLASS_MASK, 3, 64, 64 },
/* K4 */ { ZYDIS_REGCLASS_MASK, 4, 64, 64 },
/* K5 */ { ZYDIS_REGCLASS_MASK, 5, 64, 64 },
/* K6 */ { ZYDIS_REGCLASS_MASK, 6, 64, 64 },
/* K7 */ { ZYDIS_REGCLASS_MASK, 7, 64, 64 },
/* BND0 */ { ZYDIS_REGCLASS_BOUND, 0, 128, 128 },
/* BND1 */ { ZYDIS_REGCLASS_BOUND, 1, 128, 128 },
/* BND2 */ { ZYDIS_REGCLASS_BOUND, 2, 128, 128 },
/* BND3 */ { ZYDIS_REGCLASS_BOUND, 3, 128, 128 },
/* BNDCFG */ { ZYDIS_REGCLASS_INVALID, -1, 64, 64 },
/* BNDSTATUS */ { ZYDIS_REGCLASS_INVALID, -1, 64, 64 },
/* MXCSR */ { ZYDIS_REGCLASS_INVALID, -1, 32, 32 },
/* PKRU */ { ZYDIS_REGCLASS_INVALID, -1, 32, 32 },
/* XCR0 */ { ZYDIS_REGCLASS_INVALID, -1, 64, 64 },
/* UIF */ { ZYDIS_REGCLASS_INVALID, -1, 1, 1 }
};

View File

@ -25,6 +25,7 @@
***************************************************************************************************/
#include <Zydis/MetaInfo.h>
#include <Zycore/Types.h>
/* ============================================================================================== */
/* Enum strings */

View File

@ -39,12 +39,33 @@
/**
* Defines the `ZydisRegisterMapItem` struct.
*/
typedef struct ZydisRegisterMapItem_
typedef struct ZydisRegisterLookupItem
{
/**
* The register class.
*/
ZydisRegisterClass class;
/**
* The register id.
*/
ZyanI8 id;
/**
* The width of register 16- and 32-bit mode.
*/
ZydisRegisterWidth width;
/**
* The width of register in 64-bit mode.
*/
ZydisRegisterWidth width64;
} ZydisRegisterLookupItem;
#include <Generated/RegisterLookup.inc>
/**
* Defines the `ZydisRegisterClassLookupItem` struct.
*/
typedef struct ZydisRegisterClassLookupItem_
{
/**
* The lowest register of the current class.
*/
@ -61,33 +82,9 @@ typedef struct ZydisRegisterMapItem_
* The width of registers of the current class in 64-bit mode.
*/
ZydisRegisterWidth width64;
} ZydisRegisterMapItem;
} ZydisRegisterClassLookupItem;
/**
* Provides register to register-class and register-class + id to register mappings.
*/
static const ZydisRegisterMapItem REGISTER_MAP[] =
{
{ ZYDIS_REGCLASS_INVALID , ZYDIS_REGISTER_NONE , ZYDIS_REGISTER_NONE , 0 , 0 },
{ ZYDIS_REGCLASS_GPR8 , ZYDIS_REGISTER_AL , ZYDIS_REGISTER_R15B , 8 , 8 },
{ ZYDIS_REGCLASS_GPR16 , ZYDIS_REGISTER_AX , ZYDIS_REGISTER_R15W , 16 , 16 },
{ ZYDIS_REGCLASS_GPR32 , ZYDIS_REGISTER_EAX , ZYDIS_REGISTER_R15D , 32 , 32 },
{ ZYDIS_REGCLASS_GPR64 , ZYDIS_REGISTER_RAX , ZYDIS_REGISTER_R15 , 0 , 64 },
{ ZYDIS_REGCLASS_X87 , ZYDIS_REGISTER_ST0 , ZYDIS_REGISTER_ST7 , 80 , 80 },
{ ZYDIS_REGCLASS_MMX , ZYDIS_REGISTER_MM0 , ZYDIS_REGISTER_MM7 , 64 , 64 },
{ ZYDIS_REGCLASS_XMM , ZYDIS_REGISTER_XMM0 , ZYDIS_REGISTER_XMM31 , 128 , 128 },
{ ZYDIS_REGCLASS_YMM , ZYDIS_REGISTER_YMM0 , ZYDIS_REGISTER_YMM31 , 256 , 256 },
{ ZYDIS_REGCLASS_ZMM , ZYDIS_REGISTER_ZMM0 , ZYDIS_REGISTER_ZMM31 , 512 , 512 },
{ ZYDIS_REGCLASS_TMM , ZYDIS_REGISTER_TMM0 , ZYDIS_REGISTER_TMM7 , 8192 , 8192 },
{ ZYDIS_REGCLASS_FLAGS , ZYDIS_REGISTER_FLAGS , ZYDIS_REGISTER_RFLAGS , 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_TEST , ZYDIS_REGISTER_TR0 , ZYDIS_REGISTER_TR7 , 32 , 32 },
{ ZYDIS_REGCLASS_CONTROL , ZYDIS_REGISTER_CR0 , ZYDIS_REGISTER_CR15 , 32 , 64 },
{ ZYDIS_REGCLASS_DEBUG , ZYDIS_REGISTER_DR0 , ZYDIS_REGISTER_DR15 , 32 , 64 },
{ ZYDIS_REGCLASS_MASK , ZYDIS_REGISTER_K0 , ZYDIS_REGISTER_K7 , 0 , 0 },
{ ZYDIS_REGCLASS_BOUND , ZYDIS_REGISTER_BND0 , ZYDIS_REGISTER_BND3 , 128 , 128 }
};
#include <Generated/RegisterClassLookup.inc>
/* ============================================================================================== */
/* Exported functions */
@ -99,98 +96,112 @@ static const ZydisRegisterMapItem REGISTER_MAP[] =
ZydisRegister ZydisRegisterEncode(ZydisRegisterClass register_class, ZyanU8 id)
{
switch (register_class)
if ((register_class == ZYDIS_REGCLASS_INVALID) ||
(register_class == ZYDIS_REGCLASS_FLAGS) ||
(register_class == ZYDIS_REGCLASS_IP))
{
case ZYDIS_REGCLASS_INVALID:
case ZYDIS_REGCLASS_FLAGS:
case ZYDIS_REGCLASS_IP:
break;
default:
if (((ZyanUSize)register_class < ZYAN_ARRAY_LENGTH(REGISTER_MAP)) &&
(id <= (REGISTER_MAP[register_class].hi - REGISTER_MAP[register_class].lo)))
return ZYDIS_REGISTER_NONE;
}
if ((ZyanUSize)register_class >= ZYAN_ARRAY_LENGTH(REG_CLASS_LOOKUP))
{
return REGISTER_MAP[register_class].lo + id;
return ZYDIS_REGISTER_NONE;
}
const ZydisRegisterClassLookupItem* item = &REG_CLASS_LOOKUP[register_class];
if (id <= (item->hi - item->lo))
{
return item->lo + id;
}
return ZYDIS_REGISTER_NONE;
}
ZyanI8 ZydisRegisterGetId(ZydisRegister reg)
{
for (ZyanUSize i = 0; i < ZYAN_ARRAY_LENGTH(REGISTER_MAP); ++i)
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(REG_LOOKUP))
{
switch (REGISTER_MAP[i].class)
{
case ZYDIS_REGCLASS_INVALID:
case ZYDIS_REGCLASS_FLAGS:
case ZYDIS_REGCLASS_IP:
break;
default:
if ((reg >= REGISTER_MAP[i].lo) && (reg <= REGISTER_MAP[i].hi))
{
return (ZyanU8)(reg - REGISTER_MAP[i].lo);
}
}
}
return -1;
}
return REG_LOOKUP[reg].id;
}
ZydisRegisterClass ZydisRegisterGetClass(ZydisRegister reg)
{
for (ZyanUSize i = 0; i < ZYAN_ARRAY_LENGTH(REGISTER_MAP); ++i)
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(REG_LOOKUP))
{
if ((reg >= REGISTER_MAP[i].lo) && (reg <= REGISTER_MAP[i].hi))
{
return REGISTER_MAP[i].class;
}
}
return ZYDIS_REGCLASS_INVALID;
}
return REG_LOOKUP[reg].class;
}
ZydisRegisterWidth ZydisRegisterGetWidth(ZydisMachineMode mode, ZydisRegister reg)
{
// Special cases
switch (reg)
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(REG_LOOKUP))
{
case ZYDIS_REGISTER_X87CONTROL:
case ZYDIS_REGISTER_X87STATUS:
case ZYDIS_REGISTER_X87TAG:
return 16;
case ZYDIS_REGISTER_IP:
case ZYDIS_REGISTER_FLAGS:
return 16;
case ZYDIS_REGISTER_EIP:
case ZYDIS_REGISTER_EFLAGS:
return 32;
case ZYDIS_REGISTER_RIP:
case ZYDIS_REGISTER_RFLAGS:
return (mode == ZYDIS_MACHINE_MODE_LONG_64) ? 64 : 0;
case ZYDIS_REGISTER_BNDCFG:
case ZYDIS_REGISTER_BNDSTATUS:
return 64;
case ZYDIS_REGISTER_XCR0:
return 64;
case ZYDIS_REGISTER_PKRU:
case ZYDIS_REGISTER_MXCSR:
return 32;
default:
break;
return 0;
}
// Register classes
for (ZyanUSize i = 0; i < ZYAN_ARRAY_LENGTH(REGISTER_MAP); ++i)
{
if ((reg >= REGISTER_MAP[i].lo) && (reg <= REGISTER_MAP[i].hi))
{
return (mode == ZYDIS_MACHINE_MODE_LONG_64) ?
REGISTER_MAP[i].width64 : REGISTER_MAP[i].width;
}
}
return 0;
return (mode == ZYDIS_MACHINE_MODE_LONG_64)
? REG_LOOKUP[reg].width64
: REG_LOOKUP[reg].width;
}
ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, ZydisRegister reg)
{
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(REG_LOOKUP))
{
return ZYDIS_REGISTER_NONE;
}
if (mode > ZYDIS_MACHINE_MODE_MAX_VALUE)
{
return ZYDIS_REGISTER_NONE;
}
const ZydisRegisterClass reg_class = REG_LOOKUP[reg].class;
if ((reg_class == ZYDIS_REGCLASS_INVALID) ||
((reg_class == ZYDIS_REGCLASS_GPR64) && (mode != ZYDIS_MACHINE_MODE_LONG_64)))
{
return ZYDIS_REGISTER_NONE;
}
static const ZydisRegister STATIC_MAPPING[ZYDIS_REGCLASS_MAX_VALUE + 1][3] =
{
/* 16 */ /* 32 */ /* 64 */
[ZYDIS_REGCLASS_FLAGS] = { ZYDIS_REGISTER_FLAGS, ZYDIS_REGISTER_EFLAGS, ZYDIS_REGISTER_RFLAGS },
[ZYDIS_REGCLASS_IP ] = { ZYDIS_REGISTER_IP , ZYDIS_REGISTER_EIP , ZYDIS_REGISTER_RIP },
};
ZYAN_ASSERT(reg_class < ZYAN_ARRAY_LENGTH(STATIC_MAPPING));
ZyanU8 mode_bits;
switch (mode)
{
case ZYDIS_MACHINE_MODE_LONG_64:
mode_bits = 2;
break;
case ZYDIS_MACHINE_MODE_LONG_COMPAT_32:
case ZYDIS_MACHINE_MODE_LEGACY_32:
mode_bits = 1;
break;
case ZYDIS_MACHINE_MODE_LONG_COMPAT_16:
case ZYDIS_MACHINE_MODE_LEGACY_16:
case ZYDIS_MACHINE_MODE_REAL_16:
mode_bits = 0;
break;
default:
ZYAN_UNREACHABLE;
}
const ZydisRegister static_reg = STATIC_MAPPING[reg_class][mode_bits];
if (static_reg != ZYDIS_REGISTER_NONE)
{
return static_reg;
}
static const ZyanU8 GPR8_MAPPING[20] =
{
/* AL */ 0,
@ -212,20 +223,10 @@ ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, ZydisRegis
/* R12B */ 12,
/* R13B */ 13,
/* R14B */ 14,
/* R15B */ 15,
/* R15B */ 15
};
for (ZyanUSize i = 0; i < ZYAN_ARRAY_LENGTH(REGISTER_MAP); ++i)
{
if ((reg >= REGISTER_MAP[i].lo) && (reg <= REGISTER_MAP[i].hi))
{
const ZydisRegisterClass reg_class = REGISTER_MAP[i].class;
if ((reg_class == ZYDIS_REGCLASS_GPR64) && (mode != ZYDIS_MACHINE_MODE_LONG_64))
{
return ZYDIS_REGISTER_NONE;
}
ZyanU8 reg_id = (ZyanU8)(reg - REGISTER_MAP[reg_class].lo);
ZyanU8 reg_id = REG_LOOKUP[reg].id;
switch (reg_class)
{
case ZYDIS_REGCLASS_GPR8:
@ -234,53 +235,48 @@ ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, ZydisRegis
case ZYDIS_REGCLASS_GPR16:
case ZYDIS_REGCLASS_GPR32:
case ZYDIS_REGCLASS_GPR64:
switch (mode)
switch (mode_bits)
{
case ZYDIS_MACHINE_MODE_LONG_64:
return REGISTER_MAP[ZYDIS_REGCLASS_GPR64].lo + reg_id;
case ZYDIS_MACHINE_MODE_LONG_COMPAT_32:
case ZYDIS_MACHINE_MODE_LEGACY_32:
return REGISTER_MAP[ZYDIS_REGCLASS_GPR32].lo + reg_id;
case ZYDIS_MACHINE_MODE_LONG_COMPAT_16:
case ZYDIS_MACHINE_MODE_LEGACY_16:
case ZYDIS_MACHINE_MODE_REAL_16:
return REGISTER_MAP[ZYDIS_REGCLASS_GPR16].lo + reg_id;
case 2:
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_GPR64].lo + reg_id;
case 1:
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_GPR32].lo + reg_id;
case 0:
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_GPR16].lo + reg_id;
default:
return ZYDIS_REGISTER_NONE;
ZYAN_UNREACHABLE;
}
case ZYDIS_REGCLASS_XMM:
case ZYDIS_REGCLASS_YMM:
case ZYDIS_REGCLASS_ZMM:
#if defined(ZYDIS_DISABLE_AVX512) && defined(ZYDIS_DISABLE_KNC)
return REGISTER_MAP[ZYDIS_REGCLASS_YMM].lo + reg_id;
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_YMM].lo + reg_id;
#else
return REGISTER_MAP[ZYDIS_REGCLASS_ZMM].lo + reg_id;
return REG_CLASS_LOOKUP[ZYDIS_REGCLASS_ZMM].lo + reg_id;
#endif
default:
return ZYDIS_REGISTER_NONE;
}
}
}
return ZYDIS_REGISTER_NONE;
}
const char* ZydisRegisterGetString(ZydisRegister reg)
{
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(STR_REGISTER))
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(STR_REGISTERS))
{
return ZYAN_NULL;
}
return STR_REGISTER[reg].data;
return STR_REGISTERS[reg].data;
}
const ZydisShortString* ZydisRegisterGetStringWrapped(ZydisRegister reg)
{
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(STR_REGISTER))
if ((ZyanUSize)reg >= ZYAN_ARRAY_LENGTH(STR_REGISTERS))
{
return ZYAN_NULL;
}
return &STR_REGISTER[reg];
return &STR_REGISTERS[reg];
}
/* ---------------------------------------------------------------------------------------------- */
@ -290,14 +286,16 @@ const ZydisShortString* ZydisRegisterGetStringWrapped(ZydisRegister reg)
ZydisRegisterWidth ZydisRegisterClassGetWidth(ZydisMachineMode mode,
ZydisRegisterClass register_class)
{
if ((ZyanUSize)register_class < ZYAN_ARRAY_LENGTH(REGISTER_MAP))
if ((ZyanUSize)register_class >= ZYAN_ARRAY_LENGTH(REG_CLASS_LOOKUP))
{
return (mode == ZYDIS_MACHINE_MODE_LONG_64) ?
REGISTER_MAP[register_class].width64 : REGISTER_MAP[register_class].width;
}
return 0;
}
return (mode == ZYDIS_MACHINE_MODE_LONG_64)
? REG_CLASS_LOOKUP[register_class].width64
: REG_CLASS_LOOKUP[register_class].width;
}
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */

182
3rdparty/zydis/src/Segment.c vendored Normal file
View File

@ -0,0 +1,182 @@
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Florian Bernd
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***************************************************************************************************/
#include <Zycore/LibC.h>
#include <Zydis/Segment.h>
/* ============================================================================================== */
/* Exported functions */
/* ============================================================================================== */
ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* instruction,
ZydisInstructionSegments* segments)
{
if (!instruction || !segments)
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
ZYAN_MEMSET(segments, 0, sizeof(*segments));
// Legacy prefixes and `REX`
if (instruction->raw.prefix_count)
{
const ZyanU8 rex_offset = (instruction->attributes & ZYDIS_ATTRIB_HAS_REX) ? 1 : 0;
if (!rex_offset || (instruction->raw.prefix_count > 1))
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_PREFIXES;
segments->segments[segments->count ].offset = 0;
segments->segments[segments->count++].size =
instruction->raw.prefix_count - rex_offset;
}
if (rex_offset)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_REX;
segments->segments[segments->count ].offset =
instruction->raw.prefix_count - rex_offset;
segments->segments[segments->count++].size = 1;
}
}
// Encoding prefixes
ZydisInstructionSegment segment_type = ZYDIS_INSTR_SEGMENT_NONE;
ZyanU8 segment_offset = 0;
ZyanU8 segment_size = 0;
switch (instruction->encoding)
{
case ZYDIS_INSTRUCTION_ENCODING_XOP:
segment_type = ZYDIS_INSTR_SEGMENT_XOP;
segment_offset = instruction->raw.xop.offset;
segment_size = 3;
break;
case ZYDIS_INSTRUCTION_ENCODING_VEX:
segment_type = ZYDIS_INSTR_SEGMENT_VEX;
segment_offset = instruction->raw.vex.offset;
segment_size = instruction->raw.vex.size;
break;
case ZYDIS_INSTRUCTION_ENCODING_EVEX:
segment_type = ZYDIS_INSTR_SEGMENT_EVEX;
segment_offset = instruction->raw.evex.offset;
segment_size = 4;
break;
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
segment_type = ZYDIS_INSTR_SEGMENT_MVEX;
segment_offset = instruction->raw.mvex.offset;
segment_size = 4;
break;
default:
break;
}
if (segment_type)
{
segments->segments[segments->count ].type = segment_type;
segments->segments[segments->count ].offset = segment_offset;
segments->segments[segments->count++].size = segment_size;
}
// Opcode
segment_size = 1;
if ((instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_LEGACY) ||
(instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_3DNOW))
{
switch (instruction->opcode_map)
{
case ZYDIS_OPCODE_MAP_DEFAULT:
break;
case ZYDIS_OPCODE_MAP_0F:
ZYAN_FALLTHROUGH;
case ZYDIS_OPCODE_MAP_0F0F:
segment_size = 2;
break;
case ZYDIS_OPCODE_MAP_0F38:
ZYAN_FALLTHROUGH;
case ZYDIS_OPCODE_MAP_0F3A:
segment_size = 3;
break;
default:
ZYAN_UNREACHABLE;
}
}
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_OPCODE;
if (segments->count)
{
segments->segments[segments->count].offset =
segments->segments[segments->count - 1].offset +
segments->segments[segments->count - 1].size;
} else
{
segments->segments[segments->count].offset = 0;
}
segments->segments[segments->count++].size = segment_size;
// ModRM
if (instruction->attributes & ZYDIS_ATTRIB_HAS_MODRM)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_MODRM;
segments->segments[segments->count ].offset = instruction->raw.modrm.offset;
segments->segments[segments->count++].size = 1;
}
// SIB
if (instruction->attributes & ZYDIS_ATTRIB_HAS_SIB)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_SIB;
segments->segments[segments->count ].offset = instruction->raw.sib.offset;
segments->segments[segments->count++].size = 1;
}
// Displacement
if (instruction->raw.disp.size)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_DISPLACEMENT;
segments->segments[segments->count ].offset = instruction->raw.disp.offset;
segments->segments[segments->count++].size = instruction->raw.disp.size / 8;
}
// Immediates
for (ZyanU8 i = 0; i < 2; ++i)
{
if (instruction->raw.imm[i].size)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_IMMEDIATE;
segments->segments[segments->count ].offset = instruction->raw.imm[i].offset;
segments->segments[segments->count++].size = instruction->raw.imm[i].size / 8;
}
}
if (instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_3DNOW)
{
segments->segments[segments->count].type = ZYDIS_INSTR_SEGMENT_OPCODE;
segments->segments[segments->count].offset = instruction->length -1;
segments->segments[segments->count++].size = 1;
}
return ZYAN_STATUS_SUCCESS;
}
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */

View File

@ -108,17 +108,15 @@ void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding, ZyanU16 id
/* ---------------------------------------------------------------------------------------------- */
#ifndef ZYDIS_MINIMAL_MODE
ZyanU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
const ZydisOperandDefinition** operand)
const ZydisOperandDefinition* ZydisGetOperandDefinitions(
const ZydisInstructionDefinition* definition)
{
if (definition->operand_count == 0)
{
*operand = ZYAN_NULL;
return 0;
return ZYAN_NULL;
}
ZYAN_ASSERT(definition->operand_reference != 0xFFFF);
*operand = &OPERAND_DEFINITIONS[definition->operand_reference];
return definition->operand_count;
return &OPERAND_DEFINITIONS[definition->operand_reference];
}
#endif
@ -143,26 +141,31 @@ void ZydisGetElementInfo(ZydisInternalElementType element, ZydisElementType* typ
{ ZYDIS_ELEMENT_TYPE_UINT , 0 },
{ ZYDIS_ELEMENT_TYPE_INT , 1 },
{ ZYDIS_ELEMENT_TYPE_INT , 8 },
{ ZYDIS_ELEMENT_TYPE_INT , 32 }, // TODO: Should indicate 4 INT8 elements
{ ZYDIS_ELEMENT_TYPE_INT , 16 },
{ ZYDIS_ELEMENT_TYPE_INT , 32 }, // TODO: Should indicate 2 INT16 elements
{ ZYDIS_ELEMENT_TYPE_INT , 32 },
{ ZYDIS_ELEMENT_TYPE_INT , 64 },
{ ZYDIS_ELEMENT_TYPE_UINT , 8 },
{ ZYDIS_ELEMENT_TYPE_UINT , 32 }, // TODO: Should indicate 4 UINT8 elements
{ ZYDIS_ELEMENT_TYPE_UINT , 16 },
{ ZYDIS_ELEMENT_TYPE_UINT , 32 }, // TODO: Should indicate 2 UINT16 elements
{ ZYDIS_ELEMENT_TYPE_UINT , 32 },
{ ZYDIS_ELEMENT_TYPE_UINT , 64 },
{ ZYDIS_ELEMENT_TYPE_UINT , 128 },
{ ZYDIS_ELEMENT_TYPE_UINT , 256 },
{ ZYDIS_ELEMENT_TYPE_FLOAT16 , 16 },
{ ZYDIS_ELEMENT_TYPE_FLOAT16 , 32 }, // TODO: Should indicate 2 float16 elements
{ ZYDIS_ELEMENT_TYPE_FLOAT16 , 32 }, // TODO: Should indicate 2 FLOAT16 elements
{ ZYDIS_ELEMENT_TYPE_FLOAT32 , 32 },
{ ZYDIS_ELEMENT_TYPE_FLOAT64 , 64 },
{ ZYDIS_ELEMENT_TYPE_BFLOAT16 , 32 }, // TODO: Should indicate 2 BFLOAT16 elements
{ ZYDIS_ELEMENT_TYPE_FLOAT80 , 80 },
{ ZYDIS_ELEMENT_TYPE_LONGBCD , 80 },
{ ZYDIS_ELEMENT_TYPE_CC , 3 },
{ ZYDIS_ELEMENT_TYPE_CC , 5 }
};
ZYAN_ASSERT(element < ZYAN_ARRAY_LENGTH(lookup));
ZYAN_ASSERT((ZyanUSize)element < ZYAN_ARRAY_LENGTH(lookup));
*type = lookup[element].type;
*size = lookup[element].size;
@ -175,7 +178,7 @@ void ZydisGetElementInfo(ZydisInternalElementType element, ZydisElementType* typ
#ifndef ZYDIS_MINIMAL_MODE
ZyanBool ZydisGetAccessedFlags(const ZydisInstructionDefinition* definition,
const ZydisAccessedFlags** flags)
const ZydisDefinitionAccessedFlags** flags)
{
ZYAN_ASSERT(definition->flags_reference < ZYAN_ARRAY_LENGTH(ACCESSED_FLAGS));
*flags = &ACCESSED_FLAGS[definition->flags_reference];

View File

@ -65,8 +65,8 @@ static const char* const DECIMAL_LOOKUP =
/* Decimal */
/* ---------------------------------------------------------------------------------------------- */
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN)
ZyanStatus ZydisStringAppendDecU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length)
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
static ZyanStatus ZydisStringAppendDecU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length)
{
ZYAN_ASSERT(string);
ZYAN_ASSERT(!string->vector.allocator);
@ -110,7 +110,7 @@ ZyanStatus ZydisStringAppendDecU32(ZyanString* string, ZyanU32 value, ZyanU8 pad
}
#endif
ZyanStatus ZydisStringAppendDecU64(ZyanString* string, ZyanU64 value, ZyanU8 padding_length)
static ZyanStatus ZydisStringAppendDecU64(ZyanString* string, ZyanU64 value, ZyanU8 padding_length)
{
ZYAN_ASSERT(string);
ZYAN_ASSERT(!string->vector.allocator);
@ -122,7 +122,7 @@ ZyanStatus ZydisStringAppendDecU64(ZyanString* string, ZyanU64 value, ZyanU8 pad
{
const ZyanU64 value_old = value;
buffer_write_pointer -= 2;
value /= 100;
ZYAN_DIV64(value, 100);
ZYAN_MEMCPY(buffer_write_pointer, &DECIMAL_LOOKUP[(value_old - (value * 100)) * 2], 2);
}
buffer_write_pointer -= 2;
@ -157,9 +157,9 @@ ZyanStatus ZydisStringAppendDecU64(ZyanString* string, ZyanU64 value, ZyanU8 pad
/* Hexadecimal */
/* ---------------------------------------------------------------------------------------------- */
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN)
ZyanStatus ZydisStringAppendHexU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length,
ZyanBool uppercase)
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
static ZyanStatus ZydisStringAppendHexU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length,
ZyanBool force_leading_number, ZyanBool uppercase)
{
ZYAN_ASSERT(string);
ZYAN_ASSERT(!string->vector.allocator);
@ -199,11 +199,16 @@ ZyanStatus ZydisStringAppendHexU32(ZyanString* string, ZyanU32 value, ZyanU8 pad
{
continue;
}
if (remaining <= (ZyanU8)i)
const ZyanU8 zero = force_leading_number && (v > 9) && (padding_length <= i) ? 1 : 0;
if (remaining <= (ZyanUSize)i + zero)
{
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
buffer = (char*)string->vector.data + len - 1;
if (zero)
{
buffer[n++] = '0';
}
if (padding_length > i)
{
n = padding_length - i - 1;
@ -226,8 +231,8 @@ ZyanStatus ZydisStringAppendHexU32(ZyanString* string, ZyanU32 value, ZyanU8 pad
}
#endif
ZyanStatus ZydisStringAppendHexU64(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
ZyanBool uppercase)
static ZyanStatus ZydisStringAppendHexU64(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
ZyanBool force_leading_number, ZyanBool uppercase)
{
ZYAN_ASSERT(string);
ZYAN_ASSERT(!string->vector.allocator);
@ -268,11 +273,16 @@ ZyanStatus ZydisStringAppendHexU64(ZyanString* string, ZyanU64 value, ZyanU8 pad
{
continue;
}
if (remaining <= (ZyanU8)i)
const ZyanU8 zero = force_leading_number && (v > 9) && (padding_length <= i) ? 1 : 0;
if (remaining <= (ZyanUSize)i + zero)
{
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
}
buffer = (char*)string->vector.data + len - 1;
if (zero)
{
buffer[n++] = '0';
}
if (padding_length > i)
{
n = padding_length - i - 1;
@ -312,7 +322,7 @@ ZyanStatus ZydisStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 paddi
ZYAN_CHECK(ZydisStringAppend(string, prefix));
}
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64) || defined(ZYAN_LOONGARCH)
ZYAN_CHECK(ZydisStringAppendDecU64(string, value, padding_length));
#else
if (value & 0xFFFFFFFF00000000)
@ -330,23 +340,27 @@ ZyanStatus ZydisStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 paddi
}
ZyanStatus ZydisStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
ZyanBool uppercase, const ZyanStringView* prefix, const ZyanStringView* suffix)
ZyanBool force_leading_number, ZyanBool uppercase, const ZyanStringView* prefix,
const ZyanStringView* suffix)
{
if (prefix)
{
ZYAN_CHECK(ZydisStringAppend(string, prefix));
}
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
ZYAN_CHECK(ZydisStringAppendHexU64(string, value, padding_length, uppercase));
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64) || defined(ZYAN_LOONGARCH)
ZYAN_CHECK(ZydisStringAppendHexU64(string, value, padding_length, force_leading_number,
uppercase));
#else
if (value & 0xFFFFFFFF00000000)
{
ZYAN_CHECK(ZydisStringAppendHexU64(string, value, padding_length, uppercase));
ZYAN_CHECK(ZydisStringAppendHexU64(string, value, padding_length, force_leading_number,
uppercase));
}
else
{
ZYAN_CHECK(ZydisStringAppendHexU32(string, (ZyanU32)value, padding_length, uppercase));
ZYAN_CHECK(ZydisStringAppendHexU32(string, (ZyanU32)value, padding_length,
force_leading_number, uppercase));
}
#endif

View File

@ -168,206 +168,4 @@ ZyanStatus ZydisCalcAbsoluteAddressEx(const ZydisDecodedInstruction* instruction
}
}
/* ---------------------------------------------------------------------------------------------- */
/* Accessed CPU flags */
/* ---------------------------------------------------------------------------------------------- */
ZyanStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruction,
ZydisCPUFlagAction action, ZydisCPUFlags* flags)
{
if (!instruction || !flags)
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
*flags = 0;
for (ZyanUSize i = 0; i < ZYAN_ARRAY_LENGTH(instruction->accessed_flags); ++i)
{
if (instruction->accessed_flags[i].action == action)
{
*flags |= (1 << i);
}
}
return ZYAN_STATUS_SUCCESS;
}
ZyanStatus ZydisGetAccessedFlagsRead(const ZydisDecodedInstruction* instruction,
ZydisCPUFlags* flags)
{
if (!instruction || !flags)
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
*flags = instruction->cpu_flags_read;
return ZYAN_STATUS_SUCCESS;
}
ZyanStatus ZydisGetAccessedFlagsWritten(const ZydisDecodedInstruction* instruction,
ZydisCPUFlags* flags)
{
if (!instruction || !flags)
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
*flags = instruction->cpu_flags_written;
return ZYAN_STATUS_SUCCESS;
}
/* ---------------------------------------------------------------------------------------------- */
/* Instruction segments */
/* ---------------------------------------------------------------------------------------------- */
ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* instruction,
ZydisInstructionSegments* segments)
{
if (!instruction || !segments)
{
return ZYAN_STATUS_INVALID_ARGUMENT;
}
ZYAN_MEMSET(segments, 0, sizeof(*segments));
// Legacy prefixes and `REX`
if (instruction->raw.prefix_count)
{
const ZyanU8 rex_offset = (instruction->attributes & ZYDIS_ATTRIB_HAS_REX) ? 1 : 0;
if (!rex_offset || (instruction->raw.prefix_count > 1))
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_PREFIXES;
segments->segments[segments->count ].offset = 0;
segments->segments[segments->count++].size =
instruction->raw.prefix_count - rex_offset;
}
if (rex_offset)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_REX;
segments->segments[segments->count ].offset =
instruction->raw.prefix_count - rex_offset;
segments->segments[segments->count++].size = 1;
}
}
// Encoding prefixes
ZydisInstructionSegment segment_type = ZYDIS_INSTR_SEGMENT_NONE;
ZyanU8 segment_offset = 0;
ZyanU8 segment_size = 0;
switch (instruction->encoding)
{
case ZYDIS_INSTRUCTION_ENCODING_XOP:
segment_type = ZYDIS_INSTR_SEGMENT_XOP;
segment_offset = instruction->raw.xop.offset;
segment_size = 3;
break;
case ZYDIS_INSTRUCTION_ENCODING_VEX:
segment_type = ZYDIS_INSTR_SEGMENT_VEX;
segment_offset = instruction->raw.vex.offset;
segment_size = instruction->raw.vex.size;
break;
case ZYDIS_INSTRUCTION_ENCODING_EVEX:
segment_type = ZYDIS_INSTR_SEGMENT_EVEX;
segment_offset = instruction->raw.evex.offset;
segment_size = 4;
break;
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
segment_type = ZYDIS_INSTR_SEGMENT_MVEX;
segment_offset = instruction->raw.mvex.offset;
segment_size = 4;
break;
default:
break;
}
if (segment_type)
{
segments->segments[segments->count ].type = segment_type;
segments->segments[segments->count ].offset = segment_offset;
segments->segments[segments->count++].size = segment_size;
}
// Opcode
segment_size = 1;
if ((instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_LEGACY) ||
(instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_3DNOW))
{
switch (instruction->opcode_map)
{
case ZYDIS_OPCODE_MAP_DEFAULT:
break;
case ZYDIS_OPCODE_MAP_0F:
ZYAN_FALLTHROUGH;
case ZYDIS_OPCODE_MAP_0F0F:
segment_size = 2;
break;
case ZYDIS_OPCODE_MAP_0F38:
ZYAN_FALLTHROUGH;
case ZYDIS_OPCODE_MAP_0F3A:
segment_size = 3;
break;
default:
ZYAN_UNREACHABLE;
}
}
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_OPCODE;
if (segments->count)
{
segments->segments[segments->count].offset =
segments->segments[segments->count - 1].offset +
segments->segments[segments->count - 1].size;
} else
{
segments->segments[segments->count].offset = 0;
}
segments->segments[segments->count++].size = segment_size;
// ModRM
if (instruction->attributes & ZYDIS_ATTRIB_HAS_MODRM)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_MODRM;
segments->segments[segments->count ].offset = instruction->raw.modrm.offset;
segments->segments[segments->count++].size = 1;
}
// SIB
if (instruction->attributes & ZYDIS_ATTRIB_HAS_SIB)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_SIB;
segments->segments[segments->count ].offset = instruction->raw.sib.offset;
segments->segments[segments->count++].size = 1;
}
// Displacement
if (instruction->raw.disp.size)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_DISPLACEMENT;
segments->segments[segments->count ].offset = instruction->raw.disp.offset;
segments->segments[segments->count++].size = instruction->raw.disp.size / 8;
}
// Immediates
for (ZyanU8 i = 0; i < 2; ++i)
{
if (instruction->raw.imm[i].size)
{
segments->segments[segments->count ].type = ZYDIS_INSTR_SEGMENT_IMMEDIATE;
segments->segments[segments->count ].offset = instruction->raw.imm[i].offset;
segments->segments[segments->count++].size = instruction->raw.imm[i].size / 8;
}
}
if (instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_3DNOW)
{
segments->segments[segments->count].type = ZYDIS_INSTR_SEGMENT_OPCODE;
segments->segments[segments->count].offset = instruction->length -1;
segments->segments[segments->count++].size = 1;
}
return ZYAN_STATUS_SUCCESS;
}
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */

View File

@ -44,6 +44,12 @@ ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature)
return ZYAN_STATUS_TRUE;
#else
return ZYAN_STATUS_FALSE;
#endif
case ZYDIS_FEATURE_ENCODER:
#ifndef ZYDIS_DISABLE_ENCODER
return ZYAN_STATUS_TRUE;
#else
return ZYAN_STATUS_FALSE;
#endif
case ZYDIS_FEATURE_FORMATTER:
#ifndef ZYDIS_DISABLE_FORMATTER
@ -65,6 +71,13 @@ ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature)
return ZYAN_STATUS_FALSE;
#endif
case ZYDIS_FEATURE_SEGMENT:
#ifndef ZYDIS_DISABLE_SEGMENT
return ZYAN_STATUS_TRUE;
#else
return ZYAN_STATUS_FALSE;
#endif
default:
return ZYAN_STATUS_INVALID_ARGUMENT;
}

View File

@ -31,11 +31,6 @@
</PropertyGroup>
<ItemGroup>
<ClCompile Include="dependencies\zycore\src\Allocator.c" />
<ClCompile Include="dependencies\zycore\src\API\Memory.c" />
<ClCompile Include="dependencies\zycore\src\API\Process.c" />
<ClCompile Include="dependencies\zycore\src\API\Synchronization.c" />
<ClCompile Include="dependencies\zycore\src\API\Terminal.c" />
<ClCompile Include="dependencies\zycore\src\API\Thread.c" />
<ClCompile Include="dependencies\zycore\src\ArgParse.c" />
<ClCompile Include="dependencies\zycore\src\Bitset.c" />
<ClCompile Include="dependencies\zycore\src\Format.c" />
@ -43,16 +38,25 @@
<ClCompile Include="dependencies\zycore\src\String.c" />
<ClCompile Include="dependencies\zycore\src\Vector.c" />
<ClCompile Include="dependencies\zycore\src\Zycore.c" />
<ClCompile Include="dependencies\zycore\src\API\Memory.c" />
<ClCompile Include="dependencies\zycore\src\API\Process.c" />
<ClCompile Include="dependencies\zycore\src\API\Synchronization.c" />
<ClCompile Include="dependencies\zycore\src\API\Terminal.c" />
<ClCompile Include="dependencies\zycore\src\API\Thread.c" />
<ClCompile Include="src\Decoder.c" />
<ClCompile Include="src\DecoderData.c" />
<ClCompile Include="src\Formatter.c" />
<ClCompile Include="src\Disassembler.c" />
<ClCompile Include="src\Encoder.c" />
<ClCompile Include="src\EncoderData.c" />
<ClCompile Include="src\FormatterATT.c" />
<ClCompile Include="src\FormatterBase.c" />
<ClCompile Include="src\FormatterBuffer.c" />
<ClCompile Include="src\Formatter.c" />
<ClCompile Include="src\FormatterIntel.c" />
<ClCompile Include="src\MetaInfo.c" />
<ClCompile Include="src\Mnemonic.c" />
<ClCompile Include="src\Register.c" />
<ClCompile Include="src\Segment.c" />
<ClCompile Include="src\SharedData.c" />
<ClCompile Include="src\String.c" />
<ClCompile Include="src\Utils.c" />
@ -61,31 +65,28 @@
<ItemGroup>
<None Include="src\Generated\AccessedFlags.inc" />
<None Include="src\Generated\DecoderTables.inc" />
<None Include="src\Generated\EncoderTables.inc" />
<None Include="src\Generated\EnumInstructionCategory.inc" />
<None Include="src\Generated\EnumISAExt.inc" />
<None Include="src\Generated\EnumISASet.inc" />
<None Include="src\Generated\EnumMnemonic.inc" />
<None Include="src\Generated\EnumRegister.inc" />
<None Include="src\Generated\FormatterStrings.inc" />
<None Include="src\Generated\GetRelInfo.inc" />
<None Include="src\Generated\InstructionDefinitions.inc" />
<None Include="src\Generated\InstructionEncodings.inc" />
<None Include="src\Generated\OperandDefinitions.inc" />
<None Include="src\Generated\RegisterClassLookup.inc" />
<None Include="src\Generated\RegisterLookup.inc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="dependencies\zycore\include\Zycore\Allocator.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Memory.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Process.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Synchronization.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Terminal.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Thread.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\ArgParse.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Atomic.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Bitset.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Comparison.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Defines.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Format.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Internal\AtomicGNU.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Internal\AtomicMSVC.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\LibC.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\List.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Object.h" />
@ -94,33 +95,45 @@
<ClInclude Include="dependencies\zycore\include\Zycore\Types.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Vector.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Zycore.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Memory.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Process.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Synchronization.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Terminal.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Thread.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Internal\AtomicGNU.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Internal\AtomicMSVC.h" />
<ClInclude Include="include\Zydis\Decoder.h" />
<ClInclude Include="include\Zydis\DecoderTypes.h" />
<ClInclude Include="include\Zydis\Formatter.h" />
<ClInclude Include="include\Zydis\Defines.h" />
<ClInclude Include="include\Zydis\Disassembler.h" />
<ClInclude Include="include\Zydis\Encoder.h" />
<ClInclude Include="include\Zydis\FormatterBuffer.h" />
<ClInclude Include="include\Zydis\Formatter.h" />
<ClInclude Include="include\Zydis\MetaInfo.h" />
<ClInclude Include="include\Zydis\Mnemonic.h" />
<ClInclude Include="include\Zydis\Register.h" />
<ClInclude Include="include\Zydis\Segment.h" />
<ClInclude Include="include\Zydis\SharedTypes.h" />
<ClInclude Include="include\Zydis\ShortString.h" />
<ClInclude Include="include\Zydis\Status.h" />
<ClInclude Include="include\Zydis\Utils.h" />
<ClInclude Include="include\Zydis\Zydis.h" />
<ClInclude Include="include\Zydis\Generated\EnumInstructionCategory.h" />
<ClInclude Include="include\Zydis\Generated\EnumISAExt.h" />
<ClInclude Include="include\Zydis\Generated\EnumISASet.h" />
<ClInclude Include="include\Zydis\Generated\EnumMnemonic.h" />
<ClInclude Include="include\Zydis\Generated\EnumRegister.h" />
<ClInclude Include="include\Zydis\Internal\DecoderData.h" />
<ClInclude Include="include\Zydis\Internal\EncoderData.h" />
<ClInclude Include="include\Zydis\Internal\FormatterATT.h" />
<ClInclude Include="include\Zydis\Internal\FormatterBase.h" />
<ClInclude Include="include\Zydis\Internal\FormatterIntel.h" />
<ClInclude Include="include\Zydis\Internal\SharedData.h" />
<ClInclude Include="include\Zydis\Internal\String.h" />
<ClInclude Include="include\Zydis\MetaInfo.h" />
<ClInclude Include="include\Zydis\Mnemonic.h" />
<ClInclude Include="include\Zydis\Register.h" />
<ClInclude Include="include\Zydis\SharedTypes.h" />
<ClInclude Include="include\Zydis\ShortString.h" />
<ClInclude Include="include\Zydis\Status.h" />
<ClInclude Include="include\Zydis\Utils.h" />
<ClInclude Include="include\Zydis\Zydis.h" />
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>ZYCORE_STATIC_BUILD;ZYDIS_STATIC_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<AdditionalIncludeDirectories>$(ProjectDir)src;$(ProjectDir)include;$(ProjectDir)dependencies\zycore\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>

View File

@ -1,25 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="src\Mnemonic.c" />
<ClCompile Include="src\Register.c" />
<ClCompile Include="src\SharedData.c" />
<ClCompile Include="src\String.c" />
<ClCompile Include="src\Utils.c" />
<ClCompile Include="src\Zydis.c" />
<ClCompile Include="src\Decoder.c" />
<ClCompile Include="src\DecoderData.c" />
<ClCompile Include="src\Formatter.c" />
<ClCompile Include="src\FormatterATT.c" />
<ClCompile Include="src\FormatterBase.c" />
<ClCompile Include="src\FormatterBuffer.c" />
<ClCompile Include="src\FormatterIntel.c" />
<ClCompile Include="src\MetaInfo.c" />
<ClCompile Include="dependencies\zycore\src\API\Synchronization.c" />
<ClCompile Include="dependencies\zycore\src\API\Terminal.c" />
<ClCompile Include="dependencies\zycore\src\API\Thread.c" />
<ClCompile Include="dependencies\zycore\src\API\Memory.c" />
<ClCompile Include="dependencies\zycore\src\API\Process.c" />
<ClCompile Include="dependencies\zycore\src\Allocator.c" />
<ClCompile Include="dependencies\zycore\src\ArgParse.c" />
<ClCompile Include="dependencies\zycore\src\Bitset.c" />
@ -28,44 +9,31 @@
<ClCompile Include="dependencies\zycore\src\String.c" />
<ClCompile Include="dependencies\zycore\src\Vector.c" />
<ClCompile Include="dependencies\zycore\src\Zycore.c" />
<ClCompile Include="dependencies\zycore\src\API\Memory.c" />
<ClCompile Include="dependencies\zycore\src\API\Process.c" />
<ClCompile Include="dependencies\zycore\src\API\Synchronization.c" />
<ClCompile Include="dependencies\zycore\src\API\Terminal.c" />
<ClCompile Include="dependencies\zycore\src\API\Thread.c" />
<ClCompile Include="src\Decoder.c" />
<ClCompile Include="src\DecoderData.c" />
<ClCompile Include="src\Disassembler.c" />
<ClCompile Include="src\Encoder.c" />
<ClCompile Include="src\EncoderData.c" />
<ClCompile Include="src\FormatterATT.c" />
<ClCompile Include="src\FormatterBase.c" />
<ClCompile Include="src\FormatterBuffer.c" />
<ClCompile Include="src\Formatter.c" />
<ClCompile Include="src\FormatterIntel.c" />
<ClCompile Include="src\MetaInfo.c" />
<ClCompile Include="src\Mnemonic.c" />
<ClCompile Include="src\Register.c" />
<ClCompile Include="src\Segment.c" />
<ClCompile Include="src\SharedData.c" />
<ClCompile Include="src\String.c" />
<ClCompile Include="src\Utils.c" />
<ClCompile Include="src\Zydis.c" />
</ItemGroup>
<ItemGroup>
<None Include="src\Generated\EnumISAExt.inc" />
<None Include="src\Generated\EnumISASet.inc" />
<None Include="src\Generated\EnumMnemonic.inc" />
<None Include="src\Generated\EnumRegister.inc" />
<None Include="src\Generated\FormatterStrings.inc" />
<None Include="src\Generated\InstructionDefinitions.inc" />
<None Include="src\Generated\InstructionEncodings.inc" />
<None Include="src\Generated\OperandDefinitions.inc" />
<None Include="src\Generated\AccessedFlags.inc" />
<None Include="src\Generated\DecoderTables.inc" />
<None Include="src\Generated\EnumInstructionCategory.inc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Zydis\Mnemonic.h" />
<ClInclude Include="include\Zydis\Register.h" />
<ClInclude Include="include\Zydis\SharedTypes.h" />
<ClInclude Include="include\Zydis\ShortString.h" />
<ClInclude Include="include\Zydis\Status.h" />
<ClInclude Include="include\Zydis\Utils.h" />
<ClInclude Include="include\Zydis\Zydis.h" />
<ClInclude Include="include\Zydis\Decoder.h" />
<ClInclude Include="include\Zydis\DecoderTypes.h" />
<ClInclude Include="include\Zydis\Formatter.h" />
<ClInclude Include="include\Zydis\FormatterBuffer.h" />
<ClInclude Include="include\Zydis\MetaInfo.h" />
<ClInclude Include="include\Zydis\Internal\FormatterIntel.h" />
<ClInclude Include="include\Zydis\Internal\SharedData.h" />
<ClInclude Include="include\Zydis\Internal\String.h" />
<ClInclude Include="include\Zydis\Internal\DecoderData.h" />
<ClInclude Include="include\Zydis\Internal\FormatterATT.h" />
<ClInclude Include="include\Zydis\Internal\FormatterBase.h" />
<ClInclude Include="include\Zydis\Generated\EnumISASet.h" />
<ClInclude Include="include\Zydis\Generated\EnumMnemonic.h" />
<ClInclude Include="include\Zydis\Generated\EnumRegister.h" />
<ClInclude Include="include\Zydis\Generated\EnumInstructionCategory.h" />
<ClInclude Include="include\Zydis\Generated\EnumISAExt.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Allocator.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\ArgParse.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Atomic.h" />
@ -81,12 +49,57 @@
<ClInclude Include="dependencies\zycore\include\Zycore\Types.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Vector.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Zycore.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Internal\AtomicMSVC.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Internal\AtomicGNU.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Memory.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Process.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Synchronization.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Terminal.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Thread.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Memory.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\API\Process.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Internal\AtomicGNU.h" />
<ClInclude Include="dependencies\zycore\include\Zycore\Internal\AtomicMSVC.h" />
<ClInclude Include="include\Zydis\Decoder.h" />
<ClInclude Include="include\Zydis\DecoderTypes.h" />
<ClInclude Include="include\Zydis\Defines.h" />
<ClInclude Include="include\Zydis\Disassembler.h" />
<ClInclude Include="include\Zydis\Encoder.h" />
<ClInclude Include="include\Zydis\FormatterBuffer.h" />
<ClInclude Include="include\Zydis\Formatter.h" />
<ClInclude Include="include\Zydis\MetaInfo.h" />
<ClInclude Include="include\Zydis\Mnemonic.h" />
<ClInclude Include="include\Zydis\Register.h" />
<ClInclude Include="include\Zydis\Segment.h" />
<ClInclude Include="include\Zydis\SharedTypes.h" />
<ClInclude Include="include\Zydis\ShortString.h" />
<ClInclude Include="include\Zydis\Status.h" />
<ClInclude Include="include\Zydis\Utils.h" />
<ClInclude Include="include\Zydis\Zydis.h" />
<ClInclude Include="include\Zydis\Generated\EnumInstructionCategory.h" />
<ClInclude Include="include\Zydis\Generated\EnumISAExt.h" />
<ClInclude Include="include\Zydis\Generated\EnumISASet.h" />
<ClInclude Include="include\Zydis\Generated\EnumMnemonic.h" />
<ClInclude Include="include\Zydis\Generated\EnumRegister.h" />
<ClInclude Include="include\Zydis\Internal\DecoderData.h" />
<ClInclude Include="include\Zydis\Internal\EncoderData.h" />
<ClInclude Include="include\Zydis\Internal\FormatterATT.h" />
<ClInclude Include="include\Zydis\Internal\FormatterBase.h" />
<ClInclude Include="include\Zydis\Internal\FormatterIntel.h" />
<ClInclude Include="include\Zydis\Internal\SharedData.h" />
<ClInclude Include="include\Zydis\Internal\String.h" />
</ItemGroup>
<ItemGroup>
<None Include="src\Generated\AccessedFlags.inc" />
<None Include="src\Generated\DecoderTables.inc" />
<None Include="src\Generated\EncoderTables.inc" />
<None Include="src\Generated\EnumInstructionCategory.inc" />
<None Include="src\Generated\EnumISAExt.inc" />
<None Include="src\Generated\EnumISASet.inc" />
<None Include="src\Generated\EnumMnemonic.inc" />
<None Include="src\Generated\EnumRegister.inc" />
<None Include="src\Generated\FormatterStrings.inc" />
<None Include="src\Generated\GetRelInfo.inc" />
<None Include="src\Generated\InstructionDefinitions.inc" />
<None Include="src\Generated\InstructionEncodings.inc" />
<None Include="src\Generated\OperandDefinitions.inc" />
<None Include="src\Generated\RegisterClassLookup.inc" />
<None Include="src\Generated\RegisterLookup.inc" />
</ItemGroup>
</Project>

View File

@ -64,7 +64,7 @@
<ForcedIncludeFiles>PrecompiledHeader.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<PreprocessorDefinitions>C4_NO_DEBUG_BREAK;ST_NO_EXCEPTION_HANDLING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'!='ARM64'">ENABLE_RAINTEGRATION;ENABLE_OPENGL;ENABLE_VULKAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">XBYAK_NO_EXCEPTION;ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">XBYAK_NO_EXCEPTION;ZYCORE_STATIC_BUILD;ZYDIS_STATIC_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">VIXL_INCLUDE_TARGET_AARCH64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>
</ClCompile>
@ -1021,6 +1021,9 @@
<ProjectReference Include="..\3rdparty\ccc\ccc.vcxproj">
<Project>{2589f8ce-ea77-4b73-911e-64074569795b}</Project>
</ProjectReference>
<ProjectReference Include="..\3rdparty\zydis\zydis.vcxproj" Condition="'$(Platform)'=='x64'">
<Project>{67d0160c-0fe4-44b9-ac2e-82bbcf4104df}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Natvis Include="GS\GS.natvis" />

View File

@ -1416,17 +1416,16 @@ void psxRecompileNextInstruction(bool delayslot, bool swapped_delayslot)
#ifdef DUMP_BLOCKS
const bool dump_block = true;
const u8* instStart = x86Ptr;
const u8* inst_start = x86Ptr;
ZydisDecoder disas_decoder;
ZydisFormatter disas_formatter;
ZydisDecodedInstruction disas_instruction;
if (dump_block)
{
fprintf(stderr, "Compiling %s%s\n", delayslot ? "delay slot " : "", disR3000AF(iopMemRead32(psxpc), psxpc));
if (!delayslot)
{
ZydisDecoderInit(&disas_decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_ADDRESS_WIDTH_64);
ZydisDecoderInit(&disas_decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_STACK_WIDTH_64);
ZydisFormatterInit(&disas_formatter, ZYDIS_FORMATTER_STYLE_INTEL);
s_old_print_address = (ZydisFormatterFunc)&ZydisFormatterPrintAddressAbsolute;
ZydisFormatterSetHook(&disas_formatter, ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS, (const void**)&s_old_print_address);
@ -1472,16 +1471,30 @@ void psxRecompileNextInstruction(bool delayslot, bool swapped_delayslot)
#ifdef DUMP_BLOCKS
if (dump_block && !delayslot)
{
const u8* instPtr = instStart;
ZyanUSize instLength = static_cast<ZyanUSize>(x86Ptr - instStart);
while (ZYAN_SUCCESS(ZydisDecoderDecodeBuffer(&disas_decoder, instPtr, instLength, &disas_instruction)))
const u8* inst_ptr = inst_start;
ZyanUSize inst_length = static_cast<ZyanUSize>(x86Ptr - inst_start);
ZydisDecodedInstruction instruction;
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
while (ZYAN_SUCCESS(ZydisDecoderDecodeFull(&disas_decoder, inst_ptr, inst_length, &instruction, operands)))
{
char buffer[256];
if (ZYAN_SUCCESS(ZydisFormatterFormatInstruction(&disas_formatter, &disas_instruction, buffer, sizeof(buffer), (ZyanU64)instPtr)))
std::fprintf(stderr, " %016" PRIX64 " %s\n", (u64)instPtr, buffer);
ZyanStatus status = ZydisFormatterFormatInstruction(
&disas_formatter,
&instruction,
operands,
instruction.operand_count,
buffer,
sizeof(buffer),
reinterpret_cast<ZyanU64>(inst_ptr),
nullptr);
instPtr += disas_instruction.length;
instLength -= disas_instruction.length;
if (ZYAN_SUCCESS(status))
std::fprintf(stderr, " %016" PRIX64 " %s\n", reinterpret_cast<u64>(inst_ptr), buffer);
inst_ptr += instruction.length;
inst_length -= instruction.length;
}
}
#endif

View File

@ -2561,7 +2561,7 @@ StartRecomp:
#ifdef DUMP_BLOCKS
ZydisDecoder disas_decoder;
ZydisDecoderInit(&disas_decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_ADDRESS_WIDTH_64);
ZydisDecoderInit(&disas_decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_STACK_WIDTH_64);
ZydisFormatter disas_formatter;
ZydisFormatterInit(&disas_formatter, ZYDIS_FORMATTER_STYLE_INTEL);
@ -2569,7 +2569,6 @@ StartRecomp:
s_old_print_address = (ZydisFormatterFunc)&ZydisFormatterPrintAddressAbsolute;
ZydisFormatterSetHook(&disas_formatter, ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS, (const void**)&s_old_print_address);
ZydisDecodedInstruction disas_instruction;
#if 0
const bool dump_block = (startpc == 0x00000000);
#elif 1
@ -2598,19 +2597,33 @@ StartRecomp:
disR5900Fasm(disasm, *(u32*)PSM(pc), pc, false);
fprintf(stderr, "Compiling %08X %s\n", pc, disasm.c_str());
const u8* instStart = x86Ptr;
const u8* inst_start = x86Ptr;
recompileNextInstruction(false, false);
const u8* instPtr = instStart;
ZyanUSize instLength = static_cast<ZyanUSize>(x86Ptr - instStart);
while (ZYAN_SUCCESS(ZydisDecoderDecodeBuffer(&disas_decoder, instPtr, instLength, &disas_instruction)))
const u8* inst_ptr = inst_start;
ZyanUSize inst_length = static_cast<ZyanUSize>(x86Ptr - inst_start);
ZydisDecodedInstruction instruction;
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
while (ZYAN_SUCCESS(ZydisDecoderDecodeFull(&disas_decoder, inst_ptr, inst_length, &instruction, operands)))
{
char buffer[256];
if (ZYAN_SUCCESS(ZydisFormatterFormatInstruction(&disas_formatter, &disas_instruction, buffer, sizeof(buffer), (ZyanU64)instPtr)))
std::fprintf(stderr, " %016" PRIX64 " %s\n", (u64)instPtr, buffer);
ZyanStatus status = ZydisFormatterFormatInstruction(
&disas_formatter,
&instruction,
operands,
instruction.operand_count,
buffer,
sizeof(buffer),
reinterpret_cast<ZyanU64>(inst_ptr),
nullptr);
instPtr += disas_instruction.length;
instLength -= disas_instruction.length;
if (ZYAN_SUCCESS(status))
std::fprintf(stderr, " %016" PRIX64 " %s\n", reinterpret_cast<u64>(inst_ptr), buffer);
inst_ptr += instruction.length;
inst_length -= instruction.length;
}
}
else